src/HOL/Multivariate_Analysis/Integration.thy
author paulson <lp15@cam.ac.uk>
Tue, 10 Nov 2015 14:18:41 +0000
changeset 61609 77b453bd616f
parent 61524 f2e51e704a96
child 61649 268d88ec9087
child 61659 ffee6aea0ff2
permissions -rw-r--r--
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
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
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
     5
section \<open>Kurzweil-Henstock Gauge Integration in many dimensions.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
     6
35292
e4a431b6d9b7 Replaced Integration by Multivariate-Analysis/Real_Integration
hoelzl
parents: 35291
diff changeset
     7
theory Integration
41413
64cd30d6b0b8 explicit file specifications -- avoid secondary load path;
wenzelm
parents: 40513
diff changeset
     8
imports
64cd30d6b0b8 explicit file specifications -- avoid secondary load path;
wenzelm
parents: 40513
diff changeset
     9
  Derivative
61243
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
    10
  Uniform_Limit
41413
64cd30d6b0b8 explicit file specifications -- avoid secondary load path;
wenzelm
parents: 40513
diff changeset
    11
  "~~/src/HOL/Library/Indicator_Function"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
    12
begin
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
    13
60810
9ede42599eeb tweaks. Got rid of a really slow step
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
    14
lemma cSup_abs_le: (* TODO: move to Conditionally_Complete_Lattices.thy? *)
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    15
  fixes S :: "real set"
60810
9ede42599eeb tweaks. Got rid of a really slow step
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
    16
  shows "S \<noteq> {} \<Longrightarrow> (\<And>x. x\<in>S \<Longrightarrow> \<bar>x\<bar> \<le> a) \<Longrightarrow> \<bar>Sup S\<bar> \<le> a"
54258
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
    17
  by (auto simp add: abs_le_interval_iff intro: cSup_least) (metis cSup_upper2 bdd_aboveI)
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    18
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
    19
lemma cInf_abs_ge:
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    20
  fixes S :: "real set"
60810
9ede42599eeb tweaks. Got rid of a really slow step
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
    21
  shows "S \<noteq> {} \<Longrightarrow> (\<And>x. x\<in>S \<Longrightarrow> \<bar>x\<bar> \<le> a) \<Longrightarrow> \<bar>Inf S\<bar> \<le> a"
9ede42599eeb tweaks. Got rid of a really slow step
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
    22
  using cSup_abs_le [of "uminus ` S"]
9ede42599eeb tweaks. Got rid of a really slow step
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
    23
  by (fastforce simp add: Inf_real_def)
9ede42599eeb tweaks. Got rid of a really slow step
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
    24
9ede42599eeb tweaks. Got rid of a really slow step
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
    25
lemma cSup_asclose:
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
    26
  fixes S :: "real set"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    27
  assumes S: "S \<noteq> {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    28
    and b: "\<forall>x\<in>S. \<bar>x - l\<bar> \<le> e"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    29
  shows "\<bar>Sup S - l\<bar> \<le> e"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    30
proof -
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    31
  have th: "\<And>(x::real) l e. \<bar>x - l\<bar> \<le> e \<longleftrightarrow> l - e \<le> x \<and> x \<le> l + e"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    32
    by arith
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
    33
  have "bdd_above S"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
    34
    using b by (auto intro!: bdd_aboveI[of _ "l + e"])
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
    35
  with S b show ?thesis
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
    36
    unfolding th by (auto intro!: cSup_upper2 cSup_least)
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    37
qed
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    38
60810
9ede42599eeb tweaks. Got rid of a really slow step
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
    39
lemma cInf_asclose:
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    40
  fixes S :: "real set"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    41
  assumes S: "S \<noteq> {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    42
    and b: "\<forall>x\<in>S. \<bar>x - l\<bar> \<le> e"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    43
  shows "\<bar>Inf S - l\<bar> \<le> e"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    44
proof -
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    45
  have "\<bar>- Sup (uminus ` S) - l\<bar> =  \<bar>Sup (uminus ` S) - (-l)\<bar>"
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    46
    by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    47
  also have "\<dots> \<le> e"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    48
    apply (rule cSup_asclose)
54230
b1d955791529 more simplification rules on unary and binary minus
haftmann
parents: 53842
diff changeset
    49
    using abs_minus_add_cancel b by (auto simp add: S)
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    50
  finally have "\<bar>- Sup (uminus ` S) - l\<bar> \<le> e" .
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    51
  then show ?thesis
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    52
    by (simp add: Inf_real_def)
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    53
qed
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    54
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    55
lemma cSup_finite_ge_iff:
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    56
  fixes S :: "real set"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    57
  shows "finite S \<Longrightarrow> S \<noteq> {} \<Longrightarrow> a \<le> Sup S \<longleftrightarrow> (\<exists>x\<in>S. a \<le> x)"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    58
  by (metis cSup_eq_Max Max_ge_iff)
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
    59
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    60
lemma cSup_finite_le_iff:
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    61
  fixes S :: "real set"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    62
  shows "finite S \<Longrightarrow> S \<noteq> {} \<Longrightarrow> a \<ge> Sup S \<longleftrightarrow> (\<forall>x\<in>S. a \<ge> x)"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    63
  by (metis cSup_eq_Max Max_le_iff)
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    64
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    65
lemma cInf_finite_ge_iff:
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    66
  fixes S :: "real set"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    67
  shows "finite S \<Longrightarrow> S \<noteq> {} \<Longrightarrow> a \<le> Inf S \<longleftrightarrow> (\<forall>x\<in>S. a \<le> x)"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    68
  by (metis cInf_eq_Min Min_ge_iff)
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    69
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    70
lemma cInf_finite_le_iff:
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    71
  fixes S :: "real set"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    72
  shows "finite S \<Longrightarrow> S \<noteq> {} \<Longrightarrow> a \<ge> Inf S \<longleftrightarrow> (\<exists>x\<in>S. a \<ge> x)"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    73
  by (metis cInf_eq_Min Min_le_iff)
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
    74
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
    75
(*declare not_less[simp] not_le[simp]*)
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
    76
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
    77
lemmas scaleR_simps = scaleR_zero_left scaleR_minus_left scaleR_left_diff_distrib
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
    78
  scaleR_zero_right scaleR_minus_right scaleR_right_diff_distrib scaleR_eq_0_iff
44282
f0de18b62d63 remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents: 44176
diff changeset
    79
  scaleR_cancel_left scaleR_cancel_right scaleR_add_right scaleR_add_left real_vector_class.scaleR_one
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
    80
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
    81
lemma real_arch_invD:
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
    82
  "0 < (e::real) \<Longrightarrow> (\<exists>n::nat. n \<noteq> 0 \<and> 0 < inverse (real n) \<and> inverse (real n) < e)"
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
    83
  by (subst(asm) real_arch_inv)
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
    84
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
    85
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
    86
subsection \<open>Sundries\<close>
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
    87
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
    88
lemma conjunctD2: assumes "a \<and> b" shows a b using assms by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
    89
lemma conjunctD3: assumes "a \<and> b \<and> c" shows a b c using assms by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
    90
lemma conjunctD4: assumes "a \<and> b \<and> c \<and> d" shows a b c d using assms by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
    91
lemma conjunctD5: assumes "a \<and> b \<and> c \<and> d \<and> e" shows a b c d e using assms by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
    92
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    93
declare norm_triangle_ineq4[intro]
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    94
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    95
lemma simple_image: "{f x |x . x \<in> s} = f ` s"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    96
  by blast
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
    97
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
    98
lemma linear_simps:
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
    99
  assumes "bounded_linear f"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   100
  shows
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   101
    "f (a + b) = f a + f b"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   102
    "f (a - b) = f a - f b"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   103
    "f 0 = 0"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   104
    "f (- a) = - f a"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   105
    "f (s *\<^sub>R v) = s *\<^sub>R (f v)"
53600
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53597
diff changeset
   106
proof -
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53597
diff changeset
   107
  interpret f: bounded_linear f by fact
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53597
diff changeset
   108
  show "f (a + b) = f a + f b" by (rule f.add)
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53597
diff changeset
   109
  show "f (a - b) = f a - f b" by (rule f.diff)
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53597
diff changeset
   110
  show "f 0 = 0" by (rule f.zero)
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53597
diff changeset
   111
  show "f (- a) = - f a" by (rule f.minus)
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53597
diff changeset
   112
  show "f (s *\<^sub>R v) = s *\<^sub>R (f v)" by (rule f.scaleR)
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53597
diff changeset
   113
qed
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   114
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   115
lemma bounded_linearI:
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   116
  assumes "\<And>x y. f (x + y) = f x + f y"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   117
    and "\<And>r x. f (r *\<^sub>R x) = r *\<^sub>R f x"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   118
    and "\<And>x. norm (f x) \<le> norm x * K"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   119
  shows "bounded_linear f"
53600
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53597
diff changeset
   120
  using assms by (rule bounded_linear_intro) (* FIXME: duplicate *)
51348
011c97ba3b3d move lemma Inf to usage point
hoelzl
parents: 50945
diff changeset
   121
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
   122
lemma bounded_linear_component [intro]: "bounded_linear (\<lambda>x::'a::euclidean_space. x \<bullet> k)"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
   123
  by (rule bounded_linear_inner_left)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   124
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   125
lemma transitive_stepwise_lt_eq:
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   126
  assumes "(\<And>x y z::nat. R x y \<Longrightarrow> R y z \<Longrightarrow> R x z)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   127
  shows "((\<forall>m. \<forall>n>m. R m n) \<longleftrightarrow> (\<forall>n. R n (Suc n)))"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   128
  (is "?l = ?r")
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   129
proof safe
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   130
  assume ?r
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   131
  fix n m :: nat
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   132
  assume "m < n"
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   133
  then show "R m n"
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   134
  proof (induct n arbitrary: m)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   135
    case 0
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   136
    then show ?case by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   137
  next
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   138
    case (Suc n)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   139
    show ?case
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   140
    proof (cases "m < n")
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   141
      case True
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   142
      show ?thesis
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   143
        apply (rule assms[OF Suc(1)[OF True]])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
   144
        using \<open>?r\<close>
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   145
        apply auto
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   146
        done
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   147
    next
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   148
      case False
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   149
      then have "m = n"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   150
        using Suc(2) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   151
      then show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
   152
        using \<open>?r\<close> by auto
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   153
    qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   154
  qed
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   155
qed auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   156
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   157
lemma transitive_stepwise_gt:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   158
  assumes "\<And>x y z. R x y \<Longrightarrow> R y z \<Longrightarrow> R x z" "\<And>n. R n (Suc n)"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   159
  shows "\<forall>n>m. R m n"
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   160
proof -
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   161
  have "\<forall>m. \<forall>n>m. R m n"
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   162
    apply (subst transitive_stepwise_lt_eq)
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
   163
    apply (blast intro: assms)+
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   164
    done
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   165
  then show ?thesis by auto
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   166
qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   167
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   168
lemma transitive_stepwise_le_eq:
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   169
  assumes "\<And>x. R x x" "\<And>x y z. R x y \<Longrightarrow> R y z \<Longrightarrow> R x z"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   170
  shows "(\<forall>m. \<forall>n\<ge>m. R m n) \<longleftrightarrow> (\<forall>n. R n (Suc n))"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   171
  (is "?l = ?r")
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   172
proof safe
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   173
  assume ?r
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   174
  fix m n :: nat
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   175
  assume "m \<le> n"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   176
  then show "R m n"
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   177
  proof (induct n arbitrary: m)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   178
    case 0
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   179
    with assms show ?case by auto
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   180
  next
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   181
    case (Suc n)
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   182
    show ?case
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   183
    proof (cases "m \<le> n")
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   184
      case True
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
   185
      with Suc.hyps \<open>\<forall>n. R n (Suc n)\<close> assms show ?thesis
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
   186
        by blast
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   187
    next
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   188
      case False
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   189
      then have "m = Suc n"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   190
        using Suc(2) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   191
      then show ?thesis
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   192
        using assms(1) by auto
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   193
    qed
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   194
  qed
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   195
qed auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   196
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   197
lemma transitive_stepwise_le:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   198
  assumes "\<And>x. R x x" "\<And>x y z. R x y \<Longrightarrow> R y z \<Longrightarrow> R x z"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   199
    and "\<And>n. R n (Suc n)"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   200
  shows "\<forall>n\<ge>m. R m n"
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   201
proof -
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   202
  have "\<forall>m. \<forall>n\<ge>m. R m n"
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   203
    apply (subst transitive_stepwise_le_eq)
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
   204
    apply (blast intro: assms)+
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   205
    done
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   206
  then show ?thesis by auto
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   207
qed
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   208
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   209
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
   210
subsection \<open>Some useful lemmas about intervals.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   211
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   212
lemma empty_as_interval: "{} = cbox One (0::'a::euclidean_space)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   213
  using nonempty_Basis
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   214
  by (fastforce simp add: set_eq_iff mem_box)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   215
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   216
lemma interior_subset_union_intervals:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   217
  assumes "i = cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   218
    and "j = cbox c d"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   219
    and "interior j \<noteq> {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   220
    and "i \<subseteq> j \<union> s"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   221
    and "interior i \<inter> interior j = {}"
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   222
  shows "interior i \<subseteq> interior s"
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   223
proof -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   224
  have "box a b \<inter> cbox c d = {}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   225
     using inter_interval_mixed_eq_empty[of c d a b] and assms(3,5)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   226
     unfolding assms(1,2) interior_cbox by auto
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   227
  moreover
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   228
  have "box a b \<subseteq> cbox c d \<union> s"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   229
    apply (rule order_trans,rule box_subset_cbox)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   230
    using assms(4) unfolding assms(1,2)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   231
    apply auto
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   232
    done
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   233
  ultimately
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   234
  show ?thesis
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
   235
    unfolding assms interior_cbox
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
   236
      by auto (metis IntI UnE empty_iff interior_maximal open_box subsetCE subsetI)
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   237
qed
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   238
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   239
lemma inter_interior_unions_intervals:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   240
  fixes f::"('a::euclidean_space) set set"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   241
  assumes "finite f"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   242
    and "open s"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   243
    and "\<forall>t\<in>f. \<exists>a b. t = cbox a b"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   244
    and "\<forall>t\<in>f. s \<inter> (interior t) = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   245
  shows "s \<inter> interior (\<Union>f) = {}"
60394
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
   246
proof (clarsimp simp only: all_not_in_conv [symmetric])
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
   247
  fix x
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
   248
  assume x: "x \<in> s" "x \<in> interior (\<Union>f)"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   249
  have lem1: "\<And>x e s U. ball x e \<subseteq> s \<inter> interior U \<longleftrightarrow> ball x e \<subseteq> s \<inter> U"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   250
    using interior_subset
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
   251
    by auto (meson Topology_Euclidean_Space.open_ball contra_subsetD interior_maximal mem_ball)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   252
  have "\<exists>t\<in>f. \<exists>x. \<exists>e>0. ball x e \<subseteq> s \<inter> t"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   253
    if "finite f" and "\<forall>t\<in>f. \<exists>a b. t = cbox a b" and "\<exists>x. x \<in> s \<inter> interior (\<Union>f)" for f
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   254
    using that
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   255
  proof (induct rule: finite_induct)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   256
    case empty
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   257
    obtain x where "x \<in> s \<inter> interior (\<Union>{})"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   258
      using empty(2) ..
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   259
    then have False
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   260
      unfolding Union_empty interior_empty by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   261
    then show ?case by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   262
  next
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   263
    case (insert i f)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   264
    obtain x where x: "x \<in> s \<inter> interior (\<Union>insert i f)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   265
      using insert(5) ..
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   266
    then obtain e where e: "0 < e \<and> ball x e \<subseteq> s \<inter> interior (\<Union>insert i f)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   267
      unfolding open_contains_ball_eq[OF open_Int[OF assms(2) open_interior], rule_format] ..
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   268
    obtain a where "\<exists>b. i = cbox a b"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   269
      using insert(4)[rule_format,OF insertI1] ..
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   270
    then obtain b where ab: "i = cbox a b" ..
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   271
    show ?case
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   272
    proof (cases "x \<in> i")
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   273
      case False
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   274
      then have "x \<in> UNIV - cbox a b"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   275
        unfolding ab by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   276
      then obtain d where "0 < d \<and> ball x d \<subseteq> UNIV - cbox a b"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   277
        unfolding open_contains_ball_eq[OF open_Diff[OF open_UNIV closed_cbox],rule_format] ..
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   278
      then have "0 < d" "ball x (min d e) \<subseteq> UNIV - i"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   279
        unfolding ab ball_min_Int by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   280
      then have "ball x (min d e) \<subseteq> s \<inter> interior (\<Union>f)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   281
        using e unfolding lem1 unfolding  ball_min_Int by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   282
      then have "x \<in> s \<inter> interior (\<Union>f)" using \<open>d>0\<close> e by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   283
      then have "\<exists>t\<in>f. \<exists>x e. 0 < e \<and> ball x e \<subseteq> s \<inter> t"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   284
        using insert.hyps(3) insert.prems(1) by blast
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   285
      then show ?thesis by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   286
    next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   287
      case True show ?thesis
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   288
      proof (cases "x\<in>box a b")
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   289
        case True
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   290
        then obtain d where "0 < d \<and> ball x d \<subseteq> box a b"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   291
          unfolding open_contains_ball_eq[OF open_box,rule_format] ..
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   292
        then show ?thesis
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   293
          apply (rule_tac x=i in bexI, rule_tac x=x in exI, rule_tac x="min d e" in exI)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   294
          unfolding ab
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   295
          using box_subset_cbox[of a b] and e
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   296
          apply fastforce+
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   297
          done
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   298
      next
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   299
        case False
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   300
        then obtain k where "x\<bullet>k \<le> a\<bullet>k \<or> x\<bullet>k \<ge> b\<bullet>k" and k: "k \<in> Basis"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   301
          unfolding mem_box by (auto simp add: not_less)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   302
        then have "x\<bullet>k = a\<bullet>k \<or> x\<bullet>k = b\<bullet>k"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   303
          using True unfolding ab and mem_box
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   304
            apply (erule_tac x = k in ballE)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   305
            apply auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   306
            done
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   307
        then have "\<exists>x. ball x (e/2) \<subseteq> s \<inter> (\<Union>f)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   308
        proof (rule disjE)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   309
          let ?z = "x - (e/2) *\<^sub>R k"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   310
          assume as: "x\<bullet>k = a\<bullet>k"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   311
          have "ball ?z (e / 2) \<inter> i = {}"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   312
          proof (clarsimp simp only: all_not_in_conv [symmetric])
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   313
            fix y
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   314
            assume "y \<in> ball ?z (e / 2)" and yi: "y \<in> i"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   315
            then have "dist ?z y < e/2" by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   316
            then have "\<bar>(?z - y) \<bullet> k\<bar> < e/2"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   317
              using Basis_le_norm[OF k, of "?z - y"] unfolding dist_norm by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   318
            then have "y\<bullet>k < a\<bullet>k"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   319
              using e k
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   320
              by (auto simp add: field_simps abs_less_iff as inner_simps)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   321
            then have "y \<notin> i"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   322
              unfolding ab mem_box by (auto intro!: bexI[OF _ k])
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   323
            then show False using yi by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   324
          qed
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   325
          moreover
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   326
          have "ball ?z (e/2) \<subseteq> s \<inter> (\<Union>insert i f)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   327
            apply (rule order_trans[OF _ e[THEN conjunct2, unfolded lem1]])
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   328
          proof
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   329
            fix y
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   330
            assume as: "y \<in> ball ?z (e/2)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   331
            have "norm (x - y) \<le> \<bar>e\<bar> / 2 + norm (x - y - (e / 2) *\<^sub>R k)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   332
              apply (rule order_trans,rule norm_triangle_sub[of "x - y" "(e/2) *\<^sub>R k"])
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   333
              unfolding norm_scaleR norm_Basis[OF k]
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   334
              apply auto
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   335
              done
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   336
            also have "\<dots> < \<bar>e\<bar> / 2 + \<bar>e\<bar> / 2"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   337
              apply (rule add_strict_left_mono)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   338
              using as e
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   339
              apply (auto simp add: field_simps dist_norm)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   340
              done
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   341
            finally show "y \<in> ball x e"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   342
              unfolding mem_ball dist_norm using e by (auto simp add:field_simps)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   343
          qed
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   344
          ultimately show ?thesis
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   345
            apply (rule_tac x="?z" in exI)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   346
            unfolding Union_insert
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   347
            apply auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   348
            done
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   349
        next
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   350
          let ?z = "x + (e/2) *\<^sub>R k"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   351
          assume as: "x\<bullet>k = b\<bullet>k"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   352
          have "ball ?z (e / 2) \<inter> i = {}"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   353
          proof (clarsimp simp only: all_not_in_conv [symmetric])
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   354
            fix y
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   355
            assume "y \<in> ball ?z (e / 2)" and yi: "y \<in> i"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   356
            then have "dist ?z y < e/2"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   357
              by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   358
            then have "\<bar>(?z - y) \<bullet> k\<bar> < e/2"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   359
              using Basis_le_norm[OF k, of "?z - y"]
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   360
              unfolding dist_norm by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   361
            then have "y\<bullet>k > b\<bullet>k"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   362
              using e k
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   363
              by (auto simp add:field_simps inner_simps inner_Basis as)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   364
            then have "y \<notin> i"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   365
              unfolding ab mem_box by (auto intro!: bexI[OF _ k])
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   366
            then show False using yi by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   367
          qed
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   368
          moreover
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   369
          have "ball ?z (e/2) \<subseteq> s \<inter> (\<Union>insert i f)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   370
            apply (rule order_trans[OF _ e[THEN conjunct2, unfolded lem1]])
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   371
          proof
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   372
            fix y
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   373
            assume as: "y\<in> ball ?z (e/2)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   374
            have "norm (x - y) \<le> \<bar>e\<bar> / 2 + norm (x - y + (e / 2) *\<^sub>R k)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   375
              apply (rule order_trans,rule norm_triangle_sub[of "x - y" "- (e/2) *\<^sub>R k"])
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   376
              unfolding norm_scaleR
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   377
              apply (auto simp: k)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   378
              done
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   379
            also have "\<dots> < \<bar>e\<bar> / 2 + \<bar>e\<bar> / 2"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   380
              apply (rule add_strict_left_mono)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   381
              using as unfolding mem_ball dist_norm
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   382
              using e apply (auto simp add: field_simps)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   383
              done
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   384
            finally show "y \<in> ball x e"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   385
              unfolding mem_ball dist_norm using e by (auto simp add:field_simps)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   386
          qed
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   387
          ultimately show ?thesis
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   388
            apply (rule_tac x="?z" in exI)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   389
            unfolding Union_insert
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   390
            apply auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   391
            done
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   392
        qed
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   393
        then obtain x where "ball x (e / 2) \<subseteq> s \<inter> \<Union>f" ..
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   394
        then have "x \<in> s \<inter> interior (\<Union>f)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   395
          unfolding lem1[where U="\<Union>f", symmetric]
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   396
          using centre_in_ball e by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   397
        then show ?thesis
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
   398
          using insert.hyps(3) insert.prems(1) by blast
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   399
      qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   400
    qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   401
  qed
60394
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
   402
  from this[OF assms(1,3)] x
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   403
  obtain t x e where "t \<in> f" "0 < e" "ball x e \<subseteq> s \<inter> t"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   404
    by blast
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   405
  then have "x \<in> s" "x \<in> interior t"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   406
    using open_subset_interior[OF open_ball, of x e t]
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   407
    by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   408
  then show False
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
   409
    using \<open>t \<in> f\<close> assms(4) by auto
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
   410
qed
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
   411
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
   412
subsection \<open>Bounds on intervals where they exist.\<close>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   413
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   414
definition interval_upperbound :: "('a::euclidean_space) set \<Rightarrow> 'a"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   415
  where "interval_upperbound s = (\<Sum>i\<in>Basis. (SUP x:s. x\<bullet>i) *\<^sub>R i)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   416
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   417
definition interval_lowerbound :: "('a::euclidean_space) set \<Rightarrow> 'a"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   418
   where "interval_lowerbound s = (\<Sum>i\<in>Basis. (INF x:s. x\<bullet>i) *\<^sub>R i)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   419
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   420
lemma interval_upperbound[simp]:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   421
  "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i \<Longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   422
    interval_upperbound (cbox a b) = (b::'a::euclidean_space)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   423
  unfolding interval_upperbound_def euclidean_representation_setsum cbox_def SUP_def
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   424
  by (safe intro!: cSup_eq) auto
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   425
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   426
lemma interval_lowerbound[simp]:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   427
  "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i \<Longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   428
    interval_lowerbound (cbox a b) = (a::'a::euclidean_space)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   429
  unfolding interval_lowerbound_def euclidean_representation_setsum cbox_def INF_def
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   430
  by (safe intro!: cInf_eq) auto
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   431
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   432
lemmas interval_bounds = interval_upperbound interval_lowerbound
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   433
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   434
lemma
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   435
  fixes X::"real set"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   436
  shows interval_upperbound_real[simp]: "interval_upperbound X = Sup X"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   437
    and interval_lowerbound_real[simp]: "interval_lowerbound X = Inf X"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   438
  by (auto simp: interval_upperbound_def interval_lowerbound_def SUP_def INF_def)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   439
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   440
lemma interval_bounds'[simp]:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   441
  assumes "cbox a b \<noteq> {}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   442
  shows "interval_upperbound (cbox a b) = b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   443
    and "interval_lowerbound (cbox a b) = a"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   444
  using assms unfolding box_ne_empty by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   445
59425
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   446
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   447
lemma interval_upperbound_Times:
59425
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   448
  assumes "A \<noteq> {}" and "B \<noteq> {}"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   449
  shows "interval_upperbound (A \<times> B) = (interval_upperbound A, interval_upperbound B)"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   450
proof-
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   451
  from assms have fst_image_times': "A = fst ` (A \<times> B)" by simp
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   452
  have "(\<Sum>i\<in>Basis. (SUP x:A \<times> B. x \<bullet> (i, 0)) *\<^sub>R i) = (\<Sum>i\<in>Basis. (SUP x:A. x \<bullet> i) *\<^sub>R i)"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   453
      by (subst (2) fst_image_times') (simp del: fst_image_times add: o_def inner_Pair_0)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   454
  moreover from assms have snd_image_times': "B = snd ` (A \<times> B)" by simp
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   455
  have "(\<Sum>i\<in>Basis. (SUP x:A \<times> B. x \<bullet> (0, i)) *\<^sub>R i) = (\<Sum>i\<in>Basis. (SUP x:B. x \<bullet> i) *\<^sub>R i)"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   456
      by (subst (2) snd_image_times') (simp del: snd_image_times add: o_def inner_Pair_0)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   457
  ultimately show ?thesis unfolding interval_upperbound_def
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   458
      by (subst setsum_Basis_prod_eq) (auto simp add: setsum_prod)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   459
qed
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   460
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   461
lemma interval_lowerbound_Times:
59425
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   462
  assumes "A \<noteq> {}" and "B \<noteq> {}"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   463
  shows "interval_lowerbound (A \<times> B) = (interval_lowerbound A, interval_lowerbound B)"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   464
proof-
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   465
  from assms have fst_image_times': "A = fst ` (A \<times> B)" by simp
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   466
  have "(\<Sum>i\<in>Basis. (INF x:A \<times> B. x \<bullet> (i, 0)) *\<^sub>R i) = (\<Sum>i\<in>Basis. (INF x:A. x \<bullet> i) *\<^sub>R i)"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   467
      by (subst (2) fst_image_times') (simp del: fst_image_times add: o_def inner_Pair_0)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   468
  moreover from assms have snd_image_times': "B = snd ` (A \<times> B)" by simp
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   469
  have "(\<Sum>i\<in>Basis. (INF x:A \<times> B. x \<bullet> (0, i)) *\<^sub>R i) = (\<Sum>i\<in>Basis. (INF x:B. x \<bullet> i) *\<^sub>R i)"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   470
      by (subst (2) snd_image_times') (simp del: snd_image_times add: o_def inner_Pair_0)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   471
  ultimately show ?thesis unfolding interval_lowerbound_def
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   472
      by (subst setsum_Basis_prod_eq) (auto simp add: setsum_prod)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   473
qed
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   474
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
   475
subsection \<open>Content (length, area, volume...) of an interval.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   476
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   477
definition "content (s::('a::euclidean_space) set) =
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   478
  (if s = {} then 0 else (\<Prod>i\<in>Basis. (interval_upperbound s)\<bullet>i - (interval_lowerbound s)\<bullet>i))"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   479
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   480
lemma interval_not_empty: "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i \<Longrightarrow> cbox a b \<noteq> {}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   481
  unfolding box_eq_empty unfolding not_ex not_less by auto
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   482
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   483
lemma content_cbox:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   484
  fixes a :: "'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
   485
  assumes "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   486
  shows "content (cbox a b) = (\<Prod>i\<in>Basis. b\<bullet>i - a\<bullet>i)"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   487
  using interval_not_empty[OF assms]
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
   488
  unfolding content_def
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
   489
  by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   490
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   491
lemma content_cbox':
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   492
  fixes a :: "'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   493
  assumes "cbox a b \<noteq> {}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   494
  shows "content (cbox a b) = (\<Prod>i\<in>Basis. b\<bullet>i - a\<bullet>i)"
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
   495
    using assms box_ne_empty(1) content_cbox by blast
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   496
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   497
lemma content_real: "a \<le> b \<Longrightarrow> content {a..b} = b - a"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   498
  by (auto simp: interval_upperbound_def interval_lowerbound_def SUP_def INF_def content_def)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   499
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
   500
lemma abs_eq_content: "abs (y - x) = (if x\<le>y then content {x .. y} else content {y..x})"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
   501
  by (auto simp: content_real)
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
   502
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   503
lemma content_singleton[simp]: "content {a} = 0"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   504
proof -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   505
  have "content (cbox a a) = 0"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   506
    by (subst content_cbox) (auto simp: ex_in_conv)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   507
  then show ?thesis by (simp add: cbox_sing)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   508
qed
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   509
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   510
lemma content_unit[iff]: "content(cbox 0 (One::'a::euclidean_space)) = 1"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   511
 proof -
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   512
   have *: "\<forall>i\<in>Basis. (0::'a)\<bullet>i \<le> (One::'a)\<bullet>i"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   513
    by auto
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   514
  have "0 \<in> cbox 0 (One::'a)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   515
    unfolding mem_box by auto
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   516
  then show ?thesis
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
   517
     unfolding content_def interval_bounds[OF *] using setprod.neutral_const by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   518
 qed
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   519
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   520
lemma content_pos_le[intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   521
  fixes a::"'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   522
  shows "0 \<le> content (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   523
proof (cases "cbox a b = {}")
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   524
  case False
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   525
  then have *: "\<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   526
    unfolding box_ne_empty .
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   527
  have "0 \<le> (\<Prod>i\<in>Basis. interval_upperbound (cbox a b) \<bullet> i - interval_lowerbound (cbox a b) \<bullet> i)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   528
    apply (rule setprod_nonneg)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   529
    unfolding interval_bounds[OF *]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   530
    using *
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   531
    apply auto
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   532
    done
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   533
  also have "\<dots> = content (cbox a b)" using False by (simp add: content_def)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   534
  finally show ?thesis .
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   535
qed (simp add: content_def)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   536
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   537
corollary content_nonneg [simp]:
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   538
  fixes a::"'a::euclidean_space"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   539
  shows "~ content (cbox a b) < 0"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   540
using not_le by blast
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   541
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   542
lemma content_pos_lt:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   543
  fixes a :: "'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
   544
  assumes "\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   545
  shows "0 < content (cbox a b)"
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
   546
  using assms
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   547
  by (auto simp: content_def box_eq_empty intro!: setprod_pos)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   548
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   549
lemma content_eq_0:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   550
  "content (cbox a b) = 0 \<longleftrightarrow> (\<exists>i\<in>Basis. b\<bullet>i \<le> a\<bullet>i)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   551
  by (auto simp: content_def box_eq_empty intro!: setprod_pos bexI)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   552
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   553
lemma cond_cases: "(P \<Longrightarrow> Q x) \<Longrightarrow> (\<not> P \<Longrightarrow> Q y) \<Longrightarrow> Q (if P then x else y)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   554
  by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   555
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   556
lemma content_cbox_cases:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   557
  "content (cbox a (b::'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
   558
    (if \<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i then setprod (\<lambda>i. b\<bullet>i - a\<bullet>i) Basis else 0)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   559
  by (auto simp: not_le content_eq_0 intro: less_imp_le content_cbox)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   560
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   561
lemma content_eq_0_interior: "content (cbox a b) = 0 \<longleftrightarrow> interior(cbox a b) = {}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   562
  unfolding content_eq_0 interior_cbox box_eq_empty
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   563
  by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   564
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   565
lemma content_pos_lt_eq:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   566
  "0 < content (cbox a (b::'a::euclidean_space)) \<longleftrightarrow> (\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i)"
60394
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
   567
proof (rule iffI)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   568
  assume "0 < content (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   569
  then have "content (cbox a b) \<noteq> 0" by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   570
  then show "\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   571
    unfolding content_eq_0 not_ex not_le by fastforce
60394
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
   572
next
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
   573
  assume "\<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i"
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
   574
  then show "0 < content (cbox a b)"
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
   575
    by (metis content_pos_lt)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   576
qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   577
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   578
lemma content_empty [simp]: "content {} = 0"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   579
  unfolding content_def by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   580
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   581
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
   582
  by (simp add: content_real)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
   583
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   584
lemma content_subset:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   585
  assumes "cbox a b \<subseteq> cbox c d"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   586
  shows "content (cbox a b) \<le> content (cbox c d)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   587
proof (cases "cbox a b = {}")
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   588
  case True
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   589
  then show ?thesis
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   590
    using content_pos_le[of c d] by auto
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   591
next
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   592
  case False
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   593
  then have ab_ne: "\<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   594
    unfolding box_ne_empty by auto
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   595
  then have ab_ab: "a\<in>cbox a b" "b\<in>cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   596
    unfolding mem_box by auto
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   597
  have "cbox c d \<noteq> {}" using assms False by auto
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   598
  then have cd_ne: "\<forall>i\<in>Basis. c \<bullet> i \<le> d \<bullet> i"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   599
    using assms unfolding box_ne_empty by auto
60394
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
   600
  have "\<And>i. i \<in> Basis \<Longrightarrow> 0 \<le> b \<bullet> i - a \<bullet> i"
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
   601
    using ab_ne by (metis diff_le_iff(1))
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
   602
  moreover
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
   603
  have "\<And>i. i \<in> Basis \<Longrightarrow> b \<bullet> i - a \<bullet> i \<le> d \<bullet> i - c \<bullet> i"
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
   604
    using assms[unfolded subset_eq mem_box,rule_format,OF ab_ab(2)]
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
   605
          assms[unfolded subset_eq mem_box,rule_format,OF ab_ab(1)]
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
   606
      by (metis diff_mono)
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
   607
  ultimately show ?thesis
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
   608
    unfolding content_def interval_bounds[OF ab_ne] interval_bounds[OF cd_ne]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
   609
    by (simp add: setprod_mono if_not_P[OF False] if_not_P[OF \<open>cbox c d \<noteq> {}\<close>])
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   610
qed
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   611
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   612
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
   613
  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
   614
59425
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   615
lemma content_times[simp]: "content (A \<times> B) = content A * content B"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   616
proof (cases "A \<times> B = {}")
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   617
  let ?ub1 = "interval_upperbound" and ?lb1 = "interval_lowerbound"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   618
  let ?ub2 = "interval_upperbound" and ?lb2 = "interval_lowerbound"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   619
  assume nonempty: "A \<times> B \<noteq> {}"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   620
  hence "content (A \<times> B) = (\<Prod>i\<in>Basis. (?ub1 A, ?ub2 B) \<bullet> i - (?lb1 A, ?lb2 B) \<bullet> i)"
59425
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   621
      unfolding content_def by (simp add: interval_upperbound_Times interval_lowerbound_Times)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   622
  also have "... = content A * content B" unfolding content_def using nonempty
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   623
    apply (subst Basis_prod_def, subst setprod.union_disjoint, force, force, force, simp)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   624
    apply (subst (1 2) setprod.reindex, auto intro: inj_onI)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   625
    done
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   626
  finally show ?thesis .
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   627
qed (auto simp: content_def)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 58877
diff changeset
   628
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   629
lemma content_Pair: "content (cbox (a,c) (b,d)) = content (cbox a b) * 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
   630
  by (simp add: cbox_Pair_eq)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   631
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   632
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
   633
   "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
   634
  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
   635
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   636
lemma content_eq_0_gen:
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   637
  fixes s :: "'a::euclidean_space set"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   638
  assumes "bounded s"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   639
  shows "content s = 0 \<longleftrightarrow> (\<exists>i\<in>Basis. \<exists>v. \<forall>x \<in> s. x \<bullet> i = v)"  (is "_ = ?rhs")
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   640
proof safe
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   641
  assume "content s = 0" then show ?rhs
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   642
    apply (clarsimp simp: ex_in_conv content_def split: split_if_asm)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   643
    apply (rule_tac x=a in bexI)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   644
    apply (rule_tac x="interval_lowerbound s \<bullet> a" in exI)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   645
    apply (clarsimp simp: interval_upperbound_def interval_lowerbound_def)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   646
    apply (drule cSUP_eq_cINF_D)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   647
    apply (auto simp: bounded_inner_imp_bdd_above [OF assms]  bounded_inner_imp_bdd_below [OF assms])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   648
    done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   649
next
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   650
  fix i a
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   651
  assume "i \<in> Basis" "\<forall>x\<in>s. x \<bullet> i = a"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   652
  then show "content s = 0"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   653
    apply (clarsimp simp: content_def)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   654
    apply (rule_tac x=i in bexI)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   655
    apply (auto simp: interval_upperbound_def interval_lowerbound_def)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   656
    done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   657
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   658
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   659
lemma content_0_subset_gen:
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   660
  fixes a :: "'a::euclidean_space"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   661
  assumes "content t = 0" "s \<subseteq> t" "bounded t" shows "content s = 0"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   662
proof -
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   663
  have "bounded s"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   664
    using assms by (metis bounded_subset)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   665
  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
   666
    using assms
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   667
    by (auto simp: content_eq_0_gen)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   668
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   669
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   670
lemma content_0_subset: "\<lbrakk>content(cbox a b) = 0; s \<subseteq> cbox a b\<rbrakk> \<Longrightarrow> content s = 0"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   671
  by (simp add: content_0_subset_gen bounded_cbox)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   672
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   673
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
   674
subsection \<open>The notion of a gauge --- simply an open set containing the point.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   675
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   676
definition "gauge d \<longleftrightarrow> (\<forall>x. x \<in> d x \<and> open (d x))"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   677
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   678
lemma gaugeI:
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   679
  assumes "\<And>x. x \<in> g x"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   680
    and "\<And>x. open (g x)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   681
  shows "gauge g"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   682
  using assms unfolding gauge_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   683
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   684
lemma gaugeD[dest]:
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   685
  assumes "gauge d"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   686
  shows "x \<in> d x"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   687
    and "open (d x)"
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   688
  using assms unfolding gauge_def by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   689
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   690
lemma gauge_ball_dependent: "\<forall>x. 0 < e x \<Longrightarrow> gauge (\<lambda>x. ball x (e x))"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   691
  unfolding gauge_def by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   692
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   693
lemma gauge_ball[intro]: "0 < e \<Longrightarrow> gauge (\<lambda>x. ball x e)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   694
  unfolding gauge_def by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   695
60466
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
   696
lemma gauge_trivial[intro!]: "gauge (\<lambda>x. ball x 1)"
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   697
  by (rule gauge_ball) auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   698
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   699
lemma gauge_inter[intro]: "gauge d1 \<Longrightarrow> gauge d2 \<Longrightarrow> gauge (\<lambda>x. d1 x \<inter> d2 x)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   700
  unfolding gauge_def by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   701
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   702
lemma gauge_inters:
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   703
  assumes "finite s"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   704
    and "\<forall>d\<in>s. gauge (f d)"
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60492
diff changeset
   705
  shows "gauge (\<lambda>x. \<Inter>{f d x | d. d \<in> s})"
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   706
proof -
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   707
  have *: "\<And>x. {f d x |d. d \<in> s} = (\<lambda>d. f d x) ` s"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   708
    by auto
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   709
  show ?thesis
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   710
    unfolding gauge_def unfolding *
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   711
    using assms unfolding Ball_def Inter_iff mem_Collect_eq gauge_def by auto
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   712
qed
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   713
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   714
lemma gauge_existence_lemma:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   715
  "(\<forall>x. \<exists>d :: real. p x \<longrightarrow> 0 < d \<and> q d x) \<longleftrightarrow> (\<forall>x. \<exists>d>0. p x \<longrightarrow> q d x)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   716
  by (metis zero_less_one)
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   717
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   718
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
   719
subsection \<open>Divisions.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   720
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   721
definition division_of (infixl "division'_of" 40)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   722
where
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   723
  "s division_of i \<longleftrightarrow>
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   724
    finite s \<and>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   725
    (\<forall>k\<in>s. k \<subseteq> i \<and> k \<noteq> {} \<and> (\<exists>a b. k = cbox a b)) \<and>
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   726
    (\<forall>k1\<in>s. \<forall>k2\<in>s. k1 \<noteq> k2 \<longrightarrow> interior(k1) \<inter> interior(k2) = {}) \<and>
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   727
    (\<Union>s = i)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   728
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   729
lemma division_ofD[dest]:
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   730
  assumes "s division_of i"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   731
  shows "finite s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   732
    and "\<And>k. k \<in> s \<Longrightarrow> k \<subseteq> i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   733
    and "\<And>k. k \<in> s \<Longrightarrow> k \<noteq> {}"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   734
    and "\<And>k. k \<in> s \<Longrightarrow> \<exists>a b. k = cbox a b"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   735
    and "\<And>k1 k2. k1 \<in> s \<Longrightarrow> k2 \<in> s \<Longrightarrow> k1 \<noteq> k2 \<Longrightarrow> interior(k1) \<inter> interior(k2) = {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   736
    and "\<Union>s = i"
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   737
  using assms unfolding division_of_def by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   738
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   739
lemma division_ofI:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   740
  assumes "finite s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   741
    and "\<And>k. k \<in> s \<Longrightarrow> k \<subseteq> i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   742
    and "\<And>k. k \<in> s \<Longrightarrow> k \<noteq> {}"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   743
    and "\<And>k. k \<in> s \<Longrightarrow> \<exists>a b. k = cbox a b"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   744
    and "\<And>k1 k2. k1 \<in> s \<Longrightarrow> k2 \<in> s \<Longrightarrow> k1 \<noteq> k2 \<Longrightarrow> interior k1 \<inter> interior k2 = {}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   745
    and "\<Union>s = i"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   746
  shows "s division_of i"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   747
  using assms unfolding division_of_def by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   748
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   749
lemma division_of_finite: "s division_of i \<Longrightarrow> finite s"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   750
  unfolding division_of_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   751
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   752
lemma division_of_self[intro]: "cbox a b \<noteq> {} \<Longrightarrow> {cbox a b} division_of (cbox a b)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   753
  unfolding division_of_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   754
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   755
lemma division_of_trivial[simp]: "s division_of {} \<longleftrightarrow> s = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   756
  unfolding division_of_def by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   757
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   758
lemma division_of_sing[simp]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   759
  "s division_of cbox a (a::'a::euclidean_space) \<longleftrightarrow> s = {cbox a a}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   760
  (is "?l = ?r")
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   761
proof
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   762
  assume ?r
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   763
  moreover
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
   764
  { fix k
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
   765
    assume "s = {{a}}" "k\<in>s"
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
   766
    then have "\<exists>x y. k = cbox x y"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   767
      apply (rule_tac x=a in exI)+
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
   768
      apply (force simp: cbox_sing)
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   769
      done
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   770
  }
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   771
  ultimately show ?l
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   772
    unfolding division_of_def cbox_sing by auto
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   773
next
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   774
  assume ?l
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   775
  note * = conjunctD4[OF this[unfolded division_of_def cbox_sing]]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   776
  {
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   777
    fix x
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   778
    assume x: "x \<in> s" have "x = {a}"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   779
      using *(2)[rule_format,OF x] by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   780
  }
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   781
  moreover have "s \<noteq> {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   782
    using *(4) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   783
  ultimately show ?r
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   784
    unfolding cbox_sing by auto
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   785
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   786
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   787
lemma elementary_empty: obtains p where "p division_of {}"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   788
  unfolding division_of_trivial by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   789
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   790
lemma elementary_interval: obtains p where "p division_of (cbox a b)"
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   791
  by (metis division_of_trivial division_of_self)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   792
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   793
lemma division_contains: "s division_of i \<Longrightarrow> \<forall>x\<in>i. \<exists>k\<in>s. x \<in> k"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   794
  unfolding division_of_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   795
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   796
lemma forall_in_division:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   797
  "d division_of i \<Longrightarrow> (\<forall>x\<in>d. P x) \<longleftrightarrow> (\<forall>a b. cbox a b \<in> d \<longrightarrow> P (cbox a b))"
44890
22f665a2e91c new fastforce replacing fastsimp - less confusing name
nipkow
parents: 44522
diff changeset
   798
  unfolding division_of_def by fastforce
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   799
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   800
lemma division_of_subset:
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   801
  assumes "p division_of (\<Union>p)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   802
    and "q \<subseteq> p"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   803
  shows "q division_of (\<Union>q)"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   804
proof (rule division_ofI)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   805
  note * = division_ofD[OF assms(1)]
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   806
  show "finite q"
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
   807
    using "*"(1) assms(2) infinite_super by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   808
  {
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   809
    fix k
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   810
    assume "k \<in> q"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   811
    then have kp: "k \<in> p"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   812
      using assms(2) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   813
    show "k \<subseteq> \<Union>q"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
   814
      using \<open>k \<in> q\<close> by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   815
    show "\<exists>a b. k = cbox a b"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   816
      using *(4)[OF kp] by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   817
    show "k \<noteq> {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   818
      using *(3)[OF kp] by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   819
  }
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   820
  fix k1 k2
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   821
  assume "k1 \<in> q" "k2 \<in> q" "k1 \<noteq> k2"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   822
  then have **: "k1 \<in> p" "k2 \<in> p" "k1 \<noteq> k2"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   823
    using assms(2) by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   824
  show "interior k1 \<inter> interior k2 = {}"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   825
    using *(5)[OF **] by auto
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   826
qed auto
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   827
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   828
lemma division_of_union_self[intro]: "p division_of s \<Longrightarrow> p division_of (\<Union>p)"
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   829
  unfolding division_of_def by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   830
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   831
lemma division_of_content_0:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   832
  assumes "content (cbox a b) = 0" "d division_of (cbox a b)"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   833
  shows "\<forall>k\<in>d. content k = 0"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   834
  unfolding forall_in_division[OF assms(2)]
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
   835
  by (metis antisym_conv assms content_pos_le content_subset division_ofD(2))
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   836
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   837
lemma division_inter:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   838
  fixes s1 s2 :: "'a::euclidean_space set"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   839
  assumes "p1 division_of s1"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   840
    and "p2 division_of s2"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   841
  shows "{k1 \<inter> k2 | k1 k2 .k1 \<in> p1 \<and> k2 \<in> p2 \<and> k1 \<inter> k2 \<noteq> {}} division_of (s1 \<inter> s2)"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   842
  (is "?A' division_of _")
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   843
proof -
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   844
  let ?A = "{s. s \<in>  (\<lambda>(k1,k2). k1 \<inter> k2) ` (p1 \<times> p2) \<and> s \<noteq> {}}"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   845
  have *: "?A' = ?A" by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   846
  show ?thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   847
    unfolding *
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   848
  proof (rule division_ofI)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   849
    have "?A \<subseteq> (\<lambda>(x, y). x \<inter> y) ` (p1 \<times> p2)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   850
      by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   851
    moreover have "finite (p1 \<times> p2)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   852
      using assms unfolding division_of_def by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   853
    ultimately show "finite ?A" by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   854
    have *: "\<And>s. \<Union>{x\<in>s. x \<noteq> {}} = \<Union>s"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   855
      by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   856
    show "\<Union>?A = s1 \<inter> s2"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   857
      apply (rule set_eqI)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   858
      unfolding * and Union_image_eq UN_iff
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   859
      using division_ofD(6)[OF assms(1)] and division_ofD(6)[OF assms(2)]
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   860
      apply auto
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   861
      done
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   862
    {
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   863
      fix k
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   864
      assume "k \<in> ?A"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   865
      then obtain k1 k2 where k: "k = k1 \<inter> k2" "k1 \<in> p1" "k2 \<in> p2" "k \<noteq> {}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   866
        by auto
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   867
      then show "k \<noteq> {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   868
        by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   869
      show "k \<subseteq> s1 \<inter> s2"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   870
        using division_ofD(2)[OF assms(1) k(2)] and division_ofD(2)[OF assms(2) k(3)]
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   871
        unfolding k by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   872
      obtain a1 b1 where k1: "k1 = cbox a1 b1"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   873
        using division_ofD(4)[OF assms(1) k(2)] by blast
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   874
      obtain a2 b2 where k2: "k2 = cbox a2 b2"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   875
        using division_ofD(4)[OF assms(2) k(3)] by blast
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   876
      show "\<exists>a b. k = cbox a b"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   877
        unfolding k k1 k2 unfolding inter_interval by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   878
    }
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   879
    fix k1 k2
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   880
    assume "k1 \<in> ?A"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   881
    then obtain x1 y1 where k1: "k1 = x1 \<inter> y1" "x1 \<in> p1" "y1 \<in> p2" "k1 \<noteq> {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   882
      by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   883
    assume "k2 \<in> ?A"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   884
    then obtain x2 y2 where k2: "k2 = x2 \<inter> y2" "x2 \<in> p1" "y2 \<in> p2" "k2 \<noteq> {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   885
      by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   886
    assume "k1 \<noteq> k2"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   887
    then have th: "x1 \<noteq> x2 \<or> y1 \<noteq> y2"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   888
      unfolding k1 k2 by auto
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   889
    have *: "interior x1 \<inter> interior x2 = {} \<or> interior y1 \<inter> interior y2 = {} \<Longrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   890
      interior (x1 \<inter> y1) \<subseteq> interior x1 \<Longrightarrow> interior (x1 \<inter> y1) \<subseteq> interior y1 \<Longrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   891
      interior (x2 \<inter> y2) \<subseteq> interior x2 \<Longrightarrow> interior (x2 \<inter> y2) \<subseteq> interior y2 \<Longrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   892
      interior (x1 \<inter> y1) \<inter> interior (x2 \<inter> y2) = {}" by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   893
    show "interior k1 \<inter> interior k2 = {}"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   894
      unfolding k1 k2
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   895
      apply (rule *)
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
   896
      using assms division_ofD(5) k1 k2(2) k2(3) th apply auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   897
      done
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   898
  qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   899
qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   900
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   901
lemma division_inter_1:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   902
  assumes "d division_of i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   903
    and "cbox a (b::'a::euclidean_space) \<subseteq> i"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   904
  shows "{cbox a b \<inter> k | k. k \<in> d \<and> cbox a b \<inter> k \<noteq> {}} division_of (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   905
proof (cases "cbox a b = {}")
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   906
  case True
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   907
  show ?thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   908
    unfolding True and division_of_trivial by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   909
next
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   910
  case False
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   911
  have *: "cbox a b \<inter> i = cbox a b" using assms(2) by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   912
  show ?thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   913
    using division_inter[OF division_of_self[OF False] assms(1)]
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   914
    unfolding * by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   915
qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   916
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   917
lemma elementary_inter:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   918
  fixes s t :: "'a::euclidean_space set"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   919
  assumes "p1 division_of s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   920
    and "p2 division_of t"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   921
  shows "\<exists>p. p division_of (s \<inter> t)"
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
   922
using assms division_inter by blast
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   923
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   924
lemma elementary_inters:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   925
  assumes "finite f"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   926
    and "f \<noteq> {}"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   927
    and "\<forall>s\<in>f. \<exists>p. p division_of (s::('a::euclidean_space) set)"
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60492
diff changeset
   928
  shows "\<exists>p. p division_of (\<Inter>f)"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   929
  using assms
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   930
proof (induct f rule: finite_induct)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   931
  case (insert x f)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   932
  show ?case
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   933
  proof (cases "f = {}")
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   934
    case True
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   935
    then show ?thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   936
      unfolding True using insert by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   937
  next
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   938
    case False
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   939
    obtain p where "p division_of \<Inter>f"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   940
      using insert(3)[OF False insert(5)[unfolded ball_simps,THEN conjunct2]] ..
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   941
    moreover obtain px where "px division_of x"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   942
      using insert(5)[rule_format,OF insertI1] ..
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   943
    ultimately show ?thesis
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
   944
      by (simp add: elementary_inter Inter_insert)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   945
  qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   946
qed auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   947
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   948
lemma division_disjoint_union:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   949
  assumes "p1 division_of s1"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   950
    and "p2 division_of s2"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   951
    and "interior s1 \<inter> interior s2 = {}"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   952
  shows "(p1 \<union> p2) division_of (s1 \<union> s2)"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   953
proof (rule division_ofI)
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   954
  note d1 = division_ofD[OF assms(1)]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   955
  note d2 = division_ofD[OF assms(2)]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   956
  show "finite (p1 \<union> p2)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   957
    using d1(1) d2(1) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   958
  show "\<Union>(p1 \<union> p2) = s1 \<union> s2"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   959
    using d1(6) d2(6) by auto
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   960
  {
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   961
    fix k1 k2
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   962
    assume as: "k1 \<in> p1 \<union> p2" "k2 \<in> p1 \<union> p2" "k1 \<noteq> k2"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   963
    moreover
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   964
    let ?g="interior k1 \<inter> interior k2 = {}"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   965
    {
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   966
      assume as: "k1\<in>p1" "k2\<in>p2"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   967
      have ?g
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   968
        using interior_mono[OF d1(2)[OF as(1)]] interior_mono[OF d2(2)[OF as(2)]]
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   969
        using assms(3) by blast
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   970
    }
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   971
    moreover
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   972
    {
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   973
      assume as: "k1\<in>p2" "k2\<in>p1"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   974
      have ?g
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   975
        using interior_mono[OF d1(2)[OF as(2)]] interior_mono[OF d2(2)[OF as(1)]]
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   976
        using assms(3) by blast
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   977
    }
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   978
    ultimately show ?g
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   979
      using d1(5)[OF _ _ as(3)] and d2(5)[OF _ _ as(3)] by auto
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   980
  }
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   981
  fix k
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   982
  assume k: "k \<in> p1 \<union> p2"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   983
  show "k \<subseteq> s1 \<union> s2"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   984
    using k d1(2) d2(2) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   985
  show "k \<noteq> {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   986
    using k d1(3) d2(3) by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   987
  show "\<exists>a b. k = cbox a b"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   988
    using k d1(4) d2(4) by auto
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   989
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   990
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   991
lemma partial_division_extend_1:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   992
  fixes a b c d :: "'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   993
  assumes incl: "cbox c d \<subseteq> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   994
    and nonempty: "cbox c d \<noteq> {}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   995
  obtains p where "p division_of (cbox a b)" "cbox c d \<in> p"
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
   996
proof
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   997
  let ?B = "\<lambda>f::'a\<Rightarrow>'a \<times> 'a.
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
   998
    cbox (\<Sum>i\<in>Basis. (fst (f i) \<bullet> i) *\<^sub>R i) (\<Sum>i\<in>Basis. (snd (f i) \<bullet> i) *\<^sub>R i)"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 52141
diff changeset
   999
  def p \<equiv> "?B ` (Basis \<rightarrow>\<^sub>E {(a, c), (c, d), (d, b)})"
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
  1000
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1001
  show "cbox c d \<in> p"
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
  1002
    unfolding p_def
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1003
    by (auto simp add: box_eq_empty cbox_def intro!: image_eqI[where x="\<lambda>(i::'a)\<in>Basis. (c, d)"])
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1004
  {
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1005
    fix i :: 'a
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1006
    assume "i \<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
  1007
    with incl nonempty have "a \<bullet> i \<le> c \<bullet> i" "c \<bullet> i \<le> d \<bullet> i" "d \<bullet> i \<le> b \<bullet> i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1008
      unfolding box_eq_empty subset_box by (auto simp: not_le)
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1009
  }
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
  1010
  note ord = this
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1011
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1012
  show "p division_of (cbox a b)"
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
  1013
  proof (rule division_ofI)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1014
    show "finite p"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1015
      unfolding p_def by (auto intro!: finite_PiE)
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1016
    {
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1017
      fix k
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1018
      assume "k \<in> p"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 52141
diff changeset
  1019
      then obtain f where f: "f \<in> Basis \<rightarrow>\<^sub>E {(a, c), (c, d), (d, b)}" and k: "k = ?B f"
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
  1020
        by (auto simp: p_def)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1021
      then show "\<exists>a b. k = cbox a b"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1022
        by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1023
      have "k \<subseteq> cbox a b \<and> k \<noteq> {}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1024
      proof (simp add: k box_eq_empty subset_box not_less, safe)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  1025
        fix i :: 'a
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  1026
        assume i: "i \<in> Basis"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1027
        with f have "f i = (a, c) \<or> f i = (c, d) \<or> f i = (d, b)"
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
  1028
          by (auto simp: PiE_iff)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  1029
        with i ord[of i]
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1030
        show "a \<bullet> i \<le> fst (f i) \<bullet> i" "snd (f i) \<bullet> i \<le> b \<bullet> i" "fst (f i) \<bullet> i \<le> snd (f i) \<bullet> i"
54776
db890d9fc5c2 ordered_euclidean_space compatible with more standard pointwise ordering on products; conditionally complete lattice with product order
immler
parents: 54775
diff changeset
  1031
          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
  1032
      qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1033
      then show "k \<noteq> {}" "k \<subseteq> cbox a b"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1034
        by auto
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1035
      {
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1036
        fix l
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1037
        assume "l \<in> p"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 52141
diff changeset
  1038
        then obtain g where g: "g \<in> Basis \<rightarrow>\<^sub>E {(a, c), (c, d), (d, b)}" and l: "l = ?B g"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1039
          by (auto simp: p_def)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1040
        assume "l \<noteq> k"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1041
        have "\<exists>i\<in>Basis. f i \<noteq> g i"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1042
        proof (rule ccontr)
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1043
          assume "\<not> ?thesis"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1044
          with f g have "f = g"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1045
            by (auto simp: PiE_iff extensional_def intro!: ext)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1046
          with \<open>l \<noteq> k\<close> show False
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1047
            by (simp add: l k)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1048
        qed
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1049
        then obtain i where *: "i \<in> Basis" "f i \<noteq> g i" ..
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1050
        then have "f i = (a, c) \<or> f i = (c, d) \<or> f i = (d, b)"
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1051
                  "g i = (a, c) \<or> g i = (c, d) \<or> g i = (d, b)"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1052
          using f g by (auto simp: PiE_iff)
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1053
        with * ord[of i] show "interior l \<inter> interior k = {}"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1054
          by (auto simp add: l k interior_cbox disjoint_interval intro!: bexI[of _ i])
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1055
      }
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1056
      note \<open>k \<subseteq> cbox a b\<close>
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1057
    }
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
  1058
    moreover
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1059
    {
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1060
      fix x assume x: "x \<in> cbox a b"
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
  1061
      have "\<forall>i\<in>Basis. \<exists>l. x \<bullet> i \<in> {fst l \<bullet> i .. snd l \<bullet> i} \<and> l \<in> {(a, c), (c, d), (d, b)}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1062
      proof
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1063
        fix i :: 'a
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1064
        assume "i \<in> Basis"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1065
        with x ord[of 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
  1066
        have "(a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> c \<bullet> i) \<or> (c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i) \<or>
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1067
            (d \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1068
          by (auto simp: cbox_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
  1069
        then show "\<exists>l. x \<bullet> i \<in> {fst l \<bullet> i .. snd l \<bullet> i} \<and> l \<in> {(a, c), (c, d), (d, b)}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1070
          by auto
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1071
      qed
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1072
      then obtain f where
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1073
        f: "\<forall>i\<in>Basis. x \<bullet> i \<in> {fst (f i) \<bullet> i..snd (f i) \<bullet> i} \<and> f i \<in> {(a, c), (c, d), (d, b)}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1074
        unfolding bchoice_iff ..
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  1075
      moreover from f have "restrict f Basis \<in> Basis \<rightarrow>\<^sub>E {(a, c), (c, d), (d, b)}"
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
  1076
        by auto
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1077
      moreover from f have "x \<in> ?B (restrict f Basis)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1078
        by (auto simp: 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
  1079
      ultimately have "\<exists>k\<in>p. x \<in> k"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1080
        unfolding p_def by blast
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1081
    }
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1082
    ultimately show "\<Union>p = cbox a b"
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
  1083
      by auto
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1084
  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
  1085
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1086
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1087
lemma partial_division_extend_interval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1088
  assumes "p division_of (\<Union>p)" "(\<Union>p) \<subseteq> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1089
  obtains q where "p \<subseteq> q" "q division_of cbox a (b::'a::euclidean_space)"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1090
proof (cases "p = {}")
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1091
  case True
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1092
  obtain q where "q division_of (cbox a b)"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1093
    by (rule elementary_interval)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1094
  then show ?thesis
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1095
    using True that by blast
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1096
next
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1097
  case False
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1098
  note p = division_ofD[OF assms(1)]
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1099
  have div_cbox: "\<forall>k\<in>p. \<exists>q. q division_of cbox a b \<and> k \<in> q"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1100
  proof
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1101
    fix k
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1102
    assume kp: "k \<in> p"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1103
    obtain c d where k: "k = cbox c d"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1104
      using p(4)[OF kp] by blast
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1105
    have *: "cbox c d \<subseteq> cbox a b" "cbox c d \<noteq> {}"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1106
      using p(2,3)[OF kp, unfolded k] using assms(2)
54776
db890d9fc5c2 ordered_euclidean_space compatible with more standard pointwise ordering on products; conditionally complete lattice with product order
immler
parents: 54775
diff changeset
  1107
      by (blast intro: order.trans)+
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1108
    obtain q where "q division_of cbox a b" "cbox c d \<in> q"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1109
      by (rule partial_division_extend_1[OF *])
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1110
    then show "\<exists>q. q division_of cbox a b \<and> k \<in> q"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1111
      unfolding k by auto
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1112
  qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1113
  obtain q where q: "\<And>x. x \<in> p \<Longrightarrow> q x division_of cbox a b" "\<And>x. x \<in> p \<Longrightarrow> x \<in> q x"
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1114
    using bchoice[OF div_cbox] by blast
60394
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
  1115
  { fix x
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1116
    assume x: "x \<in> p"
60394
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
  1117
    have "q x division_of \<Union>q x"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1118
      apply (rule division_ofI)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1119
      using division_ofD[OF q(1)[OF x]]
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1120
      apply auto
60394
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
  1121
      done }
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
  1122
  then have "\<And>x. x \<in> p \<Longrightarrow> \<exists>d. d division_of \<Union>(q x - {x})"
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
  1123
    by (meson Diff_subset division_of_subset)
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60492
diff changeset
  1124
  then have "\<exists>d. d division_of \<Inter>((\<lambda>i. \<Union>(q i - {i})) ` p)"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1125
    apply -
60394
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
  1126
    apply (rule elementary_inters [OF finite_imageI[OF p(1)]])
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
  1127
    apply (auto simp: False elementary_inters [OF finite_imageI[OF p(1)]])
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1128
    done
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1129
  then obtain d where d: "d division_of \<Inter>((\<lambda>i. \<Union>(q i - {i})) ` p)" ..
60394
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
  1130
  have "d \<union> p division_of cbox a b"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1131
  proof -
60394
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
  1132
    have te: "\<And>s f t. s \<noteq> {} \<Longrightarrow> \<forall>i\<in>s. f i \<union> i = t \<Longrightarrow> t = \<Inter>(f ` s) \<union> \<Union>s" by auto
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1133
    have cbox_eq: "cbox a b = \<Inter>((\<lambda>i. \<Union>(q i - {i})) ` p) \<union> \<Union>p"
60394
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
  1134
    proof (rule te[OF False], clarify)
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1135
      fix i
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1136
      assume i: "i \<in> p"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1137
      show "\<Union>(q i - {i}) \<union> i = cbox a b"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1138
        using division_ofD(6)[OF q(1)[OF i]] using q(2)[OF i] by auto
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1139
    qed
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1140
    { fix k
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1141
      assume k: "k \<in> p"
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1142
      have *: "\<And>u t s. t \<inter> s = {} \<Longrightarrow> u \<subseteq> s \<Longrightarrow> u \<inter> t = {}"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1143
        by auto
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1144
      have "interior (\<Inter>i\<in>p. \<Union>(q i - {i})) \<inter> interior k = {}"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1145
      proof (rule *[OF inter_interior_unions_intervals])
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1146
        note qk=division_ofD[OF q(1)[OF k]]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1147
        show "finite (q k - {k})" "open (interior k)" "\<forall>t\<in>q k - {k}. \<exists>a b. t = cbox a b"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1148
          using qk by auto
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1149
        show "\<forall>t\<in>q k - {k}. interior k \<inter> interior t = {}"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1150
          using qk(5) using q(2)[OF k] by auto
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1151
        show "interior (\<Inter>i\<in>p. \<Union>(q i - {i})) \<subseteq> interior (\<Union>(q k - {k}))"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1152
          apply (rule interior_mono)+
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1153
          using k
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1154
          apply auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1155
          done
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1156
      qed } note [simp] = this
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1157
    show "d \<union> p division_of (cbox a b)"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1158
      unfolding cbox_eq
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1159
      apply (rule division_disjoint_union[OF d assms(1)])
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1160
      apply (rule inter_interior_unions_intervals)
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1161
      apply (rule p open_interior ballI)+
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  1162
      apply simp_all
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1163
      done
60394
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
  1164
  qed
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
  1165
  then show ?thesis
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
  1166
    by (meson Un_upper2 that)
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1167
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1168
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1169
lemma elementary_bounded[dest]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1170
  fixes s :: "'a::euclidean_space set"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1171
  shows "p division_of s \<Longrightarrow> bounded s"
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1172
  unfolding division_of_def by (metis bounded_Union bounded_cbox)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1173
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1174
lemma elementary_subset_cbox:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1175
  "p division_of s \<Longrightarrow> \<exists>a b. s \<subseteq> cbox a (b::'a::euclidean_space)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1176
  by (meson elementary_bounded bounded_subset_cbox)
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1177
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1178
lemma division_union_intervals_exists:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1179
  fixes a b :: "'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1180
  assumes "cbox a b \<noteq> {}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1181
  obtains p where "(insert (cbox a b) p) division_of (cbox a b \<union> cbox c d)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1182
proof (cases "cbox c d = {}")
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1183
  case True
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1184
  show ?thesis
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1185
    apply (rule that[of "{}"])
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1186
    unfolding True
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1187
    using assms
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1188
    apply auto
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1189
    done
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1190
next
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1191
  case False
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1192
  show ?thesis
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1193
  proof (cases "cbox a b \<inter> cbox c d = {}")
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1194
    case True
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1195
    show ?thesis
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1196
      apply (rule that[of "{cbox c d}"])
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1197
      apply (subst insert_is_Un)
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1198
      apply (rule division_disjoint_union)
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1199
      using \<open>cbox c d \<noteq> {}\<close> True assms interior_subset
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1200
      apply auto
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1201
      done
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1202
  next
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1203
    case False
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1204
    obtain u v where uv: "cbox a b \<inter> cbox c d = cbox u v"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1205
      unfolding inter_interval by auto
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1206
    have uv_sub: "cbox u v \<subseteq> cbox c d" using uv by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1207
    obtain p where "p division_of cbox c d" "cbox u v \<in> p"
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1208
      by (rule partial_division_extend_1[OF uv_sub False[unfolded uv]])
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1209
    note p = this division_ofD[OF this(1)]
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1210
    have "interior (cbox a b \<inter> \<Union>(p - {cbox u v})) = interior(cbox u v \<inter> \<Union>(p - {cbox u v}))"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1211
      apply (rule arg_cong[of _ _ interior])
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1212
      using p(8) uv by auto
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1213
    also have "\<dots> = {}"
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61424
diff changeset
  1214
      unfolding interior_Int
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1215
      apply (rule inter_interior_unions_intervals)
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1216
      using p(6) p(7)[OF p(2)] p(3)
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1217
      apply auto
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1218
      done
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1219
    finally have [simp]: "interior (cbox a b) \<inter> interior (\<Union>(p - {cbox u v})) = {}" 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
  1220
    have cbe: "cbox a b \<union> cbox c d = cbox a b \<union> \<Union>(p - {cbox u v})"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1221
      using p(8) unfolding uv[symmetric] by auto
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1222
    show ?thesis
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1223
      apply (rule that[of "p - {cbox u v}"])
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1224
      apply (simp add: cbe)
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1225
      apply (subst insert_is_Un)
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1226
      apply (rule division_disjoint_union)
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1227
      apply (simp_all add: assms division_of_self)
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1228
      by (metis Diff_subset division_of_subset p(1) p(8))
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1229
  qed
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1230
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1231
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1232
lemma division_of_unions:
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1233
  assumes "finite f"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1234
    and "\<And>p. p \<in> f \<Longrightarrow> p division_of (\<Union>p)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1235
    and "\<And>k1 k2. k1 \<in> \<Union>f \<Longrightarrow> k2 \<in> \<Union>f \<Longrightarrow> k1 \<noteq> k2 \<Longrightarrow> interior k1 \<inter> interior k2 = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1236
  shows "\<Union>f division_of \<Union>\<Union>f"
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1237
  using assms
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1238
  by (auto intro!: division_ofI)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1239
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1240
lemma elementary_union_interval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1241
  fixes a b :: "'a::euclidean_space"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1242
  assumes "p division_of \<Union>p"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1243
  obtains q where "q division_of (cbox a b \<union> \<Union>p)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1244
proof -
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1245
  note assm = division_ofD[OF assms]
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1246
  have lem1: "\<And>f s. \<Union>\<Union>(f ` s) = \<Union>((\<lambda>x. \<Union>(f x)) ` s)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1247
    by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1248
  have lem2: "\<And>f s. f \<noteq> {} \<Longrightarrow> \<Union>{s \<union> t |t. t \<in> f} = s \<union> \<Union>f"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1249
    by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1250
  {
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1251
    presume "p = {} \<Longrightarrow> thesis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1252
      "cbox a b = {} \<Longrightarrow> thesis"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1253
      "cbox a b \<noteq> {} \<Longrightarrow> interior (cbox a b) = {} \<Longrightarrow> thesis"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1254
      "p \<noteq> {} \<Longrightarrow> interior (cbox a b)\<noteq>{} \<Longrightarrow> cbox a b \<noteq> {} \<Longrightarrow> thesis"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1255
    then show thesis by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1256
  next
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1257
    assume as: "p = {}"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1258
    obtain p where "p division_of (cbox a b)"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1259
      by (rule elementary_interval)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1260
    then show thesis
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1261
      using as that by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1262
  next
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1263
    assume as: "cbox a b = {}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1264
    show thesis
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1265
      using as assms that by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1266
  next
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1267
    assume as: "interior (cbox a b) = {}" "cbox a b \<noteq> {}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1268
    show thesis
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1269
      apply (rule that[of "insert (cbox a b) p"],rule division_ofI)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1270
      unfolding finite_insert
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1271
      apply (rule assm(1)) unfolding Union_insert
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1272
      using assm(2-4) as
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1273
      apply -
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  1274
      apply (fast dest: assm(5))+
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1275
      done
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1276
  next
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1277
    assume as: "p \<noteq> {}" "interior (cbox a b) \<noteq> {}" "cbox a b \<noteq> {}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1278
    have "\<forall>k\<in>p. \<exists>q. (insert (cbox a b) q) division_of (cbox a b \<union> k)"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  1279
    proof
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1280
      fix k
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1281
      assume kp: "k \<in> p"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1282
      from assm(4)[OF kp] obtain c d where "k = cbox c d" by blast
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1283
      then show "\<exists>q. (insert (cbox a b) q) division_of (cbox a b \<union> k)"
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1284
        by (meson as(3) division_union_intervals_exists)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1285
    qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1286
    from bchoice[OF this] obtain q where "\<forall>x\<in>p. insert (cbox a b) (q x) division_of (cbox a b) \<union> x" ..
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1287
    note q = division_ofD[OF this[rule_format]]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1288
    let ?D = "\<Union>{insert (cbox a b) (q k) | k. k \<in> p}"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  1289
    show thesis
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1290
    proof (rule that[OF division_ofI])
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1291
      have *: "{insert (cbox a b) (q k) |k. k \<in> p} = (\<lambda>k. insert (cbox a b) (q k)) ` p"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1292
        by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1293
      show "finite ?D"
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1294
        using "*" assm(1) q(1) by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1295
      show "\<Union>?D = cbox a b \<union> \<Union>p"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1296
        unfolding * lem1
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1297
        unfolding lem2[OF as(1), of "cbox a b", symmetric]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1298
        using q(6)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1299
        by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1300
      fix k
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1301
      assume k: "k \<in> ?D"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1302
      then show "k \<subseteq> cbox a b \<union> \<Union>p"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1303
        using q(2) by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1304
      show "k \<noteq> {}"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1305
        using q(3) k by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1306
      show "\<exists>a b. k = cbox a b"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1307
        using q(4) k by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1308
      fix k'
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1309
      assume k': "k' \<in> ?D" "k \<noteq> k'"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1310
      obtain x where x: "k \<in> insert (cbox a b) (q x)" "x\<in>p"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1311
        using k by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1312
      obtain x' where x': "k'\<in>insert (cbox a b) (q x')" "x'\<in>p"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1313
        using k' by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1314
      show "interior k \<inter> interior k' = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1315
      proof (cases "x = x'")
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1316
        case True
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1317
        show ?thesis
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1318
          using True k' q(5) x' x by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1319
      next
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1320
        case False
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1321
        {
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1322
          presume "k = cbox a b \<Longrightarrow> ?thesis"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1323
            and "k' = cbox a b \<Longrightarrow> ?thesis"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1324
            and "k \<noteq> cbox a b \<Longrightarrow> k' \<noteq> cbox a b \<Longrightarrow> ?thesis"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1325
          then show ?thesis by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1326
        next
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1327
          assume as': "k  = cbox a b"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1328
          show ?thesis
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1329
            using as' k' q(5) x' by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1330
        next
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1331
          assume as': "k' = cbox a b"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1332
          show ?thesis
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1333
            using as' k'(2) q(5) x by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1334
        }
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1335
        assume as': "k \<noteq> cbox a b" "k' \<noteq> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1336
        obtain c d where k: "k = cbox c d"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1337
          using q(4)[OF x(2,1)] by blast
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1338
        have "interior k \<inter> interior (cbox a b) = {}"
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1339
          using as' k'(2) q(5) x by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1340
        then have "interior k \<subseteq> interior x"
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1341
        using interior_subset_union_intervals
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1342
          by (metis as(2) k q(2) x interior_subset_union_intervals)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1343
        moreover
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1344
        obtain c d where c_d: "k' = cbox c d"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1345
          using q(4)[OF x'(2,1)] by blast
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1346
        have "interior k' \<inter> interior (cbox a b) = {}"
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1347
          using as'(2) q(5) x' by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1348
        then have "interior k' \<subseteq> interior x'"
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1349
          by (metis as(2) c_d interior_subset_union_intervals q(2) x'(1) x'(2))
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1350
        ultimately show ?thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1351
          using assm(5)[OF x(2) x'(2) False] by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1352
      qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1353
    qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1354
  }
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1355
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1356
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1357
lemma elementary_unions_intervals:
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1358
  assumes fin: "finite f"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1359
    and "\<And>s. s \<in> f \<Longrightarrow> \<exists>a b. s = cbox a (b::'a::euclidean_space)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1360
  obtains p where "p division_of (\<Union>f)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1361
proof -
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1362
  have "\<exists>p. p division_of (\<Union>f)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1363
  proof (induct_tac f rule:finite_subset_induct)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1364
    show "\<exists>p. p division_of \<Union>{}" using elementary_empty by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1365
  next
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1366
    fix x F
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1367
    assume as: "finite F" "x \<notin> F" "\<exists>p. p division_of \<Union>F" "x\<in>f"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1368
    from this(3) obtain p where p: "p division_of \<Union>F" ..
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1369
    from assms(2)[OF as(4)] obtain a b where x: "x = cbox a b" by blast
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1370
    have *: "\<Union>F = \<Union>p"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1371
      using division_ofD[OF p] by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1372
    show "\<exists>p. p division_of \<Union>insert x F"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1373
      using elementary_union_interval[OF p[unfolded *], of a b]
59765
26d1c71784f1 tweaked a few slow or very ugly proofs
paulson <lp15@cam.ac.uk>
parents: 59647
diff changeset
  1374
      unfolding Union_insert x * by metis
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1375
  qed (insert assms, auto)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1376
  then show ?thesis
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1377
    using that by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1378
qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1379
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1380
lemma elementary_union:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1381
  fixes s t :: "'a::euclidean_space set"
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1382
  assumes "ps division_of s" "pt division_of t"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1383
  obtains p where "p division_of (s \<union> t)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1384
proof -
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1385
  have *: "s \<union> t = \<Union>ps \<union> \<Union>pt"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1386
    using assms unfolding division_of_def by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1387
  show ?thesis
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1388
    apply (rule elementary_unions_intervals[of "ps \<union> pt"])
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1389
    using assms apply auto
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1390
    by (simp add: * that)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1391
qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1392
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1393
lemma partial_division_extend:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1394
  fixes t :: "'a::euclidean_space set"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1395
  assumes "p division_of s"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1396
    and "q division_of t"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1397
    and "s \<subseteq> t"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1398
  obtains r where "p \<subseteq> r" and "r division_of t"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1399
proof -
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1400
  note divp = division_ofD[OF assms(1)] and divq = division_ofD[OF assms(2)]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1401
  obtain a b where ab: "t \<subseteq> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1402
    using elementary_subset_cbox[OF assms(2)] by auto
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1403
  obtain r1 where "p \<subseteq> r1" "r1 division_of (cbox a b)"
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1404
    using assms
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1405
    by (metis ab dual_order.trans partial_division_extend_interval divp(6))
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1406
  note r1 = this division_ofD[OF this(2)]
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1407
  obtain p' where "p' division_of \<Union>(r1 - p)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1408
    apply (rule elementary_unions_intervals[of "r1 - p"])
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1409
    using r1(3,6)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1410
    apply auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1411
    done
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1412
  then obtain r2 where r2: "r2 division_of (\<Union>(r1 - p)) \<inter> (\<Union>q)"
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1413
    by (metis assms(2) divq(6) elementary_inter)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1414
  {
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1415
    fix x
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1416
    assume x: "x \<in> t" "x \<notin> s"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1417
    then have "x\<in>\<Union>r1"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1418
      unfolding r1 using ab by auto
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1419
    then obtain r where r: "r \<in> r1" "x \<in> r"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1420
      unfolding Union_iff ..
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1421
    moreover
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1422
    have "r \<notin> p"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1423
    proof
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1424
      assume "r \<in> p"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1425
      then have "x \<in> s" using divp(2) r by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1426
      then show False using x by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1427
    qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1428
    ultimately have "x\<in>\<Union>(r1 - p)" by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1429
  }
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1430
  then have *: "t = \<Union>p \<union> (\<Union>(r1 - p) \<inter> \<Union>q)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1431
    unfolding divp divq using assms(3) by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1432
  show ?thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1433
    apply (rule that[of "p \<union> r2"])
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1434
    unfolding *
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1435
    defer
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1436
    apply (rule division_disjoint_union)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1437
    unfolding divp(6)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1438
    apply(rule assms r2)+
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1439
  proof -
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1440
    have "interior s \<inter> interior (\<Union>(r1-p)) = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1441
    proof (rule inter_interior_unions_intervals)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1442
      show "finite (r1 - p)" and "open (interior s)" and "\<forall>t\<in>r1-p. \<exists>a b. t = cbox a b"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1443
        using r1 by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1444
      have *: "\<And>s. (\<And>x. x \<in> s \<Longrightarrow> False) \<Longrightarrow> s = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1445
        by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1446
      show "\<forall>t\<in>r1-p. interior s \<inter> interior t = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1447
      proof
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1448
        fix m x
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1449
        assume as: "m \<in> r1 - p"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1450
        have "interior m \<inter> interior (\<Union>p) = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1451
        proof (rule inter_interior_unions_intervals)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1452
          show "finite p" and "open (interior m)" and "\<forall>t\<in>p. \<exists>a b. t = cbox a b"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1453
            using divp by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1454
          show "\<forall>t\<in>p. interior m \<inter> interior t = {}"
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1455
            by (metis DiffD1 DiffD2 as r1(1) r1(7) set_rev_mp)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1456
        qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1457
        then show "interior s \<inter> interior m = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1458
          unfolding divp by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1459
      qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1460
    qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1461
    then show "interior s \<inter> interior (\<Union>(r1-p) \<inter> (\<Union>q)) = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1462
      using interior_subset by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1463
  qed auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1464
qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1465
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1466
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1467
subsection \<open>Tagged (partial) divisions.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1468
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1469
definition tagged_partial_division_of (infixr "tagged'_partial'_division'_of" 40)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1470
  where "s tagged_partial_division_of i \<longleftrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1471
    finite s \<and>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1472
    (\<forall>x k. (x, k) \<in> s \<longrightarrow> x \<in> k \<and> k \<subseteq> i \<and> (\<exists>a b. k = cbox a b)) \<and>
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1473
    (\<forall>x1 k1 x2 k2. (x1, k1) \<in> s \<and> (x2, k2) \<in> s \<and> (x1, k1) \<noteq> (x2, k2) \<longrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1474
      interior k1 \<inter> interior k2 = {})"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1475
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1476
lemma tagged_partial_division_ofD[dest]:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1477
  assumes "s tagged_partial_division_of i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1478
  shows "finite s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1479
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> x \<in> k"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1480
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> k \<subseteq> i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1481
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> \<exists>a b. k = cbox a b"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1482
    and "\<And>x1 k1 x2 k2. (x1,k1) \<in> s \<Longrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1483
      (x2, k2) \<in> s \<Longrightarrow> (x1, k1) \<noteq> (x2, k2) \<Longrightarrow> interior k1 \<inter> interior k2 = {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1484
  using assms unfolding tagged_partial_division_of_def by blast+
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1485
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1486
definition tagged_division_of (infixr "tagged'_division'_of" 40)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1487
  where "s tagged_division_of i \<longleftrightarrow> s tagged_partial_division_of i \<and> (\<Union>{k. \<exists>x. (x,k) \<in> s} = i)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1488
44167
e81d676d598e avoid duplicate rule warnings
huffman
parents: 44140
diff changeset
  1489
lemma tagged_division_of_finite: "s tagged_division_of i \<Longrightarrow> finite s"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1490
  unfolding tagged_division_of_def tagged_partial_division_of_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1491
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1492
lemma tagged_division_of:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1493
  "s tagged_division_of i \<longleftrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1494
    finite s \<and>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1495
    (\<forall>x k. (x, k) \<in> s \<longrightarrow> x \<in> k \<and> k \<subseteq> i \<and> (\<exists>a b. k = cbox a b)) \<and>
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1496
    (\<forall>x1 k1 x2 k2. (x1, k1) \<in> s \<and> (x2, k2) \<in> s \<and> (x1, k1) \<noteq> (x2, k2) \<longrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1497
      interior k1 \<inter> interior k2 = {}) \<and>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1498
    (\<Union>{k. \<exists>x. (x,k) \<in> s} = i)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1499
  unfolding tagged_division_of_def tagged_partial_division_of_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1500
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1501
lemma tagged_division_ofI:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1502
  assumes "finite s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1503
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> x \<in> k"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1504
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> k \<subseteq> i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1505
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> \<exists>a b. k = cbox a b"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1506
    and "\<And>x1 k1 x2 k2. (x1,k1) \<in> s \<Longrightarrow> (x2, k2) \<in> s \<Longrightarrow> (x1, k1) \<noteq> (x2, k2) \<Longrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1507
      interior k1 \<inter> interior k2 = {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1508
    and "(\<Union>{k. \<exists>x. (x,k) \<in> s} = i)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1509
  shows "s tagged_division_of i"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1510
  unfolding tagged_division_of
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1511
  using assms
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1512
  apply auto
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1513
  apply fastforce+
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1514
  done
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1515
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1516
lemma tagged_division_ofD[dest]:  (*FIXME USE A LOCALE*)
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1517
  assumes "s tagged_division_of i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1518
  shows "finite s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1519
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> x \<in> k"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1520
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> k \<subseteq> i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1521
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> \<exists>a b. k = cbox a b"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1522
    and "\<And>x1 k1 x2 k2. (x1, k1) \<in> s \<Longrightarrow> (x2, k2) \<in> s \<Longrightarrow> (x1, k1) \<noteq> (x2, k2) \<Longrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1523
      interior k1 \<inter> interior k2 = {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1524
    and "(\<Union>{k. \<exists>x. (x,k) \<in> s} = i)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1525
  using assms unfolding tagged_division_of by blast+
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1526
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1527
lemma division_of_tagged_division:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1528
  assumes "s tagged_division_of i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1529
  shows "(snd ` s) division_of i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1530
proof (rule division_ofI)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1531
  note assm = tagged_division_ofD[OF assms]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1532
  show "\<Union>(snd ` s) = i" "finite (snd ` s)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1533
    using assm by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1534
  fix k
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1535
  assume k: "k \<in> snd ` s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1536
  then obtain xk where xk: "(xk, k) \<in> s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1537
    by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1538
  then show "k \<subseteq> i" "k \<noteq> {}" "\<exists>a b. k = cbox a b"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1539
    using assm by fastforce+
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1540
  fix k'
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1541
  assume k': "k' \<in> snd ` s" "k \<noteq> k'"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1542
  from this(1) obtain xk' where xk': "(xk', k') \<in> s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1543
    by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1544
  then show "interior k \<inter> interior k' = {}"
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1545
    using assm(5) k'(2) xk by blast
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1546
qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1547
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1548
lemma partial_division_of_tagged_division:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1549
  assumes "s tagged_partial_division_of i"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1550
  shows "(snd ` s) division_of \<Union>(snd ` s)"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1551
proof (rule division_ofI)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1552
  note assm = tagged_partial_division_ofD[OF assms]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1553
  show "finite (snd ` s)" "\<Union>(snd ` s) = \<Union>(snd ` s)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1554
    using assm by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1555
  fix k
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1556
  assume k: "k \<in> snd ` s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1557
  then obtain xk where xk: "(xk, k) \<in> s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1558
    by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1559
  then show "k \<noteq> {}" "\<exists>a b. k = cbox a b" "k \<subseteq> \<Union>(snd ` s)"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1560
    using assm by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1561
  fix k'
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1562
  assume k': "k' \<in> snd ` s" "k \<noteq> k'"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1563
  from this(1) obtain xk' where xk': "(xk', k') \<in> s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1564
    by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1565
  then show "interior k \<inter> interior k' = {}"
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1566
    using assm(5) k'(2) xk by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1567
qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1568
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1569
lemma tagged_partial_division_subset:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1570
  assumes "s tagged_partial_division_of i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1571
    and "t \<subseteq> s"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1572
  shows "t tagged_partial_division_of i"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1573
  using assms
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1574
  unfolding tagged_partial_division_of_def
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1575
  using finite_subset[OF assms(2)]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1576
  by blast
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1577
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1578
lemma setsum_over_tagged_division_lemma:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1579
  assumes "p tagged_division_of i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1580
    and "\<And>u v. cbox u v \<noteq> {} \<Longrightarrow> content (cbox u v) = 0 \<Longrightarrow> d (cbox u v) = 0"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1581
  shows "setsum (\<lambda>(x,k). d k) p = setsum d (snd ` p)"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1582
proof -
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1583
  have *: "(\<lambda>(x,k). d k) = d \<circ> snd"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1584
    unfolding o_def by (rule ext) auto
57129
7edb7550663e introduce more powerful reindexing rules for big operators
hoelzl
parents: 56544
diff changeset
  1585
  note assm = tagged_division_ofD[OF assms(1)]
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1586
  show ?thesis
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1587
    unfolding *
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  1588
  proof (rule setsum.reindex_nontrivial[symmetric])
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1589
    show "finite p"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1590
      using assm by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1591
    fix x y
57129
7edb7550663e introduce more powerful reindexing rules for big operators
hoelzl
parents: 56544
diff changeset
  1592
    assume "x\<in>p" "y\<in>p" "x\<noteq>y" "snd x = snd y"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1593
    obtain a b where ab: "snd x = cbox a b"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1594
      using assm(4)[of "fst x" "snd x"] \<open>x\<in>p\<close> by auto
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1595
    have "(fst x, snd y) \<in> p" "(fst x, snd y) \<noteq> y"
61424
c3658c18b7bc prod_case as canonical name for product type eliminator
haftmann
parents: 61243
diff changeset
  1596
      by (metis prod.collapse \<open>x\<in>p\<close> \<open>snd x = snd y\<close> \<open>x \<noteq> y\<close>)+
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1597
    with \<open>x\<in>p\<close> \<open>y\<in>p\<close> have "interior (snd x) \<inter> interior (snd y) = {}"
57129
7edb7550663e introduce more powerful reindexing rules for big operators
hoelzl
parents: 56544
diff changeset
  1598
      by (intro assm(5)[of "fst x" _ "fst y"]) auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1599
    then have "content (cbox a b) = 0"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1600
      unfolding \<open>snd x = snd y\<close>[symmetric] ab content_eq_0_interior by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1601
    then have "d (cbox a b) = 0"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1602
      using assm(2)[of "fst x" "snd x"] \<open>x\<in>p\<close> ab[symmetric] by (intro assms(2)) auto
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1603
    then show "d (snd x) = 0"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1604
      unfolding ab by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1605
  qed
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1606
qed
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1607
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1608
lemma tag_in_interval: "p tagged_division_of i \<Longrightarrow> (x, k) \<in> p \<Longrightarrow> x \<in> i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1609
  by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1610
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1611
lemma tagged_division_of_empty: "{} tagged_division_of {}"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1612
  unfolding tagged_division_of by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1613
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1614
lemma tagged_partial_division_of_trivial[simp]: "p tagged_partial_division_of {} \<longleftrightarrow> p = {}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1615
  unfolding tagged_partial_division_of_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1616
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1617
lemma tagged_division_of_trivial[simp]: "p tagged_division_of {} \<longleftrightarrow> p = {}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1618
  unfolding tagged_division_of by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1619
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1620
lemma tagged_division_of_self: "x \<in> cbox a b \<Longrightarrow> {(x,cbox a b)} tagged_division_of (cbox a b)"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1621
  by (rule tagged_division_ofI) auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1622
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1623
lemma tagged_division_of_self_real: "x \<in> {a .. b::real} \<Longrightarrow> {(x,{a .. b})} tagged_division_of {a .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1624
  unfolding box_real[symmetric]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1625
  by (rule tagged_division_of_self)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1626
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1627
lemma tagged_division_union:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1628
  assumes "p1 tagged_division_of s1"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1629
    and "p2 tagged_division_of s2"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1630
    and "interior s1 \<inter> interior s2 = {}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1631
  shows "(p1 \<union> p2) tagged_division_of (s1 \<union> s2)"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1632
proof (rule tagged_division_ofI)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1633
  note p1 = tagged_division_ofD[OF assms(1)]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1634
  note p2 = tagged_division_ofD[OF assms(2)]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1635
  show "finite (p1 \<union> p2)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1636
    using p1(1) p2(1) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1637
  show "\<Union>{k. \<exists>x. (x, k) \<in> p1 \<union> p2} = s1 \<union> s2"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1638
    using p1(6) p2(6) by blast
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1639
  fix x k
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1640
  assume xk: "(x, k) \<in> p1 \<union> p2"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1641
  show "x \<in> k" "\<exists>a b. k = cbox a b"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1642
    using xk p1(2,4) p2(2,4) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1643
  show "k \<subseteq> s1 \<union> s2"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1644
    using xk p1(3) p2(3) by blast
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1645
  fix x' k'
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1646
  assume xk': "(x', k') \<in> p1 \<union> p2" "(x, k) \<noteq> (x', k')"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1647
  have *: "\<And>a b. a \<subseteq> s1 \<Longrightarrow> b \<subseteq> s2 \<Longrightarrow> interior a \<inter> interior b = {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1648
    using assms(3) interior_mono by blast
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1649
  show "interior k \<inter> interior k' = {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1650
    apply (cases "(x, k) \<in> p1")
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1651
    apply (meson "*" UnE assms(1) assms(2) p1(5) tagged_division_ofD(3) xk'(1) xk'(2))
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1652
    by (metis "*" UnE assms(1) assms(2) inf_sup_aci(1) p2(5) tagged_division_ofD(3) xk xk'(1) xk'(2))
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1653
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1654
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1655
lemma tagged_division_unions:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1656
  assumes "finite iset"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1657
    and "\<forall>i\<in>iset. pfn i tagged_division_of i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1658
    and "\<forall>i1\<in>iset. \<forall>i2\<in>iset. i1 \<noteq> i2 \<longrightarrow> interior(i1) \<inter> interior(i2) = {}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1659
  shows "\<Union>(pfn ` iset) tagged_division_of (\<Union>iset)"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1660
proof (rule tagged_division_ofI)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1661
  note assm = tagged_division_ofD[OF assms(2)[rule_format]]
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1662
  show "finite (\<Union>(pfn ` iset))"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1663
    apply (rule finite_Union)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1664
    using assms
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1665
    apply auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1666
    done
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1667
  have "\<Union>{k. \<exists>x. (x, k) \<in> \<Union>(pfn ` iset)} = \<Union>((\<lambda>i. \<Union>{k. \<exists>x. (x, k) \<in> pfn i}) ` iset)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1668
    by blast
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1669
  also have "\<dots> = \<Union>iset"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1670
    using assm(6) by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1671
  finally show "\<Union>{k. \<exists>x. (x, k) \<in> \<Union>(pfn ` iset)} = \<Union>iset" .
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1672
  fix x k
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1673
  assume xk: "(x, k) \<in> \<Union>(pfn ` iset)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1674
  then obtain i where i: "i \<in> iset" "(x, k) \<in> pfn i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1675
    by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1676
  show "x \<in> k" "\<exists>a b. k = cbox a b" "k \<subseteq> \<Union>iset"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1677
    using assm(2-4)[OF i] using i(1) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1678
  fix x' k'
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1679
  assume xk': "(x', k') \<in> \<Union>(pfn ` iset)" "(x, k) \<noteq> (x', k')"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1680
  then obtain i' where i': "i' \<in> iset" "(x', k') \<in> pfn i'"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1681
    by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1682
  have *: "\<And>a b. i \<noteq> i' \<Longrightarrow> a \<subseteq> i \<Longrightarrow> b \<subseteq> i' \<Longrightarrow> interior a \<inter> interior b = {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1683
    using i(1) i'(1)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1684
    using assms(3)[rule_format] interior_mono
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1685
    by blast
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1686
  show "interior k \<inter> interior k' = {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1687
    apply (cases "i = i'")
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1688
    using assm(5) i' i(2) xk'(2) apply blast
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1689
    using "*" assm(3) i' i by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1690
qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1691
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1692
lemma tagged_partial_division_of_union_self:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1693
  assumes "p tagged_partial_division_of s"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1694
  shows "p tagged_division_of (\<Union>(snd ` p))"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1695
  apply (rule tagged_division_ofI)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1696
  using tagged_partial_division_ofD[OF assms]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1697
  apply auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1698
  done
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1699
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1700
lemma tagged_division_of_union_self:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1701
  assumes "p tagged_division_of s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1702
  shows "p tagged_division_of (\<Union>(snd ` p))"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1703
  apply (rule tagged_division_ofI)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1704
  using tagged_division_ofD[OF assms]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1705
  apply auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1706
  done
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1707
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1708
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1709
subsection \<open>Fine-ness of a partition w.r.t. a gauge.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1710
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1711
definition fine  (infixr "fine" 46)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1712
  where "d fine s \<longleftrightarrow> (\<forall>(x,k) \<in> s. k \<subseteq> d x)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1713
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1714
lemma fineI:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1715
  assumes "\<And>x k. (x, k) \<in> s \<Longrightarrow> k \<subseteq> d x"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1716
  shows "d fine s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1717
  using assms unfolding fine_def by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1718
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1719
lemma fineD[dest]:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1720
  assumes "d fine s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1721
  shows "\<And>x k. (x,k) \<in> s \<Longrightarrow> k \<subseteq> d x"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1722
  using assms unfolding fine_def by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1723
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1724
lemma fine_inter: "(\<lambda>x. d1 x \<inter> d2 x) fine p \<longleftrightarrow> d1 fine p \<and> d2 fine p"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1725
  unfolding fine_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1726
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1727
lemma fine_inters:
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60492
diff changeset
  1728
 "(\<lambda>x. \<Inter>{f d x | d.  d \<in> s}) fine p \<longleftrightarrow> (\<forall>d\<in>s. (f d) fine p)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1729
  unfolding fine_def by blast
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1730
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1731
lemma fine_union: "d fine p1 \<Longrightarrow> d fine p2 \<Longrightarrow> d fine (p1 \<union> p2)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1732
  unfolding fine_def by blast
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1733
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1734
lemma fine_unions: "(\<And>p. p \<in> ps \<Longrightarrow> d fine p) \<Longrightarrow> d fine (\<Union>ps)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1735
  unfolding fine_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1736
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1737
lemma fine_subset: "p \<subseteq> q \<Longrightarrow> d fine q \<Longrightarrow> d fine p"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1738
  unfolding fine_def by blast
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1739
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1740
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1741
subsection \<open>Gauge integral. Define on compact intervals first, then use a limit.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1742
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1743
definition has_integral_compact_interval (infixr "has'_integral'_compact'_interval" 46)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1744
  where "(f has_integral_compact_interval y) i \<longleftrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1745
    (\<forall>e>0. \<exists>d. gauge d \<and>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1746
      (\<forall>p. p tagged_division_of i \<and> d fine p \<longrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1747
        norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p - y) < e))"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1748
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1749
definition has_integral ::
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1750
    "('n::euclidean_space \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'b \<Rightarrow> 'n set \<Rightarrow> bool"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1751
  (infixr "has'_integral" 46)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1752
  where "(f has_integral y) i \<longleftrightarrow>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1753
    (if \<exists>a b. i = cbox a b
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1754
     then (f has_integral_compact_interval y) i
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1755
     else (\<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
  1756
      (\<exists>z. ((\<lambda>x. if x \<in> i then f x else 0) has_integral_compact_interval z) (cbox a b) \<and>
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1757
        norm (z - y) < e)))"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1758
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1759
lemma has_integral:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1760
  "(f has_integral y) (cbox a b) \<longleftrightarrow>
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1761
    (\<forall>e>0. \<exists>d. gauge d \<and>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1762
      (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow>
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1763
        norm (setsum (\<lambda>(x,k). content(k) *\<^sub>R f x) p - y) < e))"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1764
  unfolding has_integral_def has_integral_compact_interval_def
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1765
  by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1766
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1767
lemma has_integral_real:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1768
  "(f has_integral y) {a .. b::real} \<longleftrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1769
    (\<forall>e>0. \<exists>d. gauge d \<and>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1770
      (\<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
  1771
        norm (setsum (\<lambda>(x,k). content(k) *\<^sub>R f x) p - y) < e))"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1772
  unfolding box_real[symmetric]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1773
  by (rule has_integral)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1774
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1775
lemma has_integralD[dest]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1776
  assumes "(f has_integral y) (cbox a b)"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1777
    and "e > 0"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1778
  obtains d where "gauge d"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1779
    and "\<And>p. p tagged_division_of (cbox a b) \<Longrightarrow> d fine p \<Longrightarrow>
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1780
      norm (setsum (\<lambda>(x,k). content(k) *\<^sub>R f(x)) p - y) < e"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1781
  using assms unfolding has_integral by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1782
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1783
lemma has_integral_alt:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1784
  "(f has_integral y) i \<longleftrightarrow>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1785
    (if \<exists>a b. i = cbox a b
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1786
     then (f has_integral y) i
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1787
     else (\<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
  1788
      (\<exists>z. ((\<lambda>x. if x \<in> i then f(x) else 0) has_integral z) (cbox a b) \<and> norm (z - y) < e)))"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1789
  unfolding has_integral
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1790
  unfolding has_integral_compact_interval_def has_integral_def
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1791
  by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1792
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1793
lemma has_integral_altD:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1794
  assumes "(f has_integral y) i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1795
    and "\<not> (\<exists>a b. i = cbox a b)"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1796
    and "e>0"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1797
  obtains B where "B > 0"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1798
    and "\<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1799
      (\<exists>z. ((\<lambda>x. if x \<in> i then f(x) else 0) has_integral z) (cbox a b) \<and> norm(z - y) < e)"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1800
  using assms
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1801
  unfolding has_integral
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1802
  unfolding has_integral_compact_interval_def has_integral_def
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1803
  by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1804
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1805
definition integrable_on (infixr "integrable'_on" 46)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1806
  where "f integrable_on i \<longleftrightarrow> (\<exists>y. (f has_integral y) i)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1807
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1808
definition "integral i f = (SOME y. (f has_integral y) i)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1809
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1810
lemma integrable_integral[dest]: "f integrable_on i \<Longrightarrow> (f has_integral (integral i f)) i"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1811
  unfolding integrable_on_def integral_def by (rule someI_ex)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1812
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1813
lemma has_integral_integrable[intro]: "(f has_integral i) s \<Longrightarrow> f integrable_on s"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1814
  unfolding integrable_on_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1815
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1816
lemma has_integral_integral: "f integrable_on s \<longleftrightarrow> (f has_integral (integral s f)) s"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1817
  by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1818
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1819
lemma setsum_content_null:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1820
  assumes "content (cbox a b) = 0"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1821
    and "p tagged_division_of (cbox a b)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1822
  shows "setsum (\<lambda>(x,k). content k *\<^sub>R f x) p = (0::'a::real_normed_vector)"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  1823
proof (rule setsum.neutral, rule)
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1824
  fix y
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1825
  assume y: "y \<in> p"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1826
  obtain x k where xk: "y = (x, k)"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1827
    using surj_pair[of y] by blast
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1828
  note assm = tagged_division_ofD(3-4)[OF assms(2) y[unfolded xk]]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1829
  from this(2) obtain c d where k: "k = cbox c d" by blast
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1830
  have "(\<lambda>(x, k). content k *\<^sub>R f x) y = content k *\<^sub>R f x"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1831
    unfolding xk by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1832
  also have "\<dots> = 0"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1833
    using content_subset[OF assm(1)[unfolded k]] content_pos_le[of c d]
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1834
    unfolding assms(1) k
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1835
    by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1836
  finally show "(\<lambda>(x, k). content k *\<^sub>R f x) y = 0" .
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1837
qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1838
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1839
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1840
subsection \<open>Some basic combining lemmas.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1841
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1842
lemma tagged_division_unions_exists:
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1843
  assumes "finite iset"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1844
    and "\<forall>i\<in>iset. \<exists>p. p tagged_division_of i \<and> d fine p"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1845
    and "\<forall>i1\<in>iset. \<forall>i2\<in>iset. i1 \<noteq> i2 \<longrightarrow> interior i1 \<inter> interior i2 = {}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1846
    and "\<Union>iset = i"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1847
   obtains p where "p tagged_division_of i" and "d fine p"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1848
proof -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1849
  obtain pfn where pfn:
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1850
    "\<And>x. x \<in> iset \<Longrightarrow> pfn x tagged_division_of x"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1851
    "\<And>x. x \<in> iset \<Longrightarrow> d fine pfn x"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1852
    using bchoice[OF assms(2)] by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1853
  show thesis
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1854
    apply (rule_tac p="\<Union>(pfn ` iset)" in that)
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1855
    using assms(1) assms(3) assms(4) pfn(1) tagged_division_unions apply force
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1856
    by (metis (mono_tags, lifting) fine_unions imageE pfn(2))
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1857
qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1858
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1859
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1860
subsection \<open>The set we're concerned with must be closed.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1861
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1862
lemma division_of_closed:
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1863
  fixes i :: "'n::euclidean_space set"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1864
  shows "s division_of i \<Longrightarrow> closed i"
44890
22f665a2e91c new fastforce replacing fastsimp - less confusing name
nipkow
parents: 44522
diff changeset
  1865
  unfolding division_of_def by fastforce
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1866
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1867
subsection \<open>General bisection principle for intervals; might be useful elsewhere.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1868
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1869
lemma interval_bisection_step:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1870
  fixes type :: "'a::euclidean_space"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1871
  assumes "P {}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1872
    and "\<forall>s t. P s \<and> P t \<and> interior(s) \<inter> interior(t) = {} \<longrightarrow> P (s \<union> t)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1873
    and "\<not> P (cbox a (b::'a))"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1874
  obtains c d where "\<not> P (cbox c d)"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1875
    and "\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> c\<bullet>i \<le> d\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i \<and> 2 * (d\<bullet>i - c\<bullet>i) \<le> b\<bullet>i - a\<bullet>i"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1876
proof -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1877
  have "cbox a b \<noteq> {}"
54776
db890d9fc5c2 ordered_euclidean_space compatible with more standard pointwise ordering on products; conditionally complete lattice with product order
immler
parents: 54775
diff changeset
  1878
    using assms(1,3) by metis
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1879
  then have ab: "\<And>i. i\<in>Basis \<Longrightarrow> a \<bullet> i \<le> b \<bullet> i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1880
    by (force simp: mem_box)
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1881
  { fix f
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1882
    have "\<lbrakk>finite f;
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1883
           \<And>s. s\<in>f \<Longrightarrow> P s;
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1884
           \<And>s. s\<in>f \<Longrightarrow> \<exists>a b. s = cbox a b;
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1885
           \<And>s t. s\<in>f \<Longrightarrow> t\<in>f \<Longrightarrow> s \<noteq> t \<Longrightarrow> interior s \<inter> interior t = {}\<rbrakk> \<Longrightarrow> P (\<Union>f)"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1886
    proof (induct f rule: finite_induct)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1887
      case empty
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1888
      show ?case
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1889
        using assms(1) by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1890
    next
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1891
      case (insert x f)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1892
      show ?case
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1893
        unfolding Union_insert
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1894
        apply (rule assms(2)[rule_format])
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1895
        using inter_interior_unions_intervals [of f "interior x"]
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1896
        apply (auto simp: insert)
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1897
        by (metis IntI empty_iff insert.hyps(2) insert.prems(3) insert_iff)
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1898
    qed
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1899
  } note UN_cases = this
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1900
  let ?A = "{cbox c d | c d::'a. \<forall>i\<in>Basis. (c\<bullet>i = a\<bullet>i) \<and> (d\<bullet>i = (a\<bullet>i + b\<bullet>i) / 2) \<or>
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1901
    (c\<bullet>i = (a\<bullet>i + b\<bullet>i) / 2) \<and> (d\<bullet>i = b\<bullet>i)}"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1902
  let ?PP = "\<lambda>c d. \<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> c\<bullet>i \<le> d\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i \<and> 2 * (d\<bullet>i - c\<bullet>i) \<le> b\<bullet>i - a\<bullet>i"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1903
  {
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1904
    presume "\<forall>c d. ?PP c d \<longrightarrow> P (cbox c d) \<Longrightarrow> False"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1905
    then show thesis
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1906
      unfolding atomize_not not_all
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  1907
      by (blast intro: that)
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1908
  }
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1909
  assume as: "\<forall>c d. ?PP c d \<longrightarrow> P (cbox c d)"
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60492
diff changeset
  1910
  have "P (\<Union>?A)"
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1911
  proof (rule UN_cases)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1912
    let ?B = "(\<lambda>s. cbox (\<Sum>i\<in>Basis. (if i \<in> s then a\<bullet>i else (a\<bullet>i + b\<bullet>i) / 2) *\<^sub>R i::'a)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1913
      (\<Sum>i\<in>Basis. (if i \<in> s then (a\<bullet>i + b\<bullet>i) / 2 else b\<bullet>i) *\<^sub>R i)) ` {s. s \<subseteq> Basis}"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1914
    have "?A \<subseteq> ?B"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1915
    proof
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1916
      fix x
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  1917
      assume "x \<in> ?A"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  1918
      then obtain c d
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1919
        where x:  "x = cbox c d"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1920
                  "\<And>i. i \<in> Basis \<Longrightarrow>
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1921
                        c \<bullet> i = a \<bullet> i \<and> d \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<or>
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1922
                        c \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<and> d \<bullet> i = b \<bullet> i" by blast
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1923
      show "x \<in> ?B"
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1924
        unfolding image_iff x
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1925
        apply (rule_tac x="{i. i\<in>Basis \<and> c\<bullet>i = a\<bullet>i}" in bexI)
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1926
        apply (rule arg_cong2 [where f = cbox])
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1927
        using x(2) ab
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1928
        apply (auto simp add: euclidean_eq_iff[where 'a='a])
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1929
        by fastforce
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1930
    qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1931
    then show "finite ?A"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1932
      by (rule finite_subset) auto
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1933
  next
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1934
    fix s
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1935
    assume "s \<in> ?A"
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1936
    then obtain c d
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1937
      where s: "s = cbox c d"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1938
               "\<And>i. i \<in> Basis \<Longrightarrow>
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1939
                     c \<bullet> i = a \<bullet> i \<and> d \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<or>
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  1940
                     c \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<and> d \<bullet> i = b \<bullet> i"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1941
      by blast
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1942
    show "P s"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1943
      unfolding s
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1944
      apply (rule as[rule_format])
60394
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
  1945
      using ab s(2) by force
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1946
    show "\<exists>a b. s = cbox a b"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1947
      unfolding s by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1948
    fix t
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1949
    assume "t \<in> ?A"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1950
    then obtain e f where t:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1951
      "t = cbox e f"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1952
      "\<And>i. i \<in> Basis \<Longrightarrow>
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1953
        e \<bullet> i = a \<bullet> i \<and> f \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<or>
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1954
        e \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<and> f \<bullet> i = b \<bullet> i"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1955
      by blast
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1956
    assume "s \<noteq> t"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1957
    then have "\<not> (c = e \<and> d = f)"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1958
      unfolding s t by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1959
    then obtain i where "c\<bullet>i \<noteq> e\<bullet>i \<or> d\<bullet>i \<noteq> f\<bullet>i" and i': "i \<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
  1960
      unfolding euclidean_eq_iff[where 'a='a] by auto
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1961
    then have i: "c\<bullet>i \<noteq> e\<bullet>i" "d\<bullet>i \<noteq> f\<bullet>i"
60394
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
  1962
      using s(2) t(2) apply fastforce
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  1963
      using t(2)[OF i'] \<open>c \<bullet> i \<noteq> e \<bullet> i \<or> d \<bullet> i \<noteq> f \<bullet> i\<close> i' s(2) t(2) by fastforce
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1964
    have *: "\<And>s t. (\<And>a. a \<in> s \<Longrightarrow> a \<in> t \<Longrightarrow> False) \<Longrightarrow> s \<inter> t = {}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1965
      by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1966
    show "interior s \<inter> interior t = {}"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1967
      unfolding s t interior_cbox
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1968
    proof (rule *)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1969
      fix x
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  1970
      assume "x \<in> box c d" "x \<in> box e f"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1971
      then have x: "c\<bullet>i < d\<bullet>i" "e\<bullet>i < f\<bullet>i" "c\<bullet>i < f\<bullet>i" "e\<bullet>i < d\<bullet>i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1972
        unfolding mem_box using i'
60394
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
  1973
        by force+
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
  1974
      show False  using s(2)[OF i']
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
  1975
      proof safe
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1976
        assume as: "c \<bullet> i = a \<bullet> i" "d \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1977
        show False
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1978
          using t(2)[OF i'] and i x unfolding as by (fastforce simp add:field_simps)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1979
      next
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1980
        assume as: "c \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2" "d \<bullet> i = b \<bullet> i"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1981
        show False
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1982
          using t(2)[OF i'] and i x unfolding as by(fastforce simp add:field_simps)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1983
      qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1984
    qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1985
  qed
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60492
diff changeset
  1986
  also have "\<Union>?A = cbox a b"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1987
  proof (rule set_eqI,rule)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1988
    fix x
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1989
    assume "x \<in> \<Union>?A"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1990
    then obtain c d where x:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1991
      "x \<in> cbox c d"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1992
      "\<And>i. i \<in> Basis \<Longrightarrow>
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1993
        c \<bullet> i = a \<bullet> i \<and> d \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<or>
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  1994
        c \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<and> d \<bullet> i = b \<bullet> i"
60394
b699cedd04e8 tidying messy proofs
paulson <lp15@cam.ac.uk>
parents: 60384
diff changeset
  1995
      by blast
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1996
    show "x\<in>cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  1997
      unfolding mem_box
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1998
    proof safe
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1999
      fix i :: 'a
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2000
      assume i: "i \<in> Basis"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2001
      then show "a \<bullet> i \<le> x \<bullet> i" "x \<bullet> i \<le> b \<bullet> i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2002
        using x(2)[OF i] x(1)[unfolded mem_box,THEN bspec, OF i] by auto
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2003
    qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2004
  next
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2005
    fix x
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2006
    assume x: "x \<in> cbox a b"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2007
    have "\<forall>i\<in>Basis.
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2008
      \<exists>c d. (c = a\<bullet>i \<and> d = (a\<bullet>i + b\<bullet>i) / 2 \<or> c = (a\<bullet>i + b\<bullet>i) / 2 \<and> d = b\<bullet>i) \<and> c\<le>x\<bullet>i \<and> x\<bullet>i \<le> d"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2009
      (is "\<forall>i\<in>Basis. \<exists>c d. ?P i c d")
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2010
      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
  2011
    proof
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2012
      fix i :: 'a
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2013
      assume i: "i \<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
  2014
      have "?P i (a\<bullet>i) ((a \<bullet> i + b \<bullet> i) / 2) \<or> ?P i ((a \<bullet> i + b \<bullet> i) / 2) (b\<bullet>i)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2015
        using x[unfolded mem_box,THEN bspec, OF i] by auto
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2016
      then show "\<exists>c d. ?P i c d"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2017
        by blast
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
  2018
    qed
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2019
    then show "x\<in>\<Union>?A"
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
  2020
      unfolding Union_iff Bex_def mem_Collect_eq choice_Basis_iff
60384
b33690cad45e Tidied lots of messy proofs
paulson <lp15@cam.ac.uk>
parents: 60180
diff changeset
  2021
      apply auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2022
      apply (rule_tac x="cbox xa xaa" in exI)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2023
      unfolding mem_box
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2024
      apply auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2025
      done
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2026
  qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2027
  finally show False
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2028
    using assms by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2029
qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2030
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2031
lemma interval_bisection:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2032
  fixes type :: "'a::euclidean_space"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2033
  assumes "P {}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2034
    and "(\<forall>s t. P s \<and> P t \<and> interior(s) \<inter> interior(t) = {} \<longrightarrow> P(s \<union> t))"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2035
    and "\<not> P (cbox a (b::'a))"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2036
  obtains x where "x \<in> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2037
    and "\<forall>e>0. \<exists>c d. x \<in> cbox c d \<and> cbox c d \<subseteq> ball x e \<and> cbox c d \<subseteq> cbox a b \<and> \<not> P (cbox c d)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2038
proof -
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2039
  have "\<forall>x. \<exists>y. \<not> P (cbox (fst x) (snd x)) \<longrightarrow> (\<not> P (cbox (fst y) (snd y)) \<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
  2040
    (\<forall>i\<in>Basis. fst x\<bullet>i \<le> fst y\<bullet>i \<and> fst y\<bullet>i \<le> snd y\<bullet>i \<and> snd y\<bullet>i \<le> snd x\<bullet>i \<and>
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2041
       2 * (snd y\<bullet>i - fst y\<bullet>i) \<le> snd x\<bullet>i - fst x\<bullet>i))" (is "\<forall>x. ?P x")
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2042
  proof
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2043
    show "?P x" for x
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2044
    proof (cases "P (cbox (fst x) (snd x))")
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2045
      case True
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2046
      then show ?thesis by auto
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2047
    next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2048
      case as: False
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2049
      obtain c d where "\<not> P (cbox c d)"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2050
        "\<forall>i\<in>Basis.
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2051
           fst x \<bullet> i \<le> c \<bullet> i \<and>
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2052
           c \<bullet> i \<le> d \<bullet> i \<and>
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2053
           d \<bullet> i \<le> snd x \<bullet> i \<and>
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2054
           2 * (d \<bullet> i - c \<bullet> i) \<le> snd x \<bullet> i - fst x \<bullet> i"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2055
        by (rule interval_bisection_step[of P, OF assms(1-2) as])
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2056
      then show ?thesis
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2057
        apply -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2058
        apply (rule_tac x="(c,d)" in exI)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2059
        apply auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2060
        done
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2061
    qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2062
  qed
55751
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2063
  then obtain f where f:
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2064
    "\<forall>x.
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2065
      \<not> P (cbox (fst x) (snd x)) \<longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2066
      \<not> P (cbox (fst (f x)) (snd (f x))) \<and>
55751
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2067
        (\<forall>i\<in>Basis.
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2068
            fst x \<bullet> i \<le> fst (f x) \<bullet> i \<and>
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2069
            fst (f x) \<bullet> i \<le> snd (f x) \<bullet> i \<and>
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2070
            snd (f x) \<bullet> i \<le> snd x \<bullet> i \<and>
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2071
            2 * (snd (f x) \<bullet> i - fst (f x) \<bullet> i) \<le> snd x \<bullet> i - fst x \<bullet> i)"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2072
    apply -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2073
    apply (drule choice)
55751
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2074
    apply blast
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2075
    done
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2076
  def AB \<equiv> "\<lambda>n. (f ^^ n) (a,b)"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2077
  def A \<equiv> "\<lambda>n. fst(AB n)"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2078
  def B \<equiv> "\<lambda>n. snd(AB n)"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2079
  note ab_def = A_def B_def AB_def
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2080
  have "A 0 = a" "B 0 = b" "\<And>n. \<not> P (cbox (A(Suc n)) (B(Suc n))) \<and>
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  2081
    (\<forall>i\<in>Basis. A(n)\<bullet>i \<le> A(Suc n)\<bullet>i \<and> A(Suc n)\<bullet>i \<le> B(Suc n)\<bullet>i \<and> B(Suc n)\<bullet>i \<le> B(n)\<bullet>i \<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
  2082
    2 * (B(Suc n)\<bullet>i - A(Suc n)\<bullet>i) \<le> B(n)\<bullet>i - A(n)\<bullet>i)" (is "\<And>n. ?P n")
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2083
  proof -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2084
    show "A 0 = a" "B 0 = b"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2085
      unfolding ab_def by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2086
    note S = ab_def funpow.simps o_def id_apply
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2087
    show "?P n" for n
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2088
    proof (induct n)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2089
      case 0
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2090
      then show ?case
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2091
        unfolding S
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2092
        apply (rule f[rule_format]) using assms(3)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2093
        apply auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2094
        done
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2095
    next
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2096
      case (Suc n)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2097
      show ?case
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2098
        unfolding S
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2099
        apply (rule f[rule_format])
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2100
        using Suc
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2101
        unfolding S
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2102
        apply auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2103
        done
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2104
    qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2105
  qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2106
  note AB = this(1-2) conjunctD2[OF this(3),rule_format]
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2107
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2108
  have interv: "\<exists>n. \<forall>x\<in>cbox (A n) (B n). \<forall>y\<in>cbox (A n) (B n). dist x y < e"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2109
    if e: "0 < e" for e
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2110
  proof -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2111
    obtain n where n: "(\<Sum>i\<in>Basis. b \<bullet> i - a \<bullet> i) / e < 2 ^ n"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2112
      using real_arch_pow2[of "(setsum (\<lambda>i. b\<bullet>i - a\<bullet>i) Basis) / e"] ..
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2113
    show ?thesis
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2114
    proof (rule exI [where x=n], clarify)
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2115
      fix x y
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2116
      assume xy: "x\<in>cbox (A n) (B n)" "y\<in>cbox (A n) (B n)"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2117
      have "dist x y \<le> setsum (\<lambda>i. abs((x - y)\<bullet>i)) Basis"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2118
        unfolding dist_norm by(rule norm_le_l1)
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
  2119
      also have "\<dots> \<le> setsum (\<lambda>i. B n\<bullet>i - A n\<bullet>i) Basis"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2120
      proof (rule setsum_mono)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2121
        fix i :: 'a
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2122
        assume i: "i \<in> Basis"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2123
        show "\<bar>(x - y) \<bullet> i\<bar> \<le> B n \<bullet> i - A n \<bullet> i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2124
          using xy[unfolded mem_box,THEN bspec, OF i]
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2125
          by (auto simp: inner_diff_left)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2126
      qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2127
      also have "\<dots> \<le> setsum (\<lambda>i. b\<bullet>i - a\<bullet>i) Basis / 2^n"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2128
        unfolding setsum_divide_distrib
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2129
      proof (rule setsum_mono)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2130
        show "B n \<bullet> i - A n \<bullet> i \<le> (b \<bullet> i - a \<bullet> i) / 2 ^ n" if i: "i \<in> Basis" for i
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2131
        proof (induct n)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2132
          case 0
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2133
          then show ?case
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2134
            unfolding AB by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2135
        next
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2136
          case (Suc n)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2137
          have "B (Suc n) \<bullet> i - A (Suc n) \<bullet> i \<le> (B n \<bullet> i - A n \<bullet> i) / 2"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2138
            using AB(4)[of i n] using i by auto
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2139
          also have "\<dots> \<le> (b \<bullet> i - a \<bullet> i) / 2 ^ Suc n"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2140
            using Suc by (auto simp add: field_simps)
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2141
          finally show ?case .
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2142
        qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2143
      qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2144
      also have "\<dots> < e"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2145
        using n using e by (auto simp add: field_simps)
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2146
      finally show "dist x y < e" .
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2147
    qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2148
  qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2149
  {
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2150
    fix n m :: nat
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2151
    assume "m \<le> n" then have "cbox (A n) (B n) \<subseteq> cbox (A m) (B m)"
54411
f72e58a5a75f stronger inc_induct and dec_induct
hoelzl
parents: 54263
diff changeset
  2152
    proof (induction rule: inc_induct)
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2153
      case (step i)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2154
      show ?case
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2155
        using AB(4) by (intro order_trans[OF step.IH] subset_box_imp) auto
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2156
    qed simp
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2157
  } note ABsubset = this
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2158
  have "\<exists>a. \<forall>n. a\<in> cbox (A n) (B n)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2159
    by (rule decreasing_closed_nest[rule_format,OF closed_cbox _ ABsubset interv])
54776
db890d9fc5c2 ordered_euclidean_space compatible with more standard pointwise ordering on products; conditionally complete lattice with product order
immler
parents: 54775
diff changeset
  2160
      (metis nat.exhaust AB(1-3) assms(1,3))
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2161
  then obtain x0 where x0: "\<And>n. x0 \<in> cbox (A n) (B n)"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2162
    by blast
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2163
  show thesis
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2164
  proof (rule that[rule_format, of x0])
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2165
    show "x0\<in>cbox a b"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2166
      using x0[of 0] unfolding AB .
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2167
    fix e :: real
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2168
    assume "e > 0"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2169
    from interv[OF this] obtain n
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2170
      where n: "\<forall>x\<in>cbox (A n) (B n). \<forall>y\<in>cbox (A n) (B n). dist x y < e" ..
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2171
    have "\<not> P (cbox (A n) (B n))"
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2172
      apply (cases "0 < n")
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2173
      using AB(3)[of "n - 1"] assms(3) AB(1-2)
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2174
      apply auto
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2175
      done
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2176
    moreover have "cbox (A n) (B n) \<subseteq> ball x0 e"
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2177
      using n using x0[of n] by auto
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2178
    moreover have "cbox (A n) (B n) \<subseteq> cbox a b"
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2179
      unfolding AB(1-2)[symmetric] by (rule ABsubset) auto
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2180
    ultimately show "\<exists>c d. x0 \<in> cbox c d \<and> cbox c d \<subseteq> ball x0 e \<and> cbox c d \<subseteq> cbox a b \<and> \<not> P (cbox c d)"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2181
      apply (rule_tac x="A n" in exI)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2182
      apply (rule_tac x="B n" in exI)
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2183
      apply (auto simp: x0)
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2184
      done
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2185
  qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2186
qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2187
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2188
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2189
subsection \<open>Cousin's lemma.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2190
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2191
lemma fine_division_exists:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2192
  fixes a b :: "'a::euclidean_space"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2193
  assumes "gauge g"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2194
  obtains p where "p tagged_division_of (cbox a b)" "g fine p"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2195
proof -
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2196
  presume "\<not> (\<exists>p. p tagged_division_of (cbox a b) \<and> g fine p) \<Longrightarrow> False"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2197
  then obtain p where "p tagged_division_of (cbox a b)" "g fine p"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2198
    by blast
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2199
  then show thesis ..
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2200
next
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2201
  assume as: "\<not> (\<exists>p. p tagged_division_of (cbox a b) \<and> g fine p)"
55751
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2202
  obtain x where x:
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2203
      "x \<in> (cbox a b)"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2204
      "\<And>e. 0 < e \<Longrightarrow>
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2205
        \<exists>c d.
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2206
          x \<in> cbox c d \<and>
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2207
          cbox c d \<subseteq> ball x e \<and>
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2208
          cbox c d \<subseteq> (cbox a b) \<and>
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2209
          \<not> (\<exists>p. p tagged_division_of cbox c d \<and> g fine p)"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2210
    apply (rule interval_bisection[of "\<lambda>s. \<exists>p. p tagged_division_of s \<and> g fine p", OF _ _ as])
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2211
    apply (simp add: fine_def)
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2212
    apply (metis tagged_division_union fine_union)
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2213
    apply (auto simp: )
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2214
    done
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2215
  obtain e where e: "e > 0" "ball x e \<subseteq> g x"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2216
    using gaugeD[OF assms, of x] unfolding open_contains_ball by auto
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  2217
  from x(2)[OF e(1)]
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2218
  obtain c d where c_d: "x \<in> cbox c d"
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2219
                        "cbox c d \<subseteq> ball x e"
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2220
                        "cbox c d \<subseteq> cbox a b"
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2221
                        "\<not> (\<exists>p. p tagged_division_of cbox c d \<and> g fine p)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2222
    by blast
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2223
  have "g fine {(x, cbox c d)}"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2224
    unfolding fine_def using e using c_d(2) by auto
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2225
  then show False
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2226
    using tagged_division_of_self[OF c_d(1)] using c_d by auto
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2227
qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2228
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2229
lemma fine_division_exists_real:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2230
  fixes a b :: real
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2231
  assumes "gauge g"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2232
  obtains p where "p tagged_division_of {a .. b}" "g fine p"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2233
  by (metis assms box_real(2) fine_division_exists)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2234
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2235
subsection \<open>Basic theorems about integrals.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2236
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2237
lemma has_integral_unique:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2238
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2239
  assumes "(f has_integral k1) i"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2240
    and "(f has_integral k2) i"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2241
  shows "k1 = k2"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2242
proof (rule ccontr)
53842
b98c6cd90230 tuned proofs;
wenzelm
parents: 53638
diff changeset
  2243
  let ?e = "norm (k1 - k2) / 2"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2244
  assume as: "k1 \<noteq> k2"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2245
  then have e: "?e > 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2246
    by auto
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2247
  have lem: False
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2248
    if f_k1: "(f has_integral k1) (cbox a b)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2249
    and f_k2: "(f has_integral k2) (cbox a b)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2250
    and "k1 \<noteq> k2"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2251
    for f :: "'n \<Rightarrow> 'a" and a b k1 k2
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2252
  proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2253
    let ?e = "norm (k1 - k2) / 2"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2254
    from \<open>k1 \<noteq> k2\<close> have e: "?e > 0" by auto
55751
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2255
    obtain d1 where d1:
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2256
        "gauge d1"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2257
        "\<And>p. p tagged_division_of cbox a b \<Longrightarrow>
55751
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2258
          d1 fine p \<Longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - k1) < norm (k1 - k2) / 2"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2259
      by (rule has_integralD[OF f_k1 e]) blast
55751
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2260
    obtain d2 where d2:
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2261
        "gauge d2"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2262
        "\<And>p. p tagged_division_of cbox a b \<Longrightarrow>
55751
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2263
          d2 fine p \<Longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - k2) < norm (k1 - k2) / 2"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2264
      by (rule has_integralD[OF f_k2 e]) blast
55751
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2265
    obtain p where p:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2266
        "p tagged_division_of cbox a b"
55751
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2267
        "(\<lambda>x. d1 x \<inter> d2 x) fine p"
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2268
      by (rule fine_division_exists[OF gauge_inter[OF d1(1) d2(1)]])
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2269
    let ?c = "(\<Sum>(x, k)\<in>p. content k *\<^sub>R f x)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2270
    have "norm (k1 - k2) \<le> norm (?c - k2) + norm (?c - k1)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2271
      using norm_triangle_ineq4[of "k1 - ?c" "k2 - ?c"]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2272
      by (auto simp add:algebra_simps norm_minus_commute)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2273
    also have "\<dots> < norm (k1 - k2) / 2 + norm (k1 - k2) / 2"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2274
      apply (rule add_strict_mono)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2275
      apply (rule_tac[!] d2(2) d1(2))
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2276
      using p unfolding fine_def
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2277
      apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2278
      done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2279
    finally show False by auto
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2280
  qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2281
  {
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2282
    presume "\<not> (\<exists>a b. i = cbox a b) \<Longrightarrow> False"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2283
    then show False
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2284
      using as assms lem by blast
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2285
  }
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2286
  assume as: "\<not> (\<exists>a b. i = cbox a b)"
55751
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2287
  obtain B1 where B1:
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2288
      "0 < B1"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2289
      "\<And>a b. ball 0 B1 \<subseteq> cbox a b \<Longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2290
        \<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
  2291
          norm (z - k1) < norm (k1 - k2) / 2"
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2292
    by (rule has_integral_altD[OF assms(1) as,OF e]) blast
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2293
  obtain B2 where B2:
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2294
      "0 < B2"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2295
      "\<And>a b. ball 0 B2 \<subseteq> cbox a b \<Longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2296
        \<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
  2297
          norm (z - k2) < norm (k1 - k2) / 2"
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2298
    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
  2299
  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
  2300
    apply (rule bounded_subset_cbox)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2301
    using bounded_Un bounded_ball
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2302
    apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2303
    done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2304
  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
  2305
    by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2306
  obtain w where w:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2307
    "((\<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
  2308
    "norm (w - k1) < norm (k1 - k2) / 2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2309
    using B1(2)[OF ab(1)] by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2310
  obtain z where z:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2311
    "((\<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
  2312
    "norm (z - k2) < norm (k1 - k2) / 2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2313
    using B2(2)[OF ab(2)] by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2314
  have "z = w"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2315
    using lem[OF w(1) z(1)] by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2316
  then have "norm (k1 - k2) \<le> norm (z - k2) + norm (w - k1)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2317
    using norm_triangle_ineq4 [of "k1 - w" "k2 - z"]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2318
    by (auto simp add: norm_minus_commute)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2319
  also have "\<dots> < norm (k1 - k2) / 2 + norm (k1 - k2) / 2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2320
    apply (rule add_strict_mono)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2321
    apply (rule_tac[!] z(2) w(2))
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2322
    done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2323
  finally show False by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2324
qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2325
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2326
lemma integral_unique [intro]: "(f has_integral y) k \<Longrightarrow> integral k f = y"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2327
  unfolding integral_def
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2328
  by (rule some_equality) (auto intro: has_integral_unique)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2329
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2330
lemma has_integral_is_0:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2331
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2332
  assumes "\<forall>x\<in>s. f x = 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2333
  shows "(f has_integral 0) s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2334
proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2335
  have lem: "\<And>a b. \<And>f::'n \<Rightarrow> 'a.
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2336
    (\<forall>x\<in>cbox a b. f(x) = 0) \<Longrightarrow> (f has_integral 0) (cbox a b)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2337
    unfolding has_integral
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2338
  proof clarify
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2339
    fix a b e
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2340
    fix f :: "'n \<Rightarrow> 'a"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2341
    assume as: "\<forall>x\<in>cbox a b. f x = 0" "0 < (e::real)"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2342
    have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - 0) < e"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2343
      if p: "p tagged_division_of cbox a b" for p
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2344
    proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2345
      have "(\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) = 0"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  2346
      proof (rule setsum.neutral, rule)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2347
        fix x
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2348
        assume x: "x \<in> p"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2349
        have "f (fst x) = 0"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2350
          using tagged_division_ofD(2-3)[OF p, of "fst x" "snd x"] using as x by auto
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2351
        then show "(\<lambda>(x, k). content k *\<^sub>R f x) x = 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2352
          apply (subst surjective_pairing[of x])
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2353
          unfolding split_conv
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2354
          apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2355
          done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2356
      qed
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2357
      then show ?thesis
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2358
        using as by auto
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2359
    qed
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2360
    then show "\<exists>d. gauge d \<and>
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2361
        (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - 0) < e)"
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2362
      by auto
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2363
  qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2364
  {
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2365
    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
  2366
    with assms lem show ?thesis
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2367
      by blast
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2368
  }
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2369
  have *: "(\<lambda>x. if x \<in> s then f x else 0) = (\<lambda>x. 0)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2370
    apply (rule ext)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2371
    using assms
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2372
    apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2373
    done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2374
  assume "\<not> (\<exists>a b. s = cbox a b)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2375
  then show ?thesis
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2376
    using lem
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2377
    by (subst has_integral_alt) (force simp add: *)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2378
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2379
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2380
lemma has_integral_0[simp]: "((\<lambda>x::'n::euclidean_space. 0) has_integral 0) s"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2381
  by (rule has_integral_is_0) auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2382
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2383
lemma has_integral_0_eq[simp]: "((\<lambda>x. 0) has_integral i) s \<longleftrightarrow> i = 0"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2384
  using has_integral_unique[OF has_integral_0] by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2385
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2386
lemma has_integral_linear:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2387
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2388
  assumes "(f has_integral y) s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2389
    and "bounded_linear h"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2390
  shows "((h o f) has_integral ((h y))) s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2391
proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2392
  interpret bounded_linear h
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2393
    using assms(2) .
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2394
  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
  2395
    by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2396
  have lem: "\<And>(f :: 'n \<Rightarrow> 'a) y a b.
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2397
    (f has_integral y) (cbox a b) \<Longrightarrow> ((h o f) has_integral h y) (cbox a b)"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2398
    unfolding has_integral
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  2399
  proof (clarify, goal_cases)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  2400
    case prems: (1 f y a b e)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2401
    from pos_bounded
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2402
    obtain B where B: "0 < B" "\<And>x. norm (h x) \<le> norm x * B"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2403
      by blast
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  2404
    have "e / B > 0" using prems(2) B 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
  2405
    then obtain g
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2406
      where g: "gauge g"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2407
               "\<And>p. p tagged_division_of (cbox a b) \<Longrightarrow> g fine p \<Longrightarrow>
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2408
                    norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - y) < e / B"
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  2409
        using prems(1) by auto
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2410
    {
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2411
      fix p
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2412
      assume as: "p tagged_division_of (cbox a b)" "g fine p"
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2413
      have hc: "\<And>x k. h ((\<lambda>(x, k). content k *\<^sub>R f x) x) = (\<lambda>(x, k). h (content k *\<^sub>R f x)) x"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2414
        by auto
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2415
      then have "(\<Sum>(x, k)\<in>p. content k *\<^sub>R (h \<circ> f) x) = setsum (h \<circ> (\<lambda>(x, k). content k *\<^sub>R f x)) p"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2416
        unfolding o_def unfolding scaleR[symmetric] hc by simp
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2417
      also have "\<dots> = h (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2418
        using setsum[of "\<lambda>(x,k). content k *\<^sub>R f x" p] using as by auto
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2419
      finally have "(\<Sum>(x, k)\<in>p. content k *\<^sub>R (h \<circ> f) x) = h (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x)" .
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2420
      then have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R (h \<circ> f) x) - h y) < e"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2421
        apply (simp add: diff[symmetric])
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2422
        apply (rule le_less_trans[OF B(2)])
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2423
        using g(2)[OF as] B(1)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2424
        apply (auto simp add: field_simps)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2425
        done
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2426
    }
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2427
    with g show ?case
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2428
      by (rule_tac x=g in exI) auto
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2429
  qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2430
  {
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2431
    presume "\<not> (\<exists>a b. s = cbox a b) \<Longrightarrow> ?thesis"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2432
    then show ?thesis
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2433
      using assms(1) lem by blast
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2434
  }
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2435
  assume as: "\<not> (\<exists>a b. s = cbox a b)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2436
  then show ?thesis
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2437
  proof (subst has_integral_alt, clarsimp)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2438
    fix e :: real
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2439
    assume e: "e > 0"
56541
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56536
diff changeset
  2440
    have *: "0 < e/B" using e B(1) by simp
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2441
    obtain M where M:
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2442
      "M > 0"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2443
      "\<And>a b. ball 0 M \<subseteq> cbox a b \<Longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2444
        \<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
  2445
      using has_integral_altD[OF assms(1) as *] by blast
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2446
    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
  2447
      (\<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
  2448
    proof (rule_tac x=M in exI, clarsimp simp add: M, goal_cases)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  2449
      case prems: (1 a b)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2450
      obtain z where z:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2451
        "((\<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
  2452
        "norm (z - y) < e / B"
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  2453
        using M(2)[OF prems(1)] by blast
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2454
      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
  2455
        using zero by auto
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2456
      show ?case
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2457
        apply (rule_tac x="h z" in exI)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2458
        apply (simp add: * lem z(1))
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2459
        apply (metis B diff le_less_trans pos_less_divide_eq z(2))
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2460
        done
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2461
    qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2462
  qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2463
qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2464
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  2465
lemma has_integral_scaleR_left:
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  2466
  "(f has_integral y) s \<Longrightarrow> ((\<lambda>x. f x *\<^sub>R c) has_integral (y *\<^sub>R c)) s"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  2467
  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
  2468
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  2469
lemma has_integral_mult_left:
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  2470
  fixes c :: "_ :: {real_normed_algebra}"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  2471
  shows "(f has_integral y) s \<Longrightarrow> ((\<lambda>x. f x * c) has_integral (y * c)) s"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  2472
  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
  2473
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  2474
corollary integral_mult_left:
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  2475
  fixes c:: "'a::real_normed_algebra"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  2476
  shows "f integrable_on s \<Longrightarrow> integral s (\<lambda>x. f x * c) = integral s f * c"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  2477
  by (blast intro:  has_integral_mult_left)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  2478
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
  2479
lemma has_integral_mult_right:
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
  2480
  fixes c :: "'a :: real_normed_algebra"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
  2481
  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
  2482
  using has_integral_linear[OF _ bounded_linear_mult_right] by (simp add: comp_def)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2483
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2484
lemma has_integral_cmul: "(f has_integral k) s \<Longrightarrow> ((\<lambda>x. c *\<^sub>R f x) has_integral (c *\<^sub>R k)) s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2485
  unfolding o_def[symmetric]
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2486
  by (metis has_integral_linear bounded_linear_scaleR_right)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2487
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  2488
lemma has_integral_cmult_real:
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  2489
  fixes c :: real
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  2490
  assumes "c \<noteq> 0 \<Longrightarrow> (f has_integral x) A"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  2491
  shows "((\<lambda>x. c * f x) has_integral c * x) A"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2492
proof (cases "c = 0")
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2493
  case True
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2494
  then show ?thesis by simp
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2495
next
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2496
  case False
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  2497
  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
  2498
    unfolding real_scaleR_def .
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2499
qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2500
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2501
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
  2502
  by (drule_tac c="-1" in has_integral_cmul) auto
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2503
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2504
lemma has_integral_add:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2505
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2506
  assumes "(f has_integral k) s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2507
    and "(g has_integral l) s"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2508
  shows "((\<lambda>x. f x + g x) has_integral (k + l)) s"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2509
proof -
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2510
  have lem: "((\<lambda>x. f x + g x) has_integral (k + l)) (cbox a b)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2511
    if f_k: "(f has_integral k) (cbox a b)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2512
    and g_l: "(g has_integral l) (cbox a b)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2513
    for f :: "'n \<Rightarrow> 'a" and g a b k l
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2514
    unfolding has_integral
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2515
  proof clarify
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2516
    fix e :: real
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2517
    assume e: "e > 0"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2518
    then have *: "e / 2 > 0"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2519
      by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2520
    obtain d1 where d1:
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2521
      "gauge d1"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2522
      "\<And>p. p tagged_division_of (cbox a b) \<Longrightarrow> d1 fine p \<Longrightarrow>
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2523
        norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - k) < e / 2"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2524
      using has_integralD[OF f_k *] by blast
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2525
    obtain d2 where d2:
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2526
      "gauge d2"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2527
      "\<And>p. p tagged_division_of (cbox a b) \<Longrightarrow> d2 fine p \<Longrightarrow>
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2528
        norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - l) < e / 2"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2529
      using has_integralD[OF g_l *] by blast
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2530
    show "\<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow>
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2531
              norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R (f x + g x)) - (k + l)) < e)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2532
    proof (rule exI [where x="\<lambda>x. (d1 x) \<inter> (d2 x)"], clarsimp simp add: gauge_inter[OF d1(1) d2(1)])
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2533
      fix p
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2534
      assume as: "p tagged_division_of (cbox a b)" "(\<lambda>x. d1 x \<inter> d2 x) fine p"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2535
      have *: "(\<Sum>(x, k)\<in>p. content k *\<^sub>R (f x + g x)) =
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2536
        (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) + (\<Sum>(x, k)\<in>p. content k *\<^sub>R g x)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2537
        unfolding scaleR_right_distrib setsum.distrib[of "\<lambda>(x,k). content k *\<^sub>R f x" "\<lambda>(x,k). content k *\<^sub>R g x" p,symmetric]
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2538
        by (rule setsum.cong) auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2539
      from as have fine: "d1 fine p" "d2 fine p"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2540
        unfolding fine_inter by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2541
      have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R (f x + g x)) - (k + l)) =
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2542
            norm (((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - k) + ((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - l))"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2543
        unfolding * by (auto simp add: algebra_simps)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2544
      also have "\<dots> < e/2 + e/2"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2545
        apply (rule le_less_trans[OF norm_triangle_ineq])
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2546
        using as d1 d2 fine
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2547
        apply (blast intro: add_strict_mono)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2548
        done
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2549
      finally show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R (f x + g x)) - (k + l)) < e"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2550
        by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2551
    qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2552
  qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2553
  {
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2554
    presume "\<not> (\<exists>a b. s = cbox a b) \<Longrightarrow> ?thesis"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2555
    then show ?thesis
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2556
      using assms lem by force
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2557
  }
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2558
  assume as: "\<not> (\<exists>a b. s = cbox a b)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2559
  then show ?thesis
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  2560
  proof (subst has_integral_alt, clarsimp, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2561
    case (1 e)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2562
    then have *: "e / 2 > 0"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2563
      by auto
55751
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2564
    from has_integral_altD[OF assms(1) as *]
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2565
    obtain B1 where B1:
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2566
        "0 < B1"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2567
        "\<And>a b. ball 0 B1 \<subseteq> cbox a b \<Longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2568
          \<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
  2569
      by blast
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2570
    from has_integral_altD[OF assms(2) as *]
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2571
    obtain B2 where B2:
5ccf72c9a957 tuned proofs;
wenzelm
parents: 55417
diff changeset
  2572
        "0 < B2"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2573
        "\<And>a b. ball 0 B2 \<subseteq> (cbox a b) \<Longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2574
          \<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
  2575
      by blast
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2576
    show ?case
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2577
    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
  2578
      fix a b
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2579
      assume "ball 0 (max B1 B2) \<subseteq> cbox a (b::'n)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2580
      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
  2581
        by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2582
      obtain w where w:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2583
        "((\<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
  2584
        "norm (w - k) < e / 2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2585
        using B1(2)[OF *(1)] by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2586
      obtain z where z:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2587
        "((\<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
  2588
        "norm (z - l) < e / 2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2589
        using B2(2)[OF *(2)] by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2590
      have *: "\<And>x. (if x \<in> s then f x + g x else 0) =
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2591
        (if x \<in> s then f x else 0) + (if x \<in> s then g x else 0)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2592
        by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2593
      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
  2594
        apply (rule_tac x="w + z" in exI)
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2595
        apply (simp add: lem[OF w(1) z(1), unfolded *[symmetric]])
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2596
        using norm_triangle_ineq[of "w - k" "z - l"] w(2) z(2)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2597
        apply (auto simp add: field_simps)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2598
        done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2599
    qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2600
  qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2601
qed
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_sub:
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2604
  "(f has_integral k) s \<Longrightarrow> (g has_integral l) s \<Longrightarrow>
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2605
    ((\<lambda>x. f x - g x) has_integral (k - l)) s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2606
  using has_integral_add[OF _ has_integral_neg, of f k s g l]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2607
  unfolding algebra_simps
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2608
  by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2609
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2610
lemma integral_0:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2611
  "integral s (\<lambda>x::'n::euclidean_space. 0::'m::real_normed_vector) = 0"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2612
  by (rule integral_unique has_integral_0)+
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2613
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2614
lemma integral_add: "f integrable_on s \<Longrightarrow> g integrable_on s \<Longrightarrow>
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2615
    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
  2616
  by (rule integral_unique) (metis integrable_integral has_integral_add)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2617
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2618
lemma integral_cmul: "f integrable_on s \<Longrightarrow> integral s (\<lambda>x. c *\<^sub>R f x) = c *\<^sub>R integral s f"
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2619
  by (rule integral_unique) (metis integrable_integral has_integral_cmul)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2620
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2621
lemma integral_neg: "f integrable_on s \<Longrightarrow> integral s (\<lambda>x. - f x) = - integral s f"
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2622
  by (rule integral_unique) (metis integrable_integral has_integral_neg)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2623
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2624
lemma integral_sub: "f integrable_on s \<Longrightarrow> g integrable_on s \<Longrightarrow>
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2625
    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
  2626
  by (rule integral_unique) (metis integrable_integral has_integral_sub)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2627
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2628
lemma integrable_0: "(\<lambda>x. 0) integrable_on s"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2629
  unfolding integrable_on_def using has_integral_0 by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2630
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2631
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
  2632
  unfolding integrable_on_def by(auto intro: has_integral_add)
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2633
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2634
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
  2635
  unfolding integrable_on_def by(auto intro: has_integral_cmul)
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2636
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  2637
lemma integrable_on_cmult_iff:
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2638
  fixes c :: real
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2639
  assumes "c \<noteq> 0"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  2640
  shows "(\<lambda>x. c * f x) integrable_on s \<longleftrightarrow> f integrable_on s"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2641
  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
  2642
  by auto
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  2643
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2644
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
  2645
  unfolding integrable_on_def by(auto intro: has_integral_neg)
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2646
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2647
lemma integrable_sub:
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2648
  "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
  2649
  unfolding integrable_on_def by(auto intro: has_integral_sub)
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2650
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2651
lemma integrable_linear:
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2652
  "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
  2653
  unfolding integrable_on_def by(auto intro: has_integral_linear)
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2654
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2655
lemma integral_linear:
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2656
  "f integrable_on s \<Longrightarrow> bounded_linear h \<Longrightarrow> integral s (h \<circ> f) = h (integral s f)"
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2657
  apply (rule has_integral_unique [where i=s and f = "h \<circ> f"])
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2658
  apply (simp_all add: integrable_integral integrable_linear has_integral_linear )
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2659
  done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2660
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2661
lemma integral_component_eq[simp]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2662
  fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2663
  assumes "f integrable_on s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2664
  shows "integral s (\<lambda>x. f x \<bullet> k) = integral s f \<bullet> k"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  2665
  unfolding integral_linear[OF assms(1) bounded_linear_component,unfolded o_def] ..
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  2666
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2667
lemma has_integral_setsum:
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2668
  assumes "finite t"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2669
    and "\<forall>a\<in>t. ((f a) has_integral (i a)) s"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2670
  shows "((\<lambda>x. setsum (\<lambda>a. f a x) t) has_integral (setsum i t)) s"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2671
  using assms(1) subset_refl[of t]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2672
proof (induct rule: finite_subset_induct)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2673
  case empty
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2674
  then show ?case by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2675
next
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2676
  case (insert x F)
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2677
  with assms show ?case
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2678
    by (simp add: has_integral_add)
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2679
qed
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2680
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2681
lemma integral_setsum:
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2682
  "\<lbrakk>finite t;  \<forall>a\<in>t. (f a) integrable_on s\<rbrakk> \<Longrightarrow>
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2683
   integral s (\<lambda>x. setsum (\<lambda>a. f a x) t) = setsum (\<lambda>a. integral s (f a)) t"
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2684
  by (auto intro: has_integral_setsum integrable_integral)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2685
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2686
lemma integrable_setsum:
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2687
  "\<lbrakk>finite t;  \<forall>a\<in>t. (f a) integrable_on s\<rbrakk> \<Longrightarrow> (\<lambda>x. setsum (\<lambda>a. f a x) t) integrable_on s"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2688
  unfolding integrable_on_def
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2689
  apply (drule bchoice)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2690
  using has_integral_setsum[of t]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2691
  apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2692
  done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2693
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2694
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
  2695
  assumes "\<And>x. x \<in> s \<Longrightarrow> f x = g x"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2696
    and "(f has_integral k) s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2697
  shows "(g has_integral k) s"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2698
  using has_integral_sub[OF assms(2), of "\<lambda>x. f x - g x" 0]
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2699
  using has_integral_is_0[of s "\<lambda>x. f x - g x"]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2700
  using assms(1)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2701
  by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2702
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  2703
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
  2704
  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
  2705
  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
  2706
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  2707
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
  2708
  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
  2709
  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
  2710
  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
  2711
  by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2712
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  2713
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
  2714
  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
  2715
  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
  2716
  unfolding integral_def
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  2717
  by (metis assms 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
  2718
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  2719
lemma has_integral_null [intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2720
  assumes "content(cbox a b) = 0"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2721
  shows "(f has_integral 0) (cbox a b)"
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2722
proof -
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2723
  have "gauge (\<lambda>x. ball x 1)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2724
    by auto
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2725
  moreover
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2726
  {
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2727
    fix e :: real
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2728
    fix p
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2729
    assume e: "e > 0"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2730
    assume p: "p tagged_division_of (cbox a b)"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2731
    have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - 0) = 0"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2732
      unfolding norm_eq_zero diff_0_right
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2733
      using setsum_content_null[OF assms(1) p, of f] .
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2734
    then have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - 0) < e"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2735
      using e by auto
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2736
  }
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2737
  ultimately show ?thesis
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  2738
    by (auto simp: has_integral)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2739
qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2740
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  2741
lemma has_integral_null_real [intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2742
  assumes "content {a .. b::real} = 0"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2743
  shows "(f has_integral 0) {a .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2744
  by (metis assms box_real(2) has_integral_null)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2745
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2746
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
  2747
  by (auto simp add: has_integral_null dest!: integral_unique)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2748
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  2749
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
  2750
  by (metis has_integral_null integral_unique)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2751
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  2752
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
  2753
  by (simp add: has_integral_integrable)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2754
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2755
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
  2756
  by (simp add: has_integral_is_0)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2757
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2758
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
  2759
  by (auto simp add: has_integral_empty has_integral_unique)
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2760
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2761
lemma integrable_on_empty[intro]: "f integrable_on {}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2762
  unfolding integrable_on_def by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2763
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2764
lemma integral_empty[simp]: "integral {} f = 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2765
  by (rule integral_unique) (rule has_integral_empty)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2766
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2767
lemma has_integral_refl[intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2768
  fixes a :: "'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2769
  shows "(f has_integral 0) (cbox a a)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2770
    and "(f has_integral 0) {a}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2771
proof -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2772
  have *: "{a} = cbox a a"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2773
    apply (rule set_eqI)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2774
    unfolding mem_box singleton_iff euclidean_eq_iff[where 'a='a]
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2775
    apply safe
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2776
    prefer 3
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2777
    apply (erule_tac x=b in ballE)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2778
    apply (auto simp add: field_simps)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2779
    done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2780
  show "(f has_integral 0) (cbox a a)" "(f has_integral 0) {a}"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2781
    unfolding *
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2782
    apply (rule_tac[!] has_integral_null)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2783
    unfolding content_eq_0_interior
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2784
    unfolding interior_cbox
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2785
    using box_sing
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2786
    apply auto
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2787
    done
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2788
qed
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2789
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2790
lemma integrable_on_refl[intro]: "f integrable_on cbox a a"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2791
  unfolding integrable_on_def by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2792
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
  2793
lemma integral_refl [simp]: "integral (cbox a a) f = 0"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2794
  by (rule integral_unique) auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2795
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
  2796
lemma integral_singleton [simp]: "integral {a} f = 0"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
  2797
  by auto
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
  2798
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2799
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2800
subsection \<open>Cauchy-type criterion for integrability.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2801
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  2802
(* XXXXXXX *)
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2803
lemma integrable_cauchy:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2804
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::{real_normed_vector,complete_space}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2805
  shows "f integrable_on cbox a b \<longleftrightarrow>
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2806
    (\<forall>e>0.\<exists>d. gauge d \<and>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2807
      (\<forall>p1 p2. p1 tagged_division_of (cbox a b) \<and> d fine p1 \<and>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2808
        p2 tagged_division_of (cbox a b) \<and> d fine p2 \<longrightarrow>
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2809
        norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p1 -
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2810
        setsum (\<lambda>(x,k). content k *\<^sub>R f x) p2) < e))"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2811
  (is "?l = (\<forall>e>0. \<exists>d. ?P e d)")
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2812
proof
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2813
  assume ?l
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2814
  then guess y unfolding integrable_on_def has_integral .. note y=this
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2815
  show "\<forall>e>0. \<exists>d. ?P e d"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  2816
  proof (clarify, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2817
    case (1 e)
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2818
    then have "e/2 > 0" by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  2819
    then guess d
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  2820
      apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  2821
      apply (drule y[rule_format])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  2822
      apply (elim exE conjE)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  2823
      done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  2824
    note d=this[rule_format]
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2825
    show ?case
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2826
    proof (rule_tac x=d in exI, clarsimp simp: d)
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2827
      fix p1 p2
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2828
      assume as: "p1 tagged_division_of (cbox a b)" "d fine p1"
60396
f0bd2a6a3185 more tidying up of proofs
paulson <lp15@cam.ac.uk>
parents: 60394
diff changeset
  2829
                 "p2 tagged_division_of (cbox a b)" "d fine p2"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2830
      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"
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2831
        apply (rule dist_triangle_half_l[where y=y,unfolded dist_norm])
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2832
        using d(2)[OF conjI[OF as(1-2)]] d(2)[OF conjI[OF as(3-4)]] .
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2833
    qed
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2834
  qed
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2835
next
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2836
  assume "\<forall>e>0. \<exists>d. ?P e d"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  2837
  then have "\<forall>n::nat. \<exists>d. ?P (inverse(of_nat (n + 1))) d"
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2838
    by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2839
  from choice[OF this] guess d .. note d=conjunctD2[OF this[rule_format],rule_format]
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2840
  have "\<And>n. gauge (\<lambda>x. \<Inter>{d i x |i. i \<in> {0..n}})"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2841
    apply (rule gauge_inters)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2842
    using d(1)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2843
    apply auto
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2844
    done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2845
  then have "\<forall>n. \<exists>p. p tagged_division_of (cbox a b) \<and> (\<lambda>x. \<Inter>{d i x |i. i \<in> {0..n}}) fine p"
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  2846
    by (meson fine_division_exists)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2847
  from choice[OF this] guess p .. note p = conjunctD2[OF this[rule_format]]
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2848
  have dp: "\<And>i n. i\<le>n \<Longrightarrow> d i fine p n"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2849
    using p(2) unfolding fine_inters by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2850
  have "Cauchy (\<lambda>n. setsum (\<lambda>(x,k). content k *\<^sub>R (f x)) (p n))"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  2851
  proof (rule CauchyI, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  2852
    case (1 e)
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2853
    then guess N unfolding real_arch_inv[of e] .. note N=this
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2854
    show ?case
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2855
      apply (rule_tac x=N in exI)
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  2856
    proof clarify
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2857
      fix m n
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2858
      assume mn: "N \<le> m" "N \<le> n"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2859
      have *: "N = (N - 1) + 1" using N by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2860
      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
  2861
        apply (rule less_trans[OF _ N[THEN conjunct2,THEN conjunct2]])
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2862
        apply(subst *)
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
  2863
        using dp p(1) mn d(2) by auto
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2864
    qed
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2865
  qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  2866
  then guess y unfolding convergent_eq_cauchy[symmetric] .. note y=this[THEN LIMSEQ_D]
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2867
  show ?l
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2868
    unfolding integrable_on_def has_integral
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  2869
  proof (rule_tac x=y in exI, clarify)
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2870
    fix e :: real
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2871
    assume "e>0"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  2872
    then have *:"e/2 > 0" by auto
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2873
    then guess N1 unfolding real_arch_inv[of "e/2"] .. note N1=this
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2874
    then have N1': "N1 = N1 - 1 + 1"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2875
      by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2876
    guess N2 using y[OF *] .. note N2=this
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  2877
    have "gauge (d (N1 + N2))"
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  2878
      using d by auto
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  2879
    moreover
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  2880
    {
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2881
      fix q
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2882
      assume as: "q tagged_division_of (cbox a b)" "d (N1 + N2) fine q"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  2883
      have *: "inverse (of_nat (N1 + N2 + 1)) < e / 2"
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2884
        apply (rule less_trans)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2885
        using N1
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2886
        apply auto
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2887
        done
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  2888
      have "norm ((\<Sum>(x, k)\<in>q. content k *\<^sub>R f x) - y) < e"
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2889
        apply (rule norm_triangle_half_r)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2890
        apply (rule less_trans[OF _ *])
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2891
        apply (subst N1', rule d(2)[of "p (N1+N2)"])
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  2892
        using N1' as(1) as(2) dp
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  2893
        apply (simp add: \<open>\<forall>x. p x tagged_division_of cbox a b \<and> (\<lambda>xa. \<Inter>{d i xa |i. i \<in> {0..x}}) fine p x\<close>)
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  2894
        using N2 le_add2 by blast
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  2895
    }
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  2896
    ultimately show "\<exists>d. gauge d \<and>
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  2897
      (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow>
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  2898
        norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - y) < e)"
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  2899
      by (rule_tac x="d (N1 + N2)" in exI) auto
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2900
  qed
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2901
qed
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2902
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2903
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  2904
subsection \<open>Additivity of integral on abutting intervals.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2905
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
  2906
lemma interval_split:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2907
  fixes a :: "'a::euclidean_space"
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2908
  assumes "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
  2909
  shows
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2910
    "cbox a b \<inter> {x. x\<bullet>k \<le> c} = cbox a (\<Sum>i\<in>Basis. (if i = k then min (b\<bullet>k) c else b\<bullet>i) *\<^sub>R i)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2911
    "cbox a b \<inter> {x. x\<bullet>k \<ge> c} = cbox (\<Sum>i\<in>Basis. (if i = k then max (a\<bullet>k) c else a\<bullet>i) *\<^sub>R i) b"
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2912
  apply (rule_tac[!] set_eqI)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2913
  unfolding Int_iff mem_box mem_Collect_eq
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2914
  using assms
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2915
  apply auto
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2916
  done
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2917
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2918
lemma content_split:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2919
  fixes a :: "'a::euclidean_space"
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2920
  assumes "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2921
  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})"
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
  2922
proof cases
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2923
  note simps = interval_split[OF assms] content_cbox_cases
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2924
  have *: "Basis = insert k (Basis - {k})" "\<And>x. finite (Basis-{x})" "\<And>x. x\<notin>Basis-{x}"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  2925
    using assms by auto
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2926
  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))"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  2927
    "(\<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)"
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2928
    apply (subst *(1))
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2929
    defer
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2930
    apply (subst *(1))
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  2931
    unfolding setprod.insert[OF *(2-)]
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2932
    apply auto
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2933
    done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2934
  assume as: "\<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i"
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2935
  moreover
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2936
  have "\<And>x. min (b \<bullet> k) c = max (a \<bullet> k) c \<Longrightarrow>
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2937
    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)"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2938
    by  (auto simp add: field_simps)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2939
  moreover
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2940
  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)) =
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
  2941
      (\<Prod>i\<in>Basis. (if i = k then min (b \<bullet> k) c else b \<bullet> i) - 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
  2942
    "(\<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)) =
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  2943
      (\<Prod>i\<in>Basis. b \<bullet> i - (if i = k then max (a \<bullet> k) c else a \<bullet> i))"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  2944
    by (auto intro!: setprod.cong)
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
  2945
  have "\<not> a \<bullet> k \<le> c \<Longrightarrow> \<not> c \<le> b \<bullet> k \<Longrightarrow> False"
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2946
    unfolding not_le
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2947
    using as[unfolded ,rule_format,of k] assms
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2948
    by auto
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2949
  ultimately show ?thesis
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2950
    using assms
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2951
    unfolding simps **
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2952
    unfolding *(1)[of "\<lambda>i x. b\<bullet>i - x"] *(1)[of "\<lambda>i x. x - a\<bullet>i"]
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2953
    unfolding *(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
  2954
    by auto
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  2955
next
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2956
  assume "\<not> (\<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2957
  then have "cbox a b = {}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2958
    unfolding box_eq_empty by (auto simp: not_le)
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2959
  then show ?thesis
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  2960
    by (auto simp: not_le)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2961
qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2962
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2963
lemma division_split_left_inj:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2964
  fixes type :: "'a::euclidean_space"
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2965
  assumes "d division_of i"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2966
    and "k1 \<in> d"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2967
    and "k2 \<in> d"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2968
    and "k1 \<noteq> k2"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2969
    and "k1 \<inter> {x::'a. x\<bullet>k \<le> c} = k2 \<inter> {x. x\<bullet>k \<le> c}"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2970
    and 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
  2971
  shows "content(k1 \<inter> {x. x\<bullet>k \<le> c}) = 0"
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2972
proof -
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2973
  note d=division_ofD[OF assms(1)]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2974
  have *: "\<And>(a::'a) b c. content (cbox a b \<inter> {x. x\<bullet>k \<le> c}) = 0 \<longleftrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2975
    interior(cbox a b \<inter> {x. x\<bullet>k \<le> c}) = {}"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  2976
    unfolding  interval_split[OF k] content_eq_0_interior by auto
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2977
  guess u1 v1 using d(4)[OF assms(2)] by (elim exE) note uv1=this
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2978
  guess u2 v2 using d(4)[OF assms(3)] by (elim exE) note uv2=this
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2979
  have **: "\<And>s t u. s \<inter> t = {} \<Longrightarrow> u \<subseteq> s \<Longrightarrow> u \<subseteq> t \<Longrightarrow> u = {}"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2980
    by auto
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2981
  show ?thesis
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2982
    unfolding uv1 uv2 *
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  2983
    apply (rule **[OF d(5)[OF assms(2-4)]])
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  2984
    apply (simp add: uv1)
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  2985
    using assms(5) uv1 by auto
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  2986
qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  2987
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  2988
lemma division_split_right_inj:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2989
  fixes type :: "'a::euclidean_space"
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  2990
  assumes "d division_of i"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  2991
    and "k1 \<in> d"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  2992
    and "k2 \<in> d"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  2993
    and "k1 \<noteq> k2"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  2994
    and "k1 \<inter> {x::'a. x\<bullet>k \<ge> c} = k2 \<inter> {x. x\<bullet>k \<ge> c}"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  2995
    and k: "k \<in> Basis"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  2996
  shows "content (k1 \<inter> {x. x\<bullet>k \<ge> c}) = 0"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  2997
proof -
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  2998
  note d=division_ofD[OF assms(1)]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  2999
  have *: "\<And>a b::'a. \<And>c. content(cbox a b \<inter> {x. x\<bullet>k \<ge> c}) = 0 \<longleftrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3000
    interior(cbox a b \<inter> {x. x\<bullet>k \<ge> c}) = {}"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  3001
    unfolding interval_split[OF k] content_eq_0_interior by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3002
  guess u1 v1 using d(4)[OF assms(2)] by (elim exE) note uv1=this
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3003
  guess u2 v2 using d(4)[OF assms(3)] by (elim exE) note uv2=this
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3004
  have **: "\<And>s t u. s \<inter> t = {} \<Longrightarrow> u \<subseteq> s \<Longrightarrow> u \<subseteq> t \<Longrightarrow> u = {}"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3005
    by auto
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3006
  show ?thesis
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3007
    unfolding uv1 uv2 *
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3008
    apply (rule **[OF d(5)[OF assms(2-4)]])
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3009
    apply (simp add: uv1)
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3010
    using assms(5) uv1 by auto
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3011
qed
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3012
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3013
lemma tagged_division_split_left_inj:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3014
  fixes x1 :: "'a::euclidean_space"
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3015
  assumes d: "d tagged_division_of i"
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3016
    and k12: "(x1, k1) \<in> d"
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3017
             "(x2, k2) \<in> d"
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3018
             "k1 \<noteq> k2"
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3019
             "k1 \<inter> {x. x\<bullet>k \<le> c} = k2 \<inter> {x. x\<bullet>k \<le> c}"
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3020
             "k \<in> Basis"
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3021
  shows "content (k1 \<inter> {x. x\<bullet>k \<le> c}) = 0"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3022
proof -
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3023
  have *: "\<And>a b c. (a,b) \<in> c \<Longrightarrow> b \<in> snd ` c"
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3024
    by force
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3025
  show ?thesis
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3026
    using k12
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3027
    by (fastforce intro!:  division_split_left_inj[OF division_of_tagged_division[OF d]] *)
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3028
qed
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3029
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3030
lemma tagged_division_split_right_inj:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3031
  fixes x1 :: "'a::euclidean_space"
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3032
  assumes d: "d tagged_division_of i"
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3033
    and k12: "(x1, k1) \<in> d"
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3034
             "(x2, k2) \<in> d"
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3035
             "k1 \<noteq> k2"
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3036
             "k1 \<inter> {x. x\<bullet>k \<ge> c} = k2 \<inter> {x. x\<bullet>k \<ge> c}"
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3037
             "k \<in> Basis"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3038
  shows "content (k1 \<inter> {x. x\<bullet>k \<ge> c}) = 0"
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3039
proof -
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3040
  have *: "\<And>a b c. (a,b) \<in> c \<Longrightarrow> b \<in> snd ` c"
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3041
    by force
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3042
  show ?thesis
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3043
    using k12
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3044
    by (fastforce intro!:  division_split_right_inj[OF division_of_tagged_division[OF d]] *)
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3045
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3046
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3047
lemma division_split:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3048
  fixes a :: "'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3049
  assumes "p division_of (cbox a b)"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3050
    and k: "k\<in>Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3051
  shows "{l \<inter> {x. x\<bullet>k \<le> c} | l. l \<in> p \<and> l \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}} division_of(cbox a b \<inter> {x. x\<bullet>k \<le> c})"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3052
      (is "?p1 division_of ?I1")
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3053
    and "{l \<inter> {x. x\<bullet>k \<ge> c} | l. l \<in> p \<and> l \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}} division_of (cbox a b \<inter> {x. x\<bullet>k \<ge> c})"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3054
      (is "?p2 division_of ?I2")
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3055
proof (rule_tac[!] division_ofI)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3056
  note p = division_ofD[OF assms(1)]
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3057
  show "finite ?p1" "finite ?p2"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3058
    using p(1) by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3059
  show "\<Union>?p1 = ?I1" "\<Union>?p2 = ?I2"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3060
    unfolding p(6)[symmetric] by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3061
  {
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3062
    fix k
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3063
    assume "k \<in> ?p1"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3064
    then guess l unfolding mem_Collect_eq by (elim exE conjE) note l=this
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3065
    guess u v using p(4)[OF l(2)] by (elim exE) note uv=this
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3066
    show "k \<subseteq> ?I1"
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3067
      using l p(2) uv by force
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3068
    show  "k \<noteq> {}"
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3069
      by (simp add: l)
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3070
    show  "\<exists>a b. k = cbox a b"
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3071
      apply (simp add: l uv p(2-3)[OF l(2)])
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3072
      apply (subst interval_split[OF k])
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  3073
      apply (auto intro: order.trans)
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3074
      done
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3075
    fix k'
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3076
    assume "k' \<in> ?p1"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3077
    then guess l' unfolding mem_Collect_eq by (elim exE conjE) note l'=this
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3078
    assume "k \<noteq> k'"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3079
    then show "interior k \<inter> interior k' = {}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3080
      unfolding l l' using p(5)[OF l(2) l'(2)] by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3081
  }
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3082
  {
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3083
    fix k
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3084
    assume "k \<in> ?p2"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3085
    then guess l unfolding mem_Collect_eq by (elim exE conjE) note l=this
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3086
    guess u v using p(4)[OF l(2)] by (elim exE) note uv=this
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3087
    show "k \<subseteq> ?I2"
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3088
      using l p(2) uv by force
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3089
    show  "k \<noteq> {}"
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3090
      by (simp add: l)
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3091
    show  "\<exists>a b. k = cbox a b"
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3092
      apply (simp add: l uv p(2-3)[OF l(2)])
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3093
      apply (subst interval_split[OF k])
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  3094
      apply (auto intro: order.trans)
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3095
      done
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3096
    fix k'
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3097
    assume "k' \<in> ?p2"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3098
    then guess l' unfolding mem_Collect_eq by (elim exE conjE) note l'=this
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3099
    assume "k \<noteq> k'"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3100
    then show "interior k \<inter> interior k' = {}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3101
      unfolding l l' using p(5)[OF l(2) l'(2)] by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3102
  }
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3103
qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3104
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3105
lemma has_integral_split:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3106
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3107
  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
  3108
      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
  3109
      and k: "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3110
  shows "(f has_integral (i + j)) (cbox a b)"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  3111
proof (unfold has_integral, rule, rule, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3112
  case (1 e)
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3113
  then have e: "e/2 > 0"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3114
    by auto
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3115
    obtain d1
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3116
    where d1: "gauge d1"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3117
      and d1norm:
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3118
        "\<And>p. \<lbrakk>p tagged_division_of cbox a b \<inter> {x. x \<bullet> k \<le> c};
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3119
               d1 fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, k) \<in> p. content k *\<^sub>R f x) - i) < e / 2"
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3120
       apply (rule has_integralD[OF fi[unfolded interval_split[OF k]] e])
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3121
       apply (simp add: interval_split[symmetric] k)
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3122
       done
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3123
    obtain d2
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3124
    where d2: "gauge d2"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3125
      and d2norm:
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3126
        "\<And>p. \<lbrakk>p tagged_division_of cbox a b \<inter> {x. c \<le> x \<bullet> k};
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3127
               d2 fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, k) \<in> p. content k *\<^sub>R f x) - j) < e / 2"
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3128
       apply (rule has_integralD[OF fj[unfolded interval_split[OF k]] e])
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3129
       apply (simp add: interval_split[symmetric] k)
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3130
       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
  3131
  let ?d = "\<lambda>x. if x\<bullet>k = c then (d1 x \<inter> d2 x) else ball x (abs(x\<bullet>k - c)) \<inter> d1 x \<inter> d2 x"
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3132
  have "gauge ?d"
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3133
    using d1 d2 unfolding gauge_def by auto
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3134
  then show ?case
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3135
  proof (rule_tac x="?d" in exI, safe)
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3136
    fix p
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3137
    assume "p tagged_division_of (cbox a b)" "?d fine p"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3138
    note p = this tagged_division_ofD[OF this(1)]
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3139
    have xk_le_c: "\<And>x kk. (x, kk) \<in> p \<Longrightarrow> kk \<inter> {x. x\<bullet>k \<le> c} \<noteq> {} \<Longrightarrow> x\<bullet>k \<le> c"
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3140
    proof -
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3141
      fix x kk
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3142
      assume as: "(x, kk) \<in> p" and kk: "kk \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}"
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3143
      show "x\<bullet>k \<le> c"
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3144
      proof (rule ccontr)
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3145
        assume **: "\<not> ?thesis"
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3146
        from this[unfolded not_le]
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3147
        have "kk \<subseteq> ball x \<bar>x \<bullet> k - c\<bar>"
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3148
          using p(2)[unfolded fine_def, rule_format,OF as] by auto
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3149
        with kk obtain y where y: "y \<in> ball x \<bar>x \<bullet> k - c\<bar>" "y\<bullet>k \<le> c"
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3150
          by blast
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3151
        then have "\<bar>x \<bullet> k - y \<bullet> k\<bar> < \<bar>x \<bullet> k - c\<bar>"
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3152
          using Basis_le_norm[OF k, of "x - y"]
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3153
          by (auto simp add: dist_norm inner_diff_left intro: le_less_trans)
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3154
        with y show False
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3155
          using ** by (auto simp add: field_simps)
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3156
      qed
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3157
    qed
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3158
    have xk_ge_c: "\<And>x kk. (x, kk) \<in> p \<Longrightarrow> kk \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {} \<Longrightarrow> x\<bullet>k \<ge> c"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3159
    proof -
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3160
      fix x kk
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3161
      assume as: "(x, kk) \<in> p" and kk: "kk \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}"
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3162
      show "x\<bullet>k \<ge> c"
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3163
      proof (rule ccontr)
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3164
        assume **: "\<not> ?thesis"
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3165
        from this[unfolded not_le] have "kk \<subseteq> ball x \<bar>x \<bullet> k - c\<bar>"
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3166
          using p(2)[unfolded fine_def,rule_format,OF as,unfolded split_conv] by auto
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3167
        with kk obtain y where y: "y \<in> ball x \<bar>x \<bullet> k - c\<bar>" "y\<bullet>k \<ge> c"
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3168
          by blast
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3169
        then have "\<bar>x \<bullet> k - y \<bullet> k\<bar> < \<bar>x \<bullet> k - c\<bar>"
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3170
          using Basis_le_norm[OF k, of "x - y"]
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3171
          by (auto simp add: dist_norm inner_diff_left intro: le_less_trans)
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3172
        with y show False
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3173
          using ** by (auto simp add: field_simps)
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3174
      qed
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3175
    qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3176
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3177
    have lem1: "\<And>f P Q. (\<forall>x k. (x, k) \<in> {(x, f k) | x k. P x k} \<longrightarrow> Q x k) \<longleftrightarrow>
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3178
                         (\<forall>x k. P x k \<longrightarrow> Q x (f k))"
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3179
      by auto
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3180
    have fin_finite: "finite {(x,f k) | x k. (x,k) \<in> s \<and> P x k}" if "finite s" for f s P
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3181
    proof -
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3182
      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
  3183
        by auto
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3184
      then show ?thesis
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3185
        by (rule rev_finite_subset) auto
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3186
    qed
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3187
    { fix g :: "'a set \<Rightarrow> 'a set"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3188
      fix i :: "'a \<times> 'a set"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3189
      assume "i \<in> (\<lambda>(x, k). (x, g k)) ` p - {(x, g k) |x k. (x, k) \<in> p \<and> g k \<noteq> {}}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3190
      then obtain x k where xk:
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3191
              "i = (x, g k)"  "(x, k) \<in> p"
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3192
              "(x, g k) \<notin> {(x, g k) |x k. (x, k) \<in> p \<and> g k \<noteq> {}}"
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3193
          by auto
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3194
      have "content (g k) = 0"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3195
        using xk using content_empty by auto
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3196
      then have "(\<lambda>(x, k). content k *\<^sub>R f x) i = 0"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3197
        unfolding xk split_conv by auto
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3198
    } note [simp] = this
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3199
    have lem3: "\<And>g :: 'a set \<Rightarrow> 'a set. finite p \<Longrightarrow>
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3200
                  setsum (\<lambda>(x, k). content k *\<^sub>R f x) {(x,g k) |x k. (x,k) \<in> p \<and> g k \<noteq> {}} =
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3201
                  setsum (\<lambda>(x, k). content k *\<^sub>R f x) ((\<lambda>(x, k). (x, g k)) ` p)"
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3202
      by (rule setsum.mono_neutral_left) auto
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3203
    let ?M1 = "{(x, kk \<inter> {x. x\<bullet>k \<le> c}) |x kk. (x, kk) \<in> p \<and> kk \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}}"
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3204
    have d1_fine: "d1 fine ?M1"
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3205
      by (force intro: fineI dest: fineD[OF p(2)] simp add: split: split_if_asm)
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3206
    have "norm ((\<Sum>(x, k)\<in>?M1. content k *\<^sub>R f x) - i) < e/2"
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3207
    proof (rule d1norm [OF tagged_division_ofI d1_fine])
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3208
      show "finite ?M1"
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3209
        by (rule fin_finite p(3))+
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3210
      show "\<Union>{k. \<exists>x. (x, k) \<in> ?M1} = cbox a b \<inter> {x. x\<bullet>k \<le> c}"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3211
        unfolding p(8)[symmetric] by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3212
      fix x l
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3213
      assume xl: "(x, l) \<in> ?M1"
61424
c3658c18b7bc prod_case as canonical name for product type eliminator
haftmann
parents: 61243
diff changeset
  3214
      then guess x' l' unfolding mem_Collect_eq unfolding prod.inject by (elim exE conjE) note xl'=this
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3215
      show "x \<in> l" "l \<subseteq> cbox a b \<inter> {x. x \<bullet> k \<le> c}"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3216
        unfolding xl'
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3217
        using p(4-6)[OF xl'(3)] using xl'(4)
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3218
        using xk_le_c[OF xl'(3-4)] by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3219
      show "\<exists>a b. l = cbox a b"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3220
        unfolding xl'
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3221
        using p(6)[OF xl'(3)]
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3222
        by (fastforce simp add: interval_split[OF k,where c=c])
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3223
      fix y r
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3224
      let ?goal = "interior l \<inter> interior r = {}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3225
      assume yr: "(y, r) \<in> ?M1"
61424
c3658c18b7bc prod_case as canonical name for product type eliminator
haftmann
parents: 61243
diff changeset
  3226
      then guess y' r' unfolding mem_Collect_eq unfolding prod.inject by (elim exE conjE) note yr'=this
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3227
      assume as: "(x, l) \<noteq> (y, r)"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3228
      show "interior l \<inter> interior r = {}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3229
      proof (cases "l' = r' \<longrightarrow> x' = y'")
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3230
        case False
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3231
        then show ?thesis
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3232
          using p(7)[OF xl'(3) yr'(3)] using as unfolding xl' yr' by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3233
      next
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3234
        case True
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3235
        then have "l' \<noteq> r'"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3236
          using as unfolding xl' yr' by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3237
        then show ?thesis
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3238
          using p(7)[OF xl'(3) yr'(3)] using as unfolding xl' yr' by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3239
      qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3240
    qed
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3241
    moreover
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  3242
    let ?M2 = "{(x,kk \<inter> {x. x\<bullet>k \<ge> c}) |x kk. (x,kk) \<in> p \<and> kk \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}}"
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3243
    have d2_fine: "d2 fine ?M2"
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3244
      by (force intro: fineI dest: fineD[OF p(2)] simp add: split: split_if_asm)
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3245
    have "norm ((\<Sum>(x, k)\<in>?M2. content k *\<^sub>R f x) - j) < e/2"
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3246
    proof (rule d2norm [OF tagged_division_ofI d2_fine])
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3247
      show "finite ?M2"
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3248
        by (rule fin_finite p(3))+
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3249
      show "\<Union>{k. \<exists>x. (x, k) \<in> ?M2} = cbox a b \<inter> {x. x\<bullet>k \<ge> c}"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3250
        unfolding p(8)[symmetric] by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3251
      fix x l
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3252
      assume xl: "(x, l) \<in> ?M2"
61424
c3658c18b7bc prod_case as canonical name for product type eliminator
haftmann
parents: 61243
diff changeset
  3253
      then guess x' l' unfolding mem_Collect_eq unfolding prod.inject by (elim exE conjE) note xl'=this
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3254
      show "x \<in> l" "l \<subseteq> cbox a b \<inter> {x. x \<bullet> k \<ge> c}"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3255
        unfolding xl'
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3256
        using p(4-6)[OF xl'(3)] xl'(4) xk_ge_c[OF xl'(3-4)]
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3257
        by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3258
      show "\<exists>a b. l = cbox a b"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3259
        unfolding xl'
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3260
        using p(6)[OF xl'(3)]
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3261
        by (fastforce simp add: interval_split[OF k, where c=c])
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3262
      fix y r
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3263
      let ?goal = "interior l \<inter> interior r = {}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3264
      assume yr: "(y, r) \<in> ?M2"
61424
c3658c18b7bc prod_case as canonical name for product type eliminator
haftmann
parents: 61243
diff changeset
  3265
      then guess y' r' unfolding mem_Collect_eq unfolding prod.inject by (elim exE conjE) note yr'=this
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3266
      assume as: "(x, l) \<noteq> (y, r)"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3267
      show "interior l \<inter> interior r = {}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3268
      proof (cases "l' = r' \<longrightarrow> x' = y'")
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3269
        case False
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3270
        then show ?thesis
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3271
          using p(7)[OF xl'(3) yr'(3)] using as unfolding xl' yr' by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3272
      next
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3273
        case True
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3274
        then have "l' \<noteq> r'"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3275
          using as unfolding xl' yr' by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3276
        then show ?thesis
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3277
          using p(7)[OF xl'(3) yr'(3)] using as unfolding xl' yr' by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3278
      qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3279
    qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3280
    ultimately
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3281
    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
  3282
      using norm_add_less by blast
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3283
    also {
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3284
      have eq0: "\<And>x y. x = (0::real) \<Longrightarrow> x *\<^sub>R (y::'b) = 0"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3285
        using scaleR_zero_left by auto
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3286
      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
  3287
        by auto
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3288
      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
  3289
        (\<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
  3290
        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
  3291
      also have "\<dots> = (\<Sum>(x, ka)\<in>p. content (ka \<inter> {x. x \<bullet> k \<le> c}) *\<^sub>R f x) +
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3292
        (\<Sum>(x, ka)\<in>p. content (ka \<inter> {x. c \<le> x \<bullet> k}) *\<^sub>R f x) - (i + j)"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3293
        unfolding lem3[OF p(3)]
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3294
        by (subst setsum.reindex_nontrivial[OF p(3)], auto intro!: k eq0 tagged_division_split_left_inj[OF p(1)] tagged_division_split_right_inj[OF p(1)]
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3295
              simp: cont_eq)+
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  3296
      also note setsum.distrib[symmetric]
60435
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3297
      also have "\<And>x. x \<in> p \<Longrightarrow>
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3298
                    (\<lambda>(x,ka). content (ka \<inter> {x. x \<bullet> k \<le> c}) *\<^sub>R f x) x +
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3299
                    (\<lambda>(x,ka). content (ka \<inter> {x. c \<le> x \<bullet> k}) *\<^sub>R f x) x =
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3300
                    (\<lambda>(x,ka). content ka *\<^sub>R f x) x"
35c6e2daa397 proof tidying
paulson <lp15@cam.ac.uk>
parents: 60428
diff changeset
  3301
      proof clarify
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3302
        fix a b
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3303
        assume "(a, b) \<in> p"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3304
        from p(6)[OF this] guess u v by (elim exE) note uv=this
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3305
        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 =
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3306
          content b *\<^sub>R f a"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3307
          unfolding scaleR_left_distrib[symmetric]
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3308
          unfolding uv content_split[OF k,of u v c]
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3309
          by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3310
      qed
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  3311
      note setsum.cong [OF _ this]
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
  3312
      finally have "(\<Sum>(x, k)\<in>{(x, kk \<inter> {x. x \<bullet> k \<le> c}) |x kk. (x, kk) \<in> p \<and> kk \<inter> {x. x \<bullet> k \<le> c} \<noteq> {}}. content k *\<^sub>R f x) - 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
  3313
        ((\<Sum>(x, k)\<in>{(x, kk \<inter> {x. c \<le> x \<bullet> k}) |x kk. (x, kk) \<in> p \<and> kk \<inter> {x. c \<le> x \<bullet> k} \<noteq> {}}. content k *\<^sub>R f x) - j) =
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3314
        (\<Sum>(x, ka)\<in>p. content ka *\<^sub>R f x) - (i + j)"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3315
        by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3316
    }
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3317
    finally show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - (i + j)) < e"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3318
      by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3319
  qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3320
qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3321
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3322
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  3323
subsection \<open>A sort of converse, integrability on subintervals.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3324
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3325
lemma tagged_division_union_interval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3326
  fixes a :: "'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3327
  assumes "p1 tagged_division_of (cbox a b \<inter> {x. x\<bullet>k \<le> (c::real)})"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3328
    and "p2 tagged_division_of (cbox a b \<inter> {x. x\<bullet>k \<ge> c})"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3329
    and k: "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3330
  shows "(p1 \<union> p2) tagged_division_of (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3331
proof -
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3332
  have *: "cbox a b = (cbox a b \<inter> {x. x\<bullet>k \<le> c}) \<union> (cbox a b \<inter> {x. x\<bullet>k \<ge> c})"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3333
    by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3334
  show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3335
    apply (subst *)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3336
    apply (rule tagged_division_union[OF assms(1-2)])
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3337
    unfolding interval_split[OF k] interior_cbox
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3338
    using k
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  3339
    apply (auto simp add: box_def elim!: ballE[where x=k])
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3340
    done
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3341
qed
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3342
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3343
lemma tagged_division_union_interval_real:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3344
  fixes a :: real
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3345
  assumes "p1 tagged_division_of ({a .. b} \<inter> {x. x\<bullet>k \<le> (c::real)})"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3346
    and "p2 tagged_division_of ({a .. b} \<inter> {x. x\<bullet>k \<ge> c})"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3347
    and k: "k \<in> Basis"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3348
  shows "(p1 \<union> p2) tagged_division_of {a .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3349
  using assms
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3350
  unfolding box_real[symmetric]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3351
  by (rule tagged_division_union_interval)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3352
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3353
lemma has_integral_separate_sides:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3354
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3355
  assumes "(f has_integral i) (cbox a b)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3356
    and "e > 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3357
    and k: "k \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3358
  obtains d where "gauge d"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3359
    "\<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
  3360
        p2 tagged_division_of (cbox a b \<inter> {x. x\<bullet>k \<ge> c}) \<and> d fine p2 \<longrightarrow>
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3361
        norm ((setsum (\<lambda>(x,k). content k *\<^sub>R f x) p1 + setsum (\<lambda>(x,k). content k *\<^sub>R f x) p2) - i) < e"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3362
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3363
  guess d using has_integralD[OF assms(1-2)] . note d=this
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3364
  { fix p1 p2
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3365
    assume "p1 tagged_division_of (cbox a b) \<inter> {x. x \<bullet> k \<le> c}" "d fine p1"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3366
    note p1=tagged_division_ofD[OF this(1)] this
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3367
    assume "p2 tagged_division_of (cbox a b) \<inter> {x. c \<le> x \<bullet> k}" "d fine p2"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3368
    note p2=tagged_division_ofD[OF this(1)] this
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3369
    note tagged_division_union_interval[OF p1(7) p2(7)] note p12 = tagged_division_ofD[OF this] this
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3370
    { fix a b
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3371
      assume ab: "(a, b) \<in> p1 \<inter> p2"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3372
      have "(a, b) \<in> p1"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3373
        using ab by auto
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3374
      with p1 obtain u v where uv: "b = cbox u v" by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3375
      have "b \<subseteq> {x. x\<bullet>k = c}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3376
        using ab p1(3)[of a b] p2(3)[of a b] by fastforce
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3377
      moreover
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3378
      have "interior {x::'a. x \<bullet> k = c} = {}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3379
      proof (rule ccontr)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3380
        assume "\<not> ?thesis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3381
        then obtain x where x: "x \<in> interior {x::'a. x\<bullet>k = c}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3382
          by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3383
        then guess e unfolding mem_interior .. note e=this
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3384
        have x: "x\<bullet>k = c"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3385
          using x interior_subset by fastforce
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3386
        have *: "\<And>i. i \<in> Basis \<Longrightarrow> \<bar>(x - (x + (e / 2) *\<^sub>R k)) \<bullet> i\<bar> = (if i = k then e/2 else 0)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3387
          using e k by (auto simp: inner_simps inner_not_same_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
  3388
        have "(\<Sum>i\<in>Basis. \<bar>(x - (x + (e / 2 ) *\<^sub>R k)) \<bullet> i\<bar>) =
60425
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3389
              (\<Sum>i\<in>Basis. (if i = k then e / 2 else 0))"
a5c68d06cbf0 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60420
diff changeset
  3390
          using "*" by (blast intro: setsum.cong)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3391
        also have "\<dots> < e"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  3392
          apply (subst setsum.delta)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3393
          using e
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3394
          apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3395
          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
  3396
        finally have "x + (e/2) *\<^sub>R k \<in> ball x 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
  3397
          unfolding mem_ball dist_norm by(rule le_less_trans[OF norm_le_l1])
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3398
        then have "x + (e/2) *\<^sub>R k \<in> {x. x\<bullet>k = c}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3399
          using e by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3400
        then show False
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3401
          unfolding mem_Collect_eq using e x k by (auto simp: inner_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3402
      qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3403
      ultimately have "content b = 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3404
        unfolding uv content_eq_0_interior
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3405
        using interior_mono by blast
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3406
      then have "content b *\<^sub>R f a = 0"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3407
        by auto
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3408
    }
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3409
    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
  3410
               norm ((\<Sum>(x, k)\<in>p1 \<union> p2. content k *\<^sub>R f x) - i)"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3411
      by (subst setsum.union_inter_neutral) (auto simp: p1 p2)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3412
    also have "\<dots> < e"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3413
      by (rule k d(2) p12 fine_union p1 p2)+
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3414
    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
  3415
   }
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3416
  then show ?thesis
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3417
    by (auto intro: that[of d] d elim: )
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3418
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3419
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
  3420
lemma integrable_split[intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3421
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::{real_normed_vector,complete_space}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3422
  assumes "f integrable_on cbox a b"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3423
    and k: "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3424
  shows "f integrable_on (cbox a b \<inter> {x. x\<bullet>k \<le> c})" (is ?t1)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3425
    and "f integrable_on (cbox a b \<inter> {x. x\<bullet>k \<ge> c})" (is ?t2)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3426
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3427
  guess y using assms(1) unfolding integrable_on_def .. note y=this
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
  3428
  def b' \<equiv> "\<Sum>i\<in>Basis. (if i = k then min (b\<bullet>k) c else b\<bullet>i)*\<^sub>R i::'a"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3429
  def a' \<equiv> "\<Sum>i\<in>Basis. (if i = k then max (a\<bullet>k) c else a\<bullet>i)*\<^sub>R i::'a"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3430
  show ?t1 ?t2
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3431
    unfolding interval_split[OF k] integrable_cauchy
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3432
    unfolding interval_split[symmetric,OF k]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3433
  proof (rule_tac[!] allI impI)+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3434
    fix e :: real
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3435
    assume "e > 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3436
    then have "e/2>0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3437
      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
  3438
    from has_integral_separate_sides[OF y this k,of c] guess d . note d=this[rule_format]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3439
    let ?P = "\<lambda>A. \<exists>d. gauge d \<and> (\<forall>p1 p2. p1 tagged_division_of (cbox a b) \<inter> A \<and> d fine p1 \<and>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3440
      p2 tagged_division_of (cbox a b) \<inter> A \<and> d fine p2 \<longrightarrow>
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  3441
      norm ((\<Sum>(x, k)\<in>p1. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p2. content k *\<^sub>R f x)) < e)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3442
    show "?P {x. x \<bullet> k \<le> c}"
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3443
    proof (rule_tac x=d in exI, clarsimp simp add: d)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3444
      fix p1 p2
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3445
      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
  3446
                 "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
  3447
      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"
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3448
      proof (rule fine_division_exists[OF d(1), of a' b] )
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3449
        fix p
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3450
        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
  3451
        then show ?thesis
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3452
          using as norm_triangle_half_l[OF d(2)[of p1 p] d(2)[of p2 p]]
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3453
          unfolding interval_split[OF k] b'_def[symmetric] a'_def[symmetric]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3454
          by (auto simp add: algebra_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3455
      qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3456
    qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3457
    show "?P {x. x \<bullet> k \<ge> c}"
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3458
    proof (rule_tac x=d in exI, clarsimp simp add: d)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3459
      fix p1 p2
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3460
      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
  3461
                 "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
  3462
      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"
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3463
      proof (rule fine_division_exists[OF d(1), of a b'] )
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3464
        fix p
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3465
        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
  3466
        then show ?thesis
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3467
          using as norm_triangle_half_l[OF d(2)[of p p1] d(2)[of p p2]]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3468
          unfolding interval_split[OF k] b'_def[symmetric] a'_def[symmetric]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3469
          by (auto simp add: algebra_simps)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3470
      qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3471
    qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3472
  qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3473
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3474
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3475
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  3476
subsection \<open>Generalized notion of additivity.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3477
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3478
definition "neutral opp = (SOME x. \<forall>y. opp x y = y \<and> opp y x = y)"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3479
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3480
definition operative :: "('a \<Rightarrow> 'a \<Rightarrow> 'a) \<Rightarrow> (('b::euclidean_space) set \<Rightarrow> 'a) \<Rightarrow> bool"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3481
  where "operative opp f \<longleftrightarrow>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3482
    (\<forall>a b. content (cbox a b) = 0 \<longrightarrow> f (cbox a b) = neutral opp) \<and>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3483
    (\<forall>a b c. \<forall>k\<in>Basis. f (cbox a b) = opp (f(cbox a b \<inter> {x. x\<bullet>k \<le> c})) (f (cbox a b \<inter> {x. x\<bullet>k \<ge> c})))"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3484
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3485
lemma operativeD[dest]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3486
  fixes type :: "'a::euclidean_space"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3487
  assumes "operative opp f"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3488
  shows "\<And>a b::'a. content (cbox a b) = 0 \<Longrightarrow> f (cbox a b) = neutral opp"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3489
    and "\<And>a b c k. k \<in> Basis \<Longrightarrow> f (cbox a b) =
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3490
      opp (f (cbox a b \<inter> {x. x\<bullet>k \<le> c})) (f (cbox a b \<inter> {x. x\<bullet>k \<ge> c}))"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3491
  using assms unfolding operative_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3492
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3493
lemma property_empty_interval: "\<forall>a b. content (cbox a b) = 0 \<longrightarrow> P (cbox a b) \<Longrightarrow> P {}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3494
  using content_empty unfolding empty_as_interval by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3495
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3496
lemma operative_empty: "operative opp f \<Longrightarrow> f {} = neutral opp"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3497
  unfolding operative_def by (rule property_empty_interval) auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3498
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3499
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  3500
subsection \<open>Using additivity of lifted function to encode definedness.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3501
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3502
fun lifted where
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3503
  "lifted (opp :: 'a \<Rightarrow> 'a \<Rightarrow> 'b) (Some x) (Some y) = Some (opp x y)"
49197
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  3504
| "lifted opp None _ = (None::'b option)"
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  3505
| "lifted opp _ None = None"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3506
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3507
lemma lifted_simp_1[simp]: "lifted opp v None = None"
49197
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  3508
  by (induct v) auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3509
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3510
definition "monoidal opp \<longleftrightarrow>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3511
  (\<forall>x y. opp x y = opp y x) \<and>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3512
  (\<forall>x y z. opp x (opp y z) = opp (opp x y) z) \<and>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3513
  (\<forall>x. opp (neutral opp) x = x)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3514
49197
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  3515
lemma monoidalI:
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  3516
  assumes "\<And>x y. opp x y = opp y x"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3517
    and "\<And>x y z. opp x (opp y z) = opp (opp x y) z"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3518
    and "\<And>x. opp (neutral opp) x = x"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3519
  shows "monoidal opp"
44890
22f665a2e91c new fastforce replacing fastsimp - less confusing name
nipkow
parents: 44522
diff changeset
  3520
  unfolding monoidal_def using assms by fastforce
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3521
49197
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  3522
lemma monoidal_ac:
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  3523
  assumes "monoidal opp"
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3524
  shows [simp]: "opp (neutral opp) a = a"
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3525
    and [simp]: "opp a (neutral opp) = a"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3526
    and "opp a b = opp b a"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3527
    and "opp (opp a b) c = opp a (opp b c)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3528
    and "opp a (opp b c) = opp b (opp a c)"
49197
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  3529
  using assms unfolding monoidal_def by metis+
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3530
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3531
lemma neutral_lifted [cong]:
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3532
  assumes "monoidal opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3533
  shows "neutral (lifted opp) = Some (neutral opp)"
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3534
proof -
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3535
  { fix x
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3536
    assume "\<forall>y. lifted opp x y = y \<and> lifted opp y x = y"
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3537
    then have "Some (neutral opp) = x"
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3538
      apply (induct x)
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3539
      apply force
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3540
      by (metis assms lifted.simps(1) monoidal_ac(2) option.inject) }
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3541
  note [simp] = this
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3542
  show ?thesis
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3543
    apply (subst neutral_def)
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3544
    apply (intro some_equality allI)
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3545
    apply (induct_tac y)
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3546
    apply (auto simp add:monoidal_ac[OF assms])
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3547
    done
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3548
qed
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3549
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3550
lemma monoidal_lifted[intro]:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3551
  assumes "monoidal opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3552
  shows "monoidal (lifted opp)"
60428
5e9de4faef98 fixed several "inside-out" proofs
paulson <lp15@cam.ac.uk>
parents: 60425
diff changeset
  3553
  unfolding monoidal_def split_option_all neutral_lifted[OF assms]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3554
  using monoidal_ac[OF assms]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3555
  by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3556
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3557
definition "support opp f s = {x. x\<in>s \<and> f x \<noteq> neutral opp}"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3558
definition "fold' opp e s = (if finite s then Finite_Set.fold opp e s else e)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3559
definition "iterate opp s f = fold' (\<lambda>x a. opp (f x) a) (neutral opp) (support opp f s)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3560
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3561
lemma support_subset[intro]: "support opp f s \<subseteq> s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3562
  unfolding support_def by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3563
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3564
lemma support_empty[simp]: "support opp f {} = {}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3565
  using support_subset[of opp f "{}"] by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3566
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3567
lemma comp_fun_commute_monoidal[intro]:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3568
  assumes "monoidal opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3569
  shows "comp_fun_commute opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3570
  unfolding comp_fun_commute_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3571
  using monoidal_ac[OF assms]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3572
  by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3573
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3574
lemma support_clauses:
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3575
  "\<And>f g s. support opp f {} = {}"
49197
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  3576
  "\<And>f g s. support opp f (insert x s) =
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  3577
    (if f(x) = neutral opp then support opp f s else insert x (support opp f s))"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3578
  "\<And>f g s. support opp f (s - {x}) = (support opp f s) - {x}"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3579
  "\<And>f g s. support opp f (s \<union> t) = (support opp f s) \<union> (support opp f t)"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3580
  "\<And>f g s. support opp f (s \<inter> t) = (support opp f s) \<inter> (support opp f t)"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3581
  "\<And>f g s. support opp f (s - t) = (support opp f s) - (support opp f t)"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3582
  "\<And>f g s. support opp g (f ` s) = f ` (support opp (g o f) s)"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3583
  unfolding support_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3584
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3585
lemma finite_support[intro]: "finite s \<Longrightarrow> finite (support opp f s)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3586
  unfolding support_def by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3587
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3588
lemma iterate_empty[simp]: "iterate opp {} f = neutral opp"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  3589
  unfolding iterate_def fold'_def by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3590
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3591
lemma iterate_insert[simp]:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3592
  assumes "monoidal opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3593
    and "finite s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3594
  shows "iterate opp (insert x s) f =
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3595
         (if x \<in> s then iterate opp s f else opp (f x) (iterate opp s f))"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3596
proof (cases "x \<in> s")
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3597
  case True
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3598
  then show ?thesis by (auto simp: insert_absorb iterate_def)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3599
next
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3600
  case False
42871
1c0b99f950d9 names of fold_set locales resemble name of characteristic property more closely
haftmann
parents: 42869
diff changeset
  3601
  note * = comp_fun_commute.comp_comp_fun_commute [OF comp_fun_commute_monoidal[OF assms(1)]]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3602
  show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3603
  proof (cases "f x = neutral opp")
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3604
    case True
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3605
    then show ?thesis
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  3606
      using assms \<open>x \<notin> s\<close>
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3607
      by (auto simp: iterate_def support_clauses)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3608
  next
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3609
    case False
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  3610
    with \<open>x \<notin> s\<close> \<open>finite s\<close> support_subset show ?thesis
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3611
      apply (simp add: iterate_def fold'_def support_clauses)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3612
      apply (subst comp_fun_commute.fold_insert[OF * finite_support, simplified comp_def])
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3613
      apply (force simp add: )+
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3614
      done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3615
  qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3616
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3617
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3618
lemma iterate_some:
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3619
    "\<lbrakk>monoidal opp; finite s\<rbrakk> \<Longrightarrow> iterate (lifted opp) s (\<lambda>x. Some(f x)) = Some (iterate opp s f)"
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3620
  by (erule finite_induct) (auto simp: monoidal_lifted)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3621
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3622
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  3623
subsection \<open>Two key instances of additivity.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3624
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3625
lemma neutral_add[simp]: "neutral op + = (0::'a::comm_monoid_add)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3626
  unfolding neutral_def
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3627
  by (force elim: allE [where x=0])
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3628
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  3629
lemma operative_content[intro]: "operative (op +) content"
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3630
  by (force simp add: operative_def content_split[symmetric])
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3631
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3632
lemma monoidal_monoid[intro]: "monoidal ((op +)::('a::comm_monoid_add) \<Rightarrow> 'a \<Rightarrow> 'a)"
53597
ea99a7964174 remove duplicate lemmas
huffman
parents: 53524
diff changeset
  3633
  unfolding monoidal_def neutral_add
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3634
  by (auto simp add: algebra_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3635
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3636
lemma operative_integral:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3637
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3638
  shows "operative (lifted(op +)) (\<lambda>i. if f integrable_on i then Some(integral i f) else None)"
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3639
  unfolding operative_def neutral_lifted[OF monoidal_monoid] neutral_add
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3640
proof safe
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3641
  fix a b c
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3642
  fix k :: 'a
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3643
  assume k: "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3644
  show "(if f integrable_on cbox a b then Some (integral (cbox a b) f) else None) =
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3645
        lifted 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)
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3646
        (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)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3647
  proof (cases "f integrable_on cbox a b")
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3648
    case True
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3649
    with k show ?thesis
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3650
      apply (simp add: integrable_split)
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3651
      apply (rule integral_unique [OF has_integral_split[OF _ _ k]])
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3652
      apply (auto intro: integrable_integral)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3653
      done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3654
  next
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3655
    case False
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3656
    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})"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3657
    proof (rule ccontr)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3658
      assume "\<not> ?thesis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3659
      then have "f integrable_on cbox a b"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3660
        unfolding integrable_on_def
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3661
        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)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3662
        apply (rule has_integral_split[OF _ _ k])
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3663
        apply (auto intro: integrable_integral)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3664
        done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3665
      then show False
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3666
        using False by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3667
    qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3668
    then show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3669
      using False by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3670
  qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3671
next
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3672
  fix a b :: 'a
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3673
  assume "content (cbox a b) = 0"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3674
  then show "(if f integrable_on cbox a b then Some (integral (cbox a b) f) else None) = Some 0"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3675
    using has_integral_null_eq
60440
3c6acb281c38 tidied more proofs
paulson <lp15@cam.ac.uk>
parents: 60435
diff changeset
  3676
    by (auto simp: integrable_on_null)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3677
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3678
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3679
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  3680
subsection \<open>Points of division of a partition.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3681
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3682
definition "division_points (k::('a::euclidean_space) set) d =
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3683
   {(j,x). j \<in> Basis \<and> (interval_lowerbound k)\<bullet>j < x \<and> x < (interval_upperbound k)\<bullet>j \<and>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3684
     (\<exists>i\<in>d. (interval_lowerbound i)\<bullet>j = x \<or> (interval_upperbound i)\<bullet>j = x)}"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3685
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3686
lemma division_points_finite:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3687
  fixes i :: "'a::euclidean_space set"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3688
  assumes "d division_of i"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3689
  shows "finite (division_points i d)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3690
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3691
  note assm = division_ofD[OF assms]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3692
  let ?M = "\<lambda>j. {(j,x)|x. (interval_lowerbound i)\<bullet>j < x \<and> x < (interval_upperbound i)\<bullet>j \<and>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3693
    (\<exists>i\<in>d. (interval_lowerbound i)\<bullet>j = x \<or> (interval_upperbound i)\<bullet>j = x)}"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3694
  have *: "division_points i d = \<Union>(?M ` Basis)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3695
    unfolding division_points_def by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3696
  show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3697
    unfolding * using assm by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3698
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3699
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3700
lemma division_points_subset:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3701
  fixes a :: "'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3702
  assumes "d division_of (cbox a b)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3703
    and "\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i"  "a\<bullet>k < c" "c < b\<bullet>k"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3704
    and k: "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3705
  shows "division_points (cbox a b \<inter> {x. x\<bullet>k \<le> c}) {l \<inter> {x. x\<bullet>k \<le> c} | l . l \<in> d \<and> l \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}} \<subseteq>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3706
      division_points (cbox a b) d" (is ?t1)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3707
    and "division_points (cbox a b \<inter> {x. x\<bullet>k \<ge> c}) {l \<inter> {x. x\<bullet>k \<ge> c} | l . l \<in> d \<and> ~(l \<inter> {x. x\<bullet>k \<ge> c} = {})} \<subseteq>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3708
      division_points (cbox a b) d" (is ?t2)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3709
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3710
  note assm = division_ofD[OF assms(1)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3711
  have *: "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i"
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  3712
    "\<forall>i\<in>Basis. a\<bullet>i \<le> (\<Sum>i\<in>Basis. (if i = k then min (b \<bullet> k) c else  b \<bullet> i) *\<^sub>R i) \<bullet> i"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3713
    "\<forall>i\<in>Basis. (\<Sum>i\<in>Basis. (if i = k then max (a \<bullet> k) c else a \<bullet> i) *\<^sub>R i) \<bullet> i \<le> b\<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
  3714
    "min (b \<bullet> k) c = c" "max (a \<bullet> k) c = c"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3715
    using assms using less_imp_le by auto
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3716
  show ?t1 (*FIXME a horrible mess*)
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
  3717
    unfolding division_points_def interval_split[OF k, of a b]
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3718
    unfolding interval_bounds[OF *(1)] interval_bounds[OF *(2)] interval_bounds[OF *(3)]
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3719
    unfolding *
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3720
    apply (rule subsetI)
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
  3721
    unfolding mem_Collect_eq split_beta
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3722
    apply (erule bexE conjE)+
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3723
    apply (simp add: )
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3724
    apply (erule exE conjE)+
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
  3725
  proof
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3726
    fix i l x
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3727
    assume as:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3728
      "a \<bullet> fst x < snd x" "snd x < (if fst x = k then c else b \<bullet> fst x)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3729
      "interval_lowerbound i \<bullet> fst x = snd x \<or> interval_upperbound i \<bullet> fst x = snd x"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3730
      "i = l \<inter> {x. x \<bullet> k \<le> c}" "l \<in> d" "l \<inter> {x. x \<bullet> k \<le> c} \<noteq> {}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3731
      and fstx: "fst x \<in> Basis"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3732
    from assm(4)[OF this(5)] guess u v apply-by(erule exE)+ note l=this
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3733
    have *: "\<forall>i\<in>Basis. u \<bullet> i \<le> (\<Sum>i\<in>Basis. (if i = k then min (v \<bullet> k) c else v \<bullet> i) *\<^sub>R i) \<bullet> i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3734
      using as(6) unfolding l interval_split[OF k] box_ne_empty as .
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3735
    have **: "\<forall>i\<in>Basis. u\<bullet>i \<le> v\<bullet>i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3736
      using l using as(6) unfolding box_ne_empty[symmetric] by auto
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3737
    show "\<exists>i\<in>d. interval_lowerbound i \<bullet> fst x = snd x \<or> interval_upperbound i \<bullet> fst x = snd x"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  3738
      apply (rule bexI[OF _ \<open>l \<in> d\<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
  3739
      using as(1-3,5) fstx
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3740
      unfolding l interval_bounds[OF **] interval_bounds[OF *] interval_split[OF k] as
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3741
      apply (auto split: split_if_asm)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3742
      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
  3743
    show "snd x < b \<bullet> fst x"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  3744
      using as(2) \<open>c < b\<bullet>k\<close> by (auto split: split_if_asm)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3745
  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
  3746
  show ?t2
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3747
    unfolding division_points_def interval_split[OF k, of a b]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3748
    unfolding interval_bounds[OF *(1)] interval_bounds[OF *(2)] interval_bounds[OF *(3)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3749
    unfolding *
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3750
    unfolding subset_eq
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3751
    apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3752
    unfolding mem_Collect_eq split_beta
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3753
    apply (erule bexE conjE)+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3754
    apply (simp only: mem_Collect_eq inner_setsum_left_Basis simp_thms)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3755
    apply (erule exE conjE)+
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
  3756
  proof
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3757
    fix i l x
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3758
    assume as:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3759
      "(if fst x = k then c else a \<bullet> fst x) < snd x" "snd x < b \<bullet> fst x"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3760
      "interval_lowerbound i \<bullet> fst x = snd x \<or> interval_upperbound i \<bullet> fst x = snd x"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3761
      "i = l \<inter> {x. c \<le> x \<bullet> k}" "l \<in> d" "l \<inter> {x. c \<le> x \<bullet> k} \<noteq> {}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3762
      and fstx: "fst x \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3763
    from assm(4)[OF this(5)] guess u v by (elim exE) note l=this
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3764
    have *: "\<forall>i\<in>Basis. (\<Sum>i\<in>Basis. (if i = k then max (u \<bullet> k) c else u \<bullet> i) *\<^sub>R i) \<bullet> i \<le> v \<bullet> i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3765
      using as(6) unfolding l interval_split[OF k] box_ne_empty as .
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3766
    have **: "\<forall>i\<in>Basis. u\<bullet>i \<le> v\<bullet>i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3767
      using l using as(6) unfolding box_ne_empty[symmetric] by auto
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3768
    show "\<exists>i\<in>d. interval_lowerbound i \<bullet> fst x = snd x \<or> interval_upperbound i \<bullet> fst x = snd x"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  3769
      apply (rule bexI[OF _ \<open>l \<in> d\<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
  3770
      using as(1-3,5) fstx
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3771
      unfolding l interval_bounds[OF **] interval_bounds[OF *] interval_split[OF k] as
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3772
      apply (auto split: split_if_asm)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3773
      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
  3774
    show "a \<bullet> fst x < snd x"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  3775
      using as(1) \<open>a\<bullet>k < c\<close> by (auto split: split_if_asm)
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
  3776
   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
  3777
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
  3778
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3779
lemma division_points_psubset:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3780
  fixes a :: "'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3781
  assumes "d division_of (cbox a b)"
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3782
      and "\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i"  "a\<bullet>k < c" "c < b\<bullet>k"
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3783
      and "l \<in> d"
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3784
      and "interval_lowerbound l\<bullet>k = c \<or> interval_upperbound l\<bullet>k = c"
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3785
      and k: "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3786
  shows "division_points (cbox a b \<inter> {x. x\<bullet>k \<le> c}) {l \<inter> {x. x\<bullet>k \<le> c} | l. l\<in>d \<and> l \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}} \<subset>
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3787
         division_points (cbox a b) d" (is "?D1 \<subset> ?D")
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3788
    and "division_points (cbox a b \<inter> {x. x\<bullet>k \<ge> c}) {l \<inter> {x. x\<bullet>k \<ge> c} | l. l\<in>d \<and> l \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}} \<subset>
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3789
         division_points (cbox a b) d" (is "?D2 \<subset> ?D")
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3790
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3791
  have ab: "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3792
    using assms(2) by (auto intro!:less_imp_le)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3793
  guess u v using division_ofD(4)[OF assms(1,5)] by (elim exE) note l=this
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3794
  have uv: "\<forall>i\<in>Basis. u\<bullet>i \<le> v\<bullet>i" "\<forall>i\<in>Basis. a\<bullet>i \<le> u\<bullet>i \<and> v\<bullet>i \<le> b\<bullet>i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3795
    using division_ofD(2,2,3)[OF assms(1,5)] unfolding l box_ne_empty
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3796
    using subset_box(1)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3797
    apply auto
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3798
    apply blast+
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3799
    done
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3800
  have *: "interval_upperbound (cbox a b \<inter> {x. x \<bullet> k \<le> interval_upperbound l \<bullet> k}) \<bullet> k = interval_upperbound l \<bullet> k"
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3801
          "interval_upperbound (cbox a b \<inter> {x. x \<bullet> k \<le> interval_lowerbound l \<bullet> k}) \<bullet> k = interval_lowerbound l \<bullet> k"
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3802
    unfolding l interval_split[OF k] interval_bounds[OF uv(1)]
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3803
    using uv[rule_format, of k] ab k
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3804
    by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3805
  have "\<exists>x. x \<in> ?D - ?D1"
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3806
    using assms(3-)
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3807
    unfolding division_points_def interval_bounds[OF ab]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3808
    apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3809
    apply (erule disjE)
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3810
    apply (rule_tac x="(k,(interval_lowerbound l)\<bullet>k)" in exI, force simp add: *)
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3811
    apply (rule_tac x="(k,(interval_upperbound l)\<bullet>k)" in exI, force simp add: *)
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3812
    done
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3813
  moreover have "?D1 \<subseteq> ?D"
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3814
    by (auto simp add: assms division_points_subset)
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3815
  ultimately show "?D1 \<subset> ?D"
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3816
    by blast
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3817
  have *: "interval_lowerbound (cbox a b \<inter> {x. x \<bullet> k \<ge> interval_lowerbound l \<bullet> k}) \<bullet> k = interval_lowerbound l \<bullet> k"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3818
    "interval_lowerbound (cbox a b \<inter> {x. x \<bullet> k \<ge> interval_upperbound l \<bullet> k}) \<bullet> k = interval_upperbound l \<bullet> k"
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3819
    unfolding l interval_split[OF k] interval_bounds[OF uv(1)]
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3820
    using uv[rule_format, of k] ab k
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3821
    by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3822
  have "\<exists>x. x \<in> ?D - ?D2"
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3823
    using assms(3-)
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3824
    unfolding division_points_def interval_bounds[OF ab]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3825
    apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3826
    apply (erule disjE)
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3827
    apply (rule_tac x="(k,(interval_lowerbound l)\<bullet>k)" in exI, force simp add: *)
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3828
    apply (rule_tac x="(k,(interval_upperbound l)\<bullet>k)" in exI, force simp add: *)
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3829
    done
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3830
  moreover have "?D2 \<subseteq> ?D"
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3831
    by (auto simp add: assms division_points_subset)
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3832
  ultimately show "?D2 \<subset> ?D"
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3833
    by blast
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3834
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3835
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3836
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  3837
subsection \<open>Preservation by divisions and tagged divisions.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3838
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3839
lemma support_support[simp]:"support opp f (support opp f s) = support opp f s"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3840
  unfolding support_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3841
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3842
lemma iterate_support[simp]: "iterate opp (support opp f s) f = iterate opp s f"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3843
  unfolding iterate_def support_support by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3844
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3845
lemma iterate_expand_cases:
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3846
  "iterate opp s f = (if finite(support opp f s) then iterate opp (support opp f s) f else neutral opp)"
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3847
    by (simp add: iterate_def fold'_def)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3848
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3849
lemma iterate_image:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3850
  assumes "monoidal opp"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3851
    and "inj_on f s"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3852
  shows "iterate opp (f ` s) g = iterate opp s (g \<circ> f)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3853
proof -
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3854
  have *: "iterate opp (f ` s) g = iterate opp s (g \<circ> f)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3855
    if "finite s" "\<forall>x\<in>s. \<forall>y\<in>s. f x = f y \<longrightarrow> x = y" for s
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3856
    using that
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3857
  proof (induct s)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3858
    case empty
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3859
    then show ?case by simp
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3860
  next
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3861
    case insert
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  3862
    with assms(1) show ?case by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3863
  qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  3864
  show ?thesis
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3865
    apply (cases "finite (support opp g (f ` s))")
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3866
    prefer 2
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3867
      apply (metis finite_imageI iterate_expand_cases support_clauses(7))
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3868
    apply (subst (1) iterate_support[symmetric], subst (2) iterate_support[symmetric])
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3869
    unfolding support_clauses
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3870
    apply (rule *)
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3871
    apply (meson assms(2) finite_imageD subset_inj_on support_subset)
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3872
    apply (meson assms(2) inj_on_contraD rev_subsetD support_subset)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3873
    done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3874
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3875
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3876
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3877
(* This lemma about iterations comes up in a few places. *)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3878
lemma iterate_nonzero_image_lemma:
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3879
  assumes "monoidal opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3880
    and "finite s" "g(a) = neutral opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3881
    and "\<forall>x\<in>s. \<forall>y\<in>s. f x = f y \<and> x \<noteq> y \<longrightarrow> g(f x) = neutral opp"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3882
  shows "iterate opp {f x | x. x \<in> s \<and> f x \<noteq> a} g = iterate opp s (g \<circ> f)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3883
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3884
  have *: "{f x |x. x \<in> s \<and> f x \<noteq> a} = f ` {x. x \<in> s \<and> f x \<noteq> a}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3885
    by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3886
  have **: "support opp (g \<circ> f) {x \<in> s. f x \<noteq> a} = support opp (g \<circ> f) s"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3887
    unfolding support_def using assms(3) by auto
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3888
  have inj: "inj_on f (support opp (g \<circ> f) {x \<in> s. f x \<noteq> a})"
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3889
    apply (simp add: inj_on_def)
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3890
    apply (metis (mono_tags, lifting) assms(4) comp_def mem_Collect_eq support_def)
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3891
    done
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3892
  show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3893
    apply (subst iterate_support[symmetric])
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3894
    apply (simp add: * support_clauses iterate_image[OF assms(1) inj])
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3895
    apply (simp add: iterate_def **)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3896
    done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3897
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3898
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3899
lemma iterate_eq_neutral:
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3900
  assumes "monoidal opp"
60463
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3901
      and "\<And>x. x \<in> s \<Longrightarrow> f x = neutral opp"
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3902
    shows "iterate opp s f = neutral opp"
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3903
proof -
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3904
  have [simp]: "support opp f s = {}"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3905
    unfolding support_def using assms(2) by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3906
  show ?thesis
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3907
    by (subst iterate_support[symmetric]) simp
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3908
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3909
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3910
lemma iterate_op:
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3911
   "\<lbrakk>monoidal opp; finite s\<rbrakk>
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3912
    \<Longrightarrow> iterate opp s (\<lambda>x. opp (f x) (g x)) = opp (iterate opp s f) (iterate opp s g)"
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3913
by (erule finite_induct) (auto simp: monoidal_ac(4) monoidal_ac(5))
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3914
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3915
lemma iterate_eq:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3916
  assumes "monoidal opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3917
    and "\<And>x. x \<in> s \<Longrightarrow> f x = g x"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3918
  shows "iterate opp s f = iterate opp s g"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3919
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3920
  have *: "support opp g s = support opp f s"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3921
    unfolding support_def using assms(2) by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3922
  show ?thesis
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3923
  proof (cases "finite (support opp f s)")
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3924
    case False
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3925
    then show ?thesis
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3926
      by (simp add: "*" iterate_expand_cases)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3927
  next
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3928
    case True
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3929
    def su \<equiv> "support opp f s"
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3930
    have fsu: "finite su"
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3931
      using True by (simp add: su_def)
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3932
    moreover
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3933
    { assume "finite su" "su \<subseteq> s"
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3934
      then have "iterate opp su f = iterate opp su g"
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3935
        by (induct su) (auto simp: assms)
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3936
    }
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3937
    ultimately have "iterate opp (support opp f s) f = iterate opp (support opp g s) g"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3938
      by (simp add: "*" su_def support_subset)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3939
    then show ?thesis
60442
310853646597 streamlined many more proofs
paulson <lp15@cam.ac.uk>
parents: 60440
diff changeset
  3940
      by simp
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3941
  qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3942
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3943
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3944
lemma nonempty_witness:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3945
  assumes "s \<noteq> {}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3946
  obtains x where "x \<in> s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3947
  using assms by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3948
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3949
lemma operative_division:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3950
  fixes f :: "'a::euclidean_space set \<Rightarrow> 'b"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3951
  assumes "monoidal opp"
60463
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3952
      and "operative opp f"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3953
      and "d division_of (cbox a b)"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3954
    shows "iterate opp d f = f (cbox a b)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3955
proof -
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  3956
  def C \<equiv> "card (division_points (cbox a b) d)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3957
  then show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3958
    using assms
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3959
  proof (induct C arbitrary: a b d rule: full_nat_induct)
60463
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3960
    case (1 a b d)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3961
    show ?case
60463
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3962
    proof (cases "content (cbox a b) = 0")
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3963
      case True
60463
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3964
      show "iterate opp d f = f (cbox a b)"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3965
        unfolding operativeD(1)[OF assms(2) True]
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  3966
      proof (rule iterate_eq_neutral[OF \<open>monoidal opp\<close>])
60463
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3967
        fix x
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3968
        assume x: "x \<in> d"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3969
        then show "f x = neutral opp"
60463
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3970
          by (metis division_ofD(4) 1(4) division_of_content_0[OF True] operativeD(1)[OF assms(2)] x)
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3971
      qed
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3972
    next
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3973
      case False
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3974
      note ab = this[unfolded content_lt_nz[symmetric] content_pos_lt_eq]
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3975
      then have ab': "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3976
        by (auto intro!: less_imp_le)
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3977
        show "iterate opp d f = f (cbox a b)"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3978
      proof (cases "division_points (cbox a b) d = {}")
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3979
        case True
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3980
        { fix u v and j :: 'a
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3981
          assume j: "j \<in> Basis" and as: "cbox u v \<in> d"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3982
          then have "cbox u v \<noteq> {}"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3983
            using "1.prems"(3) by blast
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3984
          then have uv: "\<forall>i\<in>Basis. u\<bullet>i \<le> v\<bullet>i" "u\<bullet>j \<le> v\<bullet>j"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3985
            using j unfolding box_ne_empty by auto
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3986
          have *: "\<And>p r Q. \<not> j\<in>Basis \<or> p \<or> r \<or> (\<forall>x\<in>d. Q x) \<Longrightarrow> p \<or> r \<or> Q (cbox u v)"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3987
            using as j by auto
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3988
          have "(j, u\<bullet>j) \<notin> division_points (cbox a b) d"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3989
               "(j, v\<bullet>j) \<notin> division_points (cbox a b) d" using True by auto
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3990
          note this[unfolded de_Morgan_conj division_points_def mem_Collect_eq split_conv interval_bounds[OF ab'] bex_simps]
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3991
          note *[OF this(1)] *[OF this(2)] note this[unfolded interval_bounds[OF uv(1)]]
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3992
          moreover
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3993
          have "a\<bullet>j \<le> u\<bullet>j" "v\<bullet>j \<le> b\<bullet>j"
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  3994
            using division_ofD(2,2,3)[OF \<open>d division_of cbox a b\<close> as]
60463
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3995
            apply (metis j subset_box(1) uv(1))
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  3996
            by (metis \<open>cbox u v \<subseteq> cbox a b\<close> j subset_box(1) uv(1))
60463
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3997
          ultimately have "u\<bullet>j = a\<bullet>j \<and> v\<bullet>j = a\<bullet>j \<or> u\<bullet>j = b\<bullet>j \<and> v\<bullet>j = b\<bullet>j \<or> u\<bullet>j = a\<bullet>j \<and> v\<bullet>j = b\<bullet>j"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3998
            unfolding not_less de_Morgan_disj using ab[rule_format,of j] uv(2) j by force }
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  3999
        then have d': "\<forall>i\<in>d. \<exists>u v. i = cbox u v \<and>
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4000
          (\<forall>j\<in>Basis. u\<bullet>j = a\<bullet>j \<and> v\<bullet>j = a\<bullet>j \<or> u\<bullet>j = b\<bullet>j \<and> v\<bullet>j = b\<bullet>j \<or> u\<bullet>j = a\<bullet>j \<and> v\<bullet>j = b\<bullet>j)"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4001
          unfolding forall_in_division[OF 1(4)]
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4002
          by blast
60463
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4003
        have "(1/2) *\<^sub>R (a+b) \<in> cbox a b"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4004
          unfolding mem_box using ab by(auto intro!: less_imp_le simp: inner_simps)
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  4005
        note this[unfolded division_ofD(6)[OF \<open>d division_of cbox a b\<close>,symmetric] Union_iff]
60463
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4006
        then guess i .. note i=this
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4007
        guess u v using d'[rule_format,OF i(1)] by (elim exE conjE) note uv=this
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4008
        have "cbox a b \<in> d"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4009
        proof -
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4010
          have "u = a" "v = b"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4011
            unfolding euclidean_eq_iff[where 'a='a]
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4012
          proof safe
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4013
            fix j :: 'a
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4014
            assume j: "j \<in> Basis"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4015
            note i(2)[unfolded uv mem_box,rule_format,of j]
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4016
            then show "u \<bullet> j = a \<bullet> j" and "v \<bullet> j = b \<bullet> j"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4017
              using uv(2)[rule_format,of j] j by (auto simp: inner_simps)
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4018
          qed
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4019
          then have "i = cbox a b" using uv by auto
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4020
          then show ?thesis using i by auto
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4021
        qed
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4022
        then have deq: "d = insert (cbox a b) (d - {cbox a b})"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4023
          by auto
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4024
        have "iterate opp (d - {cbox a b}) f = neutral opp"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4025
        proof (rule iterate_eq_neutral[OF 1(2)])
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4026
          fix x
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4027
          assume x: "x \<in> d - {cbox a b}"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4028
          then have "x\<in>d"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4029
            by auto note d'[rule_format,OF this]
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4030
          then guess u v by (elim exE conjE) note uv=this
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4031
          have "u \<noteq> a \<or> v \<noteq> b"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4032
            using x[unfolded uv] by auto
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4033
          then obtain j where "u\<bullet>j \<noteq> a\<bullet>j \<or> v\<bullet>j \<noteq> b\<bullet>j" and j: "j \<in> Basis"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4034
            unfolding euclidean_eq_iff[where 'a='a] by auto
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4035
          then have "u\<bullet>j = v\<bullet>j"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4036
            using uv(2)[rule_format,OF j] by auto
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4037
          then have "content (cbox u v) = 0"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4038
            unfolding content_eq_0 using j
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4039
            by force
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4040
          then show "f x = neutral opp"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4041
            unfolding uv(1) by (rule operativeD(1)[OF 1(3)])
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4042
        qed
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4043
        then show "iterate opp d f = f (cbox a b)"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4044
          apply (subst deq)
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4045
          apply (subst iterate_insert[OF 1(2)])
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4046
          using 1
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4047
          apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4048
          done
60463
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4049
      next
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4050
        case False
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4051
        then have "\<exists>x. x \<in> division_points (cbox a b) d"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4052
          by auto
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4053
        then guess k c
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4054
          unfolding split_paired_Ex division_points_def mem_Collect_eq split_conv
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4055
          apply (elim exE conjE)
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4056
          done
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4057
        note this(2-4,1) note kc=this[unfolded interval_bounds[OF ab']]
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4058
        from this(3) guess j .. note j=this
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4059
        def d1 \<equiv> "{l \<inter> {x. x\<bullet>k \<le> c} | l. l \<in> d \<and> l \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}}"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4060
        def d2 \<equiv> "{l \<inter> {x. x\<bullet>k \<ge> c} | l. l \<in> d \<and> l \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}}"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4061
        def cb \<equiv> "(\<Sum>i\<in>Basis. (if i = k then c else b\<bullet>i) *\<^sub>R i)::'a"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4062
        def ca \<equiv> "(\<Sum>i\<in>Basis. (if i = k then c else a\<bullet>i) *\<^sub>R i)::'a"
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  4063
        note division_points_psubset[OF \<open>d division_of cbox a b\<close> ab kc(1-2) j]
60463
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4064
        note psubset_card_mono[OF _ this(1)] psubset_card_mono[OF _ this(2)]
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4065
        then have *: "(iterate opp d1 f) = f (cbox a b \<inter> {x. x\<bullet>k \<le> c})"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4066
          "(iterate opp d2 f) = f (cbox a b \<inter> {x. x\<bullet>k \<ge> c})"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4067
          unfolding interval_split[OF kc(4)]
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4068
          apply (rule_tac[!] "1.hyps"[rule_format])
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  4069
          using division_split[OF \<open>d division_of cbox a b\<close>, where k=k and c=c]
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  4070
          apply (simp_all add: interval_split 1 kc d1_def d2_def division_points_finite[OF \<open>d division_of cbox a b\<close>])
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4071
          done
60463
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4072
        { fix l y
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4073
          assume as: "l \<in> d" "y \<in> d" "l \<inter> {x. x \<bullet> k \<le> c} = y \<inter> {x. x \<bullet> k \<le> c}" "l \<noteq> y"
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  4074
          from division_ofD(4)[OF \<open>d division_of cbox a b\<close> this(1)] guess u v by (elim exE) note leq=this
60463
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4075
          have "f (l \<inter> {x. x \<bullet> k \<le> c}) = neutral opp"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4076
            unfolding leq interval_split[OF kc(4)]
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4077
            apply (rule operativeD(1) 1)+
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4078
            unfolding interval_split[symmetric,OF kc(4)]
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4079
            using division_split_left_inj 1 as kc leq by blast
60463
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4080
        } note fxk_le = this
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4081
        { fix l y
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4082
          assume as: "l \<in> d" "y \<in> d" "l \<inter> {x. c \<le> x \<bullet> k} = y \<inter> {x. c \<le> x \<bullet> k}" "l \<noteq> y"
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  4083
          from division_ofD(4)[OF \<open>d division_of cbox a b\<close> this(1)] guess u v by (elim exE) note leq=this
60463
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4084
          have "f (l \<inter> {x. x \<bullet> k \<ge> c}) = neutral opp"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4085
            unfolding leq interval_split[OF kc(4)]
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4086
            apply (rule operativeD(1) 1)+
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4087
            unfolding interval_split[symmetric,OF kc(4)]
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4088
            using division_split_right_inj 1 leq as kc by blast
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4089
        } note fxk_ge = this
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4090
        have "f (cbox a b) = opp (iterate opp d1 f) (iterate opp d2 f)" (is "_ = ?prev")
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4091
          unfolding *
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4092
          using assms(2) kc(4) by blast
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4093
        also have "iterate opp d1 f = iterate opp d (\<lambda>l. f(l \<inter> {x. x\<bullet>k \<le> c}))"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4094
          unfolding d1_def empty_as_interval
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4095
          apply (rule iterate_nonzero_image_lemma[unfolded o_def])
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4096
          apply (rule 1 division_of_finite operativeD[OF 1(3)])+
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4097
          apply (force simp add: empty_as_interval[symmetric] fxk_le)+
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4098
          done
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4099
        also have "iterate opp d2 f = iterate opp d (\<lambda>l. f(l \<inter> {x. x\<bullet>k \<ge> c}))"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4100
          unfolding d2_def empty_as_interval
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4101
          apply (rule iterate_nonzero_image_lemma[unfolded o_def])
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4102
          apply (rule 1 division_of_finite operativeD[OF 1(3)])+
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4103
          apply (force simp add: empty_as_interval[symmetric] fxk_ge)+
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4104
          done
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4105
        also have *: "\<forall>x\<in>d. f x = opp (f (x \<inter> {x. x \<bullet> k \<le> c})) (f (x \<inter> {x. c \<le> x \<bullet> k}))"
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  4106
          unfolding forall_in_division[OF \<open>d division_of cbox a b\<close>]
60463
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4107
          using assms(2) kc(4) by blast
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4108
        have "opp (iterate opp d (\<lambda>l. f (l \<inter> {x. x \<bullet> k \<le> c}))) (iterate opp d (\<lambda>l. f (l \<inter> {x. c \<le> x \<bullet> k}))) =
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4109
          iterate opp d f"
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4110
          apply (subst(3) iterate_eq[OF _ *[rule_format]])
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4111
          using 1
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4112
          apply (auto simp: iterate_op[symmetric])
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4113
          done
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4114
        finally show ?thesis by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4115
      qed
60463
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4116
    qed
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4117
  qed
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4118
qed
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  4119
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4120
lemma iterate_image_nonzero:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4121
  assumes "monoidal opp"
60466
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4122
      and "finite s"
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4123
      and "\<And>x y. \<forall>x\<in>s. \<forall>y\<in>s. x \<noteq> y \<and> f x = f y \<longrightarrow> g (f x) = neutral opp"
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4124
    shows "iterate opp (f ` s) g = iterate opp s (g \<circ> f)"
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4125
using assms
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4126
by (induct rule: finite_subset_induct[OF assms(2) subset_refl]) auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4127
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4128
lemma operative_tagged_division:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4129
  assumes "monoidal opp"
60466
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4130
      and "operative opp f"
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4131
      and "d tagged_division_of (cbox a b)"
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4132
    shows "iterate opp d (\<lambda>(x,l). f l) = f (cbox a b)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4133
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4134
  have *: "(\<lambda>(x,l). f l) = f \<circ> snd"
60466
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4135
    unfolding o_def by rule auto note tagged = tagged_division_ofD[OF assms(3)]
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4136
  { fix a b a'
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4137
    assume as: "(a, b) \<in> d" "(a', b) \<in> d" "(a, b) \<noteq> (a', b)"
60466
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4138
    have "f b = neutral opp"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4139
      using tagged(4)[OF as(1)]
60466
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4140
      apply clarify
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4141
      apply (rule operativeD(1)[OF assms(2)])
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4142
      by (metis content_eq_0_interior inf.idem tagged_division_ofD(5)[OF assms(3) as(1-3)])
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4143
  }
60466
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4144
  then have "iterate opp d (\<lambda>(x,l). f l) = iterate opp (snd ` d) f"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4145
    unfolding *
60466
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4146
    by (force intro!: assms iterate_image_nonzero[symmetric, OF _ tagged_division_of_finite])
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4147
  also have "\<dots> = f (cbox a b)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4148
    using operative_division[OF assms(1-2) division_of_tagged_division[OF assms(3)]] .
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4149
  finally show ?thesis .
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4150
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4151
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4152
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4153
subsection \<open>Additivity of content.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4154
51489
f738e6dbd844 fundamental revision of big operators on sets
haftmann
parents: 51475
diff changeset
  4155
lemma setsum_iterate:
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4156
  assumes "finite s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4157
  shows "setsum f s = iterate op + s f"
51489
f738e6dbd844 fundamental revision of big operators on sets
haftmann
parents: 51475
diff changeset
  4158
proof -
60466
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4159
  have "setsum f s = setsum f (support op + f s)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4160
    using assms
60466
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4161
    by (auto simp: support_def intro: setsum.mono_neutral_right)
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4162
  then show ?thesis unfolding iterate_def fold'_def setsum.eq_fold
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4163
    by (simp add: comp_def)
51489
f738e6dbd844 fundamental revision of big operators on sets
haftmann
parents: 51475
diff changeset
  4164
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4165
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4166
lemma additive_content_division:
60466
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4167
    "d division_of (cbox a b) \<Longrightarrow> setsum content d = content (cbox a b)"
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4168
  by (metis division_ofD(1) monoidal_monoid operative_content operative_division setsum_iterate)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4169
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4170
lemma additive_content_tagged_division:
60466
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4171
    "d tagged_division_of (cbox a b) \<Longrightarrow> setsum (\<lambda>(x,l). content l) d = content (cbox a b)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  4172
  unfolding operative_tagged_division[OF monoidal_monoid operative_content assms,symmetric]
60466
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4173
  using setsum_iterate by blast
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4174
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4175
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4176
subsection \<open>Finally, the integral of a constant\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4177
60466
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4178
lemma has_integral_const [intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4179
  fixes a b :: "'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4180
  shows "((\<lambda>x. c) has_integral (content (cbox a b) *\<^sub>R c)) (cbox a b)"
60466
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4181
  apply (auto intro!: exI [where x="\<lambda>x. ball x 1"] simp: split_def has_integral)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4182
  apply (subst scaleR_left.setsum[symmetric, unfolded o_def])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4183
  apply (subst additive_content_tagged_division[unfolded split_def])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4184
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4185
  done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4186
60466
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4187
lemma has_integral_const_real [intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4188
  fixes a b :: real
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4189
  shows "((\<lambda>x. c) has_integral (content {a .. b} *\<^sub>R c)) {a .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4190
  by (metis box_real(2) has_integral_const)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4191
60466
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4192
lemma integral_const [simp]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4193
  fixes a b :: "'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4194
  shows "integral (cbox a b) (\<lambda>x. c) = content (cbox a b) *\<^sub>R c"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4195
  by (rule integral_unique) (rule has_integral_const)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4196
60466
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4197
lemma integral_const_real [simp]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4198
  fixes a b :: real
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  4199
  shows "integral {a .. b} (\<lambda>x. c) = content {a .. b} *\<^sub>R c"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4200
  by (metis box_real(2) integral_const)
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  4201
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4202
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4203
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
  4204
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4205
lemma dsum_bound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4206
  assumes "p division_of (cbox a b)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4207
    and "norm c \<le> e"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4208
  shows "norm (setsum (\<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
  4209
proof -
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  4210
  have sumeq: "(\<Sum>i\<in>p. \<bar>content i\<bar>) = setsum content p"
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  4211
    apply (rule setsum.cong)
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  4212
    using assms
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  4213
    apply simp
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  4214
    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
  4215
    done
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  4216
  have e: "0 \<le> e"
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  4217
    using assms(2) norm_ge_zero order_trans by blast
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  4218
  have "norm (setsum (\<lambda>l. content l *\<^sub>R c) p) \<le> (\<Sum>i\<in>p. norm (content i *\<^sub>R c))"
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  4219
    using norm_setsum by blast
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  4220
  also have "...  \<le> e * (\<Sum>i\<in>p. \<bar>content i\<bar>)"
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  4221
    apply (simp add: setsum_right_distrib[symmetric] mult.commute)
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  4222
    using assms(2) mult_right_mono by blast
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  4223
  also have "... \<le> e * content (cbox a b)"
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  4224
    apply (rule mult_left_mono [OF _ e])
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  4225
    apply (simp add: sumeq)
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  4226
    using additive_content_division assms(1) eq_iff apply blast
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  4227
    done
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  4228
  finally show ?thesis .
e574accba10c another proof
paulson <lp15@cam.ac.uk>
parents: 60466
diff changeset
  4229
qed
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4230
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4231
lemma rsum_bound:
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4232
  assumes p: "p tagged_division_of (cbox a b)"
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4233
      and "\<forall>x\<in>cbox a b. norm (f x) \<le> e"
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4234
    shows "norm (setsum (\<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
  4235
proof (cases "cbox a b = {}")
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4236
  case True show ?thesis
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4237
    using p unfolding True tagged_division_of_trivial by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4238
next
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4239
  case False
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4240
  then have e: "e \<ge> 0"
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4241
    by (metis assms(2) norm_ge_zero order_trans nonempty_witness)
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4242
  have setsum_le: "setsum (content \<circ> snd) p \<le> content (cbox a b)"
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4243
    unfolding additive_content_tagged_division[OF p, symmetric] split_def
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4244
    by (auto intro: eq_refl)
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4245
  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
  4246
    using tagged_division_ofD(4) [OF p] content_pos_le
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4247
    by force
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4248
  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
  4249
    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
  4250
    by (metis prod.collapse subset_eq)
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4251
  have "norm (setsum (\<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))"
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4252
    by (rule norm_setsum)
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4253
  also have "...  \<le> e * content (cbox a b)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4254
    unfolding split_def norm_scaleR
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4255
    apply (rule order_trans[OF setsum_mono])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4256
    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
  4257
    apply (metis norm)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4258
    unfolding setsum_left_distrib[symmetric]
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4259
    using con setsum_le
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4260
    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
  4261
    done
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4262
  finally show ?thesis .
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4263
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4264
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4265
lemma rsum_diff_bound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4266
  assumes "p tagged_division_of (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4267
    and "\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4268
  shows "norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p - setsum (\<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
  4269
         e * content (cbox a b)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4270
  apply (rule order_trans[OF _ rsum_bound[OF assms]])
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4271
  apply (simp add: split_def scaleR_diff_right setsum_subtractf eq_refl)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4272
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4273
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4274
lemma has_integral_bound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4275
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4276
  assumes "0 \<le> B"
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4277
      and "(f has_integral i) (cbox a b)"
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4278
      and "\<forall>x\<in>cbox a b. norm (f x) \<le> B"
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4279
    shows "norm i \<le> B * content (cbox a b)"
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4280
proof (rule ccontr)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4281
  assume "\<not> ?thesis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4282
  then have *: "norm i - B * content (cbox a b) > 0"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4283
    by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4284
  from assms(2)[unfolded has_integral,rule_format,OF *]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4285
  guess d by (elim exE conjE) note d=this[rule_format]
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4286
  from fine_division_exists[OF this(1), of a b] guess p . note p=this
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4287
  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
  4288
    unfolding not_less
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4289
    by (metis norm_triangle_sub[of i] add.commute le_less_trans less_diff_eq linorder_not_le norm_minus_commute)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4290
  show False
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4291
    using d(2)[OF conjI[OF p]] *[OF rsum_bound[OF p(1) assms(3)]] by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4292
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4293
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4294
corollary has_integral_bound_real:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4295
  fixes f :: "real \<Rightarrow> 'b::real_normed_vector"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4296
  assumes "0 \<le> B"
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4297
      and "(f has_integral i) {a .. b}"
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4298
      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
  4299
    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
  4300
  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
  4301
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4302
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
  4303
  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
  4304
  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
  4305
      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
  4306
      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
  4307
    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
  4308
by (metis integrable_integral has_integral_bound assms)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4309
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4310
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4311
subsection \<open>Similar theorems about relationship among components.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4312
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4313
lemma rsum_component_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4314
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4315
  assumes "p tagged_division_of (cbox a b)"
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4316
      and "\<forall>x\<in>cbox a b. (f x)\<bullet>i \<le> (g x)\<bullet>i"
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4317
    shows "(setsum (\<lambda>(x,k). content k *\<^sub>R f x) p)\<bullet>i \<le> (setsum (\<lambda>(x,k). content k *\<^sub>R g x) p)\<bullet>i"
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4318
unfolding inner_setsum_left
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4319
proof (rule setsum_mono, clarify)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4320
  fix a b
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4321
  assume ab: "(a, b) \<in> p"
60466
7bd794d7c86b fixing more proofs
paulson <lp15@cam.ac.uk>
parents: 60463
diff changeset
  4322
  note tagged = tagged_division_ofD(2-4)[OF assms(1) ab]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4323
  from this(3) guess u v by (elim exE) note b=this
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4324
  show "(content b *\<^sub>R f a) \<bullet> i \<le> (content b *\<^sub>R g a) \<bullet> i"
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4325
    unfolding b inner_simps real_scaleR_def
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4326
    apply (rule mult_left_mono)
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4327
    using assms(2) tagged
60472
f60f6f9baf64 Tidied up more proofs
paulson <lp15@cam.ac.uk>
parents: 60467
diff changeset
  4328
    by (auto simp add: content_pos_le)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4329
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4330
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
  4331
lemma has_integral_component_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4332
  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
  4333
  assumes k: "k \<in> Basis"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4334
  assumes "(f has_integral i) s" "(g has_integral j) s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4335
    and "\<forall>x\<in>s. (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
  4336
  shows "i\<bullet>k \<le> j\<bullet>k"
50348
4b4fe0d5ee22 remove SMT proofs in Multivariate_Analysis
hoelzl
parents: 50252
diff changeset
  4337
proof -
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4338
  have lem: "i\<bullet>k \<le> j\<bullet>k"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4339
    if f_i: "(f has_integral i) (cbox a b)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4340
    and g_j: "(g has_integral j) (cbox a b)"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4341
    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
  4342
    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
  4343
  proof (rule ccontr)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4344
    assume "\<not> ?thesis"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4345
    then have *: "0 < (i\<bullet>k - j\<bullet>k) / 3"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4346
      by auto
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4347
    guess d1 using f_i[unfolded has_integral,rule_format,OF *] by (elim exE conjE) note d1=this[rule_format]
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4348
    guess d2 using g_j[unfolded has_integral,rule_format,OF *] by (elim exE conjE) note d2=this[rule_format]
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4349
    obtain p where p: "p tagged_division_of cbox a b" "d1 fine p" "d2 fine p"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4350
       using fine_division_exists[OF gauge_inter[OF d1(1) d2(1)], of a b] unfolding fine_inter
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4351
       by metis
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
  4352
    note le_less_trans[OF Basis_le_norm[OF k]]
60474
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4353
    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"
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4354
              "\<bar>((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - j) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3"
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4355
      using  k norm_bound_Basis_lt d1 d2 p
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4356
      by blast+
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4357
    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
  4358
      unfolding inner_simps
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4359
      using rsum_component_le[OF p(1) le]
50348
4b4fe0d5ee22 remove SMT proofs in Multivariate_Analysis
hoelzl
parents: 50252
diff changeset
  4360
      by (simp add: abs_real_def split: split_if_asm)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4361
  qed
60474
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4362
  show ?thesis
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4363
  proof (cases "\<exists>a b. s = cbox a b")
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4364
    case True
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4365
    with lem assms show ?thesis
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4366
      by auto
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4367
  next
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4368
    case False
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4369
    show ?thesis
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4370
    proof (rule ccontr)
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4371
      assume "\<not> i\<bullet>k \<le> j\<bullet>k"
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4372
      then have ij: "(i\<bullet>k - j\<bullet>k) / 3 > 0"
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4373
        by auto
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4374
      note has_integral_altD[OF _ False this]
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4375
      from this[OF assms(2)] this[OF assms(3)] guess B1 B2 . note B=this[rule_format]
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4376
      have "bounded (ball 0 B1 \<union> ball (0::'a) B2)"
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4377
        unfolding bounded_Un by(rule conjI bounded_ball)+
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4378
      from bounded_subset_cbox[OF this] guess a b by (elim exE)
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4379
      note ab = conjunctD2[OF this[unfolded Un_subset_iff]]
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4380
      guess w1 using B(2)[OF ab(1)] .. note w1=conjunctD2[OF this]
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4381
      guess w2 using B(4)[OF ab(2)] .. note w2=conjunctD2[OF this]
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4382
      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"
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4383
        by (simp add: abs_real_def split: split_if_asm)
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4384
      note le_less_trans[OF Basis_le_norm[OF k]]
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4385
      note this[OF w1(2)] this[OF w2(2)]
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4386
      moreover
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4387
      have "w1\<bullet>k \<le> w2\<bullet>k"
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4388
        by (rule lem[OF w1(1) w2(1)]) (simp add: assms(4))
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4389
      ultimately show False
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4390
        unfolding inner_simps by(rule *)
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4391
    qed
f690cb540385 another tangled proof
paulson <lp15@cam.ac.uk>
parents: 60472
diff changeset
  4392
  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
  4393
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
  4394
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4395
lemma integral_component_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4396
  fixes g f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4397
  assumes "k \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4398
    and "f integrable_on s" "g integrable_on s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4399
    and "\<forall>x\<in>s. (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
  4400
  shows "(integral s f)\<bullet>k \<le> (integral s g)\<bullet>k"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4401
  apply (rule has_integral_component_le)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4402
  using integrable_integral assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4403
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4404
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4405
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4406
lemma has_integral_component_nonneg:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4407
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4408
  assumes "k \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4409
    and "(f has_integral i) s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4410
    and "\<forall>x\<in>s. 0 \<le> (f x)\<bullet>k"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4411
  shows "0 \<le> i\<bullet>k"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4412
  using has_integral_component_le[OF assms(1) has_integral_0 assms(2)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4413
  using assms(3-)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4414
  by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4415
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4416
lemma integral_component_nonneg:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4417
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4418
  assumes "k \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4419
    and "f integrable_on s" "\<forall>x\<in>s. 0 \<le> (f x)\<bullet>k"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4420
  shows "0 \<le> (integral s f)\<bullet>k"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4421
  apply (rule has_integral_component_nonneg)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4422
  using assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4423
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4424
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4425
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4426
lemma has_integral_component_neg:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4427
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4428
  assumes "k \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4429
    and "(f has_integral i) s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4430
    and "\<forall>x\<in>s. (f x)\<bullet>k \<le> 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4431
  shows "i\<bullet>k \<le> 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4432
  using has_integral_component_le[OF assms(1,2) has_integral_0] assms(2-)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4433
  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
  4434
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  4435
lemma has_integral_component_lbound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4436
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4437
  assumes "(f has_integral i) (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4438
    and "\<forall>x\<in>cbox a b. B \<le> f(x)\<bullet>k"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4439
    and "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4440
  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
  4441
  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
  4442
  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
  4443
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  4444
lemma has_integral_component_ubound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4445
  fixes f::"'a::euclidean_space => 'b::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4446
  assumes "(f has_integral i) (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4447
    and "\<forall>x\<in>cbox a b. f x\<bullet>k \<le> B"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4448
    and "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4449
  shows "i\<bullet>k \<le> B * content (cbox a b)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4450
  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
  4451
  by (auto simp add: field_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4452
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4453
lemma integral_component_lbound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4454
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4455
  assumes "f integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4456
    and "\<forall>x\<in>cbox a b. B \<le> f(x)\<bullet>k"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4457
    and "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4458
  shows "B * content (cbox a b) \<le> (integral(cbox a b) f)\<bullet>k"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4459
  apply (rule has_integral_component_lbound)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4460
  using assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4461
  unfolding has_integral_integral
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4462
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4463
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4464
56190
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  4465
lemma integral_component_lbound_real:
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  4466
  assumes "f integrable_on {a ::real .. b}"
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  4467
    and "\<forall>x\<in>{a .. b}. B \<le> f(x)\<bullet>k"
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  4468
    and "k \<in> Basis"
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  4469
  shows "B * content {a .. b} \<le> (integral {a .. b} f)\<bullet>k"
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  4470
  using assms
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  4471
  by (metis box_real(2) integral_component_lbound)
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  4472
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4473
lemma integral_component_ubound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4474
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4475
  assumes "f integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4476
    and "\<forall>x\<in>cbox a b. f x\<bullet>k \<le> B"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4477
    and "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4478
  shows "(integral (cbox a b) f)\<bullet>k \<le> B * content (cbox a b)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4479
  apply (rule has_integral_component_ubound)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4480
  using assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4481
  unfolding has_integral_integral
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4482
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4483
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4484
56190
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  4485
lemma integral_component_ubound_real:
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  4486
  fixes f :: "real \<Rightarrow> 'a::euclidean_space"
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  4487
  assumes "f integrable_on {a .. b}"
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  4488
    and "\<forall>x\<in>{a .. b}. f x\<bullet>k \<le> B"
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  4489
    and "k \<in> Basis"
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  4490
  shows "(integral {a .. b} f)\<bullet>k \<le> B * content {a .. b}"
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  4491
  using assms
f0d2609c4cdc additional lemmas
immler
parents: 56189
diff changeset
  4492
  by (metis box_real(2) integral_component_ubound)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4493
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4494
subsection \<open>Uniform limit of integrable functions is integrable.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4495
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4496
lemma integrable_uniform_limit:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4497
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4498
  assumes "\<forall>e>0. \<exists>g. (\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e) \<and> g integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4499
  shows "f integrable_on cbox a b"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4500
proof (cases "content (cbox a b) > 0")
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4501
  case False then show ?thesis
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4502
      using has_integral_null
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4503
      by (simp add: content_lt_nz integrable_on_def)
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4504
next
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4505
  case True
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4506
  have *: "\<And>P. \<forall>e>(0::real). P e \<Longrightarrow> \<forall>n::nat. P (inverse (real n + 1))"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4507
    by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4508
  from choice[OF *[OF assms]] guess g .. note g=conjunctD2[OF this[rule_format],rule_format]
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4509
  from choice[OF allI[OF g(2)[unfolded integrable_on_def], of "\<lambda>x. x"]]
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4510
  obtain i where i: "\<And>x. (g x has_integral i x) (cbox a b)"
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4511
      by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4512
  have "Cauchy i"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4513
    unfolding Cauchy_def
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4514
  proof clarify
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4515
    fix e :: real
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4516
    assume "e>0"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4517
    then have "e / 4 / content (cbox a b) > 0"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4518
      using True by (auto simp add: field_simps)
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4519
    then obtain M :: nat
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4520
         where M: "M \<noteq> 0" "0 < inverse (real_of_nat M)" "inverse (of_nat M) < e / 4 / content (cbox a b)"
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
  4521
      by (subst (asm) real_arch_inv) auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4522
    show "\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (i m) (i n) < e"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4523
    proof (rule exI [where x=M], clarify)
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4524
      fix m n
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4525
      assume m: "M \<le> m" and n: "M \<le> n"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4526
      have "e/4>0" using \<open>e>0\<close> by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4527
      note * = i[unfolded has_integral,rule_format,OF this]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4528
      from *[of m] guess gm by (elim conjE exE) note gm=this[rule_format]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4529
      from *[of n] guess gn by (elim conjE exE) note gn=this[rule_format]
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4530
      from fine_division_exists[OF gauge_inter[OF gm(1) gn(1)], of a b]
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4531
      obtain p where p: "p tagged_division_of cbox a b" "(\<lambda>x. gm x \<inter> gn x) fine p"
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4532
        by auto
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4533
      { fix s1 s2 i1 and i2::'b
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4534
        assume no: "norm(s2 - s1) \<le> e/2" "norm (s1 - i1) < e/4" "norm (s2 - i2) < e/4"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4535
        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
  4536
          using norm_triangle_ineq[of "i1 - s1" "s1 - i2"]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4537
          using norm_triangle_ineq[of "s1 - s2" "s2 - i2"]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4538
          by (auto simp add: algebra_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4539
        also have "\<dots> < e"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4540
          using no
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4541
          unfolding norm_minus_commute
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4542
          by (auto simp add: algebra_simps)
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4543
        finally have "norm (i1 - i2) < e" .
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4544
      } note triangle3 = this
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4545
      have finep: "gm fine p" "gn fine p"
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4546
        using fine_inter p  by auto
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4547
      { fix x
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4548
        assume x: "x \<in> cbox a b"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  4549
        have "norm (f x - g n x) + norm (f x - g m x) \<le> inverse (real n + 1) + inverse (real m + 1)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4550
          using g(1)[OF x, of n] g(1)[OF x, of m] by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4551
        also have "\<dots> \<le> inverse (real M) + inverse (real M)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4552
          apply (rule add_mono)
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4553
          using M(2) m n by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4554
        also have "\<dots> = 2 / real M"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4555
          unfolding divide_inverse by auto
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4556
        finally have "norm (g n x - g m x) \<le> 2 / real M"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4557
          using norm_triangle_le[of "g n x - f x" "f x - g m x" "2 / real M"]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4558
          by (auto simp add: algebra_simps simp add: norm_minus_commute)
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4559
      } note norm_le = this
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4560
      have le_e2: "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R g n x) - (\<Sum>(x, k)\<in>p. content k *\<^sub>R g m x)) \<le> e / 2"
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4561
        apply (rule order_trans [OF rsum_diff_bound[OF p(1), where e="2 / real M"]])
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4562
        apply (blast intro: norm_le)
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4563
        using M True
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4564
        by (auto simp add: field_simps)
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4565
      then show "dist (i m) (i n) < e"
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4566
        unfolding dist_norm
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4567
        using gm gn p finep
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4568
        by (auto intro!: triangle3)
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4569
    qed
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4570
  qed
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4571
  then obtain s where s: "i ----> s"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4572
    using convergent_eq_cauchy[symmetric] by blast
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4573
  show ?thesis
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4574
    unfolding integrable_on_def has_integral
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4575
  proof (rule_tac x=s in exI, clarify)
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4576
    fix e::real
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4577
    assume e: "0 < e"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4578
    then have *: "e/3 > 0" by auto
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4579
    then obtain N1 where N1: "\<forall>n\<ge>N1. norm (i n - s) < e / 3"
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4580
      using LIMSEQ_D [OF s] by metis
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4581
    from e True have "e / 3 / content (cbox a b) > 0"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4582
      by (auto simp add: field_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4583
    from real_arch_invD[OF this] guess N2 by (elim exE conjE) note N2=this
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4584
    from i[of "N1 + N2",unfolded has_integral,rule_format,OF *] guess g' .. note g'=conjunctD2[OF this,rule_format]
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4585
    { fix sf sg i
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4586
      assume no: "norm (sf - sg) \<le> e / 3"
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4587
                 "norm(i - s) < e / 3"
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4588
                 "norm (sg - i) < e / 3"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4589
      have "norm (sf - s) \<le> norm (sf - sg) + norm (sg - i) + norm (i - s)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4590
        using norm_triangle_ineq[of "sf - sg" "sg - s"]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4591
        using norm_triangle_ineq[of "sg -  i" " i - s"]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4592
        by (auto simp add: algebra_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4593
      also have "\<dots> < e"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4594
        using no
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4595
        unfolding norm_minus_commute
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4596
        by (auto simp add: algebra_simps)
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4597
      finally have "norm (sf - s) < e" .
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4598
    } note lem = this
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4599
    { fix p
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4600
      assume p: "p tagged_division_of (cbox a b) \<and> g' fine p"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4601
      then have norm_less: "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R g (N1 + N2) x) - i (N1 + N2)) < e / 3"
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4602
        using g' by blast
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4603
      have "content (cbox a b) < e / 3 * (of_nat N2)"
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4604
        using N2 unfolding inverse_eq_divide using True by (auto simp add: field_simps)
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4605
      moreover have "e / 3 * of_nat N2 \<le> e / 3 * (of_nat (N1 + N2) + 1)"
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4606
        using \<open>e>0\<close> by auto
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4607
      ultimately have "content (cbox a b) < e / 3 * (of_nat (N1 + N2) + 1)"
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4608
        by linarith
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4609
      then have le_e3: "inverse (real (N1 + N2) + 1) * content (cbox a b) \<le> e / 3"
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4610
        unfolding inverse_eq_divide
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4611
        by (auto simp add: field_simps)
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4612
      have ne3: "norm (i (N1 + N2) - s) < e / 3"
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4613
        using N1 by auto
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4614
      have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - s) < e"
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4615
        apply (rule lem[OF order_trans [OF _ le_e3] ne3 norm_less])
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4616
        apply (rule rsum_diff_bound[OF p[THEN conjunct1]])
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4617
        apply (blast intro: g)
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4618
        done }
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4619
    then show "\<exists>d. gauge d \<and>
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4620
             (\<forall>p. p tagged_division_of cbox a b \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - s) < e)"
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4621
      by (blast intro: g')
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4622
  qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4623
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4624
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4625
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4626
subsection \<open>Negligible sets.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4627
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4628
definition "negligible (s:: 'a::euclidean_space set) \<longleftrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4629
  (\<forall>a b. ((indicator s :: 'a\<Rightarrow>real) has_integral 0) (cbox a b))"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4630
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4631
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4632
subsection \<open>Negligibility of hyperplane.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4633
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4634
lemma setsum_nonzero_image_lemma:
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4635
  assumes "finite s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4636
    and "g a = 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4637
    and "\<forall>x\<in>s. \<forall>y\<in>s. f x = f y \<and> x \<noteq> y \<longrightarrow> g (f x) = 0"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4638
  shows "setsum g {f x |x. x \<in> s \<and> f x \<noteq> a} = setsum (g o f) s"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4639
  apply (subst setsum_iterate)
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4640
  using assms monoidal_monoid
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4641
  unfolding setsum_iterate[OF assms(1)]
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4642
  apply (auto intro!: iterate_nonzero_image_lemma)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4643
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4644
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4645
lemma interval_doublesplit:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4646
  fixes a :: "'a::euclidean_space"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4647
  assumes "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4648
  shows "cbox a b \<inter> {x . abs(x\<bullet>k - c) \<le> (e::real)} =
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4649
    cbox (\<Sum>i\<in>Basis. (if i = k then max (a\<bullet>k) (c - e) else a\<bullet>i) *\<^sub>R i)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4650
     (\<Sum>i\<in>Basis. (if i = k then min (b\<bullet>k) (c + e) else b\<bullet>i) *\<^sub>R i)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4651
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4652
  have *: "\<And>x c e::real. abs(x - c) \<le> e \<longleftrightarrow> x \<ge> c - e \<and> x \<le> c + e"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4653
    by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4654
  have **: "\<And>s P Q. s \<inter> {x. P x \<and> Q x} = (s \<inter> {x. Q x}) \<inter> {x. P x}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4655
    by blast
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4656
  show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4657
    unfolding * ** interval_split[OF assms] by (rule refl)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4658
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
  4659
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4660
lemma division_doublesplit:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4661
  fixes a :: "'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4662
  assumes "p division_of (cbox a b)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4663
    and k: "k \<in> Basis"
60492
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4664
  shows "{l \<inter> {x. abs(x\<bullet>k - c) \<le> e} |l. l \<in> p \<and> l \<inter> {x. abs(x\<bullet>k - c) \<le> e} \<noteq> {}}
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4665
         division_of  (cbox a b \<inter> {x. abs(x\<bullet>k - c) \<le> e})"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4666
proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4667
  have *: "\<And>x c. abs (x - c) \<le> e \<longleftrightarrow> x \<ge> c - e \<and> x \<le> c + e"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4668
    by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4669
  have **: "\<And>p q p' q'. p division_of q \<Longrightarrow> p = p' \<Longrightarrow> q = q' \<Longrightarrow> p' division_of q'"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4670
    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
  4671
  note division_split(1)[OF assms, where c="c+e",unfolded interval_split[OF k]]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  4672
  note division_split(2)[OF this, where c="c-e" and k=k,OF k]
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4673
  then show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4674
    apply (rule **)
60492
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4675
    unfolding interval_doublesplit [OF k]
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4676
    using k
60492
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4677
    apply (simp_all add: * interval_split)
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4678
    apply (rule equalityI, blast)
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4679
    apply clarsimp
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4680
    apply (rule_tac x="l \<inter> {x. c + e \<ge> x \<bullet> k}" in exI)
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4681
    apply auto
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4682
    done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4683
qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4684
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4685
lemma content_doublesplit:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4686
  fixes a :: "'a::euclidean_space"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4687
  assumes "0 < e"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4688
    and k: "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4689
  obtains d where "0 < d" and "content (cbox a b \<inter> {x. abs(x\<bullet>k - c) \<le> d}) < e"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4690
proof (cases "content (cbox a b) = 0")
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4691
  case True
60492
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4692
  then have ce: "content (cbox a b) < e"
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  4693
    by (metis \<open>0 < e\<close>)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4694
  show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4695
    apply (rule that[of 1])
60492
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4696
    apply simp
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4697
    unfolding interval_doublesplit[OF k]
60492
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4698
    apply (rule le_less_trans[OF content_subset ce])
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4699
    apply (auto simp: interval_doublesplit[symmetric] k)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4700
    done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4701
next
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4702
  case False
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4703
  def d \<equiv> "e / 3 / setprod (\<lambda>i. b\<bullet>i - a\<bullet>i) (Basis - {k})"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4704
  note False[unfolded content_eq_0 not_ex not_le, rule_format]
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4705
  then have "\<And>x. x \<in> Basis \<Longrightarrow> b\<bullet>x > a\<bullet>x"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4706
    by (auto simp add:not_le)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4707
  then have prod0: "0 < setprod (\<lambda>i. b\<bullet>i - a\<bullet>i) (Basis - {k})"
60492
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4708
    by (force simp add: setprod_pos field_simps)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4709
  then have "d > 0"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4710
    using assms
60492
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4711
    by (auto simp add: d_def field_simps)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4712
  then show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4713
  proof (rule that[of d])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4714
    have *: "Basis = insert k (Basis - {k})"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4715
      using k by auto
60492
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4716
    have less_e: "(min (b \<bullet> k) (c + d) - max (a \<bullet> k) (c - d)) * (\<Prod>i\<in>Basis - {k}. b \<bullet> i - a \<bullet> i) < e"
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
  4717
    proof -
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4718
      have "(min (b \<bullet> k) (c + d) - max (a \<bullet> k) (c - d)) \<le> 2 * d"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4719
        by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4720
      also have "\<dots> < e / (\<Prod>i\<in>Basis - {k}. b \<bullet> i - a \<bullet> i)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4721
        unfolding d_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4722
        using assms prod0
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4723
        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
  4724
      finally show "(min (b \<bullet> k) (c + d) - max (a \<bullet> k) (c - d)) * (\<Prod>i\<in>Basis - {k}. b \<bullet> i - a \<bullet> i) < 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
  4725
        unfolding pos_less_divide_eq[OF prod0] .
60492
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4726
    qed
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4727
    show "content (cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) < e"
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4728
    proof (cases "cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} = {}")
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4729
      case True
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4730
      then show ?thesis
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4731
        using assms by simp
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4732
    next
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4733
      case False
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4734
      then have
60492
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4735
          "(\<Prod>i\<in>Basis - {k}. interval_upperbound (cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) \<bullet> i -
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4736
                interval_lowerbound (cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) \<bullet> i)
60492
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4737
           = (\<Prod>i\<in>Basis - {k}. b\<bullet>i - a\<bullet>i)"
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4738
        by (simp add: box_eq_empty interval_doublesplit[OF k])
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4739
      then show "content (cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) < e"
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4740
        unfolding content_def
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  4741
        using assms False
60492
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4742
        apply (subst *)
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4743
        apply (subst setprod.insert)
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4744
        apply (simp_all add: interval_doublesplit[OF k] box_eq_empty not_less less_e)
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4745
        done
db0f4f4c17c7 another messy proof fixed
paulson <lp15@cam.ac.uk>
parents: 60487
diff changeset
  4746
    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
  4747
  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
  4748
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
  4749
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  4750
lemma negligible_standard_hyperplane[intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4751
  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
  4752
  assumes k: "k \<in> Basis"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  4753
  shows "negligible {x. x\<bullet>k = c}"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4754
  unfolding negligible_def has_integral
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  4755
proof (clarify, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4756
  case (1 a b e)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  4757
  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
  4758
    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
  4759
  let ?i = "indicator {x::'a. x\<bullet>k = c} :: 'a\<Rightarrow>real"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4760
  show ?case
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4761
    apply (rule_tac x="\<lambda>x. ball x d" in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4762
    apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4763
    apply (rule gauge_ball)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4764
    apply (rule d)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4765
  proof (rule, rule)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4766
    fix p
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4767
    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
  4768
    have *: "(\<Sum>(x, ka)\<in>p. content ka *\<^sub>R ?i x) =
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4769
      (\<Sum>(x, ka)\<in>p. content (ka \<inter> {x. abs(x\<bullet>k - c) \<le> d}) *\<^sub>R ?i x)"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  4770
      apply (rule setsum.cong)
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  4771
      apply (rule refl)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4772
      unfolding split_paired_all real_scaleR_def mult_cancel_right split_conv
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4773
      apply cases
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4774
      apply (rule disjI1)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4775
      apply assumption
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4776
      apply (rule disjI2)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4777
    proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4778
      fix x l
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4779
      assume as: "(x, l) \<in> p" "?i x \<noteq> 0"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4780
      then have xk: "x\<bullet>k = c"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4781
        unfolding indicator_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4782
        apply -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4783
        apply (rule ccontr)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4784
        apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4785
        done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4786
      show "content l = content (l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4787
        apply (rule arg_cong[where f=content])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4788
        apply (rule set_eqI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4789
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4790
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4791
        unfolding mem_Collect_eq
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4792
      proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4793
        fix y
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4794
        assume y: "y \<in> l"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4795
        note p[THEN conjunct2,unfolded fine_def,rule_format,OF as(1),unfolded split_conv]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4796
        note this[unfolded subset_eq mem_ball dist_norm,rule_format,OF y]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4797
        note le_less_trans[OF Basis_le_norm[OF k] this]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4798
        then show "\<bar>y \<bullet> k - c\<bar> \<le> d"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4799
          unfolding inner_simps xk by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4800
      qed auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4801
    qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4802
    note p'= tagged_division_ofD[OF p[THEN conjunct1]] and p''=division_of_tagged_division[OF p[THEN conjunct1]]
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4803
    show "norm ((\<Sum>(x, ka)\<in>p. content ka *\<^sub>R ?i x) - 0) < e"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4804
      unfolding diff_0_right *
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4805
      unfolding real_scaleR_def real_norm_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4806
      apply (subst abs_of_nonneg)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4807
      apply (rule setsum_nonneg)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4808
      apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4809
      unfolding split_paired_all split_conv
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4810
      apply (rule mult_nonneg_nonneg)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4811
      apply (drule p'(4))
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4812
      apply (erule exE)+
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4813
      apply(rule_tac b=b in back_subst)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4814
      prefer 2
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4815
      apply (subst(asm) eq_commute)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4816
      apply assumption
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4817
      apply (subst interval_doublesplit[OF k])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4818
      apply (rule content_pos_le)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4819
      apply (rule indicator_pos_le)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4820
    proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4821
      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
  4822
        (\<Sum>(x, ka)\<in>p. content (ka \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}))"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4823
        apply (rule setsum_mono)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4824
        unfolding split_paired_all split_conv
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4825
        apply (rule mult_right_le_one_le)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4826
        apply (drule p'(4))
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4827
        apply (auto simp add:interval_doublesplit[OF k])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4828
        done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4829
      also have "\<dots> < e"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  4830
      proof (subst setsum_over_tagged_division_lemma[OF p[THEN conjunct1]], goal_cases)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  4831
        case prems: (1 u v)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4832
        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
  4833
          unfolding interval_doublesplit[OF k]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4834
          apply (rule content_subset)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4835
          unfolding interval_doublesplit[symmetric,OF k]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4836
          apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4837
          done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4838
        then show ?case
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  4839
          unfolding prems interval_doublesplit[OF k]
50348
4b4fe0d5ee22 remove SMT proofs in Multivariate_Analysis
hoelzl
parents: 50252
diff changeset
  4840
          by (blast intro: antisym)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4841
      next
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4842
        have *: "setsum content {l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} |l. l \<in> snd ` p \<and> l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<noteq> {}} \<ge> 0"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4843
          apply (rule setsum_nonneg)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4844
          apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4845
          unfolding mem_Collect_eq image_iff
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4846
          apply (erule exE bexE conjE)+
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4847
          unfolding split_paired_all
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4848
        proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4849
          fix x l a b
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4850
          assume as: "x = l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}" "(a, b) \<in> p" "l = snd (a, b)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4851
          guess u v using p'(4)[OF as(2)] by (elim exE) note * = this
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4852
          show "content x \<ge> 0"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4853
            unfolding as snd_conv * interval_doublesplit[OF k]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4854
            by (rule content_pos_le)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4855
        qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4856
        have **: "norm (1::real) \<le> 1"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4857
          by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4858
        note division_doublesplit[OF p'' k,unfolded interval_doublesplit[OF k]]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  4859
        note dsum_bound[OF this **,unfolded interval_doublesplit[symmetric,OF k]]
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4860
        note this[unfolded real_scaleR_def real_norm_def mult_1_right mult_1, of c d]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4861
        note le_less_trans[OF this d(2)]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4862
        from this[unfolded abs_of_nonneg[OF *]]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4863
        show "(\<Sum>ka\<in>snd ` p. content (ka \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})) < e"
60487
2abfcf85c627 inverted another messy proof
paulson <lp15@cam.ac.uk>
parents: 60474
diff changeset
  4864
          apply (subst setsum_nonzero_image_lemma[of "snd ` p" content "{}", unfolded o_def,symmetric])
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4865
          apply (rule finite_imageI p' content_empty)+
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4866
          unfolding forall_in_division[OF p'']
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4867
        proof (rule,rule,rule,rule,rule,rule,rule,erule conjE)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4868
          fix m n u v
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4869
          assume as:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4870
            "cbox m n \<in> snd ` p" "cbox u v \<in> snd ` p"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4871
            "cbox m n \<noteq> cbox u v"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4872
            "cbox m n \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} = cbox u v \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4873
          have "(cbox m n \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) \<inter> (cbox u v \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) \<subseteq> cbox m n \<inter> cbox u v"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4874
            by blast
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61424
diff changeset
  4875
          note interior_mono[OF this, unfolded division_ofD(5)[OF p'' as(1-3)] interior_Int[of "cbox m n"]]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4876
          then have "interior (cbox m n \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) = {}"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4877
            unfolding as Int_absorb by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4878
          then show "content (cbox m n \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) = 0"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4879
            unfolding interval_doublesplit[OF k] content_eq_0_interior[symmetric] .
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4880
        qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4881
      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
  4882
      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
  4883
    qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4884
  qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4885
qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4886
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4887
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  4888
subsection \<open>A technical lemma about "refinement" of division.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4889
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4890
lemma tagged_division_finer:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4891
  fixes p :: "('a::euclidean_space \<times> ('a::euclidean_space set)) set"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4892
  assumes "p tagged_division_of (cbox a b)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4893
    and "gauge d"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4894
  obtains q where "q tagged_division_of (cbox a b)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4895
    and "d fine q"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4896
    and "\<forall>(x,k) \<in> p. k \<subseteq> d(x) \<longrightarrow> (x,k) \<in> q"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4897
proof -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4898
  let ?P = "\<lambda>p. p tagged_partial_division_of (cbox a b) \<longrightarrow> gauge d \<longrightarrow>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4899
    (\<exists>q. q tagged_division_of (\<Union>{k. \<exists>x. (x,k) \<in> p}) \<and> d fine q \<and>
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4900
      (\<forall>(x,k) \<in> p. k \<subseteq> d(x) \<longrightarrow> (x,k) \<in> q))"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4901
  {
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4902
    have *: "finite p" "p tagged_partial_division_of (cbox a b)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4903
      using assms(1)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4904
      unfolding tagged_division_of_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4905
      by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4906
    presume "\<And>p. finite p \<Longrightarrow> ?P p"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4907
    from this[rule_format,OF * assms(2)] guess q .. note q=this
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4908
    then show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4909
      apply -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4910
      apply (rule that[of q])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4911
      unfolding tagged_division_ofD[OF assms(1)]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4912
      apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4913
      done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4914
  }
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4915
  fix p :: "('a::euclidean_space \<times> ('a::euclidean_space set)) set"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4916
  assume as: "finite p"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4917
  show "?P p"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4918
    apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4919
    apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4920
    using as
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4921
  proof (induct p)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4922
    case empty
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4923
    show ?case
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4924
      apply (rule_tac x="{}" in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4925
      unfolding fine_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4926
      apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4927
      done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4928
  next
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4929
    case (insert xk p)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4930
    guess x k using surj_pair[of xk] by (elim exE) note xk=this
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4931
    note tagged_partial_division_subset[OF insert(4) subset_insertI]
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4932
    from insert(3)[OF this insert(5)] guess q1 .. note q1 = conjunctD3[OF this]
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4933
    have *: "\<Union>{l. \<exists>y. (y,l) \<in> insert xk p} = k \<union> \<Union>{l. \<exists>y. (y,l) \<in> p}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4934
      unfolding xk by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4935
    note p = tagged_partial_division_ofD[OF insert(4)]
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4936
    from p(4)[unfolded xk, OF insertI1] guess u v by (elim exE) note uv=this
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4937
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  4938
    have "finite {k. \<exists>x. (x, k) \<in> p}"
60810
9ede42599eeb tweaks. Got rid of a really slow step
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  4939
      apply (rule finite_subset[of _ "snd ` p"])
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4940
      using p
60810
9ede42599eeb tweaks. Got rid of a really slow step
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  4941
      apply safe
9ede42599eeb tweaks. Got rid of a really slow step
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  4942
      apply (metis image_iff snd_conv)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4943
      apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4944
      done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4945
    then have int: "interior (cbox u v) \<inter> interior (\<Union>{k. \<exists>x. (x, k) \<in> p}) = {}"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4946
      apply (rule inter_interior_unions_intervals)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4947
      apply (rule open_interior)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4948
      apply (rule_tac[!] ballI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4949
      unfolding mem_Collect_eq
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4950
      apply (erule_tac[!] exE)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4951
      apply (drule p(4)[OF insertI2])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4952
      apply assumption
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4953
      apply (rule p(5))
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4954
      unfolding uv xk
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4955
      apply (rule insertI1)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4956
      apply (rule insertI2)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4957
      apply assumption
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4958
      using insert(2)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4959
      unfolding uv xk
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4960
      apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4961
      done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4962
    show ?case
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4963
    proof (cases "cbox u v \<subseteq> d x")
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4964
      case True
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4965
      then show ?thesis
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  4966
        apply (rule_tac x="{(x,cbox u v)} \<union> q1" in exI)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4967
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4968
        unfolding * uv
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4969
        apply (rule tagged_division_union)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4970
        apply (rule tagged_division_of_self)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4971
        apply (rule p[unfolded xk uv] insertI1)+
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4972
        apply (rule q1)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4973
        apply (rule int)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4974
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4975
        apply (rule fine_union)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4976
        apply (subst fine_def)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4977
        defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4978
        apply (rule q1)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4979
        unfolding Ball_def split_paired_All split_conv
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4980
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4981
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4982
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4983
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4984
        apply (erule insertE)
60810
9ede42599eeb tweaks. Got rid of a really slow step
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  4985
        apply (simp add: uv xk)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4986
        apply (rule UnI2)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4987
        apply (drule q1(3)[rule_format])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4988
        unfolding xk uv
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4989
        apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4990
        done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4991
    next
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4992
      case False
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4993
      from fine_division_exists[OF assms(2), of u v] guess q2 . note q2=this
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4994
      show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4995
        apply (rule_tac x="q2 \<union> q1" in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4996
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4997
        unfolding * uv
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4998
        apply (rule tagged_division_union q2 q1 int fine_union)+
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  4999
        unfolding Ball_def split_paired_All split_conv
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5000
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5001
        apply (rule fine_union)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5002
        apply (rule q1 q2)+
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5003
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5004
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5005
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5006
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5007
        apply (erule insertE)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5008
        apply (rule UnI2)
60810
9ede42599eeb tweaks. Got rid of a really slow step
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
  5009
        apply (simp add: False uv xk)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5010
        apply (drule q1(3)[rule_format])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5011
        using False
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5012
        unfolding xk uv
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5013
        apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5014
        done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5015
    qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5016
  qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5017
qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5018
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5019
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5020
subsection \<open>Hence the main theorem about negligible sets.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5021
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5022
lemma finite_product_dependent:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5023
  assumes "finite s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5024
    and "\<And>x. x \<in> s \<Longrightarrow> finite (t x)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5025
  shows "finite {(i, j) |i j. i \<in> s \<and> j \<in> t i}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5026
  using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5027
proof induct
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5028
  case (insert x s)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5029
  have *: "{(i, j) |i j. i \<in> insert x s \<and> j \<in> t i} =
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5030
    (\<lambda>y. (x,y)) ` (t x) \<union> {(i, j) |i j. i \<in> s \<and> j \<in> t i}" by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5031
  show ?case
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5032
    unfolding *
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5033
    apply (rule finite_UnI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5034
    using insert
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5035
    apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5036
    done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5037
qed auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5038
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5039
lemma sum_sum_product:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5040
  assumes "finite s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5041
    and "\<forall>i\<in>s. finite (t i)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5042
  shows "setsum (\<lambda>i. setsum (x i) (t i)::real) s =
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5043
    setsum (\<lambda>(i,j). x i j) {(i,j) | i j. i \<in> s \<and> j \<in> t i}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5044
  using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5045
proof induct
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5046
  case (insert a s)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5047
  have *: "{(i, j) |i j. i \<in> insert a s \<and> j \<in> t i} =
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5048
    (\<lambda>y. (a,y)) ` (t a) \<union> {(i, j) |i j. i \<in> s \<and> j \<in> t i}" by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5049
  show ?case
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5050
    unfolding *
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  5051
    apply (subst setsum.union_disjoint)
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  5052
    unfolding setsum.insert[OF insert(1-2)]
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5053
    prefer 4
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5054
    apply (subst insert(3))
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5055
    unfolding add_right_cancel
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5056
  proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5057
    show "setsum (x a) (t a) = (\<Sum>(xa, y)\<in> Pair a ` t a. x xa y)"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  5058
      apply (subst setsum.reindex)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5059
      unfolding inj_on_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5060
      apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5061
      done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5062
    show "finite {(i, j) |i j. i \<in> s \<and> j \<in> t i}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5063
      apply (rule finite_product_dependent)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5064
      using insert
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5065
      apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5066
      done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5067
  qed (insert insert, auto)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5068
qed auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5069
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5070
lemma has_integral_negligible:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5071
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::real_normed_vector"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5072
  assumes "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5073
    and "\<forall>x\<in>(t - s). f x = 0"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5074
  shows "(f has_integral 0) t"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5075
proof -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5076
  presume P: "\<And>f::'b::euclidean_space \<Rightarrow> 'a.
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5077
    \<And>a b. \<forall>x. x \<notin> s \<longrightarrow> f x = 0 \<Longrightarrow> (f has_integral 0) (cbox a b)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5078
  let ?f = "(\<lambda>x. if x \<in> t then f x else 0)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5079
  show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5080
    apply (rule_tac f="?f" in has_integral_eq)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5081
    unfolding if_P
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5082
    apply (rule refl)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5083
    apply (subst has_integral_alt)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5084
    apply cases
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5085
    apply (subst if_P, assumption)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5086
    unfolding if_not_P
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5087
  proof -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5088
    assume "\<exists>a b. t = cbox a b"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5089
    then guess a b apply - by (erule exE)+ note t = this
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5090
    show "(?f has_integral 0) t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5091
      unfolding t
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5092
      apply (rule P)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5093
      using assms(2)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5094
      unfolding t
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5095
      apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5096
      done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5097
  next
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5098
    show "\<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
  5099
      (\<exists>z. ((\<lambda>x. if x \<in> t then ?f x else 0) has_integral z) (cbox a b) \<and> norm (z - 0) < e)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5100
      apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5101
      apply (rule_tac x=1 in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5102
      apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5103
      apply (rule zero_less_one)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5104
      apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5105
      apply (rule_tac x=0 in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5106
      apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5107
      apply (rule P)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5108
      using assms(2)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5109
      apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5110
      done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5111
  qed
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5112
next
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5113
  fix f :: "'b \<Rightarrow> 'a"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5114
  fix a b :: 'b
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5115
  assume assm: "\<forall>x. x \<notin> s \<longrightarrow> f x = 0"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5116
  show "(f has_integral 0) (cbox a b)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5117
    unfolding has_integral
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5118
  proof (safe, goal_cases)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  5119
    case prems: (1 e)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5120
    then have "\<And>n. e / 2 / ((real n+1) * (2 ^ n)) > 0"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5121
      apply -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5122
      apply (rule divide_pos_pos)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5123
      defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5124
      apply (rule mult_pos_pos)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5125
      apply (auto simp add:field_simps)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5126
      done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5127
    note assms(1)[unfolded negligible_def has_integral,rule_format,OF this,of a b]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5128
    note allI[OF this,of "\<lambda>x. x"]
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5129
    from choice[OF this] guess d .. note d=conjunctD2[OF this[rule_format]]
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5130
    show ?case
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5131
      apply (rule_tac x="\<lambda>x. d (nat \<lfloor>norm (f x)\<rfloor>) x" in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5132
    proof safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5133
      show "gauge (\<lambda>x. d (nat \<lfloor>norm (f x)\<rfloor>) x)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5134
        using d(1) unfolding gauge_def by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5135
      fix p
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5136
      assume as: "p tagged_division_of (cbox a b)" "(\<lambda>x. d (nat \<lfloor>norm (f x)\<rfloor>) x) fine p"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5137
      let ?goal = "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - 0) < e"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5138
      {
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5139
        presume "p \<noteq> {} \<Longrightarrow> ?goal"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5140
        then show ?goal
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5141
          apply (cases "p = {}")
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  5142
          using prems
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5143
          apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5144
          done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5145
      }
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5146
      assume as': "p \<noteq> {}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5147
      from real_arch_simple[of "Sup((\<lambda>(x,k). norm(f x)) ` p)"] guess N ..
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5148
      then have N: "\<forall>x\<in>(\<lambda>(x, k). norm (f x)) ` p. x \<le> real N"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5149
        apply (subst(asm) cSup_finite_le_iff)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5150
        using as as'
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5151
        apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5152
        done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5153
      have "\<forall>i. \<exists>q. q tagged_division_of (cbox a b) \<and> (d i) fine q \<and> (\<forall>(x, k)\<in>p. k \<subseteq> (d i) x \<longrightarrow> (x, k) \<in> q)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5154
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5155
        apply (rule tagged_division_finer[OF as(1) d(1)])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5156
        apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5157
        done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5158
      from choice[OF this] guess q .. note q=conjunctD3[OF this[rule_format]]
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5159
      have *: "\<And>i. (\<Sum>(x, k)\<in>q i. content k *\<^sub>R indicator s x) \<ge> (0::real)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5160
        apply (rule setsum_nonneg)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5161
        apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5162
        unfolding real_scaleR_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5163
        apply (drule tagged_division_ofD(4)[OF q(1)])
56536
aefb4a8da31f made mult_nonneg_nonneg a simp rule
nipkow
parents: 56381
diff changeset
  5164
        apply (auto intro: mult_nonneg_nonneg)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5165
        done
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5166
      have **: "finite s \<Longrightarrow> finite t \<Longrightarrow> (\<forall>(x,y) \<in> t. (0::real) \<le> g(x,y)) \<Longrightarrow>
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5167
        (\<forall>y\<in>s. \<exists>x. (x,y) \<in> t \<and> f(y) \<le> g(x,y)) \<Longrightarrow> setsum f s \<le> setsum g t" for f g s t
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5168
        apply (rule setsum_le_included[of s t g snd f])
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5169
        prefer 4
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5170
        apply safe
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5171
        apply (erule_tac x=x in ballE)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5172
        apply (erule exE)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5173
        apply (rule_tac x="(xa,x)" in bexI)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5174
        apply auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5175
        done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5176
      have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - 0) \<le> setsum (\<lambda>i. (real i + 1) *
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56190
diff changeset
  5177
        norm (setsum (\<lambda>(x,k). content k *\<^sub>R indicator s x :: real) (q i))) {..N+1}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5178
        unfolding real_norm_def setsum_right_distrib abs_of_nonneg[OF *] diff_0_right
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5179
        apply (rule order_trans)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5180
        apply (rule norm_setsum)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5181
        apply (subst sum_sum_product)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5182
        prefer 3
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5183
      proof (rule **, safe)
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56190
diff changeset
  5184
        show "finite {(i, j) |i j. i \<in> {..N + 1} \<and> j \<in> q i}"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5185
          apply (rule finite_product_dependent)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5186
          using q
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5187
          apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5188
          done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5189
        fix i a b
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5190
        assume as'': "(a, b) \<in> q i"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5191
        show "0 \<le> (real i + 1) * (content b *\<^sub>R indicator s a)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5192
          unfolding real_scaleR_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5193
          using tagged_division_ofD(4)[OF q(1) as'']
56536
aefb4a8da31f made mult_nonneg_nonneg a simp rule
nipkow
parents: 56381
diff changeset
  5194
          by (auto intro!: mult_nonneg_nonneg)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5195
      next
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5196
        fix i :: nat
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5197
        show "finite (q i)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5198
          using q by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5199
      next
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5200
        fix x k
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5201
        assume xk: "(x, k) \<in> p"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5202
        def n \<equiv> "nat \<lfloor>norm (f x)\<rfloor>"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5203
        have *: "norm (f x) \<in> (\<lambda>(x, k). norm (f x)) ` p"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5204
          using xk by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5205
        have nfx: "real n \<le> norm (f x)" "norm (f x) \<le> real n + 1"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5206
          unfolding n_def by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5207
        then have "n \<in> {0..N + 1}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5208
          using N[rule_format,OF *] by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5209
        moreover
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5210
        note as(2)[unfolded fine_def,rule_format,OF xk,unfolded split_conv]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5211
        note q(3)[rule_format,OF xk,unfolded split_conv,rule_format,OF this]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5212
        note this[unfolded n_def[symmetric]]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5213
        moreover
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5214
        have "norm (content k *\<^sub>R f x) \<le> (real n + 1) * (content k * indicator s x)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5215
        proof (cases "x \<in> s")
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5216
          case False
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5217
          then show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5218
            using assm by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5219
        next
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5220
          case True
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5221
          have *: "content k \<ge> 0"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5222
            using tagged_division_ofD(4)[OF as(1) xk] by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5223
          moreover
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5224
          have "content k * norm (f x) \<le> content k * (real n + 1)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5225
            apply (rule mult_mono)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5226
            using nfx *
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5227
            apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5228
            done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5229
          ultimately
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5230
          show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5231
            unfolding abs_mult
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5232
            using nfx True
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5233
            by (auto simp add: field_simps)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5234
        qed
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56190
diff changeset
  5235
        ultimately show "\<exists>y. (y, x, k) \<in> {(i, j) |i j. i \<in> {..N + 1} \<and> j \<in> q i} \<and> norm (content k *\<^sub>R f x) \<le>
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5236
          (real y + 1) * (content k *\<^sub>R indicator s x)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5237
          apply (rule_tac x=n in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5238
          apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5239
          apply (rule_tac x=n in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5240
          apply (rule_tac x="(x,k)" in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5241
          apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5242
          apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5243
          done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5244
      qed (insert as, auto)
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56190
diff changeset
  5245
      also have "\<dots> \<le> setsum (\<lambda>i. e / 2 / 2 ^ i) {..N+1}"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5246
      proof (rule setsum_mono, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5247
        case (1 i)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5248
        then show ?case
57512
cc97b347b301 reduced name variants for assoc and commute on plus and mult
haftmann
parents: 57447
diff changeset
  5249
          apply (subst mult.commute, subst pos_le_divide_eq[symmetric])
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5250
          using d(2)[rule_format, of "q i" i]
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5251
          using q[rule_format]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5252
          apply (auto simp add: field_simps)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5253
          done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5254
      qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5255
      also have "\<dots> < e * inverse 2 * 2"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5256
        unfolding divide_inverse setsum_right_distrib[symmetric]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5257
        apply (rule mult_strict_left_mono)
60867
86e7560e07d0 slight cleanup of lemmas
haftmann
parents: 60810
diff changeset
  5258
        unfolding power_inverse [symmetric] lessThan_Suc_atMost[symmetric]
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56190
diff changeset
  5259
        apply (subst geometric_sum)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  5260
        using prems
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5261
        apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5262
        done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5263
      finally show "?goal" by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5264
    qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5265
  qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5266
qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5267
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5268
lemma has_integral_spike:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5269
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::real_normed_vector"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5270
  assumes "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5271
    and "(\<forall>x\<in>(t - s). g x = f x)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5272
    and "(f has_integral y) t"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5273
  shows "(g has_integral y) t"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5274
proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5275
  {
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5276
    fix a b :: 'b
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5277
    fix f g :: "'b \<Rightarrow> 'a"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5278
    fix y :: 'a
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5279
    assume as: "\<forall>x \<in> cbox a b - s. g x = f x" "(f has_integral y) (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5280
    have "((\<lambda>x. f x + (g x - f x)) has_integral (y + 0)) (cbox a b)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5281
      apply (rule has_integral_add[OF as(2)])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5282
      apply (rule has_integral_negligible[OF assms(1)])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5283
      using as
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5284
      apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5285
      done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5286
    then have "(g has_integral y) (cbox a b)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5287
      by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5288
  } note * = this
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5289
  show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5290
    apply (subst has_integral_alt)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5291
    using assms(2-)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5292
    apply -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5293
    apply (rule cond_cases)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5294
    apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5295
    apply (rule *)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5296
    apply assumption+
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5297
    apply (subst(asm) has_integral_alt)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5298
    unfolding if_not_P
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5299
    apply (erule_tac x=e in allE)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5300
    apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5301
    apply (rule_tac x=B in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5302
    apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5303
    apply (erule_tac x=a in allE)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5304
    apply (erule_tac x=b in allE)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5305
    apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5306
    apply (rule_tac x=z in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5307
    apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5308
    apply (rule *[where fa2="\<lambda>x. if x\<in>t then f x else 0"])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5309
    apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5310
    done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5311
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5312
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5313
lemma has_integral_spike_eq:
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5314
  assumes "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5315
    and "\<forall>x\<in>(t - s). g x = f x"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5316
  shows "((f has_integral y) t \<longleftrightarrow> (g has_integral y) t)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5317
  apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5318
  apply (rule_tac[!] has_integral_spike[OF assms(1)])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5319
  using assms(2)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5320
  apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5321
  done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5322
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5323
lemma integrable_spike:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5324
  assumes "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5325
    and "\<forall>x\<in>(t - s). g x = f x"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5326
    and "f integrable_on t"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5327
  shows "g integrable_on  t"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5328
  using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5329
  unfolding integrable_on_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5330
  apply -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5331
  apply (erule exE)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5332
  apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5333
  apply (rule has_integral_spike)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5334
  apply fastforce+
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5335
  done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5336
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5337
lemma integral_spike:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5338
  assumes "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5339
    and "\<forall>x\<in>(t - s). g x = f x"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5340
  shows "integral t f = integral t g"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5341
  unfolding integral_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5342
  using has_integral_spike_eq[OF assms]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5343
  by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5344
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5345
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5346
subsection \<open>Some other trivialities about negligible sets.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5347
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5348
lemma negligible_subset[intro]:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5349
  assumes "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5350
    and "t \<subseteq> s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5351
  shows "negligible t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5352
  unfolding negligible_def
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5353
proof (safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5354
  case (1 a b)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5355
  show ?case
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5356
    using assms(1)[unfolded negligible_def,rule_format,of a b]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5357
    apply -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5358
    apply (rule has_integral_spike[OF assms(1)])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5359
    defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5360
    apply assumption
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5361
    using assms(2)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5362
    unfolding indicator_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5363
    apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5364
    done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5365
qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5366
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5367
lemma negligible_diff[intro?]:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5368
  assumes "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5369
  shows "negligible (s - t)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5370
  using assms by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5371
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5372
lemma negligible_inter:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5373
  assumes "negligible s \<or> negligible t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5374
  shows "negligible (s \<inter> t)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5375
  using assms by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5376
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5377
lemma negligible_union:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5378
  assumes "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5379
    and "negligible t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5380
  shows "negligible (s \<union> t)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5381
  unfolding negligible_def
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5382
proof (safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5383
  case (1 a b)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5384
  note assm = assms[unfolded negligible_def,rule_format,of a b]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5385
  then show ?case
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5386
    apply (subst has_integral_spike_eq[OF assms(2)])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5387
    defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5388
    apply assumption
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5389
    unfolding indicator_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5390
    apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5391
    done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5392
qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5393
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5394
lemma negligible_union_eq[simp]: "negligible (s \<union> t) \<longleftrightarrow> negligible s \<and> negligible t"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5395
  using negligible_union by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5396
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5397
lemma negligible_sing[intro]: "negligible {a::'a::euclidean_space}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  5398
  using negligible_standard_hyperplane[OF SOME_Basis, of "a \<bullet> (SOME i. i \<in> Basis)"] by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5399
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5400
lemma negligible_insert[simp]: "negligible (insert a s) \<longleftrightarrow> negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5401
  apply (subst insert_is_Un)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5402
  unfolding negligible_union_eq
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5403
  apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5404
  done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5405
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
  5406
lemma negligible_empty[iff]: "negligible {}"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5407
  by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5408
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5409
lemma negligible_finite[intro]:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5410
  assumes "finite s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5411
  shows "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5412
  using assms by (induct s) auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5413
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5414
lemma negligible_unions[intro]:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5415
  assumes "finite s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5416
    and "\<forall>t\<in>s. negligible t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5417
  shows "negligible(\<Union>s)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5418
  using assms by induct auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5419
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5420
lemma negligible:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5421
  "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
  5422
  apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5423
  defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5424
  apply (subst negligible_def)
46905
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  5425
proof -
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5426
  fix t :: "'a set"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5427
  assume as: "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5428
  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
  5429
    by auto
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  5430
  show "((indicator s::'a\<Rightarrow>real) has_integral 0) t"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5431
    apply (subst has_integral_alt)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5432
    apply cases
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5433
    apply (subst if_P,assumption)
46905
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  5434
    unfolding if_not_P
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5435
    apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5436
    apply (rule as[unfolded negligible_def,rule_format])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5437
    apply (rule_tac x=1 in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5438
    apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5439
    apply (rule zero_less_one)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5440
    apply (rule_tac x=0 in exI)
46905
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  5441
    using negligible_subset[OF as,of "s \<inter> t"]
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  5442
    unfolding negligible_def indicator_def [abs_def]
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  5443
    unfolding *
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  5444
    apply auto
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  5445
    done
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  5446
qed auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5447
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5448
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5449
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
  5450
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5451
lemma has_integral_spike_finite:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5452
  assumes "finite s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5453
    and "\<forall>x\<in>t-s. g x = f x"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5454
    and "(f has_integral y) t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5455
  shows "(g has_integral y) t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5456
  apply (rule has_integral_spike)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5457
  using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5458
  apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5459
  done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5460
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5461
lemma has_integral_spike_finite_eq:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5462
  assumes "finite s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5463
    and "\<forall>x\<in>t-s. g x = f x"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5464
  shows "((f has_integral y) t \<longleftrightarrow> (g has_integral y) t)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5465
  apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5466
  apply (rule_tac[!] has_integral_spike_finite)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5467
  using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5468
  apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5469
  done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5470
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5471
lemma integrable_spike_finite:
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5472
  assumes "finite s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5473
    and "\<forall>x\<in>t-s. g x = f x"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5474
    and "f integrable_on t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5475
  shows "g integrable_on  t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5476
  using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5477
  unfolding integrable_on_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5478
  apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5479
  apply (rule_tac x=y in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5480
  apply (rule has_integral_spike_finite)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5481
  apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5482
  done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5483
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5484
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5485
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
  5486
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5487
lemma negligible_frontier_interval: "negligible(cbox (a::'a::euclidean_space) b - box a b)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5488
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
  5489
  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
  5490
  have "cbox a b - box a b \<subseteq> ?A"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5491
    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
  5492
    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
  5493
    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
  5494
    apply(rule_tac x=i in bexI)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5495
    apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5496
    done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5497
  then show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5498
    apply -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5499
    apply (rule negligible_subset[of ?A])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5500
    apply (rule negligible_unions[OF finite_imageI])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5501
    apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5502
    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
  5503
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5504
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5505
lemma has_integral_spike_interior:
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  5506
  assumes "\<forall>x\<in>box a b. g x = f x"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5507
    and "(f has_integral y) (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5508
  shows "(g has_integral y) (cbox a b)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5509
  apply (rule has_integral_spike[OF negligible_frontier_interval _ assms(2)])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5510
  using assms(1)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5511
  apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5512
  done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5513
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5514
lemma has_integral_spike_interior_eq:
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  5515
  assumes "\<forall>x\<in>box a b. g x = f x"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5516
  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
  5517
  apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5518
  apply (rule_tac[!] has_integral_spike_interior)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5519
  using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5520
  apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5521
  done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5522
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5523
lemma integrable_spike_interior:
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  5524
  assumes "\<forall>x\<in>box a b. g x = f x"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5525
    and "f integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5526
  shows "g integrable_on cbox a b"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5527
  using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5528
  unfolding integrable_on_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5529
  using has_integral_spike_interior[OF assms(1)]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5530
  by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5531
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5532
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5533
subsection \<open>Integrability of continuous functions.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5534
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5535
lemma neutral_and[simp]: "neutral op \<and> = True"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5536
  unfolding neutral_def by (rule some_equality) auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5537
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5538
lemma monoidal_and[intro]: "monoidal op \<and>"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5539
  unfolding monoidal_def by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5540
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5541
lemma iterate_and[simp]:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5542
  assumes "finite s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5543
  shows "(iterate op \<and>) s p \<longleftrightarrow> (\<forall>x\<in>s. p x)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5544
  using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5545
  apply induct
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5546
  unfolding iterate_insert[OF monoidal_and]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5547
  apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5548
  done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5549
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5550
lemma operative_division_and:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5551
  assumes "operative op \<and> P"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5552
    and "d division_of (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5553
  shows "(\<forall>i\<in>d. P i) \<longleftrightarrow> P (cbox a b)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5554
  using operative_division[OF monoidal_and assms] division_of_finite[OF assms(2)]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5555
  by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5556
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5557
lemma operative_approximable:
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5558
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5559
  assumes "0 \<le> e"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5560
  shows "operative op \<and> (\<lambda>i. \<exists>g. (\<forall>x\<in>i. norm (f x - g (x::'b)) \<le> e) \<and> g integrable_on i)"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5561
  unfolding operative_def neutral_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
  5562
proof safe
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5563
  fix a b :: 'b
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5564
  show "\<exists>g. (\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e) \<and> g integrable_on cbox a b"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5565
    if "content (cbox a b) = 0"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5566
    apply (rule_tac x=f in exI)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5567
    using assms that
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5568
    apply (auto intro!: integrable_on_null)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5569
    done
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5570
  {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5571
    fix c g
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5572
    fix k :: 'b
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5573
    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
  5574
    assume k: "k \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5575
    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
  5576
      "\<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
  5577
      apply (rule_tac[!] x=g in exI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5578
      using as(1) integrable_split[OF as(2) k]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5579
      apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5580
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5581
  }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5582
  fix c k g1 g2
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5583
  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
  5584
    "\<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
  5585
  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
  5586
  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
  5587
  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
  5588
    apply (rule_tac x="?g" in exI)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5589
    apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  5590
  proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5591
    case (1 x)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5592
    then show ?case
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5593
      apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5594
      apply (cases "x\<bullet>k=c")
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5595
      apply (case_tac "x\<bullet>k < c")
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5596
      using as assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5597
      apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5598
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5599
  next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  5600
    case 2
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5601
    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
  5602
      and "?g integrable_on cbox a b \<inter> {x. x \<bullet> k \<ge> c}"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5603
    then guess h1 h2 unfolding integrable_on_def by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5604
    from has_integral_split[OF this k] show ?case
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5605
      unfolding integrable_on_def by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5606
  next
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5607
    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
  5608
      apply(rule_tac[!] integrable_spike[OF negligible_standard_hyperplane[of k c]])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5609
      using k as(2,4)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5610
      apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5611
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5612
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5613
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5614
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5615
lemma approximable_on_division:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5616
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5617
  assumes "0 \<le> e"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5618
    and "d division_of (cbox a b)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5619
    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
  5620
  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
  5621
proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5622
  note * = operative_division[OF monoidal_and operative_approximable[OF assms(1)] assms(2)]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5623
  note this[unfolded iterate_and[OF division_of_finite[OF assms(2)]]]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5624
  from assms(3)[unfolded this[of f]] guess g ..
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5625
  then show thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5626
    apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5627
    apply (rule that[of g])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5628
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5629
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5630
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5631
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5632
lemma integrable_continuous:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5633
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5634
  assumes "continuous_on (cbox a b) f"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5635
  shows "f integrable_on cbox a b"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5636
proof (rule integrable_uniform_limit, safe)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5637
  fix e :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5638
  assume e: "e > 0"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5639
  from compact_uniformly_continuous[OF assms compact_cbox,unfolded uniformly_continuous_on_def,rule_format,OF e] guess d ..
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5640
  note d=conjunctD2[OF this,rule_format]
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5641
  from fine_division_exists[OF gauge_ball[OF d(1)], of a b] guess p . note p=this
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5642
  note p' = tagged_division_ofD[OF p(1)]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5643
  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
  5644
  proof (safe, unfold snd_conv)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5645
    fix x l
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5646
    assume as: "(x, l) \<in> p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5647
    from p'(4)[OF this] guess a b by (elim exE) note l=this
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5648
    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
  5649
      apply (rule_tac x="\<lambda>y. f x" in exI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5650
    proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5651
      show "(\<lambda>y. f x) integrable_on l"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5652
        unfolding integrable_on_def l
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5653
        apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5654
        apply (rule has_integral_const)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5655
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5656
      fix y
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5657
      assume y: "y \<in> l"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5658
      note fineD[OF p(2) as,unfolded subset_eq,rule_format,OF this]
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5659
      note d(2)[OF _ _ this[unfolded mem_ball]]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5660
      then show "norm (f y - f x) \<le> e"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5661
        using y p'(2-3)[OF as] unfolding dist_norm l norm_minus_commute by fastforce
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5662
    qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5663
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5664
  from e have "e \<ge> 0"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5665
    by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5666
  from approximable_on_division[OF this division_of_tagged_division[OF p(1)] *] guess g .
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5667
  then 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
  5668
    by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5669
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5670
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5671
lemma integrable_continuous_real:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5672
  fixes f :: "real \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5673
  assumes "continuous_on {a .. b} f"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5674
  shows "f integrable_on {a .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5675
  by (metis assms box_real(2) integrable_continuous)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5676
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5677
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5678
subsection \<open>Specialization of additivity to one dimension.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5679
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  5680
lemma
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
  5681
  shows real_inner_1_left: "inner 1 x = x"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  5682
  and real_inner_1_right: "inner x 1 = x"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  5683
  by simp_all
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  5684
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5685
lemma content_real_eq_0: "content {a .. b::real} = 0 \<longleftrightarrow> a \<ge> b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5686
  by (metis atLeastatMost_empty_iff2 content_empty content_real diff_self eq_iff le_cases le_iff_diff_le_0)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5687
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5688
lemma interval_real_split:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5689
  "{a .. b::real} \<inter> {x. x \<le> c} = {a .. min b c}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5690
  "{a .. b} \<inter> {x. c \<le> x} = {max a c .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5691
  apply (metis Int_atLeastAtMostL1 atMost_def)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5692
  apply (metis Int_atLeastAtMostL2 atLeast_def)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5693
  done
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5694
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5695
lemma operative_1_lt:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5696
  assumes "monoidal opp"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5697
  shows "operative opp f \<longleftrightarrow> ((\<forall>a b. b \<le> a \<longrightarrow> f {a .. b::real} = neutral opp) \<and>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5698
    (\<forall>a b c. a < c \<and> c < b \<longrightarrow> opp (f {a .. c}) (f {c .. b}) = f {a .. b}))"
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60621
diff changeset
  5699
  apply (simp add: operative_def content_real_eq_0 del: content_real_if)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5700
proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5701
  fix a b c :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5702
  assume as:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5703
    "\<forall>a b c. f {a..b} = opp (f ({a..b} \<inter> {x. x \<le> c})) (f ({a..b} \<inter> Collect (op \<le> c)))"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5704
    "a < c"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5705
    "c < b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5706
    from this(2-) have "cbox a b \<inter> {x. x \<le> c} = cbox a c" "cbox a b \<inter> {x. x \<ge> c} = cbox c b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5707
      by (auto simp: mem_box)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5708
    then show "opp (f {a..c}) (f {c..b}) = f {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5709
      unfolding as(1)[rule_format,of a b "c"] by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5710
next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5711
  fix a b c :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5712
  assume as: "\<forall>a b. b \<le> a \<longrightarrow> f {a..b} = neutral opp"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5713
    "\<forall>a b c. a < c \<and> c < b \<longrightarrow> opp (f {a..c}) (f {c..b}) = f {a..b}"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5714
  show " f {a..b} = opp (f ({a..b} \<inter> {x. x \<le> c})) (f ({a..b} \<inter> Collect (op \<le> c)))"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5715
  proof (cases "c \<in> {a..b}")
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5716
    case False
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5717
    then have "c < a \<or> c > b" by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5718
    then show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5719
    proof
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5720
      assume "c < a"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5721
      then have *: "{a..b} \<inter> {x. x \<le> c} = {1..0}" "{a..b} \<inter> {x. c \<le> x} = {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5722
        by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5723
      show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5724
        unfolding *
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5725
        apply (subst as(1)[rule_format,of 0 1])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5726
        using assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5727
        apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5728
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5729
    next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5730
      assume "b < c"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5731
      then have *: "{a..b} \<inter> {x. x \<le> c} = {a..b}" "{a..b} \<inter> {x. c \<le> x} = {1 .. 0}"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5732
        by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5733
      show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5734
        unfolding *
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5735
        apply (subst as(1)[rule_format,of 0 1])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5736
        using assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5737
        apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5738
        done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5739
    qed
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5740
  next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5741
    case True
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5742
    then have *: "min (b) c = c" "max a c = c"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5743
      by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5744
    have **: "(1::real) \<in> Basis"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5745
      by simp
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5746
    have ***: "\<And>P Q. (\<Sum>i\<in>Basis. (if i = 1 then P i else Q i) *\<^sub>R i) = (P 1::real)"
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
  5747
      by simp
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  5748
    show ?thesis
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5749
      unfolding interval_real_split unfolding *
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5750
    proof (cases "c = a \<or> c = b")
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5751
      case False
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5752
      then show "f {a..b} = opp (f {a..c}) (f {c..b})"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5753
        apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5754
        apply (subst as(2)[rule_format])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5755
        using True
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5756
        apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5757
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5758
    next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5759
      case True
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5760
      then show "f {a..b} = opp (f {a..c}) (f {c..b})"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5761
      proof
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5762
        assume *: "c = a"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5763
        then have "f {a .. c} = neutral opp"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5764
          apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5765
          apply (rule as(1)[rule_format])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5766
          apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5767
          done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5768
        then show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5769
          using assms unfolding * by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5770
      next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5771
        assume *: "c = b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5772
        then have "f {c .. b} = neutral opp"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5773
          apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5774
          apply (rule as(1)[rule_format])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5775
          apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5776
          done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5777
        then show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5778
          using assms unfolding * by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5779
      qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5780
    qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5781
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5782
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5783
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5784
lemma operative_1_le:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5785
  assumes "monoidal opp"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5786
  shows "operative opp f \<longleftrightarrow> ((\<forall>a b. b \<le> a \<longrightarrow> f {a .. b::real} = neutral opp) \<and>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5787
    (\<forall>a b c. a \<le> c \<and> c \<le> b \<longrightarrow> opp (f {a .. c}) (f {c .. b}) = f {a .. b}))"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5788
  unfolding operative_1_lt[OF assms]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5789
proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5790
  fix a b c :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5791
  assume as:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5792
    "\<forall>a b c. a \<le> c \<and> c \<le> b \<longrightarrow> opp (f {a..c}) (f {c..b}) = f {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5793
    "a < c"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5794
    "c < b"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5795
  show "opp (f {a..c}) (f {c..b}) = f {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5796
    apply (rule as(1)[rule_format])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5797
    using as(2-)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5798
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5799
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5800
next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5801
  fix a b c :: real
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5802
  assume "\<forall>a b. b \<le> a \<longrightarrow> f {a .. b} = neutral opp"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5803
    and "\<forall>a b c. a < c \<and> c < b \<longrightarrow> opp (f {a..c}) (f {c..b}) = f {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5804
    and "a \<le> c"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5805
    and "c \<le> b"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5806
  note as = this[rule_format]
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5807
  show "opp (f {a..c}) (f {c..b}) = f {a..b}"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5808
  proof (cases "c = a \<or> c = b")
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5809
    case False
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5810
    then show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5811
      apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5812
      apply (subst as(2))
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5813
      using as(3-)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5814
      apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5815
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5816
  next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5817
    case True
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5818
    then show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5819
    proof
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5820
      assume *: "c = a"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5821
      then have "f {a .. c} = neutral opp"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5822
        apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5823
        apply (rule as(1)[rule_format])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5824
        apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5825
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5826
      then show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5827
        using assms unfolding * by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5828
    next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5829
      assume *: "c = b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5830
      then have "f {c .. b} = neutral opp"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5831
        apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5832
        apply (rule as(1)[rule_format])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5833
        apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5834
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5835
      then show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5836
        using assms unfolding * by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5837
    qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5838
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5839
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5840
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5841
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5842
subsection \<open>Special case of additivity we need for the FCT.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5843
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5844
lemma additive_tagged_division_1:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5845
  fixes f :: "real \<Rightarrow> 'a::real_normed_vector"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5846
  assumes "a \<le> b"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5847
    and "p tagged_division_of {a..b}"
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  5848
  shows "setsum (\<lambda>(x,k). f(Sup k) - f(Inf k)) p = f b - f a"
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  5849
proof -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5850
  let ?f = "(\<lambda>k::(real) set. if k = {} then 0 else f(interval_upperbound k) - f(interval_lowerbound k))"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5851
  have ***: "\<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5852
    using assms by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5853
  have *: "operative op + ?f"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5854
    unfolding operative_1_lt[OF monoidal_monoid] box_eq_empty
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5855
    by auto
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5856
  have **: "cbox a b \<noteq> {}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5857
    using assms(1) by auto
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5858
  note operative_tagged_division[OF monoidal_monoid * assms(2)[simplified box_real[symmetric]]]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  5859
  note * = this[unfolded if_not_P[OF **] interval_bounds[OF ***],symmetric]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5860
  show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5861
    unfolding *
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5862
    apply (subst setsum_iterate[symmetric])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5863
    defer
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  5864
    apply (rule setsum.cong)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5865
    unfolding split_paired_all split_conv
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5866
    using assms(2)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5867
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5868
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5869
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5870
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5871
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5872
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
  5873
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5874
lemma has_integral_factor_content:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5875
  "(f has_integral i) (cbox a b) \<longleftrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5876
    (\<forall>e>0. \<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
  5877
      norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p - i) \<le> e * content (cbox a b)))"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5878
proof (cases "content (cbox a b) = 0")
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5879
  case True
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5880
  show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5881
    unfolding has_integral_null_eq[OF True]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5882
    apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5883
    apply (rule, rule, rule gauge_trivial, safe)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5884
    unfolding setsum_content_null[OF True] True
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5885
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5886
    apply (erule_tac x=1 in allE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5887
    apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5888
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5889
    apply (rule fine_division_exists[of _ a b])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5890
    apply assumption
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5891
    apply (erule_tac x=p in allE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5892
    unfolding setsum_content_null[OF True]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5893
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5894
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5895
next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5896
  case False
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5897
  note F = this[unfolded content_lt_nz[symmetric]]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5898
  let ?P = "\<lambda>e opp. \<exists>d. gauge d \<and>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5899
    (\<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
  5900
  show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5901
    apply (subst has_integral)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5902
  proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5903
    fix e :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5904
    assume e: "e > 0"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5905
    {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5906
      assume "\<forall>e>0. ?P e op <"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5907
      then show "?P (e * content (cbox a b)) op \<le>"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5908
        apply (erule_tac x="e * content (cbox a b)" in allE)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5909
        apply (erule impE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5910
        defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5911
        apply (erule exE,rule_tac x=d in exI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5912
        using F e
56544
b60d5d119489 made mult_pos_pos a simp rule
nipkow
parents: 56541
diff changeset
  5913
        apply (auto simp add:field_simps)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5914
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5915
    }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5916
    {
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5917
      assume "\<forall>e>0. ?P (e * content (cbox a b)) op \<le>"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5918
      then show "?P e op <"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5919
        apply (erule_tac x="e / 2 / content (cbox a b)" in allE)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5920
        apply (erule impE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5921
        defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5922
        apply (erule exE,rule_tac x=d in exI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5923
        using F e
56544
b60d5d119489 made mult_pos_pos a simp rule
nipkow
parents: 56541
diff changeset
  5924
        apply (auto simp add: field_simps)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5925
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5926
    }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5927
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5928
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5929
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5930
lemma has_integral_factor_content_real:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5931
  "(f has_integral i) {a .. b::real} \<longleftrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5932
    (\<forall>e>0. \<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
  5933
      norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p - i) \<le> e * content {a .. b} ))"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5934
  unfolding box_real[symmetric]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5935
  by (rule has_integral_factor_content)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5936
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5937
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5938
subsection \<open>Fundamental theorem of calculus.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5939
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5940
lemma interval_bounds_real:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5941
  fixes q b :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5942
  assumes "a \<le> b"
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  5943
  shows "Sup {a..b} = b"
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  5944
    and "Inf {a..b} = a"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5945
  using assms by auto
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5946
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5947
lemma fundamental_theorem_of_calculus:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5948
  fixes f :: "real \<Rightarrow> 'a::banach"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5949
  assumes "a \<le> b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5950
    and "\<forall>x\<in>{a .. b}. (f has_vector_derivative f' x) (at x within {a .. b})"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5951
  shows "(f' has_integral (f b - f a)) {a .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5952
  unfolding has_integral_factor_content box_real[symmetric]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5953
proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5954
  fix e :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5955
  assume e: "e > 0"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5956
  note assm = assms(2)[unfolded has_vector_derivative_def has_derivative_within_alt]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5957
  have *: "\<And>P Q. \<forall>x\<in>{a .. b}. P x \<and> (\<forall>e>0. \<exists>d>0. Q x e d) \<Longrightarrow> \<forall>x. \<exists>(d::real)>0. x\<in>{a .. b} \<longrightarrow> Q x e d"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5958
    using e by blast
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5959
  note this[OF assm,unfolded gauge_existence_lemma]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5960
  from choice[OF this,unfolded Ball_def[symmetric]] guess d ..
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5961
  note d=conjunctD2[OF this[rule_format],rule_format]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5962
  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
  5963
    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
  5964
    apply (rule_tac x="\<lambda>x. ball x (d x)" in exI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5965
    apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5966
    apply (rule gauge_ball_dependent)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5967
    apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5968
    apply (rule d(1))
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5969
  proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5970
    fix p
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  5971
    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
  5972
    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
  5973
      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
  5974
      unfolding additive_tagged_division_1[OF assms(1) as(1)[simplified box_real],of "\<lambda>x. x",symmetric]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5975
      unfolding setsum_right_distrib
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5976
      defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5977
      unfolding setsum_subtractf[symmetric]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5978
    proof (rule setsum_norm_le,safe)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5979
      fix x k
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5980
      assume "(x, k) \<in> p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5981
      note xk = tagged_division_ofD(2-4)[OF as(1) this]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5982
      from this(3) guess u v by (elim exE) note k=this
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5983
      have *: "u \<le> v"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5984
        using xk unfolding k by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5985
      have ball: "\<forall>xa\<in>k. xa \<in> ball x (d x)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  5986
        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
  5987
      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
  5988
        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
  5989
        apply (rule order_trans[OF _ norm_triangle_ineq4])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5990
        apply (rule eq_refl)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5991
        apply (rule arg_cong[where f=norm])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5992
        unfolding scaleR_diff_left
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5993
        apply (auto simp add:algebra_simps)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5994
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5995
      also have "\<dots> \<le> e * norm (u - x) + e * norm (v - x)"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5996
        apply (rule add_mono)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5997
        apply (rule d(2)[of "x" "u",unfolded o_def])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5998
        prefer 4
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5999
        apply (rule d(2)[of "x" "v",unfolded o_def])
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  6000
        using ball[rule_format,of u] ball[rule_format,of v]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6001
        using xk(1-2)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6002
        unfolding k subset_eq
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6003
        apply (auto simp add:dist_real_def)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6004
        done
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  6005
      also have "\<dots> \<le> e * (Sup k - Inf k)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6006
        unfolding k interval_bounds_real[OF *]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6007
        using xk(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6008
        unfolding k
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6009
        by (auto simp add: dist_real_def field_simps)
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  6010
      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
  6011
        e * (Sup k - Inf k)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6012
        unfolding box_real k interval_bounds_real[OF *] content_real[OF *]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6013
          interval_upperbound_real interval_lowerbound_real
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6014
          .
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6015
    qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6016
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6017
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6018
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6019
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6020
subsection \<open>Taylor series expansion\<close>
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6021
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6022
lemma (in bounded_bilinear) setsum_prod_derivatives_has_vector_derivative:
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6023
  assumes "p>0"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6024
  and f0: "Df 0 = f"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6025
  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
  6026
    (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
  6027
  and g0: "Dg 0 = g"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6028
  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
  6029
    (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
  6030
  and ivl: "a \<le> t" "t \<le> b"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6031
  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
  6032
    has_vector_derivative
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6033
      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
  6034
    (at t within {a .. b})"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6035
  using assms
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6036
proof cases
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6037
  assume p: "p \<noteq> 1"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6038
  def p' \<equiv> "p - 2"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6039
  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
  6040
    by (auto simp: p'_def)
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6041
  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
  6042
    by auto
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6043
  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
  6044
  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
  6045
    prod (Df (Suc i) t) (Dg (p - Suc i) t))) =
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6046
    (\<Sum>i\<le>(Suc p'). ?f i - ?f (Suc i))"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6047
    by (auto simp: algebra_simps p'(2) numeral_2_eq_2 * lessThan_Suc_atMost)
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6048
  also note setsum_telescope
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6049
  finally
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6050
  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
  6051
    prod (Df (Suc i) t) (Dg (p - Suc i) t)))
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6052
    = 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
  6053
    unfolding p'[symmetric]
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6054
    by (simp add: assms)
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6055
  thus ?thesis
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6056
    using assms
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6057
    by (auto intro!: derivative_eq_intros has_vector_derivative)
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6058
qed (auto intro!: derivative_eq_intros has_vector_derivative)
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6059
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6060
lemma
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6061
  fixes f::"real\<Rightarrow>'a::banach"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6062
  assumes "p>0"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6063
  and f0: "Df 0 = f"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6064
  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
  6065
    (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
  6066
  and ivl: "a \<le> b"
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6067
  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
  6068
  shows taylor_has_integral:
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6069
    "(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
  6070
  and taylor_integral:
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6071
    "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
  6072
  and taylor_integrable:
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6073
    "i integrable_on {a .. b}"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  6074
proof goal_cases
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6075
  case 1
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6076
  interpret bounded_bilinear "scaleR::real\<Rightarrow>'a\<Rightarrow>'a"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6077
    by (rule bounded_bilinear_scaleR)
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6078
  def g \<equiv> "\<lambda>s. (b - s)^(p - 1)/fact (p - 1)"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6079
  def Dg \<equiv> "\<lambda>n s. if n < p then (-1)^n * (b - s)^(p - 1 - n) / fact (p - 1 - n) else 0"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6080
  have g0: "Dg 0 = g"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6081
    using \<open>p > 0\<close>
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6082
    by (auto simp add: Dg_def divide_simps g_def split: split_if_asm)
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6083
  {
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6084
    fix m
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6085
    assume "p > Suc m"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6086
    hence "p - Suc m = Suc (p - Suc (Suc m))"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6087
      by auto
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6088
    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
  6089
      by auto
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6090
  } note fact_eq = this
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6091
  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
  6092
    (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
  6093
    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
  6094
    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
  6095
  let ?sum = "\<lambda>t. \<Sum>i<p. (- 1) ^ i *\<^sub>R Dg i t *\<^sub>R Df (p - Suc i) t"
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6096
  from setsum_prod_derivatives_has_vector_derivative[of _ Dg _ _ _ Df,
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6097
      OF \<open>p > 0\<close> g0 Dg f0 Df]
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6098
  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
  6099
    (?sum has_vector_derivative
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6100
      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
  6101
    by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6102
  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
  6103
  have "(i has_integral ?sum b - ?sum a) {a .. b}"
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6104
    by (simp add: i_def g_def Dg_def)
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6105
  also
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6106
  have one: "(- 1) ^ p' * (- 1) ^ p' = (1::real)"
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6107
    and "{..<p} \<inter> {i. p = Suc i} = {p - 1}"
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6108
    for p'
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  6109
    using \<open>p > 0\<close>
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6110
    by (auto simp: power_mult_distrib[symmetric])
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6111
  then have "?sum b = f b"
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  6112
    using Suc_pred'[OF \<open>p > 0\<close>]
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6113
    by (simp add: diff_eq_eq Dg_def power_0_left le_Suc_eq if_distrib
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6114
        cond_application_beta setsum.If_cases f0)
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6115
  also
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6116
  have "{..<p} = (\<lambda>x. p - x - 1) ` {..<p}"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6117
  proof safe
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6118
    fix x
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6119
    assume "x < p"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6120
    thus "x \<in> (\<lambda>x. p - x - 1) ` {..<p}"
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6121
      by (auto intro!: image_eqI[where x = "p - x - 1"])
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6122
  qed simp
60621
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6123
  from _ this
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6124
  have "?sum a = (\<Sum>i<p. ((b - a) ^ i / fact i) *\<^sub>R Df i a)"
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6125
    by (rule setsum.reindex_cong) (auto simp add: inj_on_def Dg_def one)
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6126
  finally show c: ?case .
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6127
  case 2 show ?case using c integral_unique by force
bfb14ff43491 taylor series with has_integral and integrable_on
immler
parents: 60615
diff changeset
  6128
  case 3 show ?case using c by force
60180
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6129
qed
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6130
09a7481c03b1 general Taylor series expansion with integral remainder
immler
parents: 59765
diff changeset
  6131
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6132
subsection \<open>Attempt a systematic general set of "offset" results for components.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6133
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6134
lemma gauge_modify:
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6135
  assumes "(\<forall>s. open s \<longrightarrow> open {x. f(x) \<in> s})" "gauge d"
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
  6136
  shows "gauge (\<lambda>x. {y. f y \<in> d (f x)})"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6137
  using assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6138
  unfolding gauge_def
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6139
  apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6140
  defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6141
  apply (erule_tac x="f x" in allE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6142
  apply (erule_tac x="d (f x)" in allE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6143
  apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6144
  done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6145
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6146
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6147
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
  6148
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6149
lemma division_of_nontrivial:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6150
  fixes s :: "'a::euclidean_space set set"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6151
  assumes "s division_of (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6152
    and "content (cbox a b) \<noteq> 0"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6153
  shows "{k. k \<in> s \<and> content k \<noteq> 0} division_of (cbox a b)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6154
  using assms(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6155
  apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6156
proof (induct "card s" arbitrary: s rule: nat_less_induct)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6157
  fix s::"'a set set"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6158
  assume assm: "s division_of (cbox a b)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6159
    "\<forall>m<card s. \<forall>x. m = card x \<longrightarrow>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6160
      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
  6161
  note s = division_ofD[OF assm(1)]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6162
  let ?thesis = "{k \<in> s. content k \<noteq> 0} division_of (cbox a b)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6163
  {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6164
    presume *: "{k \<in> s. content k \<noteq> 0} \<noteq> s \<Longrightarrow> ?thesis"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6165
    show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6166
      apply cases
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6167
      defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6168
      apply (rule *)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6169
      apply assumption
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6170
      using assm(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6171
      apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6172
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6173
  }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6174
  assume noteq: "{k \<in> s. content k \<noteq> 0} \<noteq> s"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6175
  then obtain k where k: "k \<in> s" "content k = 0"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6176
    by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6177
  from s(4)[OF k(1)] guess c d by (elim exE) note k=k this
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6178
  from k have "card s > 0"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6179
    unfolding card_gt_0_iff using assm(1) by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6180
  then have card: "card (s - {k}) < card s"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6181
    using assm(1) k(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6182
    apply (subst card_Diff_singleton_if)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6183
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6184
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6185
  have *: "closed (\<Union>(s - {k}))"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6186
    apply (rule closed_Union)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6187
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6188
    apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6189
    apply (drule DiffD1,drule s(4))
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6190
    using assm(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6191
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6192
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6193
  have "k \<subseteq> \<Union>(s - {k})"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6194
    apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6195
    apply (rule *[unfolded closed_limpt,rule_format])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6196
    unfolding islimpt_approachable
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6197
  proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6198
    fix x
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6199
    fix e :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6200
    assume as: "x \<in> k" "e > 0"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  6201
    from k(2)[unfolded k content_eq_0] guess i ..
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6202
    then have i:"c\<bullet>i = d\<bullet>i" "i\<in>Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6203
      using s(3)[OF k(1),unfolded k] unfolding box_ne_empty by auto
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6204
    then have xi: "x\<bullet>i = d\<bullet>i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6205
      using as unfolding k mem_box by (metis antisym)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6206
    def y \<equiv> "\<Sum>j\<in>Basis. (if j = i then if c\<bullet>i \<le> (a\<bullet>i + b\<bullet>i) / 2 then c\<bullet>i +
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6207
      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"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6208
    show "\<exists>x'\<in>\<Union>(s - {k}). x' \<noteq> x \<and> dist x' x < e"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6209
      apply (rule_tac x=y in bexI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6210
    proof
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6211
      have "d \<in> cbox c d"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6212
        using s(3)[OF k(1)]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6213
        unfolding k box_eq_empty mem_box
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6214
        by (fastforce simp add: not_less)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6215
      then have "d \<in> cbox a b"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6216
        using s(2)[OF k(1)]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6217
        unfolding k
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6218
        by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6219
      note di = this[unfolded mem_box,THEN bspec[where x=i]]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6220
      then have xyi: "y\<bullet>i \<noteq> x\<bullet>i"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6221
        unfolding y_def i xi
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6222
        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
  6223
        by (auto elim!: ballE[of _ _ i])
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6224
      then show "y \<noteq> x"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6225
        unfolding euclidean_eq_iff[where 'a='a] using i by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6226
      have *: "Basis = insert i (Basis - {i})"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6227
        using i by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6228
      have "norm (y - x) < e + setsum (\<lambda>i. 0) Basis"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6229
        apply (rule le_less_trans[OF norm_le_l1])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6230
        apply (subst *)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  6231
        apply (subst setsum.insert)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6232
        prefer 3
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6233
        apply (rule add_less_le_mono)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6234
      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
  6235
        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
  6236
          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
  6237
        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
  6238
          unfolding y_def by (auto simp: inner_simps)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6239
      qed auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6240
      then show "dist y x < e"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6241
        unfolding dist_norm by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6242
      have "y \<notin> k"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6243
        unfolding k mem_box
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6244
        apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6245
        apply (erule_tac x=i in ballE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6246
        using xyi k i xi
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6247
        apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6248
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6249
      moreover
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6250
      have "y \<in> \<Union>s"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6251
        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
  6252
        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
  6253
        by (auto simp: field_simps elim!: ballE[of _ _ i])
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6254
      ultimately
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6255
      show "y \<in> \<Union>(s - {k})" by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6256
    qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6257
  qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6258
  then have "\<Union>(s - {k}) = cbox a b"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6259
    unfolding s(6)[symmetric] by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6260
  then have  "{ka \<in> s - {k}. content ka \<noteq> 0} division_of (cbox a b)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6261
    apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6262
    apply (rule assm(2)[rule_format,OF card refl])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6263
    apply (rule division_ofI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6264
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6265
    apply (rule_tac[1-4] s)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6266
    using assm(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6267
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6268
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6269
  moreover
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6270
  have "{ka \<in> s - {k}. content ka \<noteq> 0} = {k \<in> s. content k \<noteq> 0}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6271
    using k by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6272
  ultimately show ?thesis by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6273
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6274
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6275
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6276
subsection \<open>Integrability on subintervals.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6277
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6278
lemma operative_integrable:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6279
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6280
  shows "operative op \<and> (\<lambda>i. f integrable_on i)"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6281
  unfolding operative_def neutral_and
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6282
  apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6283
  apply (subst integrable_on_def)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6284
  unfolding has_integral_null_eq
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6285
  apply (rule, rule refl)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6286
  apply (rule, assumption, assumption)+
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6287
  unfolding integrable_on_def
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6288
  by (auto intro!: has_integral_split)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6289
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6290
lemma integrable_subinterval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6291
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6292
  assumes "f integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6293
    and "cbox c d \<subseteq> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6294
  shows "f integrable_on cbox c d"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6295
  apply (cases "cbox c d = {}")
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6296
  defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6297
  apply (rule partial_division_extend_1[OF assms(2)],assumption)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6298
  using operative_division_and[OF operative_integrable,symmetric,of _ _ _ f] assms(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6299
  apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6300
  done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6301
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6302
lemma integrable_subinterval_real:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6303
  fixes f :: "real \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6304
  assumes "f integrable_on {a .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6305
    and "{c .. d} \<subseteq> {a .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6306
  shows "f integrable_on {c .. d}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6307
  by (metis assms(1) assms(2) box_real(2) integrable_subinterval)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6308
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6309
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6310
subsection \<open>Combining adjacent intervals in 1 dimension.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6311
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6312
lemma has_integral_combine:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6313
  fixes a b c :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6314
  assumes "a \<le> c"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6315
    and "c \<le> b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6316
    and "(f has_integral i) {a .. c}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6317
    and "(f has_integral (j::'a::banach)) {c .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6318
  shows "(f has_integral (i + j)) {a .. b}"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6319
proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6320
  note operative_integral[of f, unfolded operative_1_le[OF monoidal_lifted[OF monoidal_monoid]]]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6321
  note conjunctD2[OF this,rule_format]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6322
  note * = this(2)[OF conjI[OF assms(1-2)],unfolded if_P[OF assms(3)]]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6323
  then have "f integrable_on cbox a b"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6324
    apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6325
    apply (rule ccontr)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6326
    apply (subst(asm) if_P)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6327
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6328
    apply (subst(asm) if_P)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6329
    using assms(3-)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6330
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6331
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6332
  with *
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6333
  show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6334
    apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6335
    apply (subst(asm) if_P)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6336
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6337
    apply (subst(asm) if_P)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6338
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6339
    apply (subst(asm) if_P)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6340
    unfolding lifted.simps
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6341
    using assms(3-)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6342
    apply (auto simp add: integrable_on_def integral_unique)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6343
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6344
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6345
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6346
lemma integral_combine:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6347
  fixes f :: "real \<Rightarrow> 'a::banach"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6348
  assumes "a \<le> c"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6349
    and "c \<le> b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6350
    and "f integrable_on {a .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6351
  shows "integral {a .. c} f + integral {c .. b} f = integral {a .. b} f"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6352
  apply (rule integral_unique[symmetric])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6353
  apply (rule has_integral_combine[OF assms(1-2)])
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6354
  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
  6355
  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
  6356
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6357
lemma integrable_combine:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6358
  fixes f :: "real \<Rightarrow> 'a::banach"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6359
  assumes "a \<le> c"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6360
    and "c \<le> b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6361
    and "f integrable_on {a .. c}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6362
    and "f integrable_on {c .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6363
  shows "f integrable_on {a .. b}"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6364
  using assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6365
  unfolding integrable_on_def
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6366
  by (fastforce intro!:has_integral_combine)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6367
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6368
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6369
subsection \<open>Reduce integrability to "local" integrability.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6370
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6371
lemma integrable_on_little_subintervals:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6372
  fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6373
  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
  6374
    f integrable_on cbox u v"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6375
  shows "f integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6376
proof -
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6377
  have "\<forall>x. \<exists>d. x\<in>cbox a b \<longrightarrow> d>0 \<and> (\<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
  6378
    f integrable_on cbox u v)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6379
    using assms by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6380
  note this[unfolded gauge_existence_lemma]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6381
  from choice[OF this] guess d .. note d=this[rule_format]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6382
  guess p
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6383
    apply (rule fine_division_exists[OF gauge_ball_dependent,of d a b])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6384
    using d
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6385
    by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6386
  note p=this(1-2)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6387
  note division_of_tagged_division[OF this(1)]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6388
  note * = operative_division_and[OF operative_integrable,OF this,symmetric,of f]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6389
  show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6390
    unfolding *
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6391
    apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6392
    unfolding snd_conv
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6393
  proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6394
    fix x k
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6395
    assume "(x, k) \<in> p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6396
    note tagged_division_ofD(2-4)[OF p(1) this] fineD[OF p(2) this]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6397
    then show "f integrable_on k"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6398
      apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6399
      apply (rule d[THEN conjunct2,rule_format,of x])
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  6400
      apply (auto intro: order.trans)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6401
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6402
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6403
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6404
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6405
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6406
subsection \<open>Second FCT or existence of antiderivative.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6407
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6408
lemma integrable_const[intro]: "(\<lambda>x. c) integrable_on cbox a b"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6409
  unfolding integrable_on_def
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6410
  apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6411
  apply (rule has_integral_const)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6412
  done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6413
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6414
lemma integral_has_vector_derivative_continuous_at:
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6415
  fixes f :: "real \<Rightarrow> 'a::banach"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6416
  assumes f: "f integrable_on {a..b}"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6417
      and x: "x \<in> {a..b}"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6418
      and fx: "continuous (at x within {a..b}) f"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6419
  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
  6420
proof -
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6421
  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
  6422
  { fix e::real
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6423
    assume "e > 0"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6424
    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
  6425
      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
  6426
    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
  6427
           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
  6428
    proof (cases "y < x")
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6429
      case False
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6430
      have "f integrable_on {a..y}"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6431
        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
  6432
      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
  6433
        using False x by (simp add: algebra_simps integral_combine)
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6434
      have fux_int: "((\<lambda>u. f u - f x) has_integral integral {x..y} f - (y - x) *\<^sub>R f x) {x..y}"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6435
        apply (rule has_integral_sub)
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6436
        using x y apply (force intro: integrable_integral [OF integrable_subinterval_real [OF f]])
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6437
        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
  6438
        apply (simp add: )
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6439
        done
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6440
      show ?thesis
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6441
        using False
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6442
        apply (simp add: abs_eq_content del: content_real_if)
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6443
        apply (rule has_integral_bound_real[where f="(\<lambda>u. f u - f x)"])
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  6444
        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
  6445
        done
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6446
    next
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6447
      case True
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6448
      have "f integrable_on {a..x}"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6449
        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
  6450
      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
  6451
        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
  6452
      have fux_int: "((\<lambda>u. f u - f x) has_integral integral {y..x} f - (x - y) *\<^sub>R f x) {y..x}"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6453
        apply (rule has_integral_sub)
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6454
        using x y apply (force intro: integrable_integral [OF integrable_subinterval_real [OF f]])
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6455
        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
  6456
        apply (simp add: )
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6457
        done
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6458
      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
  6459
        using True
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6460
        apply (simp add: abs_eq_content del: content_real_if)
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6461
        apply (rule has_integral_bound_real[where f="(\<lambda>u. f u - f x)"])
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
  6462
        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
  6463
        done
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6464
      then show ?thesis
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6465
        by (simp add: algebra_simps norm_minus_commute)
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6466
    qed
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6467
    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
  6468
      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
  6469
  }
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6470
  then show ?thesis
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6471
    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
  6472
qed
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6473
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6474
lemma integral_has_vector_derivative:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6475
  fixes f :: "real \<Rightarrow> 'a::banach"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6476
  assumes "continuous_on {a .. b} f"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6477
    and "x \<in> {a .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6478
  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
  6479
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
  6480
using assms
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6481
apply (auto simp: continuous_on_eq_continuous_within)
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61167
diff changeset
  6482
done
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6483
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6484
lemma antiderivative_continuous:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6485
  fixes q b :: real
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6486
  assumes "continuous_on {a .. b} f"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6487
  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
  6488
  apply (rule that)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6489
  apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6490
  using integral_has_vector_derivative[OF assms]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6491
  apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6492
  done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6493
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6494
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6495
subsection \<open>Combined fundamental theorem of calculus.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6496
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6497
lemma antiderivative_integral_continuous:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6498
  fixes f :: "real \<Rightarrow> 'a::banach"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6499
  assumes "continuous_on {a .. b} f"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6500
  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
  6501
proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6502
  from antiderivative_continuous[OF assms] guess g . note g=this
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6503
  show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6504
    apply (rule that[of g])
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6505
    apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  6506
  proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  6507
    case prems: (1 u v)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6508
    have "\<forall>x\<in>cbox u v. (g has_vector_derivative f x) (at x within cbox u v)"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6509
      apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6510
      apply (rule has_vector_derivative_within_subset)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6511
      apply (rule g[rule_format])
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  6512
      using prems(1,2)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6513
      apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6514
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6515
    then show ?case
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  6516
      using fundamental_theorem_of_calculus[OF prems(3), of g f] by auto
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6517
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6518
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6519
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6520
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6521
subsection \<open>General "twiddling" for interval-to-interval function image.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6522
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6523
lemma has_integral_twiddle:
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6524
  assumes "0 < r"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6525
    and "\<forall>x. h(g x) = x"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6526
    and "\<forall>x. g(h x) = x"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6527
    and "\<forall>x. continuous (at x) g"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6528
    and "\<forall>u v. \<exists>w z. g ` cbox u v = cbox w z"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6529
    and "\<forall>u v. \<exists>w z. h ` cbox u v = cbox w z"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6530
    and "\<forall>u v. content(g ` cbox u v) = r * content (cbox u v)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6531
    and "(f has_integral i) (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6532
  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
  6533
proof -
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6534
  show ?thesis when *: "cbox a b \<noteq> {} \<Longrightarrow> ?thesis"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6535
    apply cases
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6536
    defer
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6537
    apply (rule *)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6538
    apply assumption
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  6539
  proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  6540
    case prems: 1
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6541
    then show ?thesis
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  6542
      unfolding prems assms(8)[unfolded prems has_integral_empty_eq] by auto
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6543
  qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6544
  assume "cbox a b \<noteq> {}"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6545
  from assms(6)[rule_format,of a b] guess w z by (elim exE) note wz=this
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6546
  have inj: "inj g" "inj h"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6547
    unfolding inj_on_def
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6548
    apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6549
    apply(rule_tac[!] ccontr)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6550
    using assms(2)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6551
    apply(erule_tac x=x in allE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6552
    using assms(2)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6553
    apply(erule_tac x=y in allE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6554
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6555
    using assms(3)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6556
    apply (erule_tac x=x in allE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6557
    using assms(3)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6558
    apply(erule_tac x=y in allE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6559
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6560
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6561
  show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6562
    unfolding has_integral_def has_integral_compact_interval_def
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6563
    apply (subst if_P)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6564
    apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6565
    apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6566
    apply (rule wz)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6567
  proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6568
    fix e :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6569
    assume e: "e > 0"
56544
b60d5d119489 made mult_pos_pos a simp rule
nipkow
parents: 56541
diff changeset
  6570
    with assms(1) have "e * r > 0" by simp
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6571
    from assms(8)[unfolded has_integral,rule_format,OF this] guess d by (elim exE conjE) note d=this[rule_format]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6572
    def d' \<equiv> "\<lambda>x. {y. g y \<in> d (g x)}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6573
    have d': "\<And>x. d' x = {y. g y \<in> (d (g x))}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6574
      unfolding d'_def ..
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6575
    show "\<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of h ` cbox a b \<and> d fine p \<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
  6576
    proof (rule_tac x=d' in exI, safe)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6577
      show "gauge d'"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6578
        using d(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6579
        unfolding gauge_def d'
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6580
        using continuous_open_preimage_univ[OF assms(4)]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6581
        by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6582
      fix p
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6583
      assume as: "p tagged_division_of h ` cbox a b" "d' fine p"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6584
      note p = tagged_division_ofD[OF as(1)]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6585
      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
  6586
        unfolding tagged_division_of
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6587
      proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6588
        show "finite ((\<lambda>(x, k). (g x, g ` k)) ` p)"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6589
          using as by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6590
        show "d fine (\<lambda>(x, k). (g x, g ` k)) ` p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6591
          using as(2) unfolding fine_def d' by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6592
        fix x k
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6593
        assume xk[intro]: "(x, k) \<in> p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6594
        show "g x \<in> g ` k"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6595
          using p(2)[OF xk] by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6596
        show "\<exists>u v. g ` k = cbox u v"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6597
          using p(4)[OF xk] using assms(5-6) by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6598
        {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6599
          fix y
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6600
          assume "y \<in> k"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6601
          then show "g y \<in> cbox a b" "g y \<in> cbox a b"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6602
            using p(3)[OF xk,unfolded subset_eq,rule_format,of "h (g y)"]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6603
            using assms(2)[rule_format,of y]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6604
            unfolding inj_image_mem_iff[OF inj(2)]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6605
            by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6606
        }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6607
        fix x' k'
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6608
        assume xk': "(x', k') \<in> p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6609
        fix z
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6610
        assume "z \<in> interior (g ` k)" and "z \<in> interior (g ` k')"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6611
        then have *: "interior (g ` k) \<inter> interior (g ` k') \<noteq> {}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6612
          by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6613
        have same: "(x, k) = (x', k')"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6614
          apply -
53842
b98c6cd90230 tuned proofs;
wenzelm
parents: 53638
diff changeset
  6615
          apply (rule ccontr)
b98c6cd90230 tuned proofs;
wenzelm
parents: 53638
diff changeset
  6616
          apply (drule p(5)[OF xk xk'])
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6617
        proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6618
          assume as: "interior k \<inter> interior k' = {}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6619
          from nonempty_witness[OF *] guess z .
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6620
          then have "z \<in> g ` (interior k \<inter> interior k')"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6621
            using interior_image_subset[OF assms(4) inj(1)]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6622
            unfolding image_Int[OF inj(1)]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6623
            by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6624
          then show False
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6625
            using as by blast
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6626
        qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6627
        then show "g x = g x'"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6628
          by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6629
        {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6630
          fix z
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6631
          assume "z \<in> k"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6632
          then show "g z \<in> g ` k'"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6633
            using same by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6634
        }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6635
        {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6636
          fix z
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6637
          assume "z \<in> k'"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6638
          then show "g z \<in> g ` k"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6639
            using same by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6640
        }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6641
      next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6642
        fix x
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6643
        assume "x \<in> cbox a b"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6644
        then have "h x \<in>  \<Union>{k. \<exists>x. (x, k) \<in> p}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6645
          using p(6) by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6646
        then guess X unfolding Union_iff .. note X=this
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6647
        from this(1) guess y unfolding mem_Collect_eq ..
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6648
        then show "x \<in> \<Union>{k. \<exists>x. (x, k) \<in> (\<lambda>(x, k). (g x, g ` k)) ` p}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6649
          apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6650
          apply (rule_tac X="g ` X" in UnionI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6651
          defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6652
          apply (rule_tac x="h x" in image_eqI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6653
          using X(2) assms(3)[rule_format,of x]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6654
          apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6655
          done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6656
      qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6657
        note ** = d(2)[OF this]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6658
        have *: "inj_on (\<lambda>(x, k). (g x, g ` k)) p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6659
          using inj(1) unfolding inj_on_def by fastforce
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6660
        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
  6661
          using assms(7)
7edb7550663e introduce more powerful reindexing rules for big operators
hoelzl
parents: 56544
diff changeset
  6662
          unfolding algebra_simps add_left_cancel scaleR_right.setsum
7edb7550663e introduce more powerful reindexing rules for big operators
hoelzl
parents: 56544
diff changeset
  6663
          by (subst setsum.reindex_bij_betw[symmetric, where h="\<lambda>(x, k). (g x, g ` k)" and S=p])
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  6664
             (auto intro!: * setsum.cong simp: bij_betw_def dest!: p(4))
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6665
      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
  6666
        unfolding scaleR_diff_right scaleR_scaleR
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6667
        using assms(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6668
        by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6669
      finally have *: "?l = ?r" .
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6670
      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
  6671
        using **
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6672
        unfolding *
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6673
        unfolding norm_scaleR
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6674
        using assms(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6675
        by (auto simp add:field_simps)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6676
    qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6677
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6678
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6679
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6680
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6681
subsection \<open>Special case of a basic affine transformation.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6682
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6683
lemma interval_image_affinity_interval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6684
  "\<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
  6685
  unfolding image_affinity_cbox
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6686
  by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6687
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6688
lemma content_image_affinity_cbox:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6689
  "content((\<lambda>x::'a::euclidean_space. m *\<^sub>R x + c) ` cbox a b) =
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6690
    abs m ^ DIM('a) * content (cbox a b)" (is "?l = ?r")
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6691
proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6692
  {
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6693
    presume *: "cbox a b \<noteq> {} \<Longrightarrow> ?thesis"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6694
    show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6695
      apply cases
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6696
      apply (rule *)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6697
      apply assumption
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6698
      unfolding not_not
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6699
      using content_empty
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6700
      apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6701
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6702
  }
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6703
  assume as: "cbox a b \<noteq> {}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  6704
  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
  6705
  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
  6706
    case True
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6707
    with as have "cbox (m *\<^sub>R a + c) (m *\<^sub>R b + c) \<noteq> {}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6708
      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
  6709
      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
  6710
      apply (erule_tac x=i in ballE)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  6711
      apply (auto simp: inner_simps intro!: mult_left_mono)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  6712
      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
  6713
    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
  6714
      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
  6715
    ultimately show ?thesis
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6716
      by (simp add: image_affinity_cbox True content_cbox'
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  6717
        setprod.distrib setprod_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
  6718
  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
  6719
    case False
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6720
    with as have "cbox (m *\<^sub>R b + c) (m *\<^sub>R a + c) \<noteq> {}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6721
      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
  6722
      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
  6723
      apply (erule_tac x=i in ballE)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  6724
      apply (auto simp: inner_simps intro!: mult_left_mono)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  6725
      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
  6726
    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
  6727
      by (simp add: inner_simps field_simps)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  6728
    ultimately show ?thesis using False
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6729
      by (simp add: image_affinity_cbox content_cbox'
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  6730
        setprod.distrib[symmetric] setprod_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
  6731
  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
  6732
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6733
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6734
lemma has_integral_affinity:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6735
  fixes a :: "'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6736
  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
  6737
      and "m \<noteq> 0"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6738
  shows "((\<lambda>x. f(m *\<^sub>R x + c)) has_integral ((1 / (abs(m) ^ 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
  6739
  apply (rule has_integral_twiddle)
60800
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6740
  using assms
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6741
  apply (safe intro!: interval_image_affinity_interval content_image_affinity_cbox)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6742
  apply (rule zero_less_power)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  6743
  unfolding scaleR_right_distrib
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6744
  apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6745
  done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6746
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6747
lemma integrable_affinity:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6748
  assumes "f integrable_on cbox a b"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6749
    and "m \<noteq> 0"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6750
  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
  6751
  using assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6752
  unfolding integrable_on_def
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6753
  apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6754
  apply (drule has_integral_affinity)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6755
  apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6756
  done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6757
60800
7d04351c795a New material for Cauchy's integral theorem
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6758
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
  6759
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6760
subsection \<open>Special case of stretching coordinate axes separately.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6761
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6762
lemma image_stretch_interval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6763
  "(\<lambda>x. \<Sum>k\<in>Basis. (m k * (x\<bullet>k)) *\<^sub>R k) ` cbox a (b::'a::euclidean_space) =
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6764
  (if (cbox a b) = {} then {} else
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6765
    cbox (\<Sum>k\<in>Basis. (min (m k * (a\<bullet>k)) (m k * (b\<bullet>k))) *\<^sub>R k::'a)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6766
     (\<Sum>k\<in>Basis. (max (m k * (a\<bullet>k)) (m k * (b\<bullet>k))) *\<^sub>R 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
  6767
proof cases
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6768
  assume *: "cbox a b \<noteq> {}"
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
  6769
  show ?thesis
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6770
    unfolding box_ne_empty if_not_P[OF *]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6771
    apply (simp add: cbox_def image_Collect set_eq_iff euclidean_eq_iff[where 'a='a] ball_conj_distrib[symmetric])
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
  6772
    apply (subst choice_Basis_iff[symmetric])
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  6773
  proof (intro allI ball_cong refl)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  6774
    fix x i :: 'a assume "i \<in> Basis"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  6775
    with * have a_le_b: "a \<bullet> i \<le> b \<bullet> i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6776
      unfolding box_ne_empty 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
  6777
    show "(\<exists>xa. x \<bullet> i = m i * xa \<and> a \<bullet> i \<le> xa \<and> xa \<le> b \<bullet> i) \<longleftrightarrow>
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  6778
        min (m i * (a \<bullet> i)) (m i * (b \<bullet> i)) \<le> x \<bullet> i \<and> x \<bullet> i \<le> max (m i * (a \<bullet> i)) (m i * (b \<bullet> i))"
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  6779
    proof (cases "m i = 0")
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  6780
      case True
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  6781
      with a_le_b show ?thesis by auto
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  6782
    next
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  6783
      case False
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  6784
      then have *: "\<And>a b. a = m i * b \<longleftrightarrow> b = a / m 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
  6785
        by (auto simp add: field_simps)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  6786
      from False have
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
  6787
          "min (m i * (a \<bullet> i)) (m i * (b \<bullet> i)) = (if 0 < m i then m i * (a \<bullet> i) else m i * (b \<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
  6788
          "max (m i * (a \<bullet> i)) (m i * (b \<bullet> i)) = (if 0 < m i then m i * (b \<bullet> i) else m i * (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
  6789
        using a_le_b by (auto simp: min_def max_def mult_le_cancel_left)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  6790
      with False show ?thesis using a_le_b
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  6791
        unfolding * by (auto simp add: le_divide_eq divide_le_eq ac_simps)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  6792
    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
  6793
  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
  6794
qed 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
  6795
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  6796
lemma interval_image_stretch_interval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6797
  "\<exists>u v. (\<lambda>x. \<Sum>k\<in>Basis. (m k * (x\<bullet>k))*\<^sub>R k) ` cbox a (b::'a::euclidean_space) = cbox u (v::'a::euclidean_space)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  6798
  unfolding image_stretch_interval by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6799
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6800
lemma content_image_stretch_interval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6801
  "content ((\<lambda>x::'a::euclidean_space. (\<Sum>k\<in>Basis. (m k * (x\<bullet>k))*\<^sub>R k)::'a) ` cbox a b) =
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6802
    abs (setprod m Basis) * content (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6803
proof (cases "cbox a b = {}")
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6804
  case True
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6805
  then show ?thesis
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6806
    unfolding content_def image_is_empty image_stretch_interval if_P[OF True] by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6807
next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6808
  case False
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6809
  then have "(\<lambda>x. (\<Sum>k\<in>Basis. (m k * (x\<bullet>k))*\<^sub>R k)) ` cbox a b \<noteq> {}"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6810
    by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6811
  then show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6812
    using False
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6813
    unfolding content_def image_stretch_interval
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6814
    apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6815
    unfolding interval_bounds' if_not_P
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  6816
    unfolding abs_setprod setprod.distrib[symmetric]
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  6817
    apply (rule setprod.cong)
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  6818
    apply (rule refl)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6819
    unfolding lessThan_iff
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6820
    apply (simp only: inner_setsum_left_Basis)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6821
  proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6822
    fix i :: 'a
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6823
    assume i: "i \<in> Basis"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6824
    have "(m i < 0 \<or> m i > 0) \<or> m i = 0"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6825
      by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6826
    then show "max (m i * (a \<bullet> i)) (m i * (b \<bullet> i)) - min (m i * (a \<bullet> i)) (m i * (b \<bullet> i)) =
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6827
      \<bar>m i\<bar> * (b \<bullet> i - a \<bullet> i)"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6828
      apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6829
      apply (erule disjE)+
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6830
      unfolding min_def max_def
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6831
      using False[unfolded box_ne_empty,rule_format,of i] i
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6832
      apply (auto simp add:field_simps not_le mult_le_cancel_left_neg mult_le_cancel_left_pos)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6833
      done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6834
  qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6835
qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6836
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6837
lemma has_integral_stretch:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6838
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6839
  assumes "(f has_integral i) (cbox a b)"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6840
    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
  6841
  shows "((\<lambda>x. f (\<Sum>k\<in>Basis. (m k * (x\<bullet>k))*\<^sub>R k)) has_integral
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6842
    ((1/(abs(setprod m Basis))) *\<^sub>R i)) ((\<lambda>x. (\<Sum>k\<in>Basis. (1 / m k * (x\<bullet>k))*\<^sub>R k)) ` cbox a b)"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6843
  apply (rule has_integral_twiddle[where f=f])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6844
  unfolding zero_less_abs_iff content_image_stretch_interval
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6845
  unfolding image_stretch_interval empty_as_interval euclidean_eq_iff[where 'a='a]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6846
  using assms
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6847
proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6848
  show "\<forall>y::'a. continuous (at y) (\<lambda>x. (\<Sum>k\<in>Basis. (m k * (x\<bullet>k))*\<^sub>R k))"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6849
    apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6850
    apply (rule linear_continuous_at)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6851
    unfolding linear_linear
53600
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53597
diff changeset
  6852
    unfolding linear_iff inner_simps euclidean_eq_iff[where 'a='a]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6853
    apply (auto simp add: field_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6854
    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
  6855
qed 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
  6856
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6857
lemma integrable_stretch:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6858
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6859
  assumes "f integrable_on cbox a b"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6860
    and "\<forall>k\<in>Basis. m k \<noteq> 0"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6861
  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
  6862
    ((\<lambda>x. \<Sum>k\<in>Basis. (1 / m k * (x\<bullet>k))*\<^sub>R k) ` cbox a b)"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6863
  using assms
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6864
  unfolding integrable_on_def
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6865
  apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6866
  apply (erule exE)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6867
  apply (drule has_integral_stretch)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6868
  apply assumption
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6869
  apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6870
  done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6871
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6872
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6873
subsection \<open>even more special cases.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6874
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6875
lemma uminus_interval_vector[simp]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6876
  fixes a b :: "'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6877
  shows "uminus ` cbox a b = cbox (-b) (-a)"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6878
  apply (rule set_eqI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6879
  apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6880
  defer
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6881
  unfolding image_iff
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6882
  apply (rule_tac x="-x" in bexI)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6883
  apply (auto simp add:minus_le_iff le_minus_iff mem_box)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6884
  done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6885
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6886
lemma has_integral_reflect_lemma[intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6887
  assumes "(f has_integral i) (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6888
  shows "((\<lambda>x. f(-x)) has_integral i) (cbox (-b) (-a))"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6889
  using has_integral_affinity[OF assms, of "-1" 0]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6890
  by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6891
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6892
lemma has_integral_reflect_lemma_real[intro]:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6893
  assumes "(f has_integral i) {a .. b::real}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6894
  shows "((\<lambda>x. f(-x)) has_integral i) {-b .. -a}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6895
  using assms
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6896
  unfolding box_real[symmetric]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6897
  by (rule has_integral_reflect_lemma)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6898
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6899
lemma has_integral_reflect[simp]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6900
  "((\<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
  6901
  apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6902
  apply (drule_tac[!] has_integral_reflect_lemma)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6903
  apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6904
  done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6905
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6906
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
  6907
  unfolding integrable_on_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6908
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6909
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
  6910
  unfolding box_real[symmetric]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6911
  by (rule integrable_reflect)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6912
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6913
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
  6914
  unfolding integral_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6915
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6916
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
  6917
  unfolding box_real[symmetric]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6918
  by (rule integral_reflect)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6919
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6920
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6921
subsection \<open>Stronger form of FCT; quite a tedious proof.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6922
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6923
lemma bgauge_existence_lemma: "(\<forall>x\<in>s. \<exists>d::real. 0 < d \<and> q d x) \<longleftrightarrow> (\<forall>x. \<exists>d>0. x\<in>s \<longrightarrow> q d x)"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6924
  by (meson zero_less_one)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6925
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6926
lemma additive_tagged_division_1':
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6927
  fixes f :: "real \<Rightarrow> 'a::real_normed_vector"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6928
  assumes "a \<le> b"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6929
    and "p tagged_division_of {a..b}"
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  6930
  shows "setsum (\<lambda>(x,k). f (Sup k) - f(Inf k)) p = f b - f a"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6931
  using additive_tagged_division_1[OF _ assms(2), of f]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6932
  using assms(1)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6933
  by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6934
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6935
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
  6936
  by (simp add: split_def)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6937
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6938
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
  6939
  apply (subst(asm)(2) norm_minus_cancel[symmetric])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6940
  apply (drule norm_triangle_le)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6941
  apply (auto simp add: algebra_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6942
  done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6943
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6944
lemma fundamental_theorem_of_calculus_interior:
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6945
  fixes f :: "real \<Rightarrow> 'a::real_normed_vector"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6946
  assumes "a \<le> b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6947
    and "continuous_on {a .. b} f"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6948
    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
  6949
  shows "(f' has_integral (f b - f a)) {a .. b}"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6950
proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6951
  {
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6952
    presume *: "a < b \<Longrightarrow> ?thesis"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6953
    show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6954
    proof (cases "a < b")
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6955
      case True
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6956
      then show ?thesis by (rule *)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6957
    next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6958
      case False
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6959
      then have "a = b"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6960
        using assms(1) by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6961
      then have *: "cbox a b = {b}" "f b - f a = 0"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6962
        by (auto simp add:  order_antisym)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6963
      show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6964
        unfolding *(2)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6965
        unfolding content_eq_0
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  6966
        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
  6967
        by (auto simp: ex_in_conv)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6968
    qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6969
  }
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6970
  assume ab: "a < b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6971
  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
  6972
    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
  6973
  { 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
  6974
  fix e :: real
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6975
  assume e: "e > 0"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6976
  note assms(3)[unfolded has_vector_derivative_def has_derivative_at_alt ball_conj_distrib]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6977
  note conjunctD2[OF this]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6978
  note bounded=this(1) and this(2)
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  6979
  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
  6980
    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
  6981
    apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6982
    apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6983
    apply (erule_tac x=x in ballE)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6984
    apply (erule_tac x="e/2" in allE)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6985
    using e
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6986
    apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6987
    done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6988
  note this[unfolded bgauge_existence_lemma]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6989
  from choice[OF this] guess d ..
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6990
  note conjunctD2[OF this[rule_format]]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6991
  note d = this[rule_format]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6992
  have "bounded (f ` cbox a b)"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6993
    apply (rule compact_imp_bounded compact_continuous_image)+
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6994
    using compact_cbox assms
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6995
    apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  6996
    done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6997
  from this[unfolded bounded_pos] guess B .. note B = this[rule_format]
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6998
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  6999
  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
  7000
    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
  7001
  proof -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7002
    have "a \<in> {a .. b}"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7003
      using ab by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7004
    note assms(2)[unfolded continuous_on_eq_continuous_within,rule_format,OF this]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7005
    note * = this[unfolded continuous_within Lim_within,rule_format]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7006
    have "(e * (b - a)) / 8 > 0"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7007
      using e ab by (auto simp add: field_simps)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7008
    from *[OF this] guess k .. note k = conjunctD2[OF this,rule_format]
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7009
    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
  7010
    proof (cases "f' a = 0")
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7011
      case True
56536
aefb4a8da31f made mult_nonneg_nonneg a simp rule
nipkow
parents: 56381
diff changeset
  7012
      thus ?thesis using ab e by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7013
    next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7014
      case False
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7015
      then show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7016
        apply (rule_tac x="(e * (b - a)) / 8 / norm (f' a)" in exI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7017
        using ab e
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7018
        apply (auto simp add: field_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7019
        done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7020
    qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7021
    then guess l .. note l = conjunctD2[OF this]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7022
    show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7023
      apply (rule_tac x="min k l" in exI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7024
      apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7025
      unfolding min_less_iff_conj
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7026
      apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7027
      apply (rule l k)+
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7028
    proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7029
      fix c
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7030
      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
  7031
      note as' = this[unfolded subset_eq Ball_def mem_ball dist_real_def mem_box]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7032
      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
  7033
        by (rule norm_triangle_ineq4)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7034
      also have "\<dots> \<le> e * (b - a) / 8 + e * (b - a) / 8"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7035
      proof (rule add_mono)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7036
        have "\<bar>c - a\<bar> \<le> \<bar>l\<bar>"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7037
          using as' by auto
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7038
        then show "norm ((c - a) *\<^sub>R f' a) \<le> e * (b - a) / 8"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7039
          apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7040
          apply (rule order_trans[OF _ l(2)])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7041
          unfolding norm_scaleR
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7042
          apply (rule mult_right_mono)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7043
          apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7044
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7045
      next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7046
        show "norm (f c - f a) \<le> e * (b - a) / 8"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7047
          apply (rule less_imp_le)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7048
          apply (cases "a = c")
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7049
          defer
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7050
          apply (rule k(2)[unfolded dist_norm])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7051
          using as' e ab
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7052
          apply (auto simp add: field_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7053
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7054
      qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7055
      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
  7056
        unfolding content_real[OF as(1)] by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7057
    qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7058
  qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7059
  then guess da .. note da=conjunctD2[OF this,rule_format]
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7060
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7061
  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
  7062
    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
  7063
  proof -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7064
    have "b \<in> {a .. b}"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7065
      using ab by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7066
    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
  7067
    note * = this[unfolded continuous_within Lim_within,rule_format] have "(e * (b - a)) / 8 > 0"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7068
      using e ab by (auto simp add: field_simps)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7069
    from *[OF this] guess k .. note k = conjunctD2[OF this,rule_format]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7070
    have "\<exists>l. 0 < l \<and> norm (l *\<^sub>R f' b) \<le> (e * (b - a)) / 8"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7071
    proof (cases "f' b = 0")
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7072
      case True
56536
aefb4a8da31f made mult_nonneg_nonneg a simp rule
nipkow
parents: 56381
diff changeset
  7073
      thus ?thesis using ab e by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7074
    next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7075
      case False
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7076
      then show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7077
        apply (rule_tac x="(e * (b - a)) / 8 / norm (f' b)" in exI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7078
        using ab e
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7079
        apply (auto simp add: field_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7080
        done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7081
    qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7082
    then guess l .. note l = conjunctD2[OF this]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7083
    show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7084
      apply (rule_tac x="min k l" in exI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7085
      apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7086
      unfolding min_less_iff_conj
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7087
      apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7088
      apply (rule l k)+
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7089
    proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7090
      fix c
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7091
      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
  7092
      note as' = this[unfolded subset_eq Ball_def mem_ball dist_real_def mem_box]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7093
      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
  7094
        by (rule norm_triangle_ineq4)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7095
      also have "\<dots> \<le> e * (b - a) / 8 + e * (b - a) / 8"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7096
      proof (rule add_mono)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7097
        have "\<bar>c - b\<bar> \<le> \<bar>l\<bar>"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7098
          using as' by auto
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7099
        then show "norm ((b - c) *\<^sub>R f' b) \<le> e * (b - a) / 8"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7100
          apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7101
          apply (rule order_trans[OF _ l(2)])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7102
          unfolding norm_scaleR
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7103
          apply (rule mult_right_mono)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7104
          apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7105
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7106
      next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7107
        show "norm (f b - f c) \<le> e * (b - a) / 8"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7108
          apply (rule less_imp_le)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7109
          apply (cases "b = c")
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7110
          defer
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7111
          apply (subst norm_minus_commute)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7112
          apply (rule k(2)[unfolded dist_norm])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7113
          using as' e ab
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7114
          apply (auto simp add: field_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7115
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7116
      qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7117
      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
  7118
        unfolding content_real[OF as(1)] by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7119
    qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7120
  qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7121
  then guess db .. note db=conjunctD2[OF this,rule_format]
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7122
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  7123
  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
  7124
  show "?P e"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7125
    apply (rule_tac x="?d" in exI)
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  7126
  proof (safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7127
    case 1
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7128
    show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7129
      apply (rule gauge_ball_dependent)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7130
      using ab db(1) da(1) d(1)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7131
      apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7132
      done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7133
  next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7134
    case as: (2 p)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7135
    let ?A = "{t. fst t \<in> {a, b}}"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7136
    note p = tagged_division_ofD[OF as(1)]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7137
    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
  7138
      using as by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7139
    note * = additive_tagged_division_1'[OF assms(1) as(1), symmetric]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7140
    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
  7141
      by arith
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7142
    show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7143
      unfolding content_real[OF assms(1)] and *[of "\<lambda>x. x"] *[of f] setsum_subtractf[symmetric] split_minus
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7144
      unfolding setsum_right_distrib
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7145
      apply (subst(2) pA)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7146
      apply (subst pA)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  7147
      unfolding setsum.union_disjoint[OF pA(2-)]
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  7148
    proof (rule norm_triangle_le, rule **, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7149
      case 1
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7150
      show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7151
        apply (rule order_trans)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7152
        apply (rule setsum_norm_le)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7153
        defer
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7154
        apply (subst setsum_divide_distrib)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7155
        apply (rule order_refl)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7156
        apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7157
        apply (unfold not_le o_def split_conv fst_conv)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7158
      proof (rule ccontr)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7159
        fix x k
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7160
        assume xk: "(x, k) \<in> p"
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  7161
          "e * (Sup k -  Inf k) / 2 <
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  7162
            norm (content k *\<^sub>R f' x - (f (Sup k) - f (Inf k)))"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7163
        from p(4)[OF this(1)] guess u v by (elim exE) note k=this
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7164
        then have "u \<le> v" and uv: "{u, v} \<subseteq> cbox u v"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7165
          using p(2)[OF xk(1)] by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7166
        note result = xk(2)[unfolded k box_real interval_bounds_real[OF this(1)] content_real[OF this(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
  7167
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7168
        assume as': "x \<noteq> a" "x \<noteq> b"
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  7169
        then have "x \<in> box a b"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7170
          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
  7171
        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
  7172
        have "norm ((v - u) *\<^sub>R f' (x) - (f (v) - f (u))) =
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  7173
          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
  7174
          apply (rule arg_cong[of _ _ norm])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7175
          unfolding scaleR_left.diff
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7176
          apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7177
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7178
        also have "\<dots> \<le> e / 2 * norm (u - x) + e / 2 * norm (v - x)"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7179
          apply (rule norm_triangle_le_sub)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7180
          apply (rule add_mono)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7181
          apply (rule_tac[!] *)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7182
          using fineD[OF as(2) xk(1)] as'
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7183
          unfolding k subset_eq
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7184
          apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7185
          apply (erule_tac x=u in ballE)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7186
          apply (erule_tac[3] x=v in ballE)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7187
          using uv
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7188
          apply (auto simp:dist_real_def)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7189
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7190
        also have "\<dots> \<le> e / 2 * norm (v - u)"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7191
          using p(2)[OF xk(1)]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7192
          unfolding k
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7193
          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
  7194
        finally have "e * (v - u) / 2 < e * (v - u) / 2"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7195
          apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7196
          apply (rule less_le_trans[OF result])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7197
          using uv
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7198
          apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7199
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7200
        then show False by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7201
      qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7202
    next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7203
      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
  7204
        by auto
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7205
      case 2
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7206
      show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7207
        apply (rule *)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7208
        apply (rule setsum_nonneg)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7209
        apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7210
        apply (unfold split_paired_all split_conv)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7211
        defer
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  7212
        unfolding setsum.union_disjoint[OF pA(2-),symmetric] pA(1)[symmetric]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7213
        unfolding setsum_right_distrib[symmetric]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7214
        apply (subst additive_tagged_division_1[OF _ as(1)])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7215
        apply (rule assms)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7216
      proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7217
        fix x k
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7218
        assume "(x, k) \<in> p \<inter> {t. fst t \<in> {a, b}}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7219
        note xk=IntD1[OF this]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7220
        from p(4)[OF this] guess u v by (elim exE) note uv=this
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7221
        with p(2)[OF xk] have "cbox u v \<noteq> {}"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7222
          by auto
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  7223
        then show "0 \<le> e * ((Sup k) - (Inf k))"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7224
          unfolding uv using e by (auto simp add: field_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7225
      next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7226
        have *: "\<And>s f t e. setsum f s = setsum f t \<Longrightarrow> norm (setsum f t) \<le> e \<Longrightarrow> norm (setsum f s) \<le> e"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7227
          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
  7228
        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
  7229
          (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
  7230
          apply (rule *[where t1="p \<inter> {t. fst t \<in> {a, b} \<and> content(snd t) \<noteq> 0}"])
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  7231
          apply (rule setsum.mono_neutral_right[OF pA(2)])
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7232
          defer
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7233
          apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7234
          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
  7235
        proof goal_cases
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7236
          fix x k
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7237
          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
  7238
          then have xk: "(x, k) \<in> p" "content k = 0"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7239
            by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7240
          from p(4)[OF xk(1)] guess u v by (elim exE) note uv=this
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7241
          have "k \<noteq> {}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7242
            using p(2)[OF xk(1)] by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7243
          then have *: "u = v"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7244
            using xk
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7245
            unfolding uv content_eq_0 box_eq_empty
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7246
            by auto
54777
1a2da44c8e7d remove redundant constants
immler
parents: 54776
diff changeset
  7247
          then show "content k *\<^sub>R (f' (x)) - (f ((Sup k)) - f ((Inf k))) = 0"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7248
            using xk unfolding uv by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7249
        next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7250
          have *: "p \<inter> {t. fst t \<in> {a, b} \<and> content(snd t) \<noteq> 0} =
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7251
            {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
  7252
            by blast
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7253
          have **: "norm (setsum f s) \<le> e"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7254
            if "\<forall>x y. x \<in> s \<and> y \<in> s \<longrightarrow> x = y"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7255
            and "\<forall>x. x \<in> s \<longrightarrow> norm (f x) \<le> e"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7256
            and "e > 0"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7257
            for s f and e :: real
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7258
          proof (cases "s = {}")
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7259
            case True
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7260
            with that show ?thesis by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7261
          next
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7262
            case False
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7263
            then obtain x where "x \<in> s"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7264
              by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7265
            then have *: "s = {x}"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7266
              using that(1) by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7267
            then show ?thesis
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7268
              using \<open>x \<in> s\<close> that(2) by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7269
          qed
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7270
          case 2
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7271
          show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7272
            apply (subst *)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  7273
            apply (subst setsum.union_disjoint)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7274
            prefer 4
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7275
            apply (rule order_trans[of _ "e * (b - a)/4 + e * (b - a)/4"])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7276
            apply (rule norm_triangle_le,rule add_mono)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7277
            apply (rule_tac[1-2] **)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7278
          proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7279
            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
  7280
            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
  7281
            proof -
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7282
              guess u v using p(4)[OF that] by (elim exE) note uv=this
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7283
              have *: "u \<le> v"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7284
                using p(2)[OF that] unfolding uv by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7285
              have u: "u = a"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7286
              proof (rule ccontr)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7287
                have "u \<in> cbox u v"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7288
                  using p(2-3)[OF that(1)] unfolding uv by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7289
                have "u \<ge> a"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7290
                  using p(2-3)[OF that(1)] unfolding uv subset_eq by auto
53842
b98c6cd90230 tuned proofs;
wenzelm
parents: 53638
diff changeset
  7291
                moreover assume "\<not> ?thesis"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7292
                ultimately have "u > a" by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7293
                then show False
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7294
                  using p(2)[OF that(1)] unfolding uv by (auto simp add:)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7295
              qed
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7296
              then show ?thesis
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7297
                apply (rule_tac x=v in exI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7298
                unfolding uv
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7299
                using *
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7300
                apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7301
                done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7302
            qed
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7303
            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
  7304
            proof -
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7305
              guess u v using p(4)[OF that] by (elim exE) note uv=this
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7306
              have *: "u \<le> v"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7307
                using p(2)[OF that] unfolding uv by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7308
              have u: "v = b"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7309
              proof (rule ccontr)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7310
                have "u \<in> cbox u v"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7311
                  using p(2-3)[OF that(1)] unfolding uv by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7312
                have "v \<le> b"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7313
                  using p(2-3)[OF that(1)] unfolding uv subset_eq by auto
53842
b98c6cd90230 tuned proofs;
wenzelm
parents: 53638
diff changeset
  7314
                moreover assume "\<not> ?thesis"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7315
                ultimately have "v < b" by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7316
                then show False
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7317
                  using p(2)[OF that(1)] unfolding uv by (auto simp add:)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7318
              qed
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7319
              then show ?thesis
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7320
                apply (rule_tac x=u in exI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7321
                unfolding uv
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7322
                using *
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7323
                apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7324
                done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7325
            qed
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7326
            show "\<forall>x y. x \<in> ?B a \<and> y \<in> ?B a \<longrightarrow> x = y"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7327
              apply (rule,rule,rule,unfold split_paired_all)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7328
              unfolding mem_Collect_eq fst_conv snd_conv
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7329
              apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7330
            proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7331
              fix x k k'
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7332
              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
  7333
              guess v using pa[OF k(1)] .. note v = conjunctD2[OF this]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7334
              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
  7335
              have "box a ?v \<subseteq> k \<inter> k'"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7336
                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
  7337
              note interior_mono[OF this,unfolded interior_Int]
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  7338
              moreover have "(a + ?v)/2 \<in> box a ?v"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7339
                using k(3-)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7340
                unfolding v v' content_eq_0 not_le
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7341
                by (auto simp add: mem_box)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7342
              ultimately have "(a + ?v)/2 \<in> interior k \<inter> interior k'"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7343
                unfolding interior_open[OF open_box] by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7344
              then have *: "k = k'"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7345
                apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7346
                apply (rule ccontr)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7347
                using p(5)[OF k(1-2)]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7348
                apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7349
                done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7350
              { assume "x \<in> k" then show "x \<in> k'" unfolding * . }
53842
b98c6cd90230 tuned proofs;
wenzelm
parents: 53638
diff changeset
  7351
              { assume "x \<in> k'" then show "x \<in> k" unfolding * . }
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  7352
            qed
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7353
            show "\<forall>x y. x \<in> ?B b \<and> y \<in> ?B b \<longrightarrow> x = y"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7354
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7355
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7356
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7357
              apply (unfold split_paired_all)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7358
              unfolding mem_Collect_eq fst_conv snd_conv
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7359
              apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7360
            proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7361
              fix x k k'
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7362
              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
  7363
              guess v using pb[OF k(1)] .. note v = conjunctD2[OF this]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7364
              guess v' using pb[OF k(2)] .. note v' = conjunctD2[OF this]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7365
              let ?v = "max v v'"
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  7366
              have "box ?v b \<subseteq> k \<inter> k'"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7367
                unfolding v v' by (auto simp: mem_box)
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61424
diff changeset
  7368
                note interior_mono[OF this,unfolded interior_Int]
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  7369
              moreover have " ((b + ?v)/2) \<in> box ?v b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7370
                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
  7371
              ultimately have " ((b + ?v)/2) \<in> interior k \<inter> interior k'"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7372
                unfolding interior_open[OF open_box] by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7373
              then have *: "k = k'"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7374
                apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7375
                apply (rule ccontr)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7376
                using p(5)[OF k(1-2)]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7377
                apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7378
                done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7379
              { assume "x \<in> k" then show "x \<in> k'" unfolding * . }
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7380
              { assume "x \<in> k'" then show "x\<in>k" unfolding * . }
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7381
            qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7382
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7383
            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
  7384
            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
  7385
              f (Inf k))) x) \<le> e * (b - a) / 4"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7386
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7387
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7388
              unfolding mem_Collect_eq
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  7389
              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
  7390
            proof (safe, goal_cases)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  7391
              case prems: 1
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  7392
              guess v using pa[OF prems(1)] .. note v = conjunctD2[OF this]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7393
              have "?a \<in> {?a..v}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7394
                using v(2) by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7395
              then have "v \<le> ?b"
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  7396
                using p(3)[OF prems(1)] unfolding subset_eq v by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7397
              moreover have "{?a..v} \<subseteq> ball ?a da"
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  7398
                using fineD[OF as(2) prems(1)]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7399
                apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7400
                apply (subst(asm) if_P)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7401
                apply (rule refl)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7402
                unfolding subset_eq
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7403
                apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7404
                apply (erule_tac x=" x" in ballE)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7405
                apply (auto simp add:subset_eq dist_real_def v)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7406
                done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7407
              ultimately show ?case
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7408
                unfolding v interval_bounds_real[OF v(2)] box_real
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7409
                apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7410
                apply(rule da(2)[of "v"])
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  7411
                using prems fineD[OF as(2) prems(1)]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7412
                unfolding v content_eq_0
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7413
                apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7414
                done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7415
            qed
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7416
            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
  7417
              (f (Sup k) - f (Inf k))) x) \<le> e * (b - a) / 4"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7418
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7419
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7420
              unfolding mem_Collect_eq
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7421
              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
  7422
            proof (safe, goal_cases)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  7423
              case prems: 1
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  7424
              guess v using pb[OF prems(1)] .. note v = conjunctD2[OF this]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7425
              have "?b \<in> {v.. ?b}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7426
                using v(2) by auto
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  7427
              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
  7428
                unfolding subset_eq v by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7429
              moreover have "{v..?b} \<subseteq> ball ?b db"
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  7430
                using fineD[OF as(2) prems(1)]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7431
                apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7432
                apply (subst(asm) if_P, rule refl)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7433
                unfolding subset_eq
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7434
                apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7435
                apply (erule_tac x=" x" in ballE)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7436
                using ab
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7437
                apply (auto simp add:subset_eq v dist_real_def)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7438
                done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7439
              ultimately show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7440
                unfolding v
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7441
                unfolding interval_bounds_real[OF v(2)] box_real
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7442
                apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7443
                apply(rule db(2)[of "v"])
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  7444
                using prems fineD[OF as(2) prems(1)]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7445
                unfolding v content_eq_0
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7446
                apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7447
                done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7448
            qed
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7449
          qed (insert p(1) ab e, auto simp add: field_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7450
        qed auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7451
      qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7452
    qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7453
  qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7454
qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7455
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7456
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7457
subsection \<open>Stronger form with finite number of exceptional points.\<close>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7458
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7459
lemma fundamental_theorem_of_calculus_interior_strong:
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7460
  fixes f :: "real \<Rightarrow> 'a::banach"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7461
  assumes "finite s"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7462
    and "a \<le> b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7463
    and "continuous_on {a .. b} f"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7464
    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
  7465
  shows "(f' has_integral (f b - f a)) {a .. b}"
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7466
  using assms
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7467
proof (induct "card s" arbitrary: s a b)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7468
  case 0
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7469
  show ?case
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7470
    apply (rule fundamental_theorem_of_calculus_interior)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7471
    using 0
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7472
    apply auto
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7473
    done
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7474
next
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7475
  case (Suc n)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7476
  from this(2) guess c s'
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7477
    apply -
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7478
    apply (subst(asm) eq_commute)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7479
    unfolding card_Suc_eq
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7480
    apply (subst(asm)(2) eq_commute)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7481
    apply (elim exE conjE)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7482
    done
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7483
  note cs = this[rule_format]
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7484
  show ?case
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  7485
  proof (cases "c \<in> box a b")
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7486
    case False
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7487
    then show ?thesis
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7488
      apply -
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7489
      apply (rule Suc(1)[OF cs(3) _ Suc(4,5)])
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7490
      apply safe
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7491
      defer
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7492
      apply (rule Suc(6)[rule_format])
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7493
      using Suc(3)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7494
      unfolding cs
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7495
      apply auto
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7496
      done
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7497
  next
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7498
    have *: "f b - f a = (f c - f a) + (f b - f c)"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7499
      by auto
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7500
    case True
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7501
    then have "a \<le> c" "c \<le> b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7502
      by (auto simp: mem_box)
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7503
    then show ?thesis
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7504
      apply (subst *)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7505
      apply (rule has_integral_combine)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7506
      apply assumption+
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7507
      apply (rule_tac[!] Suc(1)[OF cs(3)])
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7508
      using Suc(3)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7509
      unfolding cs
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7510
    proof -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7511
      show "continuous_on {a .. c} f" "continuous_on {c .. b} f"
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7512
        apply (rule_tac[!] continuous_on_subset[OF Suc(5)])
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7513
        using True
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7514
        apply (auto simp: mem_box)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7515
        done
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7516
      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
  7517
      show "?P a c" "?P c b"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7518
        apply safe
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7519
        apply (rule_tac[!] Suc(6)[rule_format])
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7520
        using True
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7521
        unfolding cs
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7522
        apply (auto simp: mem_box)
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7523
        done
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7524
    qed auto
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7525
  qed
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7526
qed
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7527
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7528
lemma fundamental_theorem_of_calculus_strong:
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7529
  fixes f :: "real \<Rightarrow> 'a::banach"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7530
  assumes "finite s"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7531
    and "a \<le> b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7532
    and "continuous_on {a .. b} f"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7533
    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
  7534
  shows "(f' has_integral (f b - f a)) {a .. b}"
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7535
  apply (rule fundamental_theorem_of_calculus_interior_strong[OF assms(1-3), of f'])
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7536
  using assms(4)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7537
  apply (auto simp: mem_box)
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7538
  done
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7539
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  7540
lemma indefinite_integral_continuous_left:
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7541
  fixes f:: "real \<Rightarrow> 'a::banach"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7542
  assumes "f integrable_on {a .. b}"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7543
    and "a < c"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7544
    and "c \<le> b"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7545
    and "e > 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7546
  obtains d where "d > 0"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7547
    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
  7548
proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7549
  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
  7550
  proof (cases "f c = 0")
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7551
    case False
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7552
    hence "0 < e / 3 / norm (f c)" using \<open>e>0\<close> by simp
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7553
    then show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7554
      apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7555
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7556
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7557
      apply assumption
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7558
      apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7559
    proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7560
      fix t
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7561
      assume as: "t < c" and "c - e / 3 / norm (f c) < t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7562
      then have "c - t < e / 3 / norm (f c)"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7563
        by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7564
      then have "norm (c - t) < e / 3 / norm (f c)"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7565
        using as by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7566
      then show "norm (f c) * norm (c - t) < e / 3"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7567
        using False
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7568
        apply -
57512
cc97b347b301 reduced name variants for assoc and commute on plus and mult
haftmann
parents: 57447
diff changeset
  7569
        apply (subst mult.commute)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7570
        apply (subst pos_less_divide_eq[symmetric])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7571
        apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7572
        done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7573
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7574
  next
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7575
    case True
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7576
    show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7577
      apply (rule_tac x=1 in exI)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7578
      unfolding True
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7579
      using \<open>e > 0\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7580
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7581
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7582
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7583
  then guess w .. note w = conjunctD2[OF this,rule_format]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7584
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7585
  have *: "e / 3 > 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7586
    using assms by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7587
  have "f integrable_on {a .. c}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7588
    apply (rule integrable_subinterval_real[OF assms(1)])
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7589
    using assms(2-3)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7590
    apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7591
    done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7592
  from integrable_integral[OF this,unfolded has_integral_real,rule_format,OF *] guess d1 ..
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7593
  note d1 = conjunctD2[OF this,rule_format]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7594
  def d \<equiv> "\<lambda>x. ball x w \<inter> d1 x"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7595
  have "gauge d"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7596
    unfolding d_def using w(1) d1 by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7597
  note this[unfolded gauge_def,rule_format,of c]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7598
  note conjunctD2[OF this]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7599
  from this(2)[unfolded open_contains_ball,rule_format,OF this(1)] guess k ..
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7600
  note k=conjunctD2[OF this]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7601
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7602
  let ?d = "min k (c - a) / 2"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7603
  show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7604
    apply (rule that[of ?d])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7605
    apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7606
  proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7607
    show "?d > 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7608
      using k(1) using assms(2) by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7609
    fix t
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7610
    assume as: "c - ?d < t" "t \<le> c"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7611
    let ?thesis = "norm (integral ({a .. c}) f - integral ({a .. t}) f) < e"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7612
    {
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7613
      presume *: "t < c \<Longrightarrow> ?thesis"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7614
      show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7615
        apply (cases "t = c")
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7616
        defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7617
        apply (rule *)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7618
        apply (subst less_le)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7619
        using \<open>e > 0\<close> as(2)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7620
        apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7621
        done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7622
    }
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
  7623
    assume "t < c"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  7624
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7625
    have "f integrable_on {a .. t}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7626
      apply (rule integrable_subinterval_real[OF assms(1)])
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7627
      using assms(2-3) as(2)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7628
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7629
      done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7630
    from integrable_integral[OF this,unfolded has_integral_real,rule_format,OF *] guess d2 ..
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  7631
    note d2 = conjunctD2[OF this,rule_format]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  7632
    def d3 \<equiv> "\<lambda>x. if x \<le> t then d1 x \<inter> d2 x else d1 x"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7633
    have "gauge d3"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7634
      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
  7635
    from fine_division_exists_real[OF this, of a t] guess p . note p=this
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  7636
    note p'=tagged_division_ofD[OF this(1)]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7637
    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
  7638
    proof (safe, goal_cases)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  7639
      case prems: 1
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  7640
      from p'(2,3)[OF prems] show ?case
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7641
        by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7642
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7643
    with p(2) have "d2 fine p"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7644
      unfolding fine_def d3_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7645
      apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7646
      apply (erule_tac x="(a,b)" in ballE)+
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7647
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7648
      done
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  7649
    note d2_fin = d2(2)[OF conjI[OF p(1) this]]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  7650
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7651
    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
  7652
      using assms(2-3) as by (auto simp add: field_simps)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7653
    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
  7654
      apply rule
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7655
      apply (rule tagged_division_union_interval_real[of _ _ _ 1 "t"])
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7656
      unfolding *
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7657
      apply (rule p)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7658
      apply (rule tagged_division_of_self_real)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7659
      unfolding fine_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7660
      apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7661
    proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7662
      fix x k y
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7663
      assume "(x,k) \<in> p" and "y \<in> k"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7664
      then show "y \<in> d1 x"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7665
        using p(2) pt
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7666
        unfolding fine_def d3_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7667
        apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7668
        apply (erule_tac x="(x,k)" in ballE)+
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7669
        apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7670
        done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7671
    next
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7672
      fix x assume "x \<in> {t..c}"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7673
      then have "dist c x < k"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7674
        unfolding dist_real_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7675
        using as(1)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7676
        by (auto simp add: field_simps)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7677
      then show "x \<in> d1 c"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7678
        using k(2)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7679
        unfolding d_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7680
        by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7681
    qed (insert as(2), auto) note d1_fin = d1(2)[OF this]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7682
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7683
    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
  7684
      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
  7685
      "e = (e/3 + e/3) + e/3"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7686
      by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7687
    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
  7688
      (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
  7689
    proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7690
      have **: "\<And>x F. F \<union> {x} = insert x F"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7691
        by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7692
      have "(c, cbox t c) \<notin> p"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  7693
      proof (safe, goal_cases)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  7694
        case prems: 1
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  7695
        from p'(2-3)[OF prems] have "c \<in> cbox a t"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7696
          by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7697
        then show False using \<open>t < c\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7698
          by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7699
      qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7700
      then show ?thesis
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7701
        unfolding ** box_real
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7702
        apply -
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  7703
        apply (subst setsum.insert)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7704
        apply (rule p')
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7705
        unfolding split_conv
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7706
        defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7707
        apply (subst content_real)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7708
        using as(2)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7709
        apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7710
        done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7711
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7712
    have ***: "c - w < t \<and> t < c"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7713
    proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7714
      have "c - k < t"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7715
        using \<open>k>0\<close> as(1) by (auto simp add: field_simps)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7716
      moreover have "k \<le> w"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7717
        apply (rule ccontr)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7718
        using k(2)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7719
        unfolding subset_eq
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7720
        apply (erule_tac x="c + ((k + w)/2)" in ballE)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7721
        unfolding d_def
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7722
        using \<open>k > 0\<close> \<open>w > 0\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7723
        apply (auto simp add: field_simps not_le not_less dist_real_def)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7724
        done
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7725
      ultimately show ?thesis using \<open>t < c\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7726
        by (auto simp add: field_simps)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7727
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7728
    show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7729
      unfolding *(1)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7730
      apply (subst *(2))
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7731
      apply (rule norm_triangle_lt add_strict_mono)+
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7732
      unfolding norm_minus_cancel
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7733
      apply (rule d1_fin[unfolded **])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7734
      apply (rule d2_fin)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7735
      using w(2)[OF ***]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7736
      unfolding norm_scaleR
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7737
      apply (auto simp add: field_simps)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7738
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7739
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7740
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7741
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7742
lemma indefinite_integral_continuous_right:
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7743
  fixes f :: "real \<Rightarrow> 'a::banach"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7744
  assumes "f integrable_on {a .. b}"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7745
    and "a \<le> c"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7746
    and "c < b"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7747
    and "e > 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7748
  obtains d where "0 < d"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7749
    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
  7750
proof -
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7751
  have *: "(\<lambda>x. f (- x)) integrable_on {-b .. -a}" "- b < - c" "- c \<le> - a"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7752
    using assms by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7753
  from indefinite_integral_continuous_left[OF * \<open>e>0\<close>] guess d . note d = this
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7754
  let ?d = "min d (b - c)"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7755
  show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7756
    apply (rule that[of "?d"])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7757
    apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7758
  proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7759
    show "0 < ?d"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7760
      using d(1) assms(3) by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7761
    fix t :: real
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7762
    assume as: "c \<le> t" "t < c + ?d"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7763
    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
  7764
      "integral {a .. t} f = integral {a .. b} f - integral {t .. b} f"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7765
      unfolding algebra_simps
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7766
      apply (rule_tac[!] integral_combine)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7767
      using assms as
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7768
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7769
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7770
    have "(- c) - d < (- t) \<and> - t \<le> - c"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7771
      using as by auto note d(2)[rule_format,OF this]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7772
    then show "norm (integral {a .. c} f - integral {a .. t} f) < e"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7773
      unfolding *
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7774
      unfolding integral_reflect
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7775
      apply (subst norm_minus_commute)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7776
      apply (auto simp add: algebra_simps)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7777
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7778
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7779
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7780
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7781
lemma indefinite_integral_continuous:
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7782
  fixes f :: "real \<Rightarrow> 'a::banach"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7783
  assumes "f integrable_on {a .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7784
  shows "continuous_on {a .. b} (\<lambda>x. integral {a .. x} f)"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7785
proof (unfold continuous_on_iff, safe)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7786
  fix x e :: real
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7787
  assume as: "x \<in> {a .. b}" "e > 0"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7788
  let ?thesis = "\<exists>d>0. \<forall>x'\<in>{a .. b}. dist x' x < d \<longrightarrow> dist (integral {a .. x'} f) (integral {a .. x} f) < e"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7789
  {
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7790
    presume *: "a < b \<Longrightarrow> ?thesis"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7791
    show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7792
      apply cases
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7793
      apply (rule *)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7794
      apply assumption
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  7795
    proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7796
      case 1
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7797
      then have "cbox a b = {x}"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7798
        using as(1)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7799
        apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7800
        apply (rule set_eqI)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7801
        apply auto
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7802
        done
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7803
      then show ?case using \<open>e > 0\<close> by auto
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7804
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7805
  }
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7806
  assume "a < b"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7807
  have "(x = a \<or> x = b) \<or> (a < x \<and> x < b)"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7808
    using as(1) by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7809
  then show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7810
    apply (elim disjE)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7811
  proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7812
    assume "x = a"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7813
    have "a \<le> a" ..
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7814
    from indefinite_integral_continuous_right[OF assms(1) this \<open>a<b\<close> \<open>e>0\<close>] guess d . note d=this
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7815
    show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7816
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7817
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7818
      apply (rule d)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7819
      apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7820
      apply (subst dist_commute)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7821
      unfolding \<open>x = a\<close> dist_norm
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7822
      apply (rule d(2)[rule_format])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7823
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7824
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7825
  next
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7826
    assume "x = b"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7827
    have "b \<le> b" ..
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7828
    from indefinite_integral_continuous_left[OF assms(1) \<open>a<b\<close> this \<open>e>0\<close>] guess d . note d=this
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7829
    show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7830
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7831
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7832
      apply (rule d)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7833
      apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7834
      apply (subst dist_commute)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7835
      unfolding \<open>x = b\<close> dist_norm
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7836
      apply (rule d(2)[rule_format])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7837
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7838
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7839
  next
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7840
    assume "a < x \<and> x < b"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7841
    then have xl: "a < x" "x \<le> b" and xr: "a \<le> x" "x < b"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7842
      by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7843
    from indefinite_integral_continuous_left [OF assms(1) xl \<open>e>0\<close>] guess d1 . note d1=this
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7844
    from indefinite_integral_continuous_right[OF assms(1) xr \<open>e>0\<close>] guess d2 . note d2=this
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7845
    show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7846
      apply (rule_tac x="min d1 d2" in exI)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7847
    proof safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7848
      show "0 < min d1 d2"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7849
        using d1 d2 by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7850
      fix y
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7851
      assume "y \<in> {a .. b}" and "dist y x < min d1 d2"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7852
      then show "dist (integral {a .. y} f) (integral {a .. x} f) < e"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7853
        apply (subst dist_commute)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7854
        apply (cases "y < x")
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7855
        unfolding dist_norm
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7856
        apply (rule d1(2)[rule_format])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7857
        defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7858
        apply (rule d2(2)[rule_format])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7859
        unfolding not_less
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7860
        apply (auto simp add: field_simps)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7861
        done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7862
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7863
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7864
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7865
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  7866
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7867
subsection \<open>This doesn't directly involve integration, but that gives an easy proof.\<close>
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  7868
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7869
lemma has_derivative_zero_unique_strong_interval:
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7870
  fixes f :: "real \<Rightarrow> 'a::banach"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7871
  assumes "finite k"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7872
    and "continuous_on {a .. b} f"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7873
    and "f a = y"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7874
    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
  7875
  shows "f x = y"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7876
proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7877
  have ab: "a \<le> b"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7878
    using assms by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7879
  have *: "a \<le> x"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7880
    using assms(5) by auto
61076
bdc1e2f0a86a eliminated \<Colon>;
wenzelm
parents: 60867
diff changeset
  7881
  have "((\<lambda>x. 0::'a) has_integral f x - f a) {a .. x}"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7882
    apply (rule fundamental_theorem_of_calculus_interior_strong[OF assms(1) *])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7883
    apply (rule continuous_on_subset[OF assms(2)])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7884
    defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7885
    apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7886
    unfolding has_vector_derivative_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7887
    apply (subst has_derivative_within_open[symmetric])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7888
    apply assumption
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7889
    apply (rule open_greaterThanLessThan)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7890
    apply (rule has_derivative_within_subset[where s="{a .. b}"])
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7891
    using assms(4) assms(5)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7892
    apply (auto simp: mem_box)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7893
    done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7894
  note this[unfolded *]
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  7895
  note has_integral_unique[OF has_integral_0 this]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7896
  then show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7897
    unfolding assms by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7898
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7899
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  7900
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7901
subsection \<open>Generalize a bit to any convex set.\<close>
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  7902
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7903
lemma has_derivative_zero_unique_strong_convex:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7904
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7905
  assumes "convex s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7906
    and "finite k"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7907
    and "continuous_on s f"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7908
    and "c \<in> s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7909
    and "f c = y"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7910
    and "\<forall>x\<in>(s - k). (f has_derivative (\<lambda>h. 0)) (at x within s)"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7911
    and "x \<in> s"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  7912
  shows "f x = y"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7913
proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7914
  {
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7915
    presume *: "x \<noteq> c \<Longrightarrow> ?thesis"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7916
    show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7917
      apply cases
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7918
      apply (rule *)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7919
      apply assumption
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7920
      unfolding assms(5)[symmetric]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7921
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7922
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7923
  }
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7924
  assume "x \<noteq> c"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  7925
  note conv = assms(1)[unfolded convex_alt,rule_format]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7926
  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
  7927
    apply (rule continuous_intros)+
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7928
    apply (rule continuous_on_subset[OF assms(3)])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7929
    apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7930
    apply (rule conv)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7931
    using assms(4,7)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7932
    apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7933
    done
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7934
  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
  7935
  proof -
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7936
    from that have "(t - xa) *\<^sub>R x = (t - xa) *\<^sub>R c"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7937
      unfolding scaleR_simps by (auto simp add: algebra_simps)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  7938
    then show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7939
      using \<open>x \<noteq> c\<close> by auto
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7940
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7941
  have as2: "finite {t. ((1 - t) *\<^sub>R c + t *\<^sub>R x) \<in> k}"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7942
    using assms(2)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7943
    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
  7944
    apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7945
    unfolding image_iff
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7946
    apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7947
    defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7948
    apply assumption
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7949
    apply (rule sym)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7950
    apply (rule some_equality)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7951
    defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7952
    apply (drule *)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7953
    apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7954
    done
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  7955
  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
  7956
    apply (rule has_derivative_zero_unique_strong_interval[OF as2 as1, of ])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7957
    unfolding o_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7958
    using assms(5)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7959
    defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7960
    apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7961
    apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7962
  proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7963
    fix t
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7964
    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
  7965
    have *: "c - t *\<^sub>R c + t *\<^sub>R x \<in> s - k"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7966
      apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7967
      apply (rule conv[unfolded scaleR_simps])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7968
      using \<open>x \<in> s\<close> \<open>c \<in> s\<close> as
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7969
      by (auto simp add: algebra_simps)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7970
    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
  7971
      (at t within {0 .. 1})"
56381
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  7972
      apply (intro derivative_eq_intros)
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  7973
      apply simp_all
0556204bc230 merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents: 56371
diff changeset
  7974
      apply (simp add: field_simps)
44140
2c10c35dd4be remove several redundant and unused theorems about derivatives
huffman
parents: 44125
diff changeset
  7975
      unfolding scaleR_simps
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7976
      apply (rule has_derivative_within_subset,rule assms(6)[rule_format])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7977
      apply (rule *)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7978
      apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7979
      apply (rule conv[unfolded scaleR_simps])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7980
      using \<open>x \<in> s\<close> \<open>c \<in> s\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7981
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7982
      done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7983
    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
  7984
      unfolding o_def .
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7985
  qed auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7986
  then show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7987
    by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7988
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7989
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7990
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7991
text \<open>Also to any open connected set with finite set of exceptions. Could
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  7992
 generalize to locally convex set with limpt-free set of exceptions.\<close>
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  7993
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7994
lemma has_derivative_zero_unique_strong_connected:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  7995
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7996
  assumes "connected s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7997
    and "open s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7998
    and "finite k"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  7999
    and "continuous_on s f"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8000
    and "c \<in> s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8001
    and "f c = y"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8002
    and "\<forall>x\<in>(s - k). (f has_derivative (\<lambda>h. 0)) (at x within s)"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8003
    and "x\<in>s"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8004
  shows "f x = y"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8005
proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8006
  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
  8007
    apply (rule assms(1)[unfolded connected_clopen,rule_format])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8008
    apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8009
    defer
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61424
diff changeset
  8010
    apply (rule continuous_closedin_preimage[OF assms(4) closed_singleton])
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8011
    apply (rule open_openin_trans[OF assms(2)])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8012
    unfolding open_contains_ball
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8013
  proof safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8014
    fix x
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8015
    assume "x \<in> s"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8016
    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
  8017
    show "\<exists>e>0. ball x e \<subseteq> {xa \<in> s. f xa \<in> {f x}}"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8018
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8019
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8020
      apply (rule e)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8021
    proof safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8022
      fix y
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8023
      assume y: "y \<in> ball x e"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8024
      then show "y \<in> s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8025
        using e by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8026
      show "f y = f x"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8027
        apply (rule has_derivative_zero_unique_strong_convex[OF convex_ball])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8028
        apply (rule assms)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8029
        apply (rule continuous_on_subset)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8030
        apply (rule assms)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8031
        apply (rule e)+
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8032
        apply (subst centre_in_ball)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8033
        apply (rule e)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8034
        apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8035
        apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8036
        apply (rule has_derivative_within_subset)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8037
        apply (rule assms(7)[rule_format])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8038
        using y e
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8039
        apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8040
        done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8041
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8042
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8043
  then show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  8044
    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
  8045
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8046
56332
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  8047
lemma has_derivative_zero_connected_constant:
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  8048
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  8049
  assumes "connected s"
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  8050
      and "open s"
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  8051
      and "finite k"
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  8052
      and "continuous_on s f"
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  8053
      and "\<forall>x\<in>(s - k). (f has_derivative (\<lambda>h. 0)) (at x within s)"
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  8054
    obtains c where "\<And>x. x \<in> s \<Longrightarrow> f(x) = c"
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  8055
proof (cases "s = {}")
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  8056
  case True
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  8057
  then show ?thesis
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  8058
by (metis empty_iff that)
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  8059
next
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  8060
  case False
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  8061
  then obtain c where "c \<in> s"
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  8062
    by (metis equals0I)
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  8063
  then show ?thesis
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  8064
    by (metis has_derivative_zero_unique_strong_connected assms that)
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  8065
qed
289dd9166d04 tuned proofs
hoelzl
parents: 56218
diff changeset
  8066
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8067
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  8068
subsection \<open>Integrating characteristic function of an interval\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8069
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8070
lemma has_integral_restrict_open_subinterval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8071
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8072
  assumes "(f has_integral i) (cbox c d)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8073
    and "cbox c d \<subseteq> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8074
  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
  8075
proof -
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  8076
  def g \<equiv> "\<lambda>x. if x \<in>box c d then f x else 0"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8077
  {
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8078
    presume *: "cbox c d \<noteq> {} \<Longrightarrow> ?thesis"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8079
    show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8080
      apply cases
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8081
      apply (rule *)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8082
      apply assumption
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  8083
    proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  8084
      case prems: 1
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  8085
      then have *: "box c d = {}"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8086
        by (metis bot.extremum_uniqueI box_subset_cbox)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8087
      show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8088
        using assms(1)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8089
        unfolding *
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  8090
        using prems
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8091
        by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8092
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8093
  }
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8094
  assume "cbox c d \<noteq> {}"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8095
  from partial_division_extend_1[OF assms(2) this] guess p . note p=this
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8096
  note mon = monoidal_lifted[OF monoidal_monoid]
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8097
  note operat = operative_division[OF this operative_integral p(1), symmetric]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8098
  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
  8099
  {
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8100
    presume "?P"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8101
    then have "g integrable_on cbox a b \<and> integral (cbox a b) g = i"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8102
      apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8103
      apply cases
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8104
      apply (subst(asm) if_P)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8105
      apply assumption
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8106
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8107
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8108
    then show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8109
      using integrable_integral
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8110
      unfolding g_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8111
      by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8112
  }
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8113
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8114
  note iterate_eq_neutral[OF mon,unfolded neutral_lifted[OF monoidal_monoid]]
53597
ea99a7964174 remove duplicate lemmas
huffman
parents: 53524
diff changeset
  8115
  note * = this[unfolded neutral_add]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8116
  have iterate:"iterate (lifted op +) (p - {cbox c d})
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8117
    (\<lambda>i. if g integrable_on i then Some (integral i g) else None) = Some 0"
60463
ba9b52abdddb fixed another horrible proof
paulson <lp15@cam.ac.uk>
parents: 60442
diff changeset
  8118
  proof (rule *)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8119
    fix x
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8120
    assume x: "x \<in> p - {cbox c d}"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8121
    then have "x \<in> p"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8122
      by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8123
    note div = division_ofD(2-5)[OF p(1) this]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8124
    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
  8125
    have "interior x \<inter> interior (cbox c d) = {}"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8126
      using div(4)[OF p(2)] x by auto
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8127
    then have "(g has_integral 0) x"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8128
      unfolding uv
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8129
      apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8130
      apply (rule has_integral_spike_interior[where f="\<lambda>x. 0"])
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8131
      unfolding g_def interior_cbox
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8132
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8133
      done
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8134
    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
  8135
      by auto
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8136
  qed
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8137
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8138
  have *: "p = insert (cbox c d) (p - {cbox c d})"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8139
    using p by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8140
  have **: "g integrable_on cbox c d"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8141
    apply (rule integrable_spike_interior[where f=f])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8142
    unfolding g_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8143
    defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8144
    apply (rule has_integral_integrable)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8145
    using assms(1)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8146
    apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8147
    done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8148
  moreover
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8149
  have "integral (cbox c d) g = i"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8150
    apply (rule has_integral_unique[OF _ assms(1)])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8151
    apply (rule has_integral_spike_interior[where f=g])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8152
    defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8153
    apply (rule integrable_integral[OF **])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8154
    unfolding g_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8155
    apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8156
    done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8157
  ultimately show ?P
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8158
    unfolding operat
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8159
    apply (subst *)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8160
    apply (subst iterate_insert)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8161
    apply rule+
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8162
    unfolding iterate
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8163
    defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8164
    apply (subst if_not_P)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8165
    defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8166
    using p
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8167
    apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8168
    done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8169
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8170
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8171
lemma has_integral_restrict_closed_subinterval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8172
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8173
  assumes "(f has_integral i) (cbox c d)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8174
    and "cbox c d \<subseteq> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8175
  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
  8176
proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8177
  note has_integral_restrict_open_subinterval[OF assms]
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8178
  note * = has_integral_spike[OF negligible_frontier_interval _ this]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8179
  show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8180
    apply (rule *[of c d])
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8181
    using box_subset_cbox[of c d]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8182
    apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8183
    done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8184
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8185
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8186
lemma has_integral_restrict_closed_subintervals_eq:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8187
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8188
  assumes "cbox c d \<subseteq> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8189
  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
  8190
  (is "?l = ?r")
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8191
proof (cases "cbox c d = {}")
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8192
  case False
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8193
  let ?g = "\<lambda>x. if x \<in> cbox c d then f x else 0"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8194
  show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8195
    apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8196
    defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8197
    apply (rule has_integral_restrict_closed_subinterval[OF _ assms])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8198
    apply assumption
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8199
  proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8200
    assume ?l
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8201
    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
  8202
      using assms has_integral_integrable integrable_subinterval by blast
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8203
    then have *: "f integrable_on cbox c d"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8204
      apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8205
      apply (rule integrable_eq)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8206
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8207
      done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8208
    then have "i = integral (cbox c d) f"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8209
      apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8210
      apply (rule has_integral_unique)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  8211
      apply (rule \<open>?l\<close>)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8212
      apply (rule has_integral_restrict_closed_subinterval[OF _ assms])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8213
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8214
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8215
    then show ?r
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8216
      using * by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8217
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8218
qed auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8219
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8220
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  8221
text \<open>Hence we can apply the limit process uniformly to all integrals.\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8222
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8223
lemma has_integral':
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8224
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8225
  shows "(f has_integral i) s \<longleftrightarrow>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8226
    (\<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
  8227
      (\<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
  8228
  (is "?l \<longleftrightarrow> (\<forall>e>0. ?r e)")
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8229
proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8230
  {
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8231
    presume *: "\<exists>a b. s = cbox a b \<Longrightarrow> ?thesis"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8232
    show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8233
      apply cases
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8234
      apply (rule *)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8235
      apply assumption
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8236
      apply (subst has_integral_alt)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8237
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8238
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8239
  }
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8240
  assume "\<exists>a b. s = cbox a b"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8241
  then guess a b by (elim exE) note s=this
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  8242
  from bounded_cbox[of a b, unfolded bounded_pos] guess B ..
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8243
  note B = conjunctD2[OF this,rule_format] show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8244
    apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8245
  proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8246
    fix e :: real
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8247
    assume ?l and "e > 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8248
    show "?r e"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8249
      apply (rule_tac x="B+1" in exI)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8250
      apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8251
      defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8252
      apply (rule_tac x=i in exI)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8253
    proof
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8254
      fix c d :: 'n
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8255
      assume as: "ball 0 (B+1) \<subseteq> cbox c d"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8256
      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
  8257
        unfolding s
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8258
        apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8259
        apply (rule has_integral_restrict_closed_subinterval)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  8260
        apply (rule \<open>?l\<close>[unfolded s])
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8261
        apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8262
        apply (drule B(2)[rule_format])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8263
        unfolding subset_eq
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8264
        apply (erule_tac x=x in ballE)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8265
        apply (auto simp add: dist_norm)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8266
        done
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  8267
    qed (insert B \<open>e>0\<close>, auto)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8268
  next
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8269
    assume as: "\<forall>e>0. ?r e"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8270
    from this[rule_format,OF zero_less_one] guess C .. note C=conjunctD2[OF this,rule_format]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8271
    def c \<equiv> "(\<Sum>i\<in>Basis. (- max B C) *\<^sub>R i)::'n"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8272
    def d \<equiv> "(\<Sum>i\<in>Basis. max B C *\<^sub>R i)::'n"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8273
    have c_d: "cbox a b \<subseteq> cbox c d"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8274
      apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8275
      apply (drule B(2))
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8276
      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
  8277
    proof
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8278
      fix x i
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8279
      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
  8280
        using that and Basis_le_norm[OF \<open>i\<in>Basis\<close>, of x]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8281
        unfolding c_def d_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8282
        by (auto simp add: field_simps setsum_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
  8283
    qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8284
    have "ball 0 C \<subseteq> cbox c d"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8285
      apply (rule subsetI)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8286
      unfolding mem_box mem_ball dist_norm
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  8287
    proof
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8288
      fix x i :: 'n
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8289
      assume x: "norm (0 - x) < C" and i: "i \<in> Basis"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8290
      show "c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8291
        using Basis_le_norm[OF i, of x] and x i
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8292
        unfolding c_def d_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8293
        by (auto simp: setsum_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
  8294
    qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8295
    from C(2)[OF this] have "\<exists>y. (f has_integral y) (cbox a b)"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8296
      unfolding has_integral_restrict_closed_subintervals_eq[OF c_d,symmetric]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8297
      unfolding s
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8298
      by auto
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8299
    then guess y .. note y=this
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8300
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8301
    have "y = i"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8302
    proof (rule ccontr)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8303
      assume "\<not> ?thesis"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8304
      then have "0 < norm (y - i)"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8305
        by auto
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8306
      from as[rule_format,OF this] guess C ..  note C=conjunctD2[OF this,rule_format]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8307
      def c \<equiv> "(\<Sum>i\<in>Basis. (- max B C) *\<^sub>R i)::'n"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8308
      def d \<equiv> "(\<Sum>i\<in>Basis. max B C *\<^sub>R i)::'n"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8309
      have c_d: "cbox a b \<subseteq> cbox c d"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8310
        apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8311
        apply (drule B(2))
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8312
        unfolding mem_box
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8313
      proof
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8314
        fix x i :: 'n
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8315
        assume "norm x \<le> B" and "i \<in> Basis"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8316
        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
  8317
          using Basis_le_norm[of i x]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8318
          unfolding c_def d_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8319
          by (auto simp add: field_simps setsum_negf)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8320
      qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8321
      have "ball 0 C \<subseteq> cbox c d"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8322
        apply (rule subsetI)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8323
        unfolding mem_box mem_ball dist_norm
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8324
      proof
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8325
        fix x i :: 'n
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8326
        assume "norm (0 - x) < C" and "i \<in> Basis"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8327
        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
  8328
          using Basis_le_norm[of i x]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8329
          unfolding c_def d_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8330
          by (auto simp: setsum_negf)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8331
      qed
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8332
      note C(2)[OF this] then guess z .. note z = conjunctD2[OF this, unfolded s]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8333
      note this[unfolded has_integral_restrict_closed_subintervals_eq[OF c_d]]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8334
      then have "z = y" and "norm (z - i) < norm (y - i)"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8335
        apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8336
        apply (rule has_integral_unique[OF _ y(1)])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8337
        apply assumption
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8338
        apply assumption
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8339
        done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8340
      then show False
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8341
        by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8342
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8343
    then show ?l
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8344
      using y
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8345
      unfolding s
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8346
      by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8347
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8348
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8349
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8350
lemma has_integral_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8351
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8352
  assumes "(f has_integral i) s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8353
    and "(g has_integral j) s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8354
    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
  8355
  shows "i \<le> j"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8356
  using has_integral_component_le[OF _ assms(1-2), of 1]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8357
  using assms(3)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8358
  by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8359
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8360
lemma integral_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8361
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8362
  assumes "f integrable_on s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8363
    and "g integrable_on s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8364
    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
  8365
  shows "integral s f \<le> integral s g"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8366
  by (rule has_integral_le[OF assms(1,2)[unfolded has_integral_integral] assms(3)])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8367
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8368
lemma has_integral_nonneg:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8369
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8370
  assumes "(f has_integral i) s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8371
    and "\<forall>x\<in>s. 0 \<le> f x"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8372
  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
  8373
  using has_integral_component_nonneg[of 1 f i s]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8374
  unfolding o_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8375
  using assms
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8376
  by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8377
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8378
lemma integral_nonneg:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8379
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8380
  assumes "f integrable_on s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8381
    and "\<forall>x\<in>s. 0 \<le> f x"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8382
  shows "0 \<le> integral s f"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8383
  by (rule has_integral_nonneg[OF assms(1)[unfolded has_integral_integral] assms(2)])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8384
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8385
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  8386
text \<open>Hence a general restriction property.\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8387
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8388
lemma has_integral_restrict[simp]:
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8389
  assumes "s \<subseteq> t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8390
  shows "((\<lambda>x. if x \<in> s then f x else (0::'a::banach)) has_integral i) t \<longleftrightarrow> (f has_integral i) s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8391
proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8392
  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)"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8393
    using assms by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8394
  show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8395
    apply (subst(2) has_integral')
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8396
    apply (subst has_integral')
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8397
    unfolding *
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8398
    apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8399
    done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8400
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8401
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8402
lemma has_integral_restrict_univ:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8403
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8404
  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
  8405
  by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8406
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8407
lemma has_integral_on_superset:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8408
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8409
  assumes "\<forall>x. x \<notin> s \<longrightarrow> f x = 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8410
    and "s \<subseteq> t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8411
    and "(f has_integral i) s"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8412
  shows "(f has_integral i) t"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8413
proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8414
  have "(\<lambda>x. if x \<in> s then f x else 0) = (\<lambda>x. if x \<in> t then f x else 0)"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8415
    apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8416
    using assms(1-2)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8417
    apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8418
    done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8419
  then show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8420
    using assms(3)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8421
    apply (subst has_integral_restrict_univ[symmetric])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8422
    apply (subst(asm) has_integral_restrict_univ[symmetric])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8423
    apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8424
    done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8425
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8426
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8427
lemma integrable_on_superset:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8428
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8429
  assumes "\<forall>x. x \<notin> s \<longrightarrow> f x = 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8430
    and "s \<subseteq> t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8431
    and "f integrable_on s"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8432
  shows "f integrable_on t"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8433
  using assms
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8434
  unfolding integrable_on_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8435
  by (auto intro:has_integral_on_superset)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8436
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8437
lemma integral_restrict_univ[intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8438
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8439
  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
  8440
  apply (rule integral_unique)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8441
  unfolding has_integral_restrict_univ
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8442
  apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8443
  done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8444
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8445
lemma integrable_restrict_univ:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8446
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8447
  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
  8448
  unfolding integrable_on_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8449
  by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8450
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8451
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
  8452
proof
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8453
  assume ?r
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8454
  show ?l
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8455
    unfolding negligible_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8456
  proof safe
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8457
    fix a b
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8458
    show "(indicator s has_integral 0) (cbox a b)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  8459
      apply (rule has_integral_negligible[OF \<open>?r\<close>[rule_format,of a b]])
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8460
      unfolding indicator_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8461
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8462
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8463
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8464
qed auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8465
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8466
lemma has_integral_spike_set_eq:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8467
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8468
  assumes "negligible ((s - t) \<union> (t - s))"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8469
  shows "(f has_integral y) s \<longleftrightarrow> (f has_integral y) t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8470
  unfolding has_integral_restrict_univ[symmetric,of f]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8471
  apply (rule has_integral_spike_eq[OF assms])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8472
  by (auto split: split_if_asm)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8473
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8474
lemma has_integral_spike_set[dest]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8475
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8476
  assumes "negligible ((s - t) \<union> (t - s))"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8477
    and "(f has_integral y) s"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8478
  shows "(f has_integral y) t"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8479
  using assms has_integral_spike_set_eq
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8480
  by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8481
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8482
lemma integrable_spike_set[dest]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8483
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8484
  assumes "negligible ((s - t) \<union> (t - s))"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8485
    and "f integrable_on s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8486
  shows "f integrable_on t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8487
  using assms(2)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8488
  unfolding integrable_on_def
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8489
  unfolding has_integral_spike_set_eq[OF assms(1)] .
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8490
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8491
lemma integrable_spike_set_eq:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8492
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8493
  assumes "negligible ((s - t) \<union> (t - s))"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8494
  shows "f integrable_on s \<longleftrightarrow> f integrable_on t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8495
  apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8496
  apply (rule_tac[!] integrable_spike_set)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8497
  using assms
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8498
  apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8499
  done
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8500
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8501
(*lemma integral_spike_set:
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8502
 "\<forall>f:real^M->real^N g s t.
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8503
        negligible(s DIFF t \<union> t DIFF s)
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8504
        \<longrightarrow> integral s f = integral t f"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8505
qed  REPEAT STRIP_TAC THEN REWRITE_TAC[integral] THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8506
  AP_TERM_TAC THEN ABS_TAC THEN MATCH_MP_TAC HAS_INTEGRAL_SPIKE_SET_EQ THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8507
  ASM_MESON_TAC[]);;
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8508
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8509
lemma has_integral_interior:
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8510
 "\<forall>f:real^M->real^N y s.
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8511
        negligible(frontier s)
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8512
        \<longrightarrow> ((f has_integral y) (interior s) \<longleftrightarrow> (f has_integral y) s)"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8513
qed  REPEAT STRIP_TAC THEN MATCH_MP_TAC HAS_INTEGRAL_SPIKE_SET_EQ THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8514
  FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (REWRITE_RULE[IMP_CONJ]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8515
    NEGLIGIBLE_SUBSET)) THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8516
  REWRITE_TAC[frontier] THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8517
  MP_TAC(ISPEC `s:real^M->bool` INTERIOR_SUBSET) THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8518
  MP_TAC(ISPEC `s:real^M->bool` CLOSURE_SUBSET) THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8519
  SET_TAC[]);;
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8520
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8521
lemma has_integral_closure:
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8522
 "\<forall>f:real^M->real^N y s.
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8523
        negligible(frontier s)
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8524
        \<longrightarrow> ((f has_integral y) (closure s) \<longleftrightarrow> (f has_integral y) s)"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8525
qed  REPEAT STRIP_TAC THEN MATCH_MP_TAC HAS_INTEGRAL_SPIKE_SET_EQ THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8526
  FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (REWRITE_RULE[IMP_CONJ]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8527
    NEGLIGIBLE_SUBSET)) THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8528
  REWRITE_TAC[frontier] THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8529
  MP_TAC(ISPEC `s:real^M->bool` INTERIOR_SUBSET) THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8530
  MP_TAC(ISPEC `s:real^M->bool` CLOSURE_SUBSET) THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8531
  SET_TAC[]);;*)
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8532
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8533
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  8534
subsection \<open>More lemmas that are useful later\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8535
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8536
lemma has_integral_subset_component_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8537
  fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8538
  assumes k: "k \<in> Basis"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8539
    and as: "s \<subseteq> t" "(f has_integral i) s" "(f has_integral j) t" "\<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
  8540
  shows "i\<bullet>k \<le> j\<bullet>k"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8541
proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8542
  note has_integral_restrict_univ[symmetric, of f]
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
  8543
  note as(2-3)[unfolded this] note * = has_integral_component_le[OF k this]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8544
  show ?thesis
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8545
    apply (rule *)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8546
    using as(1,4)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8547
    apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8548
    done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8549
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8550
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8551
lemma has_integral_subset_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8552
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8553
  assumes "s \<subseteq> t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8554
    and "(f has_integral i) s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8555
    and "(f has_integral j) t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8556
    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
  8557
  shows "i \<le> j"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8558
  using has_integral_subset_component_le[OF _ assms(1), of 1 f i j]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8559
  using assms
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8560
  by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8561
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8562
lemma integral_subset_component_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8563
  fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8564
  assumes "k \<in> Basis"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8565
    and "s \<subseteq> t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8566
    and "f integrable_on s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8567
    and "f integrable_on t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8568
    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
  8569
  shows "(integral s f)\<bullet>k \<le> (integral t f)\<bullet>k"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8570
  apply (rule has_integral_subset_component_le)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8571
  using assms
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8572
  apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8573
  done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8574
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8575
lemma integral_subset_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8576
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8577
  assumes "s \<subseteq> t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8578
    and "f integrable_on s"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8579
    and "f integrable_on t"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8580
    and "\<forall>x \<in> t. 0 \<le> f x"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8581
  shows "integral s f \<le> integral t f"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8582
  apply (rule has_integral_subset_le)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8583
  using assms
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8584
  apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8585
  done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8586
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8587
lemma has_integral_alt':
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8588
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8589
  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
  8590
    (\<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
  8591
      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
  8592
  (is "?l = ?r")
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8593
proof
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8594
  assume ?r
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8595
  show ?l
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8596
    apply (subst has_integral')
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8597
    apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  8598
  proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8599
    case (1 e)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  8600
    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
  8601
    show ?case
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8602
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8603
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8604
      apply (rule B)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8605
      apply safe
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8606
      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
  8607
      apply (drule B(2)[rule_format])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  8608
      using integrable_integral[OF \<open>?r\<close>[THEN conjunct1,rule_format]]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8609
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8610
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8611
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8612
next
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8613
  assume ?l note as = this[unfolded has_integral'[of f],rule_format]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8614
  let ?f = "\<lambda>x. if x \<in> s then f x else 0"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8615
  show ?r
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8616
  proof safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8617
    fix a b :: 'n
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8618
    from as[OF zero_less_one] guess B .. note B=conjunctD2[OF this,rule_format]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8619
    let ?a = "\<Sum>i\<in>Basis. min (a\<bullet>i) (-B) *\<^sub>R i::'n"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8620
    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
  8621
    show "?f integrable_on cbox a b"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8622
    proof (rule integrable_subinterval[of _ ?a ?b])
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8623
      have "ball 0 B \<subseteq> cbox ?a ?b"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8624
        apply (rule subsetI)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8625
        unfolding mem_ball mem_box dist_norm
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  8626
      proof (rule, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8627
        case (1 x i)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8628
        then show ?case using Basis_le_norm[of i x]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8629
          by (auto simp add:field_simps)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8630
      qed
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8631
      from B(2)[OF this] guess z .. note conjunct1[OF this]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8632
      then show "?f integrable_on cbox ?a ?b"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8633
        unfolding integrable_on_def by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8634
      show "cbox a b \<subseteq> cbox ?a ?b"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8635
        apply safe
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8636
        unfolding mem_box
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8637
        apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8638
        apply (erule_tac x=i in ballE)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8639
        apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8640
        done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8641
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8642
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8643
    fix e :: real
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8644
    assume "e > 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8645
    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
  8646
    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
  8647
      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
  8648
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8649
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8650
      apply (rule B)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8651
      apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  8652
    proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8653
      case 1
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8654
      from B(2)[OF this] guess z .. note z=conjunctD2[OF this]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8655
      from integral_unique[OF this(1)] show ?case
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8656
        using z(2) by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8657
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8658
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8659
qed
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8660
35752
c8a8df426666 reset smt_certificates
himmelma
parents: 35751
diff changeset
  8661
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  8662
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
  8663
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8664
lemma integrable_alt:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8665
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8666
  shows "f integrable_on s \<longleftrightarrow>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8667
    (\<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
  8668
    (\<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
  8669
    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
  8670
      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
  8671
  (is "?l = ?r")
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8672
proof
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8673
  assume ?l
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8674
  then guess y unfolding integrable_on_def .. note this[unfolded has_integral_alt'[of f]]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8675
  note y=conjunctD2[OF this,rule_format]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8676
  show ?r
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8677
    apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8678
    apply (rule y)
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  8679
  proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8680
    case (1 e)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8681
    then have "e/2 > 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8682
      by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8683
    from y(2)[OF this] guess B .. note B=conjunctD2[OF this,rule_format]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8684
    show ?case
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8685
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8686
      apply rule
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8687
      apply (rule B)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8688
      apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  8689
    proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  8690
      case prems: (1 a b c d)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8691
      show ?case
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8692
        apply (rule norm_triangle_half_l)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  8693
        using B(2)[OF prems(1)] B(2)[OF prems(2)]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8694
        apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8695
        done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8696
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8697
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8698
next
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8699
  assume ?r
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8700
  note as = conjunctD2[OF this,rule_format]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8701
  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
  8702
  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
  8703
  proof (unfold Cauchy_def, safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8704
    case (1 e)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8705
    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
  8706
    from real_arch_simple[of B] guess N .. note N = this
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8707
    {
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8708
      fix n
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8709
      assume n: "n \<ge> N"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8710
      have "ball 0 B \<subseteq> ?cube n"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8711
        apply (rule subsetI)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8712
        unfolding mem_ball mem_box dist_norm
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  8713
      proof (rule, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8714
        case (1 x i)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8715
        then show ?case
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  8716
          using Basis_le_norm[of i x] \<open>i\<in>Basis\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8717
          using n N
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8718
          by (auto simp add: field_simps setsum_negf)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8719
      qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8720
    }
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8721
    then show ?case
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8722
      apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8723
      apply (rule_tac x=N in exI)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8724
      apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8725
      unfolding dist_norm
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8726
      apply (rule B(2))
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8727
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8728
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8729
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8730
  from this[unfolded convergent_eq_cauchy[symmetric]] guess i ..
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
  8731
  note i = this[THEN LIMSEQ_D]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8732
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8733
  show ?l unfolding integrable_on_def has_integral_alt'[of f]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8734
    apply (rule_tac x=i in exI)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8735
    apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8736
    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
  8737
  proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8738
    case (1 e)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8739
    then have *: "e/2 > 0" by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8740
    from i[OF this] guess N .. note N =this[rule_format]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8741
    from as(2)[OF *] guess B .. note B=conjunctD2[OF this,rule_format]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8742
    let ?B = "max (real N) B"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8743
    show ?case
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8744
      apply (rule_tac x="?B" in exI)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8745
    proof safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8746
      show "0 < ?B"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8747
        using B(1) by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8748
      fix a b :: 'n
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8749
      assume ab: "ball 0 ?B \<subseteq> cbox a b"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8750
      from real_arch_simple[of ?B] guess n .. note n=this
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8751
      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
  8752
        apply (rule norm_triangle_half_l)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8753
        apply (rule B(2))
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8754
        defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8755
        apply (subst norm_minus_commute)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8756
        apply (rule N[of n])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8757
      proof safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8758
        show "N \<le> n"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8759
          using n by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8760
        fix x :: 'n
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8761
        assume x: "x \<in> ball 0 B"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8762
        then have "x \<in> ball 0 ?B"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8763
          by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8764
        then show "x \<in> cbox a b"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8765
          using ab by blast
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8766
        show "x \<in> ?cube n"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8767
          using x
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8768
          unfolding mem_box mem_ball dist_norm
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8769
          apply -
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  8770
        proof (rule, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8771
          case (1 i)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8772
          then show ?case
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  8773
            using Basis_le_norm[of i x] \<open>i \<in> Basis\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8774
            using n
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8775
            by (auto simp add: field_simps setsum_negf)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8776
        qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8777
      qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8778
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8779
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8780
qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8781
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8782
lemma integrable_altD:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8783
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8784
  assumes "f integrable_on s"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8785
  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
  8786
    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
  8787
      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
  8788
  using assms[unfolded integrable_alt[of f]] by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8789
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8790
lemma integrable_on_subcbox:
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8791
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8792
  assumes "f integrable_on s"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8793
    and "cbox a b \<subseteq> s"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8794
  shows "f integrable_on cbox a b"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8795
  apply (rule integrable_eq)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8796
  defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8797
  apply (rule integrable_altD(1)[OF assms(1)])
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8798
  using assms(2)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8799
  apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8800
  done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8801
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8802
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  8803
subsection \<open>A straddling criterion for integrability\<close>
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8804
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8805
lemma integrable_straddle_interval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8806
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8807
  assumes "\<forall>e>0. \<exists>g  h i j. (g has_integral i) (cbox a b) \<and> (h has_integral j) (cbox a b) \<and>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8808
    norm (i - j) < e \<and> (\<forall>x\<in>cbox a b. (g x) \<le> f x \<and> f x \<le> h x)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8809
  shows "f integrable_on cbox a b"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  8810
proof (subst integrable_cauchy, safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8811
  case (1 e)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8812
  then have e: "e/3 > 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8813
    by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8814
  note assms[rule_format,OF this]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8815
  then guess g h i j by (elim exE conjE) note obt = this
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8816
  from obt(1)[unfolded has_integral[of g], rule_format, OF e] guess d1 .. note d1=conjunctD2[OF this,rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8817
  from obt(2)[unfolded has_integral[of h], rule_format, OF e] guess d2 .. note d2=conjunctD2[OF this,rule_format]
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8818
  show ?case
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8819
    apply (rule_tac x="\<lambda>x. d1 x \<inter> d2 x" in exI)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8820
    apply (rule conjI gauge_inter d1 d2)+
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8821
    unfolding fine_inter
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  8822
  proof (safe, goal_cases)
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8823
    have **: "\<And>i j g1 g2 h1 h2 f1 f2. g1 - h2 \<le> f1 - f2 \<Longrightarrow> f1 - f2 \<le> h1 - g2 \<Longrightarrow>
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8824
      abs (i - j) < e / 3 \<Longrightarrow> abs (g2 - i) < e / 3 \<Longrightarrow>  abs (g1 - i) < e / 3 \<Longrightarrow>
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8825
      abs (h2 - j) < e / 3 \<Longrightarrow> abs (h1 - j) < e / 3 \<Longrightarrow> abs (f1 - f2) < e"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  8826
    using \<open>e > 0\<close> by arith
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  8827
    case prems: (1 p1 p2)
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  8828
    note tagged_division_ofD(2-4) note * = this[OF prems(1)] this[OF prems(4)]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8829
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8830
    have "(\<Sum>(x, k)\<in>p1. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p1. content k *\<^sub>R g x) \<ge> 0"
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8831
      and "0 \<le> (\<Sum>(x, k)\<in>p2. content k *\<^sub>R h x) - (\<Sum>(x, k)\<in>p2. content k *\<^sub>R f x)"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8832
      and "(\<Sum>(x, k)\<in>p2. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p2. content k *\<^sub>R g x) \<ge> 0"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8833
      and "0 \<le> (\<Sum>(x, k)\<in>p1. content k *\<^sub>R h x) - (\<Sum>(x, k)\<in>p1. content k *\<^sub>R f x)"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8834
      unfolding setsum_subtractf[symmetric]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8835
      apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8836
      apply (rule_tac[!] setsum_nonneg)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8837
      apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8838
      unfolding real_scaleR_def right_diff_distrib[symmetric]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8839
      apply (rule_tac[!] mult_nonneg_nonneg)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8840
    proof -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8841
      fix a b
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8842
      assume ab: "(a, b) \<in> p1"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8843
      show "0 \<le> content b"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8844
        using *(3)[OF ab]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8845
        apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8846
        apply (rule content_pos_le)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8847
        done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8848
      then show "0 \<le> content b" .
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8849
      show "0 \<le> f a - g a" "0 \<le> h a - f a"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8850
        using *(1-2)[OF ab]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8851
        using obt(4)[rule_format,of a]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8852
        by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8853
    next
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8854
      fix a b
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8855
      assume ab: "(a, b) \<in> p2"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8856
      show "0 \<le> content b"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8857
        using *(6)[OF ab]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8858
        apply safe
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8859
        apply (rule content_pos_le)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8860
        done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8861
      then show "0 \<le> content b" .
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8862
      show "0 \<le> f a - g a" and "0 \<le> h a - f a"
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8863
        using *(4-5)[OF ab] using obt(4)[rule_format,of a] by auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8864
    qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8865
    then show ?case
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8866
      apply -
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8867
      unfolding real_norm_def
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8868
      apply (rule **)
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8869
      defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8870
      defer
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8871
      unfolding real_norm_def[symmetric]
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8872
      apply (rule obt(3))
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  8873
      apply (rule d1(2)[OF conjI[OF prems(4,5)]])
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  8874
      apply (rule d1(2)[OF conjI[OF prems(1,2)]])
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  8875
      apply (rule d2(2)[OF conjI[OF prems(4,6)]])
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  8876
      apply (rule d2(2)[OF conjI[OF prems(1,3)]])
53634
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8877
      apply auto
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8878
      done
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8879
  qed
ab5d01b69a07 tuned proofs;
wenzelm
parents: 53600
diff changeset
  8880
qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8881
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8882
lemma integrable_straddle:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8883
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8884
  assumes "\<forall>e>0. \<exists>g h i j. (g has_integral i) s \<and> (h has_integral j) s \<and>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8885
    norm (i - j) < 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
  8886
  shows "f integrable_on s"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8887
proof -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8888
  have "\<And>a b. (\<lambda>x. if x \<in> s then f x else 0) integrable_on cbox a b"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  8889
  proof (rule integrable_straddle_interval, safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8890
    case (1 a b e)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8891
    then have *: "e/4 > 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8892
      by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8893
    from assms[rule_format,OF this] guess g h i j by (elim exE conjE) note obt=this
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8894
    note obt(1)[unfolded has_integral_alt'[of g]]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8895
    note conjunctD2[OF this, rule_format]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8896
    note g = this(1) and this(2)[OF *]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8897
    from this(2) guess B1 .. note B1 = conjunctD2[OF this,rule_format]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8898
    note obt(2)[unfolded has_integral_alt'[of h]]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8899
    note conjunctD2[OF this, rule_format]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8900
    note h = this(1) and this(2)[OF *]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8901
    from this(2) guess B2 .. note B2 = conjunctD2[OF this,rule_format]
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
  8902
    def c \<equiv> "\<Sum>i\<in>Basis. min (a\<bullet>i) (- (max B1 B2)) *\<^sub>R i::'n"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  8903
    def d \<equiv> "\<Sum>i\<in>Basis. max (b\<bullet>i) (max B1 B2) *\<^sub>R i::'n"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8904
    have *: "ball 0 B1 \<subseteq> cbox c d" "ball 0 B2 \<subseteq> cbox c d"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8905
      apply safe
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8906
      unfolding mem_ball mem_box dist_norm
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8907
      apply (rule_tac[!] ballI)
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  8908
    proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8909
      case (1 x i)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8910
      then show ?case using Basis_le_norm[of i x]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8911
        unfolding c_def d_def by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8912
    next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8913
      case (2 x i)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8914
      then show ?case using Basis_le_norm[of i x]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8915
        unfolding c_def d_def by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8916
    qed
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8917
    have **: "\<And>ch cg ag ah::real. norm (ah - ag) \<le> norm (ch - cg) \<Longrightarrow> norm (cg - i) < e / 4 \<Longrightarrow>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8918
      norm (ch - j) < e / 4 \<Longrightarrow> norm (ag - ah) < e"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8919
      using obt(3)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8920
      unfolding real_norm_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8921
      by arith
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8922
    show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8923
      apply (rule_tac x="\<lambda>x. if x \<in> s then g x else 0" in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8924
      apply (rule_tac x="\<lambda>x. if x \<in> s then h x else 0" in exI)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8925
      apply (rule_tac x="integral (cbox a b) (\<lambda>x. if x \<in> s then g x else 0)" in exI)
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8926
      apply (rule_tac x="integral (cbox a b) (\<lambda>x. if x \<in> s then h x else 0)" in exI)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8927
      apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8928
      apply (rule_tac[1-2] integrable_integral,rule g)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8929
      apply (rule h)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8930
      apply (rule **[OF _ B1(2)[OF *(1)] B2(2)[OF *(2)]])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8931
    proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8932
      have *: "\<And>x f g. (if x \<in> s then f x else 0) - (if x \<in> s then g x else 0) =
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8933
        (if x \<in> s then f x - g x else (0::real))"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8934
        by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8935
      note ** = abs_of_nonneg[OF integral_nonneg[OF integrable_sub, OF h g]]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8936
      show "norm (integral (cbox a b) (\<lambda>x. if x \<in> s then h x else 0) -
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8937
          integral (cbox a b) (\<lambda>x. if x \<in> s then g x else 0)) \<le>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8938
        norm (integral (cbox c d) (\<lambda>x. if x \<in> s then h x else 0) -
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8939
          integral (cbox c d) (\<lambda>x. if x \<in> s then g x else 0))"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8940
        unfolding integral_sub[OF h g,symmetric] real_norm_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8941
        apply (subst **)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8942
        defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8943
        apply (subst **)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8944
        defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8945
        apply (rule has_integral_subset_le)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8946
        defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8947
        apply (rule integrable_integral integrable_sub h g)+
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8948
      proof safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8949
        fix x
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8950
        assume "x \<in> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8951
        then show "x \<in> cbox c d"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8952
          unfolding mem_box c_def d_def
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8953
          apply -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8954
          apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8955
          apply (erule_tac x=i in ballE)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8956
          apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8957
          done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8958
      qed (insert obt(4), auto)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8959
    qed (insert obt(4), auto)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8960
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8961
  note interv = this
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8962
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8963
  show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8964
    unfolding integrable_alt[of f]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8965
    apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8966
    apply (rule interv)
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  8967
  proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  8968
    case (1 e)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8969
    then have *: "e/3 > 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8970
      by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8971
    from assms[rule_format,OF this] guess g h i j by (elim exE conjE) note obt=this
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8972
    note obt(1)[unfolded has_integral_alt'[of g]]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8973
    note conjunctD2[OF this, rule_format]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8974
    note g = this(1) and this(2)[OF *]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8975
    from this(2) guess B1 .. note B1 = conjunctD2[OF this,rule_format]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8976
    note obt(2)[unfolded has_integral_alt'[of h]]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8977
    note conjunctD2[OF this, rule_format]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8978
    note h = this(1) and this(2)[OF *]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8979
    from this(2) guess B2 .. note B2 = conjunctD2[OF this,rule_format]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8980
    show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8981
      apply (rule_tac x="max B1 B2" in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8982
      apply safe
54863
82acc20ded73 prefer more canonical names for lemmas on min/max
haftmann
parents: 54781
diff changeset
  8983
      apply (rule max.strict_coboundedI1)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8984
      apply (rule B1)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8985
    proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8986
      fix a b c d :: 'n
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8987
      assume as: "ball 0 (max B1 B2) \<subseteq> cbox a b" "ball 0 (max B1 B2) \<subseteq> cbox c d"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8988
      have **: "ball 0 B1 \<subseteq> ball (0::'n) (max B1 B2)" "ball 0 B2 \<subseteq> ball (0::'n) (max B1 B2)"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8989
        by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8990
      have *: "\<And>ga gc ha hc fa fc::real.
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8991
        abs (ga - i) < e / 3 \<and> abs (gc - i) < e / 3 \<and> abs (ha - j) < e / 3 \<and>
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8992
        abs (hc - j) < e / 3 \<and> abs (i - j) < e / 3 \<and> ga \<le> fa \<and> fa \<le> ha \<and> gc \<le> fc \<and> fc \<le> hc \<Longrightarrow>
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8993
        abs (fa - fc) < e"
50348
4b4fe0d5ee22 remove SMT proofs in Multivariate_Analysis
hoelzl
parents: 50252
diff changeset
  8994
        by (simp add: abs_real_def split: split_if_asm)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  8995
      show "norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else 0) - integral (cbox c d)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8996
        (\<lambda>x. if x \<in> s then f x else 0)) < e"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8997
        unfolding real_norm_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8998
        apply (rule *)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  8999
        apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9000
        unfolding real_norm_def[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9001
        apply (rule B1(2))
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9002
        apply (rule order_trans)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9003
        apply (rule **)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9004
        apply (rule as(1))
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9005
        apply (rule B1(2))
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9006
        apply (rule order_trans)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9007
        apply (rule **)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9008
        apply (rule as(2))
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9009
        apply (rule B2(2))
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9010
        apply (rule order_trans)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9011
        apply (rule **)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9012
        apply (rule as(1))
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9013
        apply (rule B2(2))
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9014
        apply (rule order_trans)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9015
        apply (rule **)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9016
        apply (rule as(2))
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9017
        apply (rule obt)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9018
        apply (rule_tac[!] integral_le)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9019
        using obt
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9020
        apply (auto intro!: h g interv)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9021
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9022
    qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9023
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9024
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9025
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9026
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  9027
subsection \<open>Adding integrals over several sets\<close>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9028
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9029
lemma has_integral_union:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9030
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9031
  assumes "(f has_integral i) s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9032
    and "(f has_integral j) t"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9033
    and "negligible (s \<inter> t)"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9034
  shows "(f has_integral (i + j)) (s \<union> t)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9035
proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9036
  note * = has_integral_restrict_univ[symmetric, of f]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9037
  show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9038
    unfolding *
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9039
    apply (rule has_integral_spike[OF assms(3)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9040
    defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9041
    apply (rule has_integral_add[OF assms(1-2)[unfolded *]])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9042
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9043
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9044
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9045
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9046
lemma has_integral_unions:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9047
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9048
  assumes "finite t"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9049
    and "\<forall>s\<in>t. (f has_integral (i s)) s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9050
    and "\<forall>s\<in>t. \<forall>s'\<in>t. s \<noteq> s' \<longrightarrow> negligible (s \<inter> s')"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9051
  shows "(f has_integral (setsum i t)) (\<Union>t)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9052
proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9053
  note * = has_integral_restrict_univ[symmetric, of f]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9054
  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}}))"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9055
    apply (rule negligible_unions)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9056
    apply (rule finite_imageI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9057
    apply (rule finite_subset[of _ "t \<times> t"])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9058
    defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9059
    apply (rule finite_cartesian_product[OF assms(1,1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9060
    using assms(3)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9061
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9062
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9063
  note assms(2)[unfolded *]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9064
  note has_integral_setsum[OF assms(1) this]
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9065
  then show ?thesis
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9066
    unfolding *
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9067
    apply -
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9068
    apply (rule has_integral_spike[OF **])
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9069
    defer
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9070
    apply assumption
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9071
    apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  9072
  proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  9073
    case prems: (1 x)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9074
    then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9075
    proof (cases "x \<in> \<Union>t")
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9076
      case True
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9077
      then guess s unfolding Union_iff .. note s=this
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9078
      then have *: "\<forall>b\<in>t. x \<in> b \<longleftrightarrow> b = s"
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  9079
        using prems(3) by blast
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9080
      show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9081
        unfolding if_P[OF True]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9082
        apply (rule trans)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9083
        defer
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  9084
        apply (rule setsum.cong)
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  9085
        apply (rule refl)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9086
        apply (subst *)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9087
        apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9088
        apply (rule refl)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  9089
        unfolding setsum.delta[OF assms(1)]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9090
        using s
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9091
        apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9092
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9093
    qed auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9094
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9095
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9096
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9097
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  9098
text \<open>In particular adding integrals over a division, maybe not of an interval.\<close>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9099
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9100
lemma has_integral_combine_division:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9101
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9102
  assumes "d division_of s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9103
    and "\<forall>k\<in>d. (f has_integral (i k)) k"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9104
  shows "(f has_integral (setsum i d)) s"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9105
proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9106
  note d = division_ofD[OF assms(1)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9107
  show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9108
    unfolding d(6)[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9109
    apply (rule has_integral_unions)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9110
    apply (rule d assms)+
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9111
    apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9112
    apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9113
    apply rule
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  9114
  proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  9115
    case prems: (1 s s')
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9116
    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
  9117
    from d(5)[OF prems] show ?case
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9118
      unfolding obt interior_cbox
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9119
      apply -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9120
      apply (rule negligible_subset[of "(cbox a b-box a b) \<union> (cbox c d-box c d)"])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9121
      apply (rule negligible_union negligible_frontier_interval)+
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9122
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9123
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9124
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9125
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9126
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9127
lemma integral_combine_division_bottomup:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9128
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9129
  assumes "d division_of s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9130
    and "\<forall>k\<in>d. f integrable_on k"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9131
  shows "integral s f = setsum (\<lambda>i. integral i f) d"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9132
  apply (rule integral_unique)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9133
  apply (rule has_integral_combine_division[OF assms(1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9134
  using assms(2)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9135
  unfolding has_integral_integral
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9136
  apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9137
  done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9138
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9139
lemma has_integral_combine_division_topdown:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9140
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9141
  assumes "f integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9142
    and "d division_of k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9143
    and "k \<subseteq> s"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9144
  shows "(f has_integral (setsum (\<lambda>i. integral i f) d)) k"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9145
  apply (rule has_integral_combine_division[OF assms(2)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9146
  apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9147
  unfolding has_integral_integral[symmetric]
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  9148
proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9149
  case (1 k)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9150
  from division_ofD(2,4)[OF assms(2) this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9151
  show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9152
    apply safe
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9153
    apply (rule integrable_on_subcbox)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9154
    apply (rule assms)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9155
    using assms(3)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9156
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9157
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9158
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9159
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9160
lemma integral_combine_division_topdown:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9161
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9162
  assumes "f integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9163
    and "d division_of s"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9164
  shows "integral s f = setsum (\<lambda>i. integral i f) d"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9165
  apply (rule integral_unique)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9166
  apply (rule has_integral_combine_division_topdown)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9167
  using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9168
  apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9169
  done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9170
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9171
lemma integrable_combine_division:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9172
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9173
  assumes "d division_of s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9174
    and "\<forall>i\<in>d. f integrable_on i"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9175
  shows "f integrable_on s"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9176
  using assms(2)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9177
  unfolding integrable_on_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9178
  by (metis has_integral_combine_division[OF assms(1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9179
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9180
lemma integrable_on_subdivision:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9181
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9182
  assumes "d division_of i"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9183
    and "f integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9184
    and "i \<subseteq> s"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9185
  shows "f integrable_on i"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9186
  apply (rule integrable_combine_division assms)+
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9187
  apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  9188
proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9189
  case 1
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9190
  note division_ofD(2,4)[OF assms(1) this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9191
  then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9192
    apply safe
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9193
    apply (rule integrable_on_subcbox[OF assms(2)])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9194
    using assms(3)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9195
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9196
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9197
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9198
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9199
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  9200
subsection \<open>Also tagged divisions\<close>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9201
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9202
lemma has_integral_combine_tagged_division:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9203
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9204
  assumes "p tagged_division_of s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9205
    and "\<forall>(x,k) \<in> p. (f has_integral (i k)) k"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9206
  shows "(f has_integral (setsum (\<lambda>(x,k). i k) p)) s"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9207
proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9208
  have *: "(f has_integral (setsum (\<lambda>k. integral k f) (snd ` p))) s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9209
    apply (rule has_integral_combine_division)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9210
    apply (rule division_of_tagged_division[OF assms(1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9211
    using assms(2)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9212
    unfolding has_integral_integral[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9213
    apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9214
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9215
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9216
  then show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9217
    apply -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9218
    apply (rule subst[where P="\<lambda>i. (f has_integral i) s"])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9219
    defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9220
    apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9221
    apply (rule trans[of _ "setsum (\<lambda>(x,k). integral k f) p"])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9222
    apply (subst eq_commute)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9223
    apply (rule setsum_over_tagged_division_lemma[OF assms(1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9224
    apply (rule integral_null)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9225
    apply assumption
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  9226
    apply (rule setsum.cong)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9227
    using assms(2)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9228
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9229
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9230
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9231
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9232
lemma integral_combine_tagged_division_bottomup:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9233
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9234
  assumes "p tagged_division_of (cbox a b)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9235
    and "\<forall>(x,k)\<in>p. f integrable_on k"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9236
  shows "integral (cbox a b) f = setsum (\<lambda>(x,k). integral k f) p"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9237
  apply (rule integral_unique)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9238
  apply (rule has_integral_combine_tagged_division[OF assms(1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9239
  using assms(2)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9240
  apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9241
  done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9242
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9243
lemma has_integral_combine_tagged_division_topdown:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9244
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9245
  assumes "f integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9246
    and "p tagged_division_of (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9247
  shows "(f has_integral (setsum (\<lambda>(x,k). integral k f) p)) (cbox a b)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9248
  apply (rule has_integral_combine_tagged_division[OF assms(2)])
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9249
  apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  9250
proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9251
  case 1
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9252
  note tagged_division_ofD(3-4)[OF assms(2) this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9253
  then show ?case
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54411
diff changeset
  9254
    using integrable_subinterval[OF assms(1)] by blast
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9255
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9256
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9257
lemma integral_combine_tagged_division_topdown:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9258
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9259
  assumes "f integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9260
    and "p tagged_division_of (cbox a b)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9261
  shows "integral (cbox a b) f = setsum (\<lambda>(x,k). integral k f) p"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9262
  apply (rule integral_unique)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9263
  apply (rule has_integral_combine_tagged_division_topdown)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9264
  using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9265
  apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9266
  done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9267
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9268
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  9269
subsection \<open>Henstock's lemma\<close>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9270
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9271
lemma henstock_lemma_part1:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9272
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9273
  assumes "f integrable_on cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9274
    and "e > 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9275
    and "gauge d"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9276
    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
  9277
      norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p - integral(cbox a b) f) < e)"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9278
    and p: "p tagged_partial_division_of (cbox a b)" "d fine p"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9279
  shows "norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x - integral k f) p) \<le> e"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9280
  (is "?x \<le> e")
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9281
proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9282
  { 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
  9283
  fix k :: real
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9284
  assume k: "k > 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9285
  note p' = tagged_partial_division_ofD[OF p(1)]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9286
  have "\<Union>(snd ` p) \<subseteq> cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9287
    using p'(3) by fastforce
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9288
  note partial_division_of_tagged_division[OF p(1)] this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9289
  from partial_division_extend_interval[OF this] guess q . note q=this and q' = division_ofD[OF this(2)]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9290
  def r \<equiv> "q - snd ` p"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9291
  have "snd ` p \<inter> r = {}"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9292
    unfolding r_def by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9293
  have r: "finite r"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9294
    using q' unfolding r_def by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9295
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9296
  have "\<forall>i\<in>r. \<exists>p. p tagged_division_of i \<and> d fine p \<and>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9297
    norm (setsum (\<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
  9298
    apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  9299
  proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9300
    case (1 i)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9301
    then have i: "i \<in> q"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9302
      unfolding r_def by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9303
    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
  9304
    have *: "k / (real (card r) + 1) > 0" using k by simp
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9305
    have "f integrable_on cbox u v"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9306
      apply (rule integrable_subinterval[OF assms(1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9307
      using q'(2)[OF i]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9308
      unfolding uv
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9309
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9310
      done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9311
    note integrable_integral[OF this, unfolded has_integral[of f]]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9312
    from this[rule_format,OF *] guess dd .. note dd=conjunctD2[OF this,rule_format]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  9313
    note gauge_inter[OF \<open>gauge d\<close> dd(1)]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9314
    from fine_division_exists[OF this,of u v] guess qq .
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9315
    then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9316
      apply (rule_tac x=qq in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9317
      using dd(2)[of qq]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9318
      unfolding fine_inter uv
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9319
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9320
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9321
  qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9322
  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
  9323
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9324
  let ?p = "p \<union> \<Union>(qq ` r)"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9325
  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
  9326
    apply (rule assms(4)[rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9327
  proof
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9328
    show "d fine ?p"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9329
      apply (rule fine_union)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9330
      apply (rule p)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9331
      apply (rule fine_unions)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9332
      using qq
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9333
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9334
      done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9335
    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
  9336
    have "p \<union> \<Union>(qq ` r) tagged_division_of \<Union>(snd ` p) \<union> \<Union>r"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9337
      using r
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  9338
    proof (rule tagged_division_union[OF * tagged_division_unions], goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9339
      case 1
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9340
      then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9341
        using qq by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9342
    next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9343
      case 2
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9344
      then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9345
        apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9346
        apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9347
        apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9348
        apply(rule q'(5))
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9349
        unfolding r_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9350
        apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9351
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9352
    next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9353
      case 3
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9354
      then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9355
        apply (rule inter_interior_unions_intervals)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9356
        apply fact
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9357
        apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9358
        apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9359
        apply (rule q')
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9360
        defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9361
        apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9362
        apply (subst Int_commute)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9363
        apply (rule inter_interior_unions_intervals)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9364
        apply (rule finite_imageI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9365
        apply (rule p')
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9366
        apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9367
        defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9368
        apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9369
        apply (rule q')
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9370
        using q(1) p'
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9371
        unfolding r_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9372
        apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9373
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9374
    qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9375
    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
  9376
      unfolding Union_Un_distrib[symmetric] r_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9377
      using q
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9378
      by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9379
    ultimately show "?p tagged_division_of (cbox a b)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9380
      by fastforce
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9381
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9382
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9383
  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
  9384
    integral (cbox a b) f) < e"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  9385
    apply (subst setsum.union_inter_neutral[symmetric])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9386
    apply (rule p')
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9387
    prefer 3
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9388
    apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9389
    apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9390
    apply (rule finite_imageI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9391
    apply (rule r)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9392
    apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9393
    apply (drule qq)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9394
  proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9395
    fix x l k
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9396
    assume as: "(x, l) \<in> p" "(x, l) \<in> qq k" "k \<in> r"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9397
    note qq[OF this(3)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9398
    note tagged_division_ofD(3,4)[OF conjunct1[OF this] as(2)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9399
    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
  9400
    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
  9401
    then have "l \<in> q" "k \<in> q" "l \<noteq> k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9402
      using as(1,3) q(1) unfolding r_def by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9403
    note q'(5)[OF this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9404
    then have "interior l = {}"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  9405
      using interior_mono[OF \<open>l \<subseteq> k\<close>] by blast
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9406
    then show "content l *\<^sub>R f x = 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9407
      unfolding uv content_eq_0_interior[symmetric] by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9408
  qed auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9409
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9410
  then have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) + setsum (setsum (\<lambda>(x, k). content k *\<^sub>R f x))
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9411
    (qq ` r) - integral (cbox a b) f) < e"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  9412
    apply (subst (asm) setsum.Union_comp)
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  9413
    prefer 2
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9414
    unfolding split_paired_all split_conv image_iff
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9415
    apply (erule bexE)+
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9416
  proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9417
    fix x m k l T1 T2
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9418
    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
  9419
    note as = this(1-5)[unfolded this(6-)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9420
    note kl = tagged_division_ofD(3,4)[OF qq[THEN conjunct1]]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9421
    from this(2)[OF as(4,1)] guess u v by (elim exE) note uv=this
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9422
    have *: "interior (k \<inter> l) = {}"
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61424
diff changeset
  9423
      unfolding interior_Int
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9424
      apply (rule q')
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9425
      using as
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9426
      unfolding r_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9427
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9428
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9429
    have "interior m = {}"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9430
      unfolding subset_empty[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9431
      unfolding *[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9432
      apply (rule interior_mono)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9433
      using kl(1)[OF as(4,1)] kl(1)[OF as(5,2)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9434
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9435
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9436
    then show "content m *\<^sub>R f x = 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9437
      unfolding uv content_eq_0_interior[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9438
      by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9439
  qed (insert qq, auto)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9440
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9441
  then have **: "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) + setsum (setsum (\<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
  9442
    integral (cbox a b) f) < e"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  9443
    apply (subst (asm) setsum.reindex_nontrivial)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9444
    apply fact
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  9445
    apply (rule setsum.neutral)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9446
    apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9447
    unfolding split_paired_all split_conv
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9448
    defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9449
    apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9450
  proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9451
    fix k l x m
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9452
    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
  9453
    note tagged_division_ofD(6)[OF qq[THEN conjunct1]]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9454
    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
  9455
      using as(3) unfolding as by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9456
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9457
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9458
  have *: "norm (cp - ip) \<le> e + k"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9459
    if "norm ((cp + cr) - i) < e"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9460
    and "norm (cr - ir) < k"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9461
    and "ip + ir = i"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9462
    for ir ip i cr cp
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9463
  proof -
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9464
    from that show ?thesis
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9465
      using norm_triangle_le[of "cp + cr - i" "- (cr - ir)"]
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9466
      unfolding that(3)[symmetric] norm_minus_cancel
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9467
      by (auto simp add: algebra_simps)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9468
  qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9469
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9470
  have "?x =  norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p. integral k f))"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9471
    unfolding split_def setsum_subtractf ..
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9472
  also have "\<dots> \<le> e + k"
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9473
    apply (rule *[OF **, where ir2="setsum (\<lambda>k. integral k f) r"])
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  9474
  proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  9475
    case 1
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  9476
    have *: "k * real (card r) / (1 + real (card r)) < k"
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  9477
      using k by (auto simp add: field_simps)
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  9478
    show ?case
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  9479
      apply (rule le_less_trans[of _ "setsum (\<lambda>x. k / (real (card r) + 1)) r"])
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  9480
      unfolding setsum_subtractf[symmetric]
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  9481
      apply (rule setsum_norm_le)
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  9482
      apply rule
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  9483
      apply (drule qq)
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  9484
      defer
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  9485
      unfolding divide_inverse setsum_left_distrib[symmetric]
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  9486
      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
  9487
      using * apply (auto simp add: field_simps)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  9488
      done
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  9489
  next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9490
    case 2
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9491
    have *: "(\<Sum>(x, k)\<in>p. integral k f) = (\<Sum>k\<in>snd ` p. integral k f)"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  9492
      apply (subst setsum.reindex_nontrivial)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9493
      apply fact
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9494
      unfolding split_paired_all snd_conv split_def o_def
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9495
    proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9496
      fix x l y m
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9497
      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
  9498
      from p'(4)[OF as(1)] guess u v by (elim exE) note uv=this
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9499
      show "integral l f = 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9500
        unfolding uv
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9501
        apply (rule integral_unique)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9502
        apply (rule has_integral_null)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9503
        unfolding content_eq_0_interior
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9504
        using p'(5)[OF as(1-3)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9505
        unfolding uv as(4)[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9506
        apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9507
        done
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9508
    qed auto
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  9509
    from q(1) have **: "snd ` p \<union> q = q" by auto
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9510
    show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9511
      unfolding integral_combine_division_topdown[OF assms(1) q(2)] * r_def
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  9512
      using ** q'(1) p'(1) setsum.union_disjoint [of "snd ` p" "q - snd ` p" "\<lambda>k. integral k f", symmetric]
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  9513
        by simp
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9514
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9515
  finally show "?x \<le> e + k" .
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9516
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9517
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9518
lemma henstock_lemma_part2:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9519
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9520
  assumes "f integrable_on cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9521
    and "e > 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9522
    and "gauge d"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9523
    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
  9524
      norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p - integral (cbox a b) f) < e"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9525
    and "p tagged_partial_division_of (cbox a b)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9526
    and "d fine p"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9527
  shows "setsum (\<lambda>(x,k). norm (content k *\<^sub>R f x - integral k f)) p \<le> 2 * real (DIM('n)) * e"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9528
  unfolding split_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9529
  apply (rule setsum_norm_allsubsets_bound)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9530
  defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9531
  apply (rule henstock_lemma_part1[unfolded split_def,OF assms(1-3)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9532
  apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9533
  apply (rule assms[rule_format,unfolded split_def])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9534
  defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9535
  apply (rule tagged_partial_division_subset)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9536
  apply (rule assms)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9537
  apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9538
  apply (rule fine_subset)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9539
  apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9540
  apply (rule assms)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9541
  using assms(5)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9542
  apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9543
  done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9544
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9545
lemma henstock_lemma:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9546
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9547
  assumes "f integrable_on cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9548
    and "e > 0"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9549
  obtains d where "gauge d"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9550
    and "\<forall>p. p tagged_partial_division_of (cbox a b) \<and> d fine p \<longrightarrow>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9551
      setsum (\<lambda>(x,k). norm(content k *\<^sub>R f x - integral k f)) p < e"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9552
proof -
56541
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56536
diff changeset
  9553
  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
  9554
  from integrable_integral[OF assms(1),unfolded has_integral[of f],rule_format,OF this]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9555
  guess d .. note d = conjunctD2[OF this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9556
  show thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9557
    apply (rule that)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9558
    apply (rule d)
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  9559
  proof (safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9560
    case (1 p)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9561
    note * = henstock_lemma_part2[OF assms(1) * d this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9562
    show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9563
      apply (rule le_less_trans[OF *])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  9564
      using \<open>e > 0\<close>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9565
      apply (auto simp add: field_simps)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9566
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9567
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9568
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9569
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9570
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  9571
subsection \<open>Geometric progression\<close>
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  9572
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  9573
text \<open>FIXME: Should one or more of these theorems be moved to @{file
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  9574
"~~/src/HOL/Set_Interval.thy"}, alongside @{text geometric_sum}?\<close>
44514
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9575
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9576
lemma sum_gp_basic:
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9577
  fixes x :: "'a::ring_1"
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9578
  shows "(1 - x) * setsum (\<lambda>i. x^i) {0 .. n} = (1 - x^(Suc n))"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9579
proof -
44514
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9580
  def y \<equiv> "1 - x"
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9581
  have "y * (\<Sum>i=0..n. (1 - y) ^ i) = 1 - (1 - y) ^ Suc n"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9582
    by (induct n) (simp_all add: algebra_simps)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9583
  then show ?thesis
44514
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9584
    unfolding y_def by simp
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9585
qed
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9586
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9587
lemma sum_gp_multiplied:
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9588
  assumes mn: "m \<le> n"
44514
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9589
  shows "((1::'a::{field}) - x) * setsum (op ^ x) {m..n} = x^m - x^ Suc n"
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9590
  (is "?lhs = ?rhs")
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9591
proof -
44514
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9592
  let ?S = "{0..(n - m)}"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9593
  from mn have mn': "n - m \<ge> 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9594
    by arith
44514
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9595
  let ?f = "op + m"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9596
  have i: "inj_on ?f ?S"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9597
    unfolding inj_on_def by auto
44514
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9598
  have f: "?f ` ?S = {m..n}"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9599
    using mn
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9600
    apply (auto simp add: image_iff Bex_def)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9601
    apply presburger
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9602
    done
44514
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9603
  have th: "op ^ x o op + m = (\<lambda>i. x^m * x^i)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9604
    by (rule ext) (simp add: power_add power_mult)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  9605
  from setsum.reindex[OF i, of "op ^ x", unfolded f th setsum_right_distrib[symmetric]]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9606
  have "?lhs = x^m * ((1 - x) * setsum (op ^ x) {0..n - m})"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9607
    by simp
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9608
  then show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9609
    unfolding sum_gp_basic
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9610
    using mn
44514
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9611
    by (simp add: field_simps power_add[symmetric])
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9612
qed
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9613
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9614
lemma sum_gp:
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9615
  "setsum (op ^ (x::'a::{field})) {m .. n} =
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9616
    (if n < m then 0
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9617
     else if x = 1 then of_nat ((n + 1) - m)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9618
     else (x^ m - x^ (Suc n)) / (1 - x))"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9619
proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9620
  {
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9621
    assume nm: "n < m"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9622
    then have ?thesis by simp
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9623
  }
44514
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9624
  moreover
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9625
  {
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9626
    assume "\<not> n < m"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9627
    then have nm: "m \<le> n"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9628
      by arith
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9629
    {
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9630
      assume x: "x = 1"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9631
      then have ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9632
        by simp
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9633
    }
44514
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9634
    moreover
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9635
    {
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9636
      assume x: "x \<noteq> 1"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9637
      then have nz: "1 - x \<noteq> 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9638
        by simp
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9639
      from sum_gp_multiplied[OF nm, of x] nz have ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9640
        by (simp add: field_simps)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9641
    }
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9642
    ultimately have ?thesis by blast
44514
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9643
  }
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9644
  ultimately show ?thesis by blast
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9645
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9646
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9647
lemma sum_gp_offset:
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9648
  "setsum (op ^ (x::'a::{field})) {m .. m+n} =
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9649
    (if x = 1 then of_nat n + 1 else x^m * (1 - x^Suc n) / (1 - x))"
44514
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9650
  unfolding sum_gp[of x m "m + n"] power_Suc
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9651
  by (simp add: field_simps power_add)
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9652
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9653
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  9654
subsection \<open>Monotone convergence (bounded interval first)\<close>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9655
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9656
lemma monotone_convergence_interval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9657
  fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9658
  assumes "\<forall>k. (f k) integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9659
    and "\<forall>k. \<forall>x\<in>cbox a b.(f k x) \<le> f (Suc k) x"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9660
    and "\<forall>x\<in>cbox a b. ((\<lambda>k. f k x) ---> g x) sequentially"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9661
    and "bounded {integral (cbox a b) (f k) | k . k \<in> UNIV}"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9662
  shows "g integrable_on cbox a b \<and> ((\<lambda>k. integral (cbox a b) (f k)) ---> integral (cbox a b) g) sequentially"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9663
proof (cases "content (cbox a b) = 0")
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9664
  case True
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9665
  show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9666
    using integrable_on_null[OF True]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9667
    unfolding integral_null[OF True]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9668
    using tendsto_const
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9669
    by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9670
next
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9671
  case False
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9672
  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
  9673
  proof safe
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9674
    fix x k
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9675
    assume x: "x \<in> cbox a b"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9676
    note * = Lim_component_ge[OF assms(3)[rule_format, OF x] trivial_limit_sequentially]
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9677
    show "f k x \<bullet> 1 \<le> g x \<bullet> 1"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9678
      apply (rule *)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9679
      unfolding eventually_sequentially
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9680
      apply (rule_tac x=k in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9681
      apply -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9682
      apply (rule transitive_stepwise_le)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9683
      using assms(2)[rule_format, OF x]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9684
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9685
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9686
  qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9687
  have "\<exists>i. ((\<lambda>k. integral (cbox a b) (f k)) ---> i) sequentially"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9688
    apply (rule bounded_increasing_convergent)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9689
    defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9690
    apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9691
    apply (rule integral_le)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9692
    apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9693
    apply (rule assms(1-2)[rule_format])+
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9694
    using assms(4)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9695
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9696
    done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9697
  then guess i .. note i=this
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9698
  have i': "\<And>k. (integral(cbox a b) (f k)) \<le> i\<bullet>1"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9699
    apply (rule Lim_component_ge)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9700
    apply (rule i)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9701
    apply (rule trivial_limit_sequentially)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9702
    unfolding eventually_sequentially
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9703
    apply (rule_tac x=k in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9704
    apply (rule transitive_stepwise_le)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9705
    prefer 3
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9706
    unfolding inner_simps real_inner_1_right
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9707
    apply (rule integral_le)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9708
    apply (rule assms(1-2)[rule_format])+
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9709
    using assms(2)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9710
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9711
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9712
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9713
  have "(g has_integral i) (cbox a b)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9714
    unfolding has_integral
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
  9715
  proof (safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9716
    case e: (1 e)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9717
    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
  9718
      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
  9719
      apply -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9720
      apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9721
      apply (rule assms(1)[unfolded has_integral_integral has_integral,rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9722
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9723
      done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9724
    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
  9725
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9726
    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
  9727
    proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9728
      have "e/4 > 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9729
        using e by auto
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
  9730
      from LIMSEQ_D [OF i this] guess r ..
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9731
      then show ?thesis
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9732
        apply (rule_tac x=r in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9733
        apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9734
        apply (erule_tac x=k in allE)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9735
        subgoal for k using i'[of k] by auto
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9736
        done
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9737
    qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9738
    then guess r .. note r=conjunctD2[OF this[rule_format]]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9739
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9740
    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
  9741
      (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
  9742
    proof (rule, goal_cases)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  9743
      case prems: (1 x)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9744
      have "e / (4 * content (cbox a b)) > 0"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
  9745
        using \<open>e>0\<close> False content_pos_le[of a b] by auto
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  9746
      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
  9747
      guess n .. note n=this
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9748
      then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9749
        apply (rule_tac x="n + r" in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9750
        apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9751
        apply (erule_tac[2-3] x=k in allE)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9752
        unfolding dist_real_def
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
  9753
        using fg[rule_format, OF prems]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9754
        apply (auto simp add: field_simps)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9755
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9756
    qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9757
    from bchoice[OF this] guess m .. note m=conjunctD2[OF this[rule_format],rule_format]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9758
    def d \<equiv> "\<lambda>x. c (m x) x"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9759
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9760
    show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9761
      apply (rule_tac x=d in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9762
    proof safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9763
      show "gauge d"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9764
        using c(1) unfolding gauge_def d_def by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9765
    next
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9766
      fix p
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9767
      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
  9768
      note p'=tagged_division_ofD[OF p(1)]
41851
96184364aa6f got rid of lemma upper_bound_finite_set
nipkow
parents: 41601
diff changeset
  9769
      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
  9770
        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
  9771
      then guess s .. note s=this
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9772
      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
  9773
        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
  9774
      proof (safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9775
        case (1 a b c d)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9776
        then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9777
          using norm_triangle_lt[of "a - b" "b - c" "3* e/4"]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9778
            norm_triangle_lt[of "a - b + (b - c)" "c - d" e]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9779
          unfolding norm_minus_cancel
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9780
          by (auto simp add: algebra_simps)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9781
      qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9782
      show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - i) < e"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9783
        apply (rule *[rule_format,where
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9784
          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
  9785
      proof (safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9786
        case 1
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9787
        show ?case
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9788
          apply (rule order_trans[of _ "\<Sum>(x, k)\<in>p. content k * (e / (4 * content (cbox a b)))"])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9789
          unfolding setsum_subtractf[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9790
          apply (rule order_trans)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9791
          apply (rule norm_setsum)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9792
          apply (rule setsum_mono)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9793
          unfolding split_paired_all split_conv
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9794
          unfolding split_def setsum_left_distrib[symmetric] scaleR_diff_right[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9795
          unfolding additive_content_tagged_division[OF p(1), unfolded split_def]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9796
        proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9797
          fix x k
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9798
          assume xk: "(x, k) \<in> p"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9799
          then have x: "x \<in> cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9800
            using p'(2-3)[OF xk] by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9801
          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
  9802
          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
  9803
            unfolding norm_scaleR uv
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9804
            unfolding abs_of_nonneg[OF content_pos_le]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9805
            apply (rule mult_left_mono)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9806
            using m(2)[OF x,of "m x"]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9807
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9808
            done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9809
        qed (insert False, auto)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9810
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9811
      next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9812
        case 2
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9813
        show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9814
          apply (rule le_less_trans[of _ "norm (\<Sum>j = 0..s.
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9815
            \<Sum>(x, k)\<in>{xk\<in>p. m (fst xk) = j}. content k *\<^sub>R f (m x) x - integral k (f (m x)))"])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9816
          apply (subst setsum_group)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9817
          apply fact
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9818
          apply (rule finite_atLeastAtMost)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9819
          defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9820
          apply (subst split_def)+
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9821
          unfolding setsum_subtractf
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9822
          apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9823
        proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9824
          show "norm (\<Sum>j = 0..s. \<Sum>(x, k)\<in>{xk \<in> p.
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9825
            m (fst xk) = j}. content k *\<^sub>R f (m x) x - integral k (f (m x))) < e / 2"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9826
            apply (rule le_less_trans[of _ "setsum (\<lambda>i. e / 2^(i+2)) {0..s}"])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9827
            apply (rule setsum_norm_le)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9828
          proof
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9829
            show "(\<Sum>i = 0..s. e / 2 ^ (i + 2)) < e / 2"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9830
              unfolding power_add divide_inverse inverse_mult_distrib
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9831
              unfolding setsum_right_distrib[symmetric] setsum_left_distrib[symmetric]
60867
86e7560e07d0 slight cleanup of lemmas
haftmann
parents: 60810
diff changeset
  9832
              unfolding power_inverse [symmetric] sum_gp
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9833
              apply(rule mult_strict_left_mono[OF _ e])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9834
              unfolding power2_eq_square
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9835
              apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9836
              done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9837
            fix t
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9838
            assume "t \<in> {0..s}"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9839
            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
  9840
              integral k (f (m x))) \<le> e / 2 ^ (t + 2)"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9841
              apply (rule order_trans
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9842
                [of _ "norm (setsum (\<lambda>(x,k). content k *\<^sub>R f t x - integral k (f t)) {xk \<in> p. m (fst xk) = t})"])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9843
              apply (rule eq_refl)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9844
              apply (rule arg_cong[where f=norm])
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  9845
              apply (rule setsum.cong)
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
  9846
              apply (rule refl)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9847
              defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9848
              apply (rule henstock_lemma_part1)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9849
              apply (rule assms(1)[rule_format])
56541
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56536
diff changeset
  9850
              apply (simp add: e)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9851
              apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9852
              apply (rule c)+
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9853
              apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9854
              apply assumption+
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9855
              apply (rule tagged_partial_division_subset[of p])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9856
              apply (rule p(1)[unfolded tagged_division_of_def,THEN conjunct1])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9857
              defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9858
              unfolding fine_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9859
              apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9860
              apply (drule p(2)[unfolded fine_def,rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9861
              unfolding d_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9862
              apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9863
              done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9864
          qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9865
        qed (insert s, auto)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9866
      next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9867
        case 3
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9868
        note comb = integral_combine_tagged_division_topdown[OF assms(1)[rule_format] p(1)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9869
        have *: "\<And>sr sx ss ks kr::real. kr = sr \<longrightarrow> ks = ss \<longrightarrow>
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9870
          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> abs (sx - i) < e/4"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9871
          by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9872
        show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9873
          unfolding real_norm_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9874
          apply (rule *[rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9875
          apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9876
          apply (rule comb[of r])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9877
          apply (rule comb[of s])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9878
          apply (rule i'[unfolded real_inner_1_right])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9879
          apply (rule_tac[1-2] setsum_mono)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9880
          unfolding split_paired_all split_conv
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9881
          apply (rule_tac[1-2] integral_le[OF ])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9882
        proof safe
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9883
          show "0 \<le> i\<bullet>1 - (integral (cbox a b) (f r))\<bullet>1"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9884
            using r(1) by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9885
          show "i\<bullet>1 - (integral (cbox a b) (f r))\<bullet>1 < e / 4"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9886
            using r(2) by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9887
          fix x k
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9888
          assume xk: "(x, k) \<in> p"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9889
          from p'(4)[OF this] guess u v by (elim exE) note uv=this
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9890
          show "f r integrable_on k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9891
            and "f s integrable_on k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9892
            and "f (m x) integrable_on k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9893
            and "f (m x) integrable_on k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9894
            unfolding uv
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9895
            apply (rule_tac[!] integrable_on_subcbox[OF assms(1)[rule_format]])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9896
            using p'(3)[OF xk]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9897
            unfolding uv
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9898
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9899
            done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9900
          fix y
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9901
          assume "y \<in> k"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9902
          then have "y \<in> cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9903
            using p'(3)[OF xk] by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9904
          then have *: "\<And>m. \<forall>n\<ge>m. f m y \<le> f n y"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9905
            apply -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9906
            apply (rule transitive_stepwise_le)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9907
            using assms(2)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9908
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9909
            done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9910
          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
  9911
            apply (rule_tac[!] *[rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9912
            using s[rule_format,OF xk] m(1)[of x] p'(2-3)[OF xk]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9913
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9914
            done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9915
        qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9916
      qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9917
    qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9918
  qed note * = this
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9919
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9920
  have "integral (cbox a b) g = i"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9921
    by (rule integral_unique) (rule *)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9922
  then show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9923
    using i * by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9924
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9925
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9926
lemma monotone_convergence_increasing:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9927
  fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9928
  assumes "\<forall>k. (f k) integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9929
    and "\<forall>k. \<forall>x\<in>s. (f k x) \<le> (f (Suc k) x)"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9930
    and "\<forall>x\<in>s. ((\<lambda>k. f k x) ---> g x) sequentially"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9931
    and "bounded {integral s (f k)| k. True}"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9932
  shows "g integrable_on s \<and> ((\<lambda>k. integral s (f k)) ---> integral s g) sequentially"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9933
proof -
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9934
  have lem: "g integrable_on s \<and> ((\<lambda>k. integral s (f k)) ---> integral s g) sequentially"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9935
    if "\<forall>k. \<forall>x\<in>s. 0 \<le> f k x"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9936
    and "\<forall>k. (f k) integrable_on s"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9937
    and "\<forall>k. \<forall>x\<in>s. f k x \<le> f (Suc k) x"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9938
    and "\<forall>x\<in>s. ((\<lambda>k. f k x) ---> g x) sequentially"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9939
    and "bounded {integral s (f k)| k. True}"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9940
    for f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real" and g s
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9941
  proof -
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9942
    note assms=that[rule_format]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9943
    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
  9944
      apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9945
      apply (rule Lim_component_ge)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9946
      apply (rule that(4)[rule_format])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9947
      apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9948
      apply (rule trivial_limit_sequentially)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9949
      unfolding eventually_sequentially
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9950
      apply (rule_tac x=k in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9951
      apply (rule transitive_stepwise_le)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9952
      using that(3)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9953
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9954
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9955
    note fg=this[rule_format]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9956
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9957
    have "\<exists>i. ((\<lambda>k. integral s (f k)) ---> i) sequentially"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9958
      apply (rule bounded_increasing_convergent)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9959
      apply (rule that(5))
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9960
      apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9961
      apply (rule integral_le)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9962
      apply (rule that(2)[rule_format])+
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9963
      using that(3)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9964
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9965
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9966
    then guess i .. note i=this
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9967
    have "\<And>k. \<forall>x\<in>s. \<forall>n\<ge>k. f k x \<le> f n x"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9968
      apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9969
      apply (rule transitive_stepwise_le)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9970
      using that(3)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9971
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9972
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9973
    then have i': "\<forall>k. (integral s (f k))\<bullet>1 \<le> i\<bullet>1"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9974
      apply -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9975
      apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9976
      apply (rule Lim_component_ge)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9977
      apply (rule i)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9978
      apply (rule trivial_limit_sequentially)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9979
      unfolding eventually_sequentially
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9980
      apply (rule_tac x=k in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9981
      apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9982
      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
  9983
      apply simp
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
  9984
      apply (rule that(2)[rule_format])+
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9985
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9986
      done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9987
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9988
    note int = assms(2)[unfolded integrable_alt[of _ s],THEN conjunct1,rule_format]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9989
    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
  9990
      (\<lambda>x. if x \<in> t \<inter> s then f k x else 0)"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9991
      by (rule ext) auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9992
    have int': "\<And>k a b. f k integrable_on cbox a b \<inter> s"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9993
      apply (subst integrable_restrict_univ[symmetric])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9994
      apply (subst ifif[symmetric])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9995
      apply (subst integrable_restrict_univ)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9996
      apply (rule int)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
  9997
      done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9998
    have "\<And>a b. (\<lambda>x. if x \<in> s then g x else 0) integrable_on cbox a b \<and>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
  9999
      ((\<lambda>k. integral (cbox a b) (\<lambda>x. if x \<in> s then f k x else 0)) --->
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10000
      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
 10001
    proof (rule monotone_convergence_interval, safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10002
      case 1
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10003
      show ?case by (rule int)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10004
    next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10005
      case (2 _ _ _ x)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10006
      then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10007
        apply (cases "x \<in> s")
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10008
        using assms(3)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10009
        apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10010
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10011
    next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10012
      case (3 _ _ x)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10013
      then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10014
        apply (cases "x \<in> s")
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10015
        using assms(4)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10016
        apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10017
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10018
    next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10019
      case (4 a b)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10020
      note * = integral_nonneg
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10021
      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
 10022
        unfolding real_norm_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10023
        apply (subst abs_of_nonneg)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10024
        apply (rule *[OF int])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10025
        apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10026
        apply (case_tac "x \<in> s")
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10027
        apply (drule assms(1))
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10028
        prefer 3
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10029
        apply (subst abs_of_nonneg)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10030
        apply (rule *[OF assms(2) that(1)[THEN spec]])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10031
        apply (subst integral_restrict_univ[symmetric,OF int])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10032
        unfolding ifif
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10033
        unfolding integral_restrict_univ[OF int']
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10034
        apply (rule integral_subset_le[OF _ int' assms(2)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10035
        using assms(1)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10036
        apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10037
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10038
      then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10039
        using assms(5)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10040
        unfolding bounded_iff
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10041
        apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10042
        apply (rule_tac x=aa in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10043
        apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10044
        apply (erule_tac x="integral s (f k)" in ballE)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10045
        apply (rule order_trans)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10046
        apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10047
        apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10048
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10049
    qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10050
    note g = conjunctD2[OF this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10051
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10052
    have "(g has_integral i) s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10053
      unfolding has_integral_alt'
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10054
      apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10055
      apply (rule g(1))
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 10056
    proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10057
      case (1 e)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10058
      then have "e/4>0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10059
        by auto
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
 10060
      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
 10061
      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
 10062
      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
 10063
      show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10064
        apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10065
        apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10066
        apply (rule B)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10067
        apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10068
      proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10069
        fix a b :: 'n
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10070
        assume ab: "ball 0 B \<subseteq> cbox a b"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
 10071
        from \<open>e > 0\<close> have "e/2 > 0"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10072
          by auto
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
 10073
        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
 10074
        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
 10075
          apply (rule norm_triangle_half_l)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10076
          using B(2)[rule_format,OF ab] N[rule_format,of N]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10077
          apply -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10078
          defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10079
          apply (subst norm_minus_commute)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10080
          apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10081
          done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10082
        have *: "\<And>f1 f2 g. abs (f1 - i) < e / 2 \<longrightarrow> abs (f2 - g) < e / 2 \<longrightarrow>
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10083
          f1 \<le> f2 \<longrightarrow> f2 \<le> i \<longrightarrow> abs (g - i) < e"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10084
          unfolding real_inner_1_right by arith
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10085
        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
 10086
          unfolding real_norm_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10087
          apply (rule *[rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10088
          apply (rule **[unfolded real_norm_def])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10089
          apply (rule M[rule_format,of "M + N",unfolded real_norm_def])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10090
          apply (rule le_add1)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10091
          apply (rule integral_le[OF int int])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10092
          defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10093
          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
 10094
        proof (safe, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10095
          case (2 x)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10096
          have "\<And>m. x \<in> s \<Longrightarrow> \<forall>n\<ge>m. (f m x)\<bullet>1 \<le> (f n x)\<bullet>1"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10097
            apply (rule transitive_stepwise_le)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10098
            using assms(3)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10099
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10100
            done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10101
          then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10102
            by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10103
        next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10104
          case 1
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10105
          show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10106
            apply (subst integral_restrict_univ[symmetric,OF int])
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10107
            unfolding ifif integral_restrict_univ[OF int']
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10108
            apply (rule integral_subset_le[OF _ int'])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10109
            using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10110
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10111
            done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10112
        qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10113
      qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10114
    qed
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10115
    then show ?thesis
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10116
      apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10117
      defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10118
      apply (drule integral_unique)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10119
      using i
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10120
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10121
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10122
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10123
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10124
  have sub: "\<And>k. integral s (\<lambda>x. f k x - f 0 x) = integral s (f k) - integral s (f 0)"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10125
    apply (subst integral_sub)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10126
    apply (rule assms(1)[rule_format])+
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10127
    apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10128
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10129
  have "\<And>x m. x \<in> s \<Longrightarrow> \<forall>n\<ge>m. f m x \<le> f n x"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10130
    apply (rule transitive_stepwise_le)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10131
    using assms(2)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10132
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10133
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10134
  note * = this[rule_format]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10135
  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)) --->
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10136
    integral s (\<lambda>x. g x - f 0 x)) sequentially"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10137
    apply (rule lem)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10138
    apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 10139
  proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10140
    case (1 k x)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10141
    then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10142
      using *[of x 0 "Suc k"] by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10143
  next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10144
    case (2 k)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10145
    then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10146
      apply (rule integrable_sub)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10147
      using assms(1)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10148
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10149
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10150
  next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10151
    case (3 k x)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10152
    then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10153
      using *[of x "Suc k" "Suc (Suc k)"] by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10154
  next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10155
    case (4 x)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10156
    then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10157
      apply -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10158
      apply (rule tendsto_diff)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10159
      using LIMSEQ_ignore_initial_segment[OF assms(3)[rule_format],of x 1]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10160
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10161
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10162
  next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10163
    case 5
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10164
    then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10165
      using assms(4)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10166
      unfolding bounded_iff
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10167
      apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10168
      apply (rule_tac x="a + norm (integral s (\<lambda>x. f 0 x))" in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10169
      apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10170
      apply (erule_tac x="integral s (\<lambda>x. f (Suc k) x)" in ballE)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10171
      unfolding sub
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10172
      apply (rule order_trans[OF norm_triangle_ineq4])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10173
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10174
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10175
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10176
  note conjunctD2[OF this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10177
  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
 10178
    integrable_add[OF this(1) assms(1)[rule_format,of 0]]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10179
  then show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10180
    unfolding sub
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10181
    apply -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10182
    apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10183
    defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10184
    apply (subst(asm) integral_sub)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10185
    using assms(1)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10186
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10187
    apply (rule LIMSEQ_imp_Suc)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10188
    apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10189
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10190
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10191
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 10192
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
 10193
  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
 10194
  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
 10195
  assumes "\<And>k x. x \<in> s \<Longrightarrow> f k x \<le> f (Suc k) x"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 10196
  assumes "\<And>x. x \<in> s \<Longrightarrow> (\<lambda>k. f k x) ----> g x"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 10197
  assumes "x ----> x'"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 10198
  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
 10199
proof -
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 10200
  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
 10201
    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
 10202
  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
 10203
    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
 10204
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 10205
  have "g integrable_on s \<and> (\<lambda>k. integral s (f k)) ----> integral s g"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 10206
  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
 10207
    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
 10208
      unfolding x by (rule convergent_imp_bounded) fact
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 10209
  qed (auto intro: f)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 10210
  moreover then have "integral s g = x'"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
 10211
    by (intro LIMSEQ_unique[OF _ \<open>x ----> x'\<close>]) (simp add: x_eq)
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 10212
  ultimately show ?thesis
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 10213
    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
 10214
qed
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 10215
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10216
lemma monotone_convergence_decreasing:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10217
  fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10218
  assumes "\<forall>k. (f k) integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10219
    and "\<forall>k. \<forall>x\<in>s. f (Suc k) x \<le> f k x"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10220
    and "\<forall>x\<in>s. ((\<lambda>k. f k x) ---> g x) sequentially"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10221
    and "bounded {integral s (f k)| k. True}"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10222
  shows "g integrable_on s \<and> ((\<lambda>k. integral s (f k)) ---> integral s g) sequentially"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10223
proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10224
  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
 10225
  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
 10226
    apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10227
    unfolding image_iff
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10228
    apply (rule_tac x="integral s (f k)" in bexI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10229
    prefer 3
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10230
    apply (rule_tac x=k in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10231
    unfolding integral_neg[OF assm(1)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10232
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10233
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10234
  have "(\<lambda>x. - g x) integrable_on s \<and>
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10235
    ((\<lambda>k. integral s (\<lambda>x. - f k x)) ---> integral s (\<lambda>x. - g x)) sequentially"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10236
    apply (rule monotone_convergence_increasing)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10237
    apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10238
    apply (rule integrable_neg)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10239
    apply (rule assm)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10240
    defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10241
    apply (rule tendsto_minus)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10242
    apply (rule assm)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10243
    apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10244
    unfolding *
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10245
    apply (rule bounded_scaling)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10246
    using assm
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10247
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10248
    done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10249
  note * = conjunctD2[OF this]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10250
  show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10251
    apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10252
    using integrable_neg[OF *(1)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10253
    defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10254
    using tendsto_minus[OF *(2)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10255
    unfolding integral_neg[OF assm(1)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10256
    unfolding integral_neg[OF *(1),symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10257
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10258
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10259
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10260
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10261
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
 10262
subsection \<open>Absolute integrability (this is the same as Lebesgue integrability)\<close>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10263
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10264
definition absolutely_integrable_on (infixr "absolutely'_integrable'_on" 46)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10265
  where "f absolutely_integrable_on s \<longleftrightarrow> f integrable_on s \<and> (\<lambda>x. (norm(f x))) integrable_on s"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10266
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10267
lemma absolutely_integrable_onI[intro?]:
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10268
  "f integrable_on s \<Longrightarrow>
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10269
    (\<lambda>x. (norm(f x))) integrable_on s \<Longrightarrow> f absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10270
  unfolding absolutely_integrable_on_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10271
  by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10272
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10273
lemma absolutely_integrable_onD[dest]:
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10274
  assumes "f absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10275
  shows "f integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10276
    and "(\<lambda>x. norm (f x)) integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10277
  using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10278
  unfolding absolutely_integrable_on_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10279
  by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10280
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10281
(*lemma absolutely_integrable_on_trans[simp]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10282
  fixes f::"'n::euclidean_space \<Rightarrow> real"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10283
  shows "(vec1 o f) absolutely_integrable_on s \<longleftrightarrow> f absolutely_integrable_on s"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
 10284
  unfolding absolutely_integrable_on_def o_def by auto*)
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
 10285
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10286
lemma integral_norm_bound_integral:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10287
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10288
  assumes "f integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10289
    and "g integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10290
    and "\<forall>x\<in>s. norm (f x) \<le> g x"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10291
  shows "norm (integral s f) \<le> integral s g"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10292
proof -
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10293
  have *: "\<And>x y. (\<forall>e::real. 0 < e \<longrightarrow> x < y + e) \<Longrightarrow> x \<le> y"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10294
    apply (rule ccontr)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10295
    apply (erule_tac x="x - y" in allE)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10296
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10297
    done
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10298
  have norm: "norm ig < dia + e"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10299
    if "norm sg \<le> dsa"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10300
    and "abs (dsa - dia) < e / 2"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10301
    and "norm (sg - ig) < e / 2"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10302
    for e dsa dia and sg ig :: 'a
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10303
    apply (rule le_less_trans[OF norm_triangle_sub[of ig sg]])
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10304
    apply (subst real_sum_of_halves[of e,symmetric])
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10305
    unfolding add.assoc[symmetric]
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10306
    apply (rule add_le_less_mono)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10307
    defer
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10308
    apply (subst norm_minus_commute)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10309
    apply (rule that(3))
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10310
    apply (rule order_trans[OF that(1)])
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10311
    using that(2)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10312
    apply arith
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10313
    done
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10314
  have lem: "norm (integral(cbox a b) f) \<le> integral (cbox a b) g"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10315
    if "f integrable_on cbox a b"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10316
    and "g integrable_on cbox a b"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10317
    and "\<forall>x\<in>cbox a b. norm (f x) \<le> g x"
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10318
    for f :: "'n \<Rightarrow> 'a" and g a b
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10319
  proof (rule *[rule_format])
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10320
    fix e :: real
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10321
    assume "e > 0"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10322
    then have *: "e/2 > 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10323
      by auto
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10324
    from integrable_integral[OF that(1),unfolded has_integral[of f],rule_format,OF *]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10325
    guess d1 .. note d1 = conjunctD2[OF this,rule_format]
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10326
    from integrable_integral[OF that(2),unfolded has_integral[of g],rule_format,OF *]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10327
    guess d2 .. note d2 = conjunctD2[OF this,rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10328
    note gauge_inter[OF d1(1) d2(1)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10329
    from fine_division_exists[OF this, of a b] guess p . note p=this
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10330
    show "norm (integral (cbox a b) f) < integral (cbox a b) g + e"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10331
      apply (rule norm)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10332
      defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10333
      apply (rule d2(2)[OF conjI[OF p(1)],unfolded real_norm_def])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10334
      defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10335
      apply (rule d1(2)[OF conjI[OF p(1)]])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10336
      defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10337
      apply (rule setsum_norm_le)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10338
    proof safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10339
      fix x k
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10340
      assume "(x, k) \<in> p"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10341
      note as = tagged_division_ofD(2-4)[OF p(1) this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10342
      from this(3) guess u v by (elim exE) note uv=this
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10343
      show "norm (content k *\<^sub>R f x) \<le> content k *\<^sub>R g x"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10344
        unfolding uv norm_scaleR
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10345
        unfolding abs_of_nonneg[OF content_pos_le] real_scaleR_def
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10346
        apply (rule mult_left_mono)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10347
        using that(3) as
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10348
        apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10349
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10350
    qed (insert p[unfolded fine_inter], auto)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10351
  qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10352
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
 10353
  { presume "\<And>e. 0 < e \<Longrightarrow> norm (integral s f) < integral s g + e"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10354
    then show ?thesis by (rule *[rule_format]) auto }
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10355
  fix e :: real
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10356
  assume "e > 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10357
  then have e: "e/2 > 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10358
    by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10359
  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
 10360
  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
 10361
  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
 10362
  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
 10363
  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
 10364
  guess B2 .. note B2=conjunctD2[OF this[rule_format],rule_format]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10365
  from bounded_subset_cbox[OF bounded_ball, of "0::'n" "max B1 B2"]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10366
  guess a b by (elim exE) note ab=this[unfolded ball_max_Un]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10367
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10368
  have "ball 0 B1 \<subseteq> cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10369
    using ab by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10370
  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
 10371
  have "ball 0 B2 \<subseteq> cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10372
    using ab by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10373
  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
 10374
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10375
  show "norm (integral s f) < integral s g + e"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10376
    apply (rule norm)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10377
    apply (rule lem[OF f g, of a b])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10378
    unfolding integral_unique[OF z(1)] integral_unique[OF w(1)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10379
    defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10380
    apply (rule w(2)[unfolded real_norm_def])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10381
    apply (rule z(2))
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10382
    apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10383
    apply (case_tac "x \<in> s")
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10384
    unfolding if_P
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10385
    apply (rule assms(3)[rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10386
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10387
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10388
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10389
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10390
lemma integral_norm_bound_integral_component:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10391
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10392
  fixes g :: "'n \<Rightarrow> 'b::euclidean_space"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10393
  assumes "f integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10394
    and "g integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10395
    and "\<forall>x\<in>s. norm(f x) \<le> (g x)\<bullet>k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10396
  shows "norm (integral s f) \<le> (integral s g)\<bullet>k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10397
proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10398
  have "norm (integral s f) \<le> integral s ((\<lambda>x. x \<bullet> k) \<circ> g)"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10399
    apply (rule integral_norm_bound_integral[OF assms(1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10400
    apply (rule integrable_linear[OF assms(2)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10401
    apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10402
    unfolding o_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10403
    apply (rule assms)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10404
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10405
  then show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10406
    unfolding o_def integral_component_eq[OF assms(2)] .
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10407
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10408
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10409
lemma has_integral_norm_bound_integral_component:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10410
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10411
  fixes g :: "'n \<Rightarrow> 'b::euclidean_space"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10412
  assumes "(f has_integral i) s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10413
    and "(g has_integral j) s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10414
    and "\<forall>x\<in>s. norm (f x) \<le> (g x)\<bullet>k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10415
  shows "norm i \<le> j\<bullet>k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10416
  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
 10417
  unfolding integral_unique[OF assms(1)] integral_unique[OF assms(2)]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10418
  using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10419
  by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10420
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10421
lemma absolutely_integrable_le:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10422
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10423
  assumes "f absolutely_integrable_on s"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10424
  shows "norm (integral s f) \<le> integral s (\<lambda>x. norm (f x))"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10425
  apply (rule integral_norm_bound_integral)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10426
  using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10427
  apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10428
  done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10429
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10430
lemma absolutely_integrable_0[intro]:
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10431
  "(\<lambda>x. 0) absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10432
  unfolding absolutely_integrable_on_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10433
  by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10434
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10435
lemma absolutely_integrable_cmul[intro]:
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10436
  "f absolutely_integrable_on s \<Longrightarrow>
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10437
    (\<lambda>x. c *\<^sub>R f x) absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10438
  unfolding absolutely_integrable_on_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10439
  using integrable_cmul[of f s c]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10440
  using integrable_cmul[of "\<lambda>x. norm (f x)" s "abs c"]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10441
  by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10442
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10443
lemma absolutely_integrable_neg[intro]:
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10444
  "f absolutely_integrable_on s \<Longrightarrow>
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10445
    (\<lambda>x. -f(x)) absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10446
  apply (drule absolutely_integrable_cmul[where c="-1"])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10447
  apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10448
  done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10449
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10450
lemma absolutely_integrable_norm[intro]:
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10451
  "f absolutely_integrable_on s \<Longrightarrow>
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10452
    (\<lambda>x. norm (f x)) absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10453
  unfolding absolutely_integrable_on_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10454
  by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10455
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10456
lemma absolutely_integrable_abs[intro]:
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10457
  "f absolutely_integrable_on s \<Longrightarrow>
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10458
    (\<lambda>x. abs(f x::real)) absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10459
  apply (drule absolutely_integrable_norm)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10460
  unfolding real_norm_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10461
  apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10462
  done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10463
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10464
lemma absolutely_integrable_on_subinterval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10465
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10466
  shows "f absolutely_integrable_on s \<Longrightarrow>
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10467
    cbox a b \<subseteq> s \<Longrightarrow> f absolutely_integrable_on cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10468
  unfolding absolutely_integrable_on_def
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10469
  by (metis integrable_on_subcbox)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10470
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10471
lemma absolutely_integrable_bounded_variation:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10472
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10473
  assumes "f absolutely_integrable_on UNIV"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10474
  obtains B where "\<forall>d. d division_of (\<Union>d) \<longrightarrow> setsum (\<lambda>k. norm(integral k f)) d \<le> B"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10475
  apply (rule that[of "integral UNIV (\<lambda>x. norm (f x))"])
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10476
  apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 10477
proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10478
  case prems: (1 d)
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10479
  note d = division_ofD[OF prems(2)]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10480
  have "(\<Sum>k\<in>d. norm (integral k f)) \<le> (\<Sum>i\<in>d. integral i (\<lambda>x. norm (f x)))"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10481
    apply (rule setsum_mono,rule absolutely_integrable_le)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10482
    apply (drule d(4))
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10483
    apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10484
    apply (rule absolutely_integrable_on_subinterval[OF assms])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10485
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10486
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10487
  also have "\<dots> \<le> integral (\<Union>d) (\<lambda>x. norm (f x))"
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10488
    apply (subst integral_combine_division_topdown[OF _ prems(2)])
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10489
    using integrable_on_subdivision[OF prems(2)]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10490
    using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10491
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10492
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10493
  also have "\<dots> \<le> integral UNIV (\<lambda>x. norm (f x))"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10494
    apply (rule integral_subset_le)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10495
    using integrable_on_subdivision[OF prems(2)]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10496
    using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10497
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10498
    done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10499
  finally show ?case .
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10500
qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10501
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10502
lemma helplemma:
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10503
  assumes "setsum (\<lambda>x. norm (f x - g x)) s < e"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10504
    and "finite s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10505
  shows "abs (setsum (\<lambda>x. norm(f x)) s - setsum (\<lambda>x. norm(g x)) s) < e"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10506
  unfolding setsum_subtractf[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10507
  apply (rule le_less_trans[OF setsum_abs])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10508
  apply (rule le_less_trans[OF _ assms(1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10509
  apply (rule setsum_mono)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10510
  apply (rule norm_triangle_ineq3)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10511
  done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10512
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10513
lemma bounded_variation_absolutely_integrable_interval:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10514
  fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 10515
  assumes f: "f integrable_on cbox a b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10516
    and *: "\<forall>d. d division_of (cbox a b) \<longrightarrow> setsum (\<lambda>k. norm(integral k f)) d \<le> B"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10517
  shows "f absolutely_integrable_on cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10518
proof -
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10519
  let ?f = "\<lambda>d. \<Sum>k\<in>d. norm (integral k f)" and ?D = "{d. d division_of (cbox a b)}"
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 10520
  have D_1: "?D \<noteq> {}"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 10521
    by (rule elementary_interval[of a b]) auto
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 10522
  have D_2: "bdd_above (?f`?D)"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 10523
    by (metis * mem_Collect_eq bdd_aboveI2)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 10524
  note D = D_1 D_2
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 10525
  let ?S = "SUP x:?D. ?f x"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10526
  show ?thesis
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 10527
    apply (rule absolutely_integrable_onI [OF f has_integral_integrable])
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 10528
    apply (subst has_integral[of _ ?S])
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10529
    apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 10530
  proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10531
    case e: (1 e)
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 10532
    then have "?S - e / 2 < ?S" by simp
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10533
    then obtain d where d: "d division_of (cbox a b)" "?S - e / 2 < (\<Sum>k\<in>d. norm (integral k f))"
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 10534
      unfolding less_cSUP_iff[OF D] by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10535
    note d' = division_ofD[OF this(1)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10536
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10537
    have "\<forall>x. \<exists>e>0. \<forall>i\<in>d. x \<notin> i \<longrightarrow> ball x e \<inter> i = {}"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10538
    proof
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10539
      fix x
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10540
      have "\<exists>da>0. \<forall>xa\<in>\<Union>{i \<in> d. x \<notin> i}. da \<le> dist x xa"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10541
        apply (rule separate_point_closed)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10542
        apply (rule closed_Union)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10543
        apply (rule finite_subset[OF _ d'(1)])
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 10544
        using d'(4)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10545
        apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10546
        done
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10547
      then show "\<exists>e>0. \<forall>i\<in>d. x \<notin> i \<longrightarrow> ball x e \<inter> i = {}"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 10548
        by force
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10549
    qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10550
    from choice[OF this] guess k .. note k=conjunctD2[OF this[rule_format],rule_format]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10551
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10552
    have "e/2 > 0"
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10553
      using e by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10554
    from henstock_lemma[OF assms(1) this] guess g . note g=this[rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10555
    let ?g = "\<lambda>x. g x \<inter> ball x (k x)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10556
    show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10557
      apply (rule_tac x="?g" in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10558
      apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10559
    proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10560
      show "gauge ?g"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 10561
        using g(1) k(1)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10562
        unfolding gauge_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10563
        by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10564
      fix p
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10565
      assume "p tagged_division_of (cbox a b)" and "?g fine p"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10566
      note p = this(1) conjunctD2[OF this(2)[unfolded fine_inter]]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10567
      note p' = tagged_division_ofD[OF p(1)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10568
      def p' \<equiv> "{(x,k) | x k. \<exists>i l. x \<in> i \<and> i \<in> d \<and> (x,l) \<in> p \<and> k = i \<inter> l}"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10569
      have gp': "g fine p'"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10570
        using p(2)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10571
        unfolding p'_def fine_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10572
        by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10573
      have p'': "p' tagged_division_of (cbox a b)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10574
        apply (rule tagged_division_ofI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10575
      proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10576
        show "finite p'"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10577
          apply (rule finite_subset[of _ "(\<lambda>(k,(x,l)). (x,k \<inter> l)) `
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10578
            {(k,xl) | k xl. k \<in> d \<and> xl \<in> p}"])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10579
          unfolding p'_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10580
          defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10581
          apply (rule finite_imageI,rule finite_product_dependent[OF d'(1) p'(1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10582
          apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10583
          unfolding image_iff
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10584
          apply (rule_tac x="(i,x,l)" in bexI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10585
          apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10586
          done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10587
        fix x k
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10588
        assume "(x, k) \<in> p'"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10589
        then have "\<exists>i l. x \<in> i \<and> i \<in> d \<and> (x, l) \<in> p \<and> k = i \<inter> l"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10590
          unfolding p'_def by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10591
        then guess i l by (elim exE) note il=conjunctD4[OF this]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10592
        show "x \<in> k" and "k \<subseteq> cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10593
          using p'(2-3)[OF il(3)] il by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10594
        show "\<exists>a b. k = cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10595
          unfolding il using p'(4)[OF il(3)] d'(4)[OF il(2)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10596
          apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10597
          unfolding inter_interval
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10598
          apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10599
          done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10600
      next
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10601
        fix x1 k1
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10602
        assume "(x1, k1) \<in> p'"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10603
        then have "\<exists>i l. x1 \<in> i \<and> i \<in> d \<and> (x1, l) \<in> p \<and> k1 = i \<inter> l"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10604
          unfolding p'_def by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10605
        then guess i1 l1 by (elim exE) note il1=conjunctD4[OF this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10606
        fix x2 k2
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10607
        assume "(x2,k2)\<in>p'"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10608
        then have "\<exists>i l. x2 \<in> i \<and> i \<in> d \<and> (x2, l) \<in> p \<and> k2 = i \<inter> l"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10609
          unfolding p'_def by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10610
        then guess i2 l2 by (elim exE) note il2=conjunctD4[OF this]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10611
        assume "(x1, k1) \<noteq> (x2, k2)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10612
        then have "interior i1 \<inter> interior i2 = {} \<or> interior l1 \<inter> interior l2 = {}"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10613
          using d'(5)[OF il1(2) il2(2)] p'(5)[OF il1(3) il2(3)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10614
          unfolding il1 il2
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10615
          by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10616
        then show "interior k1 \<inter> interior k2 = {}"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10617
          unfolding il1 il2 by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10618
      next
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10619
        have *: "\<forall>(x, X) \<in> p'. X \<subseteq> cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10620
          unfolding p'_def using d' by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10621
        show "\<Union>{k. \<exists>x. (x, k) \<in> p'} = cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10622
          apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10623
          apply (rule Union_least)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10624
          unfolding mem_Collect_eq
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10625
          apply (erule exE)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10626
          apply (drule *[rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10627
          apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10628
        proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10629
          fix y
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10630
          assume y: "y \<in> cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10631
          then have "\<exists>x l. (x, l) \<in> p \<and> y\<in>l"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10632
            unfolding p'(6)[symmetric] by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10633
          then guess x l by (elim exE) note xl=conjunctD2[OF this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10634
          then have "\<exists>k. k \<in> d \<and> y \<in> k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10635
            using y unfolding d'(6)[symmetric] by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10636
          then guess i .. note i = conjunctD2[OF this]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10637
          have "x \<in> i"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10638
            using fineD[OF p(3) xl(1)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10639
            using k(2)[OF i(1), of x]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10640
            using i(2) xl(2)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10641
            by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10642
          then show "y \<in> \<Union>{k. \<exists>x. (x, k) \<in> p'}"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10643
            unfolding p'_def Union_iff
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10644
            apply (rule_tac x="i \<inter> l" in bexI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10645
            using i xl
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10646
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10647
            done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10648
        qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10649
      qed
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10650
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10651
      then have "(\<Sum>(x, k)\<in>p'. norm (content k *\<^sub>R f x - integral k f)) < e / 2"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10652
        apply -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10653
        apply (rule g(2)[rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10654
        unfolding tagged_division_of_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10655
        apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10656
        apply (rule gp')
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10657
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10658
      then have **: "\<bar>(\<Sum>(x,k)\<in>p'. norm (content k *\<^sub>R f x)) - (\<Sum>(x,k)\<in>p'. norm (integral k f))\<bar> < e / 2"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10659
        unfolding split_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10660
        using p''
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 10661
        by (force intro!: helplemma)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10662
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10663
      have p'alt: "p' = {(x,(i \<inter> l)) | x i l. (x,l) \<in> p \<and> i \<in> d \<and> i \<inter> l \<noteq> {}}"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 10664
      proof (safe, goal_cases)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10665
        case prems: (2 _ _ x i l)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10666
        have "x \<in> i"
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10667
          using fineD[OF p(3) prems(1)] k(2)[OF prems(2), of x] prems(4-)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10668
          by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10669
        then have "(x, i \<inter> l) \<in> p'"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10670
          unfolding p'_def
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10671
          using prems
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10672
          apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10673
          apply (rule_tac x=x in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10674
          apply (rule_tac x="i \<inter> l" in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10675
          apply safe
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10676
          using prems
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10677
          apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10678
          done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10679
        then show ?case
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10680
          using prems(3) by auto
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10681
      next
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10682
        fix x k
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10683
        assume "(x, k) \<in> p'"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10684
        then have "\<exists>i l. x \<in> i \<and> i \<in> d \<and> (x, l) \<in> p \<and> k = i \<inter> l"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10685
          unfolding p'_def by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10686
        then guess i l by (elim exE) note il=conjunctD4[OF this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10687
        then show "\<exists>y i l. (x, k) = (y, i \<inter> l) \<and> (y, l) \<in> p \<and> i \<in> d \<and> i \<inter> l \<noteq> {}"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10688
          apply (rule_tac x=x in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10689
          apply (rule_tac x=i in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10690
          apply (rule_tac x=l in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10691
          using p'(2)[OF il(3)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10692
          apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10693
          done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10694
      qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10695
      have sum_p': "(\<Sum>(x, k)\<in>p'. norm (integral k f)) = (\<Sum>k\<in>snd ` p'. norm (integral k f))"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10696
        apply (subst setsum_over_tagged_division_lemma[OF p'',of "\<lambda>k. norm (integral k f)"])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10697
        unfolding norm_eq_zero
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10698
        apply (rule integral_null)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10699
        apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10700
        apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10701
        done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10702
      note snd_p = division_ofD[OF division_of_tagged_division[OF p(1)]]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10703
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 10704
      have *: "\<And>sni sni' sf sf'. abs (sf' - sni') < e / 2 \<longrightarrow> ?S - e / 2 < sni \<and> sni' \<le> ?S \<and>
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 10705
        sni \<le> sni' \<and> sf' = sf \<longrightarrow> abs (sf - ?S) < e"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10706
        by arith
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 10707
      show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x)) - ?S) < e"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10708
        unfolding real_norm_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10709
        apply (rule *[rule_format,OF **])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10710
        apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10711
        apply(rule d(2))
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 10712
      proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10713
        case 1
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10714
        show ?case
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 10715
          by (auto simp: sum_p' division_of_tagged_division[OF p''] D intro!: cSUP_upper)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10716
      next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10717
        case 2
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10718
        have *: "{k \<inter> l | k l. k \<in> d \<and> l \<in> snd ` p} =
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10719
          (\<lambda>(k,l). k \<inter> l) ` {(k,l)|k l. k \<in> d \<and> l \<in> snd ` p}"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10720
          by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10721
        have "(\<Sum>k\<in>d. norm (integral k f)) \<le> (\<Sum>i\<in>d. \<Sum>l\<in>snd ` p. norm (integral (i \<inter> l) f))"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 10722
        proof (rule setsum_mono, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10723
          case k: (1 k)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10724
          from d'(4)[OF this] guess u v by (elim exE) note uv=this
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10725
          def d' \<equiv> "{cbox u v \<inter> l |l. l \<in> snd ` p \<and>  cbox u v \<inter> l \<noteq> {}}"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10726
          note uvab = d'(2)[OF k[unfolded uv]]
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10727
          have "d' division_of cbox u v"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10728
            apply (subst d'_def)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10729
            apply (rule division_inter_1)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10730
            apply (rule division_of_tagged_division[OF p(1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10731
            apply (rule uvab)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10732
            done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10733
          then have "norm (integral k f) \<le> setsum (\<lambda>k. norm (integral k f)) d'"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10734
            unfolding uv
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10735
            apply (subst integral_combine_division_topdown[of _ _ d'])
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10736
            apply (rule integrable_on_subcbox[OF assms(1) uvab])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10737
            apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10738
            apply (rule setsum_norm_le)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10739
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10740
            done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10741
          also have "\<dots> = (\<Sum>k\<in>{k \<inter> l |l. l \<in> snd ` p}. norm (integral k f))"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
 10742
            apply (rule setsum.mono_neutral_left)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10743
            apply (subst simple_image)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10744
            apply (rule finite_imageI)+
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10745
            apply fact
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10746
            unfolding d'_def uv
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10747
            apply blast
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 10748
          proof (rule, goal_cases)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10749
            case prems: (1 i)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10750
            then have "i \<in> {cbox u v \<inter> l |l. l \<in> snd ` p}"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10751
              by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10752
            from this[unfolded mem_Collect_eq] guess l .. note l=this
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10753
            then have "cbox u v \<inter> l = {}"
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10754
              using prems by auto
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10755
            then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10756
              using l by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10757
          qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10758
          also have "\<dots> = (\<Sum>l\<in>snd ` p. norm (integral (k \<inter> l) f))"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10759
            unfolding simple_image
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
 10760
            apply (rule setsum.reindex_nontrivial [unfolded o_def])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10761
            apply (rule finite_imageI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10762
            apply (rule p')
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 10763
          proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10764
            case prems: (1 l y)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10765
            have "interior (k \<inter> l) \<subseteq> interior (l \<inter> y)"
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61424
diff changeset
 10766
              apply (subst(2) interior_Int)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10767
              apply (rule Int_greatest)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10768
              defer
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10769
              apply (subst prems(4))
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10770
              apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10771
              done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10772
            then have *: "interior (k \<inter> l) = {}"
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10773
              using snd_p(5)[OF prems(1-3)] by auto
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10774
            from d'(4)[OF k] snd_p(4)[OF prems(1)] guess u1 v1 u2 v2 by (elim exE) note uv=this
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10775
            show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10776
              using *
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10777
              unfolding uv inter_interval content_eq_0_interior[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10778
              by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10779
          qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10780
          finally show ?case .
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10781
        qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10782
        also have "\<dots> = (\<Sum>(i,l)\<in>{(i, l) |i l. i \<in> d \<and> l \<in> snd ` p}. norm (integral (i\<inter>l) f))"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10783
          apply (subst sum_sum_product[symmetric])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10784
          apply fact
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10785
          using p'(1)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10786
          apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10787
          done
61424
c3658c18b7bc prod_case as canonical name for product type eliminator
haftmann
parents: 61243
diff changeset
 10788
        also have "\<dots> = (\<Sum>x\<in>{(i, l) |i l. i \<in> d \<and> l \<in> snd ` p}. norm (integral (case_prod op \<inter> x) f))"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10789
          unfolding split_def ..
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10790
        also have "\<dots> = (\<Sum>k\<in>{i \<inter> l |i l. i \<in> d \<and> l \<in> snd ` p}. norm (integral k f))"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10791
          unfolding *
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
 10792
          apply (rule setsum.reindex_nontrivial [symmetric, unfolded o_def])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10793
          apply (rule finite_product_dependent)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10794
          apply fact
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10795
          apply (rule finite_imageI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10796
          apply (rule p')
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10797
          unfolding split_paired_all mem_Collect_eq split_conv o_def
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10798
        proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10799
          note * = division_ofD(4,5)[OF division_of_tagged_division,OF p(1)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10800
          fix l1 l2 k1 k2
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10801
          assume as:
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10802
            "(l1, k1) \<noteq> (l2, k2)"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10803
            "l1 \<inter> k1 = l2 \<inter> k2"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10804
            "\<exists>i l. (l1, k1) = (i, l) \<and> i \<in> d \<and> l \<in> snd ` p"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10805
            "\<exists>i l. (l2, k2) = (i, l) \<and> i \<in> d \<and> l \<in> snd ` p"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10806
          then have "l1 \<in> d" and "k1 \<in> snd ` p"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10807
            by auto from d'(4)[OF this(1)] *(1)[OF this(2)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10808
          guess u1 v1 u2 v2 by (elim exE) note uv=this
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10809
          have "l1 \<noteq> l2 \<or> k1 \<noteq> k2"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10810
            using as by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10811
          then have "interior k1 \<inter> interior k2 = {} \<or> interior l1 \<inter> interior l2 = {}"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10812
            apply -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10813
            apply (erule disjE)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10814
            apply (rule disjI2)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10815
            apply (rule d'(5))
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10816
            prefer 4
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10817
            apply (rule disjI1)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10818
            apply (rule *)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10819
            using as
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10820
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10821
            done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10822
          moreover have "interior (l1 \<inter> k1) = interior (l2 \<inter> k2)"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10823
            using as(2) by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10824
          ultimately have "interior(l1 \<inter> k1) = {}"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10825
            by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10826
          then show "norm (integral (l1 \<inter> k1) f) = 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10827
            unfolding uv inter_interval
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10828
            unfolding content_eq_0_interior[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10829
            by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10830
        qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10831
        also have "\<dots> = (\<Sum>(x, k)\<in>p'. norm (integral k f))"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10832
          unfolding sum_p'
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
 10833
          apply (rule setsum.mono_neutral_right)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10834
          apply (subst *)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10835
          apply (rule finite_imageI[OF finite_product_dependent])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10836
          apply fact
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10837
          apply (rule finite_imageI[OF p'(1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10838
          apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 10839
        proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10840
          case (2 i ia l a b)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10841
          then have "ia \<inter> b = {}"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10842
            unfolding p'alt image_iff Bex_def not_ex
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10843
            apply (erule_tac x="(a, ia \<inter> b)" in allE)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10844
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10845
            done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10846
          then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10847
            by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10848
        next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10849
          case (1 x a b)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10850
          then show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10851
            unfolding p'_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10852
            apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10853
            apply (rule_tac x=i in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10854
            apply (rule_tac x=l in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10855
            unfolding snd_conv image_iff
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10856
            apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10857
            apply (rule_tac x="(a,l)" in bexI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10858
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10859
            done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10860
        qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10861
        finally show ?case .
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10862
      next
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 10863
        case 3
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10864
        let ?S = "{(x, i \<inter> l) |x i l. (x, l) \<in> p \<and> i \<in> d}"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10865
        have Sigma_alt: "\<And>s t. s \<times> t = {(i, j) |i j. i \<in> s \<and> j \<in> t}"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10866
          by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10867
        have *: "?S = (\<lambda>(xl,i). (fst xl, snd xl \<inter> i)) ` (p \<times> d)" (*{(xl,i)|xl i. xl\<in>p \<and> i\<in>d}"**)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10868
          apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10869
          unfolding image_iff
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10870
          apply (rule_tac x="((x,l),i)" in bexI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10871
          apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10872
          done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10873
        note pdfin = finite_cartesian_product[OF p'(1) d'(1)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10874
        have "(\<Sum>(x, k)\<in>p'. norm (content k *\<^sub>R f x)) = (\<Sum>(x, k)\<in>?S. \<bar>content k\<bar> * norm (f x))"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10875
          unfolding norm_scaleR
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
 10876
          apply (rule setsum.mono_neutral_left)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10877
          apply (subst *)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10878
          apply (rule finite_imageI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10879
          apply fact
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10880
          unfolding p'alt
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10881
          apply blast
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10882
          apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10883
          apply (rule_tac x=x in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10884
          apply (rule_tac x=i in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10885
          apply (rule_tac x=l in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10886
          apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10887
          done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10888
        also have "\<dots> = (\<Sum>((x,l),i)\<in>p \<times> d. \<bar>content (l \<inter> i)\<bar> * norm (f x))"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10889
          unfolding *
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
 10890
          apply (subst setsum.reindex_nontrivial)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10891
          apply fact
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10892
          unfolding split_paired_all
61424
c3658c18b7bc prod_case as canonical name for product type eliminator
haftmann
parents: 61243
diff changeset
 10893
          unfolding o_def split_def snd_conv fst_conv mem_Sigma_iff prod.inject
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10894
          apply (elim conjE)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10895
        proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10896
          fix x1 l1 k1 x2 l2 k2
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10897
          assume as: "(x1, l1) \<in> p" "(x2, l2) \<in> p" "k1 \<in> d" "k2 \<in> d"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10898
            "x1 = x2" "l1 \<inter> k1 = l2 \<inter> k2" "\<not> ((x1 = x2 \<and> l1 = l2) \<and> k1 = k2)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10899
          from d'(4)[OF as(3)] p'(4)[OF as(1)] guess u1 v1 u2 v2 by (elim exE) note uv=this
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10900
          from as have "l1 \<noteq> l2 \<or> k1 \<noteq> k2"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10901
            by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10902
          then have "interior k1 \<inter> interior k2 = {} \<or> interior l1 \<inter> interior l2 = {}"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10903
            apply -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10904
            apply (erule disjE)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10905
            apply (rule disjI2)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10906
            defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10907
            apply (rule disjI1)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10908
            apply (rule d'(5)[OF as(3-4)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10909
            apply assumption
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10910
            apply (rule p'(5)[OF as(1-2)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10911
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10912
            done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10913
          moreover have "interior (l1 \<inter> k1) = interior (l2 \<inter> k2)"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10914
            unfolding  as ..
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10915
          ultimately have "interior (l1 \<inter> k1) = {}"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10916
            by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10917
          then show "\<bar>content (l1 \<inter> k1)\<bar> * norm (f x1) = 0"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10918
            unfolding uv inter_interval
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10919
            unfolding content_eq_0_interior[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10920
            by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10921
        qed safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10922
        also have "\<dots> = (\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x))"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10923
          unfolding Sigma_alt
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10924
          apply (subst sum_sum_product[symmetric])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10925
          apply (rule p')
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10926
          apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10927
          apply (rule d')
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
 10928
          apply (rule setsum.cong)
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
 10929
          apply (rule refl)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10930
          unfolding split_paired_all split_conv
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10931
        proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10932
          fix x l
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10933
          assume as: "(x, l) \<in> p"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10934
          note xl = p'(2-4)[OF this]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10935
          from this(3) guess u v by (elim exE) note uv=this
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10936
          have "(\<Sum>i\<in>d. \<bar>content (l \<inter> i)\<bar>) = (\<Sum>k\<in>d. content (k \<inter> cbox u v))"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
 10937
            apply (rule setsum.cong)
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
 10938
            apply (rule refl)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10939
            apply (drule d'(4))
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10940
            apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10941
            apply (subst Int_commute)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10942
            unfolding inter_interval uv
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10943
            apply (subst abs_of_nonneg)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10944
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10945
            done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10946
          also have "\<dots> = setsum content {k \<inter> cbox u v| k. k \<in> d}"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10947
            unfolding simple_image
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
 10948
            apply (rule setsum.reindex_nontrivial [unfolded o_def, symmetric])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10949
            apply (rule d')
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 10950
          proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10951
            case prems: (1 k y)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10952
            from d'(4)[OF this(1)] d'(4)[OF this(2)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10953
            guess u1 v1 u2 v2 by (elim exE) note uv=this
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10954
            have "{} = interior ((k \<inter> y) \<inter> cbox u v)"
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61424
diff changeset
 10955
              apply (subst interior_Int)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10956
              using d'(5)[OF prems(1-3)]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10957
              apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10958
              done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10959
            also have "\<dots> = interior (y \<inter> (k \<inter> cbox u v))"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10960
              by auto
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10961
            also have "\<dots> = interior (k \<inter> cbox u v)"
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10962
              unfolding prems(4) by auto
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10963
            finally show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10964
              unfolding uv inter_interval content_eq_0_interior ..
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10965
          qed
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10966
          also have "\<dots> = setsum content {cbox u v \<inter> k |k. k \<in> d \<and> cbox u v \<inter> k \<noteq> {}}"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
 10967
            apply (rule setsum.mono_neutral_right)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10968
            unfolding simple_image
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10969
            apply (rule finite_imageI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10970
            apply (rule d')
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10971
            apply blast
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10972
            apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10973
            apply (rule_tac x=k in exI)
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 10974
          proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10975
            case prems: (1 i k)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10976
            from d'(4)[OF this(1)] guess a b by (elim exE) note ab=this
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10977
            have "interior (k \<inter> cbox u v) \<noteq> {}"
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10978
              using prems(2)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10979
              unfolding ab inter_interval content_eq_0_interior
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10980
              by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10981
            then show ?case
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 10982
              using prems(1)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 10983
              using interior_subset[of "k \<inter> cbox u v"]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10984
              by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10985
          qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10986
          finally show "(\<Sum>i\<in>d. \<bar>content (l \<inter> i)\<bar> * norm (f x)) = content l *\<^sub>R norm (f x)"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10987
            unfolding setsum_left_distrib[symmetric] real_scaleR_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10988
            apply (subst(asm) additive_content_division[OF division_inter_1[OF d(1)]])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10989
            using xl(2)[unfolded uv]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10990
            unfolding uv
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10991
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10992
            done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10993
        qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10994
        finally show ?case .
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10995
      qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10996
    qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10997
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10998
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 10999
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11000
lemma bounded_variation_absolutely_integrable:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11001
  fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11002
  assumes "f integrable_on UNIV"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11003
    and "\<forall>d. d division_of (\<Union>d) \<longrightarrow> setsum (\<lambda>k. norm (integral k f)) d \<le> B"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11004
  shows "f absolutely_integrable_on UNIV"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11005
proof (rule absolutely_integrable_onI, fact, rule)
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11006
  let ?f = "\<lambda>d. \<Sum>k\<in>d. norm (integral k f)" and ?D = "{d. d division_of  (\<Union>d)}"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11007
  have D_1: "?D \<noteq> {}"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11008
    by (rule elementary_interval) auto
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11009
  have D_2: "bdd_above (?f`?D)"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11010
    by (intro bdd_aboveI2[where M=B] assms(2)[rule_format]) simp
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11011
  note D = D_1 D_2
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11012
  let ?S = "SUP d:?D. ?f d"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11013
  have f_int: "\<And>a b. f absolutely_integrable_on cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11014
    apply (rule bounded_variation_absolutely_integrable_interval[where B=B])
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11015
    apply (rule integrable_on_subcbox[OF assms(1)])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11016
    defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11017
    apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11018
    apply (rule assms(2)[rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11019
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11020
    done
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11021
  show "((\<lambda>x. norm (f x)) has_integral ?S) UNIV"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11022
    apply (subst has_integral_alt')
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11023
    apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 11024
  proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11025
    case (1 a b)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11026
    show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11027
      using f_int[of a b] by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11028
  next
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 11029
    case prems: (2 e)
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11030
    have "\<exists>y\<in>setsum (\<lambda>k. norm (integral k f)) ` {d. d division_of \<Union>d}. \<not> y \<le> ?S - e"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11031
    proof (rule ccontr)
53842
b98c6cd90230 tuned proofs;
wenzelm
parents: 53638
diff changeset
 11032
      assume "\<not> ?thesis"
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11033
      then have "?S \<le> ?S - e"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11034
        by (intro cSUP_least[OF D(1)]) auto
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11035
      then show False
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 11036
        using prems by auto
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11037
    qed
56180
fae7a45d0fef tuned proofs
haftmann
parents: 56166
diff changeset
 11038
    then obtain K where *: "\<exists>x\<in>{d. d division_of \<Union>d}. K = (\<Sum>k\<in>x. norm (integral k f))"
56218
1c3f1f2431f9 elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
haftmann
parents: 56193
diff changeset
 11039
      "SUPREMUM {d. d division_of \<Union>d} (setsum (\<lambda>k. norm (integral k f))) - e < K"
56180
fae7a45d0fef tuned proofs
haftmann
parents: 56166
diff changeset
 11040
      by (auto simp add: image_iff not_le)
fae7a45d0fef tuned proofs
haftmann
parents: 56166
diff changeset
 11041
    from this(1) obtain d where "d division_of \<Union>d"
fae7a45d0fef tuned proofs
haftmann
parents: 56166
diff changeset
 11042
      and "K = (\<Sum>k\<in>d. norm (integral k f))"
fae7a45d0fef tuned proofs
haftmann
parents: 56166
diff changeset
 11043
      by auto
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11044
    note d = this(1) *(2)[unfolded this(2)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11045
    note d'=division_ofD[OF this(1)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11046
    have "bounded (\<Union>d)"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11047
      by (rule elementary_bounded,fact)
56180
fae7a45d0fef tuned proofs
haftmann
parents: 56166
diff changeset
 11048
    from this[unfolded bounded_pos] obtain K where
fae7a45d0fef tuned proofs
haftmann
parents: 56166
diff changeset
 11049
       K: "0 < K" "\<forall>x\<in>\<Union>d. norm x \<le> K" by auto
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11050
    show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11051
      apply (rule_tac x="K + 1" in exI)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11052
      apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11053
    proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11054
      fix a b :: 'n
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11055
      assume ab: "ball 0 (K + 1) \<subseteq> cbox a b"
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11056
      have *: "\<forall>s s1. ?S - e < s1 \<and> s1 \<le> s \<and> s < ?S + e \<longrightarrow> abs (s - ?S) < e"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11057
        by arith
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11058
      show "norm (integral (cbox a b) (\<lambda>x. if x \<in> UNIV then norm (f x) else 0) - ?S) < e"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11059
        unfolding real_norm_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11060
        apply (rule *[rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11061
        apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11062
        apply (rule d(2))
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 11063
      proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11064
        case 1
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11065
        have "(\<Sum>k\<in>d. norm (integral k f)) \<le> setsum (\<lambda>k. integral k (\<lambda>x. norm (f x))) d"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11066
          apply (rule setsum_mono)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11067
          apply (rule absolutely_integrable_le)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11068
          apply (drule d'(4))
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11069
          apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11070
          apply (rule f_int)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11071
          done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11072
        also have "\<dots> = integral (\<Union>d) (\<lambda>x. norm (f x))"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11073
          apply (rule integral_combine_division_bottomup[symmetric])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11074
          apply (rule d)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11075
          unfolding forall_in_division[OF d(1)]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11076
          using f_int
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11077
          apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11078
          done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11079
        also have "\<dots> \<le> integral (cbox a b) (\<lambda>x. if x \<in> UNIV then norm (f x) else 0)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11080
        proof -
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11081
          have "\<Union>d \<subseteq> cbox a b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11082
            apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11083
            apply (drule K(2)[rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11084
            apply (rule ab[unfolded subset_eq,rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11085
            apply (auto simp add: dist_norm)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11086
            done
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11087
          then show ?thesis
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11088
            apply -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11089
            apply (subst if_P)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11090
            apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11091
            apply (rule integral_subset_le)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11092
            defer
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11093
            apply (rule integrable_on_subdivision[of _ _ _ "cbox a b"])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11094
            apply (rule d)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11095
            using f_int[of a b]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11096
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11097
            done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11098
        qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11099
        finally show ?case .
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11100
      next
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11101
        note f = absolutely_integrable_onD[OF f_int[of a b]]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11102
        note * = this(2)[unfolded has_integral_integral has_integral[of "\<lambda>x. norm (f x)"],rule_format]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11103
        have "e/2>0"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
 11104
          using \<open>e > 0\<close> by auto
56180
fae7a45d0fef tuned proofs
haftmann
parents: 56166
diff changeset
 11105
        from * [OF this] obtain d1 where
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11106
          d1: "gauge d1" "\<forall>p. p tagged_division_of (cbox a b) \<and> d1 fine p \<longrightarrow>
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11107
            norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x)) - integral (cbox a b) (\<lambda>x. norm (f x))) < e / 2"
56180
fae7a45d0fef tuned proofs
haftmann
parents: 56166
diff changeset
 11108
          by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
 11109
        from henstock_lemma [OF f(1) \<open>e/2>0\<close>] obtain d2 where
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11110
          d2: "gauge d2" "\<forall>p. p tagged_partial_division_of (cbox a b) \<and> d2 fine p \<longrightarrow>
61424
c3658c18b7bc prod_case as canonical name for product type eliminator
haftmann
parents: 61243
diff changeset
 11111
            (\<Sum>(x, k)\<in>p. norm (content k *\<^sub>R f x - integral k f)) < e / 2" .
c3658c18b7bc prod_case as canonical name for product type eliminator
haftmann
parents: 61243
diff changeset
 11112
         obtain p where
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11113
          p: "p tagged_division_of (cbox a b)" "d1 fine p" "d2 fine p"
56180
fae7a45d0fef tuned proofs
haftmann
parents: 56166
diff changeset
 11114
          by (rule fine_division_exists [OF gauge_inter [OF d1(1) d2(1)], of a b])
fae7a45d0fef tuned proofs
haftmann
parents: 56166
diff changeset
 11115
            (auto simp add: fine_inter)
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11116
        have *: "\<And>sf sf' si di. sf' = sf \<longrightarrow> si \<le> ?S \<longrightarrow> abs (sf - si) < e / 2 \<longrightarrow>
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11117
          abs (sf' - di) < e / 2 \<longrightarrow> di < ?S + e"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11118
          by arith
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11119
        show "integral (cbox a b) (\<lambda>x. if x \<in> UNIV then norm (f x) else 0) < ?S + e"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11120
          apply (subst if_P)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11121
          apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11122
        proof (rule *[rule_format])
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11123
          show "\<bar>(\<Sum>(x,k)\<in>p. norm (content k *\<^sub>R f x)) - (\<Sum>(x,k)\<in>p. norm (integral k f))\<bar> < e / 2"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11124
            unfolding split_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11125
            apply (rule helplemma)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11126
            using d2(2)[rule_format,of p]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11127
            using p(1,3)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11128
            unfolding tagged_division_of_def split_def
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11129
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11130
            done
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11131
          show "abs ((\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x)) - integral (cbox a b) (\<lambda>x. norm(f x))) < e / 2"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11132
            using d1(2)[rule_format,OF conjI[OF p(1,2)]]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11133
            by (simp only: real_norm_def)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11134
          show "(\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x)) = (\<Sum>(x, k)\<in>p. norm (content k *\<^sub>R f x))"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
 11135
            apply (rule setsum.cong)
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
 11136
            apply (rule refl)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11137
            unfolding split_paired_all split_conv
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11138
            apply (drule tagged_division_ofD(4)[OF p(1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11139
            unfolding norm_scaleR
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11140
            apply (subst abs_of_nonneg)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11141
            apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11142
            done
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11143
          show "(\<Sum>(x, k)\<in>p. norm (integral k f)) \<le> ?S"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11144
            using partial_division_of_tagged_division[of p "cbox a b"] p(1)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11145
            apply (subst setsum_over_tagged_division_lemma[OF p(1)])
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11146
            apply (simp add: integral_null)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11147
            apply (intro cSUP_upper2[OF D(2), of "snd ` p"])
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11148
            apply (auto simp: tagged_partial_division_of_def)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11149
            done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11150
        qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11151
      qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11152
    qed (insert K, auto)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11153
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11154
qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11155
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11156
lemma absolutely_integrable_restrict_univ:
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11157
  "(\<lambda>x. if x \<in> s then f x else (0::'a::banach)) absolutely_integrable_on UNIV \<longleftrightarrow>
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11158
    f absolutely_integrable_on s"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11159
  unfolding absolutely_integrable_on_def if_distrib norm_zero integrable_restrict_univ ..
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11160
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11161
lemma absolutely_integrable_add[intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11162
  fixes f g :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11163
  assumes "f absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11164
    and "g absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11165
  shows "(\<lambda>x. f x + g x) absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11166
proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11167
  let ?P = "\<And>f g::'n \<Rightarrow> 'm. f absolutely_integrable_on UNIV \<Longrightarrow>
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11168
    g absolutely_integrable_on UNIV \<Longrightarrow> (\<lambda>x. f x + g x) absolutely_integrable_on UNIV"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11169
  {
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11170
    presume as: "PROP ?P"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11171
    note a = absolutely_integrable_restrict_univ[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11172
    have *: "\<And>x. (if x \<in> s then f x else 0) + (if x \<in> s then g x else 0) =
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11173
      (if x \<in> s then f x + g x else 0)" by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11174
    show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11175
      apply (subst a)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11176
      using as[OF assms[unfolded a[of f] a[of g]]]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11177
      apply (simp only: *)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11178
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11179
  }
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11180
  fix f g :: "'n \<Rightarrow> 'm"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11181
  assume assms: "f absolutely_integrable_on UNIV" "g absolutely_integrable_on UNIV"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11182
  note absolutely_integrable_bounded_variation
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11183
  from this[OF assms(1)] this[OF assms(2)] guess B1 B2 . note B=this[rule_format]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11184
  show "(\<lambda>x. f x + g x) absolutely_integrable_on UNIV"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11185
    apply (rule bounded_variation_absolutely_integrable[of _ "B1+B2"])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11186
    apply (rule integrable_add)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11187
    prefer 3
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11188
    apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 11189
  proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 11190
    case prems: (1 d)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11191
    have "\<And>k. k \<in> d \<Longrightarrow> f integrable_on k \<and> g integrable_on k"
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 11192
      apply (drule division_ofD(4)[OF prems])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11193
      apply safe
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11194
      apply (rule_tac[!] integrable_on_subcbox[of _ UNIV])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11195
      using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11196
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11197
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11198
    then have "(\<Sum>k\<in>d. norm (integral k (\<lambda>x. f x + g x))) \<le>
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11199
      (\<Sum>k\<in>d. norm (integral k f)) + (\<Sum>k\<in>d. norm (integral k g))"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11200
      apply -
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
 11201
      unfolding setsum.distrib [symmetric]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11202
      apply (rule setsum_mono)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11203
      apply (subst integral_add)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11204
      prefer 3
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11205
      apply (rule norm_triangle_ineq)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11206
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11207
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11208
    also have "\<dots> \<le> B1 + B2"
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 11209
      using B(1)[OF prems] B(2)[OF prems] by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11210
    finally show ?case .
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11211
  qed (insert assms, auto)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11212
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11213
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11214
lemma absolutely_integrable_sub[intro]:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11215
  fixes f g :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11216
  assumes "f absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11217
    and "g absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11218
  shows "(\<lambda>x. f x - g x) absolutely_integrable_on s"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11219
  using absolutely_integrable_add[OF assms(1) absolutely_integrable_neg[OF assms(2)]]
54230
b1d955791529 more simplification rules on unary and binary minus
haftmann
parents: 53842
diff changeset
 11220
  by (simp add: algebra_simps)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11221
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11222
lemma absolutely_integrable_linear:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11223
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11224
    and h :: "'n::euclidean_space \<Rightarrow> 'p::euclidean_space"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11225
  assumes "f absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11226
    and "bounded_linear h"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11227
  shows "(h \<circ> f) absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11228
proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11229
  {
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11230
    presume as: "\<And>f::'m \<Rightarrow> 'n. \<And>h::'n \<Rightarrow> 'p. f absolutely_integrable_on UNIV \<Longrightarrow>
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11231
      bounded_linear h \<Longrightarrow> (h \<circ> f) absolutely_integrable_on UNIV"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11232
    note a = absolutely_integrable_restrict_univ[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11233
    show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11234
      apply (subst a)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11235
      using as[OF assms[unfolded a[of f] a[of g]]]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11236
      apply (simp only: o_def if_distrib linear_simps[OF assms(2)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11237
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11238
  }
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11239
  fix f :: "'m \<Rightarrow> 'n"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11240
  fix h :: "'n \<Rightarrow> 'p"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11241
  assume assms: "f absolutely_integrable_on UNIV" "bounded_linear h"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11242
  from absolutely_integrable_bounded_variation[OF assms(1)] guess B . note B=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11243
  from bounded_linear.pos_bounded[OF assms(2)] guess b .. note b=conjunctD2[OF this]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11244
  show "(h \<circ> f) absolutely_integrable_on UNIV"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11245
    apply (rule bounded_variation_absolutely_integrable[of _ "B * b"])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11246
    apply (rule integrable_linear[OF _ assms(2)])
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11247
    apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 11248
  proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 11249
    case prems: (2 d)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11250
    have "(\<Sum>k\<in>d. norm (integral k (h \<circ> f))) \<le> setsum (\<lambda>k. norm(integral k f)) d * b"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11251
      unfolding setsum_left_distrib
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11252
      apply (rule setsum_mono)
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 11253
    proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11254
      case (1 k)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 11255
      from division_ofD(4)[OF prems this]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11256
      guess u v by (elim exE) note uv=this
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11257
      have *: "f integrable_on k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11258
        unfolding uv
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11259
        apply (rule integrable_on_subcbox[of _ UNIV])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11260
        using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11261
        apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11262
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11263
      note this[unfolded has_integral_integral]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11264
      note has_integral_linear[OF this assms(2)] integrable_linear[OF * assms(2)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11265
      note * = has_integral_unique[OF this(2)[unfolded has_integral_integral] this(1)]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11266
      show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11267
        unfolding * using b by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11268
    qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11269
    also have "\<dots> \<le> B * b"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11270
      apply (rule mult_right_mono)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 11271
      using B prems b
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11272
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11273
      done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11274
    finally show ?case .
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11275
  qed (insert assms, auto)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11276
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11277
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11278
lemma absolutely_integrable_setsum:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11279
  fixes f :: "'a \<Rightarrow> 'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11280
  assumes "finite t"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11281
    and "\<And>a. a \<in> t \<Longrightarrow> (f a) absolutely_integrable_on s"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11282
  shows "(\<lambda>x. setsum (\<lambda>a. f a x) t) absolutely_integrable_on s"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11283
  using assms(1,2)
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11284
  by induct auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11285
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
 11286
lemma bounded_linear_setsum:
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11287
  fixes f :: "'i \<Rightarrow> 'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11288
  assumes f: "\<And>i. i \<in> I \<Longrightarrow> bounded_linear (f 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
 11289
  shows "bounded_linear (\<lambda>x. \<Sum>i\<in>I. f i x)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11290
proof (cases "finite I")
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11291
  case True
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11292
  from this f 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
 11293
    by (induct I) (auto intro!: bounded_linear_add bounded_linear_zero)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11294
next
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11295
  case False
57865
dcfb33c26f50 tuned proofs -- fewer warnings;
wenzelm
parents: 57512
diff changeset
 11296
  then show ?thesis by simp
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11297
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
 11298
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11299
lemma absolutely_integrable_vector_abs:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11300
  fixes f :: "'a::euclidean_space => 'b::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11301
    and T :: "'c::euclidean_space \<Rightarrow> 'b"
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
 11302
  assumes f: "f absolutely_integrable_on s"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11303
  shows "(\<lambda>x. (\<Sum>i\<in>Basis. abs(f x\<bullet>T i) *\<^sub>R i)) absolutely_integrable_on s"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11304
  (is "?Tf absolutely_integrable_on s")
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
 11305
proof -
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11306
  have if_distrib: "\<And>P A B x. (if P then A else B) *\<^sub>R x = (if P then A *\<^sub>R x else B *\<^sub>R x)"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11307
    by 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
 11308
  have *: "\<And>x. ?Tf x = (\<Sum>i\<in>Basis.
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11309
    ((\<lambda>y. (\<Sum>j\<in>Basis. (if j = i then y else 0) *\<^sub>R j)) o
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11310
     (\<lambda>x. (norm (\<Sum>j\<in>Basis. (if j = i then f x\<bullet>T i else 0) *\<^sub>R j)))) x)"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
 11311
    by (simp add: comp_def if_distrib setsum.If_cases)
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
 11312
  show ?thesis
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11313
    unfolding *
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11314
    apply (rule absolutely_integrable_setsum[OF finite_Basis])
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11315
    apply (rule absolutely_integrable_linear)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11316
    apply (rule absolutely_integrable_norm)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11317
    apply (rule absolutely_integrable_linear[OF f, unfolded o_def])
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11318
    apply (auto simp: linear_linear euclidean_eq_iff[where 'a='c] inner_simps intro!: linearI)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11319
    done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11320
qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11321
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
 11322
lemma absolutely_integrable_max:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11323
  fixes f g :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11324
  assumes "f absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11325
    and "g absolutely_integrable_on s"
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
 11326
  shows "(\<lambda>x. (\<Sum>i\<in>Basis. max (f(x)\<bullet>i) (g(x)\<bullet>i) *\<^sub>R i)::'n) absolutely_integrable_on s"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11327
proof -
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11328
  have *:"\<And>x. (1 / 2) *\<^sub>R (((\<Sum>i\<in>Basis. \<bar>(f x - g x) \<bullet> i\<bar> *\<^sub>R i)::'n) + (f x + g x)) =
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11329
      (\<Sum>i\<in>Basis. max (f(x)\<bullet>i) (g(x)\<bullet>i) *\<^sub>R 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
 11330
    unfolding euclidean_eq_iff[where 'a='n] by (auto simp: inner_simps)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11331
  note absolutely_integrable_sub[OF assms] absolutely_integrable_add[OF assms]
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
 11332
  note absolutely_integrable_vector_abs[OF this(1), where T="\<lambda>x. x"] this(2)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11333
  note absolutely_integrable_add[OF this]
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11334
  note absolutely_integrable_cmul[OF this, of "1/2"]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11335
  then show ?thesis unfolding * .
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
 11336
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
 11337
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11338
lemma absolutely_integrable_min:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11339
  fixes f g::"'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11340
  assumes "f absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11341
    and "g absolutely_integrable_on s"
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
 11342
  shows "(\<lambda>x. (\<Sum>i\<in>Basis. min (f(x)\<bullet>i) (g(x)\<bullet>i) *\<^sub>R i)::'n) absolutely_integrable_on s"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11343
proof -
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11344
  have *:"\<And>x. (1 / 2) *\<^sub>R ((f x + g x) - (\<Sum>i\<in>Basis. \<bar>(f x - g x) \<bullet> i\<bar> *\<^sub>R i::'n)) =
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11345
      (\<Sum>i\<in>Basis. min (f(x)\<bullet>i) (g(x)\<bullet>i) *\<^sub>R 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
 11346
    unfolding euclidean_eq_iff[where 'a='n] 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
 11347
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11348
  note absolutely_integrable_add[OF assms] absolutely_integrable_sub[OF assms]
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
 11349
  note this(1) absolutely_integrable_vector_abs[OF this(2), where T="\<lambda>x. x"]
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11350
  note absolutely_integrable_sub[OF this]
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11351
  note absolutely_integrable_cmul[OF this,of "1/2"]
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11352
  then show ?thesis unfolding * .
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
 11353
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
 11354
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11355
lemma absolutely_integrable_abs_eq:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11356
  fixes f::"'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11357
  shows "f absolutely_integrable_on s \<longleftrightarrow> f integrable_on s \<and>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11358
    (\<lambda>x. (\<Sum>i\<in>Basis. abs(f x\<bullet>i) *\<^sub>R i)::'m) integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11359
  (is "?l = ?r")
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
 11360
proof
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11361
  assume ?l
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11362
  then show ?r
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11363
    apply -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11364
    apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11365
    defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11366
    apply (drule absolutely_integrable_vector_abs)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11367
    apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11368
    done
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
 11369
next
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
 11370
  assume ?r
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11371
  {
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11372
    presume lem: "\<And>f::'n \<Rightarrow> 'm. f integrable_on UNIV \<Longrightarrow>
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11373
      (\<lambda>x. (\<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i)::'m) integrable_on UNIV \<Longrightarrow>
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11374
        f absolutely_integrable_on UNIV"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11375
    have *: "\<And>x. (\<Sum>i\<in>Basis. \<bar>(if x \<in> s then f x else 0) \<bullet> i\<bar> *\<^sub>R i) =
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11376
      (if x \<in> s then (\<Sum>i\<in>Basis. \<bar>f x \<bullet> i\<bar> *\<^sub>R i) else (0::'m))"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11377
      unfolding euclidean_eq_iff[where 'a='m]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11378
      by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11379
    show ?l
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11380
      apply (subst absolutely_integrable_restrict_univ[symmetric])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11381
      apply (rule lem)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11382
      unfolding integrable_restrict_univ *
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
 11383
      using \<open>?r\<close>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11384
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11385
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11386
  }
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11387
  fix f :: "'n \<Rightarrow> 'm"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11388
  assume assms: "f integrable_on UNIV" "(\<lambda>x. (\<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i)::'m) integrable_on UNIV"
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
 11389
  let ?B = "\<Sum>i\<in>Basis. integral UNIV (\<lambda>x. (\<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i)::'m) \<bullet> i"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11390
  show "f absolutely_integrable_on UNIV"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11391
    apply (rule bounded_variation_absolutely_integrable[OF assms(1), where B="?B"])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11392
    apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 11393
  proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 11394
    case d: (1 d)
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 11395
    note d'=division_ofD[OF d]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11396
    have "(\<Sum>k\<in>d. norm (integral k f)) \<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
 11397
      (\<Sum>k\<in>d. setsum (op \<bullet> (integral k (\<lambda>x. (\<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i)::'m))) Basis)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11398
      apply (rule setsum_mono)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11399
      apply (rule order_trans[OF norm_le_l1])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11400
      apply (rule setsum_mono)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11401
      unfolding lessThan_iff
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11402
    proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11403
      fix k
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11404
      fix i :: 'm
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11405
      assume "k \<in> d" and i: "i \<in> Basis"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11406
      from d'(4)[OF this(1)] guess a b by (elim exE) note ab=this
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
 11407
      show "\<bar>integral k f \<bullet> i\<bar> \<le> integral k (\<lambda>x. (\<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i)::'m) \<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
 11408
        apply (rule abs_leI)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11409
        unfolding inner_minus_left[symmetric]
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11410
        defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11411
        apply (subst integral_neg[symmetric])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11412
        defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11413
        apply (rule_tac[1-2] integral_component_le[OF i])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11414
        apply (rule integrable_neg)
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11415
        using integrable_on_subcbox[OF assms(1),of a b]
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11416
          integrable_on_subcbox[OF assms(2),of a b] i
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11417
        unfolding ab
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11418
        apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11419
        done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11420
    qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11421
    also have "\<dots> \<le> setsum (op \<bullet> (integral UNIV (\<lambda>x. (\<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i)::'m))) Basis"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57129
diff changeset
 11422
      apply (subst setsum.commute)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11423
      apply (rule setsum_mono)
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 11424
    proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11425
      case (1 j)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11426
      have *: "(\<lambda>x. \<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i::'m) integrable_on \<Union>d"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11427
        using integrable_on_subdivision[OF d assms(2)] by auto
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11428
      have "(\<Sum>i\<in>d. integral i (\<lambda>x. \<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i::'m) \<bullet> j) =
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11429
        integral (\<Union>d) (\<lambda>x. \<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i::'m) \<bullet> j"
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
 11430
        unfolding inner_setsum_left[symmetric] integral_combine_division_topdown[OF * d] ..
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11431
      also have "\<dots> \<le> integral UNIV (\<lambda>x. \<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i::'m) \<bullet> j"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11432
        apply (rule integral_subset_component_le)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
 11433
        using assms * \<open>j \<in> Basis\<close>
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11434
        apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11435
        done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11436
      finally show ?case .
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11437
    qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11438
    finally show ?case .
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11439
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11440
qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11441
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
 11442
lemma nonnegative_absolutely_integrable:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11443
  fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11444
  assumes "\<forall>x\<in>s. \<forall>i\<in>Basis. 0 \<le> f x \<bullet> i"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11445
    and "f integrable_on s"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11446
  shows "f absolutely_integrable_on s"
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
 11447
  unfolding absolutely_integrable_abs_eq
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11448
  apply rule
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11449
  apply (rule assms)thm integrable_eq
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
 11450
  apply (rule integrable_eq[of _ f])
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11451
  using assms
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11452
  apply (auto simp: euclidean_eq_iff[where 'a='m])
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 11453
  done
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
 11454
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11455
lemma absolutely_integrable_integrable_bound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11456
  fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11457
  assumes "\<forall>x\<in>s. norm (f x) \<le> g x"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11458
    and "f integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11459
    and "g integrable_on s"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11460
  shows "f absolutely_integrable_on s"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11461
proof -
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11462
  {
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11463
    presume *: "\<And>f::'n \<Rightarrow> 'm. \<And>g. \<forall>x. norm (f x) \<le> g x \<Longrightarrow> f integrable_on UNIV \<Longrightarrow>
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11464
      g integrable_on UNIV \<Longrightarrow> f absolutely_integrable_on UNIV"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11465
    show ?thesis
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11466
      apply (subst absolutely_integrable_restrict_univ[symmetric])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11467
      apply (rule *[of _ "\<lambda>x. if x\<in>s then g x else 0"])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11468
      using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11469
      unfolding integrable_restrict_univ
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11470
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11471
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11472
  }
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11473
  fix g
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11474
  fix f :: "'n \<Rightarrow> 'm"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11475
  assume assms: "\<forall>x. norm (f x) \<le> g x" "f integrable_on UNIV" "g integrable_on UNIV"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11476
  show "f absolutely_integrable_on UNIV"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11477
    apply (rule bounded_variation_absolutely_integrable[OF assms(2),where B="integral UNIV g"])
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11478
    apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 11479
  proof goal_cases
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11480
    case d: (1 d)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11481
    note d'=division_ofD[OF d]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11482
    have "(\<Sum>k\<in>d. norm (integral k f)) \<le> (\<Sum>k\<in>d. integral k g)"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11483
      apply (rule setsum_mono)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11484
      apply (rule integral_norm_bound_integral)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11485
      apply (drule_tac[!] d'(4))
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11486
      apply safe
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11487
      apply (rule_tac[1-2] integrable_on_subcbox)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11488
      using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11489
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11490
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11491
    also have "\<dots> = integral (\<Union>d) g"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11492
      apply (rule integral_combine_division_bottomup[symmetric])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11493
      apply (rule d)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11494
      apply safe
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11495
      apply (drule d'(4))
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11496
      apply safe
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11497
      apply (rule integrable_on_subcbox[OF assms(3)])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11498
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11499
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11500
    also have "\<dots> \<le> integral UNIV g"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11501
      apply (rule integral_subset_le)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11502
      defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11503
      apply (rule integrable_on_subdivision[OF d,of _ UNIV])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11504
      prefer 4
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11505
      apply rule
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11506
      apply (rule_tac y="norm (f x)" in order_trans)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11507
      using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11508
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11509
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11510
    finally show ?case .
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11511
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11512
qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11513
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11514
lemma absolutely_integrable_absolutely_integrable_bound:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11515
  fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11516
    and g :: "'n::euclidean_space \<Rightarrow> 'p::euclidean_space"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11517
  assumes "\<forall>x\<in>s. norm (f x) \<le> norm (g x)"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11518
    and "f integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11519
    and "g absolutely_integrable_on s"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11520
  shows "f absolutely_integrable_on s"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11521
  apply (rule absolutely_integrable_integrable_bound[of s f "\<lambda>x. norm (g x)"])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11522
  using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11523
  apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11524
  done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11525
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11526
lemma absolutely_integrable_inf_real:
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11527
  assumes "finite k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11528
    and "k \<noteq> {}"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11529
    and "\<forall>i\<in>k. (\<lambda>x. (fs x i)::real) absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11530
  shows "(\<lambda>x. (Inf ((fs x) ` k))) absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11531
  using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11532
proof induct
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11533
  case (insert a k)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11534
  let ?P = "(\<lambda>x.
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11535
    if fs x ` k = {} then fs x a
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11536
    else min (fs x a) (Inf (fs x ` k))) absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11537
  show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11538
    unfolding image_insert
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11539
    apply (subst Inf_insert_finite)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11540
    apply (rule finite_imageI[OF insert(1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11541
  proof (cases "k = {}")
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11542
    case True
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11543
    then show ?P
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11544
      apply (subst if_P)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11545
      defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11546
      apply (rule insert(5)[rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11547
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11548
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11549
  next
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11550
    case False
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11551
    then show ?P
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11552
      apply (subst if_not_P)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11553
      defer
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
 11554
      apply (rule absolutely_integrable_min[where 'n=real, unfolded Basis_real_def, simplified])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11555
      defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11556
      apply(rule insert(3)[OF False])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11557
      using insert(5)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11558
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11559
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11560
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11561
next
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11562
  case empty
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11563
  then show ?case by auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11564
qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11565
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11566
lemma absolutely_integrable_sup_real:
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11567
  assumes "finite k"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11568
    and "k \<noteq> {}"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11569
    and "\<forall>i\<in>k. (\<lambda>x. (fs x i)::real) absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11570
  shows "(\<lambda>x. (Sup ((fs x) ` k))) absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11571
  using assms
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11572
proof induct
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11573
  case (insert a k)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11574
  let ?P = "(\<lambda>x.
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11575
    if fs x ` k = {} then fs x a
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11576
    else max (fs x a) (Sup (fs x ` k))) absolutely_integrable_on s"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11577
  show ?case
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11578
    unfolding image_insert
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11579
    apply (subst Sup_insert_finite)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11580
    apply (rule finite_imageI[OF insert(1)])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11581
  proof (cases "k = {}")
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11582
    case True
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11583
    then show ?P
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11584
      apply (subst if_P)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11585
      defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11586
      apply (rule insert(5)[rule_format])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11587
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11588
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11589
  next
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11590
    case False
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11591
    then show ?P
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11592
      apply (subst if_not_P)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11593
      defer
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
 11594
      apply (rule absolutely_integrable_max[where 'n=real, unfolded Basis_real_def, simplified])
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11595
      defer
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11596
      apply (rule insert(3)[OF False])
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11597
      using insert(5)
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11598
      apply auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11599
      done
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11600
  qed
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11601
qed auto
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11602
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11603
61243
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11604
subsection \<open>Exchange uniform limit and integral\<close>
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11605
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11606
lemma
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11607
  uniform_limit_integral:
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11608
  fixes f::"'a \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::banach"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11609
  assumes u: "uniform_limit (cbox a b) f g F"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11610
  assumes c: "\<And>n. continuous_on (cbox a b) (f n)"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11611
  assumes [simp]: "F \<noteq> bot"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11612
  obtains I J where
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11613
    "\<And>n. (f n has_integral I n) (cbox a b)"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11614
    "(g has_integral J) (cbox a b)"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11615
    "(I ---> J) F"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11616
proof -
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11617
  have fi[simp]: "f n integrable_on (cbox a b)" for n
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11618
    by (auto intro!: integrable_continuous assms)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11619
  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
 11620
    by atomize_elim (auto simp: integrable_on_def intro!: choice)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11621
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11622
  moreover
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11623
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11624
  have gi[simp]: "g integrable_on (cbox a b)"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11625
    by (auto intro!: integrable_continuous uniform_limit_theorem[OF _ u] eventuallyI c)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11626
  then obtain J where J: "(g has_integral J) (cbox a b)"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11627
    by blast
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11628
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11629
  moreover
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11630
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11631
  have "(I ---> J) F"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11632
  proof cases
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11633
    assume "content (cbox a b) = 0"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11634
    hence "I = (\<lambda>_. 0)" "J = 0"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11635
      by (auto intro!: has_integral_unique I J)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11636
    thus ?thesis by simp
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11637
  next
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11638
    assume content_nonzero: "content (cbox a b) \<noteq> 0"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11639
    show ?thesis
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11640
    proof (rule tendstoI)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11641
      fix e::real
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11642
      assume "e > 0"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11643
      def e' \<equiv> "e / 2"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11644
      with \<open>e > 0\<close> have "e' > 0" by simp
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11645
      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)"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11646
        using u content_nonzero content_pos_le[of a b]
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11647
        by (auto simp: uniform_limit_iff dist_norm)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11648
      then show "\<forall>\<^sub>F n in F. dist (I n) J < e"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11649
      proof eventually_elim
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11650
        case (elim n)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11651
        have "I n = integral (cbox a b) (f n)"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11652
            "J = integral (cbox a b) g"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11653
          using I[of n] J by (simp_all add: integral_unique)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11654
        then have "dist (I n) J = norm (integral (cbox a b) (\<lambda>x. f n x - g x))"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11655
          by (simp add: integral_sub dist_norm)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11656
        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
 11657
          using elim
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11658
          by (intro integral_norm_bound_integral)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11659
            (auto intro!: integrable_sub absolutely_integrable_onI)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11660
        also have "\<dots> < e"
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11661
          using \<open>0 < e\<close>
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11662
          by (simp add: e'_def)
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11663
        finally show ?case .
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11664
      qed
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11665
    qed
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11666
  qed
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11667
  ultimately show ?thesis ..
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11668
qed
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11669
44b2d133063e exchange uniform limit and integral
immler
parents: 61222
diff changeset
 11670
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
 11671
subsection \<open>Dominated convergence\<close>
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11672
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11673
(* GENERALIZE the following theorems *)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11674
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11675
lemma dominated_convergence:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56181
diff changeset
 11676
  fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11677
  assumes "\<And>k. (f k) integrable_on s" "h integrable_on s"
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11678
    and "\<And>k. \<forall>x \<in> s. norm (f k x) \<le> h x"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11679
    and "\<forall>x \<in> s. ((\<lambda>k. f k x) ---> g x) sequentially"
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11680
  shows "g integrable_on s"
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11681
    and "((\<lambda>k. integral s (f k)) ---> integral s g) sequentially"
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11682
proof -
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11683
  have bdd_below[simp]: "\<And>x P. x \<in> s \<Longrightarrow> bdd_below {f n x |n. P n}"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11684
  proof (safe intro!: bdd_belowI)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11685
    fix n x show "x \<in> s \<Longrightarrow> - h x \<le> f n x"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11686
      using assms(3)[rule_format, of x n] by simp
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11687
  qed
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11688
  have bdd_above[simp]: "\<And>x P. x \<in> s \<Longrightarrow> bdd_above {f n x |n. P n}"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11689
  proof (safe intro!: bdd_aboveI)
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11690
    fix n x show "x \<in> s \<Longrightarrow> f n x \<le> h x"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11691
      using assms(3)[rule_format, of x n] by simp
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11692
  qed
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11693
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11694
  have "\<And>m. (\<lambda>x. Inf {f j x |j. m \<le> j}) integrable_on s \<and>
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11695
    ((\<lambda>k. integral s (\<lambda>x. Inf {f j x |j. j \<in> {m..m + k}})) --->
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11696
    integral s (\<lambda>x. Inf {f j x |j. m \<le> j}))sequentially"
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11697
  proof (rule monotone_convergence_decreasing, safe)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11698
    fix m :: nat
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11699
    show "bounded {integral s (\<lambda>x. Inf {f j x |j. j \<in> {m..m + k}}) |k. True}"
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11700
      unfolding bounded_iff
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11701
      apply (rule_tac x="integral s h" in exI)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11702
    proof safe
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11703
      fix k :: nat
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11704
      show "norm (integral s (\<lambda>x. Inf {f j x |j. j \<in> {m..m + k}})) \<le> integral s h"
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11705
        apply (rule integral_norm_bound_integral)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11706
        unfolding simple_image
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11707
        apply (rule absolutely_integrable_onD)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11708
        apply (rule absolutely_integrable_inf_real)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11709
        prefer 5
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11710
        unfolding real_norm_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11711
        apply rule
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
 11712
        apply (rule cInf_abs_ge)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11713
        prefer 5
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11714
        apply rule
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11715
        apply (rule_tac g = h in absolutely_integrable_integrable_bound)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11716
        using assms
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11717
        unfolding real_norm_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11718
        apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11719
        done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11720
    qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11721
    fix k :: nat
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11722
    show "(\<lambda>x. Inf {f j x |j. j \<in> {m..m + k}}) integrable_on s"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11723
      unfolding simple_image
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11724
      apply (rule absolutely_integrable_onD)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11725
      apply (rule absolutely_integrable_inf_real)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11726
      prefer 3
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11727
      using absolutely_integrable_integrable_bound[OF assms(3,1,2)]
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11728
      apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11729
      done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11730
    fix x
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11731
    assume x: "x \<in> s"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11732
    show "Inf {f j x |j. j \<in> {m..m + Suc k}} \<le> Inf {f j x |j. j \<in> {m..m + k}}"
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11733
      by (rule cInf_superset_mono) auto
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11734
    let ?S = "{f j x| j. m \<le> j}"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11735
    show "((\<lambda>k. Inf {f j x |j. j \<in> {m..m + k}}) ---> Inf ?S) sequentially"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 11736
    proof (rule LIMSEQ_I, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11737
      case r: (1 r)
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11738
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11739
      have "\<exists>y\<in>?S. y < Inf ?S + r"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
 11740
        by (subst cInf_less_iff[symmetric]) (auto simp: \<open>x\<in>s\<close> r)
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11741
      then obtain N where N: "f N x < Inf ?S + r" "m \<le> N"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11742
        by blast
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
 11743
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11744
      show ?case
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11745
        apply (rule_tac x=N in exI)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11746
        apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 11747
      proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 11748
        case prems: (1 n)
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11749
        have *: "\<And>y ix. y < Inf ?S + r \<longrightarrow> Inf ?S \<le> ix \<longrightarrow> ix \<le> y \<longrightarrow> abs(ix - Inf ?S) < r"
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
 11750
          by arith
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11751
        show ?case
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11752
          unfolding real_norm_def
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11753
            apply (rule *[rule_format, OF N(1)])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
 11754
            apply (rule cInf_superset_mono, auto simp: \<open>x\<in>s\<close>) []
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11755
            apply (rule cInf_lower)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 11756
            using N prems
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11757
            apply auto []
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11758
            apply simp
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11759
            done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11760
      qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11761
    qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11762
  qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11763
  note dec1 = conjunctD2[OF this]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11764
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11765
  have "\<And>m. (\<lambda>x. Sup {f j x |j. m \<le> j}) integrable_on s \<and>
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11766
    ((\<lambda>k. integral s (\<lambda>x. Sup {f j x |j. j \<in> {m..m + k}})) --->
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11767
    integral s (\<lambda>x. Sup {f j x |j. m \<le> j})) sequentially"
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11768
  proof (rule monotone_convergence_increasing,safe)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11769
    fix m :: nat
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11770
    show "bounded {integral s (\<lambda>x. Sup {f j x |j. j \<in> {m..m + k}}) |k. True}"
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11771
      unfolding bounded_iff
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11772
      apply (rule_tac x="integral s h" in exI)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11773
    proof safe
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11774
      fix k :: nat
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11775
      show "norm (integral s (\<lambda>x. Sup {f j x |j. j \<in> {m..m + k}})) \<le> integral s h"
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11776
        apply (rule integral_norm_bound_integral) unfolding simple_image
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11777
        apply (rule absolutely_integrable_onD)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11778
        apply(rule absolutely_integrable_sup_real)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11779
        prefer 5 unfolding real_norm_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11780
        apply rule
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
 11781
        apply (rule cSup_abs_le)
60810
9ede42599eeb tweaks. Got rid of a really slow step
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
 11782
        using assms
9ede42599eeb tweaks. Got rid of a really slow step
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
 11783
        apply (force simp add: )
9ede42599eeb tweaks. Got rid of a really slow step
paulson <lp15@cam.ac.uk>
parents: 60800
diff changeset
 11784
        prefer 4
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11785
        apply rule
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11786
        apply (rule_tac g=h in absolutely_integrable_integrable_bound)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11787
        using assms
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11788
        unfolding real_norm_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11789
        apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11790
        done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11791
    qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11792
    fix k :: nat
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11793
    show "(\<lambda>x. Sup {f j x |j. j \<in> {m..m + k}}) integrable_on s"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11794
      unfolding simple_image
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11795
      apply (rule absolutely_integrable_onD)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11796
      apply (rule absolutely_integrable_sup_real)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11797
      prefer 3
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11798
      using absolutely_integrable_integrable_bound[OF assms(3,1,2)]
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11799
      apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11800
      done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11801
    fix x
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11802
    assume x: "x\<in>s"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11803
    show "Sup {f j x |j. j \<in> {m..m + Suc k}} \<ge> Sup {f j x |j. j \<in> {m..m + k}}"
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11804
      by (rule cSup_subset_mono) auto
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11805
    let ?S = "{f j x| j. m \<le> j}"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11806
    show "((\<lambda>k. Sup {f j x |j. j \<in> {m..m + k}}) ---> Sup ?S) sequentially"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 11807
    proof (rule LIMSEQ_I, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11808
      case r: (1 r)
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11809
      have "\<exists>y\<in>?S. Sup ?S - r < y"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
 11810
        by (subst less_cSup_iff[symmetric]) (auto simp: r \<open>x\<in>s\<close>)
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11811
      then obtain N where N: "Sup ?S - r < f N x" "m \<le> N"
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11812
        by blast
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
 11813
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11814
      show ?case
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11815
        apply (rule_tac x=N in exI)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11816
        apply safe
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 11817
      proof goal_cases
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 11818
        case prems: (1 n)
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11819
        have *: "\<And>y ix. Sup ?S - r < y \<longrightarrow> ix \<le> Sup ?S \<longrightarrow> y \<le> ix \<longrightarrow> abs(ix - Sup ?S) < r"
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11820
          by arith
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11821
        show ?case
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11822
          apply simp
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11823
          apply (rule *[rule_format, OF N(1)])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
 11824
          apply (rule cSup_subset_mono, auto simp: \<open>x\<in>s\<close>) []
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11825
          apply (subst cSup_upper)
61167
34f782641caa tuned proofs;
wenzelm
parents: 61166
diff changeset
 11826
          using N prems
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11827
          apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11828
          done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11829
      qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11830
    qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11831
  qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11832
  note inc1 = conjunctD2[OF this]
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11833
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11834
  have "g integrable_on s \<and>
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11835
    ((\<lambda>k. integral s (\<lambda>x. Inf {f j x |j. k \<le> j})) ---> integral s g) sequentially"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11836
    apply (rule monotone_convergence_increasing,safe)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
 11837
    apply fact
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11838
  proof -
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11839
    show "bounded {integral s (\<lambda>x. Inf {f j x |j. k \<le> j}) |k. True}"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11840
      unfolding bounded_iff apply(rule_tac x="integral s h" in exI)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11841
    proof safe
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11842
      fix k :: nat
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11843
      show "norm (integral s (\<lambda>x. Inf {f j x |j. k \<le> j})) \<le> integral s h"
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11844
        apply (rule integral_norm_bound_integral)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11845
        apply fact+
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11846
        unfolding real_norm_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11847
        apply rule
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
 11848
        apply (rule cInf_abs_ge)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11849
        using assms(3)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11850
        apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11851
        done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11852
    qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11853
    fix k :: nat and x
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11854
    assume x: "x \<in> s"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11855
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11856
    have *: "\<And>x y::real. x \<ge> - y \<Longrightarrow> - x \<le> y" by auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11857
    show "Inf {f j x |j. k \<le> j} \<le> Inf {f j x |j. Suc k \<le> j}"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
 11858
      by (intro cInf_superset_mono) (auto simp: \<open>x\<in>s\<close>)
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
 11859
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
 11860
    show "(\<lambda>k::nat. Inf {f j x |j. k \<le> j}) ----> g x"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 11861
    proof (rule LIMSEQ_I, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11862
      case r: (1 r)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11863
      then have "0<r/2"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11864
        by auto
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11865
      from assms(4)[THEN bspec, THEN LIMSEQ_D, OF x this] guess N .. note N = this
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11866
      show ?case
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11867
        apply (rule_tac x=N in exI)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11868
        apply safe
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11869
        unfolding real_norm_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11870
        apply (rule le_less_trans[of _ "r/2"])
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
 11871
        apply (rule cInf_asclose)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11872
        apply safe
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11873
        defer
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11874
        apply (rule less_imp_le)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11875
        using N r
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11876
        apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11877
        done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11878
    qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11879
  qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11880
  note inc2 = conjunctD2[OF this]
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11881
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11882
  have "g integrable_on s \<and>
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11883
    ((\<lambda>k. integral s (\<lambda>x. Sup {f j x |j. k \<le> j})) ---> integral s g) sequentially"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11884
    apply (rule monotone_convergence_decreasing,safe)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11885
    apply fact
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11886
  proof -
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11887
    show "bounded {integral s (\<lambda>x. Sup {f j x |j. k \<le> j}) |k. True}"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11888
      unfolding bounded_iff
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11889
      apply (rule_tac x="integral s h" in exI)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11890
    proof safe
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11891
      fix k :: nat
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11892
      show "norm (integral s (\<lambda>x. Sup {f j x |j. k \<le> j})) \<le> integral s h"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11893
        apply (rule integral_norm_bound_integral)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11894
        apply fact+
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11895
        unfolding real_norm_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11896
        apply rule
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
 11897
        apply (rule cSup_abs_le)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11898
        using assms(3)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11899
        apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11900
        done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11901
    qed
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11902
    fix k :: nat
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11903
    fix x
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11904
    assume x: "x \<in> s"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11905
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11906
    show "Sup {f j x |j. k \<le> j} \<ge> Sup {f j x |j. Suc k \<le> j}"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60396
diff changeset
 11907
      by (rule cSup_subset_mono) (auto simp: \<open>x\<in>s\<close>)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11908
    show "((\<lambda>k. Sup {f j x |j. k \<le> j}) ---> g x) sequentially"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 11909
    proof (rule LIMSEQ_I, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11910
      case r: (1 r)
53638
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11911
      then have "0<r/2"
203794e8977d tuned proofs;
wenzelm
parents: 53634
diff changeset
 11912
        by auto
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
 11913
      from assms(4)[THEN bspec, THEN LIMSEQ_D, OF x this] guess N .. note N=this
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11914
      show ?case
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11915
        apply (rule_tac x=N in exI,safe)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11916
        unfolding real_norm_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11917
        apply (rule le_less_trans[of _ "r/2"])
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
 11918
        apply (rule cSup_asclose)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11919
        apply safe
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11920
        defer
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11921
        apply (rule less_imp_le)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11922
        using N r
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11923
        apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11924
        done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11925
    qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11926
  qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11927
  note dec2 = conjunctD2[OF this]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11928
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 11929
  show "g integrable_on s" by fact
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
 11930
  show "((\<lambda>k. integral s (f k)) ---> integral s g) sequentially"
61166
5976fe402824 renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents: 61165
diff changeset
 11931
  proof (rule LIMSEQ_I, goal_cases)
61165
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11932
    case r: (1 r)
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11933
    from LIMSEQ_D [OF inc2(2) r] guess N1 .. note N1=this[unfolded real_norm_def]
8020249565fb tuned proofs;
wenzelm
parents: 61076
diff changeset
 11934
    from LIMSEQ_D [OF dec2(2) r] guess N2 .. note N2=this[unfolded real_norm_def]
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11935
    show ?case
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11936
    proof (rule_tac x="N1+N2" in exI, safe)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11937
      fix n
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11938
      assume n: "n \<ge> N1 + N2"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11939
      have *: "\<And>i0 i i1 g. \<bar>i0 - g\<bar> < r \<longrightarrow> \<bar>i1 - g\<bar> < r \<longrightarrow> i0 \<le> i \<longrightarrow> i \<le> i1 \<longrightarrow> \<bar>i - g\<bar> < r"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11940
        by arith
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11941
      show "norm (integral s (f n) - integral s g) < r"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11942
        unfolding real_norm_def
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11943
      proof (rule *[rule_format,OF N1[rule_format] N2[rule_format], of n n])
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11944
        show "integral s (\<lambda>x. Inf {f j x |j. n \<le> j}) \<le> integral s (f n)"
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11945
          by (rule integral_le[OF dec1(1) assms(1)]) (auto intro!: cInf_lower)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11946
        show "integral s (f n) \<le> integral s (\<lambda>x. Sup {f j x |j. n \<le> j})"
54263
c4159fe6fa46 move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents: 54258
diff changeset
 11947
          by (rule integral_le[OF assms(1) inc1(1)]) (auto intro!: cSup_upper)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11948
      qed (insert n, auto)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11949
    qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11950
  qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 11951
qed
35752
c8a8df426666 reset smt_certificates
himmelma
parents: 35751
diff changeset
 11952
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11953
lemma has_integral_dominated_convergence:
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11954
  fixes f :: "nat \<Rightarrow> 'n::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
 11955
  assumes "\<And>k. (f k has_integral y k) s" "h integrable_on s"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11956
    "\<And>k. \<forall>x\<in>s. norm (f k x) \<le> h x" "\<forall>x\<in>s. (\<lambda>k. f k x) ----> g x"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11957
    and x: "y ----> x"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11958
  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
 11959
proof -
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11960
  have int_f: "\<And>k. (f k) integrable_on s"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11961
    using assms by (auto simp: integrable_on_def)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11962
  have "(g has_integral (integral s g)) s"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11963
    by (intro integrable_integral dominated_convergence[OF int_f assms(2)]) fact+
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11964
  moreover have "integral s g = x"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11965
  proof (rule LIMSEQ_unique)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11966
    show "(\<lambda>i. integral s (f i)) ----> x"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11967
      using integral_unique[OF assms(1)] x by simp
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11968
    show "(\<lambda>i. integral s (f i)) ----> integral s g"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11969
      by (intro dominated_convergence[OF int_f assms(2)]) fact+
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11970
  qed
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11971
  ultimately show ?thesis
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11972
    by simp
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11973
qed
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
 11974
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
 11975
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
 11976
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11977
lemma setcomp_dot1: "{z. P (z \<bullet> (i,0))} = {(x,y). P(x \<bullet> i)}"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11978
  by auto
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11979
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11980
lemma setcomp_dot2: "{z. P (z \<bullet> (0,i))} = {(x,y). P(y \<bullet> i)}"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11981
  by auto
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11982
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11983
lemma Sigma_Int_Paircomp1: "(Sigma A B) \<inter> {(x, y). P x} = Sigma (A \<inter> {x. P x}) B"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11984
  by blast
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11985
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11986
lemma Sigma_Int_Paircomp2: "(Sigma A B) \<inter> {(x, y). P y} = Sigma A (\<lambda>z. B z \<inter> {y. P y})"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11987
  by blast
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11988
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11989
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
 11990
  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
 11991
  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
 11992
  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
 11993
proof -
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11994
  have "f o (\<lambda>y. (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
 11995
    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
 11996
    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
 11997
    using x
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 11998
    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
 11999
    done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12000
  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
 12001
    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
 12002
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12003
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12004
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
 12005
  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
 12006
  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
 12007
    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
 12008
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
 12009
case True
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12010
  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
 12011
    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
 12012
next
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12013
  case False
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12014
  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
 12015
    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
 12016
  { 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
 12017
    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
 12018
    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
 12019
      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
 12020
    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
 12021
    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
 12022
                       \<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
 12023
      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
 12024
      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
 12025
    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
 12026
      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
 12027
      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
 12028
      apply clarify
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12029
      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
 12030
      apply (rule integrable_bound)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12031
      apply (auto intro: integrable_sub 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
 12032
      done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12033
  } note * = this
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12034
  show ?thesis
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12035
    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
 12036
    apply (simp add: * continuous_on_iff dist_norm integral_sub [symmetric] continuous_on_imp_integrable_on_Pair1 [OF assms])
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12037
    done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12038
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12039
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12040
lemma norm_diff2: "\<lbrakk>y = y1 + y2; x = x1 + x2; e = e1 + e2; norm(y1 - x1) \<le> e1; norm(y2 - x2) \<le> e2\<rbrakk>
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12041
            \<Longrightarrow> norm(y - x) \<le> e"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12042
using norm_triangle_mono [of "y1 - x1" "e1" "y2 - x2" "e2"]
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12043
  by (simp add: add_diff_add)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12044
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12045
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
 12046
  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
 12047
  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
 12048
      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
 12049
  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
 12050
           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
 12051
           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
 12052
  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
 12053
  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
 12054
  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
 12055
  done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12056
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12057
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
 12058
  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
 12059
  assumes f: "continuous_on s f" 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
 12060
    shows "operative(op \<and>)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12061
           (\<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
 12062
                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
 12063
                \<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
 12064
                         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
 12065
                    \<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
 12066
proof (auto simp: operative_def)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12067
  fix a::'a and c::'b and b::'a and d::'b 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
 12068
  assume c0: "content (cbox (a, c) (b, d)) = 0"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12069
     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
 12070
     and cb2: "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
 12071
  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
 12072
    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
 12073
  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
 12074
          \<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
 12075
    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
 12076
    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
 12077
next
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12078
  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
 12079
  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
 12080
  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
 12081
  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
 12082
     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
 12083
                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
 12084
                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
 12085
                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
 12086
                \<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
 12087
     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
 12088
                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
 12089
                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
 12090
                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
 12091
                \<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
 12092
     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
 12093
  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
 12094
    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
 12095
  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
 12096
    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
 12097
  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
 12098
    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
 12099
  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
 12100
             \<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
 12101
  proof cases
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12102
    case 1
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12103
    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
 12104
                  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
 12105
                  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
 12106
      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
 12107
    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
 12108
                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
 12109
                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
 12110
      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
 12111
      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
 12112
    show ?normle
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12113
      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
 12114
      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
 12115
      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
 12116
      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
 12117
      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
 12118
      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
 12119
      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
 12120
      done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12121
  next
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12122
    case 2
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12123
    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
 12124
                  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
 12125
                  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
 12126
      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
 12127
    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
 12128
                "(\<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
 12129
      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
 12130
      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
 12131
      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
 12132
      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
 12133
      done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12134
    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
 12135
                   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
 12136
                   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
 12137
      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
 12138
                    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
 12139
    show ?normle
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12140
      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
 12141
      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
 12142
      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
 12143
      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
 12144
      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
 12145
      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
 12146
      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
 12147
      done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12148
  qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12149
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12150
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12151
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
 12152
    "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
 12153
     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
 12154
  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
 12155
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12156
lemma norm_minus2: "norm (x1-x2, y1-y2) = norm (x2-x1, y2-y1)"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12157
  by (simp add: norm_minus_eqI)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12158
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12159
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
 12160
  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
 12161
  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
 12162
    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
 12163
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
 12164
  case True
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12165
  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
 12166
    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
 12167
next
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12168
  case False
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12169
  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
 12170
    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
 12171
  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
 12172
  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
 12173
    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
 12174
    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
 12175
      by simp
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12176
    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
 12177
      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
 12178
    { fix p
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12179
      assume p: "p 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
 12180
      note opd1 = operative_division_and [OF integral_swap_operative [OF assms e'], THEN iffD1,
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12181
                       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
 12182
      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
 12183
              \<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
 12184
              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
 12185
              \<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
 12186
            \<Longrightarrow>
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12187
            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
 12188
        using opd1 [OF p] False  by simp
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12189
    } 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
 12190
    { 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
 12191
      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
 12192
         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
 12193
                  \<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
 12194
                  \<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
 12195
         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
 12196
         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
 12197
         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
 12198
      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
 12199
        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
 12200
      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
 12201
        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
 12202
      { 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
 12203
        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
 12204
        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
 12205
          using uwvz_sub by auto
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12206
        have "norm (x1 - t1, x2 - t2) < k"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12207
          using xuvwz ls uwvz_sub unfolding ball_def
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12208
          by (force simp add: cbox_Pair_eq dist_norm norm_minus2)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12209
        then have "norm (f (x1,x2) - f (t1,t2)) \<le> 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
 12210
          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
 12211
      } 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
 12212
      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
 12213
        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
 12214
      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
 12215
        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
 12216
        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
 12217
      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
 12218
         \<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
 12219
        apply (simp only: integral_sub [symmetric] f_int_uwvz integrable_const)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12220
        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
 12221
        using cbp e' nf'
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12222
        apply (auto simp: integrable_sub f_int_uwvz integrable_const)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12223
        done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12224
      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
 12225
        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
 12226
      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
 12227
         "\<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
 12228
               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
 12229
               \<le> e * content (cbox w z) / content (cbox (a, c) (b, d)) / 2"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12230
        apply (simp only: integral_sub [symmetric] f_int_uv integrable_const)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12231
        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
 12232
        using cbp e' nf'
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12233
        apply (auto simp: integrable_sub f_int_uv integrable_const)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12234
        done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12235
      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
 12236
               (\<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
 12237
            \<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
 12238
        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
 12239
        using cbp e'
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12240
        apply (auto simp: divide_simps content_pos_le integrable_sub int_integrable integrable_const)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12241
        done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12242
      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
 12243
        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
 12244
      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
 12245
                      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
 12246
                \<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
 12247
        by (simp only: integral_sub [symmetric] int_integrable integrable_const)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12248
      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
 12249
        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
 12250
        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
 12251
      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
 12252
            \<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
 12253
        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
 12254
    } note * = this
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12255
    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
 12256
      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
 12257
      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
 12258
      apply (drule_tac x="e / 2 / content?CBOX" in spec)
61222
05d28dc76e5c isabelle update_cartouches;
wenzelm
parents: 61204
diff changeset
 12259
      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
 12260
      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
 12261
      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
 12262
      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
 12263
      apply assumption
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12264
      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
 12265
      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
 12266
      using *
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12267
      apply auto
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12268
      done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12269
  qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12270
  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
 12271
    by simp
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12272
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12273
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12274
lemma swap_continuous:
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12275
  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
 12276
    shows "continuous_on (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
 12277
proof -
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12278
  have "(\<lambda>(x, y). f y x) = (\<lambda>(x, y). f x y) o prod.swap"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12279
    by auto
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12280
  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
 12281
    apply (rule ssubst)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12282
    apply (rule continuous_on_compose)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12283
    apply (simp add: split_def)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12284
    apply (rule continuous_intros | simp add: assms)+
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12285
    done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12286
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12287
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12288
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
 12289
  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
 12290
  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
 12291
    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
 12292
proof -
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12293
  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
 12294
    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
 12295
    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
 12296
    done
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12297
 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
 12298
   by force
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12299
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12300
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12301
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
 12302
  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
 12303
  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
 12304
    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
 12305
           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
 12306
proof -
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12307
  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
 12308
    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
 12309
  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
 12310
    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
 12311
  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
 12312
    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
 12313
    by auto
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12314
  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
 12315
qed
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
 12316
35173
9b24bfca8044 Renamed Multivariate-Analysis/Integration to Multivariate-Analysis/Integration_MV to avoid name clash with Integration.
hoelzl
parents: 35172
diff changeset
 12317
end