src/HOL/Multivariate_Analysis/Integration.thy
author huffman
Thu, 12 Sep 2013 18:09:17 -0700
changeset 53600 8fda7ad57466
parent 53597 ea99a7964174
child 53634 ab5d01b69a07
permissions -rw-r--r--
make 'linear' into a sublocale of 'bounded_linear'; replace 'linear_def' with 'linear_iff'
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
     1
(*  Author:     John Harrison
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
     2
    Author:     Robert Himmelmann, TU Muenchen (Translation from HOL light)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
     3
*)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
     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
     5
header {* Kurzweil-Henstock Gauge Integration in many dimensions. *}
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
64cd30d6b0b8 explicit file specifications -- avoid secondary load path;
wenzelm
parents: 40513
diff changeset
    10
  "~~/src/HOL/Library/Indicator_Function"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
    11
begin
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
    12
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    13
lemma cSup_abs_le: (* TODO: is this really needed? *)
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    14
  fixes S :: "real set"
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    15
  shows "S \<noteq> {} \<Longrightarrow> (\<forall>x\<in>S. \<bar>x\<bar> \<le> a) \<Longrightarrow> \<bar>Sup S\<bar> \<le> a"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    16
  by (auto simp add: abs_le_interval_iff intro: cSup_least) (metis cSup_upper2)
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    17
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    18
lemma cInf_abs_ge: (* TODO: is this really needed? *)
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    19
  fixes S :: "real set"
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    20
  shows "S \<noteq> {} \<Longrightarrow> (\<forall>x\<in>S. \<bar>x\<bar> \<le> a) \<Longrightarrow> \<bar>Inf S\<bar> \<le> a"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    21
  by (simp add: Inf_real_def) (rule cSup_abs_le, auto)
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    22
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    23
lemma cSup_asclose: (* TODO: is this really needed? *)
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
    24
  fixes S :: "real set"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    25
  assumes S: "S \<noteq> {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    26
    and b: "\<forall>x\<in>S. \<bar>x - l\<bar> \<le> e"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    27
  shows "\<bar>Sup S - l\<bar> \<le> e"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    28
proof -
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    29
  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
    30
    by arith
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    31
  then show ?thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    32
    using S b cSup_bounds[of S "l - e" "l+e"]
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    33
    unfolding th
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    34
    by (auto simp add: setge_def setle_def)
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    35
qed
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    36
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    37
lemma cInf_asclose: (* TODO: is this really needed? *)
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    38
  fixes S :: "real set"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    39
  assumes S: "S \<noteq> {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    40
    and b: "\<forall>x\<in>S. \<bar>x - l\<bar> \<le> e"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    41
  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
    42
proof -
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    43
  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
    44
    by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    45
  also have "\<dots> \<le> e"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    46
    apply (rule cSup_asclose)
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    47
    apply (auto simp add: S)
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    48
    apply (metis abs_minus_add_cancel b add_commute diff_minus)
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
    49
    done
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
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
    75
lemma Inf: (* rename *)
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
    76
  fixes S :: "real set"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    77
  shows "S \<noteq> {} \<Longrightarrow> (\<exists>b. b <=* S) \<Longrightarrow> isGlb UNIV S (Inf S)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    78
  by (auto simp add: isLb_def setle_def setge_def isGlb_def greatestP_def
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    79
    intro: cInf_lower cInf_greatest)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    80
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
    81
lemma real_le_inf_subset:
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    82
  assumes "t \<noteq> {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    83
    and "t \<subseteq> s"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    84
    and "\<exists>b. b <=* s"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    85
  shows "Inf s \<le> Inf (t::real set)"
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
    86
  apply (rule isGlb_le_isLb)
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
    87
  apply (rule Inf[OF assms(1)])
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
    88
  apply (insert assms)
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
    89
  apply (erule exE)
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
    90
  apply (rule_tac x = b in exI)
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
    91
  apply (auto simp: isLb_def setge_def intro: cInf_lower cInf_greatest)
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
    92
  done
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
    93
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
    94
lemma real_ge_sup_subset:
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    95
  fixes t :: "real set"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    96
  assumes "t \<noteq> {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    97
    and "t \<subseteq> s"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    98
    and "\<exists>b. s *<= b"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
    99
  shows "Sup s \<ge> Sup t"
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
   100
  apply (rule isLub_le_isUb)
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
   101
  apply (rule isLub_cSup[OF assms(1)])
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
   102
  apply (insert assms)
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
   103
  apply (erule exE)
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
   104
  apply (rule_tac x = b in exI)
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
   105
  apply (auto simp: isUb_def setle_def intro: cSup_upper cSup_least)
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
   106
  done
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
   107
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
   108
(*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
   109
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
   110
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
   111
  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
   112
  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
   113
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
   114
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
   115
  "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
   116
  by (subst(asm) real_arch_inv)
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   117
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   118
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   119
subsection {* Sundries *}
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   120
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   121
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
   122
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
   123
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
   124
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
   125
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   126
declare norm_triangle_ineq4[intro]
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   127
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   128
lemma simple_image: "{f x |x . x \<in> s} = f ` s"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   129
  by blast
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   130
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   131
lemma linear_simps:
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   132
  assumes "bounded_linear f"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   133
  shows
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   134
    "f (a + b) = f a + f b"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   135
    "f (a - b) = f a - f b"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   136
    "f 0 = 0"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   137
    "f (- a) = - f a"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   138
    "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
   139
proof -
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53597
diff changeset
   140
  interpret f: bounded_linear f by fact
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53597
diff changeset
   141
  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
   142
  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
   143
  show "f 0 = 0" by (rule f.zero)
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53597
diff changeset
   144
  show "f (- a) = - f a" by (rule f.minus)
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53597
diff changeset
   145
  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
   146
qed
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   147
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   148
lemma bounded_linearI:
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   149
  assumes "\<And>x y. f (x + y) = f x + f y"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   150
    and "\<And>r x. f (r *\<^sub>R x) = r *\<^sub>R f x"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   151
    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
   152
  shows "bounded_linear f"
53600
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53597
diff changeset
   153
  using assms by (rule bounded_linear_intro) (* FIXME: duplicate *)
51348
011c97ba3b3d move lemma Inf to usage point
hoelzl
parents: 50945
diff changeset
   154
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
   155
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
   156
  by (rule bounded_linear_inner_left)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   157
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   158
lemma transitive_stepwise_lt_eq:
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   159
  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
   160
  shows "((\<forall>m. \<forall>n>m. R m n) \<longleftrightarrow> (\<forall>n. R n (Suc n)))"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   161
  (is "?l = ?r")
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   162
proof safe
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   163
  assume ?r
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   164
  fix n m :: nat
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   165
  assume "m < n"
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   166
  then show "R m n"
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   167
  proof (induct n arbitrary: m)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   168
    case 0
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   169
    then show ?case by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   170
  next
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   171
    case (Suc n)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   172
    show ?case
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   173
    proof (cases "m < n")
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   174
      case True
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   175
      show ?thesis
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   176
        apply (rule assms[OF Suc(1)[OF True]])
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   177
        using `?r`
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   178
        apply auto
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   179
        done
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   180
    next
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   181
      case False
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   182
      then have "m = n"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   183
        using Suc(2) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   184
      then show ?thesis
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   185
        using `?r` by auto
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   186
    qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   187
  qed
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   188
qed auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   189
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   190
lemma transitive_stepwise_gt:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   191
  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
   192
  shows "\<forall>n>m. R m n"
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   193
proof -
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   194
  have "\<forall>m. \<forall>n>m. R m n"
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   195
    apply (subst transitive_stepwise_lt_eq)
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   196
    apply (rule assms)
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   197
    apply assumption
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   198
    apply assumption
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   199
    using assms(2) apply auto
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   200
    done
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   201
  then show ?thesis by auto
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   202
qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   203
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   204
lemma transitive_stepwise_le_eq:
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   205
  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
   206
  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
   207
  (is "?l = ?r")
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   208
proof safe
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   209
  assume ?r
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   210
  fix m n :: nat
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   211
  assume "m \<le> n"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   212
  then show "R m n"
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   213
  proof (induct n arbitrary: m)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   214
    case 0
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   215
    with assms show ?case by auto
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   216
  next
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   217
    case (Suc n)
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   218
    show ?case
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   219
    proof (cases "m \<le> n")
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   220
      case True
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   221
      show ?thesis
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   222
        apply (rule assms(2))
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   223
        apply (rule Suc(1)[OF True])
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   224
        using `?r` apply auto
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   225
        done
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   226
    next
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   227
      case False
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   228
      then have "m = Suc n"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   229
        using Suc(2) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   230
      then show ?thesis
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   231
        using assms(1) by auto
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   232
    qed
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   233
  qed
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   234
qed auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   235
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   236
lemma transitive_stepwise_le:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   237
  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
   238
    and "\<And>n. R n (Suc n)"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   239
  shows "\<forall>n\<ge>m. R m n"
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   240
proof -
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   241
  have "\<forall>m. \<forall>n\<ge>m. R m n"
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   242
    apply (subst transitive_stepwise_le_eq)
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   243
    apply (rule assms)
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   244
    apply (rule assms,assumption,assumption)
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   245
    using assms(3)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   246
    apply auto
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   247
    done
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   248
  then show ?thesis by auto
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   249
qed
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   250
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
   251
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   252
subsection {* Some useful lemmas about intervals. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   253
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   254
abbreviation One :: "'a::euclidean_space"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   255
  where "One \<equiv> \<Sum>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
   256
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
   257
lemma empty_as_interval: "{} = {One..(0::'a::ordered_euclidean_space)}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
   258
  by (auto simp: set_eq_iff eucl_le[where 'a='a] intro!: bexI[OF _ SOME_Basis])
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   259
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   260
lemma interior_subset_union_intervals:
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   261
  assumes "i = {a..b::'a::ordered_euclidean_space}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   262
    and "j = {c..d}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   263
    and "interior j \<noteq> {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   264
    and "i \<subseteq> j \<union> s"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   265
    and "interior i \<inter> interior j = {}"
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   266
  shows "interior i \<subseteq> interior s"
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   267
proof -
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   268
  have "{a<..<b} \<inter> {c..d} = {}"
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   269
    using inter_interval_mixed_eq_empty[of c d a b] and assms(3,5)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   270
    unfolding assms(1,2) interior_closed_interval by auto
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   271
  moreover
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   272
  have "{a<..<b} \<subseteq> {c..d} \<union> s"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   273
    apply (rule order_trans,rule interval_open_subset_closed)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   274
    using assms(4) unfolding assms(1,2)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   275
    apply auto
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   276
    done
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   277
  ultimately
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   278
  show ?thesis
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   279
    apply -
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   280
    apply (rule interior_maximal)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   281
    defer
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   282
    apply (rule open_interior)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   283
    unfolding assms(1,2) interior_closed_interval
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   284
    apply auto
49675
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   285
    done
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   286
qed
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   287
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   288
lemma inter_interior_unions_intervals:
d9c2fb37d92a tuned proofs;
wenzelm
parents: 49197
diff changeset
   289
  fixes f::"('a::ordered_euclidean_space) set set"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   290
  assumes "finite f"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   291
    and "open s"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   292
    and "\<forall>t\<in>f. \<exists>a b. t = {a..b}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   293
    and "\<forall>t\<in>f. s \<inter> (interior t) = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   294
  shows "s \<inter> interior (\<Union>f) = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   295
proof (rule ccontr, unfold ex_in_conv[symmetric])
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   296
  case goal1
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   297
  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
   298
    apply rule
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   299
    defer
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   300
    apply (rule_tac Int_greatest)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   301
    unfolding open_subset_interior[OF open_ball]
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   302
    using interior_subset
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   303
    apply auto
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   304
    done
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   305
  have lem2: "\<And>x s P. \<exists>x\<in>s. P x \<Longrightarrow> \<exists>x\<in>insert x s. P x" by auto
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   306
  have "\<And>f. finite f \<Longrightarrow> \<forall>t\<in>f. \<exists>a b. t = {a..b} \<Longrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   307
    \<exists>x. x \<in> s \<inter> interior (\<Union>f) \<Longrightarrow> \<exists>t\<in>f. \<exists>x. \<exists>e>0. ball x e \<subseteq> s \<inter> t"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   308
  proof -
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   309
    case goal1
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   310
    then show ?case
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   311
    proof (induct rule: finite_induct)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   312
      case empty
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   313
      obtain x where "x \<in> s \<inter> interior (\<Union>{})"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   314
        using empty(2) ..
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   315
      then have False
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   316
        unfolding Union_empty interior_empty by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   317
      then show ?case by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   318
    next
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   319
      case (insert i f)
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   320
      obtain x where x: "x \<in> s \<inter> interior (\<Union>insert i f)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   321
        using insert(5) ..
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   322
      then obtain e where e: "0 < e \<and> ball x e \<subseteq> s \<inter> interior (\<Union>insert i f)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   323
        unfolding open_contains_ball_eq[OF open_Int[OF assms(2) open_interior], rule_format] ..
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   324
      obtain a where "\<exists>b. i = {a..b}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   325
        using insert(4)[rule_format,OF insertI1] ..
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   326
      then obtain b where ab: "i = {a..b}" ..
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   327
      show ?case
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   328
      proof (cases "x \<in> i")
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   329
        case False
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   330
        then have "x \<in> UNIV - {a..b}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   331
          unfolding ab by auto
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   332
        then obtain d where "0 < d \<and> ball x d \<subseteq> UNIV - {a..b}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   333
          unfolding open_contains_ball_eq[OF open_Diff[OF open_UNIV closed_interval],rule_format] ..
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   334
        then have "0 < d" "ball x (min d e) \<subseteq> UNIV - i"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   335
          unfolding ab ball_min_Int by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   336
        then have "ball x (min d e) \<subseteq> s \<inter> interior (\<Union>f)"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   337
          using e unfolding lem1 unfolding  ball_min_Int by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   338
        then have "x \<in> s \<inter> interior (\<Union>f)" using `d>0` e by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   339
        then have "\<exists>t\<in>f. \<exists>x e. 0 < e \<and> ball x e \<subseteq> s \<inter> t"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   340
          apply -
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   341
          apply (rule insert(3))
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   342
          using insert(4)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   343
          apply auto
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   344
          done
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   345
        then show ?thesis by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   346
      next
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   347
        case True show ?thesis
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   348
        proof (cases "x\<in>{a<..<b}")
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   349
          case True
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   350
          then obtain d where "0 < d \<and> ball x d \<subseteq> {a<..<b}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   351
            unfolding open_contains_ball_eq[OF open_interval,rule_format] ..
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   352
          then show ?thesis
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   353
            apply (rule_tac x=i in bexI, rule_tac x=x in exI, rule_tac x="min d e" in exI)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   354
            unfolding ab
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   355
            using interval_open_subset_closed[of a b] and e
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   356
            apply fastforce+
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   357
            done
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   358
        next
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   359
          case False
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   360
          then obtain k where "x\<bullet>k \<le> a\<bullet>k \<or> x\<bullet>k \<ge> b\<bullet>k" and k: "k \<in> Basis"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   361
            unfolding mem_interval by (auto simp add: not_less)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   362
          then have "x\<bullet>k = a\<bullet>k \<or> x\<bullet>k = b\<bullet>k"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   363
            using True unfolding ab and mem_interval
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
   364
              apply (erule_tac x = k in ballE)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   365
              apply auto
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   366
              done
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   367
          then have "\<exists>x. ball x (e/2) \<subseteq> s \<inter> (\<Union>f)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   368
          proof (rule disjE)
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
   369
            let ?z = "x - (e/2) *\<^sub>R 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
   370
            assume as: "x\<bullet>k = a\<bullet>k"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   371
            have "ball ?z (e / 2) \<inter> i = {}"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   372
              apply (rule ccontr)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   373
              unfolding ex_in_conv[symmetric]
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   374
              apply (erule exE)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   375
            proof -
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   376
              fix y
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   377
              assume "y \<in> ball ?z (e / 2) \<inter> i"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   378
              then have "dist ?z y < e/2" and yi:"y\<in>i" by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   379
              then have "\<bar>(?z - y) \<bullet> k\<bar> < e/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
   380
                using Basis_le_norm[OF k, of "?z - y"] unfolding dist_norm by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   381
              then have "y\<bullet>k < a\<bullet>k"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   382
                using e[THEN conjunct1] k
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   383
                by (auto simp add: field_simps as inner_Basis inner_simps)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   384
              then have "y \<notin> 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
   385
                unfolding ab mem_interval by (auto intro!: bexI[OF _ k])
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   386
              then show False using yi by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   387
            qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   388
            moreover
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   389
            have "ball ?z (e/2) \<subseteq> s \<inter> (\<Union>insert i f)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   390
              apply (rule order_trans[OF _ e[THEN conjunct2, unfolded lem1]])
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   391
            proof
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   392
              fix y
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   393
              assume as: "y \<in> ball ?z (e/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
   394
              have "norm (x - y) \<le> \<bar>e\<bar> / 2 + norm (x - y - (e / 2) *\<^sub>R k)"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   395
                apply -
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
   396
                apply (rule order_trans,rule norm_triangle_sub[of "x - y" "(e/2) *\<^sub>R 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
   397
                unfolding norm_scaleR norm_Basis[OF k]
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   398
                apply auto
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   399
                done
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   400
              also have "\<dots> < \<bar>e\<bar> / 2 + \<bar>e\<bar> / 2"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   401
                apply (rule add_strict_left_mono)
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   402
                using as
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   403
                unfolding mem_ball dist_norm
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   404
                using e
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   405
                apply (auto simp add: field_simps)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   406
                done
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   407
              finally show "y \<in> ball x e"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   408
                unfolding mem_ball dist_norm using e by (auto simp add:field_simps)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   409
            qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   410
            ultimately show ?thesis
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   411
              apply (rule_tac x="?z" in exI)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   412
              unfolding Union_insert
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   413
              apply auto
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   414
              done
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   415
          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
   416
            let ?z = "x + (e/2) *\<^sub>R 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
   417
            assume as: "x\<bullet>k = b\<bullet>k"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   418
            have "ball ?z (e / 2) \<inter> i = {}"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   419
              apply (rule ccontr)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   420
              unfolding ex_in_conv[symmetric]
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   421
              apply (erule exE)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   422
            proof -
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   423
              fix y
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   424
              assume "y \<in> ball ?z (e / 2) \<inter> i"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   425
              then have "dist ?z y < e/2" and yi: "y \<in> i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   426
                by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   427
              then have "\<bar>(?z - y) \<bullet> k\<bar> < e/2"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   428
                using Basis_le_norm[OF k, of "?z - y"]
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   429
                unfolding dist_norm by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   430
              then have "y\<bullet>k > b\<bullet>k"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   431
                using e[THEN conjunct1] k
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   432
                by (auto simp add:field_simps inner_simps inner_Basis as)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   433
              then have "y \<notin> 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
   434
                unfolding ab mem_interval by (auto intro!: bexI[OF _ k])
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   435
              then show False using yi by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   436
            qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   437
            moreover
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   438
            have "ball ?z (e/2) \<subseteq> s \<inter> (\<Union>insert i f)"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   439
              apply (rule order_trans[OF _ e[THEN conjunct2, unfolded lem1]])
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   440
            proof
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   441
              fix y
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   442
              assume as: "y\<in> ball ?z (e/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
   443
              have "norm (x - y) \<le> \<bar>e\<bar> / 2 + norm (x - y + (e / 2) *\<^sub>R k)"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   444
                apply -
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   445
                apply (rule order_trans,rule norm_triangle_sub[of "x - y" "- (e/2) *\<^sub>R k"])
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   446
                unfolding norm_scaleR
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
   447
                apply (auto simp: k)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   448
                done
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   449
              also have "\<dots> < \<bar>e\<bar> / 2 + \<bar>e\<bar> / 2"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   450
                apply (rule add_strict_left_mono)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   451
                using as unfolding mem_ball dist_norm
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   452
                using e apply (auto simp add: field_simps)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   453
                done
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   454
              finally show "y \<in> ball x e"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   455
                unfolding mem_ball dist_norm using e by (auto simp add:field_simps)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   456
            qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   457
            ultimately show ?thesis
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   458
              apply (rule_tac x="?z" in exI)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   459
              unfolding Union_insert
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   460
              apply auto
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   461
              done
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   462
          qed
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   463
          then obtain x where "ball x (e / 2) \<subseteq> s \<inter> \<Union>f" ..
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   464
          then have "x \<in> s \<inter> interior (\<Union>f)"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   465
            unfolding lem1[where U="\<Union>f", symmetric]
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   466
            using centre_in_ball e[THEN conjunct1] by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   467
          then show ?thesis
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   468
            apply -
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   469
            apply (rule lem2, rule insert(3))
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   470
            using insert(4)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   471
            apply auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   472
            done
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   473
        qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   474
      qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   475
    qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   476
  qed
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   477
  from this[OF assms(1,3) goal1]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   478
  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
   479
    by blast
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   480
  then have "x \<in> s" "x \<in> interior t"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   481
    using open_subset_interior[OF open_ball, of x e t]
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   482
    by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   483
  then show False
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   484
    using `t \<in> f` assms(4) by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   485
qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   486
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
   487
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   488
subsection {* Bounds on intervals where they exist. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   489
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   490
definition interval_upperbound :: "('a::ordered_euclidean_space) set \<Rightarrow> 'a"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   491
  where "interval_upperbound s = (\<Sum>i\<in>Basis. Sup {a. \<exists>x\<in>s. x\<bullet>i = a} *\<^sub>R i)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   492
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   493
definition interval_lowerbound :: "('a::ordered_euclidean_space) set \<Rightarrow> 'a"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   494
  where "interval_lowerbound s = (\<Sum>i\<in>Basis. Inf {a. \<exists>x\<in>s. x\<bullet>i = a} *\<^sub>R i)"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   495
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   496
lemma interval_upperbound[simp]:
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
   497
  "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i \<Longrightarrow>
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
   498
    interval_upperbound {a..b} = (b::'a::ordered_euclidean_space)"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
   499
  unfolding interval_upperbound_def euclidean_representation_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
   500
  by (auto simp del: ex_simps simp add: Bex_def ex_simps[symmetric] eucl_le[where 'a='a] setle_def
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   501
      intro!: cSup_unique)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   502
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   503
lemma interval_lowerbound[simp]:
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
   504
  "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i \<Longrightarrow>
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
   505
    interval_lowerbound {a..b} = (a::'a::ordered_euclidean_space)"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
   506
  unfolding interval_lowerbound_def euclidean_representation_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
   507
  by (auto simp del: ex_simps simp add: Bex_def ex_simps[symmetric] eucl_le[where 'a='a] setge_def
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   508
      intro!: cInf_unique)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   509
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   510
lemmas interval_bounds = interval_upperbound interval_lowerbound
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   511
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   512
lemma interval_bounds'[simp]:
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   513
  assumes "{a..b} \<noteq> {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   514
  shows "interval_upperbound {a..b} = b"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   515
    and "interval_lowerbound {a..b} = a"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   516
  using assms unfolding interval_ne_empty by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   517
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   518
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   519
subsection {* Content (length, area, volume...) of an interval. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   520
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
   521
definition "content (s::('a::ordered_euclidean_space) set) =
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
   522
  (if s = {} then 0 else (\<Prod>i\<in>Basis. (interval_upperbound s)\<bullet>i - (interval_lowerbound s)\<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
   523
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   524
lemma interval_not_empty: "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i \<Longrightarrow> {a..b::'a::ordered_euclidean_space} \<noteq> {}"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
   525
  unfolding interval_eq_empty unfolding not_ex not_less 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
   526
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   527
lemma content_closed_interval:
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   528
  fixes a :: "'a::ordered_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
   529
  assumes "\<forall>i\<in>Basis. a\<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
   530
  shows "content {a..b} = (\<Prod>i\<in>Basis. b\<bullet>i - a\<bullet>i)"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   531
  using interval_not_empty[OF assms]
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   532
  unfolding content_def interval_upperbound[OF assms] interval_lowerbound[OF assms]
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   533
  by auto
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   534
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   535
lemma content_closed_interval':
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   536
  fixes a :: "'a::ordered_euclidean_space"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   537
  assumes "{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
   538
  shows "content {a..b} = (\<Prod>i\<in>Basis. b\<bullet>i - a\<bullet>i)"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   539
  apply (rule content_closed_interval)
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   540
  using assms
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   541
  unfolding interval_ne_empty
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   542
  apply assumption
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   543
  done
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   544
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   545
lemma content_real: "a \<le> b \<Longrightarrow> content {a..b} = b - a"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   546
  unfolding content_def 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
   547
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   548
lemma content_singleton[simp]: "content {a} = 0"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   549
proof -
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   550
  have "content {a .. a} = 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
   551
    by (subst content_closed_interval) (auto simp: ex_in_conv)
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   552
  then show ?thesis by simp
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   553
qed
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
   554
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   555
lemma content_unit[intro]: "content{0..One::'a::ordered_euclidean_space} = 1"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   556
proof -
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   557
  have *: "\<forall>i\<in>Basis. (0::'a)\<bullet>i \<le> (One::'a)\<bullet>i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   558
    by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   559
  have "0 \<in> {0..One::'a}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   560
    unfolding mem_interval by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   561
  then show ?thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   562
    unfolding content_def interval_bounds[OF *] using setprod_1 by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   563
qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   564
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   565
lemma content_pos_le[intro]:
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   566
  fixes a::"'a::ordered_euclidean_space"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   567
  shows "0 \<le> content {a..b}"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   568
proof (cases "{a..b} = {}")
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   569
  case False
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   570
  then have *: "\<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   571
    unfolding interval_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
   572
  have "(\<Prod>i\<in>Basis. interval_upperbound {a..b} \<bullet> i - interval_lowerbound {a..b} \<bullet> i) \<ge> 0"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   573
    apply (rule setprod_nonneg)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   574
    unfolding interval_bounds[OF *]
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   575
    using *
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
   576
    apply (erule_tac x=x in ballE)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   577
    apply auto
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   578
    done
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   579
  then show ?thesis
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   580
    unfolding content_def by (auto simp del:interval_bounds')
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   581
next
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   582
  case True
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   583
  then show ?thesis
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   584
    unfolding content_def by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   585
qed
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   586
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   587
lemma content_pos_lt:
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   588
  fixes a :: "'a::ordered_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
   589
  assumes "\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   590
  shows "0 < content {a..b}"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   591
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
   592
  have help_lemma1: "\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i \<Longrightarrow> \<forall>i\<in>Basis. a\<bullet>i \<le> ((b\<bullet>i)::real)"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   593
    apply rule
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   594
    apply (erule_tac x=i in ballE)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   595
    apply auto
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   596
    done
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   597
  show ?thesis
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   598
    unfolding content_closed_interval[OF help_lemma1[OF assms]]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   599
    apply (rule setprod_pos)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   600
    using assms
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   601
    apply (erule_tac x=x in ballE)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   602
    apply auto
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   603
    done
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   604
qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   605
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   606
lemma content_eq_0:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   607
  "content{a..b::'a::ordered_euclidean_space} = 0 \<longleftrightarrow> (\<exists>i\<in>Basis. b\<bullet>i \<le> a\<bullet>i)"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   608
proof (cases "{a..b} = {}")
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   609
  case True
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   610
  then show ?thesis
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   611
    unfolding content_def if_P[OF True]
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   612
    unfolding interval_eq_empty
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   613
    apply -
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
   614
    apply (rule, erule 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
   615
    apply (rule_tac x = i in bexI)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   616
    apply auto
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   617
    done
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   618
next
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   619
  case False
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   620
  then have "\<forall>i\<in>Basis. b \<bullet> i \<ge> a \<bullet> i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   621
    unfolding interval_eq_empty not_ex not_less
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   622
    by fastforce
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   623
  then 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
   624
    unfolding content_def if_not_P[OF False] setprod_zero_iff[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
   625
    by (auto intro!: bexI)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   626
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   627
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   628
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
   629
  by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   630
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   631
lemma content_closed_interval_cases:
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   632
  "content {a..b::'a::ordered_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
   633
    (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)"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
   634
  by (auto simp: not_le content_eq_0 intro: less_imp_le content_closed_interval)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   635
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   636
lemma content_eq_0_interior: "content {a..b} = 0 \<longleftrightarrow> interior({a..b}) = {}"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   637
  unfolding content_eq_0 interior_closed_interval interval_eq_empty
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   638
  by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   639
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   640
lemma content_pos_lt_eq:
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   641
  "0 < content {a..b::'a::ordered_euclidean_space} \<longleftrightarrow> (\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i)"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   642
  apply rule
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   643
  defer
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   644
  apply (rule content_pos_lt, assumption)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   645
proof -
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   646
  assume "0 < content {a..b}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   647
  then have "content {a..b} \<noteq> 0" by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   648
  then show "\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   649
    unfolding content_eq_0 not_ex not_le by fastforce
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   650
qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   651
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   652
lemma content_empty [simp]: "content {} = 0"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   653
  unfolding content_def by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   654
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   655
lemma content_subset:
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   656
  assumes "{a..b} \<subseteq> {c..d}"
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   657
  shows "content {a..b::'a::ordered_euclidean_space} \<le> content {c..d}"
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   658
proof (cases "{a..b} = {}")
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   659
  case True
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   660
  then show ?thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   661
    using content_pos_le[of c d] by auto
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   662
next
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   663
  case False
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   664
  then have ab_ne: "\<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   665
    unfolding interval_ne_empty by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   666
  then have ab_ab: "a\<in>{a..b}" "b\<in>{a..b}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   667
    unfolding mem_interval by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   668
  have "{c..d} \<noteq> {}" using assms False by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   669
  then have cd_ne: "\<forall>i\<in>Basis. c \<bullet> i \<le> d \<bullet> i"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   670
    using assms unfolding interval_ne_empty by auto
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   671
  show ?thesis
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   672
    unfolding content_def
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   673
    unfolding interval_bounds[OF ab_ne] interval_bounds[OF cd_ne]
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   674
    unfolding if_not_P[OF False] if_not_P[OF `{c..d} \<noteq> {}`]
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   675
    apply (rule setprod_mono)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   676
    apply rule
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   677
  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
   678
    fix i :: 'a
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   679
    assume i: "i \<in> Basis"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   680
    show "0 \<le> b \<bullet> i - a \<bullet> i"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   681
      using ab_ne[THEN bspec, OF i] i 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
   682
    show "b \<bullet> i - a \<bullet> i \<le> d \<bullet> i - c \<bullet> i"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   683
      using assms[unfolded subset_eq mem_interval,rule_format,OF ab_ab(2),of i]
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   684
      using assms[unfolded subset_eq mem_interval,rule_format,OF ab_ab(1),of i]
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   685
      using i by auto
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   686
  qed
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   687
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   688
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   689
lemma content_lt_nz: "0 < content {a..b} \<longleftrightarrow> content {a..b} \<noteq> 0"
44890
22f665a2e91c new fastforce replacing fastsimp - less confusing name
nipkow
parents: 44522
diff changeset
   690
  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
   691
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   692
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   693
subsection {* The notion of a gauge --- simply an open set containing the point. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   694
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   695
definition "gauge d \<longleftrightarrow> (\<forall>x. x \<in> d x \<and> open (d x))"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   696
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   697
lemma gaugeI:
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   698
  assumes "\<And>x. x \<in> g x"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   699
    and "\<And>x. open (g x)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   700
  shows "gauge g"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   701
  using assms unfolding gauge_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   702
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   703
lemma gaugeD[dest]:
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   704
  assumes "gauge d"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   705
  shows "x \<in> d x"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   706
    and "open (d x)"
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   707
  using assms unfolding gauge_def by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   708
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   709
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
   710
  unfolding gauge_def by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   711
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   712
lemma gauge_ball[intro]: "0 < e \<Longrightarrow> gauge (\<lambda>x. ball x e)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   713
  unfolding gauge_def by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   714
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   715
lemma gauge_trivial[intro]: "gauge (\<lambda>x. ball x 1)"
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   716
  by (rule gauge_ball) auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   717
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   718
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
   719
  unfolding gauge_def by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   720
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   721
lemma gauge_inters:
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   722
  assumes "finite s"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   723
    and "\<forall>d\<in>s. gauge (f d)"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   724
  shows "gauge (\<lambda>x. \<Inter> {f d x | d. d \<in> s})"
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   725
proof -
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   726
  have *: "\<And>x. {f d x |d. d \<in> s} = (\<lambda>d. f d x) ` s"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   727
    by auto
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   728
  show ?thesis
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   729
    unfolding gauge_def unfolding *
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   730
    using assms unfolding Ball_def Inter_iff mem_Collect_eq gauge_def by auto
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   731
qed
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   732
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   733
lemma gauge_existence_lemma:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   734
  "(\<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
   735
  by (metis zero_less_one)
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   736
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   737
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   738
subsection {* Divisions. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   739
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   740
definition division_of (infixl "division'_of" 40)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   741
where
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   742
  "s division_of i \<longleftrightarrow>
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   743
    finite s \<and>
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   744
    (\<forall>k\<in>s. k \<subseteq> i \<and> k \<noteq> {} \<and> (\<exists>a b. k = {a..b})) \<and>
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   745
    (\<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
   746
    (\<Union>s = i)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   747
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   748
lemma division_ofD[dest]:
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   749
  assumes "s division_of i"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   750
  shows "finite s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   751
    and "\<And>k. k \<in> s \<Longrightarrow> k \<subseteq> i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   752
    and "\<And>k. k \<in> s \<Longrightarrow> k \<noteq> {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   753
    and "\<And>k. k \<in> s \<Longrightarrow> \<exists>a b. k = {a..b}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   754
    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
   755
    and "\<Union>s = i"
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   756
  using assms unfolding division_of_def by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   757
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   758
lemma division_ofI:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   759
  assumes "finite s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   760
    and "\<And>k. k \<in> s \<Longrightarrow> k \<subseteq> i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   761
    and "\<And>k. k \<in> s \<Longrightarrow> k \<noteq> {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   762
    and "\<And>k. k \<in> s \<Longrightarrow> \<exists>a b. k = {a..b}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   763
    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
   764
    and "\<Union>s = i"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   765
  shows "s division_of i"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   766
  using assms unfolding division_of_def by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   767
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   768
lemma division_of_finite: "s division_of i \<Longrightarrow> finite s"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   769
  unfolding division_of_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   770
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   771
lemma division_of_self[intro]: "{a..b} \<noteq> {} \<Longrightarrow> {{a..b}} division_of {a..b}"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   772
  unfolding division_of_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   773
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   774
lemma division_of_trivial[simp]: "s division_of {} \<longleftrightarrow> s = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   775
  unfolding division_of_def by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   776
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   777
lemma division_of_sing[simp]:
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   778
  "s division_of {a..a::'a::ordered_euclidean_space} \<longleftrightarrow> s = {{a..a}}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   779
  (is "?l = ?r")
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   780
proof
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   781
  assume ?r
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   782
  moreover
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   783
  {
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   784
    assume "s = {{a}}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   785
    moreover fix k assume "k\<in>s"
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   786
    ultimately have"\<exists>x y. k = {x..y}"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   787
      apply (rule_tac x=a in exI)+
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   788
      unfolding interval_sing
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   789
      apply auto
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   790
      done
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   791
  }
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   792
  ultimately show ?l
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   793
    unfolding division_of_def interval_sing by auto
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   794
next
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   795
  assume ?l
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   796
  note * = conjunctD4[OF this[unfolded division_of_def interval_sing]]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   797
  {
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   798
    fix x
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   799
    assume x: "x \<in> s" have "x = {a}"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   800
      using *(2)[rule_format,OF x] by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   801
  }
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   802
  moreover have "s \<noteq> {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   803
    using *(4) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   804
  ultimately show ?r
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   805
    unfolding interval_sing by auto
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   806
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   807
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   808
lemma elementary_empty: obtains p where "p division_of {}"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   809
  unfolding division_of_trivial by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   810
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   811
lemma elementary_interval: obtains p where "p division_of {a..b}"
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   812
  by (metis division_of_trivial division_of_self)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   813
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   814
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
   815
  unfolding division_of_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   816
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   817
lemma forall_in_division:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   818
  "d division_of i \<Longrightarrow> (\<forall>x\<in>d. P x) \<longleftrightarrow> (\<forall>a b. {a..b} \<in> d \<longrightarrow> P {a..b})"
44890
22f665a2e91c new fastforce replacing fastsimp - less confusing name
nipkow
parents: 44522
diff changeset
   819
  unfolding division_of_def by fastforce
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   820
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   821
lemma division_of_subset:
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   822
  assumes "p division_of (\<Union>p)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   823
    and "q \<subseteq> p"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   824
  shows "q division_of (\<Union>q)"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   825
proof (rule division_ofI)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   826
  note * = division_ofD[OF assms(1)]
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   827
  show "finite q"
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   828
    apply (rule finite_subset)
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   829
    using *(1) assms(2)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   830
    apply auto
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   831
    done
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   832
  {
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   833
    fix k
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   834
    assume "k \<in> q"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   835
    then have kp: "k \<in> p"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   836
      using assms(2) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   837
    show "k \<subseteq> \<Union>q"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   838
      using `k \<in> q` by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   839
    show "\<exists>a b. k = {a..b}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   840
      using *(4)[OF kp] by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   841
    show "k \<noteq> {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   842
      using *(3)[OF kp] by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   843
  }
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   844
  fix k1 k2
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   845
  assume "k1 \<in> q" "k2 \<in> q" "k1 \<noteq> k2"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   846
  then have **: "k1 \<in> p" "k2 \<in> p" "k1 \<noteq> k2"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   847
    using assms(2) by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   848
  show "interior k1 \<inter> interior k2 = {}"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   849
    using *(5)[OF **] by auto
49698
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   850
qed auto
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   851
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   852
lemma division_of_union_self[intro]: "p division_of s \<Longrightarrow> p division_of (\<Union>p)"
f68e237e8c10 tuned proofs;
wenzelm
parents: 49675
diff changeset
   853
  unfolding division_of_def by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   854
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   855
lemma division_of_content_0:
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   856
  assumes "content {a..b} = 0" "d division_of {a..b}"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   857
  shows "\<forall>k\<in>d. content k = 0"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   858
  unfolding forall_in_division[OF assms(2)]
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   859
  apply (rule,rule,rule)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   860
  apply (drule division_ofD(2)[OF assms(2)])
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   861
  apply (drule content_subset) unfolding assms(1)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   862
proof -
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   863
  case goal1
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   864
  then show ?case using content_pos_le[of a b] by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   865
qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   866
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   867
lemma division_inter:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   868
  fixes s1 s2 :: "'a::ordered_euclidean_space set"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   869
  assumes "p1 division_of s1"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   870
    and "p2 division_of s2"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   871
  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
   872
  (is "?A' division_of _")
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   873
proof -
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   874
  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
   875
  have *: "?A' = ?A" by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   876
  show ?thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   877
    unfolding *
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   878
  proof (rule division_ofI)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   879
    have "?A \<subseteq> (\<lambda>(x, y). x \<inter> y) ` (p1 \<times> p2)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   880
      by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   881
    moreover have "finite (p1 \<times> p2)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   882
      using assms unfolding division_of_def by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   883
    ultimately show "finite ?A" by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   884
    have *: "\<And>s. \<Union>{x\<in>s. x \<noteq> {}} = \<Union>s"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   885
      by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   886
    show "\<Union>?A = s1 \<inter> s2"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   887
      apply (rule set_eqI)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   888
      unfolding * and Union_image_eq UN_iff
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   889
      using division_ofD(6)[OF assms(1)] and division_ofD(6)[OF assms(2)]
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   890
      apply auto
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   891
      done
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   892
    {
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   893
      fix k
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   894
      assume "k \<in> ?A"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   895
      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
   896
        by auto
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   897
      then show "k \<noteq> {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   898
        by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   899
      show "k \<subseteq> s1 \<inter> s2"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   900
        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
   901
        unfolding k by auto
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   902
      obtain a1 b1 where k1: "k1 = {a1..b1}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   903
        using division_ofD(4)[OF assms(1) k(2)] by blast
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   904
      obtain a2 b2 where k2: "k2 = {a2..b2}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   905
        using division_ofD(4)[OF assms(2) k(3)] by blast
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   906
      show "\<exists>a b. k = {a..b}"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   907
        unfolding k k1 k2 unfolding inter_interval by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   908
    }
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   909
    fix k1 k2
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   910
    assume "k1 \<in> ?A"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   911
    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
   912
      by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   913
    assume "k2 \<in> ?A"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   914
    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
   915
      by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   916
    assume "k1 \<noteq> k2"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   917
    then have th: "x1 \<noteq> x2 \<or> y1 \<noteq> y2"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   918
      unfolding k1 k2 by auto
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   919
    have *: "interior x1 \<inter> interior x2 = {} \<or> interior y1 \<inter> interior y2 = {} \<Longrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   920
      interior (x1 \<inter> y1) \<subseteq> interior x1 \<Longrightarrow> interior (x1 \<inter> y1) \<subseteq> interior y1 \<Longrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   921
      interior (x2 \<inter> y2) \<subseteq> interior x2 \<Longrightarrow> interior (x2 \<inter> y2) \<subseteq> interior y2 \<Longrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   922
      interior (x1 \<inter> y1) \<inter> interior (x2 \<inter> y2) = {}" by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   923
    show "interior k1 \<inter> interior k2 = {}"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   924
      unfolding k1 k2
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   925
      apply (rule *)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   926
      defer
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   927
      apply (rule_tac[1-4] interior_mono)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   928
      using division_ofD(5)[OF assms(1) k1(2) k2(2)]
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   929
      using division_ofD(5)[OF assms(2) k1(3) k2(3)]
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   930
      using th
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   931
      apply auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   932
      done
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   933
  qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   934
qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   935
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   936
lemma division_inter_1:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   937
  assumes "d division_of i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   938
    and "{a..b::'a::ordered_euclidean_space} \<subseteq> i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   939
  shows "{{a..b} \<inter> k | k. k \<in> d \<and> {a..b} \<inter> k \<noteq> {}} division_of {a..b}"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   940
proof (cases "{a..b} = {}")
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   941
  case True
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   942
  show ?thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   943
    unfolding True and division_of_trivial by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   944
next
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   945
  case False
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   946
  have *: "{a..b} \<inter> i = {a..b}" using assms(2) by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   947
  show ?thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   948
    using division_inter[OF division_of_self[OF False] assms(1)]
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   949
    unfolding * by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   950
qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   951
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   952
lemma elementary_inter:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   953
  fixes s t :: "'a::ordered_euclidean_space set"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   954
  assumes "p1 division_of s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   955
    and "p2 division_of t"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   956
  shows "\<exists>p. p division_of (s \<inter> t)"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   957
  apply rule
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   958
  apply (rule division_inter[OF assms])
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   959
  done
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   960
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   961
lemma elementary_inters:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   962
  assumes "finite f"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   963
    and "f \<noteq> {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   964
    and "\<forall>s\<in>f. \<exists>p. p division_of (s::('a::ordered_euclidean_space) set)"
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   965
  shows "\<exists>p. p division_of (\<Inter> f)"
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   966
  using assms
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   967
proof (induct f rule: finite_induct)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   968
  case (insert x f)
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   969
  show ?case
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   970
  proof (cases "f = {}")
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   971
    case True
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   972
    then show ?thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
   973
      unfolding True using insert by auto
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   974
  next
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   975
    case False
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   976
    obtain p where "p division_of \<Inter>f"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   977
      using insert(3)[OF False insert(5)[unfolded ball_simps,THEN conjunct2]] ..
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   978
    moreover obtain px where "px division_of x"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   979
      using insert(5)[rule_format,OF insertI1] ..
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   980
    ultimately show ?thesis
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   981
      apply -
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   982
      unfolding Inter_insert
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   983
      apply (rule elementary_inter)
49970
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   984
      apply assumption
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   985
      apply assumption
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   986
      done
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   987
  qed
ca5ab959c0ae tuned proofs;
wenzelm
parents: 49698
diff changeset
   988
qed auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   989
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
   990
lemma division_disjoint_union:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   991
  assumes "p1 division_of s1"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   992
    and "p2 division_of s2"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   993
    and "interior s1 \<inter> interior s2 = {}"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   994
  shows "(p1 \<union> p2) division_of (s1 \<union> s2)"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
   995
proof (rule division_ofI)
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   996
  note d1 = division_ofD[OF assms(1)]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   997
  note d2 = division_ofD[OF assms(2)]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   998
  show "finite (p1 \<union> p2)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
   999
    using d1(1) d2(1) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1000
  show "\<Union>(p1 \<union> p2) = s1 \<union> s2"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1001
    using d1(6) d2(6) by auto
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1002
  {
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1003
    fix k1 k2
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1004
    assume as: "k1 \<in> p1 \<union> p2" "k2 \<in> p1 \<union> p2" "k1 \<noteq> k2"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1005
    moreover
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1006
    let ?g="interior k1 \<inter> interior k2 = {}"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1007
    {
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1008
      assume as: "k1\<in>p1" "k2\<in>p2"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1009
      have ?g
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1010
        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
  1011
        using assms(3) by blast
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1012
    }
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1013
    moreover
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1014
    {
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1015
      assume as: "k1\<in>p2" "k2\<in>p1"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1016
      have ?g
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1017
        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
  1018
        using assms(3) by blast
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1019
    }
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1020
    ultimately show ?g
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1021
      using d1(5)[OF _ _ as(3)] and d2(5)[OF _ _ as(3)] by auto
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1022
  }
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1023
  fix k
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1024
  assume k: "k \<in> p1 \<union> p2"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1025
  show "k \<subseteq> s1 \<union> s2"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1026
    using k d1(2) d2(2) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1027
  show "k \<noteq> {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1028
    using k d1(3) d2(3) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1029
  show "\<exists>a b. k = {a..b}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1030
    using k d1(4) d2(4) by auto
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1031
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1032
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1033
lemma partial_division_extend_1:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1034
  fixes a b c d :: "'a::ordered_euclidean_space"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1035
  assumes incl: "{c..d} \<subseteq> {a..b}"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1036
    and nonempty: "{c..d} \<noteq> {}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1037
  obtains p where "p division_of {a..b}" "{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
  1038
proof
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1039
  let ?B = "\<lambda>f::'a\<Rightarrow>'a \<times> 'a.
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1040
    {(\<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
  1041
  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
  1042
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1043
  show "{c .. d} \<in> p"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1044
    unfolding p_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
  1045
    by (auto simp add: interval_eq_empty eucl_le[where 'a='a]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1046
        intro!: image_eqI[where x="\<lambda>(i::'a)\<in>Basis. (c, d)"])
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1047
  {
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1048
    fix i :: 'a
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1049
    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
  1050
    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"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1051
      unfolding interval_eq_empty subset_interval by (auto simp: not_le)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1052
  }
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
  1053
  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
  1054
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  1055
  show "p division_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
  1056
  proof (rule division_ofI)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1057
    show "finite p"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1058
      unfolding p_def by (auto intro!: finite_PiE)
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1059
    {
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1060
      fix k
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1061
      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
  1062
      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
  1063
        by (auto simp: p_def)
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1064
      then show "\<exists>a b. k = {a..b}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1065
        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
  1066
      have "k \<subseteq> {a..b} \<and> k \<noteq> {}"
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
      proof (simp add: k interval_eq_empty subset_interval not_less, safe)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  1068
        fix i :: 'a
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  1069
        assume i: "i \<in> Basis"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1070
        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
  1071
          by (auto simp: PiE_iff)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  1072
        with i ord[of i]
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1073
        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"
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
  1074
          by (auto simp: subset_iff eucl_le[where 'a='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
  1075
      qed
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1076
      then show "k \<noteq> {}" "k \<subseteq> {a .. b}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1077
        by auto
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1078
      {
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1079
        fix l
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1080
        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
  1081
        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
  1082
          by (auto simp: p_def)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1083
        assume "l \<noteq> k"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1084
        have "\<exists>i\<in>Basis. f i \<noteq> g i"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1085
        proof (rule ccontr)
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1086
          assume "\<not> ?thesis"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1087
          with f g have "f = g"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1088
            by (auto simp: PiE_iff extensional_def intro!: ext)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1089
          with `l \<noteq> k` show False
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1090
            by (simp add: l k)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1091
        qed
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1092
        then obtain i where *: "i \<in> Basis" "f i \<noteq> g i" ..
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1093
        then have "f i = (a, c) \<or> f i = (c, d) \<or> f i = (d, b)"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1094
            "g i = (a, c) \<or> g i = (c, d) \<or> g i = (d, b)"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1095
          using f g by (auto simp: PiE_iff)
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1096
        with * ord[of i] show "interior l \<inter> interior k = {}"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1097
          by (auto simp add: l k interior_closed_interval disjoint_interval intro!: bexI[of _ i])
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1098
      }
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1099
      note `k \<subseteq> {a.. b}`
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1100
    }
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
  1101
    moreover
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1102
    {
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1103
      fix x assume x: "x \<in> {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
  1104
      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
  1105
      proof
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1106
        fix i :: 'a
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1107
        assume "i \<in> Basis"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1108
        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
  1109
        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
  1110
            (d \<bullet> i \<le> x \<bullet> i \<and> x \<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
  1111
          by (auto simp: eucl_le[where 'a='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
  1112
        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
  1113
          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
  1114
      qed
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1115
      then obtain f where
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1116
        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
  1117
        unfolding bchoice_iff ..
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  1118
      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
  1119
        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
  1120
      moreover from f have "x \<in> ?B (restrict f 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
  1121
        by (auto simp: mem_interval eucl_le[where 'a='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
  1122
      ultimately have "\<exists>k\<in>p. x \<in> k"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1123
        unfolding p_def by blast
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1124
    }
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
  1125
    ultimately show "\<Union>p = {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
  1126
      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
  1127
  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
  1128
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1129
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1130
lemma partial_division_extend_interval:
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1131
  assumes "p division_of (\<Union>p)" "(\<Union>p) \<subseteq> {a..b}"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1132
  obtains q where "p \<subseteq> q" "q division_of {a..b::'a::ordered_euclidean_space}"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1133
proof (cases "p = {}")
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1134
  case True
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1135
  obtain q where "q division_of {a..b}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1136
    by (rule elementary_interval)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1137
  then show ?thesis
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1138
    apply -
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1139
    apply (rule that[of q])
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1140
    unfolding True
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1141
    apply auto
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1142
    done
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1143
next
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1144
  case False
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1145
  note p = division_ofD[OF assms(1)]
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1146
  have *: "\<forall>k\<in>p. \<exists>q. q division_of {a..b} \<and> k \<in> q"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1147
  proof
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1148
    case goal1
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1149
    obtain c d where k: "k = {c..d}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1150
      using p(4)[OF goal1] by blast
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1151
    have *: "{c..d} \<subseteq> {a..b}" "{c..d} \<noteq> {}"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1152
      using p(2,3)[OF goal1, unfolded k] using assms(2) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1153
    obtain q where "q division_of {a..b}" "{c..d} \<in> q"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1154
      by (rule partial_division_extend_1[OF *])
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1155
    then show ?case
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1156
      unfolding k by auto
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1157
  qed
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1158
  obtain q where q: "\<And>x. x \<in> p \<Longrightarrow> q x division_of {a..b}" "\<And>x. x \<in> p \<Longrightarrow> x \<in> q x"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1159
    using bchoice[OF *] by blast
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1160
  have "\<And>x. x \<in> p \<Longrightarrow> \<exists>d. d division_of \<Union>(q x - {x})"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1161
    apply rule
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1162
    apply (rule_tac p="q x" in division_of_subset)
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1163
  proof -
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1164
    fix x
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1165
    assume x: "x \<in> p"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1166
    show "q x division_of \<Union>q x"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1167
      apply -
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1168
      apply (rule division_ofI)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1169
      using division_ofD[OF q(1)[OF x]]
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1170
      apply auto
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1171
      done
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1172
    show "q x - {x} \<subseteq> q x"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1173
      by auto
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1174
  qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1175
  then have "\<exists>d. d division_of \<Inter> ((\<lambda>i. \<Union>(q i - {i})) ` p)"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1176
    apply -
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1177
    apply (rule elementary_inters)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1178
    apply (rule finite_imageI[OF p(1)])
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1179
    unfolding image_is_empty
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1180
    apply (rule False)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1181
    apply auto
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1182
    done
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1183
  then obtain d where d: "d division_of \<Inter>((\<lambda>i. \<Union>(q i - {i})) ` p)" ..
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1184
  show ?thesis
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1185
    apply (rule that[of "d \<union> p"])
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1186
  proof -
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1187
    have *: "\<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
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1188
    have *: "{a..b} = \<Inter>((\<lambda>i. \<Union>(q i - {i})) ` p) \<union> \<Union>p"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1189
      apply (rule *[OF False])
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1190
    proof
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1191
      fix i
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1192
      assume i: "i \<in> p"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1193
      show "\<Union>(q i - {i}) \<union> i = {a..b}"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1194
        using division_ofD(6)[OF q(1)[OF i]] using q(2)[OF i] by auto
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1195
    qed
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1196
    show "d \<union> p division_of {a..b}"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1197
      unfolding *
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1198
      apply (rule division_disjoint_union[OF d assms(1)])
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1199
      apply (rule inter_interior_unions_intervals)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1200
      apply (rule p open_interior ballI)+
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1201
      apply assumption
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1202
    proof
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1203
      fix k
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1204
      assume k: "k \<in> p"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1205
      have *: "\<And>u t s. u \<subseteq> s \<Longrightarrow> s \<inter> t = {} \<Longrightarrow> u \<inter> t = {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1206
        by auto
52141
eff000cab70f weaker precendence of syntax for big intersection and union on sets
haftmann
parents: 51642
diff changeset
  1207
      show "interior (\<Inter> ((\<lambda>i. \<Union>(q i - {i})) ` p)) \<inter> interior k = {}"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1208
        apply (rule *[of _ "interior (\<Union>(q k - {k}))"])
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1209
        defer
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1210
        apply (subst Int_commute)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1211
        apply (rule inter_interior_unions_intervals)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1212
      proof -
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1213
        note qk=division_ofD[OF q(1)[OF k]]
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1214
        show "finite (q k - {k})" "open (interior k)" "\<forall>t\<in>q k - {k}. \<exists>a b. t = {a..b}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1215
          using qk by auto
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1216
        show "\<forall>t\<in>q k - {k}. interior k \<inter> interior t = {}"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1217
          using qk(5) using q(2)[OF k] by auto
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1218
        have *: "\<And>x s. x \<in> s \<Longrightarrow> \<Inter>s \<subseteq> x"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1219
          by auto
52141
eff000cab70f weaker precendence of syntax for big intersection and union on sets
haftmann
parents: 51642
diff changeset
  1220
        show "interior (\<Inter> ((\<lambda>i. \<Union>(q i - {i})) ` p)) \<subseteq> interior (\<Union>(q k - {k}))"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1221
          apply (rule interior_mono *)+
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1222
          using k
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1223
          apply auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1224
          done
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1225
      qed
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1226
    qed
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1227
  qed auto
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1228
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1229
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1230
lemma elementary_bounded[dest]:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1231
  fixes s :: "'a::ordered_euclidean_space set"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1232
  shows "p division_of s \<Longrightarrow> bounded s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1233
  unfolding division_of_def by (metis bounded_Union bounded_interval)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1234
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1235
lemma elementary_subset_interval:
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1236
  "p division_of s \<Longrightarrow> \<exists>a b. s \<subseteq> {a..b::'a::ordered_euclidean_space}"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1237
  by (meson elementary_bounded bounded_subset_closed_interval)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1238
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1239
lemma division_union_intervals_exists:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1240
  fixes a b :: "'a::ordered_euclidean_space"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1241
  assumes "{a..b} \<noteq> {}"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1242
  obtains p where "(insert {a..b} p) division_of ({a..b} \<union> {c..d})"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1243
proof (cases "{c..d} = {}")
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1244
  case True
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1245
  show ?thesis
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1246
    apply (rule that[of "{}"])
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1247
    unfolding True
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1248
    using assms
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1249
    apply auto
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1250
    done
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1251
next
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1252
  case False
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1253
  show ?thesis
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1254
  proof (cases "{a..b} \<inter> {c..d} = {}")
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1255
    case True
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1256
    have *: "\<And>a b. {a, b} = {a} \<union> {b}" by auto
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1257
    show ?thesis
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1258
      apply (rule that[of "{{c..d}}"])
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1259
      unfolding *
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1260
      apply (rule division_disjoint_union)
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1261
      using `{c..d} \<noteq> {}` True assms
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1262
      using interior_subset
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1263
      apply auto
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1264
      done
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1265
  next
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1266
    case False
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1267
    obtain u v where uv: "{a..b} \<inter> {c..d} = {u..v}"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1268
      unfolding inter_interval by auto
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1269
    have *: "{u..v} \<subseteq> {c..d}" using uv by auto
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1270
    obtain p where "p division_of {c..d}" "{u..v} \<in> p"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1271
      by (rule partial_division_extend_1[OF * False[unfolded uv]])
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1272
    note p = this division_ofD[OF this(1)]
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1273
    have *: "{a..b} \<union> {c..d} = {a..b} \<union> \<Union>(p - {{u..v}})" "\<And>x s. insert x s = {x} \<union> s"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1274
      using p(8) unfolding uv[symmetric] by auto
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1275
    show ?thesis
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1276
      apply (rule that[of "p - {{u..v}}"])
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1277
      unfolding *(1)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1278
      apply (subst *(2))
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1279
      apply (rule division_disjoint_union)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1280
      apply (rule, rule assms)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1281
      apply (rule division_of_subset[of p])
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1282
      apply (rule division_of_union_self[OF p(1)])
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1283
      defer
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1284
      unfolding interior_inter[symmetric]
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1285
    proof -
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1286
      have *: "\<And>cd p uv ab. p \<subseteq> cd \<Longrightarrow> ab \<inter> cd = uv \<Longrightarrow> ab \<inter> p = uv \<inter> p" by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1287
      have "interior ({a..b} \<inter> \<Union>(p - {{u..v}})) = interior({u..v} \<inter> \<Union>(p - {{u..v}}))"
50945
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1288
        apply (rule arg_cong[of _ _ interior])
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1289
        apply (rule *[OF _ uv])
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1290
        using p(8)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1291
        apply auto
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1292
        done
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1293
      also have "\<dots> = {}"
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1294
        unfolding interior_inter
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1295
        apply (rule inter_interior_unions_intervals)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1296
        using p(6) p(7)[OF p(2)] p(3)
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1297
        apply auto
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1298
        done
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1299
      finally show "interior ({a..b} \<inter> \<Union>(p - {{u..v}})) = {}" .
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1300
    qed auto
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1301
  qed
917e76c53f82 tuned proofs;
wenzelm
parents: 50919
diff changeset
  1302
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1303
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1304
lemma division_of_unions:
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1305
  assumes "finite f"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1306
    and "\<And>p. p \<in> f \<Longrightarrow> p division_of (\<Union>p)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1307
    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
  1308
  shows "\<Union>f division_of \<Union>\<Union>f"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1309
  apply (rule division_ofI)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1310
  prefer 5
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1311
  apply (rule assms(3)|assumption)+
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1312
  apply (rule finite_Union assms(1))+
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1313
  prefer 3
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1314
  apply (erule UnionE)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1315
  apply (rule_tac s=X in division_ofD(3)[OF assms(2)])
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1316
  using division_ofD[OF assms(2)]
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1317
  apply auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1318
  done
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1319
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1320
lemma elementary_union_interval:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1321
  fixes a b :: "'a::ordered_euclidean_space"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1322
  assumes "p division_of \<Union>p"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1323
  obtains q where "q division_of ({a..b} \<union> \<Union>p)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1324
proof -
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1325
  note assm = division_ofD[OF assms]
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1326
  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
  1327
    by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1328
  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
  1329
    by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1330
  {
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1331
    presume "p = {} \<Longrightarrow> thesis"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1332
      "{a..b} = {} \<Longrightarrow> thesis"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1333
      "{a..b} \<noteq> {} \<Longrightarrow> interior {a..b} = {} \<Longrightarrow> thesis"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1334
      "p \<noteq> {} \<Longrightarrow> interior {a..b}\<noteq>{} \<Longrightarrow> {a..b} \<noteq> {} \<Longrightarrow> thesis"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1335
    then show thesis by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1336
  next
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1337
    assume as: "p = {}"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1338
    obtain p where "p division_of {a..b}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1339
      by (rule elementary_interval)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1340
    then show thesis
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1341
      apply -
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1342
      apply (rule that[of p])
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1343
      unfolding as
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1344
      apply auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1345
      done
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1346
  next
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1347
    assume as: "{a..b} = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1348
    show thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1349
      apply (rule that)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1350
      unfolding as
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1351
      using assms
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1352
      apply auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1353
      done
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1354
  next
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1355
    assume as: "interior {a..b} = {}" "{a..b} \<noteq> {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1356
    show thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1357
      apply (rule that[of "insert {a..b} p"],rule division_ofI)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1358
      unfolding finite_insert
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1359
      apply (rule assm(1)) unfolding Union_insert
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1360
      using assm(2-4) as
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1361
      apply -
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1362
      apply (fastforce dest: assm(5))+
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1363
      done
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1364
  next
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1365
    assume as: "p \<noteq> {}" "interior {a..b} \<noteq> {}" "{a..b} \<noteq> {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1366
    have "\<forall>k\<in>p. \<exists>q. (insert {a..b} q) division_of ({a..b} \<union> k)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1367
    proof
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1368
      case goal1
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1369
      from assm(4)[OF this] obtain c d where "k = {c..d}" by blast
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1370
      then show ?case
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1371
        apply -
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1372
        apply (rule division_union_intervals_exists[OF as(3), of c d])
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1373
        apply auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1374
        done
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1375
    qed
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1376
    from bchoice[OF this] obtain q where "\<forall>x\<in>p. insert {a..b} (q x) division_of {a..b} \<union> x" ..
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1377
    note q = division_ofD[OF this[rule_format]]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1378
    let ?D = "\<Union>{insert {a..b} (q k) | k. k \<in> p}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1379
    show thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1380
      apply (rule that[of "?D"])
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1381
      apply (rule division_ofI)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1382
    proof -
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1383
      have *: "{insert {a..b} (q k) |k. k \<in> p} = (\<lambda>k. insert {a..b} (q k)) ` p"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1384
        by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1385
      show "finite ?D"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1386
        apply (rule finite_Union)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1387
        unfolding *
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1388
        apply (rule finite_imageI)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1389
        using assm(1) q(1)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1390
        apply auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1391
        done
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1392
      show "\<Union>?D = {a..b} \<union> \<Union>p"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1393
        unfolding * lem1
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1394
        unfolding lem2[OF as(1), of "{a..b}", symmetric]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1395
        using q(6)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1396
        by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1397
      fix k
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1398
      assume k: "k \<in> ?D"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1399
      then show "k \<subseteq> {a..b} \<union> \<Union>p"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1400
        using q(2) by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1401
      show "k \<noteq> {}"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1402
        using q(3) k by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1403
      show "\<exists>a b. k = {a..b}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1404
        using q(4) k by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1405
      fix k'
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1406
      assume k': "k' \<in> ?D" "k \<noteq> k'"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1407
      obtain x where x: "k \<in> insert {a..b} (q x)" "x\<in>p"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1408
        using k by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1409
      obtain x' where x': "k'\<in>insert {a..b} (q x')" "x'\<in>p"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1410
        using k' by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1411
      show "interior k \<inter> interior k' = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1412
      proof (cases "x = x'")
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1413
        case True
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1414
        show ?thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1415
          apply(rule q(5))
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1416
          using x x' k'
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1417
          unfolding True
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1418
          apply auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1419
          done
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1420
      next
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1421
        case False
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1422
        {
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1423
          presume "k = {a..b} \<Longrightarrow> ?thesis"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1424
            and "k' = {a..b} \<Longrightarrow> ?thesis"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1425
            and "k \<noteq> {a..b} \<Longrightarrow> k' \<noteq> {a..b} \<Longrightarrow> ?thesis"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1426
          then show ?thesis by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1427
        next
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1428
          assume as': "k  = {a..b}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1429
          show ?thesis
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1430
            apply (rule q(5))
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1431
            using x' k'(2)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1432
            unfolding as'
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1433
            apply auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1434
            done
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1435
        next
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1436
          assume as': "k' = {a..b}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1437
          show ?thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1438
            apply (rule q(5))
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1439
            using x  k'(2)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1440
            unfolding as'
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1441
            apply auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1442
            done
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1443
        }
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1444
        assume as': "k \<noteq> {a..b}" "k' \<noteq> {a..b}"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1445
        obtain c d where k: "k = {c..d}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1446
          using q(4)[OF x(2,1)] by blast
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1447
        have "interior k \<inter> interior {a..b} = {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1448
          apply (rule q(5))
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1449
          using x k'(2)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1450
          using as'
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1451
          apply auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1452
          done
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1453
        then have "interior k \<subseteq> interior x"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1454
          apply -
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1455
          apply (rule interior_subset_union_intervals[OF k _ as(2) q(2)[OF x(2,1)]])
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1456
          apply auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1457
          done
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1458
        moreover
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1459
        obtain c d where c_d: "k' = {c..d}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1460
          using q(4)[OF x'(2,1)] by blast
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1461
        have "interior k' \<inter> interior {a..b} = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1462
          apply (rule q(5))
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1463
          using x' k'(2)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1464
          using as'
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1465
          apply auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1466
          done
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1467
        then have "interior k' \<subseteq> interior x'"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1468
          apply -
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1469
          apply (rule interior_subset_union_intervals[OF c_d _ as(2) q(2)[OF x'(2,1)]])
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1470
          apply auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1471
          done
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1472
        ultimately show ?thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1473
          using assm(5)[OF x(2) x'(2) False] by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1474
      qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1475
    qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1476
  }
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1477
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1478
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1479
lemma elementary_unions_intervals:
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1480
  assumes fin: "finite f"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1481
    and "\<And>s. s \<in> f \<Longrightarrow> \<exists>a b. s = {a..b::'a::ordered_euclidean_space}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1482
  obtains p where "p division_of (\<Union>f)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1483
proof -
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1484
  have "\<exists>p. p division_of (\<Union>f)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1485
  proof (induct_tac f rule:finite_subset_induct)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1486
    show "\<exists>p. p division_of \<Union>{}" using elementary_empty by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1487
  next
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1488
    fix x F
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1489
    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
  1490
    from this(3) obtain p where p: "p division_of \<Union>F" ..
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1491
    from assms(2)[OF as(4)] obtain a b where x: "x = {a..b}" by blast
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1492
    have *: "\<Union>F = \<Union>p"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1493
      using division_ofD[OF p] by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1494
    show "\<exists>p. p division_of \<Union>insert x F"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1495
      using elementary_union_interval[OF p[unfolded *], of a b]
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1496
      unfolding Union_insert x * by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1497
  qed (insert assms, auto)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1498
  then show ?thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1499
    apply -
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1500
    apply (erule exE)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1501
    apply (rule that)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1502
    apply auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1503
    done
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1504
qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1505
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1506
lemma elementary_union:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1507
  fixes s t :: "'a::ordered_euclidean_space set"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1508
  assumes "ps division_of s"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1509
    and "pt division_of t"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1510
  obtains p where "p division_of (s \<union> t)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1511
proof -
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1512
  have "s \<union> t = \<Union>ps \<union> \<Union>pt"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1513
    using assms unfolding division_of_def by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1514
  then have *: "\<Union>(ps \<union> pt) = s \<union> t" by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1515
  show ?thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1516
    apply -
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1517
    apply (rule elementary_unions_intervals[of "ps \<union> pt"])
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1518
    unfolding *
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1519
    prefer 3
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1520
    apply (rule_tac p=p in that)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1521
    using assms[unfolded division_of_def]
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1522
    apply auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1523
    done
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1524
qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1525
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1526
lemma partial_division_extend:
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1527
  fixes t :: "'a::ordered_euclidean_space set"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1528
  assumes "p division_of s"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1529
    and "q division_of t"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1530
    and "s \<subseteq> t"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1531
  obtains r where "p \<subseteq> r" and "r division_of t"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1532
proof -
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1533
  note divp = division_ofD[OF assms(1)] and divq = division_ofD[OF assms(2)]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1534
  obtain a b where ab: "t \<subseteq> {a..b}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1535
    using elementary_subset_interval[OF assms(2)] by auto
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1536
  obtain r1 where "p \<subseteq> r1" "r1 division_of {a..b}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1537
    apply (rule partial_division_extend_interval)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1538
    apply (rule assms(1)[unfolded divp(6)[symmetric]])
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1539
    apply (rule subset_trans)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1540
    apply (rule ab assms[unfolded divp(6)[symmetric]])+
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1541
    apply assumption
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1542
    done
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1543
  note r1 = this division_ofD[OF this(2)]
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1544
  obtain p' where "p' division_of \<Union>(r1 - p)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1545
    apply (rule elementary_unions_intervals[of "r1 - p"])
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1546
    using r1(3,6)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1547
    apply auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1548
    done
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1549
  then obtain r2 where r2: "r2 division_of (\<Union>(r1 - p)) \<inter> (\<Union>q)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1550
    apply -
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1551
    apply (drule elementary_inter[OF _ assms(2)[unfolded divq(6)[symmetric]]])
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1552
    apply auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1553
    done
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1554
  {
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1555
    fix x
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1556
    assume x: "x \<in> t" "x \<notin> s"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1557
    then have "x\<in>\<Union>r1"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1558
      unfolding r1 using ab by auto
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1559
    then obtain r where r: "r \<in> r1" "x \<in> r"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1560
      unfolding Union_iff ..
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1561
    moreover
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1562
    have "r \<notin> p"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1563
    proof
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1564
      assume "r \<in> p"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1565
      then have "x \<in> s" using divp(2) r by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1566
      then show False using x by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1567
    qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1568
    ultimately have "x\<in>\<Union>(r1 - p)" by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1569
  }
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1570
  then have *: "t = \<Union>p \<union> (\<Union>(r1 - p) \<inter> \<Union>q)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1571
    unfolding divp divq using assms(3) by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1572
  show ?thesis
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1573
    apply (rule that[of "p \<union> r2"])
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1574
    unfolding *
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1575
    defer
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1576
    apply (rule division_disjoint_union)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1577
    unfolding divp(6)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1578
    apply(rule assms r2)+
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1579
  proof -
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1580
    have "interior s \<inter> interior (\<Union>(r1-p)) = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1581
    proof (rule inter_interior_unions_intervals)
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1582
      show "finite (r1 - p)" and "open (interior s)" and "\<forall>t\<in>r1-p. \<exists>a b. t = {a..b}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1583
        using r1 by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1584
      have *: "\<And>s. (\<And>x. x \<in> s \<Longrightarrow> False) \<Longrightarrow> s = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1585
        by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1586
      show "\<forall>t\<in>r1-p. interior s \<inter> interior t = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1587
      proof
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1588
        fix m x
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1589
        assume as: "m \<in> r1 - p"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1590
        have "interior m \<inter> interior (\<Union>p) = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1591
        proof (rule inter_interior_unions_intervals)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1592
          show "finite p" and "open (interior m)" and "\<forall>t\<in>p. \<exists>a b. t = {a..b}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1593
            using divp by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1594
          show "\<forall>t\<in>p. interior m \<inter> interior t = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1595
            apply (rule, rule r1(7))
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1596
            using as
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1597
            using r1 
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1598
            apply auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1599
            done
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1600
        qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1601
        then show "interior s \<inter> interior m = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1602
          unfolding divp by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1603
      qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1604
    qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1605
    then show "interior s \<inter> interior (\<Union>(r1-p) \<inter> (\<Union>q)) = {}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1606
      using interior_subset by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1607
  qed auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1608
qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1609
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
subsection {* Tagged (partial) divisions. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1612
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1613
definition tagged_partial_division_of (infixr "tagged'_partial'_division'_of" 40)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1614
  where "s tagged_partial_division_of i \<longleftrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1615
    finite s \<and>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1616
    (\<forall>x k. (x, k) \<in> s \<longrightarrow> x \<in> k \<and> k \<subseteq> i \<and> (\<exists>a b. k = {a..b})) \<and>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1617
    (\<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
  1618
      interior k1 \<inter> interior k2 = {})"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1619
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1620
lemma tagged_partial_division_ofD[dest]:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1621
  assumes "s tagged_partial_division_of i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1622
  shows "finite s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1623
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> x \<in> k"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1624
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> k \<subseteq> i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1625
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> \<exists>a b. k = {a..b}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1626
    and "\<And>x1 k1 x2 k2. (x1,k1) \<in> s \<Longrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1627
      (x2, k2) \<in> s \<Longrightarrow> (x1, k1) \<noteq> (x2, k2) \<Longrightarrow> interior k1 \<inter> interior k2 = {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1628
  using assms unfolding tagged_partial_division_of_def by blast+
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1629
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1630
definition tagged_division_of (infixr "tagged'_division'_of" 40)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1631
  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
  1632
44167
e81d676d598e avoid duplicate rule warnings
huffman
parents: 44140
diff changeset
  1633
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
  1634
  unfolding tagged_division_of_def tagged_partial_division_of_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1635
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1636
lemma tagged_division_of:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1637
  "s tagged_division_of i \<longleftrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1638
    finite s \<and>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1639
    (\<forall>x k. (x, k) \<in> s \<longrightarrow> x \<in> k \<and> k \<subseteq> i \<and> (\<exists>a b. k = {a..b})) \<and>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1640
    (\<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
  1641
      interior k1 \<inter> interior k2 = {}) \<and>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1642
    (\<Union>{k. \<exists>x. (x,k) \<in> s} = i)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1643
  unfolding tagged_division_of_def tagged_partial_division_of_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1644
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1645
lemma tagged_division_ofI:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1646
  assumes "finite s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1647
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> x \<in> k"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1648
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> k \<subseteq> i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1649
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> \<exists>a b. k = {a..b}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1650
    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
  1651
      interior k1 \<inter> interior k2 = {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1652
    and "(\<Union>{k. \<exists>x. (x,k) \<in> s} = i)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1653
  shows "s tagged_division_of i"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1654
  unfolding tagged_division_of
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1655
  apply rule
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1656
  defer
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1657
  apply rule
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1658
  apply (rule allI impI conjI assms)+
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1659
  apply assumption
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1660
  apply rule
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1661
  apply (rule assms)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1662
  apply assumption
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1663
  apply (rule assms)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1664
  apply assumption
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1665
  using assms(1,5-)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1666
  apply blast+
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1667
  done
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1668
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1669
lemma tagged_division_ofD[dest]:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1670
  assumes "s tagged_division_of i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1671
  shows "finite s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1672
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> x \<in> k"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1673
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> k \<subseteq> i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1674
    and "\<And>x k. (x,k) \<in> s \<Longrightarrow> \<exists>a b. k = {a..b}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1675
    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
  1676
      interior k1 \<inter> interior k2 = {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1677
    and "(\<Union>{k. \<exists>x. (x,k) \<in> s} = i)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1678
  using assms unfolding tagged_division_of by blast+
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1679
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1680
lemma division_of_tagged_division:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1681
  assumes "s tagged_division_of i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1682
  shows "(snd ` s) division_of i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1683
proof (rule division_ofI)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1684
  note assm = tagged_division_ofD[OF assms]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1685
  show "\<Union>(snd ` s) = i" "finite (snd ` s)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1686
    using assm by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1687
  fix k
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1688
  assume k: "k \<in> snd ` s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1689
  then obtain xk where xk: "(xk, k) \<in> s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1690
    by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1691
  then show "k \<subseteq> i" "k \<noteq> {}" "\<exists>a b. k = {a..b}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1692
    using assm by fastforce+
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1693
  fix k'
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1694
  assume k': "k' \<in> snd ` s" "k \<noteq> k'"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1695
  from this(1) obtain xk' where xk': "(xk', k') \<in> s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1696
    by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1697
  then show "interior k \<inter> interior k' = {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1698
    apply -
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1699
    apply (rule assm(5))
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1700
    apply (rule xk xk')+
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1701
    using k'
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1702
    apply auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1703
    done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1704
qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1705
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1706
lemma partial_division_of_tagged_division:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1707
  assumes "s tagged_partial_division_of i"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1708
  shows "(snd ` s) division_of \<Union>(snd ` s)"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1709
proof (rule division_ofI)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1710
  note assm = tagged_partial_division_ofD[OF assms]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1711
  show "finite (snd ` s)" "\<Union>(snd ` s) = \<Union>(snd ` s)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1712
    using assm by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1713
  fix k
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1714
  assume k: "k \<in> snd ` s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1715
  then obtain xk where xk: "(xk, k) \<in> s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1716
    by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1717
  then show "k \<noteq> {}" "\<exists>a b. k = {a..b}" "k \<subseteq> \<Union>(snd ` s)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1718
    using assm by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1719
  fix k'
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1720
  assume k': "k' \<in> snd ` s" "k \<noteq> k'"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1721
  from this(1) obtain xk' where xk': "(xk', k') \<in> s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1722
    by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1723
  then show "interior k \<inter> interior k' = {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1724
    apply -
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1725
    apply (rule assm(5))
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1726
    apply(rule xk xk')+
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1727
    using k'
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1728
    apply auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1729
    done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1730
qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1731
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1732
lemma tagged_partial_division_subset:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1733
  assumes "s tagged_partial_division_of i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1734
    and "t \<subseteq> s"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1735
  shows "t tagged_partial_division_of i"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1736
  using assms
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1737
  unfolding tagged_partial_division_of_def
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1738
  using finite_subset[OF assms(2)]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1739
  by blast
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1740
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1741
lemma setsum_over_tagged_division_lemma:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1742
  fixes d :: "'m::ordered_euclidean_space set \<Rightarrow> 'a::real_normed_vector"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1743
  assumes "p tagged_division_of i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1744
    and "\<And>u v. {u..v} \<noteq> {} \<Longrightarrow> content {u..v} = 0 \<Longrightarrow> d {u..v} = 0"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1745
  shows "setsum (\<lambda>(x,k). d k) p = setsum d (snd ` p)"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1746
proof -
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1747
  note assm = tagged_division_ofD[OF assms(1)]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1748
  have *: "(\<lambda>(x,k). d k) = d \<circ> snd"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1749
    unfolding o_def by (rule ext) auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1750
  show ?thesis
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1751
    unfolding *
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1752
    apply (subst eq_commute)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1753
  proof (rule setsum_reindex_nonzero)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1754
    show "finite p"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1755
      using assm by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1756
    fix x y
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1757
    assume as: "x\<in>p" "y\<in>p" "x\<noteq>y" "snd x = snd y"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1758
    obtain a b where ab: "snd x = {a..b}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1759
      using assm(4)[of "fst x" "snd x"] as(1) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1760
    have "(fst x, snd y) \<in> p" "(fst x, snd y) \<noteq> y"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1761
      unfolding as(4)[symmetric] using as(1-3) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1762
    then have "interior (snd x) \<inter> interior (snd y) = {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1763
      apply -
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1764
      apply (rule assm(5)[of "fst x" _ "fst y"])
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1765
      using as
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1766
      apply auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1767
      done
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1768
    then have "content {a..b} = 0"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1769
      unfolding as(4)[symmetric] ab content_eq_0_interior by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1770
    then have "d {a..b} = 0"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1771
      apply -
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1772
      apply (rule assms(2))
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1773
      using assm(2)[of "fst x" "snd x"] as(1)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1774
      unfolding ab[symmetric]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1775
      apply auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1776
      done
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1777
    then show "d (snd x) = 0"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1778
      unfolding ab by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1779
  qed
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1780
qed
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1781
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1782
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
  1783
  by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1784
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1785
lemma tagged_division_of_empty: "{} tagged_division_of {}"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1786
  unfolding tagged_division_of by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1787
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1788
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
  1789
  unfolding tagged_partial_division_of_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1790
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1791
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
  1792
  unfolding tagged_division_of by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1793
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1794
lemma tagged_division_of_self: "x \<in> {a..b} \<Longrightarrow> {(x,{a..b})} tagged_division_of {a..b}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1795
  by (rule tagged_division_ofI) auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1796
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1797
lemma tagged_division_union:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1798
  assumes "p1 tagged_division_of s1"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1799
    and "p2 tagged_division_of s2"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1800
    and "interior s1 \<inter> interior s2 = {}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1801
  shows "(p1 \<union> p2) tagged_division_of (s1 \<union> s2)"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1802
proof (rule tagged_division_ofI)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1803
  note p1 = tagged_division_ofD[OF assms(1)]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1804
  note p2 = tagged_division_ofD[OF assms(2)]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1805
  show "finite (p1 \<union> p2)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1806
    using p1(1) p2(1) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1807
  show "\<Union>{k. \<exists>x. (x, k) \<in> p1 \<union> p2} = s1 \<union> s2"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1808
    using p1(6) p2(6) by blast
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1809
  fix x k
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1810
  assume xk: "(x, k) \<in> p1 \<union> p2"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1811
  show "x \<in> k" "\<exists>a b. k = {a..b}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1812
    using xk p1(2,4) p2(2,4) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1813
  show "k \<subseteq> s1 \<union> s2"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1814
    using xk p1(3) p2(3) by blast
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1815
  fix x' k'
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1816
  assume xk': "(x', k') \<in> p1 \<union> p2" "(x, k) \<noteq> (x', k')"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1817
  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
  1818
    using assms(3) interior_mono by blast
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1819
  show "interior k \<inter> interior k' = {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1820
    apply (cases "(x, k) \<in> p1")
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1821
    apply (case_tac[!] "(x',k') \<in> p1")
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1822
    apply (rule p1(5))
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1823
    prefer 4
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1824
    apply (rule *)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1825
    prefer 6
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1826
    apply (subst Int_commute)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1827
    apply (rule *)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1828
    prefer 8
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1829
    apply (rule p2(5))
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1830
    using p1(3) p2(3)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1831
    using xk xk'
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1832
    apply auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1833
    done
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1834
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1835
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1836
lemma tagged_division_unions:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1837
  assumes "finite iset"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1838
    and "\<forall>i\<in>iset. pfn i tagged_division_of i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1839
    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
  1840
  shows "\<Union>(pfn ` iset) tagged_division_of (\<Union>iset)"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1841
proof (rule tagged_division_ofI)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1842
  note assm = tagged_division_ofD[OF assms(2)[rule_format]]
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1843
  show "finite (\<Union>(pfn ` iset))"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1844
    apply (rule finite_Union)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1845
    using assms
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1846
    apply auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1847
    done
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1848
  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
  1849
    by blast
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1850
  also have "\<dots> = \<Union>iset"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1851
    using assm(6) by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  1852
  finally show "\<Union>{k. \<exists>x. (x, k) \<in> \<Union>(pfn ` iset)} = \<Union>iset" .
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1853
  fix x k
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1854
  assume xk: "(x, k) \<in> \<Union>(pfn ` iset)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1855
  then obtain i where i: "i \<in> iset" "(x, k) \<in> pfn i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1856
    by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1857
  show "x \<in> k" "\<exists>a b. k = {a..b}" "k \<subseteq> \<Union>iset"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1858
    using assm(2-4)[OF i] using i(1) by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1859
  fix x' k'
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1860
  assume xk': "(x', k') \<in> \<Union>(pfn ` iset)" "(x, k) \<noteq> (x', k')"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1861
  then obtain i' where i': "i' \<in> iset" "(x', k') \<in> pfn i'"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1862
    by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1863
  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
  1864
    using i(1) i'(1)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1865
    using assms(3)[rule_format] interior_mono
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1866
    by blast
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1867
  show "interior k \<inter> interior k' = {}"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1868
    apply (cases "i = i'")
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1869
    using assm(5)[OF i _ xk'(2)] i'(2)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1870
    using assm(3)[OF i] assm(3)[OF i']
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1871
    defer
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1872
    apply -
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1873
    apply (rule *)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1874
    apply auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1875
    done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1876
qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1877
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1878
lemma tagged_partial_division_of_union_self:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1879
  assumes "p tagged_partial_division_of s"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1880
  shows "p tagged_division_of (\<Union>(snd ` p))"
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1881
  apply (rule tagged_division_ofI)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1882
  using tagged_partial_division_ofD[OF assms]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1883
  apply auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1884
  done
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1885
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1886
lemma tagged_division_of_union_self:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1887
  assumes "p tagged_division_of s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1888
  shows "p tagged_division_of (\<Union>(snd ` p))"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1889
  apply (rule tagged_division_ofI)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1890
  using tagged_division_ofD[OF assms]
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1891
  apply auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1892
  done
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1893
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1894
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1895
subsection {* Fine-ness of a partition w.r.t. a gauge. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1896
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1897
definition fine  (infixr "fine" 46)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1898
  where "d fine s \<longleftrightarrow> (\<forall>(x,k) \<in> s. k \<subseteq> d x)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1899
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1900
lemma fineI:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1901
  assumes "\<And>x k. (x, k) \<in> s \<Longrightarrow> k \<subseteq> d x"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1902
  shows "d fine s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1903
  using assms unfolding fine_def by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1904
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1905
lemma fineD[dest]:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1906
  assumes "d fine s"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1907
  shows "\<And>x k. (x,k) \<in> s \<Longrightarrow> k \<subseteq> d x"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1908
  using assms unfolding fine_def by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1909
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1910
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
  1911
  unfolding fine_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1912
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1913
lemma fine_inters:
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1914
 "(\<lambda>x. \<Inter> {f d x | d.  d \<in> s}) fine p \<longleftrightarrow> (\<forall>d\<in>s. (f d) fine p)"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1915
  unfolding fine_def by blast
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1916
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1917
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
  1918
  unfolding fine_def by blast
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1919
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1920
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
  1921
  unfolding fine_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1922
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1923
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
  1924
  unfolding fine_def by blast
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1925
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1926
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1927
subsection {* Gauge integral. Define on compact intervals first, then use a limit. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1928
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1929
definition has_integral_compact_interval (infixr "has'_integral'_compact'_interval" 46)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1930
  where "(f has_integral_compact_interval y) i \<longleftrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1931
    (\<forall>e>0. \<exists>d. gauge d \<and>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1932
      (\<forall>p. p tagged_division_of i \<and> d fine p \<longrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1933
        norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p - y) < e))"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1934
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1935
definition has_integral ::
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1936
    "('n::ordered_euclidean_space \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'b \<Rightarrow> 'n set \<Rightarrow> bool"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1937
  (infixr "has'_integral" 46)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1938
  where "(f has_integral y) i \<longleftrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1939
    (if \<exists>a b. i = {a..b}
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1940
     then (f has_integral_compact_interval y) i
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1941
     else (\<forall>e>0. \<exists>B>0. \<forall>a b. ball 0 B \<subseteq> {a..b} \<longrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1942
      (\<exists>z. ((\<lambda>x. if x \<in> i then f x else 0) has_integral_compact_interval z) {a..b} \<and>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1943
        norm (z - y) < e)))"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1944
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1945
lemma has_integral:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1946
  "(f has_integral y) {a..b} \<longleftrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1947
    (\<forall>e>0. \<exists>d. gauge d \<and>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1948
      (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1949
        norm (setsum (\<lambda>(x,k). content(k) *\<^sub>R f x) p - y) < e))"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1950
  unfolding has_integral_def has_integral_compact_interval_def
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1951
  by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1952
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1953
lemma has_integralD[dest]:
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1954
  assumes "(f has_integral y) ({a..b})"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1955
    and "e > 0"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1956
  obtains d where "gauge d"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1957
    and "\<And>p. p tagged_division_of {a..b} \<Longrightarrow> d fine p \<Longrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1958
      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
  1959
  using assms unfolding has_integral by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1960
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1961
lemma has_integral_alt:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1962
  "(f has_integral y) i \<longleftrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1963
    (if \<exists>a b. i = {a..b}
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1964
     then (f has_integral y) i
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1965
     else (\<forall>e>0. \<exists>B>0. \<forall>a b. ball 0 B \<subseteq> {a..b} \<longrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1966
      (\<exists>z. ((\<lambda>x. if x \<in> i then f(x) else 0) has_integral z) ({a..b}) \<and> norm (z - y) < e)))"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1967
  unfolding has_integral
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1968
  unfolding has_integral_compact_interval_def has_integral_def
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1969
  by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1970
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1971
lemma has_integral_altD:
53408
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1972
  assumes "(f has_integral y) i"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1973
    and "\<not> (\<exists>a b. i = {a..b})"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1974
    and "e>0"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1975
  obtains B where "B > 0"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1976
    and "\<forall>a b. ball 0 B \<subseteq> {a..b} \<longrightarrow>
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1977
      (\<exists>z. ((\<lambda>x. if x \<in> i then f(x) else 0) has_integral z) ({a..b}) \<and> norm(z - y) < e)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1978
  using assms
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1979
  unfolding has_integral
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1980
  unfolding has_integral_compact_interval_def has_integral_def
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1981
  by auto
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1982
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1983
definition integrable_on (infixr "integrable'_on" 46)
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1984
  where "f integrable_on i \<longleftrightarrow> (\<exists>y. (f has_integral y) i)"
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1985
a67d32e2d26e tuned proofs;
wenzelm
parents: 53399
diff changeset
  1986
definition "integral i f = (SOME y. (f has_integral y) i)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1987
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1988
lemma integrable_integral[dest]: "f integrable_on i \<Longrightarrow> (f has_integral (integral i f)) i"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1989
  unfolding integrable_on_def integral_def by (rule someI_ex)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1990
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1991
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
  1992
  unfolding integrable_on_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1993
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1994
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
  1995
  by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1996
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  1997
lemma setsum_content_null:
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1998
  assumes "content {a..b} = 0"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  1999
    and "p tagged_division_of {a..b}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2000
  shows "setsum (\<lambda>(x,k). content k *\<^sub>R f x) p = (0::'a::real_normed_vector)"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2001
proof (rule setsum_0', rule)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2002
  fix y
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2003
  assume y: "y \<in> p"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2004
  obtain x k where xk: "y = (x, k)"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2005
    using surj_pair[of y] by blast
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2006
  note assm = tagged_division_ofD(3-4)[OF assms(2) y[unfolded xk]]
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2007
  from this(2) obtain c d where k: "k = {c..d}" by blast
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2008
  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
  2009
    unfolding xk by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2010
  also have "\<dots> = 0"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2011
    using content_subset[OF assm(1)[unfolded k]] content_pos_le[of c d]
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2012
    unfolding assms(1) k
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2013
    by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2014
  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
  2015
qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2016
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2017
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2018
subsection {* Some basic combining lemmas. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2019
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2020
lemma tagged_division_unions_exists:
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2021
  assumes "finite iset"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2022
    and "\<forall>i\<in>iset. \<exists>p. p tagged_division_of i \<and> d fine p"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2023
    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
  2024
    and "\<Union>iset = i"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2025
   obtains p where "p tagged_division_of i" and "d fine p"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2026
proof -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2027
  obtain pfn where pfn:
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2028
    "\<And>x. x \<in> iset \<Longrightarrow> pfn x tagged_division_of x"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2029
    "\<And>x. x \<in> iset \<Longrightarrow> d fine pfn x"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2030
    using bchoice[OF assms(2)] by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2031
  show thesis
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2032
    apply (rule_tac p="\<Union>(pfn ` iset)" in that)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2033
    unfolding assms(4)[symmetric]
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2034
    apply (rule tagged_division_unions[OF assms(1) _ assms(3)])
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2035
    defer
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2036
    apply (rule fine_unions)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2037
    using pfn
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2038
    apply auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2039
    done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2040
qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2041
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2042
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2043
subsection {* The set we're concerned with must be closed. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2044
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2045
lemma division_of_closed:
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2046
  fixes i :: "'n::ordered_euclidean_space set"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2047
  shows "s division_of i \<Longrightarrow> closed i"
44890
22f665a2e91c new fastforce replacing fastsimp - less confusing name
nipkow
parents: 44522
diff changeset
  2048
  unfolding division_of_def by fastforce
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2049
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2050
subsection {* General bisection principle for intervals; might be useful elsewhere. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2051
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2052
lemma interval_bisection_step:
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2053
  fixes type :: "'a::ordered_euclidean_space"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2054
  assumes "P {}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2055
    and "\<forall>s t. P s \<and> P t \<and> interior(s) \<inter> interior(t) = {} \<longrightarrow> P (s \<union> t)"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2056
    and "\<not> P {a..b::'a}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2057
  obtains c d where "\<not> P{c..d}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2058
    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
  2059
proof -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2060
  have "{a..b} \<noteq> {}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2061
    using assms(1,3) by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2062
  then have ab: "\<And>i. i\<in>Basis \<Longrightarrow> a \<bullet> i \<le> b \<bullet> i"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2063
    by (auto simp: interval_eq_empty not_le)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2064
  {
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2065
    fix f
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2066
    have "finite f \<Longrightarrow>
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2067
      \<forall>s\<in>f. P s \<Longrightarrow>
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2068
      \<forall>s\<in>f. \<exists>a b. s = {a..b} \<Longrightarrow>
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2069
      \<forall>s\<in>f.\<forall>t\<in>f. s \<noteq> t \<longrightarrow> interior s \<inter> interior t = {} \<Longrightarrow> P (\<Union>f)"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2070
    proof (induct f rule: finite_induct)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2071
      case empty
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2072
      show ?case
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2073
        using assms(1) by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2074
    next
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2075
      case (insert x f)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2076
      show ?case
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2077
        unfolding Union_insert
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2078
        apply (rule assms(2)[rule_format])
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2079
        apply rule
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2080
        defer
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2081
        apply rule
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2082
        defer
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2083
        apply (rule inter_interior_unions_intervals)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2084
        using insert
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2085
        apply auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2086
        done
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2087
    qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2088
  } note * = this
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2089
  let ?A = "{{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>
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2090
    (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
  2091
  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
  2092
  {
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2093
    presume "\<forall>c d. ?PP c d \<longrightarrow> P {c..d} \<Longrightarrow> False"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2094
    then show thesis
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2095
      unfolding atomize_not not_all
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2096
      apply -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2097
      apply (erule exE)+
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2098
      apply (rule_tac c=x and d=xa in that)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2099
      apply auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2100
      done
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2101
  }
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2102
  assume as: "\<forall>c d. ?PP c d \<longrightarrow> P {c..d}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2103
  have "P (\<Union> ?A)"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2104
    apply (rule *)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2105
    apply (rule_tac[2-] ballI)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2106
    apply (rule_tac[4] ballI)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2107
    apply (rule_tac[4] impI)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2108
  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
  2109
    let ?B = "(\<lambda>s.{(\<Sum>i\<in>Basis. (if i \<in> s then a\<bullet>i else (a\<bullet>i + b\<bullet>i) / 2) *\<^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
  2110
      (\<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
  2111
    have "?A \<subseteq> ?B"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2112
    proof
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2113
      case goal1
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2114
      then obtain c d where x: "x = {c..d}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2115
        "\<And>i. i \<in> Basis \<Longrightarrow>
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2116
          c \<bullet> i = a \<bullet> i \<and> d \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<or>
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2117
          c \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<and> d \<bullet> i = b \<bullet> i" by blast
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2118
      have *: "\<And>a b c d. a = c \<Longrightarrow> b = d \<Longrightarrow> {a..b} = {c..d}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2119
        by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2120
      show "x \<in> ?B"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2121
        unfolding image_iff
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2122
        apply (rule_tac x="{i. i\<in>Basis \<and> c\<bullet>i = a\<bullet>i}" in bexI)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2123
        unfolding x
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2124
        apply (rule *)
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
  2125
        apply (simp_all only: euclidean_eq_iff[where 'a='a] inner_setsum_left_Basis mem_Collect_eq simp_thms
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2126
          cong: ball_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
  2127
        apply safe
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2128
      proof -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2129
        fix i :: 'a
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2130
        assume i: "i \<in> Basis"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2131
        then show "c \<bullet> i = (if c \<bullet> i = a \<bullet> i then a \<bullet> i else (a \<bullet> i + b \<bullet> i) / 2)"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2132
          and "d \<bullet> i = (if c \<bullet> i = a \<bullet> i then (a \<bullet> i + b \<bullet> i) / 2 else b \<bullet> i)"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2133
          using x(2)[of i] ab[OF i] by (auto simp add:field_simps)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2134
      qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2135
    qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2136
    then show "finite ?A"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2137
      by (rule finite_subset) auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2138
    fix s
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2139
    assume "s \<in> ?A"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2140
    then obtain c d where s:
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2141
      "s = {c..d}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2142
      "\<And>i. i \<in> Basis \<Longrightarrow>
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2143
         c \<bullet> i = a \<bullet> i \<and> d \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<or>
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2144
         c \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<and> d \<bullet> i = b \<bullet> i"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2145
      by blast
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2146
    show "P s"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2147
      unfolding s
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2148
      apply (rule as[rule_format])
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2149
    proof -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2150
      case goal1
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2151
      then show ?case
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2152
        using s(2)[of i] using ab[OF `i \<in> Basis`] by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2153
    qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2154
    show "\<exists>a b. s = {a..b}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2155
      unfolding s by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2156
    fix t
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2157
    assume "t \<in> ?A"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2158
    then obtain e f where t:
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2159
      "t = {e..f}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2160
      "\<And>i. i \<in> Basis \<Longrightarrow>
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2161
        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
  2162
        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
  2163
      by blast
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2164
    assume "s \<noteq> t"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2165
    then have "\<not> (c = e \<and> d = f)"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2166
      unfolding s t by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2167
    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
  2168
      unfolding euclidean_eq_iff[where 'a='a] by auto
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2169
    then have i: "c\<bullet>i \<noteq> e\<bullet>i" "d\<bullet>i \<noteq> f\<bullet>i"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2170
      apply -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2171
      apply(erule_tac[!] disjE)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2172
    proof -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2173
      assume "c\<bullet>i \<noteq> e\<bullet>i"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2174
      then show "d\<bullet>i \<noteq> f\<bullet>i"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2175
        using s(2)[OF i'] t(2)[OF i'] by fastforce
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2176
    next
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2177
      assume "d\<bullet>i \<noteq> f\<bullet>i"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2178
      then show "c\<bullet>i \<noteq> e\<bullet>i"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2179
        using s(2)[OF i'] t(2)[OF i'] by fastforce
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2180
    qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2181
    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
  2182
      by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2183
    show "interior s \<inter> interior t = {}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2184
      unfolding s t interior_closed_interval
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2185
    proof (rule *)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2186
      fix x
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2187
      assume "x \<in> {c<..<d}" "x \<in> {e<..<f}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2188
      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"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2189
        unfolding mem_interval using i'
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2190
        apply -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2191
        apply (erule_tac[!] x=i in ballE)+
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2192
        apply auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2193
        done
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2194
      show False
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2195
        using s(2)[OF i']
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2196
        apply -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2197
        apply (erule_tac disjE)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2198
        apply (erule_tac[!] conjE)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2199
      proof -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2200
        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
  2201
        show False
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2202
          using t(2)[OF i'] and i x unfolding as by (fastforce simp add:field_simps)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2203
      next
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2204
        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
  2205
        show False
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2206
          using t(2)[OF i'] and i x unfolding as by(fastforce simp add:field_simps)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2207
      qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2208
    qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2209
  qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2210
  also have "\<Union> ?A = {a..b}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2211
  proof (rule set_eqI,rule)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2212
    fix x
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2213
    assume "x \<in> \<Union>?A"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2214
    then obtain c d where x:
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2215
      "x \<in> {c..d}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2216
      "\<And>i. i \<in> Basis \<Longrightarrow>
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2217
        c \<bullet> i = a \<bullet> i \<and> d \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<or>
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2218
        c \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<and> d \<bullet> i = b \<bullet> i" by blast
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2219
    show "x\<in>{a..b}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2220
      unfolding mem_interval
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2221
    proof safe
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2222
      fix i :: 'a
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2223
      assume i: "i \<in> Basis"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2224
      then show "a \<bullet> i \<le> x \<bullet> i" "x \<bullet> i \<le> b \<bullet> i"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2225
        using x(2)[OF i] x(1)[unfolded mem_interval,THEN bspec, OF i] by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2226
    qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2227
  next
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2228
    fix x
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2229
    assume x: "x \<in> {a..b}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2230
    have "\<forall>i\<in>Basis.
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2231
      \<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
  2232
      (is "\<forall>i\<in>Basis. \<exists>c d. ?P i c d")
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2233
      unfolding mem_interval
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
  2234
    proof
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2235
      fix i :: 'a
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2236
      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
  2237
      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)"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2238
        using x[unfolded mem_interval,THEN bspec, OF i] by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2239
      then show "\<exists>c d. ?P i c d"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2240
        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
  2241
    qed
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2242
    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
  2243
      unfolding Union_iff Bex_def mem_Collect_eq choice_Basis_iff
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2244
      apply -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2245
      apply (erule exE)+
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2246
      apply (rule_tac x="{xa..xaa}" in exI)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2247
      unfolding mem_interval
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2248
      apply auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2249
      done
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2250
  qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2251
  finally show False
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2252
    using assms by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2253
qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2254
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2255
lemma interval_bisection:
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2256
  fixes type :: "'a::ordered_euclidean_space"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2257
  assumes "P {}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2258
    and "(\<forall>s t. P s \<and> P t \<and> interior(s) \<inter> interior(t) = {} \<longrightarrow> P(s \<union> t))"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2259
    and "\<not> P {a..b::'a}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2260
  obtains x where "x \<in> {a..b}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2261
    and "\<forall>e>0. \<exists>c d. x \<in> {c..d} \<and> {c..d} \<subseteq> ball x e \<and> {c..d} \<subseteq> {a..b} \<and> \<not> P {c..d}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2262
proof -
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  2263
  have "\<forall>x. \<exists>y. \<not> P {fst x..snd x} \<longrightarrow> (\<not> P {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
  2264
    (\<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>
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2265
       2 * (snd y\<bullet>i - fst y\<bullet>i) \<le> snd x\<bullet>i - fst x\<bullet>i))"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2266
  proof
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2267
    case goal1
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2268
    then show ?case
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2269
    proof -
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2270
      presume "\<not> P {fst x..snd x} \<Longrightarrow> ?thesis"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2271
      then show ?thesis by (cases "P {fst x..snd x}") auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2272
    next
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2273
      assume as: "\<not> P {fst x..snd x}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2274
      obtain c d where "\<not> P {c..d}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2275
        "\<forall>i\<in>Basis.
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2276
           fst x \<bullet> i \<le> c \<bullet> i \<and>
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2277
           c \<bullet> i \<le> d \<bullet> i \<and>
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2278
           d \<bullet> i \<le> snd x \<bullet> i \<and>
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2279
           2 * (d \<bullet> i - c \<bullet> i) \<le> snd x \<bullet> i - fst x \<bullet> i"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2280
        by (rule interval_bisection_step[of P, OF assms(1-2) as])
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2281
      then show ?thesis
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2282
        apply -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2283
        apply (rule_tac x="(c,d)" in exI)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2284
        apply auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2285
        done
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2286
    qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2287
  qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2288
  then guess f
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2289
    apply -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2290
    apply (drule choice)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2291
    apply (erule exE)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2292
    done
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2293
  note f = this
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2294
  def AB \<equiv> "\<lambda>n. (f ^^ n) (a,b)"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2295
  def A \<equiv> "\<lambda>n. fst(AB n)"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2296
  def B \<equiv> "\<lambda>n. snd(AB n)"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2297
  note ab_def = A_def B_def AB_def
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2298
  have "A 0 = a" "B 0 = b" "\<And>n. \<not> P {A(Suc n)..B(Suc n)} \<and>
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  2299
    (\<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
  2300
    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
  2301
  proof -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2302
    show "A 0 = a" "B 0 = b"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2303
      unfolding ab_def by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2304
    case goal3
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2305
    note S = ab_def funpow.simps o_def id_apply
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2306
    show ?case
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2307
    proof (induct n)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2308
      case 0
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2309
      then show ?case
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2310
        unfolding S
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2311
        apply (rule f[rule_format]) using assms(3)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2312
        apply auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2313
        done
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2314
    next
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2315
      case (Suc n)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2316
      show ?case
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2317
        unfolding S
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2318
        apply (rule f[rule_format])
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2319
        using Suc
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2320
        unfolding S
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2321
        apply auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2322
        done
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2323
    qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2324
  qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2325
  note AB = this(1-2) conjunctD2[OF this(3),rule_format]
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2326
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2327
  have interv: "\<And>e. 0 < e \<Longrightarrow> \<exists>n. \<forall>x\<in>{A n..B n}. \<forall>y\<in>{A n..B n}. dist x y < e"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2328
  proof -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2329
    case goal1
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2330
    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
  2331
      using real_arch_pow2[of "(setsum (\<lambda>i. b\<bullet>i - a\<bullet>i) Basis) / e"] ..
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2332
    show ?case
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2333
      apply (rule_tac x=n in exI)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2334
      apply rule
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2335
      apply rule
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2336
    proof -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2337
      fix x y
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2338
      assume xy: "x\<in>{A n..B n}" "y\<in>{A n..B n}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2339
      have "dist x y \<le> setsum (\<lambda>i. abs((x - y)\<bullet>i)) Basis"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2340
        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
  2341
      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
  2342
      proof (rule setsum_mono)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2343
        fix i :: 'a
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2344
        assume i: "i \<in> Basis"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2345
        show "\<bar>(x - y) \<bullet> i\<bar> \<le> B n \<bullet> i - A n \<bullet> i"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2346
          using xy[unfolded mem_interval,THEN bspec, OF i]
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2347
          by (auto simp: inner_diff_left)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2348
      qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2349
      also have "\<dots> \<le> setsum (\<lambda>i. b\<bullet>i - a\<bullet>i) Basis / 2^n"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2350
        unfolding setsum_divide_distrib
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2351
      proof (rule setsum_mono)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2352
        case goal1
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2353
        then show ?case
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2354
        proof (induct n)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2355
          case 0
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2356
          then show ?case
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2357
            unfolding AB by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2358
        next
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2359
          case (Suc n)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2360
          have "B (Suc n) \<bullet> i - A (Suc n) \<bullet> i \<le> (B n \<bullet> i - A n \<bullet> i) / 2"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  2361
            using AB(4)[of i n] using goal1 by auto
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2362
          also have "\<dots> \<le> (b \<bullet> i - a \<bullet> i) / 2 ^ Suc n"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2363
            using Suc by (auto simp add:field_simps)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2364
          finally show ?case .
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2365
        qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2366
      qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2367
      also have "\<dots> < e"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2368
        using n using goal1 by (auto simp add:field_simps)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2369
      finally show "dist x y < e" .
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2370
    qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2371
  qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2372
  {
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2373
    fix n m :: nat
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2374
    assume "m \<le> n"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2375
    then have "{A n..B n} \<subseteq> {A m..B m}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2376
    proof (induct rule: inc_induct)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2377
      case (step i)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2378
      show ?case
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
  2379
        using AB(4) by (intro order_trans[OF step(2)] subset_interval_imp) auto
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2380
    qed simp
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2381
  } note ABsubset = this
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2382
  have "\<exists>a. \<forall>n. a\<in>{A n..B n}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2383
    apply (rule decreasing_closed_nest[rule_format,OF closed_interval _ ABsubset interv])
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2384
  proof -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2385
    fix n
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2386
    show "{A n..B n} \<noteq> {}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2387
      apply (cases "0 < n")
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2388
      using AB(3)[of "n - 1"] assms(1,3) AB(1-2)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2389
      apply auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2390
      done
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2391
  qed auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2392
  then obtain x0 where x0: "\<And>n. x0 \<in> {A n..B n}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2393
    by blast
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2394
  show thesis
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2395
  proof (rule that[rule_format, of x0])
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2396
    show "x0\<in>{a..b}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2397
      using x0[of 0] unfolding AB .
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2398
    fix e :: real
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2399
    assume "e > 0"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2400
    from interv[OF this] obtain n
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2401
      where n: "\<forall>x\<in>{A n..B n}. \<forall>y\<in>{A n..B n}. dist x y < e" ..
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2402
    show "\<exists>c d. x0 \<in> {c..d} \<and> {c..d} \<subseteq> ball x0 e \<and> {c..d} \<subseteq> {a..b} \<and> \<not> P {c..d}"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2403
      apply (rule_tac x="A n" in exI)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2404
      apply (rule_tac x="B n" in exI)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2405
      apply rule
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2406
      apply (rule x0)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2407
      apply rule
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2408
      defer
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2409
      apply rule
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2410
    proof -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2411
      show "\<not> P {A n..B n}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2412
        apply (cases "0 < n")
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2413
        using AB(3)[of "n - 1"] assms(3) AB(1-2)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2414
        apply auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2415
        done
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2416
      show "{A n..B n} \<subseteq> ball x0 e"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2417
        using n using x0[of n] by auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2418
      show "{A n..B n} \<subseteq> {a..b}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2419
        unfolding AB(1-2)[symmetric] by (rule ABsubset) auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2420
    qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2421
  qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2422
qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2423
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2424
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2425
subsection {* Cousin's lemma. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2426
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2427
lemma fine_division_exists:
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2428
  fixes a b :: "'a::ordered_euclidean_space"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2429
  assumes "gauge g"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2430
  obtains p where "p tagged_division_of {a..b}" "g fine p"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2431
proof -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2432
  presume "\<not> (\<exists>p. p tagged_division_of {a..b} \<and> g fine p) \<Longrightarrow> False"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2433
  then obtain p where "p tagged_division_of {a..b}" "g fine p"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2434
    by blast
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2435
  then show thesis ..
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2436
next
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2437
  assume as: "\<not> (\<exists>p. p tagged_division_of {a..b} \<and> g fine p)"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2438
  guess x
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2439
    apply (rule interval_bisection[of "\<lambda>s. \<exists>p. p tagged_division_of s \<and> g fine p",rule_format,OF _ _ as])
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2440
    apply (rule_tac x="{}" in exI)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2441
    defer
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2442
    apply (erule conjE exE)+
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2443
  proof -
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2444
    show "{} tagged_division_of {} \<and> g fine {}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2445
      unfolding fine_def by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2446
    fix s t p p'
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2447
    assume "p tagged_division_of s" "g fine p" "p' tagged_division_of t" "g fine p'"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2448
      "interior s \<inter> interior t = {}"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2449
    then show "\<exists>p. p tagged_division_of s \<union> t \<and> g fine p"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2450
      apply -
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2451
      apply (rule_tac x="p \<union> p'" in exI)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2452
      apply rule
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2453
      apply (rule tagged_division_union)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2454
      prefer 4
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2455
      apply (rule fine_union)
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2456
      apply auto
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2457
      done
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2458
  qed note x = this
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2459
  obtain e where e: "e > 0" "ball x e \<subseteq> g x"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2460
    using gaugeD[OF assms, of x] unfolding open_contains_ball by auto
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2461
  from x(2)[OF e(1)] obtain c d where c_d:
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2462
    "x \<in> {c..d}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2463
    "{c..d} \<subseteq> ball x e"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2464
    "{c..d} \<subseteq> {a..b}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2465
    "\<not> (\<exists>p. p tagged_division_of {c..d} \<and> g fine p)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2466
    by blast
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2467
  have "g fine {(x, {c..d})}"
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2468
    unfolding fine_def using e using c_d(2) by auto
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2469
  then show False
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2470
    using tagged_division_of_self[OF c_d(1)] using c_d by auto
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2471
qed
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2472
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2473
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2474
subsection {* Basic theorems about integrals. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2475
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2476
lemma has_integral_unique:
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2477
  fixes f :: "'n::ordered_euclidean_space \<Rightarrow> 'a::real_normed_vector"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2478
  assumes "(f has_integral k1) i"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2479
    and "(f has_integral k2) i"
53409
e114f515527c tuned proofs;
wenzelm
parents: 53408
diff changeset
  2480
  shows "k1 = k2"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2481
proof (rule ccontr)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2482
  let ?e = "norm(k1 - k2) / 2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2483
  assume as:"k1 \<noteq> k2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2484
  then have e: "?e > 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2485
    by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2486
  have lem: "\<And>f::'n \<Rightarrow> 'a.  \<And>a b k1 k2.
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2487
    (f has_integral k1) ({a..b}) \<Longrightarrow> (f has_integral k2) ({a..b}) \<Longrightarrow> k1 \<noteq> k2 \<Longrightarrow> False"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2488
  proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2489
    case goal1
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2490
    let ?e = "norm (k1 - k2) / 2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2491
    from goal1(3) have e: "?e > 0" by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2492
    guess d1 by (rule has_integralD[OF goal1(1) e]) note d1=this
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2493
    guess d2 by (rule has_integralD[OF goal1(2) e]) note d2=this
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2494
    guess p by (rule fine_division_exists[OF gauge_inter[OF d1(1) d2(1)],of a b]) note p=this
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2495
    let ?c = "(\<Sum>(x, k)\<in>p. content k *\<^sub>R f x)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2496
    have "norm (k1 - k2) \<le> norm (?c - k2) + norm (?c - k1)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2497
      using norm_triangle_ineq4[of "k1 - ?c" "k2 - ?c"]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2498
      by (auto simp add:algebra_simps norm_minus_commute)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2499
    also have "\<dots> < norm (k1 - k2) / 2 + norm (k1 - k2) / 2"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2500
      apply (rule add_strict_mono)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2501
      apply (rule_tac[!] d2(2) d1(2))
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2502
      using p unfolding fine_def
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2503
      apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2504
      done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2505
    finally show False by auto
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2506
  qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2507
  {
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2508
    presume "\<not> (\<exists>a b. i = {a..b}) \<Longrightarrow> False"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2509
    then show False
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2510
      apply -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2511
      apply (cases "\<exists>a b. i = {a..b}")
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2512
      using assms
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2513
      apply (auto simp add:has_integral intro:lem[OF _ _ as])
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2514
      done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2515
  }
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2516
  assume as: "\<not> (\<exists>a b. i = {a..b})"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2517
  guess B1 by (rule has_integral_altD[OF assms(1) as,OF e]) note B1=this[rule_format]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2518
  guess B2 by (rule has_integral_altD[OF assms(2) as,OF e]) note B2=this[rule_format]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2519
  have "\<exists>a b::'n. ball 0 B1 \<union> ball 0 B2 \<subseteq> {a..b}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2520
    apply (rule bounded_subset_closed_interval)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2521
    using bounded_Un bounded_ball
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2522
    apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2523
    done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2524
  then obtain a b :: 'n where ab: "ball 0 B1 \<subseteq> {a..b}" "ball 0 B2 \<subseteq> {a..b}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2525
    by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2526
  obtain w where w:
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2527
    "((\<lambda>x. if x \<in> i then f x else 0) has_integral w) {a..b}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2528
    "norm (w - k1) < norm (k1 - k2) / 2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2529
    using B1(2)[OF ab(1)] by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2530
  obtain z where z:
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2531
    "((\<lambda>x. if x \<in> i then f x else 0) has_integral z) {a..b}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2532
    "norm (z - k2) < norm (k1 - k2) / 2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2533
    using B2(2)[OF ab(2)] by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2534
  have "z = w"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2535
    using lem[OF w(1) z(1)] by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2536
  then have "norm (k1 - k2) \<le> norm (z - k2) + norm (w - k1)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2537
    using norm_triangle_ineq4 [of "k1 - w" "k2 - z"]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2538
    by (auto simp add: norm_minus_commute)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2539
  also have "\<dots> < norm (k1 - k2) / 2 + norm (k1 - k2) / 2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2540
    apply (rule add_strict_mono)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2541
    apply (rule_tac[!] z(2) w(2))
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2542
    done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2543
  finally show False by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2544
qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2545
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2546
lemma integral_unique [intro]: "(f has_integral y) k \<Longrightarrow> integral k f = y"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2547
  unfolding integral_def
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2548
  by (rule some_equality) (auto intro: has_integral_unique)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2549
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2550
lemma has_integral_is_0:
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2551
  fixes f :: "'n::ordered_euclidean_space \<Rightarrow> 'a::real_normed_vector"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2552
  assumes "\<forall>x\<in>s. f x = 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2553
  shows "(f has_integral 0) s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2554
proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2555
  have lem: "\<And>a b. \<And>f::'n \<Rightarrow> 'a.
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2556
    (\<forall>x\<in>{a..b}. f(x) = 0) \<Longrightarrow> (f has_integral 0) ({a..b})"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2557
    unfolding has_integral
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2558
    apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2559
    apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2560
  proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2561
    fix a b e
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2562
    fix f :: "'n \<Rightarrow> 'a"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2563
    assume as: "\<forall>x\<in>{a..b}. f x = 0" "0 < (e::real)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2564
    show "\<exists>d. gauge d \<and>
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2565
      (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - 0) < e)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2566
      apply (rule_tac x="\<lambda>x. ball x 1" in exI)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2567
      apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2568
      apply (rule gaugeI)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2569
      unfolding centre_in_ball
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2570
      defer
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2571
      apply (rule open_ball)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2572
      apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2573
      apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2574
      apply (erule conjE)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2575
    proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2576
      case goal1
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2577
      have "(\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) = 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2578
      proof (rule setsum_0', rule)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2579
        fix x
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2580
        assume x: "x \<in> p"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2581
        have "f (fst x) = 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2582
          using tagged_division_ofD(2-3)[OF goal1(1), of "fst x" "snd x"] using as x by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2583
        then show "(\<lambda>(x, k). content k *\<^sub>R f x) x = 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2584
          apply (subst surjective_pairing[of x])
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2585
          unfolding split_conv
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2586
          apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2587
          done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2588
      qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2589
      then show ?case
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2590
        using as by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2591
    qed auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2592
  qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2593
  {
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2594
    presume "\<not> (\<exists>a b. s = {a..b}) \<Longrightarrow> ?thesis"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2595
    then show ?thesis
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2596
      apply -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2597
      apply (cases "\<exists>a b. s = {a..b}")
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2598
      using assms
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2599
      apply (auto simp add:has_integral intro: lem)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2600
      done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2601
  }
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2602
  have *: "(\<lambda>x. if x \<in> s then f x else 0) = (\<lambda>x. 0)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2603
    apply (rule ext)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2604
    using assms
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2605
    apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2606
    done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2607
  assume "\<not> (\<exists>a b. s = {a..b})"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2608
  then show ?thesis
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2609
    apply (subst has_integral_alt)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2610
    unfolding if_not_P *
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2611
    apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2612
    apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2613
    apply (rule_tac x=1 in exI)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2614
    apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2615
    defer
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2616
    apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2617
    apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2618
    apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2619
  proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2620
    fix e :: real
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2621
    fix a b
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2622
    assume "e > 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2623
    then show "\<exists>z. ((\<lambda>x::'n. 0::'a) has_integral z) {a..b} \<and> norm (z - 0) < e"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2624
      apply (rule_tac x=0 in exI)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2625
      apply(rule,rule lem)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2626
      apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2627
      done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2628
  qed auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2629
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2630
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  2631
lemma has_integral_0[simp]: "((\<lambda>x::'n::ordered_euclidean_space. 0) has_integral 0) s"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2632
  by (rule has_integral_is_0) auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2633
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2634
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
  2635
  using has_integral_unique[OF has_integral_0] by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2636
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2637
lemma has_integral_linear:
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2638
  fixes f :: "'n::ordered_euclidean_space \<Rightarrow> 'a::real_normed_vector"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2639
  assumes "(f has_integral y) s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2640
    and "bounded_linear h"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2641
  shows "((h o f) has_integral ((h y))) s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2642
proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2643
  interpret bounded_linear h
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2644
    using assms(2) .
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2645
  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
  2646
    by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2647
  have lem: "\<And>(f :: 'n \<Rightarrow> 'a) y a b.
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2648
    (f has_integral y) {a..b} \<Longrightarrow> ((h o f) has_integral h y) {a..b}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2649
    apply (subst has_integral)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2650
    apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2651
    apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2652
  proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2653
    case goal1
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2654
    from pos_bounded
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2655
    obtain B where B: "0 < B" "\<And>x. norm (h x) \<le> norm x * B"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2656
      by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2657
    have *: "e / B > 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2658
      apply (rule divide_pos_pos)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2659
      using goal1(2) B
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2660
      apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2661
      done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2662
    obtain g where g:
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2663
      "gauge g"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2664
      "\<And>p. p tagged_division_of {a..b} \<Longrightarrow> g fine p \<Longrightarrow>
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2665
        norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - y) < e / B"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2666
      by (rule has_integralD[OF goal1(1) *]) blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2667
    show ?case
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2668
      apply (rule_tac x=g in exI)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2669
      apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2670
      apply (rule g(1))
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2671
      apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2672
      apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2673
      apply (erule conjE)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2674
    proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2675
      fix p
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2676
      assume as: "p tagged_division_of {a..b}" "g fine p"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2677
      have *: "\<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"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2678
        by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2679
      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"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  2680
        unfolding o_def unfolding scaleR[symmetric] * by simp
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2681
      also have "\<dots> = h (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2682
        using setsum[of "\<lambda>(x,k). content k *\<^sub>R f x" p] using as by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2683
      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)" .
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2684
      show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R (h \<circ> f) x) - h y) < e"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2685
        unfolding * diff[symmetric]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2686
        apply (rule le_less_trans[OF B(2)])
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2687
        using g(2)[OF as] B(1)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2688
        apply (auto simp add: field_simps)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2689
        done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2690
    qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2691
  qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2692
  {
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2693
    presume "\<not> (\<exists>a b. s = {a..b}) \<Longrightarrow> ?thesis"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2694
    then show ?thesis
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2695
      apply -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2696
      apply (cases "\<exists>a b. s = {a..b}")
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2697
      using assms
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2698
      apply (auto simp add:has_integral intro!:lem)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2699
      done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2700
  }
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2701
  assume as: "\<not> (\<exists>a b. s = {a..b})"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2702
  then show ?thesis
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2703
    apply (subst has_integral_alt)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2704
    unfolding if_not_P
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2705
    apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2706
    apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2707
  proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2708
    fix e :: real
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2709
    assume e: "e > 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2710
    have *: "0 < e/B"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2711
      by (rule divide_pos_pos,rule e,rule B(1))
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2712
    obtain M where M:
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2713
      "M > 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2714
      "\<And>a b. ball 0 M \<subseteq> {a..b} \<Longrightarrow>
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2715
        \<exists>z. ((\<lambda>x. if x \<in> s then f x else 0) has_integral z) {a..b} \<and> norm (z - y) < e / B"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2716
      using has_integral_altD[OF assms(1) as *] by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2717
    show "\<exists>B>0. \<forall>a b. ball 0 B \<subseteq> {a..b} \<longrightarrow>
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2718
      (\<exists>z. ((\<lambda>x. if x \<in> s then (h \<circ> f) x else 0) has_integral z) {a..b} \<and> norm (z - h y) < e)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2719
      apply (rule_tac x=M in exI)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2720
      apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2721
      apply (rule M(1))
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2722
      apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2723
      apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2724
      apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2725
    proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2726
      case goal1
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2727
      obtain z where z:
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2728
        "((\<lambda>x. if x \<in> s then f x else 0) has_integral z) {a..b}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2729
        "norm (z - y) < e / B"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2730
        using M(2)[OF goal1(1)] by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2731
      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)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2732
        unfolding o_def
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2733
        apply (rule ext)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2734
        using zero
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2735
        apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2736
        done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2737
      show ?case
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2738
        apply (rule_tac x="h z" in exI)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2739
        apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2740
        unfolding *
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2741
        apply (rule lem[OF z(1)])
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2742
        unfolding diff[symmetric]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2743
        apply (rule le_less_trans[OF B(2)])
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2744
        using B(1) z(2)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2745
        apply (auto simp add: field_simps)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2746
        done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2747
    qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2748
  qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2749
qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2750
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2751
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
  2752
  unfolding o_def[symmetric]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2753
  apply (rule has_integral_linear,assumption)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2754
  apply (rule bounded_linear_scaleR_right)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2755
  done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2756
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  2757
lemma has_integral_cmult_real:
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  2758
  fixes c :: real
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  2759
  assumes "c \<noteq> 0 \<Longrightarrow> (f has_integral x) A"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  2760
  shows "((\<lambda>x. c * f x) has_integral c * x) A"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2761
proof (cases "c = 0")
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2762
  case True
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2763
  then show ?thesis by simp
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2764
next
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2765
  case False
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  2766
  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
  2767
    unfolding real_scaleR_def .
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2768
qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2769
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2770
lemma has_integral_neg: "(f has_integral k) s \<Longrightarrow> ((\<lambda>x. -(f x)) has_integral (-k)) s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2771
  apply (drule_tac c="-1" in has_integral_cmul)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2772
  apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2773
  done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2774
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2775
lemma has_integral_add:
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2776
  fixes f :: "'n::ordered_euclidean_space \<Rightarrow> 'a::real_normed_vector"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2777
  assumes "(f has_integral k) s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2778
    and "(g has_integral l) s"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2779
  shows "((\<lambda>x. f x + g x) has_integral (k + l)) s"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2780
proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2781
  have lem:"\<And>(f:: 'n \<Rightarrow> 'a) g a b k l.
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2782
    (f has_integral k) {a..b} \<Longrightarrow>
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2783
    (g has_integral l) {a..b} \<Longrightarrow>
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2784
    ((\<lambda>x. f x + g x) has_integral (k + l)) {a..b}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2785
  proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2786
    case goal1
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2787
    show ?case
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2788
      unfolding has_integral
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2789
      apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2790
      apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2791
    proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2792
      fix e :: real
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2793
      assume e: "e > 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2794
      then have *: "e/2 > 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2795
        by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2796
      obtain d1 where d1:
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2797
        "gauge d1"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2798
        "\<And>p. p tagged_division_of {a..b} \<Longrightarrow> d1 fine p \<Longrightarrow>
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2799
          norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - k) < e / 2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2800
        using has_integralD[OF goal1(1) *] by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2801
      obtain d2 where d2:
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2802
        "gauge d2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2803
        "\<And>p. p tagged_division_of {a..b} \<Longrightarrow> d2 fine p \<Longrightarrow>
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2804
          norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - l) < e / 2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2805
        using has_integralD[OF goal1(2) *] by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2806
      show "\<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow>
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2807
        norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R (f x + g x)) - (k + l)) < e)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2808
        apply (rule_tac x="\<lambda>x. (d1 x) \<inter> (d2 x)" in exI)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2809
        apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2810
        apply (rule gauge_inter[OF d1(1) d2(1)])
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2811
        apply (rule,rule,erule conjE)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2812
      proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2813
        fix p
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2814
        assume as: "p tagged_division_of {a..b}" "(\<lambda>x. d1 x \<inter> d2 x) fine p"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2815
        have *: "(\<Sum>(x, k)\<in>p. content k *\<^sub>R (f x + g x)) =
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2816
          (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) + (\<Sum>(x, k)\<in>p. content k *\<^sub>R g x)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  2817
          unfolding scaleR_right_distrib setsum_addf[of "\<lambda>(x,k). content k *\<^sub>R f x" "\<lambda>(x,k). content k *\<^sub>R g x" p,symmetric]
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2818
          by (rule setsum_cong2) auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2819
        have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R (f x + g x)) - (k + l)) =
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2820
          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))"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2821
          unfolding * by (auto simp add: algebra_simps)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2822
        also
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2823
        let ?res = "\<dots>"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2824
        from as have *: "d1 fine p" "d2 fine p"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2825
          unfolding fine_inter by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2826
        have "?res < e/2 + e/2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2827
          apply (rule le_less_trans[OF norm_triangle_ineq])
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2828
          apply (rule add_strict_mono)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2829
          using d1(2)[OF as(1) *(1)] and d2(2)[OF as(1) *(2)]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2830
          apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2831
          done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2832
        finally show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R (f x + g x)) - (k + l)) < e"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2833
          by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2834
      qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2835
    qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2836
  qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2837
  {
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2838
    presume "\<not> (\<exists>a b. s = {a..b}) \<Longrightarrow> ?thesis"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2839
    then show ?thesis
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2840
      apply -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2841
      apply (cases "\<exists>a b. s = {a..b}")
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2842
      using assms
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2843
      apply (auto simp add:has_integral intro!:lem)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2844
      done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2845
  }
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2846
  assume as: "\<not> (\<exists>a b. s = {a..b})"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2847
  then show ?thesis
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2848
    apply (subst has_integral_alt)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2849
    unfolding if_not_P
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2850
    apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2851
    apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2852
  proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2853
    case goal1
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2854
    then have *: "e/2 > 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2855
      by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2856
    from has_integral_altD[OF assms(1) as *] guess B1 . note B1=this[rule_format]
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2857
    from has_integral_altD[OF assms(2) as *] guess B2 . note B2=this[rule_format]
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2858
    show ?case
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2859
      apply (rule_tac x="max B1 B2" in exI)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2860
      apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2861
      apply (rule min_max.less_supI1)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2862
      apply (rule B1)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2863
      apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2864
      apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2865
      apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2866
    proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2867
      fix a b
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2868
      assume "ball 0 (max B1 B2) \<subseteq> {a..b::'n}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2869
      then have *: "ball 0 B1 \<subseteq> {a..b::'n}" "ball 0 B2 \<subseteq> {a..b::'n}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2870
        by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2871
      obtain w where w:
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2872
        "((\<lambda>x. if x \<in> s then f x else 0) has_integral w) {a..b}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2873
        "norm (w - k) < e / 2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2874
        using B1(2)[OF *(1)] by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2875
      obtain z where z:
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2876
        "((\<lambda>x. if x \<in> s then g x else 0) has_integral z) {a..b}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2877
        "norm (z - l) < e / 2"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2878
        using B2(2)[OF *(2)] by blast
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2879
      have *: "\<And>x. (if x \<in> s then f x + g x else 0) =
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2880
        (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
  2881
        by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2882
      show "\<exists>z. ((\<lambda>x. if x \<in> s then f x + g x else 0) has_integral z) {a..b} \<and> norm (z - (k + l)) < e"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2883
        apply (rule_tac x="w + z" in exI)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2884
        apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2885
        apply (rule lem[OF w(1) z(1), unfolded *[symmetric]])
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2886
        using norm_triangle_ineq[of "w - k" "z - l"] w(2) z(2)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2887
        apply (auto simp add: field_simps)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2888
        done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2889
    qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2890
  qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2891
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2892
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2893
lemma has_integral_sub:
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2894
  "(f has_integral k) s \<Longrightarrow> (g has_integral l) s \<Longrightarrow>
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2895
    ((\<lambda>x. f x - g x) has_integral (k - l)) s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2896
  using has_integral_add[OF _ has_integral_neg, of f k s g l]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2897
  unfolding algebra_simps
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2898
  by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2899
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2900
lemma integral_0:
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2901
  "integral s (\<lambda>x::'n::ordered_euclidean_space. 0::'m::real_normed_vector) = 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2902
  by (rule integral_unique has_integral_0)+
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2903
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2904
lemma integral_add: "f integrable_on s \<Longrightarrow> g integrable_on s \<Longrightarrow>
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2905
    integral s (\<lambda>x. f x + g x) = integral s f + integral s g"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2906
  apply (rule integral_unique)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2907
  apply (drule integrable_integral)+
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2908
  apply (rule has_integral_add)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2909
  apply assumption+
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2910
  done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2911
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2912
lemma integral_cmul: "f integrable_on s \<Longrightarrow> integral s (\<lambda>x. c *\<^sub>R f x) = c *\<^sub>R integral s f"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2913
  apply (rule integral_unique)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2914
  apply (drule integrable_integral)+
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2915
  apply (rule has_integral_cmul)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2916
  apply assumption+
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2917
  done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2918
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2919
lemma integral_neg: "f integrable_on s \<Longrightarrow> integral s (\<lambda>x. - f x) = - integral s f"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2920
  apply (rule integral_unique)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2921
  apply (drule integrable_integral)+
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2922
  apply (rule has_integral_neg)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2923
  apply assumption+
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2924
  done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2925
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2926
lemma integral_sub: "f integrable_on s \<Longrightarrow> g integrable_on s \<Longrightarrow>
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2927
    integral s (\<lambda>x. f x - g x) = integral s f - integral s g"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2928
  apply (rule integral_unique)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2929
  apply (drule integrable_integral)+
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2930
  apply (rule has_integral_sub)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2931
  apply assumption+
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2932
  done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2933
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2934
lemma integrable_0: "(\<lambda>x. 0) integrable_on s"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2935
  unfolding integrable_on_def using has_integral_0 by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2936
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2937
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
  2938
  unfolding integrable_on_def by(auto intro: has_integral_add)
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2939
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2940
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
  2941
  unfolding integrable_on_def by(auto intro: has_integral_cmul)
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2942
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  2943
lemma integrable_on_cmult_iff:
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2944
  fixes c :: real
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2945
  assumes "c \<noteq> 0"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  2946
  shows "(\<lambda>x. c * f x) integrable_on s \<longleftrightarrow> f integrable_on s"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  2947
  using integrable_cmul[of "\<lambda>x. c * f x" s "1 / c"] integrable_cmul[of f s c] `c \<noteq> 0`
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  2948
  by auto
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  2949
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2950
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
  2951
  unfolding integrable_on_def by(auto intro: has_integral_neg)
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2952
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2953
lemma integrable_sub:
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2954
  "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
  2955
  unfolding integrable_on_def by(auto intro: has_integral_sub)
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2956
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2957
lemma integrable_linear:
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2958
  "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
  2959
  unfolding integrable_on_def by(auto intro: has_integral_linear)
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2960
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2961
lemma integral_linear:
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2962
  "f integrable_on s \<Longrightarrow> bounded_linear h \<Longrightarrow> integral s (h \<circ> f) = h (integral s f)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2963
  apply (rule has_integral_unique)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2964
  defer
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2965
  unfolding has_integral_integral
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2966
  apply (drule (2) has_integral_linear)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2967
  unfolding has_integral_integral[symmetric]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2968
  apply (rule integrable_linear)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2969
  apply assumption+
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2970
  done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2971
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2972
lemma integral_component_eq[simp]:
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2973
  fixes f :: "'n::ordered_euclidean_space \<Rightarrow> 'm::ordered_euclidean_space"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2974
  assumes "f integrable_on s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2975
  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
  2976
  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
  2977
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2978
lemma has_integral_setsum:
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2979
  assumes "finite t"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2980
    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
  2981
  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
  2982
  using assms(1) subset_refl[of t]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2983
proof (induct rule: finite_subset_induct)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2984
  case empty
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2985
  then show ?case by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2986
next
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2987
  case (insert x F)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2988
  show ?case
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2989
    unfolding setsum_insert[OF insert(1,3)]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2990
    apply (rule has_integral_add)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2991
    using insert assms
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2992
    apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2993
    done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2994
qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2995
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2996
lemma integral_setsum: "finite t \<Longrightarrow> \<forall>a\<in>t. (f a) integrable_on s \<Longrightarrow>
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  2997
  integral s (\<lambda>x. setsum (\<lambda>a. f a x) t) = setsum (\<lambda>a. integral s (f a)) t"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2998
  apply (rule integral_unique)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  2999
  apply (rule has_integral_setsum)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3000
  using integrable_integral
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3001
  apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3002
  done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3003
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3004
lemma integrable_setsum:
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3005
  "finite t \<Longrightarrow> \<forall>a \<in> t. (f a) integrable_on s \<Longrightarrow> (\<lambda>x. setsum (\<lambda>a. f a x) t) integrable_on s"
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3006
  unfolding integrable_on_def
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3007
  apply (drule bchoice)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3008
  using has_integral_setsum[of t]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3009
  apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3010
  done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3011
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3012
lemma has_integral_eq:
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3013
  assumes "\<forall>x\<in>s. f x = g x"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3014
    and "(f has_integral k) s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3015
  shows "(g has_integral k) s"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3016
  using has_integral_sub[OF assms(2), of "\<lambda>x. f x - g x" 0]
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3017
  using has_integral_is_0[of s "\<lambda>x. f x - g x"]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3018
  using assms(1)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3019
  by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3020
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3021
lemma integrable_eq: "\<forall>x\<in>s. f x = g x \<Longrightarrow> f integrable_on s \<Longrightarrow> g integrable_on s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3022
  unfolding integrable_on_def
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3023
  using has_integral_eq[of s f g]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3024
  by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3025
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3026
lemma has_integral_eq_eq: "\<forall>x\<in>s. f x = g x \<Longrightarrow> (f has_integral k) s \<longleftrightarrow> (g has_integral k) s"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3027
  using has_integral_eq[of s f g] has_integral_eq[of s g f]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3028
  by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3029
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3030
lemma has_integral_null[dest]:
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3031
  assumes "content({a..b}) = 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3032
  shows "(f has_integral 0) ({a..b})"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3033
  unfolding has_integral
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3034
  apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3035
  apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3036
  apply (rule_tac x="\<lambda>x. ball x 1" in exI)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3037
  apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3038
  defer
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3039
  apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3040
  apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3041
  apply (erule conjE)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3042
proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3043
  fix e :: real
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3044
  assume e: "e > 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3045
  then show "gauge (\<lambda>x. ball x 1)"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3046
    by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3047
  fix p
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3048
  assume p: "p tagged_division_of {a..b}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3049
  have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - 0) = 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3050
    unfolding norm_eq_zero diff_0_right
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  3051
    using setsum_content_null[OF assms(1) p, of f] .
53410
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3052
  then show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - 0) < e"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3053
    using e by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3054
qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3055
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3056
lemma has_integral_null_eq[simp]: "content {a..b} = 0 \<Longrightarrow> (f has_integral i) {a..b} \<longleftrightarrow> i = 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3057
  apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3058
  apply (rule has_integral_unique)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3059
  apply assumption
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3060
  apply (drule (1) has_integral_null)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3061
  apply (drule has_integral_null)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3062
  apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3063
  done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3064
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3065
lemma integral_null[dest]: "content {a..b} = 0 \<Longrightarrow> integral {a..b} f = 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3066
  apply (rule integral_unique)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3067
  apply (drule has_integral_null)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3068
  apply assumption
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3069
  done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3070
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3071
lemma integrable_on_null[dest]: "content {a..b} = 0 \<Longrightarrow> f integrable_on {a..b}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3072
  unfolding integrable_on_def
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3073
  apply (drule has_integral_null)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3074
  apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3075
  done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3076
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3077
lemma has_integral_empty[intro]: "(f has_integral 0) {}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3078
  unfolding empty_as_interval
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3079
  apply (rule has_integral_null)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3080
  using content_empty
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3081
  unfolding empty_as_interval
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3082
  apply assumption
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3083
  done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3084
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3085
lemma has_integral_empty_eq[simp]: "(f has_integral i) {} \<longleftrightarrow> i = 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3086
  apply rule
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3087
  apply (rule has_integral_unique)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3088
  apply assumption
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3089
  apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3090
  done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3091
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3092
lemma integrable_on_empty[intro]: "f integrable_on {}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3093
  unfolding integrable_on_def by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3094
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3095
lemma integral_empty[simp]: "integral {} f = 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3096
  by (rule integral_unique) (rule has_integral_empty)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3097
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3098
lemma has_integral_refl[intro]:
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3099
  fixes a :: "'a::ordered_euclidean_space"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3100
  shows "(f has_integral 0) {a..a}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3101
    and "(f has_integral 0) {a}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3102
proof -
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3103
  have *: "{a} = {a..a}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3104
    apply (rule set_eqI)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3105
    unfolding mem_interval singleton_iff euclidean_eq_iff[where 'a='a]
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3106
    apply safe
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3107
    prefer 3
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3108
    apply (erule_tac x=b in ballE)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3109
    apply (auto simp add: field_simps)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3110
    done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3111
  show "(f has_integral 0) {a..a}" "(f has_integral 0) {a}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3112
    unfolding *
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3113
    apply (rule_tac[!] has_integral_null)
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3114
    unfolding content_eq_0_interior
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3115
    unfolding interior_closed_interval
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3116
    using interval_sing
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3117
    apply auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3118
    done
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3119
qed
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3120
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3121
lemma integrable_on_refl[intro]: "f integrable_on {a..a}"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3122
  unfolding integrable_on_def by auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3123
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3124
lemma integral_refl: "integral {a..a} f = 0"
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3125
  by (rule integral_unique) auto
0d45f21e372d tuned proofs;
wenzelm
parents: 53409
diff changeset
  3126
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3127
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3128
subsection {* Cauchy-type criterion for integrability. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3129
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  3130
(* XXXXXXX *)
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3131
lemma integrable_cauchy:
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3132
  fixes f :: "'n::ordered_euclidean_space \<Rightarrow> 'a::{real_normed_vector,complete_space}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3133
  shows "f integrable_on {a..b} \<longleftrightarrow>
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3134
    (\<forall>e>0.\<exists>d. gauge d \<and>
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3135
      (\<forall>p1 p2. p1 tagged_division_of {a..b} \<and> d fine p1 \<and>
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3136
        p2 tagged_division_of {a..b} \<and> d fine p2 \<longrightarrow>
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3137
        norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p1 -
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3138
        setsum (\<lambda>(x,k). content k *\<^sub>R f x) p2) < e))"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3139
  (is "?l = (\<forall>e>0. \<exists>d. ?P e d)")
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3140
proof
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3141
  assume ?l
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3142
  then guess y unfolding integrable_on_def has_integral .. note y=this
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3143
  show "\<forall>e>0. \<exists>d. ?P e d"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3144
  proof (rule, rule)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3145
    case goal1
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3146
    then have "e/2 > 0" by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3147
    then guess d
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3148
      apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3149
      apply (drule y[rule_format])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3150
      apply (elim exE conjE)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3151
      done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3152
    note d=this[rule_format]
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3153
    show ?case
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3154
      apply (rule_tac x=d in exI)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3155
      apply rule
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3156
      apply (rule d)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3157
      apply rule
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3158
      apply rule
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3159
      apply rule
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3160
      apply (erule conjE)+
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3161
    proof -
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3162
      fix p1 p2
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3163
      assume as: "p1 tagged_division_of {a..b}" "d fine p1"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3164
        "p2 tagged_division_of {a..b}" "d fine p2"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3165
      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
  3166
        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
  3167
        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
  3168
    qed
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3169
  qed
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3170
next
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3171
  assume "\<forall>e>0. \<exists>d. ?P e d"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3172
  then have "\<forall>n::nat. \<exists>d. ?P (inverse(real (n + 1))) d"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3173
    by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3174
  from choice[OF this] guess d .. note d=conjunctD2[OF this[rule_format],rule_format]
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3175
  have "\<And>n. gauge (\<lambda>x. \<Inter>{d i x |i. i \<in> {0..n}})"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3176
    apply (rule gauge_inters)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3177
    using d(1)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3178
    apply auto
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3179
    done
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3180
  then have "\<forall>n. \<exists>p. p tagged_division_of {a..b} \<and> (\<lambda>x. \<Inter>{d i x |i. i \<in> {0..n}}) fine p"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3181
    apply -
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3182
  proof
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3183
    case goal1
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3184
    from this[of n]
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3185
    show ?case
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3186
      apply (drule_tac fine_division_exists)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3187
      apply auto
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3188
      done
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3189
  qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3190
  from choice[OF this] guess p .. note p = conjunctD2[OF this[rule_format]]
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3191
  have dp: "\<And>i n. i\<le>n \<Longrightarrow> d i fine p n"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3192
    using p(2) unfolding fine_inters by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3193
  have "Cauchy (\<lambda>n. setsum (\<lambda>(x,k). content k *\<^sub>R (f x)) (p n))"
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3194
  proof (rule CauchyI)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3195
    case goal1
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3196
    then guess N unfolding real_arch_inv[of e] .. note N=this
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3197
    show ?case
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3198
      apply (rule_tac x=N in exI)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3199
    proof (rule, rule, rule, rule)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3200
      fix m n
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3201
      assume mn: "N \<le> m" "N \<le> n"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3202
      have *: "N = (N - 1) + 1" using N by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3203
      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
  3204
        apply (rule less_trans[OF _ N[THEN conjunct2,THEN conjunct2]])
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3205
        apply(subst *)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3206
        apply(rule d(2))
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3207
        using dp p(1)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3208
        using mn
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3209
        apply auto
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3210
        done
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3211
    qed
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3212
  qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  3213
  then guess y unfolding convergent_eq_cauchy[symmetric] .. note y=this[THEN LIMSEQ_D]
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3214
  show ?l
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3215
    unfolding integrable_on_def has_integral
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3216
    apply (rule_tac x=y in exI)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3217
  proof (rule, rule)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3218
    fix e :: real
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3219
    assume "e>0"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3220
    then have *:"e/2 > 0" by auto
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3221
    then guess N1 unfolding real_arch_inv[of "e/2"] .. note N1=this
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3222
    then have N1': "N1 = N1 - 1 + 1"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3223
      by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3224
    guess N2 using y[OF *] .. note N2=this
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3225
    show "\<exists>d. gauge d \<and>
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3226
      (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3227
        norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - y) < e)"
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3228
      apply (rule_tac x="d (N1 + N2)" in exI)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3229
      apply rule
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3230
      defer
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3231
    proof (rule, rule, erule conjE)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3232
      show "gauge (d (N1 + N2))"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3233
        using d by auto
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3234
      fix q
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3235
      assume as: "q tagged_division_of {a..b}" "d (N1 + N2) fine q"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3236
      have *: "inverse (real (N1 + N2 + 1)) < e / 2"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3237
        apply (rule less_trans)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3238
        using N1
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3239
        apply auto
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3240
        done
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3241
      show "norm ((\<Sum>(x, k)\<in>q. content k *\<^sub>R f x) - y) < e"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3242
        apply (rule norm_triangle_half_r)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3243
        apply (rule less_trans[OF _ *])
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3244
        apply (subst N1', rule d(2)[of "p (N1+N2)"])
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3245
        defer
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
  3246
        using N2[rule_format,of "N1+N2"]
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3247
        using as dp[of "N1 - 1 + 1 + N2" "N1 + N2"]
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3248
        using p(1)[of "N1 + N2"]
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3249
        using N1
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3250
        apply auto
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3251
        done
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3252
    qed
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3253
  qed
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3254
qed
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3255
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3256
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3257
subsection {* Additivity of integral on abutting intervals. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3258
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
  3259
lemma interval_split:
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3260
  fixes a :: "'a::ordered_euclidean_space"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3261
  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
  3262
  shows
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3263
    "{a..b} \<inter> {x. x\<bullet>k \<le> c} = {a .. (\<Sum>i\<in>Basis. (if i = k then min (b\<bullet>k) c else b\<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
  3264
    "{a..b} \<inter> {x. x\<bullet>k \<ge> c} = {(\<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
  3265
  apply (rule_tac[!] set_eqI)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3266
  unfolding Int_iff mem_interval mem_Collect_eq
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3267
  using assms
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3268
  apply auto
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3269
  done
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3270
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3271
lemma content_split:
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3272
  fixes a :: "'a::ordered_euclidean_space"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3273
  assumes "k \<in> Basis"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3274
  shows "content {a..b} = content({a..b} \<inter> {x. x\<bullet>k \<le> c}) + content({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
  3275
proof cases
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3276
  note simps = interval_split[OF assms] content_closed_interval_cases eucl_le[where 'a='a]
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3277
  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
  3278
    using assms by auto
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3279
  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
  3280
    "(\<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
  3281
    apply (subst *(1))
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3282
    defer
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3283
    apply (subst *(1))
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3284
    unfolding setprod_insert[OF *(2-)]
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3285
    apply auto
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3286
    done
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3287
  assume as: "a \<le> b"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3288
  moreover
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3289
  have "\<And>x. min (b \<bullet> k) c = max (a \<bullet> k) c \<Longrightarrow>
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3290
    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
  3291
    by  (auto simp add: field_simps)
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3292
  moreover
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3293
  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
  3294
      (\<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
  3295
    "(\<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
  3296
      (\<Prod>i\<in>Basis. b \<bullet> i - (if i = k then max (a \<bullet> k) c else 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
  3297
    by (auto intro!: setprod_cong)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  3298
  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
  3299
    unfolding not_le
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3300
    using as[unfolded eucl_le[where 'a='a],rule_format,of k] assms
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3301
    by auto
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3302
  ultimately show ?thesis
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3303
    using assms
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3304
    unfolding simps **
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3305
    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
  3306
    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
  3307
    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
  3308
next
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3309
  assume "\<not> a \<le> b"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3310
  then have "{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
  3311
    unfolding interval_eq_empty by (auto simp: eucl_le[where 'a='a] not_le)
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3312
  then show ?thesis
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3313
    by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3314
qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3315
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3316
lemma division_split_left_inj:
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3317
  fixes type :: "'a::ordered_euclidean_space"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3318
  assumes "d division_of i"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3319
    and "k1 \<in> d"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3320
    and "k2 \<in> d"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3321
    and "k1 \<noteq> k2"
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3322
    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
  3323
    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
  3324
  shows "content(k1 \<inter> {x. x\<bullet>k \<le> c}) = 0"
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3325
proof -
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3326
  note d=division_ofD[OF assms(1)]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3327
  have *: "\<And>(a::'a) b c. content ({a..b} \<inter> {x. x\<bullet>k \<le> c}) = 0 \<longleftrightarrow>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3328
    interior({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
  3329
    unfolding  interval_split[OF k] content_eq_0_interior by auto
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3330
  guess u1 v1 using d(4)[OF assms(2)] by (elim exE) note uv1=this
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3331
  guess u2 v2 using d(4)[OF assms(3)] by (elim exE) note uv2=this
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3332
  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
  3333
    by auto
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3334
  show ?thesis
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3335
    unfolding uv1 uv2 *
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3336
    apply (rule **[OF d(5)[OF assms(2-4)]])
53442
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3337
    defer
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3338
    apply (subst assms(5)[unfolded uv1 uv2])
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3339
    unfolding uv1 uv2
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3340
    apply auto
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3341
    done
f41ab5a7df97 tuned proofs;
wenzelm
parents: 53434
diff changeset
  3342
qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  3343
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3344
lemma division_split_right_inj:
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3345
  fixes type :: "'a::ordered_euclidean_space"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3346
  assumes "d division_of i"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3347
    and "k1 \<in> d"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3348
    and "k2 \<in> d"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3349
    and "k1 \<noteq> k2"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3350
    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
  3351
    and k: "k \<in> Basis"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3352
  shows "content (k1 \<inter> {x. x\<bullet>k \<ge> c}) = 0"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3353
proof -
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3354
  note d=division_ofD[OF assms(1)]
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3355
  have *: "\<And>a b::'a. \<And>c. content({a..b} \<inter> {x. x\<bullet>k \<ge> c}) = 0 \<longleftrightarrow>
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3356
    interior({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
  3357
    unfolding interval_split[OF k] content_eq_0_interior by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3358
  guess u1 v1 using d(4)[OF assms(2)] by (elim exE) note uv1=this
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3359
  guess u2 v2 using d(4)[OF assms(3)] by (elim exE) note uv2=this
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3360
  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
  3361
    by auto
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3362
  show ?thesis
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3363
    unfolding uv1 uv2 *
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3364
    apply (rule **[OF d(5)[OF assms(2-4)]])
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3365
    defer
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3366
    apply (subst assms(5)[unfolded uv1 uv2])
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3367
    unfolding uv1 uv2
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3368
    apply auto
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3369
    done
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3370
qed
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3371
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3372
lemma tagged_division_split_left_inj:
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3373
  fixes x1 :: "'a::ordered_euclidean_space"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3374
  assumes "d tagged_division_of i"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3375
    and "(x1, k1) \<in> d"
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3376
    and "(x2, k2) \<in> d"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3377
    and "k1 \<noteq> k2"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3378
    and "k1 \<inter> {x. x\<bullet>k \<le> c} = k2 \<inter> {x. x\<bullet>k \<le> c}"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3379
    and k: "k \<in> Basis"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3380
  shows "content (k1 \<inter> {x. x\<bullet>k \<le> c}) = 0"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3381
proof -
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3382
  have *: "\<And>a b c. (a,b) \<in> c \<Longrightarrow> b \<in> snd ` c"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3383
    unfolding image_iff
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3384
    apply (rule_tac x="(a,b)" in bexI)
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3385
    apply auto
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3386
    done
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3387
  show ?thesis
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3388
    apply (rule division_split_left_inj[OF division_of_tagged_division[OF assms(1)]])
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3389
    apply (rule_tac[1-2] *)
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3390
    using assms(2-)
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3391
    apply auto
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3392
    done
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3393
qed
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3394
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3395
lemma tagged_division_split_right_inj:
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3396
  fixes x1 :: "'a::ordered_euclidean_space"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3397
  assumes "d tagged_division_of i"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3398
    and "(x1, k1) \<in> d"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3399
    and "(x2, k2) \<in> d"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3400
    and "k1 \<noteq> k2"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3401
    and "k1 \<inter> {x. x\<bullet>k \<ge> c} = k2 \<inter> {x. x\<bullet>k \<ge> c}"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3402
  and k: "k \<in> Basis"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3403
  shows "content (k1 \<inter> {x. x\<bullet>k \<ge> c}) = 0"
53443
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3404
proof -
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3405
  have *: "\<And>a b c. (a,b) \<in> c \<Longrightarrow> b \<in> snd ` c"
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3406
    unfolding image_iff
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3407
    apply (rule_tac x="(a,b)" in bexI)
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3408
    apply auto
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3409
    done
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3410
  show ?thesis
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3411
    apply (rule division_split_right_inj[OF division_of_tagged_division[OF assms(1)]])
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3412
    apply (rule_tac[1-2] *)
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3413
    using assms(2-)
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3414
    apply auto
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3415
    done
2f6c0289dcde tuned proofs;
wenzelm
parents: 53442
diff changeset
  3416
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3417
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3418
lemma division_split:
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3419
  fixes a :: "'a::ordered_euclidean_space"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3420
  assumes "p division_of {a..b}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3421
    and k: "k\<in>Basis"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3422
  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({a..b} \<inter> {x. x\<bullet>k \<le> c})"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3423
      (is "?p1 division_of ?I1")
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3424
    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 ({a..b} \<inter> {x. x\<bullet>k \<ge> c})"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3425
      (is "?p2 division_of ?I2")
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3426
proof (rule_tac[!] division_ofI)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3427
  note p = division_ofD[OF assms(1)]
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3428
  show "finite ?p1" "finite ?p2"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3429
    using p(1) by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3430
  show "\<Union>?p1 = ?I1" "\<Union>?p2 = ?I2"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3431
    unfolding p(6)[symmetric] by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3432
  {
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3433
    fix k
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3434
    assume "k \<in> ?p1"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3435
    then guess l unfolding mem_Collect_eq by (elim exE conjE) note l=this
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3436
    guess u v using p(4)[OF l(2)] by (elim exE) note uv=this
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3437
    show "k \<subseteq> ?I1" "k \<noteq> {}" "\<exists>a b. k = {a..b}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3438
      unfolding l
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3439
      using p(2-3)[OF l(2)] l(3)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3440
      unfolding uv
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3441
      apply -
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3442
      prefer 3
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3443
      apply (subst interval_split[OF k])
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3444
      apply auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3445
      done
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3446
    fix k'
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3447
    assume "k' \<in> ?p1"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3448
    then guess l' unfolding mem_Collect_eq by (elim exE conjE) note l'=this
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3449
    assume "k \<noteq> k'"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3450
    then show "interior k \<inter> interior k' = {}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3451
      unfolding l l' using p(5)[OF l(2) l'(2)] by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3452
  }
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3453
  {
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3454
    fix k
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3455
    assume "k \<in> ?p2"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3456
    then guess l unfolding mem_Collect_eq by (elim exE conjE) note l=this
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3457
    guess u v using p(4)[OF l(2)] by (elim exE) note uv=this
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3458
    show "k \<subseteq> ?I2" "k \<noteq> {}" "\<exists>a b. k = {a..b}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3459
      unfolding l
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3460
      using p(2-3)[OF l(2)] l(3)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3461
      unfolding uv
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3462
      apply -
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3463
      prefer 3
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3464
      apply (subst interval_split[OF k])
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3465
      apply auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3466
      done
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3467
    fix k'
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3468
    assume "k' \<in> ?p2"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3469
    then guess l' unfolding mem_Collect_eq by (elim exE conjE) note l'=this
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3470
    assume "k \<noteq> k'"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3471
    then show "interior k \<inter> interior k' = {}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3472
      unfolding l l' using p(5)[OF l(2) l'(2)] by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3473
  }
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3474
qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3475
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3476
lemma has_integral_split:
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3477
  fixes f :: "'a::ordered_euclidean_space \<Rightarrow> 'b::real_normed_vector"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3478
  assumes "(f has_integral i) ({a..b} \<inter> {x. x\<bullet>k \<le> c})"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3479
    and "(f has_integral j) ({a..b} \<inter> {x. x\<bullet>k \<ge> c})"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3480
    and k: "k \<in> Basis"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3481
  shows "(f has_integral (i + j)) ({a..b})"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3482
proof (unfold has_integral, rule, rule)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3483
  case goal1
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3484
  then have e: "e/2 > 0"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3485
    by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3486
  guess d1 using has_integralD[OF assms(1)[unfolded interval_split[OF k]] e] .
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3487
  note d1=this[unfolded interval_split[symmetric,OF k]]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3488
  guess d2 using has_integralD[OF assms(2)[unfolded interval_split[OF k]] e] .
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3489
  note d2=this[unfolded interval_split[symmetric,OF 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
  3490
  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"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3491
  show ?case
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3492
    apply (rule_tac x="?d" in exI)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3493
    apply rule
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3494
    defer
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3495
    apply rule
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3496
    apply rule
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3497
    apply (elim conjE)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3498
  proof -
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3499
    show "gauge ?d"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3500
      using d1(1) d2(1) unfolding gauge_def by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3501
    fix p
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3502
    assume "p tagged_division_of {a..b}" "?d fine p"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3503
    note p = this tagged_division_ofD[OF this(1)]
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3504
    have lem0:
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3505
      "\<And>x kk. (x, kk) \<in> p \<Longrightarrow> kk \<inter> {x. x\<bullet>k \<le> c} \<noteq> {} \<Longrightarrow> x\<bullet>k \<le> c"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3506
      "\<And>x kk. (x, kk) \<in> p \<Longrightarrow> kk \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {} \<Longrightarrow> x\<bullet>k \<ge> c"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3507
    proof -
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3508
      fix x kk
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3509
      assume as: "(x, kk) \<in> p"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3510
      {
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3511
        assume *: "kk \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3512
        show "x\<bullet>k \<le> c"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3513
        proof (rule ccontr)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3514
          assume **: "\<not> ?thesis"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3515
          from this[unfolded not_le]
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3516
          have "kk \<subseteq> ball x \<bar>x \<bullet> k - c\<bar>"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3517
            using p(2)[unfolded fine_def, rule_format,OF as,unfolded split_conv] by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3518
          with * have "\<exists>y. y \<in> ball x \<bar>x \<bullet> k - c\<bar> \<inter> {x. x \<bullet> k \<le> c}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3519
            by blast
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3520
          then guess y ..
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3521
          then have "\<bar>x \<bullet> k - y \<bullet> k\<bar> < \<bar>x \<bullet> k - c\<bar>" "y\<bullet>k \<le> c"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3522
            apply -
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3523
            apply (rule le_less_trans)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3524
            using Basis_le_norm[OF k, of "x - y"]
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3525
            apply (auto simp add: dist_norm inner_diff_left)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3526
            done
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3527
          then show False
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3528
            using **[unfolded not_le] by (auto simp add: field_simps)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3529
        qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3530
      next
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3531
        assume *: "kk \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3532
        show "x\<bullet>k \<ge> c"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3533
        proof (rule ccontr)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3534
          assume **: "\<not> ?thesis"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3535
          from this[unfolded not_le] have "kk \<subseteq> ball x \<bar>x \<bullet> k - c\<bar>"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3536
            using p(2)[unfolded fine_def,rule_format,OF as,unfolded split_conv] by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3537
          with * have "\<exists>y. y \<in> ball x \<bar>x \<bullet> k - c\<bar> \<inter> {x. x \<bullet> k \<ge> c}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3538
            by blast
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3539
          then guess y ..
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3540
          then have "\<bar>x \<bullet> k - y \<bullet> k\<bar> < \<bar>x \<bullet> k - c\<bar>" "y\<bullet>k \<ge> c"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3541
            apply -
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3542
            apply (rule le_less_trans)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3543
            using Basis_le_norm[OF k, of "x - y"]
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3544
            apply (auto simp add: dist_norm inner_diff_left)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3545
            done
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3546
          then show False
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3547
            using **[unfolded not_le] by (auto simp add: field_simps)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3548
        qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3549
      }
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3550
    qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3551
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3552
    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>
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3553
      (\<forall>x k. P x k \<longrightarrow> Q x (f k))" by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3554
    have lem2: "\<And>f s P f. finite s \<Longrightarrow> finite {(x,f k) | x k. (x,k) \<in> s \<and> P x k}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3555
    proof -
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3556
      case goal1
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3557
      then show ?case
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3558
        apply -
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3559
        apply (rule finite_subset[of _ "(\<lambda>(x,k). (x,f k)) ` s"])
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3560
        apply auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3561
        done
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3562
    qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3563
    have lem3: "\<And>g :: 'a set \<Rightarrow> 'a set. finite p \<Longrightarrow>
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3564
      setsum (\<lambda>(x, k). content k *\<^sub>R f x) {(x,g k) |x k. (x,k) \<in> p \<and> g k \<noteq> {}} =
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3565
      setsum (\<lambda>(x, k). content k *\<^sub>R f x) ((\<lambda>(x, k). (x, g k)) ` p)"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3566
      apply (rule setsum_mono_zero_left)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3567
      prefer 3
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3568
    proof
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3569
      fix g :: "'a set \<Rightarrow> 'a set"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3570
      fix i :: "'a \<times> 'a set"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3571
      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
  3572
      then obtain x k where xk:
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3573
        "i = (x, g k)"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3574
        "(x, k) \<in> p"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3575
        "(x, g k) \<notin> {(x, g k) |x k. (x, k) \<in> p \<and> g k \<noteq> {}}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3576
        by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3577
      have "content (g k) = 0"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3578
        using xk using content_empty by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3579
      then show "(\<lambda>(x, k). content k *\<^sub>R f x) i = 0"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3580
        unfolding xk split_conv by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3581
    qed auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3582
    have lem4: "\<And>g. (\<lambda>(x,l). content (g l) *\<^sub>R f x) = (\<lambda>(x,l). content l *\<^sub>R f x) \<circ> (\<lambda>(x,l). (x,g l))"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3583
      by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3584
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3585
    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> {}}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3586
    have "norm ((\<Sum>(x, k)\<in>?M1. content k *\<^sub>R f x) - i) < e/2"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3587
      apply (rule d1(2),rule tagged_division_ofI)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3588
      apply (rule lem2 p(3))+
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3589
      prefer 6
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3590
      apply (rule fineI)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3591
    proof -
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3592
      show "\<Union>{k. \<exists>x. (x, k) \<in> ?M1} = {a..b} \<inter> {x. x\<bullet>k \<le> c}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3593
        unfolding p(8)[symmetric] by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3594
      fix x l
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3595
      assume xl: "(x, l) \<in> ?M1"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3596
      then guess x' l' unfolding mem_Collect_eq unfolding Pair_eq by (elim exE conjE) note xl'=this
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3597
      have "l' \<subseteq> d1 x'"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3598
        apply (rule order_trans[OF fineD[OF p(2) xl'(3)]])
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3599
        apply auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3600
        done
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3601
      then show "l \<subseteq> d1 x"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3602
        unfolding xl' by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3603
      show "x \<in> l" "l \<subseteq> {a..b} \<inter> {x. x \<bullet> k \<le> c}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3604
        unfolding xl'
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3605
        using p(4-6)[OF xl'(3)] using xl'(4)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3606
        using lem0(1)[OF xl'(3-4)] by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3607
      show "\<exists>a b. l = {a..b}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3608
        unfolding xl'
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3609
        using p(6)[OF xl'(3)]
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3610
        by (fastforce simp add: interval_split[OF k,where c=c])
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3611
      fix y r
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3612
      let ?goal = "interior l \<inter> interior r = {}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3613
      assume yr: "(y, r) \<in> ?M1"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3614
      then guess y' r' unfolding mem_Collect_eq unfolding Pair_eq by (elim exE conjE) note yr'=this
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3615
      assume as: "(x, l) \<noteq> (y, r)"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3616
      show "interior l \<inter> interior r = {}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3617
      proof (cases "l' = r' \<longrightarrow> x' = y'")
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3618
        case False
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3619
        then show ?thesis
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3620
          using p(7)[OF xl'(3) yr'(3)] using as unfolding xl' yr' by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3621
      next
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3622
        case True
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3623
        then have "l' \<noteq> r'"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3624
          using as unfolding xl' yr' by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3625
        then show ?thesis
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3626
          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
  3627
      qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3628
    qed
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3629
    moreover
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  3630
    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> {}}"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3631
    have "norm ((\<Sum>(x, k)\<in>?M2. content k *\<^sub>R f x) - j) < e/2"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3632
      apply (rule d2(2),rule tagged_division_ofI)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3633
      apply (rule lem2 p(3))+
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3634
      prefer 6
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3635
      apply (rule fineI)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3636
    proof -
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3637
      show "\<Union>{k. \<exists>x. (x, k) \<in> ?M2} = {a..b} \<inter> {x. x\<bullet>k \<ge> c}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3638
        unfolding p(8)[symmetric] by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3639
      fix x l
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3640
      assume xl: "(x, l) \<in> ?M2"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3641
      then guess x' l' unfolding mem_Collect_eq unfolding Pair_eq by (elim exE conjE) note xl'=this
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3642
      have "l' \<subseteq> d2 x'"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3643
        apply (rule order_trans[OF fineD[OF p(2) xl'(3)]])
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3644
        apply auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3645
        done
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3646
      then show "l \<subseteq> d2 x"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3647
        unfolding xl' by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3648
      show "x \<in> l" "l \<subseteq> {a..b} \<inter> {x. x \<bullet> k \<ge> c}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3649
        unfolding xl'
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3650
        using p(4-6)[OF xl'(3)]
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3651
        using xl'(4)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3652
        using lem0(2)[OF xl'(3-4)]
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3653
        by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3654
      show "\<exists>a b. l = {a..b}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3655
        unfolding xl'
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3656
        using p(6)[OF xl'(3)]
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3657
        by (fastforce simp add: interval_split[OF k, where c=c])
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3658
      fix y r
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3659
      let ?goal = "interior l \<inter> interior r = {}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3660
      assume yr: "(y, r) \<in> ?M2"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3661
      then guess y' r' unfolding mem_Collect_eq unfolding Pair_eq by (elim exE conjE) note yr'=this
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3662
      assume as: "(x, l) \<noteq> (y, r)"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3663
      show "interior l \<inter> interior r = {}"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3664
      proof (cases "l' = r' \<longrightarrow> x' = y'")
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3665
        case False
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3666
        then show ?thesis
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3667
          using p(7)[OF xl'(3) yr'(3)] using as unfolding xl' yr' by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3668
      next
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3669
        case True
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3670
        then have "l' \<noteq> r'"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3671
          using as unfolding xl' yr' by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3672
        then show ?thesis
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3673
          using p(7)[OF xl'(3) yr'(3)] using as unfolding xl' yr' by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3674
      qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3675
    qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3676
    ultimately
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3677
    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"
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3678
      apply -
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3679
      apply (rule norm_triangle_lt)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3680
      apply auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3681
      done
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3682
    also {
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3683
      have *: "\<And>x y. x = (0::real) \<Longrightarrow> x *\<^sub>R (y::'b) = 0"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3684
        using scaleR_zero_left by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3685
      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
  3686
        (\<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
  3687
        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
  3688
      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
  3689
        (\<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
  3690
        unfolding lem3[OF p(3)]
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3691
        apply (subst setsum_reindex_nonzero[OF p(3)])
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3692
        defer
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3693
        apply (subst setsum_reindex_nonzero[OF p(3)])
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3694
        defer
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3695
        unfolding lem4[symmetric]
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3696
        apply (rule refl)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3697
        unfolding split_paired_all split_conv
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3698
        apply (rule_tac[!] *)
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3699
      proof -
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3700
        case goal1
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3701
        then show ?case
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3702
          apply -
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3703
          apply (rule tagged_division_split_left_inj [OF p(1), of a b aa ba])
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3704
          using k
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3705
          apply auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3706
          done
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3707
      next
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3708
        case goal2
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3709
        then show ?case
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3710
          apply -
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3711
          apply (rule tagged_division_split_right_inj[OF p(1), of a b aa ba])
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3712
          using k
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3713
          apply auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3714
          done
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3715
      qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3716
      also note setsum_addf[symmetric]
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3717
      also have *: "\<And>x. x \<in> p \<Longrightarrow>
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3718
        (\<lambda>(x,ka). content (ka \<inter> {x. x \<bullet> k \<le> c}) *\<^sub>R f x) x +
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3719
          (\<lambda>(x,ka). content (ka \<inter> {x. c \<le> x \<bullet> k}) *\<^sub>R f x) x =
53468
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3720
        (\<lambda>(x,ka). content ka *\<^sub>R f x) x"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3721
        unfolding split_paired_all split_conv
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3722
      proof -
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3723
        fix a b
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3724
        assume "(a, b) \<in> p"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3725
        from p(6)[OF this] guess u v by (elim exE) note uv=this
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3726
        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
  3727
          content b *\<^sub>R f a"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3728
          unfolding scaleR_left_distrib[symmetric]
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3729
          unfolding uv content_split[OF k,of u v c]
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3730
          by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3731
      qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3732
      note setsum_cong2[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
  3733
      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
  3734
        ((\<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
  3735
        (\<Sum>(x, ka)\<in>p. content ka *\<^sub>R f x) - (i + j)"
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3736
        by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3737
    }
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3738
    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
  3739
      by auto
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3740
  qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3741
qed
0688928a41fd tuned proofs;
wenzelm
parents: 53443
diff changeset
  3742
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3743
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3744
subsection {* A sort of converse, integrability on subintervals. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3745
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3746
lemma tagged_division_union_interval:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3747
  fixes a :: "'a::ordered_euclidean_space"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3748
  assumes "p1 tagged_division_of ({a..b} \<inter> {x. x\<bullet>k \<le> (c::real)})"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3749
    and "p2 tagged_division_of ({a..b} \<inter> {x. x\<bullet>k \<ge> c})"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3750
    and k: "k \<in> Basis"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3751
  shows "(p1 \<union> p2) tagged_division_of ({a..b})"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3752
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3753
  have *: "{a..b} = ({a..b} \<inter> {x. x\<bullet>k \<le> c}) \<union> ({a..b} \<inter> {x. x\<bullet>k \<ge> c})"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3754
    by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3755
  show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3756
    apply (subst *)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3757
    apply (rule tagged_division_union[OF assms(1-2)])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3758
    unfolding interval_split[OF k] interior_closed_interval
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3759
    using k
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3760
    apply (auto simp add: eucl_less[where 'a='a] elim!: ballE[where x=k])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3761
    done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3762
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3763
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3764
lemma has_integral_separate_sides:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3765
  fixes f :: "'a::ordered_euclidean_space \<Rightarrow> 'b::real_normed_vector"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3766
  assumes "(f has_integral i) ({a..b})"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3767
    and "e > 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3768
    and k: "k \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3769
  obtains d where "gauge d"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3770
    "\<forall>p1 p2. p1 tagged_division_of ({a..b} \<inter> {x. x\<bullet>k \<le> c}) \<and> d fine p1 \<and>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3771
        p2 tagged_division_of ({a..b} \<inter> {x. x\<bullet>k \<ge> c}) \<and> d fine p2 \<longrightarrow>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3772
        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
  3773
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3774
  guess d using has_integralD[OF assms(1-2)] . note d=this
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3775
  show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3776
    apply (rule that[of d])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3777
    apply (rule d)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3778
    apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3779
    apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3780
    apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3781
    apply (elim conjE)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3782
  proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3783
    fix p1 p2
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3784
    assume "p1 tagged_division_of {a..b} \<inter> {x. x \<bullet> k \<le> c}" "d fine p1"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3785
    note p1=tagged_division_ofD[OF this(1)] this
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3786
    assume "p2 tagged_division_of {a..b} \<inter> {x. c \<le> x \<bullet> k}" "d fine p2"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3787
    note p2=tagged_division_ofD[OF this(1)] this
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3788
    note tagged_division_union_interval[OF p1(7) p2(7)] note p12 = tagged_division_ofD[OF this] this
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3789
    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) =
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3790
      norm ((\<Sum>(x, k)\<in>p1 \<union> p2. content k *\<^sub>R f x) - i)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3791
      apply (subst setsum_Un_zero)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3792
      apply (rule p1 p2)+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3793
      apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3794
      unfolding split_paired_all split_conv
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3795
    proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3796
      fix a b
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3797
      assume ab: "(a, b) \<in> p1 \<inter> p2"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3798
      have "(a, b) \<in> p1"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3799
        using ab by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3800
      from p1(4)[OF this] guess u v by (elim exE) note uv = this
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3801
      have "b \<subseteq> {x. x\<bullet>k = c}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3802
        using ab p1(3)[of a b] p2(3)[of a b] by fastforce
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3803
      moreover
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3804
      have "interior {x::'a. x \<bullet> k = c} = {}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3805
      proof (rule ccontr)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3806
        assume "\<not> ?thesis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3807
        then obtain x where x: "x \<in> interior {x::'a. x\<bullet>k = c}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3808
          by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3809
        then guess e unfolding mem_interior .. note e=this
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3810
        have x: "x\<bullet>k = c"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3811
          using x interior_subset by fastforce
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3812
        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
  3813
          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
  3814
        have "(\<Sum>i\<in>Basis. \<bar>(x - (x + (e / 2 ) *\<^sub>R k)) \<bullet> i\<bar>) =
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3815
          (\<Sum>i\<in>Basis. (if i = k then e / 2 else 0))"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3816
          apply (rule setsum_cong2)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3817
          apply (subst *)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3818
          apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3819
          done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3820
        also have "\<dots> < e"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3821
          apply (subst setsum_delta)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3822
          using e
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3823
          apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3824
          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
  3825
        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
  3826
          unfolding mem_ball dist_norm by(rule le_less_trans[OF norm_le_l1])
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3827
        then have "x + (e/2) *\<^sub>R k \<in> {x. x\<bullet>k = c}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3828
          using e by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3829
        then show False
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3830
          unfolding mem_Collect_eq using e x k by (auto simp: inner_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3831
      qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3832
      ultimately have "content b = 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3833
        unfolding uv content_eq_0_interior
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3834
        apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3835
        apply (drule interior_mono)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3836
        apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3837
        done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3838
      then show "content b *\<^sub>R f a = 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3839
        by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3840
    qed auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3841
    also have "\<dots> < e"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3842
      by (rule k d(2) p12 fine_union p1 p2)+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3843
    finally show "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" .
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3844
  qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3845
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3846
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
  3847
lemma integrable_split[intro]:
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3848
  fixes f :: "'a::ordered_euclidean_space \<Rightarrow> 'b::{real_normed_vector,complete_space}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3849
  assumes "f integrable_on {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3850
    and k: "k \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3851
  shows "f integrable_on ({a..b} \<inter> {x. x\<bullet>k \<le> c})" (is ?t1)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3852
    and "f integrable_on ({a..b} \<inter> {x. x\<bullet>k \<ge> c})" (is ?t2)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3853
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3854
  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
  3855
  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
  3856
  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
  3857
  show ?t1 ?t2
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3858
    unfolding interval_split[OF k] integrable_cauchy
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3859
    unfolding interval_split[symmetric,OF k]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3860
  proof (rule_tac[!] allI impI)+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3861
    fix e :: real
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3862
    assume "e > 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3863
    then have "e/2>0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3864
      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
  3865
    from has_integral_separate_sides[OF y this k,of c] guess d . note d=this[rule_format]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3866
    let ?P = "\<lambda>A. \<exists>d. gauge d \<and> (\<forall>p1 p2. p1 tagged_division_of {a..b} \<inter> A \<and> d fine p1 \<and>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3867
      p2 tagged_division_of {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
  3868
      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
  3869
    show "?P {x. x \<bullet> k \<le> c}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3870
      apply (rule_tac x=d in exI)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3871
      apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3872
      apply (rule d)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3873
      apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3874
      apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3875
      apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3876
    proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3877
      fix p1 p2
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3878
      assume as: "p1 tagged_division_of {a..b} \<inter> {x. x \<bullet> k \<le> c} \<and> d fine p1 \<and>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3879
        p2 tagged_division_of {a..b} \<inter> {x. x \<bullet> k \<le> c} \<and> d fine p2"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3880
      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"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3881
      proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3882
        guess p using fine_division_exists[OF d(1), of a' b] . note p=this
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3883
        show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3884
          using norm_triangle_half_l[OF d(2)[of p1 p] d(2)[of p2 p]]
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  3885
          using as unfolding interval_split[OF k] b'_def[symmetric] a'_def[symmetric]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3886
          using p using assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3887
          by (auto simp add: algebra_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3888
      qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3889
    qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3890
    show "?P {x. x \<bullet> k \<ge> c}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3891
      apply (rule_tac x=d in exI)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3892
      apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3893
      apply (rule d)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3894
      apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3895
      apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3896
      apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3897
    proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3898
      fix p1 p2
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3899
      assume as: "p1 tagged_division_of {a..b} \<inter> {x. x \<bullet> k \<ge> c} \<and> d fine p1 \<and>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3900
        p2 tagged_division_of {a..b} \<inter> {x. x \<bullet> k \<ge> c} \<and> d fine p2"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3901
      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"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3902
      proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3903
        guess p using fine_division_exists[OF d(1), of a b'] . note p=this
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3904
        show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3905
          using norm_triangle_half_l[OF d(2)[of p p1] d(2)[of p p2]]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3906
          using as
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3907
          unfolding interval_split[OF k] b'_def[symmetric] a'_def[symmetric]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3908
          using p
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3909
          using assms
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3910
          by (auto simp add: algebra_simps)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3911
      qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3912
    qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3913
  qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3914
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3915
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3916
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3917
subsection {* Generalized notion of additivity. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3918
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3919
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
  3920
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3921
definition operative :: "('a \<Rightarrow> 'a \<Rightarrow> 'a) \<Rightarrow> (('b::ordered_euclidean_space) set \<Rightarrow> 'a) \<Rightarrow> bool"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3922
  where "operative opp f \<longleftrightarrow>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3923
    (\<forall>a b. content {a..b} = 0 \<longrightarrow> f {a..b} = neutral opp) \<and>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3924
    (\<forall>a b c. \<forall>k\<in>Basis. f {a..b} = opp (f({a..b} \<inter> {x. x\<bullet>k \<le> c})) (f ({a..b} \<inter> {x. x\<bullet>k \<ge> c})))"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3925
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3926
lemma operativeD[dest]:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3927
  fixes type :: "'a::ordered_euclidean_space"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3928
  assumes "operative opp f"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3929
  shows "\<And>a b::'a. content {a..b} = 0 \<Longrightarrow> f {a..b} = neutral opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3930
    and "\<And>a b c k. k \<in> Basis \<Longrightarrow> f {a..b} =
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3931
      opp (f ({a..b} \<inter> {x. x\<bullet>k \<le> c})) (f ({a..b} \<inter> {x. x\<bullet>k \<ge> c}))"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3932
  using assms unfolding operative_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3933
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  3934
lemma operative_trivial: "operative opp f \<Longrightarrow> content {a..b} = 0 \<Longrightarrow> f {a..b} = neutral opp"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3935
  unfolding operative_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3936
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3937
lemma property_empty_interval: "\<forall>a b. content {a..b} = 0 \<longrightarrow> P {a..b} \<Longrightarrow> P {}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3938
  using content_empty unfolding empty_as_interval by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3939
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3940
lemma operative_empty: "operative opp f \<Longrightarrow> f {} = neutral opp"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3941
  unfolding operative_def by (rule property_empty_interval) auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3942
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3943
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3944
subsection {* Using additivity of lifted function to encode definedness. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3945
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3946
lemma forall_option: "(\<forall>x. P x) \<longleftrightarrow> P None \<and> (\<forall>x. P (Some x))"
36362
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36359
diff changeset
  3947
  by (metis option.nchotomy)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3948
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3949
lemma exists_option: "(\<exists>x. P x) \<longleftrightarrow> P None \<or> (\<exists>x. P (Some x))"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3950
  by (metis option.nchotomy)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3951
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3952
fun lifted where
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3953
  "lifted (opp :: 'a \<Rightarrow> 'a \<Rightarrow> 'b) (Some x) (Some y) = Some (opp x y)"
49197
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  3954
| "lifted opp None _ = (None::'b option)"
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  3955
| "lifted opp _ None = None"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3956
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3957
lemma lifted_simp_1[simp]: "lifted opp v None = None"
49197
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  3958
  by (induct v) auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3959
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3960
definition "monoidal opp \<longleftrightarrow>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3961
  (\<forall>x y. opp x y = opp y x) \<and>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3962
  (\<forall>x y z. opp x (opp y z) = opp (opp x y) z) \<and>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3963
  (\<forall>x. opp (neutral opp) x = x)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3964
49197
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  3965
lemma monoidalI:
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  3966
  assumes "\<And>x y. opp x y = opp y x"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3967
    and "\<And>x y z. opp x (opp y z) = opp (opp x y) z"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3968
    and "\<And>x. opp (neutral opp) x = x"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3969
  shows "monoidal opp"
44890
22f665a2e91c new fastforce replacing fastsimp - less confusing name
nipkow
parents: 44522
diff changeset
  3970
  unfolding monoidal_def using assms by fastforce
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3971
49197
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  3972
lemma monoidal_ac:
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  3973
  assumes "monoidal opp"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3974
  shows "opp (neutral opp) a = a"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3975
    and "opp a (neutral opp) = a"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3976
    and "opp a b = opp b a"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3977
    and "opp (opp a b) c = opp a (opp b c)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3978
    and "opp a (opp b c) = opp b (opp a c)"
49197
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  3979
  using assms unfolding monoidal_def by metis+
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3980
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3981
lemma monoidal_simps[simp]:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3982
  assumes "monoidal opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3983
  shows "opp (neutral opp) a = a"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3984
    and "opp a (neutral opp) = a"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3985
  using monoidal_ac[OF assms] by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  3986
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3987
lemma neutral_lifted[cong]:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3988
  assumes "monoidal opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3989
  shows "neutral (lifted opp) = Some (neutral opp)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3990
  apply (subst neutral_def)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3991
  apply (rule some_equality)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3992
  apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3993
  apply (induct_tac y)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3994
  prefer 3
49197
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  3995
proof -
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3996
  fix x
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3997
  assume "\<forall>y. lifted opp x y = y \<and> lifted opp y x = y"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3998
  then show "x = Some (neutral opp)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  3999
    apply (induct x)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4000
    defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4001
    apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4002
    apply (subst neutral_def)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4003
    apply (subst eq_commute)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4004
    apply(rule some_equality)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4005
    apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4006
    apply (erule_tac x="Some y" in allE)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4007
    defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4008
    apply (erule_tac x="Some x" in allE)
49197
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  4009
    apply auto
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  4010
    done
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4011
qed (auto simp add:monoidal_ac[OF assms])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4012
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4013
lemma monoidal_lifted[intro]:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4014
  assumes "monoidal opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4015
  shows "monoidal (lifted opp)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4016
  unfolding monoidal_def forall_option neutral_lifted[OF assms]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4017
  using monoidal_ac[OF assms]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4018
  by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4019
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4020
definition "support opp f s = {x. x\<in>s \<and> f x \<noteq> neutral opp}"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4021
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
  4022
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
  4023
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4024
lemma support_subset[intro]: "support opp f s \<subseteq> s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4025
  unfolding support_def by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4026
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4027
lemma support_empty[simp]: "support opp f {} = {}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4028
  using support_subset[of opp f "{}"] by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4029
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4030
lemma comp_fun_commute_monoidal[intro]:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4031
  assumes "monoidal opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4032
  shows "comp_fun_commute opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4033
  unfolding comp_fun_commute_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4034
  using monoidal_ac[OF assms]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4035
  by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4036
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4037
lemma support_clauses:
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4038
  "\<And>f g s. support opp f {} = {}"
49197
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  4039
  "\<And>f g s. support opp f (insert x s) =
e5224d887e12 tuned proofs;
wenzelm
parents: 49194
diff changeset
  4040
    (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
  4041
  "\<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
  4042
  "\<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
  4043
  "\<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
  4044
  "\<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
  4045
  "\<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
  4046
  unfolding support_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4047
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4048
lemma finite_support[intro]: "finite s \<Longrightarrow> finite (support opp f s)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4049
  unfolding support_def by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4050
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4051
lemma iterate_empty[simp]: "iterate opp {} f = neutral opp"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  4052
  unfolding iterate_def fold'_def by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4053
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4054
lemma iterate_insert[simp]:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4055
  assumes "monoidal opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4056
    and "finite s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4057
  shows "iterate opp (insert x s) f =
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4058
    (if x \<in> s then iterate opp s f else opp (f x) (iterate opp s f))"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4059
proof (cases "x \<in> s")
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4060
  case True
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4061
  then have *: "insert x s = s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4062
    by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4063
  show ?thesis unfolding iterate_def if_P[OF True] * by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4064
next
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4065
  case False
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4066
  note x = this
42871
1c0b99f950d9 names of fold_set locales resemble name of characteristic property more closely
haftmann
parents: 42869
diff changeset
  4067
  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
  4068
  show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4069
  proof (cases "f x = neutral opp")
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4070
    case True
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4071
    show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4072
      unfolding iterate_def if_not_P[OF x] support_clauses if_P[OF True]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4073
      unfolding True monoidal_simps[OF assms(1)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4074
      by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4075
  next
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4076
    case False
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4077
    show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4078
      unfolding iterate_def fold'_def  if_not_P[OF x] support_clauses if_not_P[OF False]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4079
      apply (subst comp_fun_commute.fold_insert[OF * finite_support, simplified comp_def])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4080
      using `finite s`
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4081
      unfolding support_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4082
      using False x
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4083
      apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4084
      done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4085
  qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4086
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4087
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4088
lemma iterate_some:
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4089
  assumes "monoidal opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4090
    and "finite s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4091
  shows "iterate (lifted opp) s (\<lambda>x. Some(f x)) = Some (iterate opp s f)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4092
  using assms(2)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4093
proof (induct s)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4094
  case empty
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4095
  then show ?case
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4096
    using assms by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4097
next
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4098
  case (insert x F)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4099
  show ?case
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4100
    apply (subst iterate_insert)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4101
    prefer 3
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4102
    apply (subst if_not_P)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4103
    defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4104
    unfolding insert(3) lifted.simps
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4105
    apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4106
    using assms insert
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4107
    apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4108
    done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4109
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4110
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4111
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4112
subsection {* Two key instances of additivity. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4113
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4114
lemma neutral_add[simp]: "neutral op + = (0::'a::comm_monoid_add)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4115
  unfolding neutral_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4116
  apply (rule some_equality)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4117
  defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4118
  apply (erule_tac x=0 in allE)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4119
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4120
  done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4121
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  4122
lemma operative_content[intro]: "operative (op +) content"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4123
  unfolding operative_def neutral_add
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4124
  apply safe
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4125
  unfolding content_split[symmetric]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4126
  apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4127
  done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4128
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4129
lemma monoidal_monoid[intro]: "monoidal ((op +)::('a::comm_monoid_add) \<Rightarrow> 'a \<Rightarrow> 'a)"
53597
ea99a7964174 remove duplicate lemmas
huffman
parents: 53524
diff changeset
  4130
  unfolding monoidal_def neutral_add
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4131
  by (auto simp add: algebra_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4132
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4133
lemma operative_integral:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4134
  fixes f :: "'a::ordered_euclidean_space \<Rightarrow> 'b::banach"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4135
  shows "operative (lifted(op +)) (\<lambda>i. if f integrable_on i then Some(integral i f) else None)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4136
  unfolding operative_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4137
  unfolding neutral_lifted[OF monoidal_monoid] neutral_add
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4138
  apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4139
  apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4140
  apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4141
  apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4142
  defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4143
  apply (rule allI ballI)+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4144
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4145
  fix a b c
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4146
  fix k :: 'a
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4147
  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
  4148
  show "(if f integrable_on {a..b} then Some (integral {a..b} f) else None) =
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  4149
    lifted op + (if f integrable_on {a..b} \<inter> {x. x \<bullet> k \<le> c} then Some (integral ({a..b} \<inter> {x. x \<bullet> k \<le> c}) f) else None)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  4150
    (if f integrable_on {a..b} \<inter> {x. c \<le> x \<bullet> k} then Some (integral ({a..b} \<inter> {x. c \<le> x \<bullet> k}) f) else None)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4151
  proof (cases "f integrable_on {a..b}")
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4152
    case True
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4153
    show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4154
      unfolding if_P[OF True]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4155
      using k
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4156
      apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4157
      unfolding if_P[OF integrable_split(1)[OF True]]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4158
      unfolding if_P[OF integrable_split(2)[OF True]]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4159
      unfolding lifted.simps option.inject
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4160
      apply (rule integral_unique)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4161
      apply (rule has_integral_split[OF _ _ k])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4162
      apply (rule_tac[!] integrable_integral integrable_split)+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4163
      using True k
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4164
      apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4165
      done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4166
  next
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4167
    case False
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4168
    have "\<not> (f integrable_on {a..b} \<inter> {x. x \<bullet> k \<le> c}) \<or> \<not> ( f integrable_on {a..b} \<inter> {x. c \<le> x \<bullet> k})"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4169
    proof (rule ccontr)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4170
      assume "\<not> ?thesis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4171
      then have "f integrable_on {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4172
        apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4173
        unfolding integrable_on_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4174
        apply (rule_tac x="integral ({a..b} \<inter> {x. x \<bullet> k \<le> c}) f + integral ({a..b} \<inter> {x. x \<bullet> k \<ge> c}) f" in exI)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4175
        apply (rule has_integral_split[OF _ _ k])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4176
        apply (rule_tac[!] integrable_integral)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4177
        apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4178
        done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4179
      then show False
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4180
        using False by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4181
    qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4182
    then show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4183
      using False by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4184
  qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4185
next
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4186
  fix a b :: 'a
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4187
  assume as: "content {a..b} = 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4188
  then show "(if f integrable_on {a..b} then Some (integral {a..b} f) else None) = Some 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4189
    unfolding if_P[OF integrable_on_null[OF as]]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4190
    using has_integral_null_eq[OF as]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4191
    by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4192
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4193
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4194
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4195
subsection {* Points of division of a partition. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4196
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  4197
definition "division_points (k::('a::ordered_euclidean_space) set) d =
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4198
  {(j,x). j \<in> Basis \<and> (interval_lowerbound k)\<bullet>j < x \<and> x < (interval_upperbound k)\<bullet>j \<and>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4199
    (\<exists>i\<in>d. (interval_lowerbound i)\<bullet>j = x \<or> (interval_upperbound i)\<bullet>j = x)}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4200
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4201
lemma division_points_finite:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4202
  fixes i :: "'a::ordered_euclidean_space set"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4203
  assumes "d division_of i"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4204
  shows "finite (division_points i d)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4205
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4206
  note assm = division_ofD[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
  4207
  let ?M = "\<lambda>j. {(j,x)|x. (interval_lowerbound i)\<bullet>j < x \<and> x < (interval_upperbound i)\<bullet>j \<and>
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4208
    (\<exists>i\<in>d. (interval_lowerbound i)\<bullet>j = x \<or> (interval_upperbound i)\<bullet>j = x)}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4209
  have *: "division_points i d = \<Union>(?M ` Basis)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4210
    unfolding division_points_def by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4211
  show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4212
    unfolding * using assm by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4213
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4214
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4215
lemma division_points_subset:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4216
  fixes a :: "'a::ordered_euclidean_space"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4217
  assumes "d division_of {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4218
    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
  4219
    and k: "k \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4220
  shows "division_points ({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>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4221
      division_points ({a..b}) d" (is ?t1)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4222
    and "division_points ({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>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4223
      division_points ({a..b}) d" (is ?t2)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4224
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4225
  note assm = division_ofD[OF assms(1)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4226
  have *: "\<forall>i\<in>Basis. a\<bullet>i \<le> 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
  4227
    "\<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"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  4228
    "\<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
  4229
    "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
  4230
    using assms using less_imp_le 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
  4231
  show ?t1
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  4232
    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
  4233
    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
  4234
    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
  4235
    unfolding subset_eq
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4236
    apply rule
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
  4237
    unfolding mem_Collect_eq split_beta
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4238
    apply (erule bexE conjE)+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4239
    apply (simp only: mem_Collect_eq inner_setsum_left_Basis simp_thms)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4240
    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
  4241
  proof
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4242
    fix i l x
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4243
    assume as:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4244
      "a \<bullet> fst x < snd x" "snd x < (if fst x = k then c else b \<bullet> fst 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
  4245
      "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
  4246
      "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
  4247
      and fstx: "fst x \<in> Basis"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4248
    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
  4249
    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"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  4250
      using as(6) unfolding l interval_split[OF k] interval_ne_empty as .
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4251
    have **: "\<forall>i\<in>Basis. u\<bullet>i \<le> v\<bullet>i"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4252
      using l using as(6) unfolding interval_ne_empty[symmetric] 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
  4253
    show "\<exists>i\<in>d. interval_lowerbound i \<bullet> fst x = snd x \<or> interval_upperbound i \<bullet> fst x = snd 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
  4254
      apply (rule bexI[OF _ `l \<in> d`])
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  4255
      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
  4256
      unfolding l interval_bounds[OF **] interval_bounds[OF *] interval_split[OF k] as
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4257
      apply (auto split: split_if_asm)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4258
      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
  4259
    show "snd x < b \<bullet> fst 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
  4260
      using as(2) `c < b\<bullet>k` by (auto split: split_if_asm)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4261
  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
  4262
  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
  4263
    unfolding division_points_def interval_split[OF k, of a b]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4264
    unfolding interval_bounds[OF *(1)] interval_bounds[OF *(2)] interval_bounds[OF *(3)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4265
    unfolding *
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4266
    unfolding subset_eq
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4267
    apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4268
    unfolding mem_Collect_eq split_beta
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4269
    apply (erule bexE conjE)+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4270
    apply (simp only: mem_Collect_eq inner_setsum_left_Basis simp_thms)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4271
    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
  4272
  proof
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4273
    fix i l x
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4274
    assume as:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4275
      "(if fst x = k then c else a \<bullet> fst x) < snd x" "snd x < b \<bullet> fst x"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  4276
      "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
  4277
      "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
  4278
      and fstx: "fst x \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4279
    from assm(4)[OF this(5)] guess u v by (elim exE) note l=this
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4280
    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"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  4281
      using as(6) unfolding l interval_split[OF k] interval_ne_empty as .
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4282
    have **: "\<forall>i\<in>Basis. u\<bullet>i \<le> v\<bullet>i"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4283
      using l using as(6) unfolding interval_ne_empty[symmetric] 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
  4284
    show "\<exists>i\<in>d. interval_lowerbound i \<bullet> fst x = snd x \<or> interval_upperbound i \<bullet> fst x = snd 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
  4285
      apply (rule bexI[OF _ `l \<in> d`])
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  4286
      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
  4287
      unfolding l interval_bounds[OF **] interval_bounds[OF *] interval_split[OF k] as
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4288
      apply (auto split: split_if_asm)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4289
      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
  4290
    show "a \<bullet> fst x < snd 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
  4291
      using as(1) `a\<bullet>k < c` by (auto split: split_if_asm)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  4292
   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
  4293
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
  4294
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4295
lemma division_points_psubset:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4296
  fixes a :: "'a::ordered_euclidean_space"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4297
  assumes "d division_of {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4298
    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
  4299
    and "l \<in> d"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4300
    and "interval_lowerbound l\<bullet>k = c \<or> interval_upperbound l\<bullet>k = c"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4301
    and k: "k \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4302
  shows "division_points ({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>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4303
      division_points ({a..b}) d" (is "?D1 \<subset> ?D")
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4304
    and "division_points ({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>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4305
      division_points ({a..b}) d" (is "?D2 \<subset> ?D")
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4306
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4307
  have ab: "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4308
    using assms(2) by (auto intro!:less_imp_le)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4309
  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
  4310
  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"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  4311
    using division_ofD(2,2,3)[OF assms(1,5)] unfolding l interval_ne_empty
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4312
    unfolding subset_eq
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4313
    apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4314
    defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4315
    apply (erule_tac x=u in ballE)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4316
    apply (erule_tac x=v in ballE)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4317
    unfolding mem_interval
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4318
    apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4319
    done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4320
  have *: "interval_upperbound ({a..b} \<inter> {x. x \<bullet> k \<le> interval_upperbound l \<bullet> k}) \<bullet> k = interval_upperbound l \<bullet> k"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4321
    "interval_upperbound ({a..b} \<inter> {x. x \<bullet> k \<le> interval_lowerbound l \<bullet> k}) \<bullet> k = interval_lowerbound l \<bullet> k"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4322
    unfolding interval_split[OF k]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4323
    apply (subst interval_bounds)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4324
    prefer 3
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4325
    apply (subst interval_bounds)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4326
    unfolding l interval_bounds[OF uv(1)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4327
    using uv[rule_format,of k] ab k
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4328
    apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4329
    done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4330
  have "\<exists>x. x \<in> ?D - ?D1"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4331
    using assms(2-)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4332
    apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4333
    apply (erule disjE)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4334
    apply (rule_tac x="(k,(interval_lowerbound l)\<bullet>k)" in exI)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4335
    defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4336
    apply (rule_tac x="(k,(interval_upperbound l)\<bullet>k)" in exI)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4337
    unfolding division_points_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4338
    unfolding interval_bounds[OF ab]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4339
    apply (auto simp add:*)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4340
    done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4341
  then show "?D1 \<subset> ?D"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4342
    apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4343
    apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4344
    apply (rule division_points_subset[OF assms(1-4)])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4345
    using k
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4346
    apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4347
    done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4348
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4349
  have *: "interval_lowerbound ({a..b} \<inter> {x. x \<bullet> k \<ge> interval_lowerbound l \<bullet> k}) \<bullet> k = interval_lowerbound l \<bullet> k"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4350
    "interval_lowerbound ({a..b} \<inter> {x. x \<bullet> k \<ge> interval_upperbound l \<bullet> k}) \<bullet> k = interval_upperbound l \<bullet> k"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4351
    unfolding interval_split[OF k]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4352
    apply (subst interval_bounds)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4353
    prefer 3
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4354
    apply (subst interval_bounds)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4355
    unfolding l interval_bounds[OF uv(1)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4356
    using uv[rule_format,of k] ab k
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4357
    apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4358
    done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4359
  have "\<exists>x. x \<in> ?D - ?D2"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4360
    using assms(2-)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4361
    apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4362
    apply (erule disjE)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4363
    apply (rule_tac x="(k,(interval_lowerbound l)\<bullet>k)" in exI)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4364
    defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4365
    apply (rule_tac x="(k,(interval_upperbound l)\<bullet>k)" in exI)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4366
    unfolding division_points_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4367
    unfolding interval_bounds[OF ab]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4368
    apply (auto simp add:*)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4369
    done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4370
  then show "?D2 \<subset> ?D"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4371
    apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4372
    apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4373
    apply (rule division_points_subset[OF assms(1-4) k])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4374
    apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4375
    done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4376
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4377
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4378
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4379
subsection {* Preservation by divisions and tagged divisions. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4380
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4381
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
  4382
  unfolding support_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4383
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4384
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
  4385
  unfolding iterate_def support_support by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4386
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4387
lemma iterate_expand_cases:
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4388
  "iterate opp s f = (if finite(support opp f s) then iterate opp (support opp f s) f else neutral opp)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4389
  apply cases
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4390
  apply (subst if_P, assumption)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4391
  unfolding iterate_def support_support fold'_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4392
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4393
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4394
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4395
lemma iterate_image:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4396
  assumes "monoidal opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4397
    and "inj_on f s"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4398
  shows "iterate opp (f ` s) g = iterate opp s (g \<circ> f)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4399
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4400
  have *: "\<And>s. finite s \<Longrightarrow>  \<forall>x\<in>s. \<forall>y\<in>s. f x = f y \<longrightarrow> x = y \<Longrightarrow>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4401
    iterate opp (f ` s) g = iterate opp s (g \<circ> f)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4402
  proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4403
    case goal1
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4404
    then show ?case
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4405
    proof (induct s)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4406
      case empty
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4407
      then show ?case
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4408
        using assms(1) by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4409
    next
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4410
      case (insert x s)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4411
      show ?case
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4412
        unfolding iterate_insert[OF assms(1) insert(1)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4413
        unfolding if_not_P[OF insert(2)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4414
        apply (subst insert(3)[symmetric])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4415
        unfolding image_insert
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4416
        defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4417
        apply (subst iterate_insert[OF assms(1)])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4418
        apply (rule finite_imageI insert)+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4419
        apply (subst if_not_P)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4420
        unfolding image_iff o_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4421
        using insert(2,4)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4422
        apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4423
        done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4424
    qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4425
  qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  4426
  show ?thesis
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4427
    apply (cases "finite (support opp g (f ` s))")
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4428
    apply (subst (1) iterate_support[symmetric],subst (2) iterate_support[symmetric])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4429
    unfolding support_clauses
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4430
    apply (rule *)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4431
    apply (rule finite_imageD,assumption)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4432
    unfolding inj_on_def[symmetric]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4433
    apply (rule subset_inj_on[OF assms(2) support_subset])+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4434
    apply (subst iterate_expand_cases)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4435
    unfolding support_clauses
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4436
    apply (simp only: if_False)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4437
    apply (subst iterate_expand_cases)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4438
    apply (subst if_not_P)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4439
    apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4440
    done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4441
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4442
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4443
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4444
(* This lemma about iterations comes up in a few places. *)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4445
lemma iterate_nonzero_image_lemma:
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4446
  assumes "monoidal opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4447
    and "finite s" "g(a) = neutral opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4448
    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
  4449
  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
  4450
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4451
  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
  4452
    by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4453
  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
  4454
    unfolding support_def using assms(3) by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4455
  show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4456
    unfolding *
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4457
    apply (subst iterate_support[symmetric])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4458
    unfolding support_clauses
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4459
    apply (subst iterate_image[OF assms(1)])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4460
    defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4461
    apply (subst(2) iterate_support[symmetric])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4462
    apply (subst **)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4463
    unfolding inj_on_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4464
    using assms(3,4)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4465
    unfolding support_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4466
    apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4467
    done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4468
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4469
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4470
lemma iterate_eq_neutral:
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4471
  assumes "monoidal opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4472
    and "\<forall>x \<in> s. f x = neutral opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4473
  shows "iterate opp s f = neutral opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4474
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4475
  have *: "support opp f s = {}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4476
    unfolding support_def using assms(2) by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4477
  show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4478
    apply (subst iterate_support[symmetric])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4479
    unfolding *
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4480
    using assms(1)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4481
    apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4482
    done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4483
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4484
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4485
lemma iterate_op:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4486
  assumes "monoidal opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4487
    and "finite s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4488
  shows "iterate opp s (\<lambda>x. opp (f x) (g x)) = opp (iterate opp s f) (iterate opp s g)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4489
  using assms(2)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4490
proof (induct s)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4491
  case empty
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4492
  then show ?case
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4493
    unfolding iterate_insert[OF assms(1)] using assms(1) by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4494
next
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4495
  case (insert x F)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4496
  show ?case
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4497
    unfolding iterate_insert[OF assms(1) insert(1)] if_not_P[OF insert(2)] insert(3)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4498
    by (simp add: monoidal_ac[OF assms(1)])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4499
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4500
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4501
lemma iterate_eq:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4502
  assumes "monoidal opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4503
    and "\<And>x. x \<in> s \<Longrightarrow> f x = g x"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4504
  shows "iterate opp s f = iterate opp s g"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4505
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4506
  have *: "support opp g s = support opp f s"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4507
    unfolding support_def using assms(2) by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4508
  show ?thesis
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4509
  proof (cases "finite (support opp f s)")
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4510
    case False
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4511
    then show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4512
      apply (subst iterate_expand_cases)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4513
      apply (subst(2) iterate_expand_cases)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4514
      unfolding *
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4515
      apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4516
      done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4517
  next
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4518
    def su \<equiv> "support opp f s"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  4519
    case True note support_subset[of opp f s]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4520
    then show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4521
      apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4522
      apply (subst iterate_support[symmetric])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4523
      apply (subst(2) iterate_support[symmetric])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4524
      unfolding *
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4525
      using True
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4526
      unfolding su_def[symmetric]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4527
    proof (induct su)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4528
      case empty
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4529
      show ?case by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4530
    next
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4531
      case (insert x s)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4532
      show ?case
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4533
        unfolding iterate_insert[OF assms(1) insert(1)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4534
        unfolding if_not_P[OF insert(2)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4535
        apply (subst insert(3))
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4536
        defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4537
        apply (subst assms(2)[of x])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4538
        using insert
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4539
        apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4540
        done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4541
    qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4542
  qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4543
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4544
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4545
lemma nonempty_witness:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4546
  assumes "s \<noteq> {}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4547
  obtains x where "x \<in> s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4548
  using assms by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4549
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4550
lemma operative_division:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4551
  fixes f :: "'a::ordered_euclidean_space set \<Rightarrow> 'b"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4552
  assumes "monoidal opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4553
    and "operative opp f"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4554
    and "d division_of {a..b}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4555
  shows "iterate opp d f = f {a..b}"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4556
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4557
  def C \<equiv> "card (division_points {a..b} d)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4558
  then show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4559
    using assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4560
  proof (induct C arbitrary: a b d rule: full_nat_induct)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4561
    case goal1
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4562
    { presume *: "content {a..b} \<noteq> 0 \<Longrightarrow> ?case"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4563
      then show ?case
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4564
        apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4565
        apply cases
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4566
        defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4567
        apply assumption
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4568
      proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4569
        assume as: "content {a..b} = 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4570
        show ?case
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4571
          unfolding operativeD(1)[OF assms(2) as]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4572
          apply(rule iterate_eq_neutral[OF goal1(2)])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4573
        proof
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4574
          fix x
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4575
          assume x: "x \<in> d"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4576
          then guess u v
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4577
            apply (drule_tac division_ofD(4)[OF goal1(4)])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4578
            apply (elim exE)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4579
            done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4580
          then show "f x = neutral opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4581
            using division_of_content_0[OF as goal1(4)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4582
            using operativeD(1)[OF assms(2)] x
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4583
            by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4584
        qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4585
      qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4586
    }
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  4587
    assume "content {a..b} \<noteq> 0" note ab = this[unfolded content_lt_nz[symmetric] content_pos_lt_eq]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4588
    then have ab': "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4589
      by (auto intro!: less_imp_le)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4590
    show ?case
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4591
    proof (cases "division_points {a..b} d = {}")
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4592
      case True
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4593
      have d': "\<forall>i\<in>d. \<exists>u v. i = {u..v} \<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
  4594
        (\<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)"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4595
        unfolding forall_in_division[OF goal1(4)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4596
        apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4597
        apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4598
        apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4599
        apply (rule_tac x=a in exI)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4600
        apply (rule_tac x=b in exI)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4601
        apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4602
        apply (rule refl)
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
  4603
      proof
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4604
        fix u v
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4605
        fix j :: 'a
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4606
        assume j: "j \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4607
        assume as: "{u..v} \<in> d"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4608
        note division_ofD(3)[OF goal1(4) this]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4609
        then have uv: "\<forall>i\<in>Basis. u\<bullet>i \<le> v\<bullet>i" "u\<bullet>j \<le> v\<bullet>j"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4610
          using j unfolding interval_ne_empty by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4611
        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 {u..v}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4612
          using as j 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
  4613
        have "(j, u\<bullet>j) \<notin> division_points {a..b} d"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  4614
          "(j, v\<bullet>j) \<notin> division_points {a..b} d" using True by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4615
        note this[unfolded de_Morgan_conj division_points_def mem_Collect_eq split_conv interval_bounds[OF ab'] bex_simps]
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4616
        note *[OF this(1)] *[OF this(2)] note this[unfolded interval_bounds[OF uv(1)]]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4617
        moreover
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4618
        have "a\<bullet>j \<le> u\<bullet>j" "v\<bullet>j \<le> b\<bullet>j"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4619
          using division_ofD(2,2,3)[OF goal1(4) as]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4620
          unfolding subset_eq
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4621
          apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4622
          apply (erule_tac x=u in ballE,erule_tac[3] x=v in ballE)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4623
          unfolding interval_ne_empty mem_interval
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4624
          using j
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4625
          apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4626
          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
  4627
        ultimately show "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"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  4628
          unfolding not_less de_Morgan_disj using ab[rule_format,of j] uv(2) j 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
  4629
      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
  4630
      have "(1/2) *\<^sub>R (a+b) \<in> {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
  4631
        unfolding mem_interval using ab by(auto intro!: less_imp_le simp: inner_simps)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  4632
      note this[unfolded division_ofD(6)[OF goal1(4),symmetric] Union_iff]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4633
      then guess i .. note i=this
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4634
      guess u v using d'[rule_format,OF i(1)] by (elim exE conjE) note uv=this
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4635
      have "{a..b} \<in> d"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4636
      proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4637
        { presume "i = {a..b}" then show ?thesis using i by auto }
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4638
        { presume "u = a" "v = b" then show "i = {a..b}" using uv by auto }
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4639
        show "u = a" "v = b"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4640
          unfolding euclidean_eq_iff[where 'a='a]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4641
        proof safe
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4642
          fix j :: 'a
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4643
          assume j: "j \<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
  4644
          note i(2)[unfolded uv mem_interval,rule_format,of j]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4645
          then show "u \<bullet> j = a \<bullet> j" and "v \<bullet> j = b \<bullet> j"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4646
            using uv(2)[rule_format,of j] j by (auto simp: inner_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4647
        qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4648
      qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4649
      then have *: "d = insert {a..b} (d - {{a..b}})"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4650
        by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4651
      have "iterate opp (d - {{a..b}}) f = neutral opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4652
        apply (rule iterate_eq_neutral[OF goal1(2)])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4653
      proof
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4654
        fix x
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4655
        assume x: "x \<in> d - {{a..b}}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4656
        then have "x\<in>d"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4657
          by auto note d'[rule_format,OF this]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4658
        then guess u v by (elim exE conjE) note uv=this
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4659
        have "u \<noteq> a \<or> v \<noteq> b"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4660
          using x[unfolded uv] by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4661
        then obtain j where "u\<bullet>j \<noteq> a\<bullet>j \<or> v\<bullet>j \<noteq> b\<bullet>j" and j: "j \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4662
          unfolding euclidean_eq_iff[where 'a='a] by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4663
        then have "u\<bullet>j = v\<bullet>j"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4664
          using uv(2)[rule_format,OF j] by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4665
        then have "content {u..v} = 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4666
          unfolding content_eq_0
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4667
          apply (rule_tac x=j in bexI)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4668
          using j
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4669
          apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4670
          done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4671
        then show "f x = neutral opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4672
          unfolding uv(1) by (rule operativeD(1)[OF goal1(3)])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4673
      qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4674
      then show "iterate opp d f = f {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4675
        apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4676
        apply (subst *)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4677
        apply (subst iterate_insert[OF goal1(2)])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4678
        using goal1(2,4)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4679
        apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4680
        done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4681
    next
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4682
      case False
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4683
      then have "\<exists>x. x \<in> division_points {a..b} d"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4684
        by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4685
      then guess k c
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4686
        unfolding split_paired_Ex
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4687
        unfolding division_points_def mem_Collect_eq split_conv
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4688
        apply (elim exE conjE)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4689
        done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4690
      note this(2-4,1) note kc=this[unfolded interval_bounds[OF ab']]
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4691
      from this(3) guess j .. note j=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
  4692
      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> {}}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  4693
      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> {}}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  4694
      def cb \<equiv> "(\<Sum>i\<in>Basis. (if i = k then 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
  4695
      def ca \<equiv> "(\<Sum>i\<in>Basis. (if i = k then c else a\<bullet>i) *\<^sub>R i)::'a"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4696
      note division_points_psubset[OF goal1(4) ab kc(1-2) j]
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4697
      note psubset_card_mono[OF _ this(1)] psubset_card_mono[OF _ this(2)]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4698
      then have *: "(iterate opp d1 f) = f ({a..b} \<inter> {x. x\<bullet>k \<le> c})"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4699
        "(iterate opp d2 f) = f ({a..b} \<inter> {x. x\<bullet>k \<ge> c})"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4700
        unfolding interval_split[OF kc(4)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4701
        apply (rule_tac[!] goal1(1)[rule_format])
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4702
        using division_split[OF goal1(4), where k=k and c=c]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4703
        unfolding interval_split[OF kc(4)] d1_def[symmetric] d2_def[symmetric]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4704
        unfolding goal1(2) Suc_le_mono
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4705
        using goal1(2-3)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4706
        using division_points_finite[OF goal1(4)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4707
        using kc(4)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4708
        apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4709
        done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4710
      have "f {a..b} = opp (iterate opp d1 f) (iterate opp d2 f)" (is "_ = ?prev")
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4711
        unfolding *
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4712
        apply (rule operativeD(2))
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4713
        using goal1(3)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4714
        using kc(4)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4715
        apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4716
        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
  4717
      also have "iterate opp d1 f = iterate opp d (\<lambda>l. f(l \<inter> {x. x\<bullet>k \<le> c}))"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4718
        unfolding d1_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4719
        apply (rule iterate_nonzero_image_lemma[unfolded o_def])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4720
        unfolding empty_as_interval
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4721
        apply (rule goal1 division_of_finite operativeD[OF goal1(3)])+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4722
        unfolding empty_as_interval[symmetric]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4723
        apply (rule content_empty)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4724
      proof (rule, rule, rule, erule conjE)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4725
        fix l y
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4726
        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"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4727
        from division_ofD(4)[OF goal1(4) this(1)] guess u v by (elim exE) note l=this
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4728
        show "f (l \<inter> {x. x \<bullet> k \<le> c}) = neutral opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4729
          unfolding l interval_split[OF kc(4)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4730
          apply (rule operativeD(1) goal1)+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4731
          unfolding interval_split[symmetric,OF kc(4)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4732
          apply (rule division_split_left_inj)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4733
          apply (rule goal1)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4734
          unfolding l[symmetric]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4735
          apply (rule as(1), rule as(2))
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4736
          apply (rule kc(4) as)+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4737
          done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4738
      qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4739
      also have "iterate opp d2 f = iterate opp d (\<lambda>l. f(l \<inter> {x. x\<bullet>k \<ge> c}))"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4740
        unfolding d2_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4741
        apply (rule iterate_nonzero_image_lemma[unfolded o_def])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4742
        unfolding empty_as_interval
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4743
        apply (rule goal1 division_of_finite operativeD[OF goal1(3)])+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4744
        unfolding empty_as_interval[symmetric]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4745
        apply (rule content_empty)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4746
      proof (rule, rule, rule, erule conjE)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4747
        fix l y
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4748
        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"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4749
        from division_ofD(4)[OF goal1(4) this(1)] guess u v by (elim exE) note l=this
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4750
        show "f (l \<inter> {x. x \<bullet> k \<ge> c}) = neutral opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4751
        unfolding l interval_split[OF kc(4)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4752
          apply (rule operativeD(1) goal1)+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4753
          unfolding interval_split[symmetric,OF kc(4)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4754
          apply (rule division_split_right_inj)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4755
          apply (rule goal1)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4756
          unfolding l[symmetric]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4757
          apply (rule as(1))
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4758
          apply (rule as(2))
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4759
          apply (rule as kc(4))+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4760
          done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4761
      qed 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}))"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4762
        unfolding forall_in_division[OF goal1(4)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4763
        apply (rule, rule, rule, rule operativeD(2))
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4764
        using goal1(3) kc
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4765
        by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4766
      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}))) =
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4767
        iterate opp d f"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4768
        apply (subst(3) iterate_eq[OF _ *[rule_format]])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4769
        prefer 3
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4770
        apply (rule iterate_op[symmetric])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4771
        using goal1
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4772
        apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4773
        done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4774
      finally show ?thesis by auto
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4775
    qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4776
  qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4777
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4778
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4779
lemma iterate_image_nonzero:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4780
  assumes "monoidal opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4781
    and "finite s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4782
    and "\<forall>x\<in>s. \<forall>y\<in>s. x \<noteq> y \<and> f x = f y \<longrightarrow> g (f x) = neutral opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4783
  shows "iterate opp (f ` s) g = iterate opp s (g \<circ> f)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4784
  using assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4785
proof (induct rule: finite_subset_induct[OF assms(2) subset_refl])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4786
  case goal1
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4787
  show ?case
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4788
    using assms(1) by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4789
next
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4790
  case goal2
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4791
  have *: "\<And>x y. y = neutral opp \<Longrightarrow> x = opp y x"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4792
    using assms(1) by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4793
  show ?case
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4794
    unfolding image_insert
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4795
    apply (subst iterate_insert[OF assms(1)])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4796
    apply (rule finite_imageI goal2)+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4797
    apply (cases "f a \<in> f ` F")
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4798
    unfolding if_P if_not_P
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4799
    apply (subst goal2(4)[OF assms(1) goal2(1)])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4800
    defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4801
    apply (subst iterate_insert[OF assms(1) goal2(1)])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4802
    defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4803
    apply (subst iterate_insert[OF assms(1) goal2(1)])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4804
    unfolding if_not_P[OF goal2(3)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4805
    defer unfolding image_iff
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4806
    defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4807
    apply (erule bexE)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4808
    apply (rule *)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4809
    unfolding o_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4810
    apply (rule_tac y=x in goal2(7)[rule_format])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4811
    using goal2
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4812
    unfolding o_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4813
    apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4814
    done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4815
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4816
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4817
lemma operative_tagged_division:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4818
  assumes "monoidal opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4819
    and "operative opp f"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4820
    and "d tagged_division_of {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4821
  shows "iterate opp d (\<lambda>(x,l). f l) = f {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4822
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4823
  have *: "(\<lambda>(x,l). f l) = f \<circ> snd"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4824
    unfolding o_def by rule auto note assm = tagged_division_ofD[OF assms(3)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4825
  have "iterate opp d (\<lambda>(x,l). f l) = iterate opp (snd ` d) f"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4826
    unfolding *
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4827
    apply (rule iterate_image_nonzero[symmetric,OF assms(1)])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4828
    apply (rule tagged_division_of_finite assms)+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4829
    unfolding Ball_def split_paired_All snd_conv
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4830
    apply (rule, rule, rule, rule, rule, rule, rule, erule conjE)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4831
  proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4832
    fix a b aa ba
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4833
    assume as: "(a, b) \<in> d" "(aa, ba) \<in> d" "(a, b) \<noteq> (aa, ba)" "b = ba"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4834
    guess u v using assm(4)[OF as(1)] by (elim exE) note uv=this
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4835
    show "f b = neutral opp"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4836
      unfolding uv
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4837
      apply (rule operativeD(1)[OF assms(2)])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4838
      unfolding content_eq_0_interior
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4839
      using tagged_division_ofD(5)[OF assms(3) as(1-3)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4840
      unfolding as(4)[symmetric] uv
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4841
      apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4842
      done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4843
  qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4844
  also have "\<dots> = f {a..b}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4845
    using operative_division[OF assms(1-2) division_of_tagged_division[OF assms(3)]] .
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4846
  finally show ?thesis .
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4847
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4848
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4849
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4850
subsection {* Additivity of content. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4851
51489
f738e6dbd844 fundamental revision of big operators on sets
haftmann
parents: 51475
diff changeset
  4852
lemma setsum_iterate:
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4853
  assumes "finite s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4854
  shows "setsum f s = iterate op + s f"
51489
f738e6dbd844 fundamental revision of big operators on sets
haftmann
parents: 51475
diff changeset
  4855
proof -
f738e6dbd844 fundamental revision of big operators on sets
haftmann
parents: 51475
diff changeset
  4856
  have *: "setsum f s = setsum f (support op + f s)"
f738e6dbd844 fundamental revision of big operators on sets
haftmann
parents: 51475
diff changeset
  4857
    apply (rule setsum_mono_zero_right)
53597
ea99a7964174 remove duplicate lemmas
huffman
parents: 53524
diff changeset
  4858
    unfolding support_def neutral_add
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4859
    using assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4860
    apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4861
    done
51489
f738e6dbd844 fundamental revision of big operators on sets
haftmann
parents: 51475
diff changeset
  4862
  then show ?thesis unfolding * iterate_def fold'_def setsum.eq_fold
53597
ea99a7964174 remove duplicate lemmas
huffman
parents: 53524
diff changeset
  4863
    unfolding neutral_add by (simp add: comp_def)
51489
f738e6dbd844 fundamental revision of big operators on sets
haftmann
parents: 51475
diff changeset
  4864
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4865
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4866
lemma additive_content_division:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4867
  assumes "d division_of {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4868
  shows "setsum content d = content {a..b}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  4869
  unfolding operative_division[OF monoidal_monoid operative_content assms,symmetric]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4870
  apply (subst setsum_iterate)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4871
  using assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4872
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4873
  done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4874
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4875
lemma additive_content_tagged_division:
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4876
  assumes "d tagged_division_of {a..b}"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4877
  shows "setsum (\<lambda>(x,l). content l) d = content {a..b}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  4878
  unfolding operative_tagged_division[OF monoidal_monoid operative_content assms,symmetric]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4879
  apply (subst setsum_iterate)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4880
  using assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4881
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4882
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4883
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4884
36334
068a01b4bc56 document generation for Multivariate_Analysis
huffman
parents: 36318
diff changeset
  4885
subsection {* Finally, the integral of a constant *}
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4886
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4887
lemma has_integral_const[intro]:
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4888
  fixes a b :: "'a::ordered_euclidean_space"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4889
  shows "((\<lambda>x. c) has_integral (content {a..b} *\<^sub>R c)) {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4890
  unfolding has_integral
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4891
  apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4892
  apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4893
  apply (rule_tac x="\<lambda>x. ball x 1" in exI)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4894
  apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4895
  apply (rule gauge_trivial)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4896
  apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4897
  apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4898
  apply (erule conjE)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4899
  unfolding split_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4900
  apply (subst scaleR_left.setsum[symmetric, unfolded o_def])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4901
  defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4902
  apply (subst additive_content_tagged_division[unfolded split_def])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4903
  apply assumption
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4904
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4905
  done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4906
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  4907
lemma integral_const[simp]:
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  4908
  fixes a b :: "'a::ordered_euclidean_space"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  4909
  shows "integral {a .. b} (\<lambda>x. c) = content {a .. b} *\<^sub>R c"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  4910
  by (rule integral_unique) (rule has_integral_const)
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 49996
diff changeset
  4911
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4912
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4913
subsection {* Bounds on the norm of Riemann sums and the integral itself. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4914
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4915
lemma dsum_bound:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4916
  assumes "p division_of {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4917
    and "norm c \<le> e"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4918
  shows "norm (setsum (\<lambda>l. content l *\<^sub>R c) p) \<le> e * content({a..b})"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4919
  apply (rule order_trans)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4920
  apply (rule norm_setsum)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4921
  unfolding norm_scaleR setsum_left_distrib[symmetric]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4922
  apply (rule order_trans[OF mult_left_mono])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4923
  apply (rule assms)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4924
  apply (rule setsum_abs_ge_zero)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4925
  apply (subst mult_commute)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4926
  apply (rule mult_left_mono)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4927
  apply (rule order_trans[of _ "setsum content p"])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4928
  apply (rule eq_refl)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4929
  apply (rule setsum_cong2)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4930
  apply (subst abs_of_nonneg)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4931
  unfolding additive_content_division[OF assms(1)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4932
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4933
  from order_trans[OF norm_ge_zero[of c] assms(2)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4934
  show "0 \<le> e" .
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4935
  fix x assume "x \<in> p"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4936
  from division_ofD(4)[OF assms(1) this] guess u v by (elim exE)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4937
  then show "0 \<le> content x"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4938
    using content_pos_le by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4939
qed (insert assms, auto)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4940
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4941
lemma rsum_bound:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4942
  assumes "p tagged_division_of {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4943
    and "\<forall>x\<in>{a..b}. norm (f x) \<le> e"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4944
  shows "norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p) \<le> e * content {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4945
proof (cases "{a..b} = {}")
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4946
  case True
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4947
  show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4948
    using assms(1) unfolding True tagged_division_of_trivial by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4949
next
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4950
  case False
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4951
  show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4952
    apply (rule order_trans)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4953
    apply (rule norm_setsum)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4954
    unfolding split_def norm_scaleR
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4955
    apply (rule order_trans[OF setsum_mono])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4956
    apply (rule mult_left_mono[OF _ abs_ge_zero, of _ e])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4957
    defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4958
    unfolding setsum_left_distrib[symmetric]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4959
    apply (subst mult_commute)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4960
    apply (rule mult_left_mono)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4961
    apply (rule order_trans[of _ "setsum (content \<circ> snd) p"])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4962
    apply (rule eq_refl)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4963
    apply (rule setsum_cong2)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4964
    apply (subst o_def)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4965
    apply (rule abs_of_nonneg)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4966
  proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4967
    show "setsum (content \<circ> snd) p \<le> content {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4968
      apply (rule eq_refl)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4969
      unfolding additive_content_tagged_division[OF assms(1),symmetric] split_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4970
      apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4971
      done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4972
    guess w using nonempty_witness[OF False] .
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4973
    then show "e \<ge> 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4974
      apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4975
      apply (rule order_trans)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4976
      defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4977
      apply (rule assms(2)[rule_format])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4978
      apply assumption
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4979
      apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4980
      done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4981
    fix xk
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4982
    assume *: "xk \<in> p"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4983
    guess x k using surj_pair[of xk] by (elim exE) note xk = this *[unfolded this]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4984
    from tagged_division_ofD(4)[OF assms(1) xk(2)] guess u v by (elim exE) note uv=this
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4985
    show "0 \<le> content (snd xk)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4986
      unfolding xk snd_conv uv by(rule content_pos_le)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4987
    show "norm (f (fst xk)) \<le> e"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4988
      unfolding xk fst_conv using tagged_division_ofD(2,3)[OF assms(1) xk(2)] assms(2) by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4989
  qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4990
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4991
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  4992
lemma rsum_diff_bound:
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4993
  assumes "p tagged_division_of {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4994
    and "\<forall>x\<in>{a..b}. norm (f x - g x) \<le> e"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4995
  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>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4996
    e * content {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4997
  apply (rule order_trans[OF _ rsum_bound[OF assms]])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4998
  apply (rule eq_refl)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  4999
  apply (rule arg_cong[where f=norm])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5000
  unfolding setsum_subtractf[symmetric]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5001
  apply (rule setsum_cong2)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5002
  unfolding scaleR_diff_right
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5003
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5004
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5005
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5006
lemma has_integral_bound:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5007
  fixes f :: "'a::ordered_euclidean_space \<Rightarrow> 'b::real_normed_vector"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5008
  assumes "0 \<le> B"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5009
    and "(f has_integral i) {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5010
    and "\<forall>x\<in>{a..b}. norm (f x) \<le> B"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5011
  shows "norm i \<le> B * content {a..b}"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5012
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5013
  let ?P = "content {a..b} > 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5014
  {
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5015
    presume "?P \<Longrightarrow> ?thesis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5016
    then show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5017
    proof (cases ?P)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5018
      case False
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5019
      then have *: "content {a..b} = 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5020
        using content_lt_nz by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5021
      hence **: "i = 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5022
        using assms(2)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5023
        apply (subst has_integral_null_eq[symmetric])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5024
        apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5025
        done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5026
      show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5027
        unfolding * ** using assms(1) by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5028
    qed auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5029
  }
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5030
  assume ab: ?P
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5031
  { presume "\<not> ?thesis \<Longrightarrow> False" then show ?thesis by auto }
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5032
  assume "\<not> ?thesis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5033
  then have *: "norm i - B * content {a..b} > 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5034
    by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5035
  from assms(2)[unfolded has_integral,rule_format,OF *]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5036
  guess d by (elim exE conjE) note d=this[rule_format]
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5037
  from fine_division_exists[OF this(1), of a b] guess p . note p=this
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5038
  have *: "\<And>s B. norm s \<le> B \<Longrightarrow> \<not> norm (s - i) < norm i - B"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5039
  proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5040
    case goal1
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5041
    then show ?case
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5042
      unfolding not_less
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5043
      using norm_triangle_sub[of i s]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5044
      unfolding norm_minus_commute
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5045
      by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5046
  qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5047
  show False
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5048
    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
  5049
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5050
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5051
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5052
subsection {* Similar theorems about relationship among components. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5053
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5054
lemma rsum_component_le:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5055
  fixes f :: "'a::ordered_euclidean_space \<Rightarrow> 'b::euclidean_space"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5056
  assumes "p tagged_division_of {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5057
    and "\<forall>x\<in>{a..b}. (f x)\<bullet>i \<le> (g x)\<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
  5058
  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"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5059
  unfolding inner_setsum_left
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5060
  apply (rule setsum_mono)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5061
  apply safe
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5062
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5063
  fix a b
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5064
  assume ab: "(a, b) \<in> p"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5065
  note assm = tagged_division_ofD(2-4)[OF assms(1) ab]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5066
  from this(3) guess u v by (elim exE) note b=this
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5067
  show "(content b *\<^sub>R f a) \<bullet> i \<le> (content b *\<^sub>R g a) \<bullet> i"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5068
    unfolding b
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5069
    unfolding inner_simps real_scaleR_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5070
    apply (rule mult_left_mono)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5071
    defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5072
    apply (rule content_pos_le,rule assms(2)[rule_format])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5073
    using assm
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5074
    apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5075
    done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5076
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5077
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
  5078
lemma has_integral_component_le:
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5079
  fixes f g :: "'a::ordered_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
  5080
  assumes k: "k \<in> Basis"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5081
  assumes "(f has_integral i) s" "(g has_integral j) s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5082
    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
  5083
  shows "i\<bullet>k \<le> j\<bullet>k"
50348
4b4fe0d5ee22 remove SMT proofs in Multivariate_Analysis
hoelzl
parents: 50252
diff changeset
  5084
proof -
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  5085
  have lem:"\<And>a b i (j::'b). \<And>g f::'a \<Rightarrow> 'b. (f has_integral i) ({a..b}) \<Longrightarrow>
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
  5086
    (g has_integral j) ({a..b}) \<Longrightarrow> \<forall>x\<in>{a..b}. (f x)\<bullet>k \<le> (g x)\<bullet>k \<Longrightarrow> i\<bullet>k \<le> j\<bullet>k"
50348
4b4fe0d5ee22 remove SMT proofs in Multivariate_Analysis
hoelzl
parents: 50252
diff changeset
  5087
  proof (rule ccontr)
4b4fe0d5ee22 remove SMT proofs in Multivariate_Analysis
hoelzl
parents: 50252
diff changeset
  5088
    case goal1
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5089
    then have *: "0 < (i\<bullet>k - j\<bullet>k) / 3"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5090
      by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5091
    guess d1 using goal1(1)[unfolded has_integral,rule_format,OF *] by (elim exE conjE) note d1=this[rule_format]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5092
    guess d2 using goal1(2)[unfolded has_integral,rule_format,OF *] by (elim exE conjE) note d2=this[rule_format]
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5093
    guess p using fine_division_exists[OF gauge_inter[OF d1(1) d2(1)], of a b] unfolding fine_inter .
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
  5094
    note p = this(1) conjunctD2[OF 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
  5095
    note le_less_trans[OF Basis_le_norm[OF k]]
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5096
    note this[OF d1(2)[OF conjI[OF p(1,2)]]] this[OF d2(2)[OF conjI[OF p(1,3)]]]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5097
    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
  5098
      unfolding inner_simps
50348
4b4fe0d5ee22 remove SMT proofs in Multivariate_Analysis
hoelzl
parents: 50252
diff changeset
  5099
      using rsum_component_le[OF p(1) goal1(3)]
4b4fe0d5ee22 remove SMT proofs in Multivariate_Analysis
hoelzl
parents: 50252
diff changeset
  5100
      by (simp add: abs_real_def split: split_if_asm)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5101
  qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5102
  let ?P = "\<exists>a b. s = {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5103
  {
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5104
    presume "\<not> ?P \<Longrightarrow> ?thesis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5105
    then show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5106
    proof (cases ?P)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5107
      case True
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5108
      then guess a b by (elim exE) note s=this
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5109
      show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5110
        apply (rule lem)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5111
        using assms[unfolded s]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5112
        apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5113
        done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5114
    qed auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5115
  }
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5116
  assume as: "\<not> ?P"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5117
  { presume "\<not> ?thesis \<Longrightarrow> False" then show ?thesis by auto }
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5118
  assume "\<not> i\<bullet>k \<le> j\<bullet>k"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5119
  then have ij: "(i\<bullet>k - j\<bullet>k) / 3 > 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5120
    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
  5121
  note has_integral_altD[OF _ as 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
  5122
  from this[OF assms(2)] this[OF assms(3)] guess B1 B2 . note B=this[rule_format]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5123
  have "bounded (ball 0 B1 \<union> ball (0::'a) B2)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5124
    unfolding bounded_Un by(rule conjI bounded_ball)+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5125
  from bounded_subset_closed_interval[OF this] guess a b by (elim exE)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5126
  note ab = conjunctD2[OF this[unfolded Un_subset_iff]]
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5127
  guess w1 using B(2)[OF ab(1)] .. note w1=conjunctD2[OF this]
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5128
  guess w2 using B(4)[OF ab(2)] .. note w2=conjunctD2[OF this]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5129
  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"
50348
4b4fe0d5ee22 remove SMT proofs in Multivariate_Analysis
hoelzl
parents: 50252
diff changeset
  5130
    by (simp add: abs_real_def split: split_if_asm)
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5131
  note le_less_trans[OF Basis_le_norm[OF k]]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5132
  note this[OF w1(2)] this[OF w2(2)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5133
  moreover
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5134
  have "w1\<bullet>k \<le> w2\<bullet>k"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5135
    apply (rule lem[OF w1(1) w2(1)])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5136
    using assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5137
    apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5138
    done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5139
  ultimately show False
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5140
    unfolding inner_simps by(rule *)
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
  5141
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
  5142
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5143
lemma integral_component_le:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5144
  fixes g f :: "'a::ordered_euclidean_space \<Rightarrow> 'b::euclidean_space"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5145
  assumes "k \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5146
    and "f integrable_on s" "g integrable_on s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5147
    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
  5148
  shows "(integral s f)\<bullet>k \<le> (integral s g)\<bullet>k"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5149
  apply (rule has_integral_component_le)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5150
  using integrable_integral assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5151
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5152
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5153
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5154
lemma has_integral_component_nonneg:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5155
  fixes f :: "'a::ordered_euclidean_space \<Rightarrow> 'b::euclidean_space"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5156
  assumes "k \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5157
    and "(f has_integral i) s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5158
    and "\<forall>x\<in>s. 0 \<le> (f x)\<bullet>k"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5159
  shows "0 \<le> i\<bullet>k"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5160
  using has_integral_component_le[OF assms(1) has_integral_0 assms(2)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5161
  using assms(3-)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5162
  by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5163
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5164
lemma integral_component_nonneg:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5165
  fixes f :: "'a::ordered_euclidean_space \<Rightarrow> 'b::euclidean_space"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5166
  assumes "k \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5167
    and "f integrable_on s" "\<forall>x\<in>s. 0 \<le> (f x)\<bullet>k"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5168
  shows "0 \<le> (integral s f)\<bullet>k"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5169
  apply (rule has_integral_component_nonneg)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5170
  using assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5171
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5172
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5173
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5174
lemma has_integral_component_neg:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5175
  fixes f :: "'a::ordered_euclidean_space \<Rightarrow> 'b::ordered_euclidean_space"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5176
  assumes "k \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5177
    and "(f has_integral i) s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5178
    and "\<forall>x\<in>s. (f x)\<bullet>k \<le> 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5179
  shows "i\<bullet>k \<le> 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5180
  using has_integral_component_le[OF assms(1,2) has_integral_0] assms(2-)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5181
  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
  5182
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  5183
lemma has_integral_component_lbound:
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  5184
  fixes f :: "'a::ordered_euclidean_space \<Rightarrow> 'b::ordered_euclidean_space"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5185
  assumes "(f has_integral i) {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5186
    and "\<forall>x\<in>{a..b}. B \<le> f(x)\<bullet>k"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5187
    and "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
  5188
  shows "B * content {a..b} \<le> i\<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
  5189
  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
  5190
  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
  5191
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  5192
lemma has_integral_component_ubound:
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  5193
  fixes f::"'a::ordered_euclidean_space => 'b::ordered_euclidean_space"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5194
  assumes "(f has_integral i) {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5195
    and "\<forall>x\<in>{a..b}. f x\<bullet>k \<le> B"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5196
    and "k \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5197
  shows "i\<bullet>k \<le> B * content {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5198
  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
  5199
  by (auto simp add: field_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5200
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5201
lemma integral_component_lbound:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5202
  fixes f :: "'a::ordered_euclidean_space \<Rightarrow> 'b::ordered_euclidean_space"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5203
  assumes "f integrable_on {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5204
    and "\<forall>x\<in>{a..b}. B \<le> f(x)\<bullet>k"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5205
    and "k \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5206
  shows "B * content {a..b} \<le> (integral({a..b}) f)\<bullet>k"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5207
  apply (rule has_integral_component_lbound)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5208
  using assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5209
  unfolding has_integral_integral
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5210
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5211
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5212
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5213
lemma integral_component_ubound:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5214
  fixes f :: "'a::ordered_euclidean_space \<Rightarrow> 'b::ordered_euclidean_space"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5215
  assumes "f integrable_on {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5216
    and "\<forall>x\<in>{a..b}. f x\<bullet>k \<le> B"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5217
    and "k \<in> Basis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5218
  shows "(integral {a..b} f)\<bullet>k \<le> B * content {a..b}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5219
  apply (rule has_integral_component_ubound)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5220
  using assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5221
  unfolding has_integral_integral
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5222
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5223
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5224
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5225
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5226
subsection {* Uniform limit of integrable functions is integrable. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5227
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5228
lemma integrable_uniform_limit:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5229
  fixes f :: "'a::ordered_euclidean_space \<Rightarrow> 'b::banach"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5230
  assumes "\<forall>e>0. \<exists>g. (\<forall>x\<in>{a..b}. norm (f x - g x) \<le> e) \<and> g integrable_on {a..b}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5231
  shows "f integrable_on {a..b}"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5232
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5233
  {
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5234
    presume *: "content {a..b} > 0 \<Longrightarrow> ?thesis"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5235
    show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5236
      apply cases
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5237
      apply (rule *)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5238
      apply assumption
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5239
      unfolding content_lt_nz integrable_on_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5240
      using has_integral_null
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5241
      apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5242
      done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5243
  }
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5244
  assume as: "content {a..b} > 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5245
  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
  5246
    by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5247
  from choice[OF *[OF assms]] guess g .. note g=conjunctD2[OF this[rule_format],rule_format]
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5248
  from choice[OF allI[OF g(2)[unfolded integrable_on_def], of "\<lambda>x. x"]] guess i .. note i=this[rule_format]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  5249
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5250
  have "Cauchy i"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5251
    unfolding Cauchy_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5252
  proof (rule, rule)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5253
    fix e :: real
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5254
    assume "e>0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5255
    then have "e / 4 / content {a..b} > 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5256
      using as by (auto simp add: field_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5257
    then guess M
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5258
      apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5259
      apply (subst(asm) real_arch_inv)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5260
      apply (elim exE conjE)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5261
      done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5262
    note M=this
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5263
    show "\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (i m) (i n) < e"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5264
      apply (rule_tac x=M in exI,rule,rule,rule,rule)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5265
    proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5266
      case goal1
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5267
      have "e/4>0" using `e>0` by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5268
      note * = i[unfolded has_integral,rule_format,OF this]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5269
      from *[of m] guess gm by (elim conjE exE) note gm=this[rule_format]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5270
      from *[of n] guess gn by (elim conjE exE) note gn=this[rule_format]
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5271
      from fine_division_exists[OF gauge_inter[OF gm(1) gn(1)], of a b] guess p . note p=this
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5272
      have lem2: "\<And>s1 s2 i1 i2. norm(s2 - s1) \<le> e/2 \<Longrightarrow> norm (s1 - i1) < e / 4 \<Longrightarrow>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5273
        norm (s2 - i2) < e / 4 \<Longrightarrow> norm (i1 - i2) < e"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5274
      proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5275
        case goal1
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5276
        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
  5277
          using norm_triangle_ineq[of "i1 - s1" "s1 - i2"]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5278
          using norm_triangle_ineq[of "s1 - s2" "s2 - i2"]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5279
          by (auto simp add: algebra_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5280
        also have "\<dots> < e"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5281
          using goal1
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5282
          unfolding norm_minus_commute
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5283
          by (auto simp add: algebra_simps)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5284
        finally show ?case .
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5285
      qed
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5286
      show ?case
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5287
        unfolding dist_norm
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5288
        apply (rule lem2)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5289
        defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5290
        apply (rule gm(2)[OF conjI[OF p(1)]],rule_tac[2] gn(2)[OF conjI[OF p(1)]])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5291
        using conjunctD2[OF p(2)[unfolded fine_inter]]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5292
        apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5293
        apply assumption+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5294
        apply (rule order_trans)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5295
        apply (rule rsum_diff_bound[OF p(1), where e="2 / real M"])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5296
      proof
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5297
        show "2 / real M * content {a..b} \<le> e / 2"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5298
          unfolding divide_inverse
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5299
          using M as
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5300
          by (auto simp add: field_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5301
        fix x
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5302
        assume x: "x \<in> {a..b}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  5303
        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
  5304
          using g(1)[OF x, of n] g(1)[OF x, of m] by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5305
        also have "\<dots> \<le> inverse (real M) + inverse (real M)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5306
          apply (rule add_mono)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5307
          apply (rule_tac[!] le_imp_inverse_le)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5308
          using goal1 M
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5309
          apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5310
          done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5311
        also have "\<dots> = 2 / real M"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5312
          unfolding divide_inverse by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5313
        finally show "norm (g n x - g m x) \<le> 2 / real M"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5314
          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
  5315
          by (auto simp add: algebra_simps simp add: norm_minus_commute)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5316
      qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5317
    qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5318
  qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  5319
  from this[unfolded convergent_eq_cauchy[symmetric]] guess s .. note s=this
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5320
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5321
  show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5322
    unfolding integrable_on_def
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5323
    apply (rule_tac x=s in exI)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5324
    unfolding has_integral
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5325
  proof (rule, rule)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5326
    case goal1
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5327
    then have *: "e/3 > 0" by auto
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
  5328
    from LIMSEQ_D [OF s this] guess N1 .. note N1=this
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5329
    from goal1 as have "e / 3 / content {a..b} > 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5330
      by (auto simp add: field_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5331
    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
  5332
    from i[of "N1 + N2",unfolded has_integral,rule_format,OF *] guess g' .. note g'=conjunctD2[OF this,rule_format]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5333
    have lem: "\<And>sf sg i. norm (sf - sg) \<le> e / 3 \<Longrightarrow>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5334
      norm(i - s) < e / 3 \<Longrightarrow> norm (sg - i) < e / 3 \<Longrightarrow> norm (sf - s) < e"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5335
    proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5336
      case goal1
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5337
      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
  5338
        using norm_triangle_ineq[of "sf - sg" "sg - s"]
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5339
        using norm_triangle_ineq[of "sg -  i" " i - s"]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5340
        by (auto simp add: algebra_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5341
      also have "\<dots> < e"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5342
        using goal1
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5343
        unfolding norm_minus_commute
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5344
        by (auto simp add: algebra_simps)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5345
      finally show ?case .
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5346
    qed
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5347
    show ?case
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5348
      apply (rule_tac x=g' in exI)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5349
      apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5350
      apply (rule g')
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5351
    proof (rule, rule)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5352
      fix p
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5353
      assume p: "p tagged_division_of {a..b} \<and> g' fine p"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5354
      note * = g'(2)[OF this]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5355
      show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - s) < e"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5356
        apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5357
        apply (rule lem[OF _ _ *])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5358
        apply (rule order_trans)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5359
        apply (rule rsum_diff_bound[OF p[THEN conjunct1]])
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5360
        apply rule
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5361
        apply (rule g)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5362
        apply assumption
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5363
      proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5364
        have "content {a..b} < e / 3 * (real N2)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5365
          using N2 unfolding inverse_eq_divide using as by (auto simp add: field_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5366
        then have "content {a..b} < e / 3 * (real (N1 + N2) + 1)"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5367
          apply -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5368
          apply (rule less_le_trans,assumption)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5369
          using `e>0`
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5370
          apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5371
          done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5372
        then show "inverse (real (N1 + N2) + 1) * content {a..b} \<le> e / 3"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5373
          unfolding inverse_eq_divide
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5374
          by (auto simp add: field_simps)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5375
        show "norm (i (N1 + N2) - s) < e / 3"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5376
          by (rule N1[rule_format]) auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5377
      qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5378
    qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5379
  qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5380
qed
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5381
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5382
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5383
subsection {* Negligible sets. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5384
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5385
definition "negligible (s:: 'a::ordered_euclidean_space set) \<longleftrightarrow>
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5386
  (\<forall>a b. ((indicator s :: 'a\<Rightarrow>real) has_integral 0) {a..b})"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5387
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5388
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5389
subsection {* Negligibility of hyperplane. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5390
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  5391
lemma vsum_nonzero_image_lemma:
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5392
  assumes "finite s"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5393
    and "g a = 0"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5394
    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
  5395
  shows "setsum g {f x |x. x \<in> s \<and> f x \<noteq> a} = setsum (g o f) s"
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5396
  unfolding setsum_iterate[OF assms(1)]
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5397
  apply (subst setsum_iterate)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5398
  defer
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5399
  apply (rule iterate_nonzero_image_lemma)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5400
  apply (rule assms monoidal_monoid)+
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5401
  unfolding assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5402
  unfolding neutral_add
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5403
  using assms
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5404
  apply auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5405
  done
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5406
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5407
lemma interval_doublesplit:
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5408
  fixes a :: "'a::ordered_euclidean_space"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5409
  assumes "k \<in> Basis"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  5410
  shows "{a..b} \<inter> {x . abs(x\<bullet>k - c) \<le> (e::real)} =
53494
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5411
    {(\<Sum>i\<in>Basis. (if i = k then max (a\<bullet>k) (c - e) else a\<bullet>i) *\<^sub>R i) ..
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5412
     (\<Sum>i\<in>Basis. (if i = k then min (b\<bullet>k) (c + e) else b\<bullet>i) *\<^sub>R i)}"
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5413
proof -
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5414
  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
  5415
    by auto
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5416
  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
  5417
    by blast
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5418
  show ?thesis
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5419
    unfolding * ** interval_split[OF assms] by (rule refl)
c24892032eea tuned proofs;
wenzelm
parents: 53468
diff changeset
  5420
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
  5421
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5422
lemma division_doublesplit:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5423
  fixes a :: "'a::ordered_euclidean_space"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5424
  assumes "p division_of {a..b}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5425
    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
  5426
  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> {}} division_of ({a..b} \<inter> {x. abs(x\<bullet>k - c) \<le> e})"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5427
proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5428
  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
  5429
    by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5430
  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
  5431
    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
  5432
  note division_split(1)[OF assms, where c="c+e",unfolded interval_split[OF k]]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  5433
  note division_split(2)[OF this, where c="c-e" and k=k,OF k]
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5434
  then show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5435
    apply (rule **)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5436
    using k
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5437
    apply -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5438
    unfolding interval_doublesplit
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5439
    unfolding *
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5440
    unfolding interval_split interval_doublesplit
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5441
    apply (rule set_eqI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5442
    unfolding mem_Collect_eq
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5443
    apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5444
    apply (erule conjE exE)+
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5445
    apply (rule_tac x=la in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5446
    defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5447
    apply (erule conjE exE)+
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5448
    apply (rule_tac x="l \<inter> {x. c + e \<ge> x \<bullet> k}" in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5449
    apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5450
    defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5451
    apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5452
    apply (rule_tac x=l in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5453
    apply blast+
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5454
    done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5455
qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5456
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5457
lemma content_doublesplit:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5458
  fixes a :: "'a::ordered_euclidean_space"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5459
  assumes "0 < e"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5460
    and k: "k \<in> Basis"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5461
  obtains d where "0 < d" and "content ({a..b} \<inter> {x. abs(x\<bullet>k - c) \<le> d}) < e"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5462
proof (cases "content {a..b} = 0")
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5463
  case True
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5464
  show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5465
    apply (rule that[of 1])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5466
    defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5467
    unfolding interval_doublesplit[OF k]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5468
    apply (rule le_less_trans[OF content_subset])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5469
    defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5470
    apply (subst True)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5471
    unfolding interval_doublesplit[symmetric,OF k]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5472
    using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5473
    apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5474
    done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5475
next
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5476
  case False
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5477
  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
  5478
  note False[unfolded content_eq_0 not_ex not_le, rule_format]
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5479
  then have "\<And>x. x \<in> Basis \<Longrightarrow> b\<bullet>x > a\<bullet>x"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5480
    by (auto simp add:not_le)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5481
  then have prod0: "0 < setprod (\<lambda>i. b\<bullet>i - a\<bullet>i) (Basis - {k})"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5482
    apply -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5483
    apply (rule setprod_pos)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5484
    apply (auto simp add: field_simps)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5485
    done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5486
  then have "d > 0"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5487
    unfolding d_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5488
    using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5489
    by (auto simp add:field_simps)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5490
  then show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5491
  proof (rule that[of d])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5492
    have *: "Basis = insert k (Basis - {k})"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5493
      using k by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5494
    have **: "{a..b} \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<noteq> {} \<Longrightarrow>
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5495
      (\<Prod>i\<in>Basis - {k}. interval_upperbound ({a..b} \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) \<bullet> i -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5496
        interval_lowerbound ({a..b} \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) \<bullet> i) =
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5497
      (\<Prod>i\<in>Basis - {k}. b\<bullet>i - a\<bullet>i)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5498
      apply (rule setprod_cong)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5499
      apply (rule refl)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5500
      unfolding interval_doublesplit[OF k]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5501
      apply (subst interval_bounds)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5502
      defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5503
      apply (subst interval_bounds)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5504
      unfolding interval_eq_empty not_ex not_less
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5505
      apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5506
      done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5507
    show "content ({a..b} \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) < e"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5508
      apply cases
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5509
      unfolding content_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5510
      apply (subst if_P)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5511
      apply assumption
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5512
      apply (rule assms)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5513
      unfolding if_not_P
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5514
      apply (subst *)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5515
      apply (subst setprod_insert)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5516
      unfolding **
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5517
      unfolding interval_doublesplit[OF k] interval_eq_empty not_ex not_less
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5518
      prefer 3
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5519
      apply (subst interval_bounds)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5520
      defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5521
      apply (subst interval_bounds)
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
  5522
      apply (simp_all only: k inner_setsum_left_Basis simp_thms if_P cong: bex_cong ball_cong)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  5523
    proof -
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5524
      have "(min (b \<bullet> k) (c + d) - max (a \<bullet> k) (c - d)) \<le> 2 * d"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5525
        by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5526
      also have "\<dots> < e / (\<Prod>i\<in>Basis - {k}. b \<bullet> i - a \<bullet> i)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5527
        unfolding d_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5528
        using assms prod0
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5529
        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
  5530
      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
  5531
        unfolding pos_less_divide_eq[OF prod0] .
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  5532
    qed 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
  5533
  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
  5534
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
  5535
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  5536
lemma negligible_standard_hyperplane[intro]:
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
  5537
  fixes k :: "'a::ordered_euclidean_space"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  5538
  assumes k: "k \<in> Basis"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  5539
  shows "negligible {x. x\<bullet>k = c}"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5540
  unfolding negligible_def has_integral
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5541
  apply (rule, rule, rule, rule)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5542
proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5543
  case goal1
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5544
  from content_doublesplit[OF this k,of a b c] guess d . note d=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
  5545
  let ?i = "indicator {x::'a. x\<bullet>k = c} :: 'a\<Rightarrow>real"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5546
  show ?case
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5547
    apply (rule_tac x="\<lambda>x. ball x d" in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5548
    apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5549
    apply (rule gauge_ball)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5550
    apply (rule d)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5551
  proof (rule, rule)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5552
    fix p
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5553
    assume p: "p tagged_division_of {a..b} \<and> (\<lambda>x. ball x d) fine p"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5554
    have *: "(\<Sum>(x, ka)\<in>p. content ka *\<^sub>R ?i x) =
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5555
      (\<Sum>(x, ka)\<in>p. content (ka \<inter> {x. abs(x\<bullet>k - c) \<le> d}) *\<^sub>R ?i x)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5556
      apply (rule setsum_cong2)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5557
      unfolding split_paired_all real_scaleR_def mult_cancel_right split_conv
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5558
      apply cases
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5559
      apply (rule disjI1)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5560
      apply assumption
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5561
      apply (rule disjI2)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5562
    proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5563
      fix x l
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5564
      assume as: "(x, l) \<in> p" "?i x \<noteq> 0"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5565
      then have xk: "x\<bullet>k = c"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5566
        unfolding indicator_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5567
        apply -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5568
        apply (rule ccontr)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5569
        apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5570
        done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5571
      show "content l = content (l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5572
        apply (rule arg_cong[where f=content])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5573
        apply (rule set_eqI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5574
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5575
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5576
        unfolding mem_Collect_eq
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5577
      proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5578
        fix y
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5579
        assume y: "y \<in> l"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5580
        note p[THEN conjunct2,unfolded fine_def,rule_format,OF as(1),unfolded split_conv]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5581
        note this[unfolded subset_eq mem_ball dist_norm,rule_format,OF y]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5582
        note le_less_trans[OF Basis_le_norm[OF k] this]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5583
        then show "\<bar>y \<bullet> k - c\<bar> \<le> d"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5584
          unfolding inner_simps xk by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5585
      qed auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5586
    qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5587
    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
  5588
    show "norm ((\<Sum>(x, ka)\<in>p. content ka *\<^sub>R ?i x) - 0) < e"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5589
      unfolding diff_0_right *
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5590
      unfolding real_scaleR_def real_norm_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5591
      apply (subst abs_of_nonneg)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5592
      apply (rule setsum_nonneg)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5593
      apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5594
      unfolding split_paired_all split_conv
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5595
      apply (rule mult_nonneg_nonneg)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5596
      apply (drule p'(4))
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5597
      apply (erule exE)+
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5598
      apply(rule_tac b=b in back_subst)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5599
      prefer 2
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5600
      apply (subst(asm) eq_commute)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5601
      apply assumption
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5602
      apply (subst interval_doublesplit[OF k])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5603
      apply (rule content_pos_le)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5604
      apply (rule indicator_pos_le)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5605
    proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5606
      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
  5607
        (\<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
  5608
        apply (rule setsum_mono)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5609
        unfolding split_paired_all split_conv
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5610
        apply (rule mult_right_le_one_le)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5611
        apply (drule p'(4))
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5612
        apply (auto simp add:interval_doublesplit[OF k])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5613
        done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5614
      also have "\<dots> < e"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5615
        apply (subst setsum_over_tagged_division_lemma[OF p[THEN conjunct1]])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5616
      proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5617
        case goal1
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5618
        have "content ({u..v} \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) \<le> content {u..v}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5619
          unfolding interval_doublesplit[OF k]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5620
          apply (rule content_subset)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5621
          unfolding interval_doublesplit[symmetric,OF k]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5622
          apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5623
          done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5624
        then show ?case
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5625
          unfolding goal1
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5626
          unfolding interval_doublesplit[OF k]
50348
4b4fe0d5ee22 remove SMT proofs in Multivariate_Analysis
hoelzl
parents: 50252
diff changeset
  5627
          by (blast intro: antisym)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5628
      next
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5629
        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
  5630
          apply (rule setsum_nonneg)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5631
          apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5632
          unfolding mem_Collect_eq image_iff
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5633
          apply (erule exE bexE conjE)+
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5634
          unfolding split_paired_all
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5635
        proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5636
          fix x l a b
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5637
          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
  5638
          guess u v using p'(4)[OF as(2)] by (elim exE) note * = this
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5639
          show "content x \<ge> 0"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5640
            unfolding as snd_conv * interval_doublesplit[OF k]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5641
            by (rule content_pos_le)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5642
        qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5643
        have **: "norm (1::real) \<le> 1"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5644
          by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5645
        note division_doublesplit[OF p'' k,unfolded interval_doublesplit[OF k]]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  5646
        note dsum_bound[OF this **,unfolded interval_doublesplit[symmetric,OF k]]
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5647
        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
  5648
        note le_less_trans[OF this d(2)]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5649
        from this[unfolded abs_of_nonneg[OF *]]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5650
        show "(\<Sum>ka\<in>snd ` p. content (ka \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})) < e"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5651
          apply (subst vsum_nonzero_image_lemma[of "snd ` p" content "{}", unfolded o_def,symmetric])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5652
          apply (rule finite_imageI p' content_empty)+
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5653
          unfolding forall_in_division[OF p'']
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5654
        proof (rule,rule,rule,rule,rule,rule,rule,erule conjE)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5655
          fix m n u v
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5656
          assume as:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5657
            "{m..n} \<in> snd ` p" "{u..v} \<in> snd ` p"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5658
            "{m..n} \<noteq> {u..v}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5659
            "{m..n} \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} = {u..v} \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5660
          have "({m..n} \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) \<inter> ({u..v} \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) \<subseteq> {m..n} \<inter> {u..v}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5661
            by blast
44522
2f7e9d890efe rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents: 44514
diff changeset
  5662
          note interior_mono[OF this, unfolded division_ofD(5)[OF p'' as(1-3)] interior_inter[of "{m..n}"]]
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5663
          then have "interior ({m..n} \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) = {}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5664
            unfolding as Int_absorb by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5665
          then show "content ({m..n} \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) = 0"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5666
            unfolding interval_doublesplit[OF k] content_eq_0_interior[symmetric] .
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5667
        qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5668
      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
  5669
      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
  5670
    qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5671
  qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5672
qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5673
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5674
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5675
subsection {* A technical lemma about "refinement" of division. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5676
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5677
lemma tagged_division_finer:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5678
  fixes p :: "('a::ordered_euclidean_space \<times> ('a::ordered_euclidean_space set)) set"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5679
  assumes "p tagged_division_of {a..b}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5680
    and "gauge d"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5681
  obtains q where "q tagged_division_of {a..b}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5682
    and "d fine q"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5683
    and "\<forall>(x,k) \<in> p. k \<subseteq> d(x) \<longrightarrow> (x,k) \<in> q"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5684
proof -
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5685
  let ?P = "\<lambda>p. p tagged_partial_division_of {a..b} \<longrightarrow> gauge d \<longrightarrow>
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5686
    (\<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
  5687
      (\<forall>(x,k) \<in> p. k \<subseteq> d(x) \<longrightarrow> (x,k) \<in> q))"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5688
  {
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5689
    have *: "finite p" "p tagged_partial_division_of {a..b}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5690
      using assms(1)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5691
      unfolding tagged_division_of_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5692
      by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5693
    presume "\<And>p. finite p \<Longrightarrow> ?P p"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5694
    from this[rule_format,OF * assms(2)] guess q .. note q=this
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5695
    then show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5696
      apply -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5697
      apply (rule that[of q])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5698
      unfolding tagged_division_ofD[OF assms(1)]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5699
      apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5700
      done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5701
  }
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5702
  fix p :: "('a::ordered_euclidean_space \<times> ('a::ordered_euclidean_space set)) set"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5703
  assume as: "finite p"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5704
  show "?P p"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5705
    apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5706
    apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5707
    using as
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5708
  proof (induct p)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5709
    case empty
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5710
    show ?case
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5711
      apply (rule_tac x="{}" in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5712
      unfolding fine_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5713
      apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5714
      done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5715
  next
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5716
    case (insert xk p)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5717
    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
  5718
    note tagged_partial_division_subset[OF insert(4) subset_insertI]
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5719
    from insert(3)[OF this insert(5)] guess q1 .. note q1 = conjunctD3[OF this]
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5720
    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
  5721
      unfolding xk by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5722
    note p = tagged_partial_division_ofD[OF insert(4)]
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5723
    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
  5724
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  5725
    have "finite {k. \<exists>x. (x, k) \<in> p}"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5726
      apply (rule finite_subset[of _ "snd ` p"],rule)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5727
      unfolding subset_eq image_iff mem_Collect_eq
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5728
      apply (erule exE)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5729
      apply (rule_tac x="(xa,x)" in bexI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5730
      using p
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5731
      apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5732
      done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5733
    then have int: "interior {u..v} \<inter> interior (\<Union>{k. \<exists>x. (x, k) \<in> p}) = {}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5734
      apply (rule inter_interior_unions_intervals)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5735
      apply (rule open_interior)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5736
      apply (rule_tac[!] ballI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5737
      unfolding mem_Collect_eq
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5738
      apply (erule_tac[!] exE)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5739
      apply (drule p(4)[OF insertI2])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5740
      apply assumption
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5741
      apply (rule p(5))
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5742
      unfolding uv xk
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5743
      apply (rule insertI1)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5744
      apply (rule insertI2)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5745
      apply assumption
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5746
      using insert(2)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5747
      unfolding uv xk
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5748
      apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5749
      done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5750
    show ?case
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5751
    proof (cases "{u..v} \<subseteq> d x")
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5752
      case True
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5753
      then show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5754
        apply (rule_tac x="{(x,{u..v})} \<union> q1" in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5755
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5756
        unfolding * uv
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5757
        apply (rule tagged_division_union)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5758
        apply (rule tagged_division_of_self)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5759
        apply (rule p[unfolded xk uv] insertI1)+
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5760
        apply (rule q1)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5761
        apply (rule int)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5762
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5763
        apply (rule fine_union)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5764
        apply (subst fine_def)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5765
        defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5766
        apply (rule q1)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5767
        unfolding Ball_def split_paired_All split_conv
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5768
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5769
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5770
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5771
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5772
        apply (erule insertE)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5773
        defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5774
        apply (rule UnI2)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5775
        apply (drule q1(3)[rule_format])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5776
        unfolding xk uv
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5777
        apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5778
        done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5779
    next
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5780
      case False
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5781
      from fine_division_exists[OF assms(2), of u v] guess q2 . note q2=this
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5782
      show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5783
        apply (rule_tac x="q2 \<union> q1" in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5784
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5785
        unfolding * uv
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5786
        apply (rule tagged_division_union q2 q1 int fine_union)+
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5787
        unfolding Ball_def split_paired_All split_conv
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5788
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5789
        apply (rule fine_union)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5790
        apply (rule q1 q2)+
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5791
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5792
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5793
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5794
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5795
        apply (erule insertE)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5796
        apply (rule UnI2)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5797
        defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5798
        apply (drule q1(3)[rule_format])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5799
        using False
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5800
        unfolding xk uv
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5801
        apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5802
        done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5803
    qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5804
  qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5805
qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5806
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5807
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5808
subsection {* Hence the main theorem about negligible sets. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5809
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5810
lemma finite_product_dependent:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5811
  assumes "finite s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5812
    and "\<And>x. x \<in> s \<Longrightarrow> finite (t x)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5813
  shows "finite {(i, j) |i j. i \<in> s \<and> j \<in> t i}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5814
  using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5815
proof induct
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5816
  case (insert x s)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5817
  have *: "{(i, j) |i j. i \<in> insert x s \<and> j \<in> t i} =
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5818
    (\<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
  5819
  show ?case
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5820
    unfolding *
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5821
    apply (rule finite_UnI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5822
    using insert
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5823
    apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5824
    done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5825
qed auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5826
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5827
lemma sum_sum_product:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5828
  assumes "finite s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5829
    and "\<forall>i\<in>s. finite (t i)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5830
  shows "setsum (\<lambda>i. setsum (x i) (t i)::real) s =
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5831
    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
  5832
  using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5833
proof induct
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5834
  case (insert a s)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5835
  have *: "{(i, j) |i j. i \<in> insert a s \<and> j \<in> t i} =
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5836
    (\<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
  5837
  show ?case
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5838
    unfolding *
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5839
    apply (subst setsum_Un_disjoint)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5840
    unfolding setsum_insert[OF insert(1-2)]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5841
    prefer 4
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5842
    apply (subst insert(3))
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5843
    unfolding add_right_cancel
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5844
  proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5845
    show "setsum (x a) (t a) = (\<Sum>(xa, y)\<in> Pair a ` t a. x xa y)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5846
      apply (subst setsum_reindex)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5847
      unfolding inj_on_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5848
      apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5849
      done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5850
    show "finite {(i, j) |i j. i \<in> s \<and> j \<in> t i}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5851
      apply (rule finite_product_dependent)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5852
      using insert
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5853
      apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5854
      done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5855
  qed (insert insert, auto)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5856
qed auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5857
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5858
lemma has_integral_negligible:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5859
  fixes f :: "'b::ordered_euclidean_space \<Rightarrow> 'a::real_normed_vector"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5860
  assumes "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5861
    and "\<forall>x\<in>(t - s). f x = 0"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5862
  shows "(f has_integral 0) t"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5863
proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5864
  presume P: "\<And>f::'b::ordered_euclidean_space \<Rightarrow> 'a.
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5865
    \<And>a b. \<forall>x. x \<notin> s \<longrightarrow> f x = 0 \<Longrightarrow> (f has_integral 0) {a..b}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5866
  let ?f = "(\<lambda>x. if x \<in> t then f x else 0)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5867
  show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5868
    apply (rule_tac f="?f" in has_integral_eq)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5869
    apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5870
    unfolding if_P
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5871
    apply (rule refl)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5872
    apply (subst has_integral_alt)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5873
    apply cases
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5874
    apply (subst if_P, assumption)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5875
    unfolding if_not_P
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5876
  proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5877
    assume "\<exists>a b. t = {a..b}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5878
    then guess a b apply - by (erule exE)+ note t = this
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5879
    show "(?f has_integral 0) t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5880
      unfolding t
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5881
      apply (rule P)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5882
      using assms(2)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5883
      unfolding t
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5884
      apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5885
      done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5886
  next
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5887
    show "\<forall>e>0. \<exists>B>0. \<forall>a b. ball 0 B \<subseteq> {a..b} \<longrightarrow>
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5888
      (\<exists>z. ((\<lambda>x. if x \<in> t then ?f x else 0) has_integral z) {a..b} \<and> norm (z - 0) < e)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5889
      apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5890
      apply (rule_tac x=1 in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5891
      apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5892
      apply (rule zero_less_one)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5893
      apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5894
      apply (rule_tac x=0 in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5895
      apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5896
      apply (rule P)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5897
      using assms(2)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5898
      apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5899
      done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5900
  qed
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5901
next
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5902
  fix f :: "'b \<Rightarrow> 'a"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5903
  fix a b :: 'b
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5904
  assume assm: "\<forall>x. x \<notin> s \<longrightarrow> f x = 0"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5905
  show "(f has_integral 0) {a..b}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5906
    unfolding has_integral
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5907
  proof safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5908
    case goal1
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5909
    then have "\<And>n. e / 2 / ((real n+1) * (2 ^ n)) > 0"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5910
      apply -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5911
      apply (rule divide_pos_pos)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5912
      defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5913
      apply (rule mult_pos_pos)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5914
      apply (auto simp add:field_simps)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5915
      done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5916
    note assms(1)[unfolded negligible_def has_integral,rule_format,OF this,of a b]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5917
    note allI[OF this,of "\<lambda>x. x"]
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5918
    from choice[OF this] guess d .. note d=conjunctD2[OF this[rule_format]]
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5919
    show ?case
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5920
      apply (rule_tac x="\<lambda>x. d (nat \<lfloor>norm (f x)\<rfloor>) x" in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5921
    proof safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5922
      show "gauge (\<lambda>x. d (nat \<lfloor>norm (f x)\<rfloor>) x)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5923
        using d(1) unfolding gauge_def by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5924
      fix p
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5925
      assume as: "p tagged_division_of {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
  5926
      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
  5927
      {
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5928
        presume "p \<noteq> {} \<Longrightarrow> ?goal"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5929
        then show ?goal
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5930
          apply (cases "p = {}")
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5931
          using goal1
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5932
          apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5933
          done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5934
      }
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5935
      assume as': "p \<noteq> {}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5936
      from real_arch_simple[of "Sup((\<lambda>(x,k). norm(f x)) ` p)"] guess N ..
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5937
      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
  5938
        apply (subst(asm) cSup_finite_le_iff)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5939
        using as as'
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5940
        apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5941
        done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5942
      have "\<forall>i. \<exists>q. q tagged_division_of {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
  5943
        apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5944
        apply (rule tagged_division_finer[OF as(1) d(1)])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5945
        apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5946
        done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5947
      from choice[OF this] guess q .. note q=conjunctD3[OF this[rule_format]]
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5948
      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
  5949
        apply (rule setsum_nonneg)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5950
        apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5951
        unfolding real_scaleR_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5952
        apply (rule mult_nonneg_nonneg)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5953
        apply (drule tagged_division_ofD(4)[OF q(1)])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5954
        apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5955
        done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5956
      have **: "\<And>f g s t. finite s \<Longrightarrow> finite t \<Longrightarrow> (\<forall>(x,y) \<in> t. (0::real) \<le> g(x,y)) \<Longrightarrow>
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5957
        (\<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"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5958
      proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5959
        case goal1
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5960
        then show ?case
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5961
          apply -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5962
          apply (rule setsum_le_included[of s t g snd f])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5963
          prefer 4
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5964
          apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5965
          apply (erule_tac x=x in ballE)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5966
          apply (erule exE)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5967
          apply (rule_tac x="(xa,x)" in bexI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5968
          apply auto  
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5969
          done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5970
      qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5971
      have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - 0) \<le> setsum (\<lambda>i. (real i + 1) *
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5972
        norm (setsum (\<lambda>(x,k). content k *\<^sub>R indicator s x :: real) (q i))) {0..N+1}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  5973
        unfolding real_norm_def setsum_right_distrib abs_of_nonneg[OF *] diff_0_right
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5974
        apply (rule order_trans)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5975
        apply (rule norm_setsum)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5976
        apply (subst sum_sum_product)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5977
        prefer 3
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5978
      proof (rule **, safe)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5979
        show "finite {(i, j) |i j. i \<in> {0..N + 1} \<and> j \<in> q i}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5980
          apply (rule finite_product_dependent)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5981
          using q
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5982
          apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5983
          done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5984
        fix i a b
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5985
        assume as'': "(a, b) \<in> q i"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5986
        show "0 \<le> (real i + 1) * (content b *\<^sub>R indicator s a)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5987
          unfolding real_scaleR_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5988
          apply (rule mult_nonneg_nonneg)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5989
          defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5990
          apply (rule mult_nonneg_nonneg)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5991
          using tagged_division_ofD(4)[OF q(1) as'']
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5992
          apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5993
          done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5994
      next
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5995
        fix i :: nat
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5996
        show "finite (q i)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5997
          using q by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5998
      next
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  5999
        fix x k
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6000
        assume xk: "(x, k) \<in> p"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6001
        def n \<equiv> "nat \<lfloor>norm (f x)\<rfloor>"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6002
        have *: "norm (f x) \<in> (\<lambda>(x, k). norm (f x)) ` p"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6003
          using xk by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6004
        have nfx: "real n \<le> norm (f x)" "norm (f x) \<le> real n + 1"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6005
          unfolding n_def by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6006
        then have "n \<in> {0..N + 1}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6007
          using N[rule_format,OF *] by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6008
        moreover
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6009
        note as(2)[unfolded fine_def,rule_format,OF xk,unfolded split_conv]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6010
        note q(3)[rule_format,OF xk,unfolded split_conv,rule_format,OF this]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6011
        note this[unfolded n_def[symmetric]]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6012
        moreover
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6013
        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
  6014
        proof (cases "x \<in> s")
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6015
          case False
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6016
          then show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6017
            using assm by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6018
        next
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6019
          case True
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6020
          have *: "content k \<ge> 0"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6021
            using tagged_division_ofD(4)[OF as(1) xk] by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6022
          moreover
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6023
          have "content k * norm (f x) \<le> content k * (real n + 1)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6024
            apply (rule mult_mono)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6025
            using nfx *
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6026
            apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6027
            done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6028
          ultimately
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6029
          show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6030
            unfolding abs_mult
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6031
            using nfx True
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6032
            by (auto simp add: field_simps)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6033
        qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6034
        ultimately show "\<exists>y. (y, x, k) \<in> {(i, j) |i j. i \<in> {0..N + 1} \<and> j \<in> q i} \<and> norm (content k *\<^sub>R f x) \<le>
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6035
          (real y + 1) * (content k *\<^sub>R indicator s x)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6036
          apply (rule_tac x=n in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6037
          apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6038
          apply (rule_tac x=n in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6039
          apply (rule_tac x="(x,k)" in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6040
          apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6041
          apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6042
          done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6043
      qed (insert as, auto)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6044
      also have "\<dots> \<le> setsum (\<lambda>i. e / 2 / 2 ^ i) {0..N+1}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6045
        apply (rule setsum_mono)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6046
      proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6047
        case goal1
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6048
        then show ?case
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6049
          apply (subst mult_commute, subst pos_le_divide_eq[symmetric])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6050
          using d(2)[rule_format,of "q i" i]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6051
          using q[rule_format]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6052
          apply (auto simp add: field_simps)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6053
          done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6054
      qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6055
      also have "\<dots> < e * inverse 2 * 2"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6056
        unfolding divide_inverse setsum_right_distrib[symmetric]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6057
        apply (rule mult_strict_left_mono)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6058
        unfolding power_inverse atLeastLessThanSuc_atLeastAtMost[symmetric]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6059
        apply (subst sumr_geometric)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6060
        using goal1
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6061
        apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6062
        done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6063
      finally show "?goal" by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6064
    qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6065
  qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6066
qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6067
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6068
lemma has_integral_spike:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6069
  fixes f :: "'b::ordered_euclidean_space \<Rightarrow> 'a::real_normed_vector"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6070
  assumes "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6071
    and "(\<forall>x\<in>(t - s). g x = f x)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6072
    and "(f has_integral y) t"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6073
  shows "(g has_integral y) t"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6074
proof -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6075
  {
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6076
    fix a b :: 'b
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6077
    fix f g :: "'b \<Rightarrow> 'a"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6078
    fix y :: 'a
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6079
    assume as: "\<forall>x \<in> {a..b} - s. g x = f x" "(f has_integral y) {a..b}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6080
    have "((\<lambda>x. f x + (g x - f x)) has_integral (y + 0)) {a..b}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6081
      apply (rule has_integral_add[OF as(2)])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6082
      apply (rule has_integral_negligible[OF assms(1)])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6083
      using as
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6084
      apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6085
      done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6086
    then have "(g has_integral y) {a..b}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6087
      by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6088
  } note * = this
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6089
  show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6090
    apply (subst has_integral_alt)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6091
    using assms(2-)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6092
    apply -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6093
    apply (rule cond_cases)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6094
    apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6095
    apply (rule *)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6096
    apply assumption+
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6097
    apply (subst(asm) has_integral_alt)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6098
    unfolding if_not_P
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6099
    apply (erule_tac x=e in allE)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6100
    apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6101
    apply (rule_tac x=B in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6102
    apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6103
    apply (erule_tac x=a in allE)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6104
    apply (erule_tac x=b in allE)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6105
    apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6106
    apply (rule_tac x=z in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6107
    apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6108
    apply (rule *[where fa2="\<lambda>x. if x\<in>t then f x else 0"])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6109
    apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6110
    done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6111
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6112
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6113
lemma has_integral_spike_eq:
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6114
  assumes "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6115
    and "\<forall>x\<in>(t - s). g x = f x"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6116
  shows "((f has_integral y) t \<longleftrightarrow> (g has_integral y) t)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6117
  apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6118
  apply (rule_tac[!] has_integral_spike[OF assms(1)])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6119
  using assms(2)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6120
  apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6121
  done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6122
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6123
lemma integrable_spike:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6124
  assumes "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6125
    and "\<forall>x\<in>(t - s). g x = f x"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6126
    and "f integrable_on t"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6127
  shows "g integrable_on  t"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6128
  using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6129
  unfolding integrable_on_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6130
  apply -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6131
  apply (erule exE)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6132
  apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6133
  apply (rule has_integral_spike)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6134
  apply fastforce+
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6135
  done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6136
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6137
lemma integral_spike:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6138
  assumes "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6139
    and "\<forall>x\<in>(t - s). g x = f x"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6140
  shows "integral t f = integral t g"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6141
  unfolding integral_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6142
  using has_integral_spike_eq[OF assms]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6143
  by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6144
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6145
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6146
subsection {* Some other trivialities about negligible sets. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6147
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6148
lemma negligible_subset[intro]:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6149
  assumes "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6150
    and "t \<subseteq> s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6151
  shows "negligible t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6152
  unfolding negligible_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6153
proof safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6154
  case goal1
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6155
  show ?case
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6156
    using assms(1)[unfolded negligible_def,rule_format,of a b]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6157
    apply -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6158
    apply (rule has_integral_spike[OF assms(1)])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6159
    defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6160
    apply assumption
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6161
    using assms(2)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6162
    unfolding indicator_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6163
    apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6164
    done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6165
qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6166
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6167
lemma negligible_diff[intro?]:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6168
  assumes "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6169
  shows "negligible (s - t)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6170
  using assms by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6171
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6172
lemma negligible_inter:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6173
  assumes "negligible s \<or> negligible t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6174
  shows "negligible (s \<inter> t)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6175
  using assms by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6176
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6177
lemma negligible_union:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6178
  assumes "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6179
    and "negligible t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6180
  shows "negligible (s \<union> t)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6181
  unfolding negligible_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6182
proof safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6183
  case goal1
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6184
  note assm = assms[unfolded negligible_def,rule_format,of a b]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6185
  then show ?case
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6186
    apply (subst has_integral_spike_eq[OF assms(2)])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6187
    defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6188
    apply assumption
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6189
    unfolding indicator_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6190
    apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6191
    done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6192
qed
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6193
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6194
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
  6195
  using negligible_union by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6196
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6197
lemma negligible_sing[intro]: "negligible {a::'a::ordered_euclidean_space}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  6198
  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
  6199
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6200
lemma negligible_insert[simp]: "negligible (insert a s) \<longleftrightarrow> negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6201
  apply (subst insert_is_Un)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6202
  unfolding negligible_union_eq
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6203
  apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6204
  done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6205
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6206
lemma negligible_empty[intro]: "negligible {}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6207
  by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6208
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6209
lemma negligible_finite[intro]:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6210
  assumes "finite s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6211
  shows "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6212
  using assms by (induct s) auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6213
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6214
lemma negligible_unions[intro]:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6215
  assumes "finite s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6216
    and "\<forall>t\<in>s. negligible t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6217
  shows "negligible(\<Union>s)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6218
  using assms by induct auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6219
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6220
lemma negligible:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6221
  "negligible s \<longleftrightarrow> (\<forall>t::('a::ordered_euclidean_space) set. ((indicator s::'a\<Rightarrow>real) has_integral 0) t)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6222
  apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6223
  defer
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6224
  apply (subst negligible_def)
46905
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  6225
proof -
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6226
  fix t :: "'a set"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6227
  assume as: "negligible s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6228
  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
  6229
    by auto
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  6230
  show "((indicator s::'a\<Rightarrow>real) has_integral 0) t"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6231
    apply (subst has_integral_alt)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6232
    apply cases
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6233
    apply (subst if_P,assumption)
46905
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  6234
    unfolding if_not_P
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6235
    apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6236
    apply (rule as[unfolded negligible_def,rule_format])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6237
    apply (rule_tac x=1 in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6238
    apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6239
    apply (rule zero_less_one)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6240
    apply (rule_tac x=0 in exI)
46905
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  6241
    using negligible_subset[OF as,of "s \<inter> t"]
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  6242
    unfolding negligible_def indicator_def [abs_def]
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  6243
    unfolding *
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  6244
    apply auto
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  6245
    done
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 45994
diff changeset
  6246
qed auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6247
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6248
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6249
subsection {* Finite case of the spike theorem is quite commonly needed. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6250
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6251
lemma has_integral_spike_finite:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6252
  assumes "finite s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6253
    and "\<forall>x\<in>t-s. g x = f x"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6254
    and "(f has_integral y) t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6255
  shows "(g has_integral y) t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6256
  apply (rule has_integral_spike)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6257
  using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6258
  apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6259
  done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6260
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6261
lemma has_integral_spike_finite_eq:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6262
  assumes "finite s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6263
    and "\<forall>x\<in>t-s. g x = f x"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6264
  shows "((f has_integral y) t \<longleftrightarrow> (g has_integral y) t)"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6265
  apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6266
  apply (rule_tac[!] has_integral_spike_finite)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6267
  using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6268
  apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6269
  done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6270
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6271
lemma integrable_spike_finite:
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6272
  assumes "finite s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6273
    and "\<forall>x\<in>t-s. g x = f x"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6274
    and "f integrable_on t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6275
  shows "g integrable_on  t"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6276
  using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6277
  unfolding integrable_on_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6278
  apply safe
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6279
  apply (rule_tac x=y in exI)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6280
  apply (rule has_integral_spike_finite)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6281
  apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6282
  done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6283
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6284
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6285
subsection {* In particular, the boundary of an interval is negligible. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6286
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  6287
lemma negligible_frontier_interval: "negligible({a::'a::ordered_euclidean_space..b} - {a<..<b})"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6288
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
  6289
  let ?A = "\<Union>((\<lambda>k. {x. x\<bullet>k = a\<bullet>k} \<union> {x::'a. x\<bullet>k = b\<bullet>k}) ` 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
  6290
  have "{a..b} - {a<..<b} \<subseteq> ?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
  6291
    apply rule unfolding Diff_iff mem_interval
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  6292
    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
  6293
    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
  6294
    apply(rule_tac x=i in bexI)
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6295
    apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6296
    done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6297
  then show ?thesis
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6298
    apply -
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6299
    apply (rule negligible_subset[of ?A])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6300
    apply (rule negligible_unions[OF finite_imageI])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6301
    apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6302
    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
  6303
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6304
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6305
lemma has_integral_spike_interior:
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6306
  assumes "\<forall>x\<in>{a<..<b}. g x = f x"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6307
    and "(f has_integral y) ({a..b})"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6308
  shows "(g has_integral y) {a..b}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6309
  apply (rule has_integral_spike[OF negligible_frontier_interval _ assms(2)])
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6310
  using assms(1)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6311
  apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6312
  done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6313
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6314
lemma has_integral_spike_interior_eq:
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6315
  assumes "\<forall>x\<in>{a<..<b}. g x = f x"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6316
  shows "(f has_integral y) {a..b} \<longleftrightarrow> (g has_integral y) {a..b}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6317
  apply rule
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6318
  apply (rule_tac[!] has_integral_spike_interior)
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6319
  using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6320
  apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6321
  done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6322
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6323
lemma integrable_spike_interior:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6324
  assumes "\<forall>x\<in>{a<..<b}. g x = f x"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6325
    and "f integrable_on {a..b}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6326
  shows "g integrable_on {a..b}"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6327
  using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6328
  unfolding integrable_on_def
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6329
  using has_integral_spike_interior[OF assms(1)]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6330
  by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6331
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6332
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6333
subsection {* Integrability of continuous functions. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6334
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6335
lemma neutral_and[simp]: "neutral op \<and> = True"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6336
  unfolding neutral_def by (rule some_equality) auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6337
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6338
lemma monoidal_and[intro]: "monoidal op \<and>"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6339
  unfolding monoidal_def by auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6340
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6341
lemma iterate_and[simp]:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6342
  assumes "finite s"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6343
  shows "(iterate op \<and>) s p \<longleftrightarrow> (\<forall>x\<in>s. p x)"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6344
  using assms
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6345
  apply induct
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6346
  unfolding iterate_insert[OF monoidal_and]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6347
  apply auto
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6348
  done
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6349
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6350
lemma operative_division_and:
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6351
  assumes "operative op \<and> P"
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6352
    and "d division_of {a..b}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6353
  shows "(\<forall>i\<in>d. P i) \<longleftrightarrow> P {a..b}"
53495
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6354
  using operative_division[OF monoidal_and assms] division_of_finite[OF assms(2)]
fd977a1574dc tuned proofs;
wenzelm
parents: 53494
diff changeset
  6355
  by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6356
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6357
lemma operative_approximable:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6358
  fixes f::"'b::ordered_euclidean_space \<Rightarrow> 'a::banach"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6359
  assumes "0 \<le> e"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6360
  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
  6361
  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
  6362
proof safe
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6363
  fix a b :: 'b
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6364
  {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6365
    assume "content {a..b} = 0"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6366
    then show "\<exists>g. (\<forall>x\<in>{a..b}. norm (f x - g x) \<le> e) \<and> g integrable_on {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6367
      apply (rule_tac x=f in exI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6368
      using assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6369
      apply (auto intro!:integrable_on_null)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6370
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6371
  }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6372
  {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6373
    fix c g
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6374
    fix k :: 'b
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6375
    assume as: "\<forall>x\<in>{a..b}. norm (f x - g x) \<le> e" "g integrable_on {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6376
    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
  6377
    show "\<exists>g. (\<forall>x\<in>{a..b} \<inter> {x. x \<bullet> k \<le> c}. norm (f x - g x) \<le> e) \<and> g integrable_on {a..b} \<inter> {x. x \<bullet> k \<le> c}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  6378
      "\<exists>g. (\<forall>x\<in>{a..b} \<inter> {x. c \<le> x \<bullet> k}. norm (f x - g x) \<le> e) \<and> g integrable_on {a..b} \<inter> {x. c \<le> x \<bullet> k}"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6379
      apply (rule_tac[!] x=g in exI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6380
      using as(1) integrable_split[OF as(2) k]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6381
      apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6382
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6383
  }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6384
  fix c k g1 g2
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6385
  assume as: "\<forall>x\<in>{a..b} \<inter> {x. x \<bullet> k \<le> c}. norm (f x - g1 x) \<le> e" "g1 integrable_on {a..b} \<inter> {x. x \<bullet> k \<le> c}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6386
    "\<forall>x\<in>{a..b} \<inter> {x. c \<le> x \<bullet> k}. norm (f x - g2 x) \<le> e" "g2 integrable_on {a..b} \<inter> {x. c \<le> x \<bullet> k}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6387
  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
  6388
  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"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6389
  show "\<exists>g. (\<forall>x\<in>{a..b}. norm (f x - g x) \<le> e) \<and> g integrable_on {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6390
    apply (rule_tac x="?g" in exI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6391
  proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6392
    case goal1
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6393
    then show ?case
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6394
      apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6395
      apply (cases "x\<bullet>k=c")
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6396
      apply (case_tac "x\<bullet>k < c")
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6397
      using as assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6398
      apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6399
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6400
  next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6401
    case goal2
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6402
    presume "?g integrable_on {a..b} \<inter> {x. x \<bullet> k \<le> c}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6403
      and "?g integrable_on {a..b} \<inter> {x. x \<bullet> k \<ge> c}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6404
    then guess h1 h2 unfolding integrable_on_def by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6405
    from has_integral_split[OF this k] show ?case
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6406
      unfolding integrable_on_def by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6407
  next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6408
    show "?g integrable_on {a..b} \<inter> {x. x \<bullet> k \<le> c}" "?g integrable_on {a..b} \<inter> {x. x \<bullet> k \<ge> c}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6409
      apply(rule_tac[!] integrable_spike[OF negligible_standard_hyperplane[of k c]])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6410
      using k as(2,4)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6411
      apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6412
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6413
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6414
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6415
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6416
lemma approximable_on_division:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6417
  fixes f :: "'b::ordered_euclidean_space \<Rightarrow> 'a::banach"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6418
  assumes "0 \<le> e"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6419
    and "d division_of {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6420
    and "\<forall>i\<in>d. \<exists>g. (\<forall>x\<in>i. norm (f x - g x) \<le> e) \<and> g integrable_on i"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6421
  obtains g where "\<forall>x\<in>{a..b}. norm (f x - g x) \<le> e" "g integrable_on {a..b}"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6422
proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6423
  note * = operative_division[OF monoidal_and operative_approximable[OF assms(1)] assms(2)]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6424
  note this[unfolded iterate_and[OF division_of_finite[OF assms(2)]]]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6425
  from assms(3)[unfolded this[of f]] guess g ..
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6426
  then show thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6427
    apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6428
    apply (rule that[of g])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6429
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6430
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6431
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6432
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6433
lemma integrable_continuous:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6434
  fixes f :: "'b::ordered_euclidean_space \<Rightarrow> 'a::banach"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6435
  assumes "continuous_on {a..b} f"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6436
  shows "f integrable_on {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6437
proof (rule integrable_uniform_limit, safe)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6438
  fix e :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6439
  assume e: "e > 0"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6440
  from compact_uniformly_continuous[OF assms compact_interval,unfolded uniformly_continuous_on_def,rule_format,OF e] guess d ..
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6441
  note d=conjunctD2[OF this,rule_format]
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6442
  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
  6443
  note p' = tagged_division_ofD[OF p(1)]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6444
  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
  6445
  proof (safe, unfold snd_conv)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6446
    fix x l
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6447
    assume as: "(x, l) \<in> p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6448
    from p'(4)[OF this] guess a b by (elim exE) note l=this
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6449
    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
  6450
      apply (rule_tac x="\<lambda>y. f x" in exI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6451
    proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6452
      show "(\<lambda>y. f x) integrable_on l"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6453
        unfolding integrable_on_def l
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6454
        apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6455
        apply (rule has_integral_const)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6456
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6457
      fix y
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6458
      assume y: "y \<in> l"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6459
      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
  6460
      note d(2)[OF _ _ this[unfolded mem_ball]]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6461
      then show "norm (f y - f x) \<le> e"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6462
        using y p'(2-3)[OF as] unfolding dist_norm l norm_minus_commute by fastforce
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6463
    qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6464
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6465
  from e have "e \<ge> 0"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6466
    by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6467
  from approximable_on_division[OF this division_of_tagged_division[OF p(1)] *] guess g .
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6468
  then show "\<exists>g. (\<forall>x\<in>{a..b}. norm (f x - g x) \<le> e) \<and> g integrable_on {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6469
    by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6470
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6471
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6472
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6473
subsection {* Specialization of additivity to one dimension. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6474
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  6475
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
  6476
  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
  6477
  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
  6478
  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
  6479
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6480
lemma operative_1_lt:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6481
  assumes "monoidal opp"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  6482
  shows "operative opp f \<longleftrightarrow> ((\<forall>a b. b \<le> a \<longrightarrow> f {a..b::real} = neutral opp) \<and>
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6483
    (\<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
  6484
  apply (simp add: operative_def content_eq_0)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6485
proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6486
  fix a b c :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6487
  assume as:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6488
    "\<forall>a b c. f {a..b} = opp (f ({a..b} \<inter> {x. x \<le> c})) (f ({a..b} \<inter> {x. c \<le> x}))"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6489
    "a < c"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6490
    "c < b"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6491
    from this(2-) have "{a..b} \<inter> {x. x \<le> c} = {a..c}" "{a..b} \<inter> {x. x \<ge> c} = {c..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6492
      by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6493
    then show "opp (f {a..c}) (f {c..b}) = f {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6494
      unfolding as(1)[rule_format,of a b "c"] by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6495
next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6496
  fix a b c :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6497
  assume as: "\<forall>a b. b \<le> a \<longrightarrow> f {a..b} = neutral opp"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6498
    "\<forall>a b c. a < c \<and> c < b \<longrightarrow> opp (f {a..c}) (f {c..b}) = f {a..b}"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  6499
  show "f {a..b} = opp (f ({a..b} \<inter> {x. x \<le> c})) (f ({a..b} \<inter> {x. c \<le> x}))"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6500
  proof (cases "c \<in> {a..b}")
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6501
    case False
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6502
    then have "c < a \<or> c > b" by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6503
    then show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6504
    proof
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6505
      assume "c < a"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6506
      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
  6507
        by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6508
      show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6509
        unfolding *
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6510
        apply (subst as(1)[rule_format,of 0 1])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6511
        using assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6512
        apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6513
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6514
    next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6515
      assume "b < c"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6516
      then have *: "{a..b} \<inter> {x. x \<le> c} = {a..b}" "{a..b} \<inter> {x. c \<le> x} = {1..0}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6517
        by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6518
      show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6519
        unfolding *
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6520
        apply (subst as(1)[rule_format,of 0 1])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6521
        using assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6522
        apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6523
        done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6524
    qed
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6525
  next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6526
    case True
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6527
    then have *: "min (b) c = c" "max a c = c"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6528
      by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6529
    have **: "(1::real) \<in> Basis"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6530
      by simp
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6531
    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
  6532
      by simp
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  6533
    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
  6534
      unfolding interval_split[OF **, unfolded real_inner_1_right] unfolding *** *
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6535
    proof (cases "c = a \<or> c = b")
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6536
      case False
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6537
      then show "f {a..b} = opp (f {a..c}) (f {c..b})"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6538
        apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6539
        apply (subst as(2)[rule_format])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6540
        using True
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6541
        apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6542
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6543
    next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6544
      case True
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6545
      then show "f {a..b} = opp (f {a..c}) (f {c..b})"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6546
      proof
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6547
        assume *: "c = a"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6548
        then have "f {a..c} = neutral opp"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6549
          apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6550
          apply (rule as(1)[rule_format])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6551
          apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6552
          done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6553
        then show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6554
          using assms unfolding * by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6555
      next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6556
        assume *: "c = b"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6557
        then have "f {c..b} = neutral opp"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6558
          apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6559
          apply (rule as(1)[rule_format])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6560
          apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6561
          done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6562
        then show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6563
          using assms unfolding * by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6564
      qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6565
    qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6566
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6567
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6568
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6569
lemma operative_1_le:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6570
  assumes "monoidal opp"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  6571
  shows "operative opp f \<longleftrightarrow> ((\<forall>a b. b \<le> a \<longrightarrow> f {a..b::real} = neutral opp) \<and>
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6572
    (\<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
  6573
  unfolding operative_1_lt[OF assms]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6574
proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6575
  fix a b c :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6576
  assume as:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6577
    "\<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
  6578
    "a < c"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6579
    "c < b"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6580
  show "opp (f {a..c}) (f {c..b}) = f {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6581
    apply (rule as(1)[rule_format])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6582
    using as(2-)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6583
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6584
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6585
next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6586
  fix a b c :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6587
  assume "\<forall>a b. b \<le> a \<longrightarrow> f {a..b} = neutral opp"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6588
    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
  6589
    and "a \<le> c"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6590
    and "c \<le> b"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6591
  note as = this[rule_format]
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6592
  show "opp (f {a..c}) (f {c..b}) = f {a..b}"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6593
  proof (cases "c = a \<or> c = b")
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6594
    case False
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6595
    then show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6596
      apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6597
      apply (subst as(2))
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6598
      using as(3-)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6599
      apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6600
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6601
  next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6602
    case True
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6603
    then show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6604
    proof
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6605
      assume *: "c = a"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6606
      then have "f {a..c} = neutral opp"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6607
        apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6608
        apply (rule as(1)[rule_format])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6609
        apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6610
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6611
      then show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6612
        using assms unfolding * by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6613
    next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6614
      assume *: "c = b"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6615
      then have "f {c..b} = neutral opp"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6616
        apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6617
        apply (rule as(1)[rule_format])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6618
        apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6619
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6620
      then show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6621
        using assms unfolding * by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6622
    qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6623
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6624
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6625
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6626
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6627
subsection {* Special case of additivity we need for the FCT. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6628
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6629
lemma interval_bound_sing[simp]:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6630
  "interval_upperbound {a} = a"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6631
  "interval_lowerbound {a} = a"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6632
  unfolding interval_upperbound_def interval_lowerbound_def
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6633
  by (auto simp: euclidean_representation)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6634
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6635
lemma additive_tagged_division_1:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6636
  fixes f :: "real \<Rightarrow> 'a::real_normed_vector"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6637
  assumes "a \<le> b"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6638
    and "p tagged_division_of {a..b}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6639
  shows "setsum (\<lambda>(x,k). f(interval_upperbound k) - f(interval_lowerbound k)) p = f b - f a"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6640
proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6641
  let ?f = "(\<lambda>k::(real) set. if k = {} then 0 else f(interval_upperbound k) - f(interval_lowerbound k))"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6642
  have ***: "\<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6643
    using assms by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6644
  have *: "operative op + ?f"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6645
    unfolding operative_1_lt[OF monoidal_monoid] interval_eq_empty by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6646
  have **: "{a..b} \<noteq> {}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6647
    using assms(1) by auto note operative_tagged_division[OF monoidal_monoid * assms(2)]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  6648
  note * = this[unfolded if_not_P[OF **] interval_bounds[OF ***],symmetric]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6649
  show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6650
    unfolding *
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6651
    apply (subst setsum_iterate[symmetric])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6652
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6653
    apply (rule setsum_cong2)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6654
    unfolding split_paired_all split_conv
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6655
    using assms(2)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6656
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6657
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6658
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6659
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6660
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6661
subsection {* A useful lemma allowing us to factor out the content size. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6662
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6663
lemma has_integral_factor_content:
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6664
  "(f has_integral i) {a..b} \<longleftrightarrow>
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6665
    (\<forall>e>0. \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow>
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6666
      norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p - i) \<le> e * content {a..b}))"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6667
proof (cases "content {a..b} = 0")
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6668
  case True
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6669
  show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6670
    unfolding has_integral_null_eq[OF True]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6671
    apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6672
    apply (rule, rule, rule gauge_trivial, safe)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6673
    unfolding setsum_content_null[OF True] True
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6674
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6675
    apply (erule_tac x=1 in allE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6676
    apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6677
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6678
    apply (rule fine_division_exists[of _ a b])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6679
    apply assumption
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6680
    apply (erule_tac x=p in allE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6681
    unfolding setsum_content_null[OF True]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6682
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6683
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6684
next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6685
  case False
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6686
  note F = this[unfolded content_lt_nz[symmetric]]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6687
  let ?P = "\<lambda>e opp. \<exists>d. gauge d \<and>
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6688
    (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow> opp (norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i)) e)"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6689
  show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6690
    apply (subst has_integral)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6691
  proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6692
    fix e :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6693
    assume e: "e > 0"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6694
    {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6695
      assume "\<forall>e>0. ?P e op <"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6696
      then show "?P (e * content {a..b}) op \<le>"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6697
        apply (erule_tac x="e * content {a..b}" in allE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6698
        apply (erule impE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6699
        defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6700
        apply (erule exE,rule_tac x=d in exI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6701
        using F e
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6702
        apply (auto simp add:field_simps intro:mult_pos_pos)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6703
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6704
    }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6705
    {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6706
      assume "\<forall>e>0. ?P (e * content {a..b}) op \<le>"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6707
      then show "?P e op <"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6708
        apply (erule_tac x="e / 2 / content {a..b}" in allE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6709
        apply (erule impE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6710
        defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6711
        apply (erule exE,rule_tac x=d in exI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6712
        using F e
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6713
        apply (auto simp add: field_simps intro: mult_pos_pos)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6714
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6715
    }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6716
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6717
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6718
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6719
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6720
subsection {* Fundamental theorem of calculus. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6721
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6722
lemma interval_bounds_real:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6723
  fixes q b :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6724
  assumes "a \<le> b"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6725
  shows "interval_upperbound {a..b} = b"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6726
    and "interval_lowerbound {a..b} = a"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6727
  apply (rule_tac[!] interval_bounds)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6728
  using assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6729
  apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6730
  done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6731
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6732
lemma fundamental_theorem_of_calculus:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6733
  fixes f :: "real \<Rightarrow> 'a::banach"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6734
  assumes "a \<le> b"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6735
    and "\<forall>x\<in>{a..b}. (f has_vector_derivative f' x) (at x within {a..b})"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6736
  shows "(f' has_integral (f b - f a)) {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6737
  unfolding has_integral_factor_content
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6738
proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6739
  fix e :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6740
  assume e: "e > 0"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6741
  note assm = assms(2)[unfolded has_vector_derivative_def has_derivative_within_alt]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6742
  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"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6743
    using e by blast
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6744
  note this[OF assm,unfolded gauge_existence_lemma]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6745
  from choice[OF this,unfolded Ball_def[symmetric]] guess d ..
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6746
  note d=conjunctD2[OF this[rule_format],rule_format]
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  6747
  show "\<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow>
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6748
    norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b})"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6749
    apply (rule_tac x="\<lambda>x. ball x (d x)" in exI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6750
    apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6751
    apply (rule gauge_ball_dependent)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6752
    apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6753
    apply (rule d(1))
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6754
  proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6755
    fix p
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6756
    assume as: "p tagged_division_of {a..b}" "(\<lambda>x. ball x (d x)) fine p"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  6757
    show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  6758
      unfolding content_real[OF assms(1)] additive_tagged_division_1[OF assms(1) as(1),of f,symmetric]
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  6759
      unfolding additive_tagged_division_1[OF assms(1) as(1),of "\<lambda>x. x",symmetric]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6760
      unfolding setsum_right_distrib
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6761
      defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6762
      unfolding setsum_subtractf[symmetric]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6763
    proof (rule setsum_norm_le,safe)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6764
      fix x k
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6765
      assume "(x, k) \<in> p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6766
      note xk = tagged_division_ofD(2-4)[OF as(1) this]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6767
      from this(3) guess u v by (elim exE) note k=this
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6768
      have *: "u \<le> v"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6769
        using xk unfolding k by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6770
      have ball: "\<forall>xa\<in>k. xa \<in> ball x (d x)"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6771
        using as(2)[unfolded fine_def,rule_format,OF `(x,k)\<in>p`,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
  6772
      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
  6773
        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
  6774
        apply (rule order_trans[OF _ norm_triangle_ineq4])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6775
        apply (rule eq_refl)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6776
        apply (rule arg_cong[where f=norm])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6777
        unfolding scaleR_diff_left
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6778
        apply (auto simp add:algebra_simps)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6779
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6780
      also have "\<dots> \<le> e * norm (u - x) + e * norm (v - x)"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6781
        apply (rule add_mono)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6782
        apply (rule d(2)[of "x" "u",unfolded o_def])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6783
        prefer 4
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6784
        apply (rule d(2)[of "x" "v",unfolded o_def])
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  6785
        using ball[rule_format,of u] ball[rule_format,of v]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6786
        using xk(1-2)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6787
        unfolding k subset_eq
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6788
        apply (auto simp add:dist_real_def)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6789
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6790
      also have "\<dots> \<le> e * (interval_upperbound k - interval_lowerbound k)"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6791
        unfolding k interval_bounds_real[OF *]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6792
        using xk(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6793
        unfolding k
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6794
        by (auto simp add: dist_real_def field_simps)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6795
      finally show "norm (content k *\<^sub>R f' x - (f (interval_upperbound k) - f (interval_lowerbound k))) \<le>
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6796
        e * (interval_upperbound k - interval_lowerbound k)"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6797
        unfolding k interval_bounds_real[OF *] content_real[OF *] .
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6798
    qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6799
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6800
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6801
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6802
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6803
subsection {* Attempt a systematic general set of "offset" results for components. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6804
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6805
lemma gauge_modify:
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6806
  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
  6807
  shows "gauge (\<lambda>x. {y. f y \<in> d (f x)})"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6808
  using assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6809
  unfolding gauge_def
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6810
  apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6811
  defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6812
  apply (erule_tac x="f x" in allE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6813
  apply (erule_tac x="d (f x)" in allE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6814
  apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6815
  done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6816
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6817
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6818
subsection {* Only need trivial subintervals if the interval itself is trivial. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6819
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6820
lemma division_of_nontrivial:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6821
  fixes s :: "'a::ordered_euclidean_space set set"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6822
  assumes "s division_of {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6823
    and "content {a..b} \<noteq> 0"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6824
  shows "{k. k \<in> s \<and> content k \<noteq> 0} division_of {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6825
  using assms(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6826
  apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6827
proof (induct "card s" arbitrary: s rule: nat_less_induct)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6828
  fix s::"'a set set"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6829
  assume assm: "s division_of {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6830
    "\<forall>m<card s. \<forall>x. m = card x \<longrightarrow>
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6831
      x division_of {a..b} \<longrightarrow> {k \<in> x. content k \<noteq> 0} division_of {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6832
  note s = division_ofD[OF assm(1)]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6833
  let ?thesis = "{k \<in> s. content k \<noteq> 0} division_of {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6834
  {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6835
    presume *: "{k \<in> s. content k \<noteq> 0} \<noteq> s \<Longrightarrow> ?thesis"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6836
    show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6837
      apply cases
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6838
      defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6839
      apply (rule *)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6840
      apply assumption
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6841
      using assm(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6842
      apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6843
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6844
  }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6845
  assume noteq: "{k \<in> s. content k \<noteq> 0} \<noteq> s"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6846
  then obtain k where k: "k \<in> s" "content k = 0"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6847
    by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6848
  from s(4)[OF k(1)] guess c d by (elim exE) note k=k this
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6849
  from k have "card s > 0"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6850
    unfolding card_gt_0_iff using assm(1) by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6851
  then have card: "card (s - {k}) < card s"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6852
    using assm(1) k(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6853
    apply (subst card_Diff_singleton_if)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6854
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6855
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6856
  have *: "closed (\<Union>(s - {k}))"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6857
    apply (rule closed_Union)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6858
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6859
    apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6860
    apply (drule DiffD1,drule s(4))
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6861
    apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6862
    apply (rule closed_interval)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6863
    using assm(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6864
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6865
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6866
  have "k \<subseteq> \<Union>(s - {k})"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6867
    apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6868
    apply (rule *[unfolded closed_limpt,rule_format])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6869
    unfolding islimpt_approachable
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6870
  proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6871
    fix x
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6872
    fix e :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6873
    assume as: "x \<in> k" "e > 0"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  6874
    from k(2)[unfolded k content_eq_0] guess i ..
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6875
    then have i:"c\<bullet>i = d\<bullet>i" "i\<in>Basis"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6876
      using s(3)[OF k(1),unfolded k] unfolding interval_ne_empty by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6877
    then have xi: "x\<bullet>i = d\<bullet>i"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6878
      using as unfolding k mem_interval by (metis antisym)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6879
    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
  6880
      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
  6881
    show "\<exists>x'\<in>\<Union>(s - {k}). x' \<noteq> x \<and> dist x' x < e"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6882
      apply (rule_tac x=y in bexI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6883
    proof
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6884
      have "d \<in> {c..d}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6885
        using s(3)[OF k(1)]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6886
        unfolding k interval_eq_empty mem_interval
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6887
        by (fastforce simp add: not_less)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6888
      then have "d \<in> {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6889
        using s(2)[OF k(1)]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6890
        unfolding k
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6891
        by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6892
      note di = this[unfolded mem_interval,THEN bspec[where x=i]]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6893
      then have xyi: "y\<bullet>i \<noteq> x\<bullet>i"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6894
        unfolding y_def i xi
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6895
        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
  6896
        by (auto elim!: ballE[of _ _ i])
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6897
      then show "y \<noteq> x"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6898
        unfolding euclidean_eq_iff[where 'a='a] using i by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6899
      have *: "Basis = insert i (Basis - {i})"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6900
        using i by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6901
      have "norm (y - x) < e + setsum (\<lambda>i. 0) Basis"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6902
        apply (rule le_less_trans[OF norm_le_l1])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6903
        apply (subst *)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6904
        apply (subst setsum_insert)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6905
        prefer 3
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6906
        apply (rule add_less_le_mono)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6907
      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
  6908
        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
  6909
          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
  6910
        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
  6911
          unfolding y_def by (auto simp: inner_simps)
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6912
      qed auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6913
      then show "dist y x < e"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6914
        unfolding dist_norm by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6915
      have "y \<notin> k"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6916
        unfolding k mem_interval
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6917
        apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6918
        apply (erule_tac x=i in ballE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6919
        using xyi k i xi
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6920
        apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6921
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6922
      moreover
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6923
      have "y \<in> \<Union>s"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6924
        using set_rev_mp[OF as(1) s(2)[OF k(1)]] as(2) di i
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6925
        unfolding s mem_interval 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
  6926
        by (auto simp: field_simps elim!: ballE[of _ _ i])
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6927
      ultimately
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6928
      show "y \<in> \<Union>(s - {k})" by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6929
    qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6930
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6931
  then have "\<Union>(s - {k}) = {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6932
    unfolding s(6)[symmetric] by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6933
  then have  "{ka \<in> s - {k}. content ka \<noteq> 0} division_of {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6934
    apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6935
    apply (rule assm(2)[rule_format,OF card refl])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6936
    apply (rule division_ofI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6937
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6938
    apply (rule_tac[1-4] s)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6939
    using assm(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6940
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6941
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6942
  moreover
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6943
  have "{ka \<in> s - {k}. content ka \<noteq> 0} = {k \<in> s. content k \<noteq> 0}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6944
    using k by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6945
  ultimately show ?thesis by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6946
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6947
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6948
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
  6949
subsection {* Integrability on subintervals. *}
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6950
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6951
lemma operative_integrable:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6952
  fixes f :: "'b::ordered_euclidean_space \<Rightarrow> 'a::banach"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6953
  shows "operative op \<and> (\<lambda>i. f integrable_on i)"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6954
  unfolding operative_def neutral_and
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6955
  apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6956
  apply (subst integrable_on_def)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6957
  unfolding has_integral_null_eq
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6958
  apply (rule, rule refl)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6959
  apply (rule, assumption, assumption)+
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6960
  unfolding integrable_on_def
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6961
  by (auto intro!: has_integral_split)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6962
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6963
lemma integrable_subinterval:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6964
  fixes f :: "'b::ordered_euclidean_space \<Rightarrow> 'a::banach"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6965
  assumes "f integrable_on {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6966
    and "{c..d} \<subseteq> {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6967
  shows "f integrable_on {c..d}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6968
  apply (cases "{c..d} = {}")
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6969
  defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6970
  apply (rule partial_division_extend_1[OF assms(2)],assumption)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6971
  using operative_division_and[OF operative_integrable,symmetric,of _ _ _ f] assms(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6972
  apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6973
  done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6974
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6975
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6976
subsection {* Combining adjacent intervals in 1 dimension. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6977
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6978
lemma has_integral_combine:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6979
  fixes a b c :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6980
  assumes "a \<le> c"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6981
    and "c \<le> b"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6982
    and "(f has_integral i) {a..c}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6983
    and "(f has_integral (j::'a::banach)) {c..b}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  6984
  shows "(f has_integral (i + j)) {a..b}"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6985
proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6986
  note operative_integral[of f, unfolded operative_1_le[OF monoidal_lifted[OF monoidal_monoid]]]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6987
  note conjunctD2[OF this,rule_format]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6988
  note * = this(2)[OF conjI[OF assms(1-2)],unfolded if_P[OF assms(3)]]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6989
  then have "f integrable_on {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6990
    apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6991
    apply (rule ccontr)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6992
    apply (subst(asm) if_P)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6993
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6994
    apply (subst(asm) if_P)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6995
    using assms(3-)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6996
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6997
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6998
  with *
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  6999
  show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7000
    apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7001
    apply (subst(asm) if_P)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7002
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7003
    apply (subst(asm) if_P)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7004
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7005
    apply (subst(asm) if_P)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7006
    unfolding lifted.simps
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7007
    using assms(3-)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7008
    apply (auto simp add: integrable_on_def integral_unique)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7009
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7010
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7011
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7012
lemma integral_combine:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7013
  fixes f :: "real \<Rightarrow> 'a::banach"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7014
  assumes "a \<le> c"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7015
    and "c \<le> b"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7016
    and "f integrable_on {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7017
  shows "integral {a..c} f + integral {c..b} f = integral {a..b} f"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7018
  apply (rule integral_unique[symmetric])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7019
  apply (rule has_integral_combine[OF assms(1-2)])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7020
  apply (rule_tac[!] integrable_integral integrable_subinterval[OF assms(3)])+
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7021
  using assms(1-2)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7022
  apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7023
  done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7024
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7025
lemma integrable_combine:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7026
  fixes f :: "real \<Rightarrow> 'a::banach"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7027
  assumes "a \<le> c"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7028
    and "c \<le> b"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7029
    and "f integrable_on {a..c}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7030
    and "f integrable_on {c..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7031
  shows "f integrable_on {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7032
  using assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7033
  unfolding integrable_on_def
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7034
  by (fastforce intro!:has_integral_combine)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7035
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7036
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7037
subsection {* Reduce integrability to "local" integrability. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7038
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7039
lemma integrable_on_little_subintervals:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7040
  fixes f :: "'b::ordered_euclidean_space \<Rightarrow> 'a::banach"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7041
  assumes "\<forall>x\<in>{a..b}. \<exists>d>0. \<forall>u v. x \<in> {u..v} \<and> {u..v} \<subseteq> ball x d \<and> {u..v} \<subseteq> {a..b} \<longrightarrow>
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7042
    f integrable_on {u..v}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7043
  shows "f integrable_on {a..b}"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7044
proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7045
  have "\<forall>x. \<exists>d. x\<in>{a..b} \<longrightarrow> d>0 \<and> (\<forall>u v. x \<in> {u..v} \<and> {u..v} \<subseteq> ball x d \<and> {u..v} \<subseteq> {a..b} \<longrightarrow>
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7046
    f integrable_on {u..v})"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7047
    using assms by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7048
  note this[unfolded gauge_existence_lemma]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7049
  from choice[OF this] guess d .. note d=this[rule_format]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7050
  guess p
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7051
    apply (rule fine_division_exists[OF gauge_ball_dependent,of d a b])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7052
    using d
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7053
    by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7054
  note p=this(1-2)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7055
  note division_of_tagged_division[OF this(1)]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7056
  note * = operative_division_and[OF operative_integrable,OF this,symmetric,of f]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7057
  show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7058
    unfolding *
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7059
    apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7060
    unfolding snd_conv
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7061
  proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7062
    fix x k
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7063
    assume "(x, k) \<in> p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7064
    note tagged_division_ofD(2-4)[OF p(1) this] fineD[OF p(2) this]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7065
    then show "f integrable_on k"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7066
      apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7067
      apply (rule d[THEN conjunct2,rule_format,of x])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7068
      apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7069
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7070
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7071
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7072
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7073
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7074
subsection {* Second FCT or existence of antiderivative. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7075
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7076
lemma integrable_const[intro]: "(\<lambda>x. c) integrable_on {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7077
  unfolding integrable_on_def
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7078
  apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7079
  apply (rule has_integral_const)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7080
  done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7081
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7082
lemma integral_has_vector_derivative:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7083
  fixes f :: "real \<Rightarrow> 'a::banach"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7084
  assumes "continuous_on {a..b} f"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7085
    and "x \<in> {a..b}"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  7086
  shows "((\<lambda>u. integral {a..u} f) has_vector_derivative f(x)) (at x within {a..b})"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7087
  unfolding has_vector_derivative_def has_derivative_within_alt
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7088
  apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7089
  apply (rule bounded_linear_scaleR_left)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7090
proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7091
  fix e :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7092
  assume e: "e > 0"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  7093
  note compact_uniformly_continuous[OF assms(1) compact_interval,unfolded uniformly_continuous_on_def]
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7094
  from this[rule_format,OF e] guess d by (elim conjE exE) note d=this[rule_format]
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  7095
  let ?I = "\<lambda>a b. integral {a..b} f"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7096
  show "\<exists>d>0. \<forall>y\<in>{a..b}. norm (y - x) < d \<longrightarrow>
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7097
    norm (?I a y - ?I a x - (y - x) *\<^sub>R f x) \<le> e * norm (y - x)"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7098
  proof (rule, rule, rule d, safe)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7099
    case goal1
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7100
    show ?case
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7101
    proof (cases "y < x")
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7102
      case False
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7103
      have "f integrable_on {a..y}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7104
        apply (rule integrable_subinterval,rule integrable_continuous)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7105
        apply (rule assms)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7106
        unfolding not_less
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7107
        using assms(2) goal1
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7108
        apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7109
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7110
      then have *: "?I a y - ?I a x = ?I x y"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7111
        unfolding algebra_simps
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7112
        apply (subst eq_commute)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7113
        apply (rule integral_combine)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7114
        using False
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7115
        unfolding not_less
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7116
        using assms(2) goal1
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7117
        apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7118
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7119
      have **: "norm (y - x) = content {x..y}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7120
        apply (subst content_real)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7121
        using False
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7122
        unfolding not_less
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7123
        apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7124
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7125
      show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7126
        unfolding **
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7127
        apply (rule has_integral_bound[where f="(\<lambda>u. f u - f x)"])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7128
        unfolding *
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7129
        unfolding o_def
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7130
        defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7131
        apply (rule has_integral_sub)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7132
        apply (rule integrable_integral)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7133
        apply (rule integrable_subinterval)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7134
        apply (rule integrable_continuous)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7135
        apply (rule assms)+
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7136
      proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7137
        show "{x..y} \<subseteq> {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7138
          using goal1 assms(2) by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7139
        have *: "y - x = norm (y - x)"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7140
          using False by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7141
        show "((\<lambda>xa. f x) has_integral (y - x) *\<^sub>R f x) {x.. y}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7142
          apply (subst *)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7143
          unfolding **
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7144
          apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7145
          done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7146
        show "\<forall>xa\<in>{x..y}. norm (f xa - f x) \<le> e"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7147
          apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7148
          apply (rule less_imp_le)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7149
          apply (rule d(2)[unfolded dist_norm])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7150
          using assms(2)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7151
          using goal1
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7152
          apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7153
          done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7154
      qed (insert e, auto)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7155
    next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7156
      case True
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7157
      have "f integrable_on {a..x}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7158
        apply (rule integrable_subinterval,rule integrable_continuous)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7159
        apply (rule assms)+
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7160
        unfolding not_less
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7161
        using assms(2) goal1
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7162
        apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7163
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7164
      then have *: "?I a x - ?I a y = ?I y x"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7165
        unfolding algebra_simps
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7166
        apply (subst eq_commute)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7167
        apply (rule integral_combine)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7168
        using True using assms(2) goal1
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7169
        apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7170
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7171
      have **: "norm (y - x) = content {y..x}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7172
        apply (subst content_real)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7173
        using True
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7174
        unfolding not_less
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7175
        apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7176
        done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7177
      have ***: "\<And>fy fx c::'a. fx - fy - (y - x) *\<^sub>R c = -(fy - fx - (x - y) *\<^sub>R c)"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7178
        unfolding scaleR_left.diff by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7179
      show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7180
        apply (subst ***)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7181
        unfolding norm_minus_cancel **
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7182
        apply (rule has_integral_bound[where f="(\<lambda>u. f u - f x)"])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7183
        unfolding *
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7184
        unfolding o_def
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7185
        defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7186
        apply (rule has_integral_sub)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7187
        apply (subst minus_minus[symmetric])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7188
        unfolding minus_minus
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7189
        apply (rule integrable_integral)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7190
        apply (rule integrable_subinterval,rule integrable_continuous)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7191
        apply (rule assms)+
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7192
      proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7193
        show "{y..x} \<subseteq> {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7194
          using goal1 assms(2) by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7195
        have *: "x - y = norm (y - x)"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7196
          using True by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7197
        show "((\<lambda>xa. f x) has_integral (x - y) *\<^sub>R f x) {y..x}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7198
          apply (subst *)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7199
          unfolding **
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7200
          apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7201
          done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7202
        show "\<forall>xa\<in>{y..x}. norm (f xa - f x) \<le> e"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7203
          apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7204
          apply (rule less_imp_le)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7205
          apply (rule d(2)[unfolded dist_norm])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7206
          using assms(2)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7207
          using goal1
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7208
          apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7209
          done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7210
      qed (insert e, auto)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7211
    qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7212
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7213
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7214
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7215
lemma antiderivative_continuous:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7216
  fixes q b :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7217
  assumes "continuous_on {a..b} f"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7218
  obtains g where "\<forall>x\<in> {a..b}. (g has_vector_derivative (f x::_::banach)) (at x within {a..b})"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7219
  apply (rule that)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7220
  apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7221
  using integral_has_vector_derivative[OF assms]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7222
  apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7223
  done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7224
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7225
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7226
subsection {* Combined fundamental theorem of calculus. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7227
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7228
lemma antiderivative_integral_continuous:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7229
  fixes f :: "real \<Rightarrow> 'a::banach"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7230
  assumes "continuous_on {a..b} f"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  7231
  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
  7232
proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7233
  from antiderivative_continuous[OF assms] guess g . note g=this
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7234
  show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7235
    apply (rule that[of g])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7236
  proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7237
    case goal1
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7238
    have "\<forall>x\<in>{u..v}. (g has_vector_derivative f x) (at x within {u..v})"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7239
      apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7240
      apply (rule has_vector_derivative_within_subset)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7241
      apply (rule g[rule_format])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7242
      using goal1(1-2)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7243
      apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7244
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7245
    then show ?case
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7246
      using fundamental_theorem_of_calculus[OF goal1(3),of "g" "f"] by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7247
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7248
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7249
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7250
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7251
subsection {* General "twiddling" for interval-to-interval function image. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7252
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7253
lemma has_integral_twiddle:
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7254
  assumes "0 < r"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7255
    and "\<forall>x. h(g x) = x"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7256
    and "\<forall>x. g(h x) = x"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7257
    and "\<forall>x. continuous (at x) g"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7258
    and "\<forall>u v. \<exists>w z. g ` {u..v} = {w..z}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7259
    and "\<forall>u v. \<exists>w z. h ` {u..v} = {w..z}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7260
    and "\<forall>u v. content(g ` {u..v}) = r * content {u..v}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7261
    and "(f has_integral i) {a..b}"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7262
  shows "((\<lambda>x. f(g x)) has_integral (1 / r) *\<^sub>R i) (h ` {a..b})"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7263
proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7264
  {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7265
    presume *: "{a..b} \<noteq> {} \<Longrightarrow> ?thesis"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7266
    show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7267
      apply cases
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7268
      defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7269
      apply (rule *)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7270
      apply assumption
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7271
    proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7272
      case goal1
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7273
      then show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7274
        unfolding goal1 assms(8)[unfolded goal1 has_integral_empty_eq] by auto qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7275
  }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7276
  assume "{a..b} \<noteq> {}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7277
  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
  7278
  have inj: "inj g" "inj h"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7279
    unfolding inj_on_def
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7280
    apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7281
    apply(rule_tac[!] ccontr)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7282
    using assms(2)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7283
    apply(erule_tac x=x in allE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7284
    using assms(2)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7285
    apply(erule_tac x=y in allE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7286
    defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7287
    using assms(3)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7288
    apply (erule_tac x=x in allE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7289
    using assms(3)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7290
    apply(erule_tac x=y in allE)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7291
    apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7292
    done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7293
  show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7294
    unfolding has_integral_def has_integral_compact_interval_def
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7295
    apply (subst if_P)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7296
    apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7297
    apply rule
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7298
    apply (rule wz)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7299
  proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7300
    fix e :: real
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7301
    assume e: "e > 0"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7302
    then have "e * r > 0"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7303
      using assms(1) by (rule mult_pos_pos)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7304
    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
  7305
    def d' \<equiv> "\<lambda>x. {y. g y \<in> d (g x)}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7306
    have d': "\<And>x. d' x = {y. g y \<in> (d (g x))}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7307
      unfolding d'_def ..
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7308
    show "\<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of h ` {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
  7309
    proof (rule_tac x=d' in exI, safe)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7310
      show "gauge d'"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7311
        using d(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7312
        unfolding gauge_def d'
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7313
        using continuous_open_preimage_univ[OF assms(4)]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7314
        by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7315
      fix p
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7316
      assume as: "p tagged_division_of h ` {a..b}" "d' fine p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7317
      note p = tagged_division_ofD[OF as(1)]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7318
      have "(\<lambda>(x, k). (g x, g ` k)) ` p tagged_division_of {a..b} \<and> d fine (\<lambda>(x, k). (g x, g ` k)) ` p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7319
        unfolding tagged_division_of
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7320
      proof safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7321
        show "finite ((\<lambda>(x, k). (g x, g ` k)) ` p)"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7322
          using as by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7323
        show "d fine (\<lambda>(x, k). (g x, g ` k)) ` p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7324
          using as(2) unfolding fine_def d' by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7325
        fix x k
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7326
        assume xk[intro]: "(x, k) \<in> p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7327
        show "g x \<in> g ` k"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7328
          using p(2)[OF xk] by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7329
        show "\<exists>u v. g ` k = {u..v}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7330
          using p(4)[OF xk] using assms(5-6) by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7331
        {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7332
          fix y
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7333
          assume "y \<in> k"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7334
          then show "g y \<in> {a..b}" "g y \<in> {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7335
            using p(3)[OF xk,unfolded subset_eq,rule_format,of "h (g y)"]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7336
            using assms(2)[rule_format,of y]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7337
            unfolding inj_image_mem_iff[OF inj(2)]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7338
            by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7339
        }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7340
        fix x' k'
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7341
        assume xk': "(x', k') \<in> p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7342
        fix z
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7343
        assume "z \<in> interior (g ` k)" and "z \<in> interior (g ` k')"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7344
        then have *: "interior (g ` k) \<inter> interior (g ` k') \<noteq> {}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7345
          by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7346
        have same: "(x, k) = (x', k')"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7347
          apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7348
          apply (rule ccontr,drule p(5)[OF xk xk'])
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7349
        proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7350
          assume as: "interior k \<inter> interior k' = {}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7351
          from nonempty_witness[OF *] guess z .
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7352
          then have "z \<in> g ` (interior k \<inter> interior k')"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7353
            using interior_image_subset[OF assms(4) inj(1)]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7354
            unfolding image_Int[OF inj(1)]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7355
            by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7356
          then show False
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7357
            using as by blast
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7358
        qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7359
        then show "g x = g x'"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7360
          by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7361
        {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7362
          fix z
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7363
          assume "z \<in> k"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7364
          then show "g z \<in> g ` k'"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7365
            using same by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7366
        }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7367
        {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7368
          fix z
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7369
          assume "z \<in> k'"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7370
          then show "g z \<in> g ` k"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7371
            using same by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7372
        }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7373
      next
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7374
        fix x
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7375
        assume "x \<in> {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7376
        then have "h x \<in>  \<Union>{k. \<exists>x. (x, k) \<in> p}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7377
          using p(6) by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7378
        then guess X unfolding Union_iff .. note X=this
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7379
        from this(1) guess y unfolding mem_Collect_eq ..
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7380
        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
  7381
          apply -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7382
          apply (rule_tac X="g ` X" in UnionI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7383
          defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7384
          apply (rule_tac x="h x" in image_eqI)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7385
          using X(2) assms(3)[rule_format,of x]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7386
          apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7387
          done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7388
      qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7389
        note ** = d(2)[OF this]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7390
        have *: "inj_on (\<lambda>(x, k). (g x, g ` k)) p"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7391
          using inj(1) unfolding inj_on_def by fastforce
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7392
        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 = _")
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7393
          unfolding algebra_simps add_left_cancel
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7394
          unfolding setsum_reindex[OF *]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7395
          apply (subst scaleR_right.setsum)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7396
          defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7397
          apply (rule setsum_cong2)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7398
          unfolding o_def split_paired_all split_conv
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7399
          apply (drule p(4))
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7400
          apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7401
          unfolding assms(7)[rule_format]
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7402
          using p
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7403
          apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7404
          done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7405
      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
  7406
        unfolding scaleR_diff_right scaleR_scaleR
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7407
        using assms(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7408
        by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7409
      finally have *: "?l = ?r" .
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7410
      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
  7411
        using **
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7412
        unfolding *
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7413
        unfolding norm_scaleR
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7414
        using assms(1)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7415
        by (auto simp add:field_simps)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7416
    qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7417
  qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7418
qed
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7419
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7420
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7421
subsection {* Special case of a basic affine transformation. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7422
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7423
lemma interval_image_affinity_interval:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7424
  "\<exists>u v. (\<lambda>x. m *\<^sub>R (x::'a::ordered_euclidean_space) + c) ` {a..b} = {u..v}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7425
  unfolding image_affinity_interval
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7426
  by auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7427
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7428
lemma setprod_cong2:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7429
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x = g x"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7430
  shows "setprod f A = setprod g A"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7431
  apply (rule setprod_cong)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7432
  using assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7433
  apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7434
  done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7435
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  7436
lemma content_image_affinity_interval:
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7437
  "content((\<lambda>x::'a::ordered_euclidean_space. m *\<^sub>R x + c) ` {a..b}) =
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7438
    abs m ^ DIM('a) * content {a..b}" (is "?l = ?r")
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7439
proof -
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7440
  {
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7441
    presume *: "{a..b} \<noteq> {} \<Longrightarrow> ?thesis"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7442
    show ?thesis
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7443
      apply cases
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7444
      apply (rule *)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7445
      apply assumption
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7446
      unfolding not_not
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7447
      using content_empty
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7448
      apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7449
      done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7450
  }
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7451
  assume as: "{a..b} \<noteq> {}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  7452
  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
  7453
  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
  7454
    case True
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  7455
    with as have "{m *\<^sub>R a + c..m *\<^sub>R b + c} \<noteq> {}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  7456
      unfolding interval_ne_empty
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  7457
      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
  7458
      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
  7459
      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
  7460
      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
  7461
    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
  7462
      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
  7463
    ultimately 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
  7464
      by (simp add: image_affinity_interval True content_closed_interval'
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7465
        setprod_timesf 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
  7466
  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
  7467
    case False
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  7468
    with as have "{m *\<^sub>R b + c..m *\<^sub>R a + c} \<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
  7469
      unfolding interval_ne_empty
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  7470
      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
  7471
      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
  7472
      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
  7473
      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
  7474
    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
  7475
      by (simp add: inner_simps field_simps)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  7476
    ultimately show ?thesis using 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
  7477
      by (simp add: image_affinity_interval content_closed_interval'
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7478
        setprod_timesf[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
  7479
  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
  7480
qed
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7481
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7482
lemma has_integral_affinity:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7483
  fixes a :: "'a::ordered_euclidean_space"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7484
  assumes "(f has_integral i) {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7485
    and "m \<noteq> 0"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  7486
  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)) ` {a..b})"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7487
  apply (rule has_integral_twiddle)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7488
  apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7489
  apply (rule zero_less_power)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7490
  unfolding euclidean_eq_iff[where 'a='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
  7491
  unfolding scaleR_right_distrib inner_simps scaleR_scaleR
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7492
  defer
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7493
  apply (insert assms(2))
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7494
  apply (simp add: field_simps)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7495
  apply (insert assms(2))
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7496
  apply (simp add: field_simps)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7497
  apply (rule continuous_intros)+
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7498
  apply (rule interval_image_affinity_interval)+
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7499
  apply (rule content_image_affinity_interval)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7500
  using assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7501
  apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7502
  done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7503
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7504
lemma integrable_affinity:
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7505
  assumes "f integrable_on {a..b}"
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7506
    and "m \<noteq> 0"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7507
  shows "(\<lambda>x. f(m *\<^sub>R x + c)) integrable_on ((\<lambda>x. (1 / m) *\<^sub>R x + -((1/m) *\<^sub>R c)) ` {a..b})"
53520
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7508
  using assms
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7509
  unfolding integrable_on_def
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7510
  apply safe
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7511
  apply (drule has_integral_affinity)
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7512
  apply auto
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7513
  done
29af7bb89757 tuned proofs;
wenzelm
parents: 53495
diff changeset
  7514
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7515
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7516
subsection {* Special case of stretching coordinate axes separately. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7517
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7518
lemma image_stretch_interval:
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
  7519
  "(\<lambda>x. \<Sum>k\<in>Basis. (m k * (x\<bullet>k)) *\<^sub>R k) ` {a..b::'a::ordered_euclidean_space} =
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  7520
  (if {a..b} = {} then {} else
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  7521
    {(\<Sum>k\<in>Basis. (min (m k * (a\<bullet>k)) (m k * (b\<bullet>k))) *\<^sub>R k)::'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
  7522
     (\<Sum>k\<in>Basis. (max (m k * (a\<bullet>k)) (m k * (b\<bullet>k))) *\<^sub>R 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
  7523
proof cases
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  7524
  assume *: "{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
  7525
  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
  7526
    unfolding interval_ne_empty if_not_P[OF *]
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  7527
    apply (simp add: interval image_Collect set_eq_iff euclidean_eq_iff[where 'a='a] ball_conj_distrib[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
  7528
    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
  7529
  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
  7530
    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
  7531
    with * have a_le_b: "a \<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
  7532
      unfolding interval_ne_empty 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
  7533
    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
  7534
        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
  7535
    proof (cases "m i = 0")
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  7536
      case True
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  7537
      with a_le_b show ?thesis by auto
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  7538
    next
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  7539
      case False
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  7540
      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
  7541
        by (auto simp add: field_simps)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  7542
      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
  7543
          "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
  7544
          "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
  7545
        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
  7546
      with False show ?thesis using a_le_b
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  7547
        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
  7548
    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
  7549
  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
  7550
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
  7551
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  7552
lemma interval_image_stretch_interval:
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7553
  "\<exists>u v. (\<lambda>x. \<Sum>k\<in>Basis. (m k * (x\<bullet>k))*\<^sub>R k) ` {a..b::'a::ordered_euclidean_space} = {u..v::'a}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  7554
  unfolding image_stretch_interval by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7555
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7556
lemma content_image_stretch_interval:
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7557
  "content ((\<lambda>x::'a::ordered_euclidean_space. (\<Sum>k\<in>Basis. (m k * (x\<bullet>k))*\<^sub>R k)::'a) ` {a..b}) =
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7558
    abs (setprod m Basis) * content {a..b}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7559
proof (cases "{a..b} = {}")
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7560
  case True
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7561
  then show ?thesis
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7562
    unfolding content_def image_is_empty image_stretch_interval if_P[OF True] by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7563
next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7564
  case False
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7565
  then have "(\<lambda>x. (\<Sum>k\<in>Basis. (m k * (x\<bullet>k))*\<^sub>R k)) ` {a..b} \<noteq> {}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7566
    by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7567
  then show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7568
    using False
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7569
    unfolding content_def image_stretch_interval
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7570
    apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7571
    unfolding interval_bounds' if_not_P
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7572
    unfolding abs_setprod setprod_timesf[symmetric]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7573
    apply (rule setprod_cong2)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7574
    unfolding lessThan_iff
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7575
    apply (simp only: inner_setsum_left_Basis)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7576
  proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7577
    fix i :: 'a
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7578
    assume i: "i \<in> Basis"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7579
    have "(m i < 0 \<or> m i > 0) \<or> m i = 0"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7580
      by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7581
    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
  7582
      \<bar>m i\<bar> * (b \<bullet> i - a \<bullet> i)"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7583
      apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7584
      apply (erule disjE)+
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7585
      unfolding min_def max_def
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7586
      using False[unfolded interval_ne_empty,rule_format,of i] i
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7587
      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
  7588
      done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7589
  qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7590
qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7591
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7592
lemma has_integral_stretch:
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7593
  fixes f :: "'a::ordered_euclidean_space \<Rightarrow> 'b::real_normed_vector"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7594
  assumes "(f has_integral i) {a..b}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7595
    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
  7596
  shows "((\<lambda>x. f (\<Sum>k\<in>Basis. (m k * (x\<bullet>k))*\<^sub>R k)) has_integral
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7597
    ((1/(abs(setprod m Basis))) *\<^sub>R i)) ((\<lambda>x. (\<Sum>k\<in>Basis. (1 / m k * (x\<bullet>k))*\<^sub>R k)) ` {a..b})"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7598
  apply (rule has_integral_twiddle[where f=f])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7599
  unfolding zero_less_abs_iff content_image_stretch_interval
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7600
  unfolding image_stretch_interval empty_as_interval euclidean_eq_iff[where 'a='a]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7601
  using assms
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7602
proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7603
  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
  7604
    apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7605
    apply (rule linear_continuous_at)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7606
    unfolding linear_linear
53600
8fda7ad57466 make 'linear' into a sublocale of 'bounded_linear';
huffman
parents: 53597
diff changeset
  7607
    unfolding linear_iff inner_simps euclidean_eq_iff[where 'a='a]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7608
    apply (auto simp add: field_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7609
    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
  7610
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
  7611
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7612
lemma integrable_stretch:
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7613
  fixes f :: "'a::ordered_euclidean_space \<Rightarrow> 'b::real_normed_vector"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7614
  assumes "f integrable_on {a..b}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7615
    and "\<forall>k\<in>Basis. m k \<noteq> 0"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7616
  shows "(\<lambda>x::'a. f (\<Sum>k\<in>Basis. (m k * (x\<bullet>k))*\<^sub>R k)) integrable_on
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7617
    ((\<lambda>x. \<Sum>k\<in>Basis. (1 / m k * (x\<bullet>k))*\<^sub>R k) ` {a..b})"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7618
  using assms
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7619
  unfolding integrable_on_def
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7620
  apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7621
  apply (erule exE)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7622
  apply (drule has_integral_stretch)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7623
  apply assumption
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7624
  apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7625
  done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7626
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7627
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7628
subsection {* even more special cases. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7629
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7630
lemma uminus_interval_vector[simp]:
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7631
  fixes a b :: "'a::ordered_euclidean_space"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7632
  shows "uminus ` {a..b} = {-b..-a}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7633
  apply (rule set_eqI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7634
  apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7635
  defer
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7636
  unfolding image_iff
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7637
  apply (rule_tac x="-x" in bexI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7638
  apply (auto simp add:minus_le_iff le_minus_iff eucl_le[where 'a='a])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7639
  done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7640
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7641
lemma has_integral_reflect_lemma[intro]:
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7642
  assumes "(f has_integral i) {a..b}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7643
  shows "((\<lambda>x. f(-x)) has_integral i) {-b..-a}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7644
  using has_integral_affinity[OF assms, of "-1" 0]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7645
  by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7646
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7647
lemma has_integral_reflect[simp]:
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7648
  "((\<lambda>x. f (-x)) has_integral i) {-b..-a} \<longleftrightarrow> (f has_integral i) {a..b}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7649
  apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7650
  apply (drule_tac[!] has_integral_reflect_lemma)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7651
  apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7652
  done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7653
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7654
lemma integrable_reflect[simp]: "(\<lambda>x. f(-x)) integrable_on {-b..-a} \<longleftrightarrow> f integrable_on {a..b}"
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7655
  unfolding integrable_on_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7656
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7657
lemma integral_reflect[simp]: "integral {-b..-a} (\<lambda>x. f (-x)) = integral {a..b} f"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7658
  unfolding integral_def by auto
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7659
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7660
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7661
subsection {* Stronger form of FCT; quite a tedious proof. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7662
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7663
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
  7664
  by (meson zero_less_one)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7665
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7666
lemma additive_tagged_division_1':
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7667
  fixes f :: "real \<Rightarrow> 'a::real_normed_vector"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7668
  assumes "a \<le> b"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7669
    and "p tagged_division_of {a..b}"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  7670
  shows "setsum (\<lambda>(x,k). f (interval_upperbound k) - f(interval_lowerbound k)) p = f b - f a"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7671
  using additive_tagged_division_1[OF _ assms(2), of f]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7672
  using assms(1)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7673
  by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7674
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7675
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
  7676
  by (simp add: split_def)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7677
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7678
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
  7679
  apply (subst(asm)(2) norm_minus_cancel[symmetric])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7680
  apply (drule norm_triangle_le)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7681
  apply (auto simp add: algebra_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7682
  done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7683
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7684
lemma fundamental_theorem_of_calculus_interior:
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7685
  fixes f :: "real \<Rightarrow> 'a::real_normed_vector"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7686
  assumes "a \<le> b"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7687
    and "continuous_on {a..b} f"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7688
    and "\<forall>x\<in>{a<..<b}. (f has_vector_derivative f'(x)) (at 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
  7689
  shows "(f' has_integral (f b - f a)) {a..b}"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7690
proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7691
  {
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7692
    presume *: "a < b \<Longrightarrow> ?thesis"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7693
    show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7694
    proof (cases "a < b")
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7695
      case True
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7696
      then show ?thesis by (rule *)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7697
    next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7698
      case False
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7699
      then have "a = b"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7700
        using assms(1) by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7701
      then have *: "{a .. b} = {b}" "f b - f a = 0"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7702
        by (auto simp add:  order_antisym)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7703
      show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7704
        unfolding *(2)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7705
        apply (rule has_integral_null)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7706
        unfolding content_eq_0
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7707
        using * `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
  7708
        by (auto simp: ex_in_conv)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7709
    qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7710
  }
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7711
  assume ab: "a < b"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  7712
  let ?P = "\<lambda>e. \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow>
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7713
    norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b})"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7714
  { presume "\<And>e. e > 0 \<Longrightarrow> ?P e" then show ?thesis unfolding has_integral_factor_content by auto }
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7715
  fix e :: real
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7716
  assume e: "e > 0"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7717
  note assms(3)[unfolded has_vector_derivative_def has_derivative_at_alt ball_conj_distrib]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7718
  note conjunctD2[OF this]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7719
  note bounded=this(1) and this(2)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7720
  from this(2) have "\<forall>x\<in>{a<..<b}. \<exists>d>0. \<forall>y. norm (y - x) < d \<longrightarrow>
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7721
    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
  7722
    apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7723
    apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7724
    apply (erule_tac x=x in ballE)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7725
    apply (erule_tac x="e/2" in allE)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7726
    using e
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7727
    apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7728
    done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7729
  note this[unfolded bgauge_existence_lemma]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7730
  from choice[OF this] guess d ..
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7731
  note conjunctD2[OF this[rule_format]]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7732
  note d = this[rule_format]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7733
  have "bounded (f ` {a..b})"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7734
    apply (rule compact_imp_bounded compact_continuous_image)+
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7735
    using compact_interval assms
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7736
    apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7737
    done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7738
  from this[unfolded bounded_pos] guess B .. note B = this[rule_format]
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7739
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7740
  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>
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7741
    norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> (e * (b - a)) / 4)"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7742
  proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7743
    have "a \<in> {a..b}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7744
      using ab by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7745
    note assms(2)[unfolded continuous_on_eq_continuous_within,rule_format,OF this]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7746
    note * = this[unfolded continuous_within Lim_within,rule_format]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7747
    have "(e * (b - a)) / 8 > 0"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7748
      using e ab by (auto simp add: field_simps)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7749
    from *[OF this] guess k .. note k = conjunctD2[OF this,rule_format]
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7750
    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
  7751
    proof (cases "f' a = 0")
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7752
      case True
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7753
      then show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7754
        apply (rule_tac x=1 in exI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7755
        using ab e
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7756
        apply (auto intro!:mult_nonneg_nonneg)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7757
        done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7758
    next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7759
      case False
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7760
      then show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7761
        apply (rule_tac x="(e * (b - a)) / 8 / norm (f' a)" in exI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7762
        using ab e
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7763
        apply (auto simp add: field_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7764
        done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7765
    qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7766
    then guess l .. note l = conjunctD2[OF this]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7767
    show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7768
      apply (rule_tac x="min k l" in exI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7769
      apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7770
      unfolding min_less_iff_conj
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7771
      apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7772
      apply (rule l k)+
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7773
    proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7774
      fix c
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7775
      assume as: "a \<le> c" "{a..c} \<subseteq> {a..b}" "{a..c} \<subseteq> ball a (min k l)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7776
      note as' = this[unfolded subset_eq Ball_def mem_ball dist_real_def mem_interval]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7777
      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
  7778
        by (rule norm_triangle_ineq4)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7779
      also have "\<dots> \<le> e * (b - a) / 8 + e * (b - a) / 8"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7780
      proof (rule add_mono)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7781
        case goal1
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7782
        have "\<bar>c - a\<bar> \<le> \<bar>l\<bar>"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7783
          using as' by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7784
        then show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7785
          apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7786
          apply (rule order_trans[OF _ l(2)])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7787
          unfolding norm_scaleR
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7788
          apply (rule mult_right_mono)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7789
          apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7790
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7791
      next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7792
        case goal2
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7793
        show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7794
          apply (rule less_imp_le)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7795
          apply (cases "a = c")
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7796
          defer
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7797
          apply (rule k(2)[unfolded dist_norm])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7798
          using as' e ab
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7799
          apply (auto simp add: field_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7800
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7801
      qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7802
      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
  7803
        unfolding content_real[OF as(1)] by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7804
    qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7805
  qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7806
  then guess da .. note da=conjunctD2[OF this,rule_format]
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7807
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  7808
  have "\<exists>db>0. \<forall>c\<le>b. {c..b} \<subseteq> {a..b} \<and> {c..b} \<subseteq> ball b db \<longrightarrow>
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7809
    norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> (e * (b - a)) / 4"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7810
  proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7811
    have "b \<in> {a..b}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7812
      using ab by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7813
    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
  7814
    note * = this[unfolded continuous_within Lim_within,rule_format] have "(e * (b - a)) / 8 > 0"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7815
      using e ab by (auto simp add: field_simps)
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7816
    from *[OF this] guess k .. note k = conjunctD2[OF this,rule_format]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7817
    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
  7818
    proof (cases "f' b = 0")
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7819
      case True
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7820
      then show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7821
        apply (rule_tac x=1 in exI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7822
        using ab e
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7823
        apply (auto intro!: mult_nonneg_nonneg)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7824
        done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7825
    next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7826
      case False
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7827
      then show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7828
        apply (rule_tac x="(e * (b - a)) / 8 / norm (f' b)" in exI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7829
        using ab e
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7830
        apply (auto simp add: field_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7831
        done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7832
    qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7833
    then guess l .. note l = conjunctD2[OF this]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7834
    show ?thesis
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7835
      apply (rule_tac x="min k l" in exI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7836
      apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7837
      unfolding min_less_iff_conj
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7838
      apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7839
      apply (rule l k)+
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7840
    proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7841
      fix c
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7842
      assume as: "c \<le> b" "{c..b} \<subseteq> {a..b}" "{c..b} \<subseteq> ball b (min k l)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7843
      note as' = this[unfolded subset_eq Ball_def mem_ball dist_real_def mem_interval]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7844
      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
  7845
        by (rule norm_triangle_ineq4)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7846
      also have "\<dots> \<le> e * (b - a) / 8 + e * (b - a) / 8"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7847
      proof (rule add_mono)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7848
        case goal1
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7849
        have "\<bar>c - b\<bar> \<le> \<bar>l\<bar>"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7850
          using as' by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7851
        then show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7852
          apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7853
          apply (rule order_trans[OF _ l(2)])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7854
          unfolding norm_scaleR
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7855
          apply (rule mult_right_mono)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7856
          apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7857
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7858
      next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7859
        case goal2
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7860
        show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7861
          apply (rule less_imp_le)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7862
          apply (cases "b = c")
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7863
          defer
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7864
          apply (subst norm_minus_commute)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7865
          apply (rule k(2)[unfolded dist_norm])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7866
          using as' e ab
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7867
          apply (auto simp add: field_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7868
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7869
      qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7870
      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
  7871
        unfolding content_real[OF as(1)] by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7872
    qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7873
  qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7874
  then guess db .. note db=conjunctD2[OF this,rule_format]
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  7875
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  7876
  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
  7877
  show "?P e"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7878
    apply (rule_tac x="?d" in exI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7879
  proof safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7880
    case goal1
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7881
    show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7882
      apply (rule gauge_ball_dependent)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7883
      using ab db(1) da(1) d(1)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7884
      apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7885
      done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7886
  next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7887
    case goal2
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7888
    note as=this
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7889
    let ?A = "{t. fst t \<in> {a, b}}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7890
    note p = tagged_division_ofD[OF goal2(1)]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7891
    have pA: "p = (p \<inter> ?A) \<union> (p - ?A)" "finite (p \<inter> ?A)" "finite (p - ?A)" "(p \<inter> ?A) \<inter> (p - ?A) = {}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7892
      using goal2 by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  7893
    note * = additive_tagged_division_1'[OF assms(1) goal2(1), symmetric]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7894
    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
  7895
      by arith
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7896
    show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7897
      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
  7898
      unfolding setsum_right_distrib
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7899
      apply (subst(2) pA)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7900
      apply (subst pA)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7901
      unfolding setsum_Un_disjoint[OF pA(2-)]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7902
    proof (rule norm_triangle_le, rule **)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7903
      case goal1
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7904
      show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7905
        apply (rule order_trans)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7906
        apply (rule setsum_norm_le)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7907
        defer
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7908
        apply (subst setsum_divide_distrib)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7909
        apply (rule order_refl)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7910
        apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7911
        apply (unfold not_le o_def split_conv fst_conv)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7912
      proof (rule ccontr)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7913
        fix x k
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7914
        assume as: "(x, k) \<in> p"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7915
          "e * (interval_upperbound k -  interval_lowerbound k) / 2 <
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7916
            norm (content k *\<^sub>R f' x - (f (interval_upperbound k) - f (interval_lowerbound k)))"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7917
        from p(4)[OF this(1)] guess u v by (elim exE) note k=this
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7918
        then have "u \<le> v" and uv: "{u, v} \<subseteq> {u..v}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7919
          using p(2)[OF as(1)] 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
  7920
        note result = as(2)[unfolded k interval_bounds_real[OF this(1)] content_real[OF this(1)]]
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  7921
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7922
        assume as': "x \<noteq> a" "x \<noteq> b"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7923
        then have "x \<in> {a<..<b}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7924
          using p(2-3)[OF as(1)] 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
  7925
        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
  7926
        have "norm ((v - u) *\<^sub>R f' (x) - (f (v) - f (u))) =
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  7927
          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
  7928
          apply (rule arg_cong[of _ _ norm])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7929
          unfolding scaleR_left.diff
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7930
          apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7931
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7932
        also have "\<dots> \<le> e / 2 * norm (u - x) + e / 2 * norm (v - x)"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7933
          apply (rule norm_triangle_le_sub)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7934
          apply (rule add_mono)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7935
          apply (rule_tac[!] *)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7936
          using fineD[OF goal2(2) as(1)] as'
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7937
          unfolding k subset_eq
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7938
          apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7939
          apply (erule_tac x=u in ballE)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7940
          apply (erule_tac[3] x=v in ballE)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7941
          using uv
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7942
          apply (auto simp:dist_real_def)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7943
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7944
        also have "\<dots> \<le> e / 2 * norm (v - u)"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7945
          using p(2)[OF as(1)]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7946
          unfolding k
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7947
          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
  7948
        finally have "e * (v - u) / 2 < e * (v - u) / 2"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7949
          apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7950
          apply (rule less_le_trans[OF result])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7951
          using uv
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7952
          apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7953
          done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7954
        then show False by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7955
      qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7956
    next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7957
      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
  7958
        by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7959
      case goal2
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7960
      show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7961
        apply (rule *)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7962
        apply (rule setsum_nonneg)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7963
        apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7964
        apply (unfold split_paired_all split_conv)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7965
        defer
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7966
        unfolding setsum_Un_disjoint[OF pA(2-),symmetric] pA(1)[symmetric]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7967
        unfolding setsum_right_distrib[symmetric]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7968
        apply (subst additive_tagged_division_1[OF _ as(1)])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7969
        apply (rule assms)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7970
      proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7971
        fix x k
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7972
        assume "(x, k) \<in> p \<inter> {t. fst t \<in> {a, b}}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7973
        note xk=IntD1[OF this]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7974
        from p(4)[OF this] guess u v by (elim exE) note uv=this
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7975
        with p(2)[OF xk] have "{u..v} \<noteq> {}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7976
          by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7977
        then show "0 \<le> e * ((interval_upperbound k) - (interval_lowerbound k))"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7978
          unfolding uv using e by (auto simp add: field_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7979
      next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7980
        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
  7981
          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
  7982
        show "norm (\<Sum>(x, k)\<in>p \<inter> ?A. content k *\<^sub>R f' x -
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  7983
          (f ((interval_upperbound k)) - f ((interval_lowerbound k)))) \<le> e * (b - a) / 2"
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7984
          apply (rule *[where t="p \<inter> {t. fst t \<in> {a, b} \<and> content(snd t) \<noteq> 0}"])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7985
          apply (rule setsum_mono_zero_right[OF pA(2)])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7986
          defer
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7987
          apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7988
          unfolding split_paired_all split_conv o_def
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7989
        proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7990
          fix x k
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7991
          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
  7992
          then have xk: "(x, k) \<in> p" "content k = 0"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7993
            by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7994
          from p(4)[OF xk(1)] guess u v by (elim exE) note uv=this
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7995
          have "k \<noteq> {}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7996
            using p(2)[OF xk(1)] by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7997
          then have *: "u = v"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7998
            using xk
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  7999
            unfolding uv content_eq_0 interval_eq_empty
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8000
            by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8001
          then show "content k *\<^sub>R (f' (x)) - (f ((interval_upperbound k)) - f ((interval_lowerbound k))) = 0"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8002
            using xk unfolding uv by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8003
        next
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8004
          have *: "p \<inter> {t. fst t \<in> {a, b} \<and> content(snd t) \<noteq> 0} =
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8005
            {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
  8006
            by blast
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8007
          have **: "\<And>s f. \<And>e::real. (\<forall>x y. x \<in> s \<and> y \<in> s \<longrightarrow> x = y) \<Longrightarrow>
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8008
            (\<forall>x. x \<in> s \<longrightarrow> norm (f x) \<le> e) \<Longrightarrow> e > 0 \<Longrightarrow> norm (setsum f s) \<le> e"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8009
          proof (case_tac "s = {}")
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8010
            case goal2
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8011
            then obtain x where "x \<in> s"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8012
              by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8013
            then have *: "s = {x}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8014
              using goal2(1) by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8015
            then show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8016
              using `x \<in> s` goal2(2) by auto
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  8017
          qed auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8018
          case goal2
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8019
          show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8020
            apply (subst *)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8021
            apply (subst setsum_Un_disjoint)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8022
            prefer 4
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8023
            apply (rule order_trans[of _ "e * (b - a)/4 + e * (b - a)/4"])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8024
            apply (rule norm_triangle_le,rule add_mono)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8025
            apply (rule_tac[1-2] **)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8026
          proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8027
            let ?B = "\<lambda>x. {t \<in> p. fst t = x \<and> content (snd t) \<noteq> 0}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8028
            have pa: "\<And>k. (a, k) \<in> p \<Longrightarrow> \<exists>v. k = {a .. v} \<and> a \<le> v"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8029
            proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8030
              case goal1
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8031
              guess u v using p(4)[OF goal1] by (elim exE) note uv=this
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8032
              have *: "u \<le> v"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8033
                using p(2)[OF goal1] unfolding uv by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8034
              have u: "u = a"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8035
              proof (rule ccontr)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8036
                have "u \<in> {u..v}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8037
                  using p(2-3)[OF goal1(1)] unfolding uv by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8038
                have "u \<ge> a"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8039
                  using p(2-3)[OF goal1(1)] unfolding uv subset_eq by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8040
                moreover assume "u \<noteq> a"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8041
                ultimately have "u > a" by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8042
                then show False
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8043
                  using p(2)[OF goal1(1)] unfolding uv by (auto simp add:)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8044
              qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8045
              then show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8046
                apply (rule_tac x=v in exI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8047
                unfolding uv
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8048
                using *
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8049
                apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8050
                done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  8051
            qed
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8052
            have pb: "\<And>k. (b, k) \<in> p \<Longrightarrow> \<exists>v. k = {v .. b} \<and> b \<ge> v"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8053
            proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8054
              case goal1
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8055
              guess u v using p(4)[OF goal1] by (elim exE) note uv=this
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8056
              have *: "u \<le> v"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8057
                using p(2)[OF goal1] unfolding uv by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8058
              have u: "v =  b"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8059
              proof (rule ccontr)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8060
                have "u \<in> {u..v}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8061
                  using p(2-3)[OF goal1(1)] unfolding uv by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8062
                have "v \<le> b"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8063
                  using p(2-3)[OF goal1(1)] unfolding uv subset_eq by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8064
                moreover assume "v \<noteq> b"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8065
                ultimately have "v < b" by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8066
                then show False
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8067
                  using p(2)[OF goal1(1)] unfolding uv by (auto simp add:)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8068
              qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8069
              then show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8070
                apply (rule_tac x=u in exI)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8071
                unfolding uv
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8072
                using *
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8073
                apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8074
                done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  8075
            qed
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8076
            show "\<forall>x y. x \<in> ?B a \<and> y \<in> ?B a \<longrightarrow> x = y"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8077
              apply (rule,rule,rule,unfold split_paired_all)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8078
              unfolding mem_Collect_eq fst_conv snd_conv
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8079
              apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8080
            proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8081
              fix x k k'
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8082
              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
  8083
              guess v using pa[OF k(1)] .. note v = conjunctD2[OF this]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8084
              guess v' using pa[OF k(2)] .. note v' = conjunctD2[OF this] let ?v = "min v v'"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8085
              have "{a <..< ?v} \<subseteq> k \<inter> k'"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8086
                unfolding v v' by (auto simp add:)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8087
              note interior_mono[OF this,unfolded interior_inter]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8088
              moreover have "(a + ?v)/2 \<in> { a <..< ?v}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8089
                using k(3-)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8090
                unfolding v v' content_eq_0 not_le
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8091
                by (auto simp add: not_le)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8092
              ultimately have "(a + ?v)/2 \<in> interior k \<inter> interior k'"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8093
                unfolding interior_open[OF open_interval] by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8094
              then have *: "k = k'"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8095
                apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8096
                apply (rule ccontr)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8097
                using p(5)[OF k(1-2)]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8098
                apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8099
                done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8100
              { assume "x \<in> k" then show "x \<in> k'" unfolding * . }
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8101
              { assume "x \<in> k'" then show "x\<in>k" unfolding * . }
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8102
            qed
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8103
            show "\<forall>x y. x \<in> ?B b \<and> y \<in> ?B b \<longrightarrow> x = y"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8104
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8105
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8106
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8107
              apply (unfold split_paired_all)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8108
              unfolding mem_Collect_eq fst_conv snd_conv
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8109
              apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8110
            proof -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8111
              fix x k k'
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8112
              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
  8113
              guess v using pb[OF k(1)] .. note v = conjunctD2[OF this]
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8114
              guess v' using pb[OF k(2)] .. note v' = conjunctD2[OF this]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8115
              let ?v = "max v v'"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8116
              have "{?v <..< b} \<subseteq> k \<inter> k'"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8117
                unfolding v v' by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8118
                note interior_mono[OF this,unfolded interior_inter]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8119
              moreover have " ((b + ?v)/2) \<in> {?v <..<  b}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8120
                using k(3-) unfolding v v' content_eq_0 not_le by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8121
              ultimately have " ((b + ?v)/2) \<in> interior k \<inter> interior k'"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8122
                unfolding interior_open[OF open_interval] by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8123
              then have *: "k = k'"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8124
                apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8125
                apply (rule ccontr)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8126
                using p(5)[OF k(1-2)]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8127
                apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8128
                done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8129
              { assume "x \<in> k" then show "x \<in> k'" unfolding * . }
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8130
              { assume "x \<in> k'" then show "x\<in>k" unfolding * . }
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  8131
            qed
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  8132
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  8133
            let ?a = a and ?b = b (* a is something else while proofing the next theorem. *)
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8134
            show "\<forall>x. x \<in> ?B a \<longrightarrow> norm ((\<lambda>(x, k). content k *\<^sub>R f' x - (f (interval_upperbound k) -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8135
              f (interval_lowerbound k))) x) \<le> e * (b - a) / 4"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8136
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8137
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8138
              unfolding mem_Collect_eq
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8139
              unfolding split_paired_all fst_conv snd_conv
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8140
            proof safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8141
              case goal1
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8142
              guess v using pa[OF goal1(1)] .. note v = conjunctD2[OF this]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8143
              have "?a \<in> {?a..v}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8144
                using v(2) by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8145
              then have "v \<le> ?b"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8146
                using p(3)[OF goal1(1)] unfolding subset_eq v by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8147
              moreover have "{?a..v} \<subseteq> ball ?a da"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8148
                using fineD[OF as(2) goal1(1)]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8149
                apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8150
                apply (subst(asm) if_P)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8151
                apply (rule refl)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8152
                unfolding subset_eq
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8153
                apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8154
                apply (erule_tac x=" x" in ballE)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8155
                apply (auto simp add:subset_eq dist_real_def v)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8156
                done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8157
              ultimately show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8158
                unfolding v interval_bounds_real[OF v(2)]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8159
                apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8160
                apply(rule da(2)[of "v"])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8161
                using goal1 fineD[OF as(2) goal1(1)]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8162
                unfolding v content_eq_0
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8163
                apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8164
                done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  8165
            qed
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8166
            show "\<forall>x. x \<in> ?B b \<longrightarrow> norm ((\<lambda>(x, k). content k *\<^sub>R f' x -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8167
              (f (interval_upperbound k) - f (interval_lowerbound k))) x) \<le> e * (b - a) / 4"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8168
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8169
              apply rule
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8170
              unfolding mem_Collect_eq
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8171
              unfolding split_paired_all fst_conv snd_conv
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8172
            proof safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8173
              case goal1 guess v using pb[OF goal1(1)] .. note v = conjunctD2[OF this]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8174
              have "?b \<in> {v.. ?b}"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8175
                using v(2) by auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8176
              then have "v \<ge> ?a" using p(3)[OF goal1(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
  8177
                unfolding subset_eq v by auto
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8178
              moreover have "{v..?b} \<subseteq> ball ?b db"
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8179
                using fineD[OF as(2) goal1(1)]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8180
                apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8181
                apply (subst(asm) if_P, rule refl)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8182
                unfolding subset_eq
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8183
                apply safe
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8184
                apply (erule_tac x=" x" in ballE)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8185
                using ab
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8186
                apply (auto simp add:subset_eq v dist_real_def)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8187
                done
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8188
              ultimately show ?case
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8189
                unfolding v
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8190
                unfolding interval_bounds_real[OF v(2)]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8191
                apply -
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8192
                apply(rule db(2)[of "v"])
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8193
                using goal1 fineD[OF as(2) goal1(1)]
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8194
                unfolding v content_eq_0
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8195
                apply auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8196
                done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  8197
            qed
53523
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8198
          qed (insert p(1) ab e, auto simp add: field_simps)
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8199
        qed auto
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8200
      qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8201
    qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8202
  qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8203
qed
706f7edea3d4 tuned proofs;
wenzelm
parents: 53520
diff changeset
  8204
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  8205
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  8206
subsection {* Stronger form with finite number of exceptional points. *}
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  8207
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8208
lemma fundamental_theorem_of_calculus_interior_strong:
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8209
  fixes f :: "real \<Rightarrow> 'a::banach"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8210
  assumes "finite s"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8211
    and "a \<le> b"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8212
    and "continuous_on {a..b} f"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8213
    and "\<forall>x\<in>{a<..<b} - s. (f has_vector_derivative f'(x)) (at x)"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8214
  shows "(f' has_integral (f b - f a)) {a..b}"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8215
  using assms
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8216
proof (induct "card s" arbitrary: s a b)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8217
  case 0
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8218
  show ?case
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8219
    apply (rule fundamental_theorem_of_calculus_interior)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8220
    using 0
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8221
    apply auto
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8222
    done
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8223
next
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8224
  case (Suc n)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8225
  from this(2) guess c s'
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8226
    apply -
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8227
    apply (subst(asm) eq_commute)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8228
    unfolding card_Suc_eq
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8229
    apply (subst(asm)(2) eq_commute)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8230
    apply (elim exE conjE)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8231
    done
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8232
  note cs = this[rule_format]
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8233
  show ?case
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8234
  proof (cases "c \<in> {a<..<b}")
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8235
    case False
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8236
    then show ?thesis
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8237
      apply -
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8238
      apply (rule Suc(1)[OF cs(3) _ Suc(4,5)])
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8239
      apply safe
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8240
      defer
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8241
      apply (rule Suc(6)[rule_format])
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8242
      using Suc(3)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8243
      unfolding cs
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8244
      apply auto
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8245
      done
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8246
  next
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8247
    have *: "f b - f a = (f c - f a) + (f b - f c)"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8248
      by auto
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8249
    case True
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8250
    then have "a \<le> c" "c \<le> b"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8251
      by auto
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8252
    then show ?thesis
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8253
      apply (subst *)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8254
      apply (rule has_integral_combine)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8255
      apply assumption+
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8256
      apply (rule_tac[!] Suc(1)[OF cs(3)])
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8257
      using Suc(3)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8258
      unfolding cs
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8259
    proof -
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8260
      show "continuous_on {a..c} f" "continuous_on {c..b} f"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8261
        apply (rule_tac[!] continuous_on_subset[OF Suc(5)])
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8262
        using True
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8263
        apply auto
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8264
        done
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents:
diff changeset
  8265
      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
  8266
      show "?P a c" "?P c b"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8267
        apply safe
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8268
        apply (rule_tac[!] Suc(6)[rule_format])
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8269
        using True
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8270
        unfolding cs
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8271
        apply auto
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8272
        done
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8273
    qed auto
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8274
  qed
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8275
qed
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8276
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8277
lemma fundamental_theorem_of_calculus_strong:
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8278
  fixes f :: "real \<Rightarrow> 'a::banach"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8279
  assumes "finite s"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8280
    and "a \<le> b"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8281
    and "continuous_on {a..b} f"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8282
    and "\<forall>x\<in>{a..b} - s. (f has_vector_derivative f'(x)) (at 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
  8283
  shows "(f' has_integral (f(b) - f(a))) {a..b}"
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8284
  apply (rule fundamental_theorem_of_calculus_interior_strong[OF assms(1-3), of f'])
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8285
  using assms(4)
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8286
  apply auto
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8287
  done
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8288
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8289
lemma indefinite_integral_continuous_left:
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
  8290
  fixes f::"real \<Rightarrow> 'a::banach"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8291
  assumes "f integrable_on {a..b}" "a < c" "c \<le> b" "0 < e"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8292
  obtains d where "0 < d" "\<forall>t. c - d < t \<and> t \<le> c \<longrightarrow> norm(integral {a..c} f - integral {a..t} f) < e"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8293
proof- have "\<exists>w>0. \<forall>t. c - w < t \<and> t < c \<longrightarrow> norm(f c) * norm(c - t) < e / 3"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8294
  proof(cases "f c = 0") case False hence "0 < e / 3 / norm (f c)"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8295
      apply-apply(rule divide_pos_pos) using `e>0` by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8296
    thus ?thesis apply-apply(rule,rule,assumption,safe)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8297
    proof- fix t assume as:"t < c" and "c - e / 3 / norm (f c) < t"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8298
      hence "c - t < e / 3 / norm (f c)" 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
  8299
      hence "norm (c - t) < e / 3 / norm (f c)" using as by auto
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8300
      thus "norm (f c) * norm (c - t) < e / 3" using False apply-
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8301
        apply(subst mult_commute) apply(subst pos_less_divide_eq[symmetric]) by auto
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8302
    qed next case True show ?thesis apply(rule_tac x=1 in exI) unfolding True using `e>0` by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8303
  qed then guess w .. note w = conjunctD2[OF this,rule_format]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8304
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8305
  have *:"e / 3 > 0" using assms by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8306
  have "f integrable_on {a..c}" apply(rule integrable_subinterval[OF assms(1)]) using assms(2-3) by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8307
  from integrable_integral[OF this,unfolded has_integral,rule_format,OF *] guess d1 ..
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8308
  note d1 = conjunctD2[OF this,rule_format] def d \<equiv> "\<lambda>x. ball x w \<inter> d1 x"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8309
  have "gauge d" unfolding d_def using w(1) d1 by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8310
  note this[unfolded gauge_def,rule_format,of c] note conjunctD2[OF this]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8311
  from this(2)[unfolded open_contains_ball,rule_format,OF this(1)] guess k .. note k=conjunctD2[OF this]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8312
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8313
  let ?d = "min k (c - a)/2" show ?thesis apply(rule that[of ?d])
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
  8314
  proof safe
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  8315
    show "?d > 0" using k(1) using assms(2) 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
  8316
    fix t assume as:"c - ?d < t" "t \<le> c"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  8317
    let ?thesis = "norm (integral {a..c} f - integral {a..t} f) < e"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8318
    { presume *:"t < c \<Longrightarrow> ?thesis"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8319
      show ?thesis apply(cases "t = c") defer apply(rule *)
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
  8320
        apply(subst less_le) using `e>0` as(2) 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
  8321
    assume "t < c"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8322
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8323
    have "f integrable_on {a..t}" apply(rule integrable_subinterval[OF assms(1)]) using assms(2-3) as(2) by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8324
    from integrable_integral[OF this,unfolded has_integral,rule_format,OF *] guess d2 ..
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8325
    note d2 = conjunctD2[OF this,rule_format]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8326
    def d3 \<equiv> "\<lambda>x. if x \<le> t then d1 x \<inter> d2 x else d1 x"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8327
    have "gauge d3" using d2(1) d1(1) unfolding d3_def gauge_def by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8328
    from fine_division_exists[OF this, of a t] guess p . note p=this
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8329
    note p'=tagged_division_ofD[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
  8330
    have pt:"\<forall>(x,k)\<in>p. x \<le> t" proof safe case goal1 from p'(2,3)[OF this] show ?case by auto qed
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8331
    with p(2) have "d2 fine p" unfolding fine_def d3_def apply safe apply(erule_tac x="(a,b)" in ballE)+ by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8332
    note d2_fin = d2(2)[OF conjI[OF p(1) this]]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8333
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
  8334
    have *:"{a..c} \<inter> {x. x \<bullet> 1 \<le> t} = {a..t}" "{a..c} \<inter> {x. x \<bullet> 1 \<ge> t} = {t..c}"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8335
      using assms(2-3) as by(auto simp add:field_simps)
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8336
    have "p \<union> {(c, {t..c})} tagged_division_of {a..c} \<and> d1 fine p \<union> {(c, {t..c})}" apply rule
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
  8337
      apply(rule tagged_division_union_interval[of _ _ _ 1 "t"]) unfolding * apply(rule p)
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8338
      apply(rule tagged_division_of_self) unfolding fine_def
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8339
    proof safe fix x k y assume "(x,k)\<in>p" "y\<in>k" thus "y\<in>d1 x"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8340
        using p(2) pt unfolding fine_def d3_def apply- apply(erule_tac x="(x,k)" in ballE)+ 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
  8341
    next fix x assume "x\<in>{t..c}" hence "dist c x < k" unfolding dist_real_def
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8342
        using as(1) by(auto simp add:field_simps)
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8343
      thus "x \<in> d1 c" using k(2) unfolding d_def by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8344
    qed(insert as(2), auto) note d1_fin = d1(2)[OF this]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8345
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8346
    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)) -
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8347
        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"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8348
      "e = (e/3 + e/3) + e/3" 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
  8349
    have **:"(\<Sum>(x, k)\<in>p \<union> {(c, {t..c})}. content k *\<^sub>R f x) = (c - t) *\<^sub>R f c + (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x)"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8350
    proof- have **:"\<And>x F. F \<union> {x} = insert x F" by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8351
      have "(c, {t..c}) \<notin> p" proof safe case goal1 from p'(2-3)[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
  8352
        have "c \<in> {a..t}" by auto thus False using `t<c` by auto
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8353
      qed thus ?thesis unfolding ** apply- apply(subst setsum_insert) apply(rule p')
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8354
        unfolding split_conv defer apply(subst content_real) using as(2) by auto 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
  8355
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8356
    have ***:"c - w < t \<and> t < c"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8357
    proof- have "c - k < t" using `k>0` as(1) by(auto simp add:field_simps)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8358
      moreover have "k \<le> w" apply(rule ccontr) using k(2)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8359
        unfolding subset_eq apply(erule_tac x="c + ((k + w)/2)" in ballE)
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8360
        unfolding d_def using `k>0` `w>0` by(auto simp add:field_simps not_le not_less dist_real_def)
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8361
      ultimately show  ?thesis using `t<c` by(auto simp add:field_simps) qed
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8362
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8363
    show ?thesis unfolding *(1) apply(subst *(2)) apply(rule norm_triangle_lt add_strict_mono)+
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8364
      unfolding norm_minus_cancel apply(rule d1_fin[unfolded **]) apply(rule d2_fin)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8365
      using w(2)[OF ***] unfolding norm_scaleR by(auto simp add:field_simps) qed 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
  8366
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8367
lemma indefinite_integral_continuous_right: fixes f::"real \<Rightarrow> 'a::banach"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8368
  assumes "f integrable_on {a..b}" "a \<le> c" "c < b" "0 < e"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8369
  obtains d where "0 < d" "\<forall>t. c \<le> t \<and> t < c + d \<longrightarrow> norm(integral{a..c} f - integral{a..t} f) < e"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8370
proof- have *:"(\<lambda>x. f (- x)) integrable_on {- b..- a}" "- b < - c" "- c \<le> - a" using assms 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
  8371
  from indefinite_integral_continuous_left[OF * `e>0`] guess d . note d = this let ?d = "min d (b - c)"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8372
  show ?thesis apply(rule that[of "?d"])
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8373
  proof safe show "0 < ?d" using d(1) assms(3) 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
  8374
    fix t::"real" assume as:"c \<le> t" "t < c + ?d"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8375
    have *:"integral{a..c} f = integral{a..b} f - integral{c..b} f"
36350
bc7982c54e37 dropped group_simps, ring_simps, field_eq_simps
haftmann
parents: 36334
diff changeset
  8376
      "integral{a..t} f = integral{a..b} f - integral{t..b} f" unfolding algebra_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
  8377
      apply(rule_tac[!] integral_combine) using assms as 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
  8378
    have "(- c) - d < (- t) \<and> - t \<le> - c" using as by auto note d(2)[rule_format,OF this]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8379
    thus "norm (integral {a..c} f - integral {a..t} f) < e" unfolding *
36350
bc7982c54e37 dropped group_simps, ring_simps, field_eq_simps
haftmann
parents: 36334
diff changeset
  8380
      unfolding integral_reflect apply-apply(subst norm_minus_commute) by(auto simp add:algebra_simps) qed qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8381
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8382
lemma indefinite_integral_continuous: fixes f::"real \<Rightarrow> 'a::banach"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8383
  assumes "f integrable_on {a..b}" shows  "continuous_on {a..b} (\<lambda>x. integral {a..x} f)"
36359
e5c785c166b2 generalize type of continuous_on
huffman
parents: 36334
diff changeset
  8384
proof(unfold continuous_on_iff, safe)  fix x e assume as:"x\<in>{a..b}" "0<(e::real)"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8385
  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"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8386
  { presume *:"a<b \<Longrightarrow> ?thesis"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8387
    show ?thesis apply(cases,rule *,assumption)
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 38656
diff changeset
  8388
    proof- case goal1 hence "{a..b} = {x}" using as(1) apply-apply(rule set_eqI)
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
  8389
        unfolding atLeastAtMost_iff by(auto simp only:field_simps not_less)
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8390
      thus ?case using `e>0` by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8391
    qed } assume "a<b"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8392
  have "(x=a \<or> x=b) \<or> (a<x \<and> x<b)" using as(1) by (auto simp add:)
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8393
  thus ?thesis apply-apply(erule disjE)+
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8394
  proof- assume "x=a" have "a \<le> a" by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8395
    from indefinite_integral_continuous_right[OF assms(1) this `a<b` `e>0`] guess d . note d=this
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8396
    show ?thesis apply(rule,rule,rule d,safe) apply(subst dist_commute)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8397
      unfolding `x=a` dist_norm apply(rule d(2)[rule_format]) by auto
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8398
  next   assume "x=b" have "b \<le> b" by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8399
    from indefinite_integral_continuous_left[OF assms(1) `a<b` this `e>0`] guess d . note d=this
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8400
    show ?thesis apply(rule,rule,rule d,safe) apply(subst dist_commute)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8401
      unfolding `x=b` dist_norm apply(rule d(2)[rule_format])  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
  8402
  next assume "a<x \<and> x<b" hence xl:"a<x" "x\<le>b" and xr:"a\<le>x" "x<b" by(auto simp add: )
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8403
    from indefinite_integral_continuous_left [OF assms(1) xl `e>0`] guess d1 . note d1=this
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8404
    from indefinite_integral_continuous_right[OF assms(1) xr `e>0`] guess d2 . note d2=this
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8405
    show ?thesis apply(rule_tac x="min d1 d2" in exI)
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8406
    proof safe show "0 < min d1 d2" using d1 d2 by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8407
      fix y assume "y\<in>{a..b}" "dist y x < min d1 d2"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8408
      thus "dist (integral {a..y} f) (integral {a..x} f) < e" apply-apply(subst dist_commute)
36587
534418d8d494 remove redundant lemma vector_dist_norm
huffman
parents: 36365
diff changeset
  8409
        apply(cases "y < x") unfolding dist_norm apply(rule d1(2)[rule_format]) defer
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8410
        apply(rule d2(2)[rule_format]) unfolding not_less by(auto simp add:field_simps)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8411
    qed qed qed
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8412
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8413
subsection {* This doesn't directly involve integration, but that gives an easy proof. *}
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8414
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8415
lemma has_derivative_zero_unique_strong_interval: fixes f::"real \<Rightarrow> 'a::banach"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8416
  assumes "finite k" "continuous_on {a..b} f" "f a = y"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8417
  "\<forall>x\<in>({a..b} - k). (f has_derivative (\<lambda>h. 0)) (at x within {a..b})" "x \<in> {a..b}"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8418
  shows "f x = y"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8419
proof- have ab:"a\<le>b" using assms 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
  8420
  have *:"a\<le>x" using assms(5) 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
  8421
  have "((\<lambda>x. 0\<Colon>'a) has_integral f x - f a) {a..x}"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8422
    apply(rule fundamental_theorem_of_calculus_interior_strong[OF assms(1) *])
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8423
    apply(rule continuous_on_subset[OF assms(2)]) defer
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8424
    apply safe unfolding has_vector_derivative_def apply(subst has_derivative_within_open[symmetric])
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8425
    apply assumption apply(rule open_interval) apply(rule has_derivative_within_subset[where s="{a..b}"])
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8426
    using assms(4) assms(5) by auto note this[unfolded *]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8427
  note has_integral_unique[OF has_integral_0 this]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8428
  thus ?thesis unfolding assms by auto qed
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8429
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8430
subsection {* Generalize a bit to any convex set. *}
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8431
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8432
lemma has_derivative_zero_unique_strong_convex: fixes f::"'a::ordered_euclidean_space \<Rightarrow> 'b::banach"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8433
  assumes "convex s" "finite k" "continuous_on s f" "c \<in> s" "f c = y"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8434
  "\<forall>x\<in>(s - k). (f has_derivative (\<lambda>h. 0)) (at x within s)" "x \<in> s"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8435
  shows "f x = y"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8436
proof- { presume *:"x \<noteq> c \<Longrightarrow> ?thesis" show ?thesis apply(cases,rule *,assumption)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8437
      unfolding assms(5)[symmetric] by auto } assume "x\<noteq>c"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8438
  note conv = assms(1)[unfolded convex_alt,rule_format]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8439
  have as1:"continuous_on {0..1} (f \<circ> (\<lambda>t. (1 - t) *\<^sub>R c + t *\<^sub>R x))"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8440
    apply(rule continuous_on_intros)+ apply(rule continuous_on_subset[OF assms(3)])
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8441
    apply safe apply(rule conv) using assms(4,7) by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8442
  have *:"\<And>t xa. (1 - t) *\<^sub>R c + t *\<^sub>R x = (1 - xa) *\<^sub>R c + xa *\<^sub>R x \<Longrightarrow> t = xa"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8443
  proof- case goal1 hence "(t - xa) *\<^sub>R x = (t - xa) *\<^sub>R c"
36350
bc7982c54e37 dropped group_simps, ring_simps, field_eq_simps
haftmann
parents: 36334
diff changeset
  8444
      unfolding scaleR_simps by(auto simp add:algebra_simps)
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8445
    thus ?case using `x\<noteq>c` by auto qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8446
  have as2:"finite {t. ((1 - t) *\<^sub>R c + t *\<^sub>R x) \<in> k}" using assms(2)
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8447
    apply(rule finite_surj[where f="\<lambda>z. SOME t. (1-t) *\<^sub>R c + t *\<^sub>R x = z"])
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8448
    apply safe unfolding image_iff apply rule defer apply assumption
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8449
    apply(rule sym) apply(rule some_equality) defer apply(drule *) by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8450
  have "(f \<circ> (\<lambda>t. (1 - t) *\<^sub>R c + t *\<^sub>R x)) 1 = y"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8451
    apply(rule has_derivative_zero_unique_strong_interval[OF as2 as1, of ])
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8452
    unfolding o_def using assms(5) defer apply-apply(rule)
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8453
  proof- fix t assume as:"t\<in>{0..1} - {t. (1 - t) *\<^sub>R c + t *\<^sub>R x \<in> k}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8454
    have *:"c - t *\<^sub>R c + t *\<^sub>R x \<in> s - k" apply safe apply(rule conv[unfolded scaleR_simps])
36362
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36359
diff changeset
  8455
      using `x\<in>s` `c\<in>s` as by(auto simp add: algebra_simps)
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8456
    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)) (at t within {0..1})"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8457
      apply(rule diff_chain_within) apply(rule has_derivative_add)
44140
2c10c35dd4be remove several redundant and unused theorems about derivatives
huffman
parents: 44125
diff changeset
  8458
      unfolding scaleR_simps
51642
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51518
diff changeset
  8459
      apply(intro FDERIV_intros)
400ec5ae7f8f move FrechetDeriv from the Library to HOL/Deriv; base DERIV on FDERIV and both derivatives allow a restricted support set; FDERIV is now an abbreviation of has_derivative
hoelzl
parents: 51518
diff changeset
  8460
      apply(intro FDERIV_intros)
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8461
      apply(rule has_derivative_within_subset,rule assms(6)[rule_format])
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8462
      apply(rule *) apply safe apply(rule conv[unfolded scaleR_simps]) using `x\<in>s` `c\<in>s` by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8463
    thus "((\<lambda>xa. f ((1 - xa) *\<^sub>R c + xa *\<^sub>R x)) has_derivative (\<lambda>h. 0)) (at t within {0..1})" unfolding o_def .
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8464
  qed auto thus ?thesis by auto qed
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8465
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8466
subsection {* Also to any open connected set with finite set of exceptions. Could
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8467
 generalize to locally convex set with limpt-free set of exceptions. *}
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8468
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8469
lemma has_derivative_zero_unique_strong_connected: fixes f::"'a::ordered_euclidean_space \<Rightarrow> 'b::banach"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8470
  assumes "connected s" "open s" "finite k" "continuous_on s f" "c \<in> s" "f c = y"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8471
  "\<forall>x\<in>(s - k). (f has_derivative (\<lambda>h. 0)) (at x within s)" "x\<in>s"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8472
  shows "f x = y"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8473
proof- have "{x \<in> s. f x \<in> {y}} = {} \<or> {x \<in> s. f x \<in> {y}} = s"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8474
    apply(rule assms(1)[unfolded connected_clopen,rule_format]) apply rule defer
41969
1cf3e4107a2a moved t2_spaces to HOL image
hoelzl
parents: 41958
diff changeset
  8475
    apply(rule continuous_closed_in_preimage[OF assms(4) closed_singleton])
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8476
    apply(rule open_openin_trans[OF assms(2)]) unfolding open_contains_ball
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8477
  proof safe fix x assume "x\<in>s"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8478
    from assms(2)[unfolded open_contains_ball,rule_format,OF this] guess e .. note e=conjunctD2[OF this]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8479
    show "\<exists>e>0. ball x e \<subseteq> {xa \<in> s. f xa \<in> {f x}}" apply(rule,rule,rule e)
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8480
    proof safe fix y assume y:"y \<in> ball x e" thus "y\<in>s" using e by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8481
      show "f y = f x" apply(rule has_derivative_zero_unique_strong_convex[OF convex_ball])
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8482
        apply(rule assms) apply(rule continuous_on_subset,rule assms) apply(rule e)+
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8483
        apply(subst centre_in_ball,rule e,rule) apply safe
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8484
        apply(rule has_derivative_within_subset) apply(rule assms(7)[rule_format])
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8485
        using y e by auto qed qed
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8486
  thus ?thesis using `x\<in>s` `f c = y` `c\<in>s` by auto qed
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8487
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8488
subsection {* Integrating characteristic function of an interval. *}
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8489
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8490
lemma has_integral_restrict_open_subinterval: fixes f::"'a::ordered_euclidean_space \<Rightarrow> 'b::banach"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8491
  assumes "(f has_integral i) {c..d}" "{c..d} \<subseteq> {a..b}"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8492
  shows "((\<lambda>x. if x \<in> {c<..<d} then f x else 0) has_integral i) {a..b}"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8493
proof- def g \<equiv> "\<lambda>x. if x \<in>{c<..<d} then f x else 0"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8494
  { presume *:"{c..d}\<noteq>{} \<Longrightarrow> ?thesis"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8495
    show ?thesis apply(cases,rule *,assumption)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8496
    proof- case goal1 hence *:"{c<..<d} = {}" using interval_open_subset_closed by auto
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8497
      show ?thesis using assms(1) unfolding * using goal1 by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8498
    qed } assume "{c..d}\<noteq>{}"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8499
  from partial_division_extend_1[OF assms(2) this] guess p . note p=this
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8500
  note mon = monoidal_lifted[OF monoidal_monoid]
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8501
  note operat = operative_division[OF this operative_integral p(1), symmetric]
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8502
  let ?P = "(if g integrable_on {a..b} then Some (integral {a..b} g) else None) = Some i"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8503
  { presume "?P" hence "g integrable_on {a..b} \<and> integral {a..b} g = i"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8504
      apply- apply(cases,subst(asm) if_P,assumption) by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8505
    thus ?thesis using integrable_integral unfolding g_def by auto }
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8506
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8507
  note iterate_eq_neutral[OF mon,unfolded neutral_lifted[OF monoidal_monoid]]
53597
ea99a7964174 remove duplicate lemmas
huffman
parents: 53524
diff changeset
  8508
  note * = this[unfolded neutral_add]
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8509
  have iterate:"iterate (lifted op +) (p - {{c..d}})
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8510
      (\<lambda>i. if g integrable_on i then Some (integral i g) else None) = Some 0"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8511
  proof(rule *,rule) case goal1 hence "x\<in>p" by auto note div = division_ofD(2-5)[OF p(1) this]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8512
    from div(3) guess u v apply-by(erule exE)+ note uv=this
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8513
    have "interior x \<inter> interior {c..d} = {}" using div(4)[OF p(2)] goal1 by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8514
    hence "(g has_integral 0) x" unfolding uv apply-apply(rule has_integral_spike_interior[where f="\<lambda>x. 0"])
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8515
      unfolding g_def interior_closed_interval by auto thus ?case by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8516
  qed
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8517
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8518
  have *:"p = insert {c..d} (p - {{c..d}})" using p by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8519
  have **:"g integrable_on {c..d}" apply(rule integrable_spike_interior[where f=f])
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8520
    unfolding g_def defer apply(rule has_integral_integrable) using assms(1) by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8521
  moreover have "integral {c..d} g = i" apply(rule has_integral_unique[OF _ assms(1)])
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8522
    apply(rule has_integral_spike_interior[where f=g]) defer
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8523
    apply(rule integrable_integral[OF **]) unfolding g_def by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8524
  ultimately show ?P unfolding operat apply- apply(subst *) apply(subst iterate_insert) apply rule+
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8525
    unfolding iterate defer apply(subst if_not_P) defer using p by auto qed
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8526
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8527
lemma has_integral_restrict_closed_subinterval: fixes f::"'a::ordered_euclidean_space \<Rightarrow> 'b::banach"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8528
  assumes "(f has_integral i) ({c..d})" "{c..d} \<subseteq> {a..b}"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8529
  shows "((\<lambda>x. if x \<in> {c..d} then f x else 0) has_integral i) {a..b}"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8530
proof- note has_integral_restrict_open_subinterval[OF assms]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8531
  note * = has_integral_spike[OF negligible_frontier_interval _ this]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8532
  show ?thesis apply(rule *[of c d]) using interval_open_subset_closed[of c d] by auto qed
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8533
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8534
lemma has_integral_restrict_closed_subintervals_eq: fixes f::"'a::ordered_euclidean_space \<Rightarrow> 'b::banach" assumes "{c..d} \<subseteq> {a..b}"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8535
  shows "((\<lambda>x. if x \<in> {c..d} then f x else 0) has_integral i) {a..b} \<longleftrightarrow> (f has_integral i) {c..d}" (is "?l = ?r")
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8536
proof(cases "{c..d} = {}") case False let ?g = "\<lambda>x. if x \<in> {c..d} then f x else 0"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8537
  show ?thesis apply rule defer apply(rule has_integral_restrict_closed_subinterval[OF _ assms])
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8538
  proof assumption assume ?l hence "?g integrable_on {c..d}"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8539
      apply-apply(rule integrable_subinterval[OF _ assms]) by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8540
    hence *:"f integrable_on {c..d}"apply-apply(rule integrable_eq) by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8541
    hence "i = integral {c..d} f" apply-apply(rule has_integral_unique)
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8542
      apply(rule `?l`) apply(rule has_integral_restrict_closed_subinterval[OF _ assms]) by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8543
    thus ?r using * by auto qed qed auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8544
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8545
subsection {* Hence we can apply the limit process uniformly to all integrals. *}
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8546
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8547
lemma has_integral': fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach" shows
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8548
 "(f has_integral i) s \<longleftrightarrow> (\<forall>e>0. \<exists>B>0. \<forall>a b. ball 0 B \<subseteq> {a..b}
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8549
  \<longrightarrow> (\<exists>z. ((\<lambda>x. if x \<in> s then f(x) else 0) has_integral z) {a..b} \<and> norm(z - i) < e))" (is "?l \<longleftrightarrow> (\<forall>e>0. ?r e)")
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8550
proof- { presume *:"\<exists>a b. s = {a..b} \<Longrightarrow> ?thesis"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8551
    show ?thesis apply(cases,rule *,assumption)
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8552
      apply(subst has_integral_alt) by auto }
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8553
  assume "\<exists>a b. s = {a..b}" then guess a b apply-by(erule exE)+ note s=this
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8554
  from bounded_interval[of a b, THEN conjunct1, unfolded bounded_pos] guess B ..
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8555
  note B = conjunctD2[OF this,rule_format] show ?thesis apply safe
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8556
  proof- fix e assume ?l "e>(0::real)"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8557
    show "?r e" apply(rule_tac x="B+1" in exI) apply safe defer apply(rule_tac x=i in exI)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8558
    proof fix c d assume as:"ball 0 (B+1) \<subseteq> {c..d::'n::ordered_euclidean_space}"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8559
      thus "((\<lambda>x. if x \<in> s then f x else 0) has_integral i) {c..d}" unfolding s
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8560
        apply-apply(rule has_integral_restrict_closed_subinterval) apply(rule `?l`[unfolded s])
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8561
        apply safe apply(drule B(2)[rule_format]) unfolding subset_eq apply(erule_tac x=x in ballE)
36587
534418d8d494 remove redundant lemma vector_dist_norm
huffman
parents: 36365
diff changeset
  8562
        by(auto simp add:dist_norm)
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8563
    qed(insert B `e>0`, auto)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8564
  next assume as:"\<forall>e>0. ?r e"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8565
    from this[rule_format,OF zero_less_one] guess C .. note C=conjunctD2[OF this,rule_format]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8566
    def c \<equiv> "(\<Sum>i\<in>Basis. (- max B C) *\<^sub>R i)::'n::ordered_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
  8567
    def d \<equiv> "(\<Sum>i\<in>Basis. max B C *\<^sub>R i)::'n::ordered_euclidean_space"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8568
    have c_d:"{a..b} \<subseteq> {c..d}" apply safe apply(drule B(2)) unfolding mem_interval
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
    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
  8570
      case goal1 thus ?case using Basis_le_norm[OF `i\<in>Basis`, of x] unfolding c_def d_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
  8571
        by(auto simp add:field_simps setsum_negf)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  8572
    qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8573
    have "ball 0 C \<subseteq> {c..d}" apply safe unfolding mem_interval mem_ball dist_norm
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
  8574
    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
  8575
      case goal1 thus ?case
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  8576
        using Basis_le_norm[OF `i\<in>Basis`, of x] unfolding c_def d_def by (auto simp: setsum_negf)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  8577
    qed
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8578
    from C(2)[OF this] have "\<exists>y. (f has_integral y) {a..b}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8579
      unfolding has_integral_restrict_closed_subintervals_eq[OF c_d,symmetric] unfolding s by auto
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8580
    then guess y .. note y=this
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8581
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8582
    have "y = i" proof(rule ccontr) assume "y\<noteq>i" hence "0 < norm (y - i)" by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8583
      from as[rule_format,OF this] guess C ..  note C=conjunctD2[OF this,rule_format]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8584
      def c \<equiv> "(\<Sum>i\<in>Basis. (- max B C) *\<^sub>R i)::'n::ordered_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
  8585
      def d \<equiv> "(\<Sum>i\<in>Basis. max B C *\<^sub>R i)::'n::ordered_euclidean_space"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8586
      have c_d:"{a..b} \<subseteq> {c..d}" apply safe apply(drule B(2)) unfolding mem_interval
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
  8587
      proof case goal1 thus ?case using Basis_le_norm[of i x] unfolding c_def d_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
  8588
          by(auto simp add:field_simps setsum_negf) qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8589
      have "ball 0 C \<subseteq> {c..d}" apply safe unfolding mem_interval mem_ball dist_norm
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
  8590
      proof case goal1 thus ?case using Basis_le_norm[of i x] unfolding c_def d_def by (auto simp: setsum_negf) qed
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8591
      note C(2)[OF this] then guess z .. note z = conjunctD2[OF this, unfolded s]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8592
      note this[unfolded has_integral_restrict_closed_subintervals_eq[OF c_d]]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8593
      hence "z = y" "norm (z - i) < norm (y - i)" apply- apply(rule has_integral_unique[OF _ y(1)]) .
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8594
      thus False by auto qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8595
    thus ?l using y unfolding s by auto qed qed
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8596
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8597
lemma has_integral_le: fixes f::"'n::ordered_euclidean_space \<Rightarrow> real"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8598
  assumes "(f has_integral i) s" "(g has_integral j) s"  "\<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
  8599
  shows "i \<le> j"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  8600
  using has_integral_component_le[OF _ assms(1-2), of 1] using assms(3) 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
  8601
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8602
lemma integral_le: fixes f::"'n::ordered_euclidean_space \<Rightarrow> real"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8603
  assumes "f integrable_on s" "g integrable_on s" "\<forall>x\<in>s. f x \<le> g x"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8604
  shows "integral s f \<le> integral s g"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8605
  using has_integral_le[OF assms(1,2)[unfolded has_integral_integral] assms(3)] .
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8606
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8607
lemma has_integral_nonneg: fixes f::"'n::ordered_euclidean_space \<Rightarrow> real"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8608
  assumes "(f has_integral i) s" "\<forall>x\<in>s. 0 \<le> f x" 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
  8609
  using has_integral_component_nonneg[of 1 f i s]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8610
  unfolding o_def using assms by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8611
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8612
lemma integral_nonneg: fixes f::"'n::ordered_euclidean_space \<Rightarrow> real"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8613
  assumes "f integrable_on s" "\<forall>x\<in>s. 0 \<le> f x" shows "0 \<le> integral s f"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8614
  using has_integral_nonneg[OF assms(1)[unfolded has_integral_integral] assms(2)] .
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8615
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8616
subsection {* Hence a general restriction property. *}
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8617
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8618
lemma has_integral_restrict[simp]: assumes "s \<subseteq> t" shows
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8619
  "((\<lambda>x. if x \<in> s then f x else (0::'a::banach)) has_integral i) t \<longleftrightarrow> (f has_integral i) s"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8620
proof- 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)" using assms by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8621
  show ?thesis apply(subst(2) has_integral') apply(subst has_integral') unfolding * by rule qed
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8622
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8623
lemma has_integral_restrict_univ: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach" shows
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8624
  "((\<lambda>x. if x \<in> s then f x else 0) has_integral i) UNIV \<longleftrightarrow> (f has_integral i) s" by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8625
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8626
lemma has_integral_on_superset: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8627
  assumes "\<forall>x. ~(x \<in> s) \<longrightarrow> f x = 0" "s \<subseteq> t" "(f has_integral i) s"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8628
  shows "(f has_integral i) t"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8629
proof- have "(\<lambda>x. if x \<in> s then f x else 0) = (\<lambda>x. if x \<in> t then f x else 0)"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8630
    apply(rule) using assms(1-2) by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8631
  thus ?thesis apply- using assms(3) apply(subst has_integral_restrict_univ[symmetric])
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8632
  apply- apply(subst(asm) has_integral_restrict_univ[symmetric]) by auto qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8633
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8634
lemma integrable_on_superset: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8635
  assumes "\<forall>x. ~(x \<in> s) \<longrightarrow> f x = 0" "s \<subseteq> t" "f integrable_on s"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8636
  shows "f integrable_on t"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8637
  using assms unfolding integrable_on_def by(auto intro:has_integral_on_superset)
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8638
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8639
lemma integral_restrict_univ[intro]: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8640
  shows "f integrable_on s \<Longrightarrow> integral UNIV (\<lambda>x. if x \<in> s then f x else 0) = integral s f"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8641
  apply(rule integral_unique) unfolding has_integral_restrict_univ by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8642
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8643
lemma integrable_restrict_univ: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach" shows
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8644
 "(\<lambda>x. if x \<in> s then f x else 0) integrable_on UNIV \<longleftrightarrow> f integrable_on s"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8645
  unfolding integrable_on_def by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8646
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8647
lemma negligible_on_intervals: "negligible s \<longleftrightarrow> (\<forall>a b. negligible(s \<inter> {a..b}))" (is "?l = ?r")
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8648
proof assume ?r show ?l unfolding negligible_def
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8649
  proof safe case goal1 show ?case apply(rule has_integral_negligible[OF `?r`[rule_format,of a b]])
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8650
      unfolding indicator_def by auto qed qed auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8651
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8652
lemma has_integral_spike_set_eq: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8653
  assumes "negligible((s - t) \<union> (t - s))" shows "((f has_integral y) s \<longleftrightarrow> (f has_integral y) t)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8654
  unfolding has_integral_restrict_univ[symmetric,of f] apply(rule has_integral_spike_eq[OF assms]) by (auto split: split_if_asm)
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8655
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8656
lemma has_integral_spike_set[dest]: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8657
  assumes "negligible((s - t) \<union> (t - s))" "(f has_integral y) s"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8658
  shows "(f has_integral y) t"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8659
  using assms has_integral_spike_set_eq by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8660
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8661
lemma integrable_spike_set[dest]: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8662
  assumes "negligible((s - t) \<union> (t - s))" "f integrable_on s"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8663
  shows "f integrable_on t" using assms(2) unfolding integrable_on_def
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8664
  unfolding has_integral_spike_set_eq[OF assms(1)] .
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8665
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8666
lemma integrable_spike_set_eq: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8667
  assumes "negligible((s - t) \<union> (t - s))"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8668
  shows "(f integrable_on s \<longleftrightarrow> f integrable_on t)"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8669
  apply(rule,rule_tac[!] integrable_spike_set) using assms by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8670
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8671
(*lemma integral_spike_set:
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8672
 "\<forall>f:real^M->real^N g s t.
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8673
        negligible(s DIFF t \<union> t DIFF s)
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8674
        \<longrightarrow> integral s f = integral t f"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8675
qed  REPEAT STRIP_TAC THEN REWRITE_TAC[integral] THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8676
  AP_TERM_TAC THEN ABS_TAC THEN MATCH_MP_TAC HAS_INTEGRAL_SPIKE_SET_EQ THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8677
  ASM_MESON_TAC[]);;
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8678
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8679
lemma has_integral_interior:
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8680
 "\<forall>f:real^M->real^N y s.
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8681
        negligible(frontier s)
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8682
        \<longrightarrow> ((f has_integral y) (interior s) \<longleftrightarrow> (f has_integral y) s)"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8683
qed  REPEAT STRIP_TAC THEN MATCH_MP_TAC HAS_INTEGRAL_SPIKE_SET_EQ THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8684
  FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (REWRITE_RULE[IMP_CONJ]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8685
    NEGLIGIBLE_SUBSET)) THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8686
  REWRITE_TAC[frontier] THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8687
  MP_TAC(ISPEC `s:real^M->bool` INTERIOR_SUBSET) THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8688
  MP_TAC(ISPEC `s:real^M->bool` CLOSURE_SUBSET) THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8689
  SET_TAC[]);;
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8690
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8691
lemma has_integral_closure:
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8692
 "\<forall>f:real^M->real^N y s.
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8693
        negligible(frontier s)
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8694
        \<longrightarrow> ((f has_integral y) (closure s) \<longleftrightarrow> (f has_integral y) s)"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8695
qed  REPEAT STRIP_TAC THEN MATCH_MP_TAC HAS_INTEGRAL_SPIKE_SET_EQ THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8696
  FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (REWRITE_RULE[IMP_CONJ]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8697
    NEGLIGIBLE_SUBSET)) THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8698
  REWRITE_TAC[frontier] THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8699
  MP_TAC(ISPEC `s:real^M->bool` INTERIOR_SUBSET) THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8700
  MP_TAC(ISPEC `s:real^M->bool` CLOSURE_SUBSET) THEN
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8701
  SET_TAC[]);;*)
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8702
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8703
subsection {* More lemmas that are useful later. *}
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8704
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8705
lemma has_integral_subset_component_le: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'm::ordered_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
  8706
  assumes k: "k\<in>Basis" 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"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  8707
  shows "i\<bullet>k \<le> j\<bullet>k"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8708
proof- 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
  8709
  note as(2-3)[unfolded this] note * = has_integral_component_le[OF k 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
  8710
  show ?thesis apply(rule *) using as(1,4) by auto qed
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8711
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8712
lemma has_integral_subset_le: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 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
  8713
  assumes as: "s \<subseteq> t" "(f has_integral i) s" "(f has_integral j) t" "\<forall>x\<in>t. 0 \<le> 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
  8714
  shows "i \<le> j"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  8715
  using has_integral_subset_component_le[OF _ assms(1), of 1 f i j] using assms 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
  8716
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8717
lemma integral_subset_component_le: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'm::ordered_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
  8718
  assumes "k\<in>Basis" "s \<subseteq> t" "f integrable_on s" "f integrable_on t" "\<forall>x \<in> t. 0 \<le> f(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
  8719
  shows "(integral s f)\<bullet>k \<le> (integral t f)\<bullet>k"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8720
  apply(rule has_integral_subset_component_le) using assms by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8721
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8722
lemma integral_subset_le: fixes f::"'n::ordered_euclidean_space \<Rightarrow> real"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8723
  assumes "s \<subseteq> t" "f integrable_on s" "f integrable_on t" "\<forall>x \<in> t. 0 \<le> f(x)"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8724
  shows "(integral s f) \<le> (integral t f)"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8725
  apply(rule has_integral_subset_le) using assms by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8726
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8727
lemma has_integral_alt': fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8728
  shows "(f has_integral i) s \<longleftrightarrow> (\<forall>a b. (\<lambda>x. if x \<in> s then f x else 0) integrable_on {a..b}) \<and>
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8729
  (\<forall>e>0. \<exists>B>0. \<forall>a b. ball 0 B \<subseteq> {a..b} \<longrightarrow> norm(integral {a..b} (\<lambda>x. if x \<in> s then f x else 0) - i) < e)" (is "?l = ?r")
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8730
proof assume ?r
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8731
  show ?l apply- apply(subst has_integral')
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8732
  proof safe case goal1 from `?r`[THEN conjunct2,rule_format,OF this] guess B .. note B=conjunctD2[OF this]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8733
    show ?case apply(rule,rule,rule B,safe)
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8734
      apply(rule_tac x="integral {a..b} (\<lambda>x. if x \<in> s then f x else 0)" in exI)
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8735
      apply(drule B(2)[rule_format]) using integrable_integral[OF `?r`[THEN conjunct1,rule_format]] by auto
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8736
  qed next
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8737
  assume ?l note as = this[unfolded has_integral'[of f],rule_format]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8738
  let ?f = "\<lambda>x. if x \<in> s then f x else 0"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8739
  show ?r proof safe fix a b::"'n::ordered_euclidean_space"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8740
    from as[OF zero_less_one] guess B .. note B=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
  8741
    let ?a = "\<Sum>i\<in>Basis. min (a\<bullet>i) (-B) *\<^sub>R i::'n" and ?b = "\<Sum>i\<in>Basis. max (b\<bullet>i) B *\<^sub>R i::'n"
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8742
    show "?f integrable_on {a..b}" apply(rule integrable_subinterval[of _ ?a ?b])
36587
534418d8d494 remove redundant lemma vector_dist_norm
huffman
parents: 36365
diff changeset
  8743
    proof- have "ball 0 B \<subseteq> {?a..?b}" apply safe unfolding mem_ball mem_interval dist_norm
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
  8744
      proof case goal1 thus ?case using Basis_le_norm[of i x] by(auto simp add:field_simps) qed
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8745
      from B(2)[OF this] guess z .. note conjunct1[OF this]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8746
      thus "?f integrable_on {?a..?b}" unfolding integrable_on_def 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
  8747
      show "{a..b} \<subseteq> {?a..?b}" apply safe unfolding mem_interval apply(rule,erule_tac x=i in ballE) by auto qed
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8748
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8749
    fix e::real assume "e>0" from as[OF this] guess B .. note B=conjunctD2[OF this,rule_format]
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8750
    show "\<exists>B>0. \<forall>a b. ball 0 B \<subseteq> {a..b} \<longrightarrow>
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8751
                    norm (integral {a..b} (\<lambda>x. if x \<in> s then f x else 0) - i) < e"
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8752
    proof(rule,rule,rule B,safe) case goal1 from B(2)[OF this] guess z .. note z=conjunctD2[OF this]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8753
      from integral_unique[OF this(1)] show ?case using z(2) by auto qed qed qed
35751
f7f8d59b60b9 added lemmas
himmelma
parents: 35540
diff changeset
  8754
35752
c8a8df426666 reset smt_certificates
himmelma
parents: 35751
diff changeset
  8755
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8756
subsection {* Continuity of the integral (for a 1-dimensional interval). *}
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8757
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8758
lemma integrable_alt: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach" shows
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8759
  "f integrable_on s \<longleftrightarrow>
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8760
          (\<forall>a b. (\<lambda>x. if x \<in> s then f x else 0) integrable_on {a..b}) \<and>
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8761
          (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball 0 B \<subseteq> {a..b} \<and> ball 0 B \<subseteq> {c..d}
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8762
  \<longrightarrow> norm(integral {a..b} (\<lambda>x. if x \<in> s then f x else 0) -
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8763
          integral {c..d}  (\<lambda>x. if x \<in> s then f x else 0)) < e)" (is "?l = ?r")
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8764
proof assume ?l then guess y unfolding integrable_on_def .. note this[unfolded has_integral_alt'[of f]]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8765
  note y=conjunctD2[OF this,rule_format] show ?r apply safe apply(rule y)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8766
  proof- case goal1 hence "e/2 > 0" by auto from y(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
  8767
    show ?case apply(rule,rule,rule B)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8768
    proof safe case goal1 show ?case apply(rule norm_triangle_half_l)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8769
        using B(2)[OF goal1(1)] B(2)[OF goal1(2)] by auto qed qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8770
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8771
next assume ?r note as = 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
  8772
  let ?cube = "\<lambda>n. {(\<Sum>i\<in>Basis. - real n *\<^sub>R i)::'n .. (\<Sum>i\<in>Basis. real n *\<^sub>R i)} :: 'n set"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  8773
  have "Cauchy (\<lambda>n. integral (?cube n) (\<lambda>x. if x \<in> s then f x else 0))"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8774
  proof(unfold Cauchy_def,safe) case goal1
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8775
    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
  8776
    from real_arch_simple[of B] guess N .. note N = 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
  8777
    { fix n assume n:"n \<ge> N" have "ball 0 B \<subseteq> ?cube n" apply safe
36587
534418d8d494 remove redundant lemma vector_dist_norm
huffman
parents: 36365
diff changeset
  8778
        unfolding mem_ball mem_interval dist_norm
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
  8779
      proof case goal1 thus ?case using Basis_le_norm[of i x] `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
  8780
          using n N by(auto simp add:field_simps setsum_negf) qed }
36587
534418d8d494 remove redundant lemma vector_dist_norm
huffman
parents: 36365
diff changeset
  8781
    thus ?case apply-apply(rule_tac x=N in exI) apply safe unfolding dist_norm apply(rule B(2)) by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8782
  qed from this[unfolded convergent_eq_cauchy[symmetric]] guess i ..
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
  8783
  note i = this[THEN LIMSEQ_D]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8784
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8785
  show ?l unfolding integrable_on_def has_integral_alt'[of f] apply(rule_tac x=i in exI)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8786
    apply safe apply(rule as(1)[unfolded integrable_on_def])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8787
  proof- case goal1 hence *:"e/2 > 0" by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8788
    from i[OF this] guess N .. note N =this[rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8789
    from as(2)[OF *] guess B .. note B=conjunctD2[OF this,rule_format] let ?B = "max (real N) B"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8790
    show ?case apply(rule_tac x="?B" in exI)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8791
    proof safe show "0 < ?B" using B(1) 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
  8792
      fix a b assume ab:"ball 0 ?B \<subseteq> {a..b::'n::ordered_euclidean_space}"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8793
      from real_arch_simple[of ?B] guess n .. note n=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8794
      show "norm (integral {a..b} (\<lambda>x. if x \<in> s then f x else 0) - i) < e"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8795
        apply(rule norm_triangle_half_l) apply(rule B(2)) defer apply(subst norm_minus_commute)
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
  8796
        apply(rule N[of n])
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8797
      proof safe show "N \<le> n" using n 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
  8798
        fix x::"'n::ordered_euclidean_space" assume x:"x \<in> ball 0 B" hence "x\<in> ball 0 ?B" by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8799
        thus "x\<in>{a..b}" using ab 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
  8800
        show "x\<in>?cube n" using x unfolding mem_interval mem_ball dist_norm apply-
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  8801
        proof case goal1 thus ?case using Basis_le_norm[of i x] `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
  8802
            using n by(auto simp add:field_simps setsum_negf) qed qed qed qed qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8803
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8804
lemma integrable_altD: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8805
  assumes "f integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8806
  shows "\<And>a b. (\<lambda>x. if x \<in> s then f x else 0) integrable_on {a..b}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8807
  "\<And>e. e>0 \<Longrightarrow> \<exists>B>0. \<forall>a b c d. ball 0 B \<subseteq> {a..b} \<and> ball 0 B \<subseteq> {c..d}
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8808
  \<longrightarrow> norm(integral {a..b} (\<lambda>x. if x \<in> s then f x else 0) - integral {c..d}  (\<lambda>x. if x \<in> s then f x else 0)) < e"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8809
  using assms[unfolded integrable_alt[of f]] by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8810
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8811
lemma integrable_on_subinterval: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8812
  assumes "f integrable_on s" "{a..b} \<subseteq> s" shows "f integrable_on {a..b}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8813
  apply(rule integrable_eq) defer apply(rule integrable_altD(1)[OF assms(1)])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8814
  using assms(2) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8815
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8816
subsection {* A straddling criterion for integrability. *}
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8817
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8818
lemma integrable_straddle_interval: fixes f::"'n::ordered_euclidean_space \<Rightarrow> real"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8819
  assumes "\<forall>e>0. \<exists>g  h i j. (g has_integral i) ({a..b}) \<and> (h has_integral j) ({a..b}) \<and>
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8820
  norm(i - j) < e \<and> (\<forall>x\<in>{a..b}. (g x) \<le> (f x) \<and> (f x) \<le>(h x))"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8821
  shows "f integrable_on {a..b}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8822
proof(subst integrable_cauchy,safe)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8823
  case goal1 hence e:"e/3 > 0" by auto note assms[rule_format,OF this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8824
  then guess g h i j apply- by(erule exE conjE)+ note obt = this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8825
  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
  8826
  from obt(2)[unfolded has_integral[of h], rule_format, OF e] guess d2 .. note d2=conjunctD2[OF this,rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8827
  show ?case apply(rule_tac x="\<lambda>x. d1 x \<inter> d2 x" in exI) apply(rule conjI gauge_inter d1 d2)+ unfolding fine_inter
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8828
  proof safe have **:"\<And>i j g1 g2 h1 h2 f1 f2. g1 - h2 \<le> f1 - f2 \<Longrightarrow> f1 - f2 \<le> h1 - g2 \<Longrightarrow>
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8829
      abs(i - j) < e / 3 \<Longrightarrow> abs(g2 - i) < e / 3 \<Longrightarrow>  abs(g1 - i) < e / 3 \<Longrightarrow>
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8830
      abs(h2 - j) < e / 3 \<Longrightarrow> abs(h1 - j) < e / 3 \<Longrightarrow> abs(f1 - f2) < e" using `e>0` by arith
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8831
    case goal1 note tagged_division_ofD(2-4) note * = this[OF goal1(1)] this[OF goal1(4)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8832
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8833
    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"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8834
      "0 \<le> (\<Sum>(x, k)\<in>p2. content k *\<^sub>R h x) - (\<Sum>(x, k)\<in>p2. content k *\<^sub>R f x)"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8835
      "(\<Sum>(x, k)\<in>p2. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p2. content k *\<^sub>R g x) \<ge> 0"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8836
      "0 \<le> (\<Sum>(x, k)\<in>p1. content k *\<^sub>R h x) - (\<Sum>(x, k)\<in>p1. content k *\<^sub>R f x)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8837
      unfolding setsum_subtractf[symmetric] apply- apply(rule_tac[!] setsum_nonneg)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8838
      apply safe unfolding real_scaleR_def right_diff_distrib[symmetric]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8839
      apply(rule_tac[!] mult_nonneg_nonneg)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8840
    proof- fix a b assume ab:"(a,b) \<in> p1"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8841
      show "0 \<le> content b" using *(3)[OF ab] apply safe using content_pos_le . thus "0 \<le> content b" .
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8842
      show "0 \<le> f a - g a" "0 \<le> h a - f a" using *(1-2)[OF ab] using obt(4)[rule_format,of a] by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8843
    next fix a b assume ab:"(a,b) \<in> p2"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8844
      show "0 \<le> content b" using *(6)[OF ab] apply safe using content_pos_le . thus "0 \<le> content b" .
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8845
      show "0 \<le> f a - g a" "0 \<le> h a - f a" using *(4-5)[OF ab] using obt(4)[rule_format,of a] by auto qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8846
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8847
    thus ?case apply- unfolding real_norm_def apply(rule **) defer defer
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8848
      unfolding real_norm_def[symmetric] apply(rule obt(3))
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8849
      apply(rule d1(2)[OF conjI[OF goal1(4,5)]])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8850
      apply(rule d1(2)[OF conjI[OF goal1(1,2)]])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8851
      apply(rule d2(2)[OF conjI[OF goal1(4,6)]])
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8852
      apply(rule d2(2)[OF conjI[OF goal1(1,3)]]) by auto qed qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8853
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8854
lemma integrable_straddle: fixes f::"'n::ordered_euclidean_space \<Rightarrow> real"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8855
  assumes "\<forall>e>0. \<exists>g h i j. (g has_integral i) s \<and> (h has_integral j) s \<and>
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8856
  norm(i - j) < e \<and> (\<forall>x\<in>s. (g x) \<le>(f x) \<and>(f x) \<le>(h x))"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8857
  shows "f integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8858
proof- have "\<And>a b. (\<lambda>x. if x \<in> s then f x else 0) integrable_on {a..b}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8859
  proof(rule integrable_straddle_interval,safe) case goal1 hence *:"e/4 > 0" by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8860
    from assms[rule_format,OF this] guess g h i j apply-by(erule exE conjE)+ note obt=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8861
    note obt(1)[unfolded has_integral_alt'[of g]] note conjunctD2[OF this, rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8862
    note g = this(1) and this(2)[OF *] from this(2) guess B1 .. note B1 = conjunctD2[OF this,rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8863
    note obt(2)[unfolded has_integral_alt'[of h]] note conjunctD2[OF this, rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8864
    note h = this(1) and this(2)[OF *] 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
  8865
    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
  8866
    def d \<equiv> "\<Sum>i\<in>Basis. max (b\<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
  8867
    have *:"ball 0 B1 \<subseteq> {c..d}" "ball 0 B2 \<subseteq> {c..d}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  8868
      apply safe unfolding mem_ball mem_interval dist_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
  8869
    proof(rule_tac[!] 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
  8870
      case goal1 thus ?case using Basis_le_norm[of i x] unfolding c_def d_def by auto 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
  8871
      case goal2 thus ?case using Basis_le_norm[of i x] unfolding c_def d_def by auto qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8872
    have **:"\<And>ch cg ag ah::real. norm(ah - ag) \<le> norm(ch - cg) \<Longrightarrow> norm(cg - i) < e / 4 \<Longrightarrow>
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8873
      norm(ch - j) < e / 4 \<Longrightarrow> norm(ag - ah) < e"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8874
      using obt(3) unfolding real_norm_def by arith
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8875
    show ?case apply(rule_tac x="\<lambda>x. if x \<in> s then g x else 0" in exI)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8876
               apply(rule_tac x="\<lambda>x. if x \<in> s then h x else 0" in exI)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8877
      apply(rule_tac x="integral {a..b} (\<lambda>x. if x \<in> s then g x else 0)" in exI)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8878
      apply(rule_tac x="integral {a..b} (\<lambda>x. if x \<in> s then h x else 0)" in exI)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8879
      apply safe apply(rule_tac[1-2] integrable_integral,rule g,rule h)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8880
      apply(rule **[OF _ B1(2)[OF *(1)] B2(2)[OF *(2)]])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8881
    proof- have *:"\<And>x f g. (if x \<in> s then f x else 0) - (if x \<in> s then g x else 0) =
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8882
        (if x \<in> s then f x - g x else (0::real))" by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8883
      note ** = abs_of_nonneg[OF integral_nonneg[OF integrable_sub, OF h g]]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8884
      show " norm (integral {a..b} (\<lambda>x. if x \<in> s then h x else 0) -
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8885
                   integral {a..b} (\<lambda>x. if x \<in> s then g x else 0))
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8886
           \<le> norm (integral {c..d} (\<lambda>x. if x \<in> s then h x else 0) -
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8887
                   integral {c..d} (\<lambda>x. if x \<in> s then g x else 0))"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8888
        unfolding integral_sub[OF h g,symmetric] real_norm_def apply(subst **) defer apply(subst **) defer
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8889
        apply(rule has_integral_subset_le) defer apply(rule integrable_integral integrable_sub h g)+
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8890
      proof safe fix x assume "x\<in>{a..b}" thus "x\<in>{c..d}" unfolding mem_interval c_def d_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
  8891
          apply - apply rule apply(erule_tac x=i in ballE) by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8892
      qed(insert obt(4), auto) qed(insert obt(4), auto) qed note interv = this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8893
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8894
  show ?thesis unfolding integrable_alt[of f] apply safe apply(rule interv)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8895
  proof- case goal1 hence *:"e/3 > 0" by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8896
    from assms[rule_format,OF this] guess g h i j apply-by(erule exE conjE)+ note obt=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8897
    note obt(1)[unfolded has_integral_alt'[of g]] note conjunctD2[OF this, rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8898
    note g = this(1) and this(2)[OF *] from this(2) guess B1 .. note B1 = conjunctD2[OF this,rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8899
    note obt(2)[unfolded has_integral_alt'[of h]] note conjunctD2[OF this, rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8900
    note h = this(1) and this(2)[OF *] from this(2) guess B2 .. note B2 = conjunctD2[OF this,rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8901
    show ?case apply(rule_tac x="max B1 B2" in exI) apply safe apply(rule min_max.less_supI1,rule B1)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8902
    proof- fix a b c d::"'n::ordered_euclidean_space" assume as:"ball 0 (max B1 B2) \<subseteq> {a..b}" "ball 0 (max B1 B2) \<subseteq> {c..d}"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8903
      have **:"ball 0 B1 \<subseteq> ball (0::'n::ordered_euclidean_space) (max B1 B2)" "ball 0 B2 \<subseteq> ball (0::'n::ordered_euclidean_space) (max B1 B2)" by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8904
      have *:"\<And>ga gc ha hc fa fc::real. abs(ga - i) < e / 3 \<and> abs(gc - i) < e / 3 \<and> abs(ha - j) < e / 3 \<and>
50348
4b4fe0d5ee22 remove SMT proofs in Multivariate_Analysis
hoelzl
parents: 50252
diff changeset
  8905
        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> abs(fa - fc) < e"
4b4fe0d5ee22 remove SMT proofs in Multivariate_Analysis
hoelzl
parents: 50252
diff changeset
  8906
        by (simp add: abs_real_def split: split_if_asm)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8907
      show "norm (integral {a..b} (\<lambda>x. if x \<in> s then f x else 0) - integral {c..d} (\<lambda>x. if x \<in> s then f x else 0)) < e"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8908
        unfolding real_norm_def apply(rule *, safe) unfolding real_norm_def[symmetric]
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8909
        apply(rule B1(2),rule order_trans,rule **,rule as(1))
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8910
        apply(rule B1(2),rule order_trans,rule **,rule as(2))
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8911
        apply(rule B2(2),rule order_trans,rule **,rule as(1))
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8912
        apply(rule B2(2),rule order_trans,rule **,rule as(2))
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8913
        apply(rule obt) apply(rule_tac[!] integral_le) using obt
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8914
        by(auto intro!: h g interv) qed qed qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8915
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8916
subsection {* Adding integrals over several sets. *}
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8917
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8918
lemma has_integral_union: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8919
  assumes "(f has_integral i) s" "(f has_integral j) t" "negligible(s \<inter> t)"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8920
  shows "(f has_integral (i + j)) (s \<union> t)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8921
proof- note * = has_integral_restrict_univ[symmetric, of f]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8922
  show ?thesis unfolding * apply(rule has_integral_spike[OF assms(3)])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8923
    defer apply(rule has_integral_add[OF assms(1-2)[unfolded *]]) by auto qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8924
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8925
lemma has_integral_unions: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8926
  assumes "finite t" "\<forall>s\<in>t. (f has_integral (i s)) s"  "\<forall>s\<in>t. \<forall>s'\<in>t. ~(s = s') \<longrightarrow> negligible(s \<inter> s')"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8927
  shows "(f has_integral (setsum i t)) (\<Union>t)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8928
proof- note * = has_integral_restrict_univ[symmetric, of f]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8929
  have **:"negligible (\<Union>((\<lambda>(a,b). a \<inter> b) ` {(a,b). a \<in> t \<and> b \<in> {y. y \<in> t \<and> ~(a = y)}}))"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8930
    apply(rule negligible_unions) apply(rule finite_imageI) apply(rule finite_subset[of _ "t \<times> t"]) defer
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8931
    apply(rule finite_cartesian_product[OF assms(1,1)]) using assms(3) by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8932
  note assms(2)[unfolded *] note has_integral_setsum[OF assms(1) this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8933
  thus ?thesis unfolding * apply-apply(rule has_integral_spike[OF **]) defer apply assumption
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8934
  proof safe case goal1 thus ?case
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8935
    proof(cases "x\<in>\<Union>t") case True then guess s unfolding Union_iff .. note s=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8936
      hence *:"\<forall>b\<in>t. x \<in> b \<longleftrightarrow> b = s" using goal1(3) by blast
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8937
      show ?thesis unfolding if_P[OF True] apply(rule trans) defer
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8938
        apply(rule setsum_cong2) apply(subst *, assumption) apply(rule refl)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8939
        unfolding setsum_delta[OF assms(1)] using s by auto qed auto qed qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8940
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8941
subsection {* In particular adding integrals over a division, maybe not of an interval. *}
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8942
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8943
lemma has_integral_combine_division: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8944
  assumes "d division_of s" "\<forall>k\<in>d. (f has_integral (i k)) k"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8945
  shows "(f has_integral (setsum i d)) s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8946
proof- note d = division_ofD[OF assms(1)]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8947
  show ?thesis unfolding d(6)[symmetric] apply(rule has_integral_unions)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8948
    apply(rule d assms)+ apply(rule,rule,rule)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8949
  proof- case goal1 from d(4)[OF this(1)] d(4)[OF this(2)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8950
    guess a c b d apply-by(erule exE)+ note obt=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8951
    from d(5)[OF goal1] show ?case unfolding obt interior_closed_interval
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8952
      apply-apply(rule negligible_subset[of "({a..b}-{a<..<b}) \<union> ({c..d}-{c<..<d})"])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8953
      apply(rule negligible_union negligible_frontier_interval)+ by auto qed qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8954
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8955
lemma integral_combine_division_bottomup: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8956
  assumes "d division_of s" "\<forall>k\<in>d. f integrable_on k"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8957
  shows "integral s f = setsum (\<lambda>i. integral i f) d"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8958
  apply(rule integral_unique) apply(rule has_integral_combine_division[OF assms(1)])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8959
  using assms(2) unfolding has_integral_integral .
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8960
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8961
lemma has_integral_combine_division_topdown: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8962
  assumes "f integrable_on s" "d division_of k" "k \<subseteq> s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8963
  shows "(f has_integral (setsum (\<lambda>i. integral i f) d)) k"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8964
  apply(rule has_integral_combine_division[OF assms(2)])
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8965
  apply safe unfolding has_integral_integral[symmetric]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8966
proof- case goal1 from division_ofD(2,4)[OF assms(2) this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8967
  show ?case apply safe apply(rule integrable_on_subinterval)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8968
    apply(rule assms) using assms(3) by auto qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8969
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8970
lemma integral_combine_division_topdown: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8971
  assumes "f integrable_on s" "d division_of s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8972
  shows "integral s f = setsum (\<lambda>i. integral i f) d"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8973
  apply(rule integral_unique,rule has_integral_combine_division_topdown) using assms by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8974
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8975
lemma integrable_combine_division: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8976
  assumes "d division_of s" "\<forall>i\<in>d. f integrable_on i"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8977
  shows "f integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8978
  using assms(2) unfolding integrable_on_def
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8979
  by(metis has_integral_combine_division[OF assms(1)])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8980
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8981
lemma integrable_on_subdivision: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8982
  assumes "d division_of i" "f integrable_on s" "i \<subseteq> s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8983
  shows "f integrable_on i"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8984
  apply(rule integrable_combine_division assms)+
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8985
proof safe case goal1 note division_ofD(2,4)[OF assms(1) this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8986
  thus ?case apply safe apply(rule integrable_on_subinterval[OF assms(2)])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8987
    using assms(3) by auto qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8988
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8989
subsection {* Also tagged divisions. *}
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8990
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  8991
lemma has_integral_combine_tagged_division: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8992
  assumes "p tagged_division_of s" "\<forall>(x,k) \<in> p. (f has_integral (i k)) k"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8993
  shows "(f has_integral (setsum (\<lambda>(x,k). i k) p)) s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8994
proof- have *:"(f has_integral (setsum (\<lambda>k. integral k f) (snd ` p))) s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8995
    apply(rule has_integral_combine_division) apply(rule division_of_tagged_division[OF assms(1)])
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  8996
    using assms(2) unfolding has_integral_integral[symmetric] by(safe,auto)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8997
  thus ?thesis apply- apply(rule subst[where P="\<lambda>i. (f has_integral i) s"]) defer apply assumption
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8998
    apply(rule trans[of _ "setsum (\<lambda>(x,k). integral k f) p"]) apply(subst eq_commute)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  8999
    apply(rule setsum_over_tagged_division_lemma[OF assms(1)]) apply(rule integral_null,assumption)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9000
    apply(rule setsum_cong2) using assms(2) by auto qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9001
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9002
lemma integral_combine_tagged_division_bottomup: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9003
  assumes "p tagged_division_of {a..b}" "\<forall>(x,k)\<in>p. f integrable_on k"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9004
  shows "integral {a..b} f = setsum (\<lambda>(x,k). integral k f) p"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9005
  apply(rule integral_unique) apply(rule has_integral_combine_tagged_division[OF assms(1)])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9006
  using assms(2) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9007
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9008
lemma has_integral_combine_tagged_division_topdown: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9009
  assumes "f integrable_on {a..b}" "p tagged_division_of {a..b}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9010
  shows "(f has_integral (setsum (\<lambda>(x,k). integral k f) p)) {a..b}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9011
  apply(rule has_integral_combine_tagged_division[OF assms(2)])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9012
proof safe case goal1 note tagged_division_ofD(3-4)[OF assms(2) this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9013
  thus ?case using integrable_subinterval[OF assms(1)] by auto qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9014
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9015
lemma integral_combine_tagged_division_topdown: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9016
  assumes "f integrable_on {a..b}" "p tagged_division_of {a..b}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9017
  shows "integral {a..b} f = setsum (\<lambda>(x,k). integral k f) p"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9018
  apply(rule integral_unique,rule has_integral_combine_tagged_division_topdown) using assms by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9019
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9020
subsection {* Henstock's lemma. *}
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9021
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9022
lemma henstock_lemma_part1: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9023
  assumes "f integrable_on {a..b}" "0 < e" "gauge d"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9024
  "(\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow> norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p - integral({a..b}) f) < e)"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9025
  and p:"p tagged_partial_division_of {a..b}" "d fine p"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9026
  shows "norm(setsum (\<lambda>(x,k). content k *\<^sub>R f x - integral k f) p) \<le> e" (is "?x \<le> e")
41863
e5104b436ea1 removed dependency on Dense_Linear_Order
boehmes
parents: 41851
diff changeset
  9027
proof-  { presume "\<And>k. 0<k \<Longrightarrow> ?x \<le> e + k" thus ?thesis by (blast intro: field_le_epsilon) }
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9028
  fix k::real assume k:"k>0" note p' = tagged_partial_division_ofD[OF p(1)]
52141
eff000cab70f weaker precendence of syntax for big intersection and union on sets
haftmann
parents: 51642
diff changeset
  9029
  have "\<Union>(snd ` p) \<subseteq> {a..b}" using p'(3) by fastforce
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9030
  note partial_division_of_tagged_division[OF p(1)] this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9031
  from partial_division_extend_interval[OF this] guess q . note q=this and q' = division_ofD[OF this(2)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9032
  def r \<equiv> "q - snd ` p" have "snd ` p \<inter> r = {}" unfolding r_def by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9033
  have r:"finite r" using q' unfolding r_def by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9034
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9035
  have "\<forall>i\<in>r. \<exists>p. p tagged_division_of i \<and> d fine p \<and>
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9036
    norm(setsum (\<lambda>(x,j). content j *\<^sub>R f x) p - integral i f) < k / (real (card r) + 1)"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9037
  proof safe case goal1 hence i:"i \<in> q" unfolding r_def by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9038
    from q'(4)[OF this] guess u v apply-by(erule exE)+ note uv=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9039
    have *:"k / (real (card r) + 1) > 0" apply(rule divide_pos_pos,rule k) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9040
    have "f integrable_on {u..v}" apply(rule integrable_subinterval[OF assms(1)])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9041
      using q'(2)[OF i] unfolding uv by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9042
    note integrable_integral[OF this, unfolded has_integral[of f]]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9043
    from this[rule_format,OF *] guess dd .. note dd=conjunctD2[OF this,rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9044
    note gauge_inter[OF `gauge d` dd(1)] from fine_division_exists[OF this,of u v] guess qq .
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9045
    thus ?case apply(rule_tac x=qq in exI) using dd(2)[of qq] unfolding fine_inter uv by auto qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9046
  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
  9047
52141
eff000cab70f weaker precendence of syntax for big intersection and union on sets
haftmann
parents: 51642
diff changeset
  9048
  let ?p = "p \<union> \<Union>(qq ` r)" have "norm ((\<Sum>(x, k)\<in>?p. content k *\<^sub>R f x) - integral {a..b} f) < e"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9049
    apply(rule assms(4)[rule_format])
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9050
  proof show "d fine ?p" apply(rule fine_union,rule p) apply(rule fine_unions) using qq by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9051
    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
  9052
    have "p \<union> \<Union>(qq ` r) tagged_division_of \<Union>(snd ` p) \<union> \<Union>r"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9053
    proof(rule tagged_division_union[OF * tagged_division_unions])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9054
      show "finite r" by fact case goal2 thus ?case using qq by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9055
    next case goal3 thus ?case apply(rule,rule,rule) apply(rule q'(5)) unfolding r_def by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9056
    next case goal4 thus ?case apply(rule inter_interior_unions_intervals) apply(fact,rule)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9057
        apply(rule,rule q') defer apply(rule,subst Int_commute)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9058
        apply(rule inter_interior_unions_intervals) apply(rule finite_imageI,rule p',rule) defer
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9059
        apply(rule,rule q') using q(1) p' unfolding r_def by auto qed
52141
eff000cab70f weaker precendence of syntax for big intersection and union on sets
haftmann
parents: 51642
diff changeset
  9060
    moreover have "\<Union>(snd ` p) \<union> \<Union>r = {a..b}" "{qq i |i. i \<in> r} = qq ` r"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9061
      unfolding Union_Un_distrib[symmetric] r_def using q by auto
44890
22f665a2e91c new fastforce replacing fastsimp - less confusing name
nipkow
parents: 44522
diff changeset
  9062
    ultimately show "?p tagged_division_of {a..b}" by fastforce qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9063
52141
eff000cab70f weaker precendence of syntax for big intersection and union on sets
haftmann
parents: 51642
diff changeset
  9064
  hence "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) -
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9065
    integral {a..b} f) < e" apply(subst setsum_Un_zero[symmetric]) apply(rule p') prefer 3
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9066
    apply assumption apply rule apply(rule finite_imageI,rule r) apply safe apply(drule qq)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9067
  proof- fix x l k assume as:"(x,l)\<in>p" "(x,l)\<in>qq k" "k\<in>r"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9068
    note qq[OF this(3)] note tagged_division_ofD(3,4)[OF conjunct1[OF this] as(2)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9069
    from this(2) guess u v apply-by(erule exE)+ note uv=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9070
    have "l\<in>snd ` p" unfolding image_iff apply(rule_tac x="(x,l)" in bexI) using as by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9071
    hence "l\<in>q" "k\<in>q" "l\<noteq>k" using as(1,3) q(1) unfolding r_def by auto
44522
2f7e9d890efe rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents: 44514
diff changeset
  9072
    note q'(5)[OF this] hence "interior l = {}" using interior_mono[OF `l \<subseteq> k`] by blast
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9073
    thus "content l *\<^sub>R f x = 0" unfolding uv content_eq_0_interior[symmetric] by auto qed auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9074
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9075
  hence "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) + setsum (setsum (\<lambda>(x, k). content k *\<^sub>R f x))
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9076
    (qq ` r) - integral {a..b} f) < e" apply(subst(asm) setsum_UNION_zero)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9077
    prefer 4 apply assumption apply(rule finite_imageI,fact)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9078
    unfolding split_paired_all split_conv image_iff defer apply(erule bexE)+
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9079
  proof- fix x m k l T1 T2 assume "(x,m)\<in>T1" "(x,m)\<in>T2" "T1\<noteq>T2" "k\<in>r" "l\<in>r" "T1 = qq k" "T2 = qq l"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9080
    note as = this(1-5)[unfolded this(6-)] note kl = tagged_division_ofD(3,4)[OF qq[THEN conjunct1]]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9081
    from this(2)[OF as(4,1)] guess u v apply-by(erule exE)+ note uv=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9082
    have *:"interior (k \<inter> l) = {}" unfolding interior_inter apply(rule q')
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9083
      using as unfolding r_def by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9084
    have "interior m = {}" unfolding subset_empty[symmetric] unfolding *[symmetric]
44522
2f7e9d890efe rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents: 44514
diff changeset
  9085
      apply(rule interior_mono) using kl(1)[OF as(4,1)] kl(1)[OF as(5,2)] by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9086
    thus "content m *\<^sub>R f x = 0" unfolding uv content_eq_0_interior[symmetric] by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9087
  qed(insert qq, auto)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9088
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9089
  hence **:"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 -
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9090
    integral {a..b} f) < e" apply(subst(asm) setsum_reindex_nonzero) apply fact
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9091
    apply(rule setsum_0',rule) unfolding split_paired_all split_conv defer apply assumption
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9092
  proof- fix k l x m assume as:"k\<in>r" "l\<in>r" "k\<noteq>l" "qq k = qq l" "(x,m)\<in>qq k"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9093
    note tagged_division_ofD(6)[OF qq[THEN conjunct1]] from this[OF as(1)] this[OF as(2)]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9094
    show "content m *\<^sub>R f x = 0"  using as(3) unfolding as by auto qed
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9095
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9096
  have *:"\<And>ir ip i cr cp. norm((cp + cr) - i) < e \<Longrightarrow> norm(cr - ir) < k \<Longrightarrow>
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9097
    ip + ir = i \<Longrightarrow> norm(cp - ip) \<le> e + k"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9098
  proof- case goal1 thus ?case  using norm_triangle_le[of "cp + cr - i" "- (cr - ir)"]
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9099
      unfolding goal1(3)[symmetric] norm_minus_cancel by(auto simp add:algebra_simps) qed
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9100
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9101
  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
  9102
    unfolding split_def setsum_subtractf ..
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9103
  also have "... \<le> e + k" apply(rule *[OF **, where ir="setsum (\<lambda>k. integral k f) r"])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9104
  proof- case goal2 have *:"(\<Sum>(x, k)\<in>p. integral k f) = (\<Sum>k\<in>snd ` p. integral k f)"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9105
      apply(subst setsum_reindex_nonzero) apply fact
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9106
      unfolding split_paired_all snd_conv split_def o_def
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9107
    proof- fix x l y m assume as:"(x,l)\<in>p" "(y,m)\<in>p" "(x,l)\<noteq>(y,m)" "l = m"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9108
      from p'(4)[OF as(1)] guess u v apply-by(erule exE)+ note uv=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9109
      show "integral l f = 0" unfolding uv apply(rule integral_unique)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9110
        apply(rule has_integral_null) unfolding content_eq_0_interior
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9111
        using p'(5)[OF as(1-3)] unfolding uv as(4)[symmetric] by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9112
    qed auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9113
    show ?case unfolding integral_combine_division_topdown[OF assms(1) q(2)] * r_def
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9114
      apply(rule setsum_Un_disjoint'[symmetric]) using q(1) q'(1) p'(1) by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9115
  next  case goal1 have *:"k * real (card r) / (1 + real (card r)) < k" using k by(auto simp add:field_simps)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9116
    show ?case apply(rule le_less_trans[of _ "setsum (\<lambda>x. k / (real (card r) + 1)) r"])
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9117
      unfolding setsum_subtractf[symmetric] apply(rule setsum_norm_le)
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9118
      apply rule apply(drule qq) defer unfolding divide_inverse setsum_left_distrib[symmetric]
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9119
      unfolding divide_inverse[symmetric] using * by(auto simp add:field_simps real_eq_of_nat)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9120
  qed finally show "?x \<le> e + k" . qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9121
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9122
lemma henstock_lemma_part2: fixes f::"'m::ordered_euclidean_space \<Rightarrow> 'n::ordered_euclidean_space"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9123
  assumes "f integrable_on {a..b}" "0 < e" "gauge d"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9124
  "\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow> norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p -
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9125
          integral({a..b}) f) < e"    "p tagged_partial_division_of {a..b}" "d fine p"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9126
  shows "setsum (\<lambda>(x,k). norm(content k *\<^sub>R f x - integral k f)) p \<le> 2 * real (DIM('n)) * e"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9127
  unfolding split_def apply(rule setsum_norm_allsubsets_bound) defer
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9128
  apply(rule henstock_lemma_part1[unfolded split_def,OF assms(1-3)])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9129
  apply safe apply(rule assms[rule_format,unfolded split_def]) defer
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9130
  apply(rule tagged_partial_division_subset,rule assms,assumption)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9131
  apply(rule fine_subset,assumption,rule assms) using assms(5) by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9132
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9133
lemma henstock_lemma: fixes f::"'m::ordered_euclidean_space \<Rightarrow> 'n::ordered_euclidean_space"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9134
  assumes "f integrable_on {a..b}" "e>0"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9135
  obtains d where "gauge d"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9136
  "\<forall>p. p tagged_partial_division_of {a..b} \<and> d fine p
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9137
  \<longrightarrow> setsum (\<lambda>(x,k). norm(content k *\<^sub>R f x - integral k f)) p < e"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9138
proof- have *:"e / (2 * (real DIM('n) + 1)) > 0" apply(rule divide_pos_pos) using assms(2) by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9139
  from integrable_integral[OF assms(1),unfolded has_integral[of f],rule_format,OF this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9140
  guess d .. note d = conjunctD2[OF this] show thesis apply(rule that,rule d)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9141
  proof safe case goal1 note * = henstock_lemma_part2[OF assms(1) * d this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9142
    show ?case apply(rule le_less_trans[OF *]) using `e>0` by(auto simp add:field_simps) qed qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9143
44514
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9144
subsection {* Geometric progression *}
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9145
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9146
text {* FIXME: Should one or more of these theorems be moved to @{file
47317
432b29a96f61 modernized obsolete old-style theory name with proper new-style underscore
huffman
parents: 47152
diff changeset
  9147
"~~/src/HOL/Set_Interval.thy"}, alongside @{text geometric_sum}? *}
44514
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9148
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9149
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
  9150
  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
  9151
  shows "(1 - x) * setsum (\<lambda>i. x^i) {0 .. n} = (1 - x^(Suc n))"
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9152
proof-
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9153
  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
  9154
  have "y * (\<Sum>i=0..n. (1 - y) ^ i) = 1 - (1 - y) ^ Suc n"
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9155
    by (induct n, simp, simp add: algebra_simps)
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9156
  thus ?thesis
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9157
    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
  9158
qed
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9159
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9160
lemma sum_gp_multiplied: assumes mn: "m <= n"
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9161
  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
  9162
  (is "?lhs = ?rhs")
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9163
proof-
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9164
  let ?S = "{0..(n - m)}"
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9165
  from mn have mn': "n - m \<ge> 0" by arith
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9166
  let ?f = "op + m"
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9167
  have i: "inj_on ?f ?S" unfolding inj_on_def by auto
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9168
  have f: "?f ` ?S = {m..n}"
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9169
    using mn apply (auto simp add: image_iff Bex_def) by arith
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9170
  have th: "op ^ x o op + m = (\<lambda>i. x^m * x^i)"
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9171
    by (rule ext, simp add: power_add power_mult)
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9172
  from setsum_reindex[OF i, of "op ^ x", unfolded f th setsum_right_distrib[symmetric]]
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9173
  have "?lhs = x^m * ((1 - x) * setsum (op ^ x) {0..n - m})" by simp
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9174
  then show ?thesis unfolding sum_gp_basic using mn
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9175
    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
  9176
qed
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9177
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9178
lemma sum_gp: "setsum (op ^ (x::'a::{field})) {m .. n} =
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9179
   (if n < m then 0 else if x = 1 then of_nat ((n + 1) - m)
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9180
                    else (x^ m - x^ (Suc n)) / (1 - x))"
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9181
proof-
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9182
  {assume nm: "n < m" hence ?thesis by simp}
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9183
  moreover
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9184
  {assume "\<not> n < m" hence nm: "m \<le> n" by arith
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9185
    {assume x: "x = 1"  hence ?thesis by simp}
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9186
    moreover
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9187
    {assume x: "x \<noteq> 1" hence nz: "1 - x \<noteq> 0" by simp
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9188
      from sum_gp_multiplied[OF nm, of x] nz have ?thesis by (simp add: field_simps)}
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9189
    ultimately have ?thesis by metis
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9190
  }
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9191
  ultimately show ?thesis by metis
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9192
qed
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9193
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9194
lemma sum_gp_offset: "setsum (op ^ (x::'a::{field})) {m .. m+n} =
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9195
  (if x = 1 then of_nat n + 1 else x^m * (1 - x^Suc n) / (1 - x))"
d02b01e5ab8f move geometric progression lemmas from Linear_Algebra.thy to Integration.thy where they are used
huffman
parents: 44457
diff changeset
  9196
  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
  9197
  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
  9198
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9199
subsection {* monotone convergence (bounded interval first). *}
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9200
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9201
lemma monotone_convergence_interval: fixes f::"nat \<Rightarrow> 'n::ordered_euclidean_space \<Rightarrow> real"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9202
  assumes "\<forall>k. (f k) integrable_on {a..b}"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9203
  "\<forall>k. \<forall>x\<in>{a..b}.(f k x) \<le> (f (Suc k) x)"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9204
  "\<forall>x\<in>{a..b}. ((\<lambda>k. f k x) ---> g x) sequentially"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9205
  "bounded {integral {a..b} (f k) | k . k \<in> UNIV}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9206
  shows "g integrable_on {a..b} \<and> ((\<lambda>k. integral ({a..b}) (f k)) ---> integral ({a..b}) g) sequentially"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9207
proof(case_tac[!] "content {a..b} = 0") assume as:"content {a..b} = 0"
44125
230a8665c919 mark some redundant theorems as legacy
huffman
parents: 42871
diff changeset
  9208
  show ?thesis using integrable_on_null[OF as] unfolding integral_null[OF as] using tendsto_const by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9209
next assume ab:"content {a..b} \<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
  9210
  have fg:"\<forall>x\<in>{a..b}. \<forall> k. (f k x) \<bullet> 1 \<le> (g x) \<bullet> 1"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9211
  proof safe case goal1 note assms(3)[rule_format,OF this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9212
    note * = Lim_component_ge[OF this trivial_limit_sequentially]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9213
    show ?case apply(rule *) unfolding eventually_sequentially
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9214
      apply(rule_tac x=k in exI) apply- apply(rule transitive_stepwise_le)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9215
      using assms(2)[rule_format,OF goal1] by auto qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9216
  have "\<exists>i. ((\<lambda>k. integral ({a..b}) (f k)) ---> i) sequentially"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9217
    apply(rule bounded_increasing_convergent) defer
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9218
    apply rule apply(rule integral_le) apply safe
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9219
    apply(rule assms(1-2)[rule_format])+ using assms(4) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9220
  then guess i .. note i=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
  9221
  have i':"\<And>k. (integral({a..b}) (f k)) \<le> i\<bullet>1"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9222
    apply(rule Lim_component_ge,rule i) apply(rule trivial_limit_sequentially)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9223
    unfolding eventually_sequentially apply(rule_tac x=k in exI)
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
  9224
    apply(rule transitive_stepwise_le) prefer 3 unfolding inner_simps real_inner_1_right apply(rule integral_le)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9225
    apply(rule assms(1-2)[rule_format])+ using assms(2) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9226
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9227
  have "(g has_integral i) {a..b}" unfolding has_integral
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9228
  proof safe case goal1 note e=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9229
    hence "\<forall>k. (\<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow>
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9230
             norm ((\<Sum>(x, ka)\<in>p. content ka *\<^sub>R f k x) - integral {a..b} (f k)) < e / 2 ^ (k + 2)))"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9231
      apply-apply(rule,rule assms(1)[unfolded has_integral_integral has_integral,rule_format])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9232
      apply(rule divide_pos_pos) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9233
    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
  9234
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
  9235
    have "\<exists>r. \<forall>k\<ge>r. 0 \<le> i\<bullet>1 - (integral {a..b} (f k)) \<and> i\<bullet>1 - (integral {a..b} (f k)) < e / 4"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9236
    proof- case goal1 have "e/4 > 0" using e by auto
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
  9237
      from LIMSEQ_D [OF i this] guess r ..
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9238
      thus ?case apply(rule_tac x=r in exI) apply rule
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9239
        apply(erule_tac x=k in allE)
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
  9240
      proof- case goal1 thus ?case using i'[of k] by auto qed qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9241
    then guess r .. note r=conjunctD2[OF this[rule_format]]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9242
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
  9243
    have "\<forall>x\<in>{a..b}. \<exists>n\<ge>r. \<forall>k\<ge>n. 0 \<le> (g x)\<bullet>1 - (f k x)\<bullet>1 \<and>
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  9244
           (g x)\<bullet>1 - (f k x)\<bullet>1 < e / (4 * content({a..b}))"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9245
    proof case goal1 have "e / (4 * content {a..b}) > 0" apply(rule divide_pos_pos,fact)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9246
        using ab content_pos_le[of a b] by auto
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
  9247
      from assms(3)[rule_format, OF goal1, THEN LIMSEQ_D, OF this]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9248
      guess n .. note n=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9249
      thus ?case apply(rule_tac x="n + r" in exI) apply safe apply(erule_tac[2-3] x=k in allE)
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
  9250
        unfolding dist_real_def using fg[rule_format,OF goal1]
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  9251
        by (auto simp add:field_simps) qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9252
    from bchoice[OF this] guess m .. note m=conjunctD2[OF this[rule_format],rule_format]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9253
    def d \<equiv> "\<lambda>x. c (m x) x"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9254
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9255
    show ?case apply(rule_tac x=d in exI)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9256
    proof safe show "gauge d" using c(1) unfolding gauge_def d_def by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9257
    next fix p assume p:"p tagged_division_of {a..b}" "d fine p"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9258
      note p'=tagged_division_ofD[OF p(1)]
41851
96184364aa6f got rid of lemma upper_bound_finite_set
nipkow
parents: 41601
diff changeset
  9259
      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
  9260
        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
  9261
      then guess s .. note s=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9262
      have *:"\<forall>a b c d. norm(a - b) \<le> e / 4 \<and> norm(b - c) < e / 2 \<and>
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9263
            norm(c - d) < e / 4 \<longrightarrow> norm(a - d) < e"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9264
      proof safe case goal1 thus ?case using norm_triangle_lt[of "a - b" "b - c" "3* e/4"]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9265
          norm_triangle_lt[of "a - b + (b - c)" "c - d" e] unfolding norm_minus_cancel
36350
bc7982c54e37 dropped group_simps, ring_simps, field_eq_simps
haftmann
parents: 36334
diff changeset
  9266
          by(auto simp add:algebra_simps) qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9267
      show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - i) < e" apply(rule *[rule_format,where
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9268
          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))"])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9269
      proof safe case goal1
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9270
         show ?case apply(rule order_trans[of _ "\<Sum>(x, k)\<in>p. content k * (e / (4 * content {a..b}))"])
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9271
           unfolding setsum_subtractf[symmetric] apply(rule order_trans,rule norm_setsum)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9272
           apply(rule setsum_mono) unfolding split_paired_all split_conv
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9273
           unfolding split_def setsum_left_distrib[symmetric] scaleR_diff_right[symmetric]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9274
           unfolding additive_content_tagged_division[OF p(1), unfolded split_def]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9275
         proof- fix x k assume xk:"(x,k) \<in> p" hence x:"x\<in>{a..b}" using p'(2-3)[OF xk] by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9276
           from p'(4)[OF xk] guess u v apply-by(erule exE)+ note uv=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9277
           show " norm (content k *\<^sub>R (g x - f (m x) x)) \<le> content k * (e / (4 * content {a..b}))"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9278
             unfolding norm_scaleR uv unfolding abs_of_nonneg[OF content_pos_le]
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9279
             apply(rule mult_left_mono) using m(2)[OF x,of "m x"] by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9280
         qed(insert ab,auto)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9281
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9282
       next case goal2 show ?case apply(rule le_less_trans[of _ "norm (\<Sum>j = 0..s.
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9283
           \<Sum>(x, k)\<in>{xk\<in>p. m (fst xk) = j}. content k *\<^sub>R f (m x) x - integral k (f (m x)))"])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9284
           apply(subst setsum_group) apply fact apply(rule finite_atLeastAtMost) defer
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9285
           apply(subst split_def)+ unfolding setsum_subtractf apply rule
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9286
         proof- show "norm (\<Sum>j = 0..s. \<Sum>(x, k)\<in>{xk \<in> p.
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9287
             m (fst xk) = j}. content k *\<^sub>R f (m x) x - integral k (f (m x))) < e / 2"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9288
             apply(rule le_less_trans[of _ "setsum (\<lambda>i. e / 2^(i+2)) {0..s}"])
44176
eda112e9cdee remove redundant lemma setsum_norm in favor of norm_setsum;
huffman
parents: 44170
diff changeset
  9289
             apply(rule setsum_norm_le)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9290
           proof show "(\<Sum>i = 0..s. e / 2 ^ (i + 2)) < e / 2"
36778
739a9379e29b avoid using real-specific versions of generic lemmas
huffman
parents: 36725
diff changeset
  9291
               unfolding power_add divide_inverse inverse_mult_distrib
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9292
               unfolding setsum_right_distrib[symmetric] setsum_left_distrib[symmetric]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9293
               unfolding power_inverse sum_gp apply(rule mult_strict_left_mono[OF _ e])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9294
               unfolding power2_eq_square by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9295
             fix t assume "t\<in>{0..s}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9296
             show "norm (\<Sum>(x, k)\<in>{xk \<in> p. m (fst xk) = t}. content k *\<^sub>R f (m x) x -
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9297
               integral k (f (m x))) \<le> e / 2 ^ (t + 2)"apply(rule order_trans[of _
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9298
               "norm(setsum (\<lambda>(x,k). content k *\<^sub>R f t x - integral k (f t)) {xk \<in> p. m (fst xk) = t})"])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9299
               apply(rule eq_refl) apply(rule arg_cong[where f=norm]) apply(rule setsum_cong2) defer
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9300
               apply(rule henstock_lemma_part1) apply(rule assms(1)[rule_format])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9301
               apply(rule divide_pos_pos,rule e) defer  apply safe apply(rule c)+
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9302
               apply rule apply assumption+ apply(rule tagged_partial_division_subset[of p])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9303
               apply(rule p(1)[unfolded tagged_division_of_def,THEN conjunct1]) defer
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9304
               unfolding fine_def apply safe apply(drule p(2)[unfolded fine_def,rule_format])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9305
               unfolding d_def by auto qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9306
         qed(insert s, auto)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9307
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9308
       next case goal3
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9309
         note comb = integral_combine_tagged_division_topdown[OF assms(1)[rule_format] p(1)]
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
  9310
         have *:"\<And>sr sx ss ks kr::real. kr = sr \<longrightarrow> ks = ss \<longrightarrow> ks \<le> i \<and> sr \<le> sx \<and> sx \<le> ss \<and> 0 \<le> i\<bullet>1 - kr\<bullet>1
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9311
           \<and> i\<bullet>1 - kr\<bullet>1 < e/4 \<longrightarrow> abs(sx - i) < e/4" 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
  9312
         show ?case unfolding real_norm_def apply(rule *[rule_format],safe)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9313
           apply(rule comb[of r],rule comb[of s]) apply(rule i'[unfolded real_inner_1_right])
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9314
           apply(rule_tac[1-2] setsum_mono) unfolding split_paired_all split_conv
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9315
           apply(rule_tac[1-2] integral_le[OF ])
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
  9316
         proof safe show "0 \<le> i\<bullet>1 - (integral {a..b} (f r))\<bullet>1" using r(1) 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
  9317
           show "i\<bullet>1 - (integral {a..b} (f r))\<bullet>1 < e / 4" using r(2) by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9318
           fix x k assume xk:"(x,k)\<in>p" from p'(4)[OF this] guess u v apply-by(erule exE)+ note uv=this
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9319
           show "f r integrable_on k" "f s integrable_on k" "f (m x) integrable_on k" "f (m x) integrable_on k"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9320
             unfolding uv apply(rule_tac[!] integrable_on_subinterval[OF assms(1)[rule_format]])
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9321
             using p'(3)[OF xk] unfolding uv by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9322
           fix y assume "y\<in>k" hence "y\<in>{a..b}" using p'(3)[OF xk] 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
  9323
           hence *:"\<And>m. \<forall>n\<ge>m. (f m y) \<le> (f n y)" apply-apply(rule transitive_stepwise_le) using assms(2) 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
  9324
           show "(f r y) \<le> (f (m x) y)" "(f (m x) y) \<le> (f s y)"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9325
             apply(rule_tac[!] *[rule_format]) using s[rule_format,OF xk] m(1)[of x] p'(2-3)[OF xk] by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9326
         qed qed qed qed note * = this
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9327
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9328
   have "integral {a..b} g = i" apply(rule integral_unique) using * .
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9329
   thus ?thesis using i * by auto qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9330
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9331
lemma monotone_convergence_increasing: fixes f::"nat \<Rightarrow> 'n::ordered_euclidean_space \<Rightarrow> real"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9332
  assumes "\<forall>k. (f k) integrable_on s"  "\<forall>k. \<forall>x\<in>s. (f k x) \<le> (f (Suc k) x)"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9333
  "\<forall>x\<in>s. ((\<lambda>k. f k x) ---> g x) sequentially" "bounded {integral s (f k)| k. True}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9334
  shows "g integrable_on s \<and> ((\<lambda>k. integral s (f k)) ---> integral s g) sequentially"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9335
proof- have lem:"\<And>f::nat \<Rightarrow> 'n::ordered_euclidean_space \<Rightarrow> real. \<And> g s. \<forall>k.\<forall>x\<in>s. 0 \<le> (f k x) \<Longrightarrow> \<forall>k. (f k) integrable_on s \<Longrightarrow>
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9336
    \<forall>k. \<forall>x\<in>s. (f k x) \<le> (f (Suc k) x) \<Longrightarrow> \<forall>x\<in>s. ((\<lambda>k. f k x) ---> g x) sequentially  \<Longrightarrow>
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9337
    bounded {integral s (f k)| k. True} \<Longrightarrow> g integrable_on s \<and> ((\<lambda>k. integral s (f k)) ---> integral s g) sequentially"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9338
  proof- case goal1 note assms=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
  9339
    have "\<forall>x\<in>s. \<forall>k. (f k x)\<bullet>1 \<le> (g x)\<bullet>1" apply safe apply(rule Lim_component_ge)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9340
      apply(rule goal1(4)[rule_format],assumption) apply(rule trivial_limit_sequentially)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9341
      unfolding eventually_sequentially apply(rule_tac x=k in exI)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9342
      apply(rule transitive_stepwise_le) using goal1(3) by auto note fg=this[rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9343
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9344
    have "\<exists>i. ((\<lambda>k. integral s (f k)) ---> i) sequentially" apply(rule bounded_increasing_convergent)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9345
      apply(rule goal1(5)) apply(rule,rule integral_le) apply(rule goal1(2)[rule_format])+
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9346
      using goal1(3) by auto then guess i .. note i=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9347
    have "\<And>k. \<forall>x\<in>s. \<forall>n\<ge>k. f k x \<le> f n x" apply(rule,rule transitive_stepwise_le) using goal1(3) 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
  9348
    hence i':"\<forall>k. (integral s (f k))\<bullet>1 \<le> i\<bullet>1" apply-apply(rule,rule Lim_component_ge)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9349
      apply(rule i,rule trivial_limit_sequentially) unfolding eventually_sequentially
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9350
      apply(rule_tac x=k in exI,safe) 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
  9351
      apply simp
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9352
      apply(rule goal1(2)[rule_format])+ by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9353
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9354
    note int = assms(2)[unfolded integrable_alt[of _ s],THEN conjunct1,rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9355
    have ifif:"\<And>k t. (\<lambda>x. if x \<in> t then if x \<in> s then f k x else 0 else 0) =
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9356
      (\<lambda>x. if x \<in> t\<inter>s then f k x else 0)" apply(rule ext) by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9357
    have int':"\<And>k a b. f k integrable_on {a..b} \<inter> s" apply(subst integrable_restrict_univ[symmetric])
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9358
      apply(subst ifif[symmetric]) apply(subst integrable_restrict_univ) using int .
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9359
    have "\<And>a b. (\<lambda>x. if x \<in> s then g x else 0) integrable_on {a..b} \<and>
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9360
      ((\<lambda>k. integral {a..b} (\<lambda>x. if x \<in> s then f k x else 0)) --->
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9361
      integral {a..b} (\<lambda>x. if x \<in> s then g x else 0)) sequentially"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9362
    proof(rule monotone_convergence_interval,safe)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9363
      case goal1 show ?case using int .
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9364
    next case goal2 thus ?case apply-apply(cases "x\<in>s") using assms(3) by auto
44125
230a8665c919 mark some redundant theorems as legacy
huffman
parents: 42871
diff changeset
  9365
    next case goal3 thus ?case apply-apply(cases "x\<in>s")
44457
d366fa5551ef declare euclidean_simps [simp] at the point they are proved;
huffman
parents: 44282
diff changeset
  9366
        using assms(4) 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
  9367
    next case goal4 note * = integral_nonneg
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9368
      have "\<And>k. norm (integral {a..b} (\<lambda>x. if x \<in> s then f k x else 0)) \<le> norm (integral s (f 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
  9369
        unfolding real_norm_def apply(subst abs_of_nonneg) apply(rule *[OF int])
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9370
        apply(safe,case_tac "x\<in>s") apply(drule assms(1)) prefer 3
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9371
        apply(subst abs_of_nonneg) apply(rule *[OF assms(2) goal1(1)[THEN spec]])
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9372
        apply(subst integral_restrict_univ[symmetric,OF int])
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9373
        unfolding ifif unfolding integral_restrict_univ[OF int']
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9374
        apply(rule integral_subset_le[OF _ int' assms(2)]) using assms(1) by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9375
      thus ?case using assms(5) unfolding bounded_iff apply safe
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9376
        apply(rule_tac x=aa in exI,safe) apply(erule_tac x="integral s (f k)" in ballE)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9377
        apply(rule order_trans) apply assumption by auto qed note g = conjunctD2[OF this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9378
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9379
    have "(g has_integral i) s" unfolding has_integral_alt' apply safe apply(rule g(1))
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9380
    proof- case goal1 hence "e/4>0" by auto
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
  9381
      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
  9382
      note assms(2)[of N,unfolded has_integral_integral has_integral_alt'[of "f N"]]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9383
      from this[THEN conjunct2,rule_format,OF `e/4>0`] guess B .. note B=conjunctD2[OF this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9384
      show ?case apply(rule,rule,rule B,safe)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9385
      proof- fix a b::"'n::ordered_euclidean_space" assume ab:"ball 0 B \<subseteq> {a..b}"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9386
        from `e>0` have "e/2>0" by auto
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
  9387
        from LIMSEQ_D [OF g(2)[of a b] this] guess M .. note M=this
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9388
        have **:"norm (integral {a..b} (\<lambda>x. if x \<in> s then f N x else 0) - i) < e/2"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9389
          apply(rule norm_triangle_half_l) using B(2)[rule_format,OF ab] N[rule_format,of N]
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
  9390
          apply-defer apply(subst norm_minus_commute) 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
  9391
        have *:"\<And>f1 f2 g. abs(f1 - i) < e / 2 \<longrightarrow> abs(f2 - g) < e / 2 \<longrightarrow> f1 \<le> f2 \<longrightarrow> f2 \<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
  9392
          \<longrightarrow> abs(g - i) < e" unfolding real_inner_1_right by arith
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9393
        show "norm (integral {a..b} (\<lambda>x. if x \<in> s then g x else 0) - i) < e"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9394
          unfolding real_norm_def apply(rule *[rule_format])
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9395
          apply(rule **[unfolded real_norm_def])
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
  9396
          apply(rule M[rule_format,of "M + N",unfolded real_norm_def]) apply(rule le_add1)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9397
          apply(rule integral_le[OF int int]) 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
  9398
          apply(rule order_trans[OF _ i'[rule_format,of "M + N",unfolded real_inner_1_right]])
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  9399
        proof safe case goal2 have "\<And>m. x\<in>s \<Longrightarrow> \<forall>n\<ge>m. (f m x)\<bullet>1 \<le> (f n x)\<bullet>1"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9400
            apply(rule transitive_stepwise_le) using assms(3) by auto thus ?case by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9401
        next case goal1 show ?case apply(subst integral_restrict_univ[symmetric,OF int])
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9402
            unfolding ifif integral_restrict_univ[OF int']
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9403
            apply(rule integral_subset_le[OF _ int']) using assms by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9404
        qed qed qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9405
    thus ?case apply safe defer apply(drule integral_unique) using i by auto qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9406
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9407
  have sub:"\<And>k. integral s (\<lambda>x. f k x - f 0 x) = integral s (f k) - integral s (f 0)"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9408
    apply(subst integral_sub) apply(rule assms(1)[rule_format])+ by rule
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9409
  have "\<And>x m. x\<in>s \<Longrightarrow> \<forall>n\<ge>m. (f m x) \<le> (f n x)" apply(rule transitive_stepwise_le)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9410
    using assms(2) by auto note * = this[rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9411
  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)) --->
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9412
      integral s (\<lambda>x. g x - f 0 x)) sequentially" apply(rule lem,safe)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9413
  proof- case goal1 thus ?case using *[of x 0 "Suc k"] by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9414
  next case goal2 thus ?case apply(rule integrable_sub) using assms(1) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9415
  next case goal3 thus ?case using *[of x "Suc k" "Suc (Suc k)"] by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9416
  next case goal4 thus ?case apply-apply(rule tendsto_diff)
53597
ea99a7964174 remove duplicate lemmas
huffman
parents: 53524
diff changeset
  9417
      using LIMSEQ_ignore_initial_segment[OF assms(3)[rule_format],of x 1] by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9418
  next case goal5 thus ?case using assms(4) unfolding bounded_iff
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9419
      apply safe apply(rule_tac x="a + norm (integral s (\<lambda>x. f 0 x))" in exI)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9420
      apply safe apply(erule_tac x="integral s (\<lambda>x. f (Suc k) x)" in ballE) unfolding sub
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9421
      apply(rule order_trans[OF norm_triangle_ineq4]) by auto qed
44125
230a8665c919 mark some redundant theorems as legacy
huffman
parents: 42871
diff changeset
  9422
  note conjunctD2[OF this] 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
  9423
    integrable_add[OF this(1) assms(1)[rule_format,of 0]]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9424
  thus ?thesis unfolding sub apply-apply rule defer apply(subst(asm) integral_sub)
53597
ea99a7964174 remove duplicate lemmas
huffman
parents: 53524
diff changeset
  9425
    using assms(1) apply auto by(rule LIMSEQ_imp_Suc) qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9426
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9427
lemma monotone_convergence_decreasing: fixes f::"nat \<Rightarrow> 'n::ordered_euclidean_space \<Rightarrow> real"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9428
  assumes "\<forall>k. (f k) integrable_on s"  "\<forall>k. \<forall>x\<in>s. (f (Suc k) x) \<le> (f k x)"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9429
  "\<forall>x\<in>s. ((\<lambda>k. f k x) ---> g x) sequentially" "bounded {integral s (f k)| k. True}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9430
  shows "g integrable_on s \<and> ((\<lambda>k. integral s (f k)) ---> integral s g) sequentially"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9431
proof- note assm = assms[rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9432
  have *:"{integral s (\<lambda>x. - f k x) |k. True} = op *\<^sub>R -1 ` {integral s (f k)| k. True}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9433
    apply safe unfolding image_iff apply(rule_tac x="integral s (f k)" in bexI) prefer 3
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9434
    apply(rule_tac x=k in exI) unfolding integral_neg[OF assm(1)] by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9435
  have "(\<lambda>x. - g x) integrable_on s \<and> ((\<lambda>k. integral s (\<lambda>x. - f k x))
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9436
    ---> integral s (\<lambda>x. - g x))  sequentially" apply(rule monotone_convergence_increasing)
44125
230a8665c919 mark some redundant theorems as legacy
huffman
parents: 42871
diff changeset
  9437
    apply(safe,rule integrable_neg) apply(rule assm) defer apply(rule tendsto_minus)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9438
    apply(rule assm,assumption) unfolding * apply(rule bounded_scaling) using assm by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9439
  note * = conjunctD2[OF this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9440
  show ?thesis apply rule using integrable_neg[OF *(1)] defer
44125
230a8665c919 mark some redundant theorems as legacy
huffman
parents: 42871
diff changeset
  9441
    using tendsto_minus[OF *(2)] apply- unfolding integral_neg[OF assm(1)]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9442
    unfolding integral_neg[OF *(1),symmetric] by auto qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9443
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9444
subsection {* absolute integrability (this is the same as Lebesgue integrability). *}
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9445
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9446
definition absolutely_integrable_on (infixr "absolutely'_integrable'_on" 46) where
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9447
  "f absolutely_integrable_on s \<longleftrightarrow> f integrable_on s \<and> (\<lambda>x. (norm(f x))) integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9448
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9449
lemma absolutely_integrable_onI[intro?]:
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9450
  "f integrable_on s \<Longrightarrow> (\<lambda>x. (norm(f x))) integrable_on s \<Longrightarrow> f absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9451
  unfolding absolutely_integrable_on_def by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9452
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9453
lemma absolutely_integrable_onD[dest]: assumes "f absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9454
  shows "f integrable_on s" "(\<lambda>x. (norm(f x))) integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9455
  using assms unfolding absolutely_integrable_on_def by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9456
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9457
(*lemma absolutely_integrable_on_trans[simp]: fixes f::"'n::ordered_euclidean_space \<Rightarrow> real" shows
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9458
  "(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
  9459
  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
  9460
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9461
lemma integral_norm_bound_integral: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9462
  assumes "f integrable_on s" "g integrable_on s" "\<forall>x\<in>s. norm(f x) \<le> g x"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9463
  shows "norm(integral s f) \<le> (integral s g)"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9464
proof- have *:"\<And>x y. (\<forall>e::real. 0 < e \<longrightarrow> x < y + e) \<longrightarrow> x \<le> y" apply(safe,rule ccontr)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9465
    apply(erule_tac x="x - y" in allE) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9466
  have "\<And>e sg dsa dia ig. norm(sg) \<le> dsa \<longrightarrow> abs(dsa - dia) < e / 2 \<longrightarrow> norm(sg - ig) < e / 2
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9467
    \<longrightarrow> norm(ig) < dia + e"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9468
  proof safe case goal1 show ?case apply(rule le_less_trans[OF norm_triangle_sub[of ig sg]])
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9469
      apply(subst real_sum_of_halves[of e,symmetric]) unfolding add_assoc[symmetric]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9470
      apply(rule add_le_less_mono) defer apply(subst norm_minus_commute,rule goal1)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9471
      apply(rule order_trans[OF goal1(1)]) using goal1(2) by arith
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9472
  qed note norm=this[rule_format]
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9473
  have lem:"\<And>f::'n::ordered_euclidean_space \<Rightarrow> 'a. \<And> g a b. f integrable_on {a..b} \<Longrightarrow> g integrable_on {a..b} \<Longrightarrow>
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9474
    \<forall>x\<in>{a..b}. norm(f x) \<le> (g x) \<Longrightarrow> norm(integral({a..b}) f) \<le> (integral({a..b}) g)"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9475
  proof(rule *[rule_format]) case goal1 hence *:"e/2>0" by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9476
    from integrable_integral[OF goal1(1),unfolded has_integral[of f],rule_format,OF *]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9477
    guess d1 .. note d1 = conjunctD2[OF this,rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9478
    from integrable_integral[OF goal1(2),unfolded has_integral[of g],rule_format,OF *]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9479
    guess d2 .. note d2 = conjunctD2[OF this,rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9480
    note gauge_inter[OF d1(1) d2(1)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9481
    from fine_division_exists[OF this, of a b] guess p . note p=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9482
    show ?case apply(rule norm) defer
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9483
      apply(rule d2(2)[OF conjI[OF p(1)],unfolded real_norm_def]) defer
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9484
      apply(rule d1(2)[OF conjI[OF p(1)]]) defer apply(rule setsum_norm_le)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9485
    proof safe fix x k assume "(x,k)\<in>p" note as = tagged_division_ofD(2-4)[OF p(1) this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9486
      from this(3) guess u v apply-by(erule exE)+ note uv=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9487
      show "norm (content k *\<^sub>R f x) \<le> content k *\<^sub>R g x" unfolding uv norm_scaleR
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9488
        unfolding abs_of_nonneg[OF content_pos_le] real_scaleR_def
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9489
        apply(rule mult_left_mono) using goal1(3) as by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9490
    qed(insert p[unfolded fine_inter],auto) qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9491
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9492
  { presume "\<And>e. 0 < e \<Longrightarrow> norm (integral s f) < integral s g + e"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9493
    thus ?thesis apply-apply(rule *[rule_format]) by auto }
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9494
  fix e::real assume "e>0" hence e:"e/2 > 0" by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9495
  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
  9496
  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
  9497
  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
  9498
  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
  9499
  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
  9500
  guess B2 .. note B2=conjunctD2[OF this[rule_format],rule_format]
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9501
  from bounded_subset_closed_interval[OF bounded_ball, of "0::'n::ordered_euclidean_space" "max B1 B2"]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9502
  guess a b apply-by(erule exE)+ note ab=this[unfolded ball_max_Un]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9503
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9504
  have "ball 0 B1 \<subseteq> {a..b}" using ab by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9505
  from B1(2)[OF this] guess z .. note z=conjunctD2[OF this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9506
  have "ball 0 B2 \<subseteq> {a..b}" using ab by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9507
  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
  9508
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9509
  show "norm (integral s f) < integral s g + e" apply(rule norm)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9510
    apply(rule lem[OF f g, of a b]) unfolding integral_unique[OF z(1)] integral_unique[OF w(1)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9511
    defer apply(rule w(2)[unfolded real_norm_def],rule z(2))
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9512
    apply safe apply(case_tac "x\<in>s") unfolding if_P apply(rule assms(3)[rule_format]) by auto qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9513
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9514
lemma integral_norm_bound_integral_component: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9515
  fixes g::"'n => 'b::ordered_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
  9516
  assumes "f integrable_on s" "g integrable_on s"  "\<forall>x\<in>s. norm(f x) \<le> (g 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
  9517
  shows "norm(integral s f) \<le> (integral s g)\<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
  9518
proof- have "norm (integral s f) \<le> integral s ((\<lambda>x. x \<bullet> k) o g)"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9519
    apply(rule integral_norm_bound_integral[OF assms(1)])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9520
    apply(rule integrable_linear[OF assms(2)],rule)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9521
    unfolding o_def by(rule assms)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9522
  thus ?thesis unfolding o_def integral_component_eq[OF assms(2)] . qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9523
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9524
lemma has_integral_norm_bound_integral_component: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9525
  fixes g::"'n => 'b::ordered_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
  9526
  assumes "(f has_integral i) s" "(g has_integral j) s" "\<forall>x\<in>s. norm(f x) \<le> (g 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
  9527
  shows "norm(i) \<le> j\<bullet>k" 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
  9528
  unfolding integral_unique[OF assms(1)] integral_unique[OF assms(2)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9529
  using assms by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9530
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9531
lemma absolutely_integrable_le: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9532
  assumes "f absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9533
  shows "norm(integral s f) \<le> integral s (\<lambda>x. norm(f x))"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9534
  apply(rule integral_norm_bound_integral) using assms by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9535
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9536
lemma absolutely_integrable_0[intro]: "(\<lambda>x. 0) absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9537
  unfolding absolutely_integrable_on_def by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9538
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9539
lemma absolutely_integrable_cmul[intro]:
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9540
 "f absolutely_integrable_on s \<Longrightarrow> (\<lambda>x. c *\<^sub>R f x) absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9541
  unfolding absolutely_integrable_on_def using integrable_cmul[of f s c]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9542
  using integrable_cmul[of "\<lambda>x. norm (f x)" s "abs c"] by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9543
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9544
lemma absolutely_integrable_neg[intro]:
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9545
 "f absolutely_integrable_on s \<Longrightarrow> (\<lambda>x. -f(x)) absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9546
  apply(drule absolutely_integrable_cmul[where c="-1"]) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9547
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9548
lemma absolutely_integrable_norm[intro]:
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9549
 "f absolutely_integrable_on s \<Longrightarrow> (\<lambda>x. norm(f x)) absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9550
  unfolding absolutely_integrable_on_def by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9551
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9552
lemma absolutely_integrable_abs[intro]:
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9553
 "f absolutely_integrable_on s \<Longrightarrow> (\<lambda>x. abs(f x::real)) absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9554
  apply(drule absolutely_integrable_norm) unfolding real_norm_def .
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9555
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9556
lemma absolutely_integrable_on_subinterval: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach" shows
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9557
  "f absolutely_integrable_on s \<Longrightarrow> {a..b} \<subseteq> s \<Longrightarrow> f absolutely_integrable_on {a..b}"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9558
  unfolding absolutely_integrable_on_def by(meson integrable_on_subinterval)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9559
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9560
lemma absolutely_integrable_bounded_variation: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'a::banach"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9561
  assumes "f absolutely_integrable_on UNIV"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9562
  obtains B where "\<forall>d. d division_of (\<Union>d) \<longrightarrow> setsum (\<lambda>k. norm(integral k f)) d \<le> B"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9563
  apply(rule that[of "integral UNIV (\<lambda>x. norm (f x))"])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9564
proof safe case goal1 note d = division_ofD[OF this(2)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9565
  have "(\<Sum>k\<in>d. norm (integral k f)) \<le> (\<Sum>i\<in>d. integral i (\<lambda>x. norm (f x)))"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9566
    apply(rule setsum_mono,rule absolutely_integrable_le) apply(drule d(4),safe)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9567
    apply(rule absolutely_integrable_on_subinterval[OF assms]) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9568
  also have "... \<le> integral (\<Union>d) (\<lambda>x. norm (f x))"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9569
    apply(subst integral_combine_division_topdown[OF _ goal1(2)])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9570
    using integrable_on_subdivision[OF goal1(2)] using assms by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9571
  also have "... \<le> integral UNIV (\<lambda>x. norm (f x))"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9572
    apply(rule integral_subset_le)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9573
    using integrable_on_subdivision[OF goal1(2)] using assms by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9574
  finally show ?case . qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9575
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9576
lemma helplemma:
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9577
  assumes "setsum (\<lambda>x. norm(f x - g x)) s < e" "finite s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9578
  shows "abs(setsum (\<lambda>x. norm(f x)) s - setsum (\<lambda>x. norm(g x)) s) < e"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9579
  unfolding setsum_subtractf[symmetric] apply(rule le_less_trans[OF setsum_abs])
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9580
  apply(rule le_less_trans[OF _ assms(1)]) apply(rule setsum_mono)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9581
  using norm_triangle_ineq3 .
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9582
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9583
lemma bounded_variation_absolutely_integrable_interval:
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9584
  fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'm::ordered_euclidean_space" assumes "f integrable_on {a..b}"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9585
  "\<forall>d. d division_of {a..b} \<longrightarrow> setsum (\<lambda>k. norm(integral k f)) d \<le> B"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9586
  shows "f absolutely_integrable_on {a..b}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9587
proof- let ?S = "(\<lambda>d. setsum (\<lambda>k. norm(integral k f)) d) ` {d. d division_of {a..b} }" def i \<equiv> "Sup ?S"
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
  9588
  have i:"isLub UNIV ?S i" unfolding i_def apply(rule isLub_cSup)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9589
    apply(rule elementary_interval) defer apply(rule_tac x=B in exI)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9590
    apply(rule setleI) using assms(2) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9591
  show ?thesis apply(rule,rule assms) apply rule apply(subst has_integral[of _ i])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9592
  proof safe case goal1 hence "i - e / 2 \<notin> Collect (isUb UNIV (setsum (\<lambda>k. norm (integral k f)) `
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9593
        {d. d division_of {a..b}}))" using isLub_ubs[OF i,rule_format]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9594
      unfolding setge_def ubs_def by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9595
    hence " \<exists>y. y division_of {a..b} \<and> i - e / 2 < (\<Sum>k\<in>y. norm (integral k f))"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9596
      unfolding mem_Collect_eq isUb_def setle_def by(simp add:not_le) then guess d .. note d=conjunctD2[OF this]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9597
    note d' = division_ofD[OF this(1)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9598
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9599
    have "\<forall>x. \<exists>e>0. \<forall>i\<in>d. x \<notin> i \<longrightarrow> ball x e \<inter> i = {}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9600
    proof case goal1 have "\<exists>da>0. \<forall>xa\<in>\<Union>{i \<in> d. x \<notin> i}. da \<le> dist x xa"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9601
        apply(rule separate_point_closed) apply(rule closed_Union)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9602
        apply(rule finite_subset[OF _ d'(1)]) apply safe apply(drule d'(4)) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9603
      thus ?case apply safe apply(rule_tac x=da in exI,safe)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9604
        apply(erule_tac x=xa in ballE) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9605
    qed from choice[OF this] guess k .. note k=conjunctD2[OF this[rule_format],rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9606
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9607
    have "e/2 > 0" using goal1 by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9608
    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
  9609
    let ?g = "\<lambda>x. g x \<inter> ball x (k x)"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9610
    show ?case apply(rule_tac x="?g" in exI) apply safe
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9611
    proof- show "gauge ?g" using g(1) unfolding gauge_def using k(1) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9612
      fix p assume "p tagged_division_of {a..b}" "?g fine p"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9613
      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
  9614
      note p' = tagged_division_ofD[OF p(1)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9615
      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}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9616
      have gp':"g fine p'" using p(2) unfolding p'_def fine_def by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9617
      have p'':"p' tagged_division_of {a..b}" apply(rule tagged_division_ofI)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9618
      proof- show "finite p'" apply(rule finite_subset[of _ "(\<lambda>(k,(x,l)). (x,k \<inter> l))
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9619
          ` {(k,xl) | k xl. k \<in> d \<and> xl \<in> p}"]) unfolding p'_def
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9620
          defer apply(rule finite_imageI,rule finite_product_dependent[OF d'(1) p'(1)])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9621
          apply safe unfolding image_iff apply(rule_tac x="(i,x,l)" in bexI) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9622
        fix x k assume "(x,k)\<in>p'"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9623
        hence "\<exists>i l. x \<in> i \<and> i \<in> d \<and> (x, l) \<in> p \<and> k = i \<inter> l" unfolding p'_def by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9624
        then guess i l apply-by(erule exE)+ note il=conjunctD4[OF this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9625
        show "x\<in>k" "k\<subseteq>{a..b}" using p'(2-3)[OF il(3)] il by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9626
        show "\<exists>a b. k = {a..b}" unfolding il using p'(4)[OF il(3)] d'(4)[OF il(2)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9627
          apply safe unfolding inter_interval by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9628
      next fix x1 k1 assume "(x1,k1)\<in>p'"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9629
        hence "\<exists>i l. x1 \<in> i \<and> i \<in> d \<and> (x1, l) \<in> p \<and> k1 = i \<inter> l" unfolding p'_def by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9630
        then guess i1 l1 apply-by(erule exE)+ note il1=conjunctD4[OF this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9631
        fix x2 k2 assume "(x2,k2)\<in>p'"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9632
        hence "\<exists>i l. x2 \<in> i \<and> i \<in> d \<and> (x2, l) \<in> p \<and> k2 = i \<inter> l" unfolding p'_def by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9633
        then guess i2 l2 apply-by(erule exE)+ note il2=conjunctD4[OF this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9634
        assume "(x1, k1) \<noteq> (x2, k2)"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9635
        hence "interior(i1) \<inter> interior(i2) = {} \<or> interior(l1) \<inter> interior(l2) = {}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9636
          using d'(5)[OF il1(2) il2(2)] p'(5)[OF il1(3) il2(3)] unfolding il1 il2 by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9637
        thus "interior k1 \<inter> interior k2 = {}" unfolding il1 il2 by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9638
      next have *:"\<forall>(x, X) \<in> p'. X \<subseteq> {a..b}" unfolding p'_def using d' by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9639
        show "\<Union>{k. \<exists>x. (x, k) \<in> p'} = {a..b}" apply rule apply(rule Union_least)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9640
          unfolding mem_Collect_eq apply(erule exE) apply(drule *[rule_format]) apply safe
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9641
        proof- fix y assume y:"y\<in>{a..b}"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9642
          hence "\<exists>x l. (x, l) \<in> p \<and> y\<in>l" unfolding p'(6)[symmetric] by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9643
          then guess x l apply-by(erule exE)+ note xl=conjunctD2[OF this]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9644
          hence "\<exists>k. k\<in>d \<and> y\<in>k" using y unfolding d'(6)[symmetric] by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9645
          then guess i .. note i = conjunctD2[OF this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9646
          have "x\<in>i" using fineD[OF p(3) xl(1)] using k(2)[OF i(1), of x] using i(2) xl(2) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9647
          thus "y\<in>\<Union>{k. \<exists>x. (x, k) \<in> p'}" unfolding p'_def Union_iff apply(rule_tac x="i \<inter> l" in bexI)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9648
            defer unfolding mem_Collect_eq apply(rule_tac x=x in exI)+ apply(rule_tac x="i\<inter>l" in exI)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9649
            apply safe apply(rule_tac x=i in exI) apply(rule_tac x=l in exI) using i xl by auto
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9650
        qed qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9651
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9652
      hence "(\<Sum>(x, k)\<in>p'. norm (content k *\<^sub>R f x - integral k f)) < e / 2"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9653
        apply-apply(rule g(2)[rule_format]) unfolding tagged_division_of_def apply safe using gp' .
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9654
      hence **:" \<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"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9655
        unfolding split_def apply(rule helplemma) using p'' by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9656
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9657
      have p'alt:"p' = {(x,(i \<inter> l)) | x i l. (x,l) \<in> p \<and> i \<in> d \<and> ~(i \<inter> l = {})}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9658
      proof safe case goal2
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9659
        have "x\<in>i" using fineD[OF p(3) goal2(1)] k(2)[OF goal2(2), of x] goal2(4-) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9660
        hence "(x, i \<inter> l) \<in> p'" unfolding p'_def apply safe
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9661
          apply(rule_tac x=x in exI,rule_tac x="i\<inter>l" in exI) apply safe using goal2 by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9662
        thus ?case using goal2(3) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9663
      next fix x k assume "(x,k)\<in>p'"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9664
        hence "\<exists>i l. x \<in> i \<and> i \<in> d \<and> (x, l) \<in> p \<and> k = i \<inter> l" unfolding p'_def by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9665
        then guess i l apply-by(erule exE)+ note il=conjunctD4[OF this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9666
        thus "\<exists>y i l. (x, k) = (y, i \<inter> l) \<and> (y, l) \<in> p \<and> i \<in> d \<and> i \<inter> l \<noteq> {}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9667
          apply(rule_tac x=x in exI,rule_tac x=i in exI,rule_tac x=l in exI)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9668
          using p'(2)[OF il(3)] by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9669
      qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9670
      have sum_p':"(\<Sum>(x, k)\<in>p'. norm (integral k f)) = (\<Sum>k\<in>snd ` p'. norm (integral k f))"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9671
        apply(subst setsum_over_tagged_division_lemma[OF p'',of "\<lambda>k. norm (integral k f)"])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9672
        unfolding norm_eq_zero apply(rule integral_null,assumption) ..
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9673
      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
  9674
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9675
      have *:"\<And>sni sni' sf sf'. abs(sf' - sni') < e / 2 \<longrightarrow> i - e / 2 < sni \<and> sni' \<le> i \<and>
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9676
        sni \<le> sni' \<and> sf' = sf \<longrightarrow> abs(sf - i) < e" by arith
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9677
      show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x)) - i) < e"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9678
        unfolding real_norm_def apply(rule *[rule_format,OF **],safe) apply(rule d(2))
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9679
      proof- case goal1 show ?case unfolding sum_p'
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9680
          apply(rule isLubD2[OF i]) using division_of_tagged_division[OF p''] by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9681
      next case goal2 have *:"{k \<inter> l | k l. k \<in> d \<and> l \<in> snd ` p} =
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9682
          (\<lambda>(k,l). k \<inter> l) ` {(k,l)|k l. k \<in> d \<and> l \<in> snd ` p}" by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9683
        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))"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9684
        proof(rule setsum_mono) case goal1 note k=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9685
          from d'(4)[OF this] guess u v apply-by(erule exE)+ note uv=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9686
          def d' \<equiv> "{{u..v} \<inter> l |l. l \<in> snd ` p \<and>  ~({u..v} \<inter> l = {})}" note uvab = d'(2)[OF k[unfolded uv]]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9687
          have "d' division_of {u..v}" apply(subst d'_def) apply(rule division_inter_1)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9688
            apply(rule division_of_tagged_division[OF p(1)]) using uvab .
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9689
          hence "norm (integral k f) \<le> setsum (\<lambda>k. norm (integral k f)) d'"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9690
            unfolding uv apply(subst integral_combine_division_topdown[of _ _ d'])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9691
            apply(rule integrable_on_subinterval[OF assms(1) uvab]) apply assumption
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9692
            apply(rule setsum_norm_le) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9693
          also have "... = (\<Sum>k\<in>{k \<inter> l |l. l \<in> snd ` p}. norm (integral k f))"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9694
            apply(rule setsum_mono_zero_left) apply(subst simple_image)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9695
            apply(rule finite_imageI)+ apply fact unfolding d'_def uv apply blast
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9696
          proof case goal1 hence "i \<in> {{u..v} \<inter> l |l. l \<in> snd ` p}" by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9697
            from this[unfolded mem_Collect_eq] guess l .. note l=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9698
            hence "{u..v} \<inter> l = {}" using goal1 by auto thus ?case using l by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9699
          qed also have "... = (\<Sum>l\<in>snd ` p. norm (integral (k \<inter> l) f))" unfolding  simple_image
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9700
            apply(rule setsum_reindex_nonzero[unfolded o_def])apply(rule finite_imageI,rule p')
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9701
          proof- case goal1 have "interior (k \<inter> l) \<subseteq> interior (l \<inter> y)" apply(subst(2) interior_inter)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9702
              apply(rule Int_greatest) defer apply(subst goal1(4)) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9703
            hence *:"interior (k \<inter> l) = {}" using snd_p(5)[OF goal1(1-3)] by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9704
            from d'(4)[OF k] snd_p(4)[OF goal1(1)] guess u1 v1 u2 v2 apply-by(erule exE)+ note uv=this
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9705
            show ?case using * unfolding uv inter_interval content_eq_0_interior[symmetric] by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9706
          qed finally show ?case .
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9707
        qed also have "... = (\<Sum>(i,l)\<in>{(i, l) |i l. i \<in> d \<and> l \<in> snd ` p}. norm (integral (i\<inter>l) f))"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9708
          apply(subst sum_sum_product[symmetric],fact) using p'(1) by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9709
        also have "... = (\<Sum>x\<in>{(i, l) |i l. i \<in> d \<and> l \<in> snd ` p}. norm (integral (split op \<inter> x) f))"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9710
          unfolding split_def ..
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9711
        also have "... = (\<Sum>k\<in>{i \<inter> l |i l. i \<in> d \<and> l \<in> snd ` p}. norm (integral k f))"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9712
          unfolding * apply(rule setsum_reindex_nonzero[symmetric,unfolded o_def])
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9713
          apply(rule finite_product_dependent) apply(fact,rule finite_imageI,rule p')
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9714
          unfolding split_paired_all mem_Collect_eq split_conv o_def
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9715
        proof- note * = division_ofD(4,5)[OF division_of_tagged_division,OF p(1)]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9716
          fix l1 l2 k1 k2 assume as:"(l1, k1) \<noteq> (l2, k2)"  "l1 \<inter> k1 = l2 \<inter> k2"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9717
            "\<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
  9718
            "\<exists>i l. (l2, k2) = (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
  9719
          hence "l1 \<in> d" "k1 \<in> snd ` p" by auto from d'(4)[OF this(1)] *(1)[OF this(2)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9720
          guess u1 v1 u2 v2 apply-by(erule exE)+ note uv=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9721
          have "l1 \<noteq> l2 \<or> k1 \<noteq> k2" using as by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9722
          hence "(interior(k1) \<inter> interior(k2) = {} \<or> interior(l1) \<inter> interior(l2) = {})" apply-
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9723
            apply(erule disjE) apply(rule disjI2) apply(rule d'(5)) prefer 4 apply(rule disjI1)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9724
            apply(rule *) using as by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9725
          moreover have "interior(l1 \<inter> k1) = interior(l2 \<inter> k2)" using as(2) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9726
          ultimately have "interior(l1 \<inter> k1) = {}" by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9727
          thus "norm (integral (l1 \<inter> k1) f) = 0" unfolding uv inter_interval
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9728
            unfolding content_eq_0_interior[symmetric] by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9729
        qed also have "... = (\<Sum>(x, k)\<in>p'. norm (integral k f))" unfolding sum_p'
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9730
          apply(rule setsum_mono_zero_right) apply(subst *)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9731
          apply(rule finite_imageI[OF finite_product_dependent]) apply fact
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9732
          apply(rule finite_imageI[OF p'(1)]) apply safe
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9733
        proof- case goal2 have "ia \<inter> b = {}" using goal2 unfolding p'alt image_iff Bex_def not_ex
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9734
            apply(erule_tac x="(a,ia\<inter>b)" in allE) by auto thus ?case by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9735
        next case goal1 thus ?case unfolding p'_def apply safe
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9736
            apply(rule_tac x=i in exI,rule_tac x=l in exI) unfolding snd_conv image_iff
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9737
            apply safe apply(rule_tac x="(a,l)" in bexI) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9738
        qed finally show ?case .
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9739
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9740
      next case goal3
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9741
        let ?S = "{(x, i \<inter> l) |x i l. (x, l) \<in> p \<and> i \<in> d}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9742
        have Sigma_alt:"\<And>s t. s \<times> t = {(i, j) |i j. i \<in> s \<and> j \<in> t}" by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9743
        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}"**)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9744
          apply safe unfolding image_iff apply(rule_tac x="((x,l),i)" in bexI) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9745
        note pdfin = finite_cartesian_product[OF p'(1) d'(1)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9746
        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))"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9747
          unfolding norm_scaleR apply(rule setsum_mono_zero_left)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9748
          apply(subst *, rule finite_imageI) apply fact unfolding p'alt apply blast
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9749
          apply safe apply(rule_tac x=x in exI,rule_tac x=i in exI,rule_tac x=l in exI) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9750
        also have "... = (\<Sum>((x,l),i)\<in>p \<times> d. \<bar>content (l \<inter> i)\<bar> * norm (f x))" unfolding *
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9751
          apply(subst setsum_reindex_nonzero,fact) unfolding split_paired_all
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9752
          unfolding  o_def split_def snd_conv fst_conv mem_Sigma_iff Pair_eq apply(erule_tac conjE)+
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9753
        proof- fix x1 l1 k1 x2 l2 k2 assume as:"(x1,l1)\<in>p" "(x2,l2)\<in>p" "k1\<in>d" "k2\<in>d"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9754
            "x1 = x2" "l1 \<inter> k1 = l2 \<inter> k2" "\<not> ((x1 = x2 \<and> l1 = l2) \<and> k1 = k2)"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9755
          from d'(4)[OF as(3)] p'(4)[OF as(1)] guess u1 v1 u2 v2 apply-by(erule exE)+ note uv=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9756
          from as have "l1 \<noteq> l2 \<or> k1 \<noteq> k2" by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9757
          hence "(interior(k1) \<inter> interior(k2) = {} \<or> interior(l1) \<inter> interior(l2) = {})"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9758
            apply-apply(erule disjE) apply(rule disjI2) defer apply(rule disjI1)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9759
            apply(rule d'(5)[OF as(3-4)],assumption) apply(rule p'(5)[OF as(1-2)]) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9760
          moreover have "interior(l1 \<inter> k1) = interior(l2 \<inter> k2)" unfolding  as ..
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9761
          ultimately have "interior (l1 \<inter> k1) = {}" by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9762
          thus "\<bar>content (l1 \<inter> k1)\<bar> * norm (f x1) = 0" unfolding uv inter_interval
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9763
            unfolding content_eq_0_interior[symmetric] by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9764
        qed safe also have "... = (\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x))" unfolding Sigma_alt
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9765
          apply(subst sum_sum_product[symmetric]) apply(rule p', rule,rule d')
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9766
          apply(rule setsum_cong2) unfolding split_paired_all split_conv
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9767
        proof- fix x l assume as:"(x,l)\<in>p"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9768
          note xl = p'(2-4)[OF this] from this(3) guess u v apply-by(erule exE)+ note uv=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9769
          have "(\<Sum>i\<in>d. \<bar>content (l \<inter> i)\<bar>) = (\<Sum>k\<in>d. content (k \<inter> {u..v}))"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9770
            apply(rule setsum_cong2) apply(drule d'(4),safe) apply(subst Int_commute)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9771
            unfolding inter_interval uv apply(subst abs_of_nonneg) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9772
          also have "... = setsum content {k\<inter>{u..v}| k. k\<in>d}" unfolding simple_image
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9773
            apply(rule setsum_reindex_nonzero[unfolded o_def,symmetric]) apply(rule d')
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9774
          proof- case goal1 from d'(4)[OF this(1)] d'(4)[OF this(2)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9775
            guess u1 v1 u2 v2 apply- by(erule exE)+ note uv=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9776
            have "{} = interior ((k \<inter> y) \<inter> {u..v})" apply(subst interior_inter)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9777
              using d'(5)[OF goal1(1-3)] by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9778
            also have "... = interior (y \<inter> (k \<inter> {u..v}))" by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9779
            also have "... = interior (k \<inter> {u..v})" unfolding goal1(4) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9780
            finally show ?case unfolding uv inter_interval content_eq_0_interior ..
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9781
          qed also have "... = setsum content {{u..v} \<inter> k |k. k \<in> d \<and> ~({u..v} \<inter> k = {})}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9782
            apply(rule setsum_mono_zero_right) unfolding simple_image
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9783
            apply(rule finite_imageI,rule d') apply blast apply safe
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9784
            apply(rule_tac x=k in exI)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9785
          proof- case goal1 from d'(4)[OF this(1)] guess a b apply-by(erule exE)+ note ab=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9786
            have "interior (k \<inter> {u..v}) \<noteq> {}" using goal1(2)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9787
              unfolding ab inter_interval content_eq_0_interior by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9788
            thus ?case using goal1(1) using interior_subset[of "k \<inter> {u..v}"] by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9789
          qed finally show "(\<Sum>i\<in>d. \<bar>content (l \<inter> i)\<bar> * norm (f x)) = content l *\<^sub>R norm (f x)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9790
            unfolding setsum_left_distrib[symmetric] real_scaleR_def apply -
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9791
            apply(subst(asm) additive_content_division[OF division_inter_1[OF d(1)]])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9792
            using xl(2)[unfolded uv] unfolding uv by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9793
        qed finally show ?case .
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9794
      qed qed qed qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9795
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9796
lemma bounded_variation_absolutely_integrable:  fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'm::ordered_euclidean_space"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9797
  assumes "f integrable_on UNIV" "\<forall>d. d division_of (\<Union>d) \<longrightarrow> setsum (\<lambda>k. norm(integral k f)) d \<le> B"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9798
  shows "f absolutely_integrable_on UNIV"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9799
proof(rule absolutely_integrable_onI,fact,rule)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9800
  let ?S = "(\<lambda>d. setsum (\<lambda>k. norm(integral k f)) d) ` {d. d division_of  (\<Union>d)}" def i \<equiv> "Sup ?S"
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
  9801
  have i:"isLub UNIV ?S i" unfolding i_def apply(rule isLub_cSup)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9802
    apply(rule elementary_interval) defer apply(rule_tac x=B in exI)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9803
    apply(rule setleI) using assms(2) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9804
  have f_int:"\<And>a b. f absolutely_integrable_on {a..b}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9805
    apply(rule bounded_variation_absolutely_integrable_interval[where B=B])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9806
    apply(rule integrable_on_subinterval[OF assms(1)]) defer apply safe
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9807
    apply(rule assms(2)[rule_format]) by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9808
  show "((\<lambda>x. norm (f x)) has_integral i) UNIV" apply(subst has_integral_alt',safe)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9809
  proof- case goal1 show ?case using f_int[of a b] by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9810
  next case goal2 have "\<exists>y\<in>setsum (\<lambda>k. norm (integral k f)) ` {d. d division_of \<Union>d}. \<not> y \<le> i - e"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9811
    proof(rule ccontr) case goal1 hence "i \<le> i - e" apply-
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9812
        apply(rule isLub_le_isUb[OF i]) apply(rule isUbI) unfolding setle_def by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9813
      thus False using goal2 by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9814
    qed then guess K .. note * = this[unfolded image_iff not_le]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9815
    from this(1) guess d .. note this[unfolded mem_Collect_eq]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9816
    note d = this(1) *(2)[unfolded this(2)] note d'=division_ofD[OF this(1)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9817
    have "bounded (\<Union>d)" by(rule elementary_bounded,fact)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9818
    from this[unfolded bounded_pos] guess K .. note K=conjunctD2[OF this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9819
    show ?case apply(rule_tac x="K + 1" in exI,safe)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9820
    proof- fix a b assume ab:"ball 0 (K + 1) \<subseteq> {a..b::'n::ordered_euclidean_space}"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9821
      have *:"\<forall>s s1. i - e < s1 \<and> s1 \<le> s \<and> s < i + e \<longrightarrow> abs(s - i) < (e::real)" by arith
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9822
      show "norm (integral {a..b} (\<lambda>x. if x \<in> UNIV then norm (f x) else 0) - i) < e"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9823
        unfolding real_norm_def apply(rule *[rule_format],safe) apply(rule d(2))
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9824
      proof- case goal1 have "(\<Sum>k\<in>d. norm (integral k f)) \<le> setsum (\<lambda>k. integral k (\<lambda>x. norm (f x))) d"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9825
          apply(rule setsum_mono) apply(rule absolutely_integrable_le)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9826
          apply(drule d'(4),safe) by(rule f_int)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9827
        also have "... = integral (\<Union>d) (\<lambda>x. norm(f x))"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9828
          apply(rule integral_combine_division_bottomup[symmetric])
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9829
          apply(rule d) unfolding forall_in_division[OF d(1)] using f_int by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9830
        also have "... \<le> integral {a..b} (\<lambda>x. if x \<in> UNIV then norm (f x) else 0)"
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9831
        proof- case goal1 have "\<Union>d \<subseteq> {a..b}" apply rule apply(drule K(2)[rule_format])
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9832
            apply(rule ab[unfolded subset_eq,rule_format]) by(auto simp add:dist_norm)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9833
          thus ?case apply- apply(subst if_P,rule) apply(rule integral_subset_le) defer
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9834
            apply(rule integrable_on_subdivision[of _ _ _ "{a..b}"])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9835
            apply(rule d) using f_int[of a b] by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9836
        qed finally show ?case .
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9837
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9838
      next note f = absolutely_integrable_onD[OF f_int[of a b]]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9839
        note * = this(2)[unfolded has_integral_integral has_integral[of "\<lambda>x. norm (f x)"],rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9840
        have "e/2>0" using `e>0` by auto from *[OF this] guess d1 .. note d1=conjunctD2[OF this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9841
        from henstock_lemma[OF f(1) `e/2>0`] guess d2 . note d2=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9842
        from fine_division_exists[OF gauge_inter[OF d1(1) d2(1)], of a b] guess p .
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9843
        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
  9844
        have *:"\<And>sf sf' si di. sf' = sf \<longrightarrow> si \<le> i \<longrightarrow> abs(sf - si) < e / 2
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9845
          \<longrightarrow> abs(sf' - di) < e / 2 \<longrightarrow> di < i + e" by arith
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9846
        show "integral {a..b} (\<lambda>x. if x \<in> UNIV then norm (f x) else 0) < i + e" apply(subst if_P,rule)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9847
        proof(rule *[rule_format])
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9848
          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"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9849
            unfolding split_def apply(rule helplemma) using d2(2)[rule_format,of p]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9850
            using p(1,3) unfolding tagged_division_of_def split_def by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9851
          show "abs ((\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x)) - integral {a..b} (\<lambda>x. norm(f x))) < e / 2"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9852
            using d1(2)[rule_format,OF conjI[OF p(1,2)]] unfolding real_norm_def .
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9853
          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))"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9854
            apply(rule setsum_cong2) unfolding split_paired_all split_conv
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9855
            apply(drule tagged_division_ofD(4)[OF p(1)]) unfolding norm_scaleR
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9856
            apply(subst abs_of_nonneg) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9857
          show "(\<Sum>(x, k)\<in>p. norm (integral k f)) \<le> i"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9858
            apply(subst setsum_over_tagged_division_lemma[OF p(1)]) defer apply(rule isLubD2[OF i])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9859
            unfolding image_iff apply(rule_tac x="snd ` p" in bexI) unfolding mem_Collect_eq defer
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9860
            apply(rule partial_division_of_tagged_division[of _ "{a..b}"])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9861
            using p(1) unfolding tagged_division_of_def by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9862
        qed qed qed(insert K,auto) qed qed
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9863
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9864
lemma absolutely_integrable_restrict_univ:
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9865
 "(\<lambda>x. if x \<in> s then f x else (0::'a::banach)) absolutely_integrable_on UNIV \<longleftrightarrow> f absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9866
  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
  9867
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9868
lemma absolutely_integrable_add[intro]: fixes f g::"'n::ordered_euclidean_space \<Rightarrow> 'm::ordered_euclidean_space"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9869
  assumes "f absolutely_integrable_on s" "g absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9870
  shows "(\<lambda>x. f(x) + g(x)) 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
  9871
proof- let ?P = "\<And>f g::'n::ordered_euclidean_space \<Rightarrow> 'm::ordered_euclidean_space. f absolutely_integrable_on UNIV \<Longrightarrow>
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9872
    g absolutely_integrable_on UNIV \<Longrightarrow> (\<lambda>x. f(x) + g(x)) absolutely_integrable_on UNIV"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9873
  { presume as:"PROP ?P" note a = absolutely_integrable_restrict_univ[symmetric]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9874
    have *:"\<And>x. (if x \<in> s then f x else 0) + (if x \<in> s then g x else 0)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9875
      = (if x \<in> s then f x + g x else 0)" by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9876
    show ?thesis apply(subst a) using as[OF assms[unfolded a[of f] a[of g]]] unfolding * . }
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9877
  fix f g::"'n::ordered_euclidean_space \<Rightarrow> 'm::ordered_euclidean_space" assume assms:"f absolutely_integrable_on UNIV"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9878
    "g absolutely_integrable_on UNIV"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9879
  note absolutely_integrable_bounded_variation
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9880
  from this[OF assms(1)] this[OF assms(2)] guess B1 B2 . note B=this[rule_format]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9881
  show "(\<lambda>x. f(x) + g(x)) absolutely_integrable_on UNIV"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9882
    apply(rule bounded_variation_absolutely_integrable[of _ "B1+B2"])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9883
    apply(rule integrable_add) prefer 3
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9884
  proof safe case goal1 have "\<And>k. k \<in> d \<Longrightarrow> f integrable_on k \<and> g integrable_on k"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9885
      apply(drule division_ofD(4)[OF goal1]) apply safe
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9886
      apply(rule_tac[!] integrable_on_subinterval[of _ UNIV]) using assms by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9887
    hence "(\<Sum>k\<in>d. norm (integral k (\<lambda>x. f x + g x))) \<le>
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9888
      (\<Sum>k\<in>d. norm (integral k f)) + (\<Sum>k\<in>d. norm (integral k g))" apply-
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9889
      unfolding setsum_addf[symmetric] apply(rule setsum_mono)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9890
      apply(subst integral_add) prefer 3 apply(rule norm_triangle_ineq) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9891
    also have "... \<le> B1 + B2" using B(1)[OF goal1] B(2)[OF goal1] by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9892
    finally show ?case .
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9893
  qed(insert assms,auto) qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9894
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9895
lemma absolutely_integrable_sub[intro]: fixes f g::"'n::ordered_euclidean_space \<Rightarrow> 'm::ordered_euclidean_space"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9896
  assumes "f absolutely_integrable_on s" "g absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9897
  shows "(\<lambda>x. f(x) - g(x)) absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9898
  using absolutely_integrable_add[OF assms(1) absolutely_integrable_neg[OF assms(2)]]
36350
bc7982c54e37 dropped group_simps, ring_simps, field_eq_simps
haftmann
parents: 36334
diff changeset
  9899
  unfolding algebra_simps .
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9900
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9901
lemma absolutely_integrable_linear: fixes f::"'m::ordered_euclidean_space \<Rightarrow> 'n::ordered_euclidean_space" and h::"'n::ordered_euclidean_space \<Rightarrow> 'p::ordered_euclidean_space"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9902
  assumes "f absolutely_integrable_on s" "bounded_linear h"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9903
  shows "(h o f) absolutely_integrable_on s"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9904
proof- { presume as:"\<And>f::'m::ordered_euclidean_space \<Rightarrow> 'n::ordered_euclidean_space. \<And>h::'n::ordered_euclidean_space \<Rightarrow> 'p::ordered_euclidean_space.
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9905
    f absolutely_integrable_on UNIV \<Longrightarrow> bounded_linear h \<Longrightarrow>
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9906
    (h o f) absolutely_integrable_on UNIV" note a = absolutely_integrable_restrict_univ[symmetric]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9907
    show ?thesis apply(subst a) using as[OF assms[unfolded a[of f] a[of g]]]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9908
      unfolding o_def if_distrib linear_simps[OF assms(2)] . }
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9909
  fix f::"'m::ordered_euclidean_space \<Rightarrow> 'n::ordered_euclidean_space" and h::"'n::ordered_euclidean_space \<Rightarrow> 'p::ordered_euclidean_space"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9910
  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
  9911
  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
  9912
  from bounded_linear.pos_bounded[OF assms(2)] guess b .. note b=conjunctD2[OF this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9913
  show "(h o f) absolutely_integrable_on UNIV"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9914
    apply(rule bounded_variation_absolutely_integrable[of _ "B * b"])
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
  9915
    apply(rule integrable_linear[OF _ assms(2)])
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9916
  proof safe case goal2
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9917
    have "(\<Sum>k\<in>d. norm (integral k (h \<circ> f))) \<le> setsum (\<lambda>k. norm(integral k f)) d * b"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9918
      unfolding setsum_left_distrib apply(rule setsum_mono)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9919
    proof- case goal1 from division_ofD(4)[OF goal2 this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9920
      guess u v apply-by(erule exE)+ note uv=this
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9921
      have *:"f integrable_on k" unfolding uv apply(rule integrable_on_subinterval[of _ UNIV])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9922
        using assms by auto note this[unfolded has_integral_integral]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9923
      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
  9924
      note * = has_integral_unique[OF this(2)[unfolded has_integral_integral] this(1)]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9925
      show ?case unfolding * using b by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9926
    qed also have "... \<le> B * b" apply(rule mult_right_mono) using B goal2 b by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9927
    finally show ?case .
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9928
  qed(insert assms,auto) qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9929
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
  9930
lemma absolutely_integrable_setsum: fixes f::"'a \<Rightarrow> 'n::ordered_euclidean_space \<Rightarrow> 'm::ordered_euclidean_space"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9931
  assumes "finite t" "\<And>a. a \<in> t \<Longrightarrow> (f a) absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9932
  shows "(\<lambda>x. setsum (\<lambda>a. f a x) t) absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9933
  using assms(1,2) apply induct defer apply(subst setsum.insert) apply assumption+ by(rule,auto)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9934
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
  9935
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
  9936
  fixes f :: "'i \<Rightarrow> 'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  9937
  assumes f: "\<And>i. i\<in>I \<Longrightarrow> bounded_linear (f 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
  9938
  shows "bounded_linear (\<lambda>x. \<Sum>i\<in>I. f i 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
  9939
proof cases
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  9940
  assume "finite I" from this f 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
  9941
    by (induct I) (auto intro!: bounded_linear_add bounded_linear_zero)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  9942
qed (simp add: bounded_linear_zero)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  9943
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  9944
lemma absolutely_integrable_vector_abs:
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  9945
  fixes f::"'a::ordered_euclidean_space => 'b::ordered_euclidean_space"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  9946
  fixes T :: "'c::ordered_euclidean_space \<Rightarrow> '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
  9947
  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
  9948
  shows "(\<lambda>x. (\<Sum>i\<in>Basis. abs(f x\<bullet>T i) *\<^sub>R i)) 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
  9949
    (is "?Tf 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
  9950
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
  9951
  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
  9952
    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
  9953
  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
  9954
    ((\<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
  9955
     (\<lambda>x. (norm (\<Sum>j\<in>Basis. (if j = i then f x\<bullet>T i else 0) *\<^sub>R j)))) 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
  9956
    by (simp add: comp_def if_distrib setsum_cases)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  9957
  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
  9958
    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
  9959
    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
  9960
    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
  9961
    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
  9962
    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
  9963
    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
  9964
    done
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9965
qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9966
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
  9967
lemma absolutely_integrable_max:
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  9968
  fixes f g::"'m::ordered_euclidean_space \<Rightarrow> 'n::ordered_euclidean_space"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9969
  assumes "f absolutely_integrable_on s" "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
  9970
  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
  9971
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
  9972
  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
  9973
      (\<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
  9974
    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
  9975
  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
  9976
  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
  9977
  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
  9978
  note absolutely_integrable_cmul[OF this, of "1/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
  9979
  thus ?thesis 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
  9980
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
  9981
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  9982
lemma absolutely_integrable_min:
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
  fixes f g::"'m::ordered_euclidean_space \<Rightarrow> 'n::ordered_euclidean_space"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9984
  assumes "f absolutely_integrable_on s" "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
  9985
  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
  9986
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
  9987
  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
  9988
      (\<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
  9989
    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
  9990
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
  9991
  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
  9992
  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
  9993
  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
  9994
  note absolutely_integrable_cmul[OF this,of "1/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
  9995
  thus ?thesis 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
  9996
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
  9997
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
  9998
lemma 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
  9999
  fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'm::ordered_euclidean_space"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10000
  shows "f absolutely_integrable_on s \<longleftrightarrow> f integrable_on s \<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
 10001
          (\<lambda>x. (\<Sum>i\<in>Basis. abs(f x\<bullet>i) *\<^sub>R i)::'m) integrable_on s" (is "?l = ?r")
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 10002
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
 10003
  assume ?l thus ?r apply-apply rule defer
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10004
    apply(drule absolutely_integrable_vector_abs) by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
 10005
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
 10006
  assume ?r
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 10007
  { presume lem:"\<And>f::'n \<Rightarrow> 'm. f integrable_on UNIV \<Longrightarrow>
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 10008
      (\<lambda>x. (\<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i)::'m) integrable_on UNIV \<Longrightarrow> f absolutely_integrable_on UNIV"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 10009
    have *:"\<And>x. (\<Sum>i\<in>Basis. \<bar>(if x \<in> s then f x else 0) \<bullet> i\<bar> *\<^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
 10010
        (if x\<in>s then (\<Sum>i\<in>Basis. \<bar>f x \<bullet> i\<bar> *\<^sub>R i) else (0::'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
 10011
      unfolding euclidean_eq_iff[where 'a='m] by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
 10012
    show ?l apply(subst absolutely_integrable_restrict_univ[symmetric]) apply(rule lem)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10013
      unfolding integrable_restrict_univ * using `?r` 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
 10014
  fix f::"'n::ordered_euclidean_space \<Rightarrow> 'm::ordered_euclidean_space"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 10015
  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"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 10016
  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
 10017
  show "f absolutely_integrable_on UNIV"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10018
    apply(rule bounded_variation_absolutely_integrable[OF assms(1), where B="?B"],safe)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10019
  proof- case goal1 note d=this and d'=division_ofD[OF this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10020
    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
 10021
      (\<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)"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 10022
      apply(rule setsum_mono)
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
 10023
      apply(rule order_trans[OF norm_le_l1]) apply(rule setsum_mono) unfolding lessThan_iff
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
 10024
    proof- fix k and i :: 'm assume "k\<in>d" and i:"i\<in>Basis"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
 10025
      from d'(4)[OF this(1)] guess a b apply-by(erule 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
 10026
      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
 10027
        apply (rule abs_leI)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
 10028
        unfolding inner_minus_left[symmetric] defer apply(subst integral_neg[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
 10029
        defer apply(rule_tac[1-2] integral_component_le[OF i]) apply(rule integrable_neg)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10030
        using integrable_on_subinterval[OF assms(1),of 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
 10031
          integrable_on_subinterval[OF assms(2),of a b] i unfolding ab 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
 10032
    qed also have "... \<le> setsum (op \<bullet> (integral UNIV (\<lambda>x. (\<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i)::'m))) Basis"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10033
      apply(subst setsum_commute,rule setsum_mono)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 10034
    proof- case goal1 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
 10035
        using integrable_on_subdivision[OF d assms(2)] 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
 10036
      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)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 10037
        = integral (\<Union>d) (\<lambda>x. \<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i::'m) \<bullet> j"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 10038
        unfolding inner_setsum_left[symmetric] integral_combine_division_topdown[OF * d] ..
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 10039
      also have "... \<le> integral UNIV (\<lambda>x. \<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i::'m) \<bullet> j"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 10040
        apply(rule integral_subset_component_le) using assms * `j\<in>Basis` by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10041
      finally show ?case .
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10042
    qed finally show ?case . qed qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10043
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
 10044
lemma nonnegative_absolutely_integrable:
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 10045
  fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'm::ordered_euclidean_space"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 10046
  assumes "\<forall>x\<in>s. \<forall>i\<in>Basis. 0 \<le> f(x)\<bullet>i" "f integrable_on s"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10047
  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
 10048
  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
 10049
  apply rule
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 10050
  apply (rule 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
 10051
  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
 10052
  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
 10053
  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
 10054
  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
 10055
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
 10056
lemma absolutely_integrable_integrable_bound: fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'm::ordered_euclidean_space"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10057
  assumes "\<forall>x\<in>s. norm(f x) \<le> g x" "f integrable_on s" "g integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10058
  shows "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
 10059
proof- { presume *:"\<And>f::'n::ordered_euclidean_space \<Rightarrow> 'm::ordered_euclidean_space. \<And> g. \<forall>x. norm(f x) \<le> g x \<Longrightarrow> f integrable_on UNIV
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10060
    \<Longrightarrow> g integrable_on UNIV \<Longrightarrow> f absolutely_integrable_on UNIV"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
 10061
    show ?thesis apply(subst absolutely_integrable_restrict_univ[symmetric])
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10062
      apply(rule *[of _ "\<lambda>x. if x\<in>s then g x else 0"])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10063
      using assms unfolding integrable_restrict_univ 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
 10064
  fix g and f :: "'n::ordered_euclidean_space \<Rightarrow> 'm::ordered_euclidean_space"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10065
  assume assms:"\<forall>x. norm(f x) \<le> g x" "f integrable_on UNIV" "g integrable_on UNIV"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10066
  show "f absolutely_integrable_on UNIV"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10067
    apply(rule bounded_variation_absolutely_integrable[OF assms(2),where B="integral UNIV g"])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10068
  proof safe case goal1 note d=this and d'=division_ofD[OF this]
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10069
    have "(\<Sum>k\<in>d. norm (integral k f)) \<le> (\<Sum>k\<in>d. integral k g)"
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
 10070
      apply(rule setsum_mono) apply(rule integral_norm_bound_integral) apply(drule_tac[!] d'(4),safe)
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10071
      apply(rule_tac[1-2] integrable_on_subinterval) using assms by auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
 10072
    also have "... = integral (\<Union>d) g" apply(rule integral_combine_division_bottomup[symmetric])
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10073
      apply(rule d,safe) apply(drule d'(4),safe)
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10074
      apply(rule integrable_on_subinterval[OF assms(3)]) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10075
    also have "... \<le> integral UNIV g" apply(rule integral_subset_le) defer
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10076
      apply(rule integrable_on_subdivision[OF d,of _ UNIV]) prefer 4
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10077
      apply(rule,rule_tac y="norm (f x)" in order_trans) using assms by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10078
    finally show ?case . qed qed
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10079
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
 10080
lemma absolutely_integrable_integrable_bound_real: fixes f::"'n::ordered_euclidean_space \<Rightarrow> real"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10081
  assumes "\<forall>x\<in>s. norm(f x) \<le> g x" "f integrable_on s" "g integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10082
  shows "f absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10083
  apply(rule absolutely_integrable_integrable_bound[where g=g])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10084
  using assms unfolding o_def by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10085
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10086
lemma absolutely_integrable_absolutely_integrable_bound:
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36899
diff changeset
 10087
  fixes f::"'n::ordered_euclidean_space \<Rightarrow> 'm::ordered_euclidean_space" and g::"'n::ordered_euclidean_space \<Rightarrow> 'p::ordered_euclidean_space"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10088
  assumes "\<forall>x\<in>s. norm(f x) \<le> norm(g x)" "f integrable_on s" "g absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10089
  shows "f absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10090
  apply(rule absolutely_integrable_integrable_bound[of s f "\<lambda>x. norm (g x)"])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10091
  using assms by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10092
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10093
lemma absolutely_integrable_inf_real:
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10094
  assumes "finite k" "k \<noteq> {}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10095
  "\<forall>i\<in>k. (\<lambda>x. (fs x i)::real) absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10096
  shows "(\<lambda>x. (Inf ((fs x) ` k))) absolutely_integrable_on s" using assms
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10097
proof induct case (insert a k) let ?P = " (\<lambda>x. if fs x ` k = {} then fs x a
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10098
         else min (fs x a) (Inf (fs x ` k))) absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10099
  show ?case unfolding image_insert
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10100
    apply(subst Inf_insert_finite) apply(rule finite_imageI[OF insert(1)])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10101
  proof(cases "k={}") case True
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10102
    thus ?P apply(subst if_P) defer apply(rule insert(5)[rule_format]) 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
 10103
  next case False thus ?P apply(subst if_not_P) defer
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50348
diff changeset
 10104
      apply (rule absolutely_integrable_min[where 'n=real, unfolded Basis_real_def, simplified])
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10105
      defer apply(rule insert(3)[OF False]) using insert(5) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10106
  qed qed auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10107
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10108
lemma absolutely_integrable_sup_real:
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10109
  assumes "finite k" "k \<noteq> {}"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10110
  "\<forall>i\<in>k. (\<lambda>x. (fs x i)::real) absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10111
  shows "(\<lambda>x. (Sup ((fs x) ` k))) absolutely_integrable_on s" using assms
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10112
proof induct case (insert a k) let ?P = " (\<lambda>x. if fs x ` k = {} then fs x a
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10113
         else max (fs x a) (Sup (fs x ` k))) absolutely_integrable_on s"
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10114
  show ?case unfolding image_insert
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10115
    apply(subst Sup_insert_finite) apply(rule finite_imageI[OF insert(1)])
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10116
  proof(cases "k={}") case True
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10117
    thus ?P apply(subst if_P) defer apply(rule insert(5)[rule_format]) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10118
  next case False thus ?P apply(subst if_not_P) 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
 10119
      apply (rule absolutely_integrable_max[where 'n=real, unfolded Basis_real_def, simplified])
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10120
      defer apply(rule insert(3)[OF False]) using insert(5) by auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10121
  qed qed auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10122
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10123
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10124
subsection {* Dominated convergence. *}
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10125
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10126
lemma dominated_convergence:
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10127
  fixes f :: "nat \<Rightarrow> 'n::ordered_euclidean_space \<Rightarrow> real"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10128
  assumes "\<And>k. (f k) integrable_on s" "h integrable_on s"
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10129
    "\<And>k. \<forall>x \<in> s. norm(f k x) \<le> (h x)"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10130
    "\<forall>x \<in> s. ((\<lambda>k. f k x) ---> g x) sequentially"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10131
  shows "g integrable_on s"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10132
    "((\<lambda>k. integral s (f k)) ---> integral s g) sequentially"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10133
proof -
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10134
  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
 10135
    ((\<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
 10136
    integral s (\<lambda>x. Inf {f j x |j. m \<le> j}))sequentially"
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10137
  proof (rule monotone_convergence_decreasing, safe)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10138
    fix m :: nat
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10139
    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
 10140
      unfolding bounded_iff
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10141
      apply (rule_tac x="integral s h" in exI)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10142
    proof safe
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10143
      fix k :: nat
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10144
      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
 10145
        apply (rule integral_norm_bound_integral)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10146
        unfolding simple_image
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10147
        apply (rule absolutely_integrable_onD)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10148
        apply (rule absolutely_integrable_inf_real)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10149
        prefer 5
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10150
        unfolding real_norm_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10151
        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
 10152
        apply (rule cInf_abs_ge)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10153
        prefer 5
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10154
        apply rule
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10155
        apply (rule_tac g = h in absolutely_integrable_integrable_bound_real)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10156
        using assms
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10157
        unfolding real_norm_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10158
        apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10159
        done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10160
    qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10161
    fix k :: nat
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10162
    show "(\<lambda>x. Inf {f j x |j. j \<in> {m..m + k}}) integrable_on s"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10163
      unfolding simple_image
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10164
      apply (rule absolutely_integrable_onD)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10165
      apply (rule absolutely_integrable_inf_real)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10166
      prefer 3
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10167
      using absolutely_integrable_integrable_bound_real[OF assms(3,1,2)]
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10168
      apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10169
      done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10170
    fix x
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10171
    assume x: "x \<in> s"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10172
    show "Inf {f j x |j. j \<in> {m..m + Suc k}} \<le> Inf {f j x |j. j \<in> {m..m + k}}"
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
 10173
      apply (rule cInf_ge)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10174
      unfolding setge_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10175
      defer
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10176
      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
 10177
      apply (subst cInf_finite_le_iff)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10178
      prefer 3
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10179
      apply (rule_tac x=xa in bexI)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10180
      apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10181
      done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10182
    let ?S = "{f j x| j.  m \<le> j}"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10183
    def i \<equiv> "Inf ?S"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10184
    show "((\<lambda>k. Inf {f j x |j. j \<in> {m..m + k}}) ---> i) sequentially"
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10185
    proof (rule LIMSEQ_I)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10186
      case goal1
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10187
      note r = this
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10188
      have i: "isGlb UNIV ?S i"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10189
        unfolding i_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10190
        apply (rule Inf)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10191
        defer
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10192
        apply (rule_tac x="- h x - 1" in exI)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10193
        unfolding setge_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10194
      proof safe
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10195
        case goal1
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10196
        thus ?case using assms(3)[rule_format,OF x, of j] by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10197
      qed auto
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10198
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
 10199
      have "\<exists>y\<in>?S. \<not> y \<ge> i + r"
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10200
      proof(rule ccontr)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10201
        case goal1
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10202
        hence "i \<ge> i + r"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10203
          apply -
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10204
          apply (rule isGlb_le_isLb[OF i])
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10205
          apply (rule isLbI)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10206
          unfolding setge_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10207
          apply fastforce+
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10208
          done
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
 10209
        thus False using r by auto
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10210
      qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10211
      then guess y .. note y=this[unfolded not_le]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10212
      from this(1)[unfolded mem_Collect_eq] guess N .. note N=conjunctD2[OF this]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
 10213
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10214
      show ?case
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10215
        apply (rule_tac x=N in exI)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10216
      proof safe
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10217
        case goal1
53524
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
 10218
        have *: "\<And>y ix. y < i + r \<longrightarrow> i \<le> ix \<longrightarrow> ix \<le> y \<longrightarrow> abs(ix - i) < r"
ee1bdeb9e0ed tuned proofs;
wenzelm
parents: 53523
diff changeset
 10219
          by arith
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10220
        show ?case
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10221
          unfolding real_norm_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10222
            apply (rule *[rule_format,OF y(2)])
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10223
            unfolding i_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10224
            apply (rule real_le_inf_subset)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10225
            prefer 3
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10226
            apply (rule,rule isGlbD1[OF i])
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10227
            prefer 3
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
 10228
            apply (subst cInf_finite_le_iff)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10229
            prefer 3
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10230
            apply (rule_tac x=y in bexI)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10231
            using N goal1
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10232
            apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10233
            done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10234
      qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10235
    qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10236
  qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10237
  note dec1 = conjunctD2[OF this]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10238
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10239
  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
 10240
    ((\<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
 10241
    integral s (\<lambda>x. Sup {f j x |j. m \<le> j})) sequentially"
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10242
  proof (rule monotone_convergence_increasing,safe)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10243
    fix m :: nat
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10244
    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
 10245
      unfolding bounded_iff
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10246
      apply (rule_tac x="integral s h" in exI)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10247
    proof safe
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10248
      fix k :: nat
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10249
      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
 10250
        apply (rule integral_norm_bound_integral) unfolding simple_image
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10251
        apply (rule absolutely_integrable_onD)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10252
        apply(rule absolutely_integrable_sup_real)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10253
        prefer 5 unfolding real_norm_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10254
        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
 10255
        apply (rule cSup_abs_le)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10256
        prefer 5
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10257
        apply rule
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10258
        apply (rule_tac g=h in absolutely_integrable_integrable_bound_real)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10259
        using assms
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10260
        unfolding real_norm_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10261
        apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10262
        done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10263
    qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10264
    fix k :: nat
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10265
    show "(\<lambda>x. Sup {f j x |j. j \<in> {m..m + k}}) integrable_on s"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10266
      unfolding simple_image
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10267
      apply (rule absolutely_integrable_onD)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10268
      apply (rule absolutely_integrable_sup_real)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10269
      prefer 3
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10270
      using absolutely_integrable_integrable_bound_real[OF assms(3,1,2)]
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10271
      apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10272
      done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10273
    fix x
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10274
    assume x: "x\<in>s"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10275
    show "Sup {f j x |j. j \<in> {m..m + Suc k}} \<ge> Sup {f j x |j. j \<in> {m..m + k}}"
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
 10276
      apply (rule cSup_le)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10277
      unfolding setle_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10278
      defer
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10279
      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
 10280
      apply (subst cSup_finite_ge_iff)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10281
      prefer 3
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10282
      apply (rule_tac x=y in bexI)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10283
      apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10284
      done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10285
    let ?S = "{f j x| j.  m \<le> j}"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10286
    def i \<equiv> "Sup ?S"
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10287
    show "((\<lambda>k. Sup {f j x |j. j \<in> {m..m + k}}) ---> i) sequentially"
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10288
    proof (rule LIMSEQ_I)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10289
      case goal1 note r=this
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10290
      have i: "isLub UNIV ?S i"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10291
        unfolding i_def
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
 10292
        apply (rule isLub_cSup)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10293
        defer
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10294
        apply (rule_tac x="h x" in exI)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10295
        unfolding setle_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10296
      proof safe
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10297
        case goal1
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10298
        thus ?case using assms(3)[rule_format,OF x, of j] by auto
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10299
      qed auto
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
 10300
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
 10301
      have "\<exists>y\<in>?S. \<not> y \<le> i - r"
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10302
      proof (rule ccontr)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10303
        case goal1
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10304
        hence "i \<le> i - r"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10305
          apply -
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10306
          apply (rule isLub_le_isUb[OF i])
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10307
          apply (rule isUbI)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10308
          unfolding setle_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10309
          apply fastforce+
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10310
          done
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
 10311
        thus False using r by auto
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10312
      qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10313
      then guess y .. note y=this[unfolded not_le]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10314
      from this(1)[unfolded mem_Collect_eq] guess N .. note N=conjunctD2[OF this]
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
 10315
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10316
      show ?case
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10317
        apply (rule_tac x=N in exI)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10318
      proof safe
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10319
        case goal1
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10320
        have *: "\<And>y ix. i - r < y \<longrightarrow> ix \<le> i \<longrightarrow> y \<le> ix \<longrightarrow> abs(ix - i) < r"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10321
          by arith
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10322
        show ?case
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10323
          unfolding real_norm_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10324
          apply (rule *[rule_format,OF y(2)])
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10325
          unfolding i_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10326
          apply (rule real_ge_sup_subset)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10327
          prefer 3
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10328
          apply (rule, rule isLubD1[OF i])
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10329
          prefer 3
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
 10330
          apply (subst cSup_finite_ge_iff)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10331
          prefer 3
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10332
          apply (rule_tac x = y in bexI)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10333
          using N goal1
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10334
          apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10335
          done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10336
      qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10337
    qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10338
  qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10339
  note inc1 = conjunctD2[OF this]
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10340
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10341
  have "g integrable_on s \<and>
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10342
    ((\<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
 10343
    apply (rule monotone_convergence_increasing,safe)
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
 10344
    apply fact
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10345
  proof -
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10346
    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
 10347
      unfolding bounded_iff apply(rule_tac x="integral s h" in exI)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10348
    proof safe
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10349
      fix k :: nat
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10350
      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
 10351
        apply (rule integral_norm_bound_integral)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10352
        apply fact+
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10353
        unfolding real_norm_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10354
        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
 10355
        apply (rule cInf_abs_ge)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10356
        using assms(3)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10357
        apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10358
        done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10359
    qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10360
    fix k :: nat and x
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10361
    assume x: "x \<in> s"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10362
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10363
    have *: "\<And>x y::real. x \<ge> - y \<Longrightarrow> - x \<le> y" by auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10364
    show "Inf {f j x |j. k \<le> j} \<le> Inf {f j x |j. Suc k \<le> j}"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10365
      apply -
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10366
      apply (rule real_le_inf_subset)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10367
      prefer 3
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10368
      unfolding setge_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10369
      apply (rule_tac x="- h x" in exI)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10370
      apply safe
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10371
      apply (rule *)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10372
      using assms(3)[rule_format,OF x]
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10373
      unfolding real_norm_def abs_le_iff
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10374
      apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10375
      done
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
 10376
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51489
diff changeset
 10377
    show "(\<lambda>k::nat. Inf {f j x |j. k \<le> j}) ----> g x"
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10378
    proof (rule LIMSEQ_I)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10379
      case goal1
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10380
      hence "0<r/2" by auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10381
      from assms(4)[THEN bspec, THEN LIMSEQ_D, OF x this] guess N .. note N = this
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10382
      show ?case
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10383
        apply (rule_tac x=N in exI,safe)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10384
        unfolding real_norm_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10385
        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
 10386
        apply (rule cInf_asclose)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10387
        apply safe
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10388
        defer
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10389
        apply (rule less_imp_le)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10390
        using N goal1
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10391
        apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10392
        done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10393
    qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10394
  qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10395
  note inc2 = conjunctD2[OF this]
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10396
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10397
  have "g integrable_on s \<and>
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10398
    ((\<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
 10399
    apply (rule monotone_convergence_decreasing,safe)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10400
    apply fact
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10401
  proof -
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10402
    show "bounded {integral s (\<lambda>x. Sup {f j x |j. k \<le> j}) |k. True}"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10403
      unfolding bounded_iff
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10404
      apply (rule_tac x="integral s h" in exI)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10405
    proof safe
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10406
      fix k :: nat
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10407
      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
 10408
        apply (rule integral_norm_bound_integral)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10409
        apply fact+
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10410
        unfolding real_norm_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10411
        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
 10412
        apply (rule cSup_abs_le)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10413
        using assms(3)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10414
        apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10415
        done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10416
    qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10417
    fix k :: nat and x
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10418
    assume x: "x \<in> s"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10419
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10420
    show "Sup {f j x |j. k \<le> j} \<ge> Sup {f j x |j. Suc k \<le> j}"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10421
      apply -
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10422
      apply (rule real_ge_sup_subset)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10423
      prefer 3
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10424
      unfolding setle_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10425
      apply (rule_tac x="h x" in exI)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10426
      apply safe
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10427
      using assms(3)[rule_format,OF x]
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10428
      unfolding real_norm_def abs_le_iff
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10429
      apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10430
      done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10431
    show "((\<lambda>k. Sup {f j x |j. k \<le> j}) ---> g x) sequentially"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10432
    proof (rule LIMSEQ_I)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10433
      case goal1
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10434
      hence "0<r/2" by auto
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
 10435
      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
 10436
      show ?case
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10437
        apply (rule_tac x=N in exI,safe)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10438
        unfolding real_norm_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10439
        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
 10440
        apply (rule cSup_asclose)
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10441
        apply safe
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10442
        defer
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10443
        apply (rule less_imp_le)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10444
        using N goal1
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10445
        apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10446
        done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10447
    qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10448
  qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10449
  note dec2 = conjunctD2[OF this]
36243
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10450
027ae62681be Translated remaining theorems about integration from HOL light.
himmelma
parents: 36081
diff changeset
 10451
  show "g integrable_on s" by fact
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
 10452
  show "((\<lambda>k. integral s (f k)) ---> integral s g) sequentially"
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10453
  proof (rule LIMSEQ_I)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10454
    case goal1
44906
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
 10455
    from LIMSEQ_D [OF inc2(2) goal1] guess N1 .. note N1=this[unfolded real_norm_def]
8f3625167c76 simplify proofs using LIMSEQ lemmas
huffman
parents: 44890
diff changeset
 10456
    from LIMSEQ_D [OF dec2(2) goal1] guess N2 .. note N2=this[unfolded real_norm_def]
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10457
    show ?case
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10458
      apply (rule_tac x="N1+N2" in exI, safe)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10459
    proof -
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10460
      fix n
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10461
      assume n: "n \<ge> N1 + N2"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10462
      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
 10463
        by arith
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10464
      show "norm (integral s (f n) - integral s g) < r"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10465
        unfolding real_norm_def
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10466
        apply (rule *[rule_format,OF N1[rule_format] N2[rule_format], of n n])
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10467
      proof -
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10468
        show "integral s (\<lambda>x. Inf {f j x |j. n \<le> j}) \<le> integral s (f n)"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10469
        proof (rule integral_le[OF dec1(1) assms(1)], safe)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10470
          fix x
53399
43b3b3fa6967 tuned proofs;
wenzelm
parents: 53374
diff changeset
 10471
          assume x: "x \<in> s"
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10472
          have *: "\<And>x y::real. x \<ge> - y \<Longrightarrow> - x \<le> y" by auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10473
          show "Inf {f j x |j. n \<le> j} \<le> f n x"
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
 10474
            apply (rule cInf_lower[where z="- h x"])
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10475
            defer
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10476
            apply (rule *)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10477
            using assms(3)[rule_format,OF x]
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10478
            unfolding real_norm_def abs_le_iff
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10479
            apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10480
            done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10481
        qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10482
        show "integral s (f n) \<le> integral s (\<lambda>x. Sup {f j x |j. n \<le> j})"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10483
        proof (rule integral_le[OF assms(1) inc1(1)], safe)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10484
          fix x
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10485
          assume x: "x \<in> s"
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10486
          show "f n x \<le> Sup {f j x |j. n \<le> j}"
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51348
diff changeset
 10487
            apply (rule cSup_upper[where z="h x"])
50919
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10488
            defer
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10489
            using assms(3)[rule_format,OF x]
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10490
            unfolding real_norm_def abs_le_iff
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10491
            apply auto
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10492
            done
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10493
        qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10494
      qed (insert n, auto)
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10495
    qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10496
  qed
cc03437a1f80 tuned proofs;
wenzelm
parents: 50526
diff changeset
 10497
qed
35752
c8a8df426666 reset smt_certificates
himmelma
parents: 35751
diff changeset
 10498
35173
9b24bfca8044 Renamed Multivariate-Analysis/Integration to Multivariate-Analysis/Integration_MV to avoid name clash with Integration.
hoelzl
parents: 35172
diff changeset
 10499
end