src/HOL/Analysis/Set_Integral.thy
author paulson <lp15@cam.ac.uk>
Mon, 18 Aug 2025 22:37:21 +0100
changeset 83011 d35875d530a2
parent 82969 dedd9d13c79c
permissions -rw-r--r--
Simple facts about Lebesgue integration
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
63627
6ddb43c6b711 rename HOL-Multivariate_Analysis to HOL-Analysis.
hoelzl
parents: 63626
diff changeset
     1
(*  Title:      HOL/Analysis/Set_Integral.thy
63329
6b26c378ab35 Probability: tuned headers; cleanup Radon_Nikodym
hoelzl
parents: 63092
diff changeset
     2
    Author:     Jeremy Avigad (CMU), Johannes Hölzl (TUM), Luke Serafin (CMU)
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
     3
    Author:  Sébastien Gouëzel   sebastien.gouezel@univ-rennes1.fr
80133
e414bcc5a39e Acknowledgement of Ata Keskin for his Martingales material
paulson <lp15@cam.ac.uk>
parents: 79950
diff changeset
     4
    Author:     Ata Keskin, TU Muenchen
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
     5
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
     6
Notation and useful facts for working with integrals over a set.
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
     7
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
     8
TODO: keep all these? Need unicode translations as well.
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
     9
*)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    10
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
    11
chapter \<open>Integrals over a Set\<close>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
    12
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    13
theory Set_Integral
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
    14
  imports Radon_Nikodym
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    15
begin
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    16
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
    17
section \<open>Notation\<close>
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    18
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69737
diff changeset
    19
definition\<^marker>\<open>tag important\<close> "set_borel_measurable M A f \<equiv> (\<lambda>x. indicator A x *\<^sub>R f x) \<in> borel_measurable M"
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    20
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69737
diff changeset
    21
definition\<^marker>\<open>tag important\<close>  "set_integrable M A f \<equiv> integrable M (\<lambda>x. indicator A x *\<^sub>R f x)"
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    22
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69737
diff changeset
    23
definition\<^marker>\<open>tag important\<close>  "set_lebesgue_integral M A f \<equiv> lebesgue_integral M (\<lambda>x. indicator A x *\<^sub>R f x)"
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    24
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    25
syntax
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
    26
  "_ascii_set_lebesgue_integral" :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'a measure \<Rightarrow> real \<Rightarrow> real"
81097
6c81cdca5b82 more inner syntax markup: HOL-Analysis;
wenzelm
parents: 80914
diff changeset
    27
  (\<open>(\<open>indent=4 notation=\<open>binder LINT\<close>\<close>LINT (_):(_)/|(_)./ _)\<close> [0,0,0,10] 10)
80768
c7723cc15de8 more markup for syntax consts;
wenzelm
parents: 80133
diff changeset
    28
syntax_consts
c7723cc15de8 more markup for syntax consts;
wenzelm
parents: 80133
diff changeset
    29
  "_ascii_set_lebesgue_integral" == set_lebesgue_integral
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    30
translations
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
    31
  "LINT x:A|M. f" == "CONST set_lebesgue_integral M A (\<lambda>x. f)"
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    32
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    33
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
    34
section \<open>Basic properties\<close>
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    35
83011
d35875d530a2 Simple facts about Lebesgue integration
paulson <lp15@cam.ac.uk>
parents: 82969
diff changeset
    36
lemma set_integrable_eq:
d35875d530a2 Simple facts about Lebesgue integration
paulson <lp15@cam.ac.uk>
parents: 82969
diff changeset
    37
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
d35875d530a2 Simple facts about Lebesgue integration
paulson <lp15@cam.ac.uk>
parents: 82969
diff changeset
    38
  assumes "\<Omega> \<inter> space M \<in> sets M"
d35875d530a2 Simple facts about Lebesgue integration
paulson <lp15@cam.ac.uk>
parents: 82969
diff changeset
    39
  shows "set_integrable M \<Omega> f = integrable (restrict_space M \<Omega>) f"
d35875d530a2 Simple facts about Lebesgue integration
paulson <lp15@cam.ac.uk>
parents: 82969
diff changeset
    40
  by (meson assms integrable_restrict_space set_integrable_def)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    41
68721
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
    42
lemma set_integrable_cong:
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
    43
  assumes "M = M'" "A = A'" "\<And>x. x \<in> A \<Longrightarrow> f x = f' x"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
    44
  shows   "set_integrable M A f = set_integrable M' A' f'"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
    45
proof -
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
    46
  have "(\<lambda>x. indicator A x *\<^sub>R f x) = (\<lambda>x. indicator A' x *\<^sub>R f' x)"
73536
5131c388a9b0 simplified definition
haftmann
parents: 73253
diff changeset
    47
    using assms by (auto simp: indicator_def of_bool_def)
68721
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
    48
  thus ?thesis by (simp add: set_integrable_def assms)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
    49
qed
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
    50
62083
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
    51
lemma set_borel_measurable_sets:
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
    52
  fixes f :: "_ \<Rightarrow> _::real_normed_vector"
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
    53
  assumes "set_borel_measurable M X f" "B \<in> sets borel" "X \<in> sets M"
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
    54
  shows "f -` B \<inter> X \<in> sets M"
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
    55
proof -
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
    56
  have "f \<in> borel_measurable (restrict_space M X)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
    57
    using assms unfolding set_borel_measurable_def by (subst borel_measurable_restrict_space_iff) auto
62083
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
    58
  then have "f -` B \<inter> space (restrict_space M X) \<in> sets (restrict_space M X)"
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
    59
    by (rule measurable_sets) fact
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
    60
  with \<open>X \<in> sets M\<close> show ?thesis
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
    61
    by (subst (asm) sets_restrict_space_iff) (auto simp: space_restrict_space)
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
    62
qed
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
    63
77322
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
    64
lemma set_integrable_bound:
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
    65
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
    66
    and g :: "'a \<Rightarrow> 'c::{banach, second_countable_topology}"
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
    67
  assumes "set_integrable M A f" "set_borel_measurable M A g"
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
    68
  assumes "AE x in M. x \<in> A \<longrightarrow> norm (g x) \<le> norm (f x)"
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
    69
  shows   "set_integrable M A g"
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
    70
  unfolding set_integrable_def
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
    71
proof (rule Bochner_Integration.integrable_bound)
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
    72
  from assms(1) show "integrable M (\<lambda>x. indicator A x *\<^sub>R f x)"
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
    73
    by (simp add: set_integrable_def)
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
    74
  from assms(2) show "(\<lambda>x. indicat_real A x *\<^sub>R g x) \<in> borel_measurable M"
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
    75
    by (simp add: set_borel_measurable_def)
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
    76
  from assms(3) show "AE x in M. norm (indicat_real A x *\<^sub>R g x) \<le> norm (indicat_real A x *\<^sub>R f x)"
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
    77
    by eventually_elim (simp add: indicator_def)
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
    78
qed
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
    79
67977
557ea2740125 Probability builds with new definitions
paulson <lp15@cam.ac.uk>
parents: 67974
diff changeset
    80
lemma set_lebesgue_integral_zero [simp]: "set_lebesgue_integral M A (\<lambda>x. 0) = 0"
557ea2740125 Probability builds with new definitions
paulson <lp15@cam.ac.uk>
parents: 67974
diff changeset
    81
  by (auto simp: set_lebesgue_integral_def)
557ea2740125 Probability builds with new definitions
paulson <lp15@cam.ac.uk>
parents: 67974
diff changeset
    82
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    83
lemma set_lebesgue_integral_cong:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    84
  assumes "A \<in> sets M" and "\<forall>x. x \<in> A \<longrightarrow> f x = g x"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    85
  shows "(LINT x:A|M. f x) = (LINT x:A|M. g x)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
    86
  unfolding set_lebesgue_integral_def
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
    87
  using assms
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
    88
  by (metis indicator_simps(2) real_vector.scale_zero_left)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    89
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    90
lemma set_lebesgue_integral_cong_AE:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    91
  assumes [measurable]: "A \<in> sets M" "f \<in> borel_measurable M" "g \<in> borel_measurable M"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    92
  assumes "AE x \<in> A in M. f x = g x"
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
    93
  shows "(LINT x:A|M. f x) = (LINT x:A|M. g x)"
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    94
proof-
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    95
  have "AE x in M. indicator A x *\<^sub>R f x = indicator A x *\<^sub>R g x"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    96
    using assms by auto
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
    97
  thus ?thesis
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
    98
  unfolding set_lebesgue_integral_def by (intro integral_cong_AE) auto
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
    99
qed
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   100
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   101
lemma set_integrable_cong_AE:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   102
    "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow>
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 59867
diff changeset
   103
    AE x \<in> A in M. f x = g x \<Longrightarrow> A \<in> sets M \<Longrightarrow>
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   104
    set_integrable M A f = set_integrable M A g"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   105
  unfolding set_integrable_def
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   106
  by (rule integrable_cong_AE) auto
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   107
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 59867
diff changeset
   108
lemma set_integrable_subset:
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   109
  fixes M A B and f :: "_ \<Rightarrow> _ :: {banach, second_countable_topology}"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 59867
diff changeset
   110
  assumes "set_integrable M A f" "B \<in> sets M" "B \<subseteq> A"
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   111
  shows "set_integrable M B f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   112
proof -
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   113
  have "set_integrable M B (\<lambda>x. indicator A x *\<^sub>R f x)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   114
    using assms integrable_mult_indicator set_integrable_def by blast
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 60615
diff changeset
   115
  with \<open>B \<subseteq> A\<close> show ?thesis
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   116
    unfolding set_integrable_def
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   117
    by (simp add: indicator_inter_arith[symmetric] Int_absorb2)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   118
qed
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   119
67339
d91b9d22305b HOL-Analysis: add set_integrable_restrict_space
hoelzl
parents: 66456
diff changeset
   120
lemma set_integrable_restrict_space:
d91b9d22305b HOL-Analysis: add set_integrable_restrict_space
hoelzl
parents: 66456
diff changeset
   121
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
d91b9d22305b HOL-Analysis: add set_integrable_restrict_space
hoelzl
parents: 66456
diff changeset
   122
  assumes f: "set_integrable M S f" and T: "T \<in> sets (restrict_space M S)"
d91b9d22305b HOL-Analysis: add set_integrable_restrict_space
hoelzl
parents: 66456
diff changeset
   123
  shows "set_integrable M T f"
d91b9d22305b HOL-Analysis: add set_integrable_restrict_space
hoelzl
parents: 66456
diff changeset
   124
proof -
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   125
  obtain T' where T_eq: "T = S \<inter> T'" and "T' \<in> sets M" 
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   126
    using T by (auto simp: sets_restrict_space)
67339
d91b9d22305b HOL-Analysis: add set_integrable_restrict_space
hoelzl
parents: 66456
diff changeset
   127
  have \<open>integrable M (\<lambda>x. indicator T' x *\<^sub>R (indicator S x *\<^sub>R f x))\<close>
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   128
    using \<open>T' \<in> sets M\<close> f integrable_mult_indicator set_integrable_def by blast
67339
d91b9d22305b HOL-Analysis: add set_integrable_restrict_space
hoelzl
parents: 66456
diff changeset
   129
  then show ?thesis
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   130
    unfolding set_integrable_def
67339
d91b9d22305b HOL-Analysis: add set_integrable_restrict_space
hoelzl
parents: 66456
diff changeset
   131
    unfolding T_eq indicator_inter_arith by (simp add: ac_simps)
d91b9d22305b HOL-Analysis: add set_integrable_restrict_space
hoelzl
parents: 66456
diff changeset
   132
qed
d91b9d22305b HOL-Analysis: add set_integrable_restrict_space
hoelzl
parents: 66456
diff changeset
   133
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   134
(* TODO: integral_cmul_indicator should be named set_integral_const *)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   135
(* TODO: borel_integrable_atLeastAtMost should be named something like set_integrable_Icc_isCont *)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   136
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   137
lemma set_integral_scaleR_left: 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   138
  assumes "A \<in> sets M" "c \<noteq> 0 \<Longrightarrow> integrable M f"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   139
  shows "(LINT t:A|M. f t *\<^sub>R c) = (LINT t:A|M. f t) *\<^sub>R c"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   140
  unfolding set_lebesgue_integral_def 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   141
  using integrable_mult_indicator[OF assms]
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   142
  by (subst integral_scaleR_left[symmetric], auto)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   143
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   144
lemma set_integral_scaleR_right [simp]: "(LINT t:A|M. a *\<^sub>R f t) = a *\<^sub>R (LINT t:A|M. f t)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   145
  unfolding set_lebesgue_integral_def
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63627
diff changeset
   146
  by (subst integral_scaleR_right[symmetric]) (auto intro!: Bochner_Integration.integral_cong)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   147
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 59867
diff changeset
   148
lemma set_integral_mult_right [simp]:
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   149
  fixes a :: "'a::{real_normed_field, second_countable_topology}"
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   150
  shows "(LINT t:A|M. a * f t) = a * (LINT t:A|M. f t)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   151
  unfolding set_lebesgue_integral_def
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63627
diff changeset
   152
  by (subst integral_mult_right_zero[symmetric]) auto
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   153
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 59867
diff changeset
   154
lemma set_integral_mult_left [simp]:
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   155
  fixes a :: "'a::{real_normed_field, second_countable_topology}"
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   156
  shows "(LINT t:A|M. f t * a) = (LINT t:A|M. f t) * a"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   157
  unfolding set_lebesgue_integral_def
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63627
diff changeset
   158
  by (subst integral_mult_left_zero[symmetric]) auto
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   159
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 59867
diff changeset
   160
lemma set_integral_divide_zero [simp]:
59867
58043346ca64 given up separate type classes demanding `inverse 0 = 0`
haftmann
parents: 59358
diff changeset
   161
  fixes a :: "'a::{real_normed_field, field, second_countable_topology}"
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   162
  shows "(LINT t:A|M. f t / a) = (LINT t:A|M. f t) / a"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   163
  unfolding set_lebesgue_integral_def
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63627
diff changeset
   164
  by (subst integral_divide_zero[symmetric], intro Bochner_Integration.integral_cong)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   165
     (auto split: split_indicator)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   166
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   167
lemma set_integrable_scaleR_right [simp, intro]:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   168
  shows "(a \<noteq> 0 \<Longrightarrow> set_integrable M A f) \<Longrightarrow> set_integrable M A (\<lambda>t. a *\<^sub>R f t)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   169
  unfolding set_integrable_def
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   170
  unfolding scaleR_left_commute by (rule integrable_scaleR_right)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   171
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   172
lemma set_integrable_scaleR_left [simp, intro]:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   173
  fixes a :: "_ :: {banach, second_countable_topology}"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   174
  shows "(a \<noteq> 0 \<Longrightarrow> set_integrable M A f) \<Longrightarrow> set_integrable M A (\<lambda>t. f t *\<^sub>R a)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   175
  unfolding set_integrable_def
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   176
  using integrable_scaleR_left[of a M "\<lambda>x. indicator A x *\<^sub>R f x"] by simp
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   177
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   178
lemma set_integrable_mult_right [simp, intro]:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   179
  fixes a :: "'a::{real_normed_field, second_countable_topology}"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   180
  shows "(a \<noteq> 0 \<Longrightarrow> set_integrable M A f) \<Longrightarrow> set_integrable M A (\<lambda>t. a * f t)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   181
  unfolding set_integrable_def
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   182
  using integrable_mult_right[of a M "\<lambda>x. indicator A x *\<^sub>R f x"] by simp
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   183
70721
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   184
lemma set_integrable_mult_right_iff [simp]:
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   185
  fixes a :: "'a::{real_normed_field, second_countable_topology}"
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   186
  assumes "a \<noteq> 0"
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   187
  shows "set_integrable M A (\<lambda>t. a * f t) \<longleftrightarrow> set_integrable M A f"
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   188
proof
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   189
  assume "set_integrable M A (\<lambda>t. a * f t)"
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   190
  then have "set_integrable M A (\<lambda>t. 1/a * (a * f t))"
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   191
    using set_integrable_mult_right by blast
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   192
  then show "set_integrable M A f"
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   193
    using assms by auto
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   194
qed auto
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   195
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   196
lemma set_integrable_mult_left [simp, intro]:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   197
  fixes a :: "'a::{real_normed_field, second_countable_topology}"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   198
  shows "(a \<noteq> 0 \<Longrightarrow> set_integrable M A f) \<Longrightarrow> set_integrable M A (\<lambda>t. f t * a)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   199
  unfolding set_integrable_def
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   200
  using integrable_mult_left[of a M "\<lambda>x. indicator A x *\<^sub>R f x"] by simp
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   201
70721
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   202
lemma set_integrable_mult_left_iff [simp]:
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   203
  fixes a :: "'a::{real_normed_field, second_countable_topology}"
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   204
  assumes "a \<noteq> 0"
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   205
  shows "set_integrable M A (\<lambda>t. f t * a) \<longleftrightarrow> set_integrable M A f"
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   206
  using assms by (subst set_integrable_mult_right_iff [symmetric]) (auto simp: mult.commute)
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   207
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   208
lemma set_integrable_divide [simp, intro]:
59867
58043346ca64 given up separate type classes demanding `inverse 0 = 0`
haftmann
parents: 59358
diff changeset
   209
  fixes a :: "'a::{real_normed_field, field, second_countable_topology}"
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   210
  assumes "a \<noteq> 0 \<Longrightarrow> set_integrable M A f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   211
  shows "set_integrable M A (\<lambda>t. f t / a)"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   212
proof -
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   213
  have "integrable M (\<lambda>x. indicator A x *\<^sub>R f x / a)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   214
    using assms unfolding set_integrable_def by (rule integrable_divide_zero)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   215
  also have "(\<lambda>x. indicator A x *\<^sub>R f x / a) = (\<lambda>x. indicator A x *\<^sub>R (f x / a))"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   216
    by (auto split: split_indicator)
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   217
  finally show ?thesis 
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   218
    unfolding set_integrable_def .
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   219
qed
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   220
70721
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   221
lemma set_integrable_mult_divide_iff [simp]:
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   222
  fixes a :: "'a::{real_normed_field, second_countable_topology}"
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   223
  assumes "a \<noteq> 0"
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   224
  shows "set_integrable M A (\<lambda>t. f t / a) \<longleftrightarrow> set_integrable M A f"
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   225
  by (simp add: divide_inverse assms)
47258727fa42 A few new theorems, tidying up and deletion of obsolete material
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
   226
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   227
lemma set_integral_add [simp, intro]:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   228
  fixes f g :: "_ \<Rightarrow> _ :: {banach, second_countable_topology}"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   229
  assumes "set_integrable M A f" "set_integrable M A g"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   230
  shows "set_integrable M A (\<lambda>x. f x + g x)"
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   231
    and "(LINT x:A|M. f x + g x) = (LINT x:A|M. f x) + (LINT x:A|M. g x)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   232
  using assms unfolding set_integrable_def set_lebesgue_integral_def by (simp_all add: scaleR_add_right)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   233
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   234
lemma set_integral_diff [simp, intro]:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   235
  assumes "set_integrable M A f" "set_integrable M A g"
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   236
  shows "set_integrable M A (\<lambda>x. f x - g x)" and "(LINT x:A|M. f x - g x) = (LINT x:A|M. f x) - (LINT x:A|M. g x)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   237
  using assms unfolding set_integrable_def set_lebesgue_integral_def by (simp_all add: scaleR_diff_right)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   238
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   239
lemma set_integral_uminus: "set_integrable M A f \<Longrightarrow> (LINT x:A|M. - f x) = - (LINT x:A|M. f x)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   240
  unfolding set_integrable_def set_lebesgue_integral_def
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   241
  by (subst integral_minus[symmetric]) simp_all
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   242
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   243
lemma set_integral_complex_of_real:
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   244
  "(LINT x:A|M. complex_of_real (f x)) = of_real (LINT x:A|M. f x)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   245
  unfolding set_lebesgue_integral_def
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   246
  by (subst integral_complex_of_real[symmetric])
63886
685fb01256af move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
hoelzl
parents: 63627
diff changeset
   247
     (auto intro!: Bochner_Integration.integral_cong split: split_indicator)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   248
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   249
lemma set_integral_mono:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   250
  fixes f g :: "_ \<Rightarrow> real"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   251
  assumes "set_integrable M A f" "set_integrable M A g"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   252
    "\<And>x. x \<in> A \<Longrightarrow> f x \<le> g x"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   253
  shows "(LINT x:A|M. f x) \<le> (LINT x:A|M. g x)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   254
  using assms unfolding set_integrable_def set_lebesgue_integral_def
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   255
  by (auto intro: integral_mono split: split_indicator)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   256
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 59867
diff changeset
   257
lemma set_integral_mono_AE:
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   258
  fixes f g :: "_ \<Rightarrow> real"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   259
  assumes "set_integrable M A f" "set_integrable M A g"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   260
    "AE x \<in> A in M. f x \<le> g x"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   261
  shows "(LINT x:A|M. f x) \<le> (LINT x:A|M. g x)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   262
  using assms unfolding set_integrable_def set_lebesgue_integral_def
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   263
  by (auto intro: integral_mono_AE split: split_indicator)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   264
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   265
lemma set_integrable_abs: "set_integrable M A f \<Longrightarrow> set_integrable M A (\<lambda>x. \<bar>f x\<bar> :: real)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   266
  using integrable_abs[of M "\<lambda>x. f x * indicator A x"]unfolding set_integrable_def by (simp add: abs_mult ac_simps)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   267
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   268
lemma set_integrable_abs_iff:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   269
  fixes f :: "_ \<Rightarrow> real"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 59867
diff changeset
   270
  shows "set_borel_measurable M A f \<Longrightarrow> set_integrable M A (\<lambda>x. \<bar>f x\<bar>) = set_integrable M A f"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   271
  unfolding set_integrable_def set_borel_measurable_def
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   272
  by (subst (2) integrable_abs_iff[symmetric]) (simp_all add: abs_mult ac_simps)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   273
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   274
lemma set_integrable_abs_iff':
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   275
  fixes f :: "_ \<Rightarrow> real"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 59867
diff changeset
   276
  shows "f \<in> borel_measurable M \<Longrightarrow> A \<in> sets M \<Longrightarrow>
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   277
    set_integrable M A (\<lambda>x. \<bar>f x\<bar>) = set_integrable M A f"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   278
  by (simp add: set_borel_measurable_def set_integrable_abs_iff)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   279
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   280
lemma set_integrable_discrete_difference:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   281
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   282
  assumes "countable X"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   283
  assumes diff: "(A - B) \<union> (B - A) \<subseteq> X"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   284
  assumes "\<And>x. x \<in> X \<Longrightarrow> emeasure M {x} = 0" "\<And>x. x \<in> X \<Longrightarrow> {x} \<in> sets M"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   285
  shows "set_integrable M A f \<longleftrightarrow> set_integrable M B f"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   286
  unfolding set_integrable_def
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   287
proof (rule integrable_discrete_difference[where X=X])
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   288
  show "\<And>x. x \<in> space M \<Longrightarrow> x \<notin> X \<Longrightarrow> indicator A x *\<^sub>R f x = indicator B x *\<^sub>R f x"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   289
    using diff by (auto split: split_indicator)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   290
qed fact+
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   291
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   292
lemma set_integral_discrete_difference:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   293
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   294
  assumes "countable X"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   295
  assumes diff: "(A - B) \<union> (B - A) \<subseteq> X"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   296
  assumes "\<And>x. x \<in> X \<Longrightarrow> emeasure M {x} = 0" "\<And>x. x \<in> X \<Longrightarrow> {x} \<in> sets M"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   297
  shows "set_lebesgue_integral M A f = set_lebesgue_integral M B f"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   298
  unfolding set_lebesgue_integral_def
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   299
proof (rule integral_discrete_difference[where X=X])
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   300
  show "\<And>x. x \<in> space M \<Longrightarrow> x \<notin> X \<Longrightarrow> indicator A x *\<^sub>R f x = indicator B x *\<^sub>R f x"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   301
    using diff by (auto split: split_indicator)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   302
qed fact+
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   303
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   304
lemma set_integrable_Un:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   305
  fixes f g :: "_ \<Rightarrow> _ :: {banach, second_countable_topology}"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   306
  assumes f_A: "set_integrable M A f" and f_B:  "set_integrable M B f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   307
    and [measurable]: "A \<in> sets M" "B \<in> sets M"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   308
  shows "set_integrable M (A \<union> B) f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   309
proof -
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   310
  have "set_integrable M (A - B) f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   311
    using f_A by (rule set_integrable_subset) auto
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   312
  with f_B have "integrable M (\<lambda>x. indicator (A - B) x *\<^sub>R f x + indicator B x *\<^sub>R f x)"
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   313
    unfolding set_integrable_def using integrable_add by blast
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   314
  then show ?thesis
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   315
    unfolding set_integrable_def
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   316
    by (rule integrable_cong[THEN iffD1, rotated 2]) (auto split: split_indicator)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   317
qed
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   318
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   319
lemma set_integrable_empty [simp]: "set_integrable M {} f"
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   320
  by (auto simp: set_integrable_def)
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   321
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   322
lemma set_integrable_UN:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   323
  fixes f :: "_ \<Rightarrow> _ :: {banach, second_countable_topology}"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   324
  assumes "finite I" "\<And>i. i\<in>I \<Longrightarrow> set_integrable M (A i) f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   325
    "\<And>i. i\<in>I \<Longrightarrow> A i \<in> sets M"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   326
  shows "set_integrable M (\<Union>i\<in>I. A i) f"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   327
  using assms
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   328
  by (induct I) (auto simp: set_integrable_Un sets.finite_UN)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   329
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   330
lemma set_integral_Un:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   331
  fixes f :: "_ \<Rightarrow> _ :: {banach, second_countable_topology}"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   332
  assumes "A \<inter> B = {}"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   333
  and "set_integrable M A f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   334
  and "set_integrable M B f"
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   335
shows "(LINT x:A\<union>B|M. f x) = (LINT x:A|M. f x) + (LINT x:B|M. f x)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   336
  using assms
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   337
  unfolding set_integrable_def set_lebesgue_integral_def
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   338
  by (auto simp add: indicator_union_arith indicator_inter_arith[symmetric] scaleR_add_left)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   339
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   340
lemma set_integral_cong_set:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   341
  fixes f :: "_ \<Rightarrow> _ :: {banach, second_countable_topology}"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   342
  assumes "set_borel_measurable M A f" "set_borel_measurable M B f"
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   343
    and ae: "AE x in M. x \<in> A \<longleftrightarrow> x \<in> B"
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   344
  shows "(LINT x:B|M. f x) = (LINT x:A|M. f x)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   345
  unfolding set_lebesgue_integral_def
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   346
proof (rule integral_cong_AE)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   347
  show "AE x in M. indicator B x *\<^sub>R f x = indicator A x *\<^sub>R f x"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   348
    using ae by (auto simp: subset_eq split: split_indicator)
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   349
qed (use assms in \<open>auto simp: set_borel_measurable_def\<close>)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   350
69737
ec3cc98c38db tagged 4 theories
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69566
diff changeset
   351
proposition set_borel_measurable_subset:
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   352
  fixes f :: "_ \<Rightarrow> _ :: {banach, second_countable_topology}"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   353
  assumes [measurable]: "set_borel_measurable M A f" "B \<in> sets M" and "B \<subseteq> A"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   354
  shows "set_borel_measurable M B f"
69737
ec3cc98c38db tagged 4 theories
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69566
diff changeset
   355
proof-
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   356
  have "set_borel_measurable M B (\<lambda>x. indicator A x *\<^sub>R f x)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   357
    using assms unfolding set_borel_measurable_def
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   358
    using borel_measurable_indicator borel_measurable_scaleR by blast 
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   359
  moreover have "(\<lambda>x. indicator B x *\<^sub>R indicator A x *\<^sub>R f x) = (\<lambda>x. indicator B x *\<^sub>R f x)"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 60615
diff changeset
   360
    using \<open>B \<subseteq> A\<close> by (auto simp: fun_eq_iff split: split_indicator)
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   361
  ultimately show ?thesis 
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   362
    unfolding set_borel_measurable_def by simp
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   363
qed
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   364
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   365
lemma set_integral_Un_AE:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   366
  fixes f :: "_ \<Rightarrow> _ :: {banach, second_countable_topology}"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   367
  assumes ae: "AE x in M. \<not> (x \<in> A \<and> x \<in> B)" and [measurable]: "A \<in> sets M" "B \<in> sets M"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   368
  and "set_integrable M A f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   369
  and "set_integrable M B f"
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   370
  shows "(LINT x:A\<union>B|M. f x) = (LINT x:A|M. f x) + (LINT x:B|M. f x)"
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   371
proof -
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   372
  have f: "set_integrable M (A \<union> B) f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   373
    by (intro set_integrable_Un assms)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   374
  then have f': "set_borel_measurable M (A \<union> B) f"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   375
    using integrable_iff_bounded set_borel_measurable_def set_integrable_def by blast
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   376
  have "(LINT x:A\<union>B|M. f x) = (LINT x:(A - A \<inter> B) \<union> (B - A \<inter> B)|M. f x)"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 59867
diff changeset
   377
  proof (rule set_integral_cong_set)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   378
    show "AE x in M. (x \<in> A - A \<inter> B \<union> (B - A \<inter> B)) = (x \<in> A \<union> B)"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   379
      using ae by auto
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   380
    show "set_borel_measurable M (A - A \<inter> B \<union> (B - A \<inter> B)) f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   381
      using f' by (rule set_borel_measurable_subset) auto
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   382
  qed fact
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   383
  also have "\<dots> = (LINT x:(A - A \<inter> B)|M. f x) + (LINT x:(B - A \<inter> B)|M. f x)"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   384
    by (auto intro!: set_integral_Un set_integrable_subset[OF f])
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   385
  also have "\<dots> = (LINT x:A|M. f x) + (LINT x:B|M. f x)"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   386
    using ae
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 67339
diff changeset
   387
    by (intro arg_cong2[where f="(+)"] set_integral_cong_set)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   388
       (auto intro!: set_borel_measurable_subset[OF f'])
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   389
  finally show ?thesis .
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   390
qed
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   391
69737
ec3cc98c38db tagged 4 theories
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69566
diff changeset
   392
lemma set_integral_finite_Union:
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   393
  fixes f :: "_ \<Rightarrow> _ :: {banach, second_countable_topology}"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   394
  assumes "finite I" "disjoint_family_on A I"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   395
    and "\<And>i. i \<in> I \<Longrightarrow> set_integrable M (A i) f" "\<And>i. i \<in> I \<Longrightarrow> A i \<in> sets M"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   396
  shows "(LINT x:(\<Union>i\<in>I. A i)|M. f x) = (\<Sum>i\<in>I. LINT x:A i|M. f x)"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   397
  using assms
69737
ec3cc98c38db tagged 4 theories
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69566
diff changeset
   398
proof induction
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   399
  case (insert x F)
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69173
diff changeset
   400
  then have "A x \<inter> \<Union>(A ` F) = {}"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   401
    by (meson disjoint_family_on_insert)
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   402
  with insert show ?case
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   403
    by (simp add: set_integral_Un set_integrable_Un set_integrable_UN disjoint_family_on_insert)
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   404
qed (simp add: set_lebesgue_integral_def)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   405
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   406
(* TODO: find a better name? *)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   407
lemma pos_integrable_to_top:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   408
  fixes l::real
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   409
  assumes "\<And>i. A i \<in> sets M" "mono A"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   410
  assumes nneg: "\<And>x i. x \<in> A i \<Longrightarrow> 0 \<le> f x"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   411
  and intgbl: "\<And>i::nat. set_integrable M (A i) f"
61969
e01015e49041 more symbols;
wenzelm
parents: 61945
diff changeset
   412
  and lim: "(\<lambda>i::nat. LINT x:A i|M. f x) \<longlonglongrightarrow> l"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   413
shows "set_integrable M (\<Union>i. A i) f"
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   414
  unfolding set_integrable_def
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   415
  apply (rule integrable_monotone_convergence[where f = "\<lambda>i::nat. \<lambda>x. indicator (A i) x *\<^sub>R f x" and x = l])
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   416
      apply (rule intgbl [unfolded set_integrable_def])
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   417
     prefer 3 apply (rule lim [unfolded set_lebesgue_integral_def])
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   418
    apply (rule AE_I2)
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 60615
diff changeset
   419
  using \<open>mono A\<close> apply (auto simp: mono_def nneg split: split_indicator) []
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   420
proof (rule AE_I2)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   421
  { fix x assume "x \<in> space M"
61969
e01015e49041 more symbols;
wenzelm
parents: 61945
diff changeset
   422
    show "(\<lambda>i. indicator (A i) x *\<^sub>R f x) \<longlonglongrightarrow> indicator (\<Union>i. A i) x *\<^sub>R f x"
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   423
    proof cases
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   424
      assume "\<exists>i. x \<in> A i"
74362
0135a0c77b64 tuned proofs --- avoid 'guess';
wenzelm
parents: 73536
diff changeset
   425
      then obtain i where "x \<in> A i" ..
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   426
      then have "\<forall>\<^sub>F i in sequentially. x \<in> A i"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 60615
diff changeset
   427
        using \<open>x \<in> A i\<close> \<open>mono A\<close> by (auto simp: eventually_sequentially mono_def)
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   428
      with eventually_mono have "\<forall>\<^sub>F i in sequentially. indicat_real (A i) x *\<^sub>R f x = indicat_real (\<Union> (range A)) x *\<^sub>R f x"
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   429
        by fastforce
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   430
      then show ?thesis
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   431
        by (intro tendsto_eventually)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   432
    qed auto }
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   433
  then show "(\<lambda>x. indicator (\<Union>i. A i) x *\<^sub>R f x) \<in> borel_measurable M"
62624
59ceeb6f3079 generalized some Borel measurable statements to support ennreal
hoelzl
parents: 62083
diff changeset
   434
    apply (rule borel_measurable_LIMSEQ_real)
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   435
     apply assumption
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   436
    using intgbl set_integrable_def by blast
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   437
qed
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   438
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   439
text \<open>Proof from Royden, \emph{Real Analysis}, p. 91.\<close>
69737
ec3cc98c38db tagged 4 theories
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69566
diff changeset
   440
lemma lebesgue_integral_countable_add:
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   441
  fixes f :: "_ \<Rightarrow> 'a :: {banach, second_countable_topology}"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   442
  assumes meas[intro]: "\<And>i::nat. A i \<in> sets M"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   443
    and disj: "\<And>i j. i \<noteq> j \<Longrightarrow> A i \<inter> A j = {}"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   444
    and intgbl: "set_integrable M (\<Union>i. A i) f"
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   445
  shows "(LINT x:(\<Union>i. A i)|M. f x) = (\<Sum>i. (LINT x:(A i)|M. f x))"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   446
    unfolding set_lebesgue_integral_def
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69737
diff changeset
   447
proof (subst integral_suminf[symmetric])
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   448
  show int_A: "integrable M (\<lambda>x. indicat_real (A i) x *\<^sub>R f x)" for i
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   449
    using intgbl unfolding set_integrable_def [symmetric]
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   450
    by (rule set_integrable_subset) auto
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   451
  { fix x assume "x \<in> space M"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   452
    have "(\<lambda>i. indicator (A i) x *\<^sub>R f x) sums (indicator (\<Union>i. A i) x *\<^sub>R f x)"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   453
      by (intro sums_scaleR_left indicator_sums) fact }
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   454
  note sums = this
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   455
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   456
  have norm_f: "\<And>i. set_integrable M (A i) (\<lambda>x. norm (f x))"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   457
    using int_A[THEN integrable_norm] unfolding set_integrable_def by auto
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   458
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   459
  show "AE x in M. summable (\<lambda>i. norm (indicator (A i) x *\<^sub>R f x))"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   460
    using disj by (intro AE_I2) (auto intro!: summable_mult2 sums_summable[OF indicator_sums])
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   461
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   462
  show "summable (\<lambda>i. LINT x|M. norm (indicator (A i) x *\<^sub>R f x))"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   463
  proof (rule summableI_nonneg_bounded)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   464
    fix n
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   465
    show "0 \<le> LINT x|M. norm (indicator (A n) x *\<^sub>R f x)"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   466
      using norm_f by (auto intro!: integral_nonneg_AE)
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 59867
diff changeset
   467
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   468
    have "(\<Sum>i<n. LINT x|M. norm (indicator (A i) x *\<^sub>R f x)) = (\<Sum>i<n. LINT x:A i|M. norm (f x))"
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   469
      by (simp add: abs_mult set_lebesgue_integral_def)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   470
    also have "\<dots> = set_lebesgue_integral M (\<Union>i<n. A i) (\<lambda>x. norm (f x))"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   471
      using norm_f
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   472
      by (subst set_integral_finite_Union) (auto simp: disjoint_family_on_def disj)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   473
    also have "\<dots> \<le> set_lebesgue_integral M (\<Union>i. A i) (\<lambda>x. norm (f x))"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   474
      using intgbl[unfolded set_integrable_def, THEN integrable_norm] norm_f
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   475
      unfolding set_lebesgue_integral_def set_integrable_def
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   476
      apply (intro integral_mono set_integrable_UN[of "{..<n}", unfolded set_integrable_def])
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   477
          apply (auto split: split_indicator)
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   478
      done
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   479
    finally show "(\<Sum>i<n. LINT x|M. norm (indicator (A i) x *\<^sub>R f x)) \<le>
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   480
      set_lebesgue_integral M (\<Union>i. A i) (\<lambda>x. norm (f x))"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   481
      by simp
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   482
  qed
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69173
diff changeset
   483
  show "LINT x|M. indicator (\<Union>(A ` UNIV)) x *\<^sub>R f x = LINT x|M. (\<Sum>i. indicator (A i) x *\<^sub>R f x)"
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   484
    by (metis (no_types, lifting) integral_cong sums sums_unique)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   485
qed
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   486
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   487
lemma set_integral_cont_up:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   488
  fixes f :: "_ \<Rightarrow> 'a :: {banach, second_countable_topology}"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   489
  assumes [measurable]: "\<And>i. A i \<in> sets M" and A: "incseq A"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   490
  and intgbl: "set_integrable M (\<Union>i. A i) f"
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   491
shows "(\<lambda>i. LINT x:(A i)|M. f x) \<longlonglongrightarrow> (LINT x:(\<Union>i. A i)|M. f x)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   492
  unfolding set_lebesgue_integral_def
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   493
proof (intro integral_dominated_convergence[where w="\<lambda>x. indicator (\<Union>i. A i) x *\<^sub>R norm (f x)"])
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   494
  have int_A: "\<And>i. set_integrable M (A i) f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   495
    using intgbl by (rule set_integrable_subset) auto
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   496
  show "\<And>i. (\<lambda>x. indicator (A i) x *\<^sub>R f x) \<in> borel_measurable M"
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   497
    using int_A integrable_iff_bounded set_integrable_def by blast
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69173
diff changeset
   498
  show "(\<lambda>x. indicator (\<Union>(A ` UNIV)) x *\<^sub>R f x) \<in> borel_measurable M"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   499
    using integrable_iff_bounded intgbl set_integrable_def by blast
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   500
  show "integrable M (\<lambda>x. indicator (\<Union>i. A i) x *\<^sub>R norm (f x))"
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   501
    using int_A intgbl integrable_norm unfolding set_integrable_def 
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   502
    by fastforce
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   503
  { fix x i assume "x \<in> A i"
61969
e01015e49041 more symbols;
wenzelm
parents: 61945
diff changeset
   504
    with A have "(\<lambda>xa. indicator (A xa) x::real) \<longlonglongrightarrow> 1 \<longleftrightarrow> (\<lambda>xa. 1::real) \<longlonglongrightarrow> 1"
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   505
      by (intro filterlim_cong refl)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   506
         (fastforce simp: eventually_sequentially incseq_def subset_eq intro!: exI[of _ i]) }
61969
e01015e49041 more symbols;
wenzelm
parents: 61945
diff changeset
   507
  then show "AE x in M. (\<lambda>i. indicator (A i) x *\<^sub>R f x) \<longlonglongrightarrow> indicator (\<Union>i. A i) x *\<^sub>R f x"
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   508
    by (intro AE_I2 tendsto_intros) (auto split: split_indicator)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   509
qed (auto split: split_indicator)
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 59867
diff changeset
   510
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   511
(* Can the int0 hypothesis be dropped? *)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   512
lemma set_integral_cont_down:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   513
  fixes f :: "_ \<Rightarrow> 'a :: {banach, second_countable_topology}"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   514
  assumes [measurable]: "\<And>i. A i \<in> sets M" and A: "decseq A"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   515
  and int0: "set_integrable M (A 0) f"
79599
2c18ac57e92e the syntax of Lebesgue integrals (LINT, LBINT, ∫, etc.) now requires parentheses
paulson <lp15@cam.ac.uk>
parents: 77322
diff changeset
   516
  shows "(\<lambda>i::nat. LINT x:(A i)|M. f x) \<longlonglongrightarrow> (LINT x:(\<Inter>i. A i)|M. f x)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   517
  unfolding set_lebesgue_integral_def
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   518
proof (rule integral_dominated_convergence)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   519
  have int_A: "\<And>i. set_integrable M (A i) f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   520
    using int0 by (rule set_integrable_subset) (insert A, auto simp: decseq_def)
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   521
  have "integrable M (\<lambda>c. norm (indicat_real (A 0) c *\<^sub>R f c))"
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   522
    by (metis (no_types) int0 integrable_norm set_integrable_def)
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   523
  then show "integrable M (\<lambda>x. indicator (A 0) x *\<^sub>R norm (f x))"
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   524
    by force
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   525
  have "set_integrable M (\<Inter>i. A i) f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   526
    using int0 by (rule set_integrable_subset) (insert A, auto simp: decseq_def)
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69173
diff changeset
   527
  with int_A show "(\<lambda>x. indicat_real (\<Inter>(A ` UNIV)) x *\<^sub>R f x) \<in> borel_measurable M"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   528
                  "\<And>i. (\<lambda>x. indicat_real (A i) x *\<^sub>R f x) \<in> borel_measurable M"
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   529
    by (auto simp: set_integrable_def)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   530
  show "\<And>i. AE x in M. norm (indicator (A i) x *\<^sub>R f x) \<le> indicator (A 0) x *\<^sub>R norm (f x)"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   531
    using A by (auto split: split_indicator simp: decseq_def)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   532
  { fix x i assume "x \<in> space M" "x \<notin> A i"
61969
e01015e49041 more symbols;
wenzelm
parents: 61945
diff changeset
   533
    with A have "(\<lambda>i. indicator (A i) x::real) \<longlonglongrightarrow> 0 \<longleftrightarrow> (\<lambda>i. 0::real) \<longlonglongrightarrow> 0"
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   534
      by (intro filterlim_cong refl)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   535
         (auto split: split_indicator simp: eventually_sequentially decseq_def intro!: exI[of _ i]) }
61969
e01015e49041 more symbols;
wenzelm
parents: 61945
diff changeset
   536
  then show "AE x in M. (\<lambda>i. indicator (A i) x *\<^sub>R f x) \<longlonglongrightarrow> indicator (\<Inter>i. A i) x *\<^sub>R f x"
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   537
    by (intro AE_I2 tendsto_intros) (auto split: split_indicator)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   538
qed
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   539
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   540
lemma set_integral_at_point:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   541
  fixes a :: real
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   542
  assumes "set_integrable M {a} f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   543
  and [simp]: "{a} \<in> sets M" and "(emeasure M) {a} \<noteq> \<infinity>"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   544
  shows "(LINT x:{a} | M. f x) = f a * measure M {a}"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   545
proof-
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   546
  have "set_lebesgue_integral M {a} f = set_lebesgue_integral M {a} (%x. f a)"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   547
    by (intro set_lebesgue_integral_cong) simp_all
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   548
  then show ?thesis using assms
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   549
    unfolding set_lebesgue_integral_def by simp
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   550
qed
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   551
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   552
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   553
section \<open>Complex integrals\<close>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   554
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   555
abbreviation complex_integrable :: "'a measure \<Rightarrow> ('a \<Rightarrow> complex) \<Rightarrow> bool" where
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   556
  "complex_integrable M f \<equiv> integrable M f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   557
80914
d97fdabd9e2b standardize mixfix annotations via "isabelle update -a -u mixfix_cartouches" --- to simplify systematic editing;
wenzelm
parents: 80768
diff changeset
   558
abbreviation complex_lebesgue_integral :: "'a measure \<Rightarrow> ('a \<Rightarrow> complex) \<Rightarrow> complex" (\<open>integral\<^sup>C\<close>) where
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   559
  "integral\<^sup>C M f == integral\<^sup>L M f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   560
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   561
syntax
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   562
  "_complex_lebesgue_integral" :: "pttrn \<Rightarrow> complex \<Rightarrow> 'a measure \<Rightarrow> complex"
81142
6ad2c917dd2e more inner-syntax markup;
wenzelm
parents: 81097
diff changeset
   563
 (\<open>(\<open>open_block notation=\<open>binder integral\<close>\<close>\<integral>\<^sup>C _. _ \<partial>_)\<close> [0,0] 110)
80768
c7723cc15de8 more markup for syntax consts;
wenzelm
parents: 80133
diff changeset
   564
syntax_consts
c7723cc15de8 more markup for syntax consts;
wenzelm
parents: 80133
diff changeset
   565
  "_complex_lebesgue_integral" == complex_lebesgue_integral
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   566
translations
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   567
  "\<integral>\<^sup>Cx. f \<partial>M" == "CONST complex_lebesgue_integral M (\<lambda>x. f)"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   568
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   569
syntax
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   570
  "_ascii_complex_lebesgue_integral" :: "pttrn \<Rightarrow> 'a measure \<Rightarrow> real \<Rightarrow> real"
81097
6c81cdca5b82 more inner syntax markup: HOL-Analysis;
wenzelm
parents: 80914
diff changeset
   571
  (\<open>(\<open>indent=3 notation=\<open>binder CLINT\<close>\<close>CLINT _|_. _)\<close> [0,0,10] 10)
80768
c7723cc15de8 more markup for syntax consts;
wenzelm
parents: 80133
diff changeset
   572
syntax_consts
c7723cc15de8 more markup for syntax consts;
wenzelm
parents: 80133
diff changeset
   573
  "_ascii_complex_lebesgue_integral" == complex_lebesgue_integral
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   574
translations
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   575
  "CLINT x|M. f" == "CONST complex_lebesgue_integral M (\<lambda>x. f)"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   576
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   577
lemma complex_integrable_cnj [simp]:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   578
  "complex_integrable M (\<lambda>x. cnj (f x)) \<longleftrightarrow> complex_integrable M f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   579
proof
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   580
  assume "complex_integrable M (\<lambda>x. cnj (f x))"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   581
  then have "complex_integrable M (\<lambda>x. cnj (cnj (f x)))"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   582
    by (rule integrable_cnj)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   583
  then show "complex_integrable M f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   584
    by simp
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   585
qed simp
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   586
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   587
lemma complex_of_real_integrable_eq:
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   588
  "complex_integrable M (\<lambda>x. complex_of_real (f x)) \<longleftrightarrow> integrable M f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   589
proof
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   590
  assume "complex_integrable M (\<lambda>x. complex_of_real (f x))"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   591
  then have "integrable M (\<lambda>x. Re (complex_of_real (f x)))"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   592
    by (rule integrable_Re)
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   593
  then show "integrable M f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   594
    by simp
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   595
qed simp
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   596
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   597
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   598
abbreviation complex_set_integrable :: "'a measure \<Rightarrow> 'a set \<Rightarrow> ('a \<Rightarrow> complex) \<Rightarrow> bool" where
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   599
  "complex_set_integrable M A f \<equiv> set_integrable M A f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   600
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   601
abbreviation complex_set_lebesgue_integral :: "'a measure \<Rightarrow> 'a set \<Rightarrow> ('a \<Rightarrow> complex) \<Rightarrow> complex" where
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   602
  "complex_set_lebesgue_integral M A f \<equiv> set_lebesgue_integral M A f"
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   603
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   604
syntax
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   605
  "_ascii_complex_set_lebesgue_integral" :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'a measure \<Rightarrow> real \<Rightarrow> real"
81097
6c81cdca5b82 more inner syntax markup: HOL-Analysis;
wenzelm
parents: 80914
diff changeset
   606
  (\<open>(\<open>indent=4 notation=\<open>binder CLINT\<close>\<close>CLINT _:_|_. _)\<close> [0,0,0,10] 10)
80768
c7723cc15de8 more markup for syntax consts;
wenzelm
parents: 80133
diff changeset
   607
syntax_consts
c7723cc15de8 more markup for syntax consts;
wenzelm
parents: 80133
diff changeset
   608
  "_ascii_complex_set_lebesgue_integral" == complex_set_lebesgue_integral
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   609
translations
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   610
  "CLINT x:A|M. f" == "CONST complex_set_lebesgue_integral M A (\<lambda>x. f)"
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   611
82969
dedd9d13c79c Generalised a theorem about Lebesgue integration
paulson <lp15@cam.ac.uk>
parents: 81184
diff changeset
   612
lemma set_measurable_continuous_on:
dedd9d13c79c Generalised a theorem about Lebesgue integration
paulson <lp15@cam.ac.uk>
parents: 81184
diff changeset
   613
  fixes f g :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
dedd9d13c79c Generalised a theorem about Lebesgue integration
paulson <lp15@cam.ac.uk>
parents: 81184
diff changeset
   614
  shows "A \<in> sets borel \<Longrightarrow> continuous_on A f \<Longrightarrow> set_borel_measurable borel A f"
dedd9d13c79c Generalised a theorem about Lebesgue integration
paulson <lp15@cam.ac.uk>
parents: 81184
diff changeset
   615
  by (meson borel_measurable_continuous_on_indicator
dedd9d13c79c Generalised a theorem about Lebesgue integration
paulson <lp15@cam.ac.uk>
parents: 81184
diff changeset
   616
      set_borel_measurable_def)
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
   617
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   618
section \<open>NN Set Integrals\<close>
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   619
64911
f0e07600de47 isabelle update_cartouches -c -t;
wenzelm
parents: 64284
diff changeset
   620
text\<open>This notation is from Sébastien Gouëzel: His use is not directly in line with the
f0e07600de47 isabelle update_cartouches -c -t;
wenzelm
parents: 64284
diff changeset
   621
notations in this file, they are more in line with sum, and more readable he thinks.\<close>
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   622
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   623
abbreviation "set_nn_integral M A f \<equiv> nn_integral M (\<lambda>x. f x * indicator A x)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   624
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   625
syntax
81142
6ad2c917dd2e more inner-syntax markup;
wenzelm
parents: 81097
diff changeset
   626
  "_set_nn_integral" :: "pttrn => 'a set => 'a measure => ereal => ereal"
6ad2c917dd2e more inner-syntax markup;
wenzelm
parents: 81097
diff changeset
   627
    (\<open>(\<open>notation=\<open>binder integral\<close>\<close>\<integral>\<^sup>+((_)\<in>(_)./ _)/\<partial>_)\<close> [0,0,0,110] 10)
6ad2c917dd2e more inner-syntax markup;
wenzelm
parents: 81097
diff changeset
   628
  "_set_lebesgue_integral" :: "pttrn => 'a set => 'a measure => ereal => ereal"
6ad2c917dd2e more inner-syntax markup;
wenzelm
parents: 81097
diff changeset
   629
    (\<open>(\<open>notation=\<open>binder integral\<close>\<close>\<integral>((_)\<in>(_)./ _)/\<partial>_)\<close> [0,0,0,110] 10)
80768
c7723cc15de8 more markup for syntax consts;
wenzelm
parents: 80133
diff changeset
   630
syntax_consts
81142
6ad2c917dd2e more inner-syntax markup;
wenzelm
parents: 81097
diff changeset
   631
  "_set_nn_integral" == set_nn_integral and
6ad2c917dd2e more inner-syntax markup;
wenzelm
parents: 81097
diff changeset
   632
  "_set_lebesgue_integral" == set_lebesgue_integral
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   633
translations
81142
6ad2c917dd2e more inner-syntax markup;
wenzelm
parents: 81097
diff changeset
   634
  "\<integral>\<^sup>+x \<in> A. f \<partial>M" == "CONST set_nn_integral M A (\<lambda>x. f)"
6ad2c917dd2e more inner-syntax markup;
wenzelm
parents: 81097
diff changeset
   635
  "\<integral>x \<in> A. f \<partial>M" == "CONST set_lebesgue_integral M A (\<lambda>x. f)"
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   636
77322
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
   637
lemma set_nn_integral_cong:
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
   638
  assumes "M = M'" "A = B" "\<And>x. x \<in> space M \<inter> A \<Longrightarrow> f x = g x"
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
   639
  shows   "set_nn_integral M A f = set_nn_integral M' B g"
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
   640
  by (metis (mono_tags, lifting) IntI assms indicator_simps(2) mult_eq_0_iff nn_integral_cong)
9c295f84d55f Replacing z powr of_int i by z powi i and adding new material from the AFP
paulson <lp15@cam.ac.uk>
parents: 74362
diff changeset
   641
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   642
lemma nn_integral_disjoint_pair:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   643
  assumes [measurable]: "f \<in> borel_measurable M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   644
          "B \<in> sets M" "C \<in> sets M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   645
          "B \<inter> C = {}"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   646
  shows "(\<integral>\<^sup>+x \<in> B \<union> C. f x \<partial>M) = (\<integral>\<^sup>+x \<in> B. f x \<partial>M) + (\<integral>\<^sup>+x \<in> C. f x \<partial>M)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   647
proof -
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   648
  have mes: "\<And>D. D \<in> sets M \<Longrightarrow> (\<lambda>x. f x * indicator D x) \<in> borel_measurable M" by simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   649
  have pos: "\<And>D. AE x in M. f x * indicator D x \<ge> 0" using assms(2) by auto
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   650
  have "\<And>x. f x * indicator (B \<union> C) x = f x * indicator B x + f x * indicator C x" using assms(4)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   651
    by (auto split: split_indicator)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   652
  then have "(\<integral>\<^sup>+x. f x * indicator (B \<union> C) x \<partial>M) = (\<integral>\<^sup>+x. f x * indicator B x + f x * indicator C x \<partial>M)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   653
    by simp
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   654
  also have "\<dots> = (\<integral>\<^sup>+x. f x * indicator B x \<partial>M) + (\<integral>\<^sup>+x. f x * indicator C x \<partial>M)"
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   655
    by (rule nn_integral_add) (auto simp add: assms mes pos)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   656
  finally show ?thesis by simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   657
qed
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   658
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   659
lemma nn_integral_disjoint_pair_countspace:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   660
  assumes "B \<inter> C = {}"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   661
  shows "(\<integral>\<^sup>+x \<in> B \<union> C. f x \<partial>count_space UNIV) = (\<integral>\<^sup>+x \<in> B. f x \<partial>count_space UNIV) + (\<integral>\<^sup>+x \<in> C. f x \<partial>count_space UNIV)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   662
by (rule nn_integral_disjoint_pair) (simp_all add: assms)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   663
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   664
lemma nn_integral_null_delta:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   665
  assumes "A \<in> sets M" "B \<in> sets M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   666
          "(A - B) \<union> (B - A) \<in> null_sets M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   667
  shows "(\<integral>\<^sup>+x \<in> A. f x \<partial>M) = (\<integral>\<^sup>+x \<in> B. f x \<partial>M)"
73536
5131c388a9b0 simplified definition
haftmann
parents: 73253
diff changeset
   668
proof (rule nn_integral_cong_AE)
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   669
  have *: "AE a in M. a \<notin> (A - B) \<union> (B - A)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   670
    using assms(3) AE_not_in by blast
73536
5131c388a9b0 simplified definition
haftmann
parents: 73253
diff changeset
   671
  then show \<open>AE x in M. f x * indicator A x = f x * indicator B x\<close>
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   672
    by auto
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   673
qed
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   674
69737
ec3cc98c38db tagged 4 theories
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69566
diff changeset
   675
proposition nn_integral_disjoint_family:
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   676
  assumes [measurable]: "f \<in> borel_measurable M" "\<And>(n::nat). B n \<in> sets M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   677
      and "disjoint_family B"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   678
  shows "(\<integral>\<^sup>+x \<in> (\<Union>n. B n). f x \<partial>M) = (\<Sum>n. (\<integral>\<^sup>+x \<in> B n. f x \<partial>M))"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   679
proof -
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   680
  have "(\<integral>\<^sup>+ x. (\<Sum>n. f x * indicator (B n) x) \<partial>M) = (\<Sum>n. (\<integral>\<^sup>+ x. f x * indicator (B n) x \<partial>M))"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   681
    by (rule nn_integral_suminf) simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   682
  moreover have "(\<Sum>n. f x * indicator (B n) x) = f x * indicator (\<Union>n. B n) x" for x
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   683
  proof (cases)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   684
    assume "x \<in> (\<Union>n. B n)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   685
    then obtain n where "x \<in> B n" by blast
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   686
    have a: "finite {n}" by simp
64911
f0e07600de47 isabelle update_cartouches -c -t;
wenzelm
parents: 64284
diff changeset
   687
    have "\<And>i. i \<noteq> n \<Longrightarrow> x \<notin> B i" using \<open>x \<in> B n\<close> assms(3) disjoint_family_on_def
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   688
      by (metis IntI UNIV_I empty_iff)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   689
    then have "\<And>i. i \<notin> {n} \<Longrightarrow> indicator (B i) x = (0::ennreal)" using indicator_def by simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   690
    then have b: "\<And>i. i \<notin> {n} \<Longrightarrow> f x * indicator (B i) x = (0::ennreal)" by simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   691
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   692
    define h where "h = (\<lambda>i. f x * indicator (B i) x)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   693
    then have "\<And>i. i \<notin> {n} \<Longrightarrow> h i = 0" using b by simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   694
    then have "(\<Sum>i. h i) = (\<Sum>i\<in>{n}. h i)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   695
      by (metis sums_unique[OF sums_finite[OF a]])
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   696
    then have "(\<Sum>i. h i) = h n" by simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   697
    then have "(\<Sum>n. f x * indicator (B n) x) = f x * indicator (B n) x" using h_def by simp
64911
f0e07600de47 isabelle update_cartouches -c -t;
wenzelm
parents: 64284
diff changeset
   698
    then have "(\<Sum>n. f x * indicator (B n) x) = f x" using \<open>x \<in> B n\<close> indicator_def by simp
f0e07600de47 isabelle update_cartouches -c -t;
wenzelm
parents: 64284
diff changeset
   699
    then show ?thesis using \<open>x \<in> (\<Union>n. B n)\<close> by auto
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   700
  next
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   701
    assume "x \<notin> (\<Union>n. B n)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   702
    then have "\<And>n. f x * indicator (B n) x = 0" by simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   703
    have "(\<Sum>n. f x * indicator (B n) x) = 0"
64911
f0e07600de47 isabelle update_cartouches -c -t;
wenzelm
parents: 64284
diff changeset
   704
      by (simp add: \<open>\<And>n. f x * indicator (B n) x = 0\<close>)
f0e07600de47 isabelle update_cartouches -c -t;
wenzelm
parents: 64284
diff changeset
   705
    then show ?thesis using \<open>x \<notin> (\<Union>n. B n)\<close> by auto
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   706
  qed
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   707
  ultimately show ?thesis by simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   708
qed
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   709
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   710
lemma nn_set_integral_add:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   711
  assumes [measurable]: "f \<in> borel_measurable M" "g \<in> borel_measurable M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   712
          "A \<in> sets M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   713
  shows "(\<integral>\<^sup>+x \<in> A. (f x + g x) \<partial>M) = (\<integral>\<^sup>+x \<in> A. f x \<partial>M) + (\<integral>\<^sup>+x \<in> A. g x \<partial>M)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   714
proof -
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   715
  have "(\<integral>\<^sup>+x \<in> A. (f x + g x) \<partial>M) = (\<integral>\<^sup>+x. (f x * indicator A x + g x * indicator A x) \<partial>M)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   716
    by (auto simp add: indicator_def intro!: nn_integral_cong)
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   717
  also have "\<dots> = (\<integral>\<^sup>+x. f x * indicator A x \<partial>M) + (\<integral>\<^sup>+x. g x * indicator A x \<partial>M)"
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   718
    apply (rule nn_integral_add) using assms(1) assms(2) by auto
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   719
  finally show ?thesis by simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   720
qed
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   721
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   722
lemma nn_set_integral_cong:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   723
  assumes "AE x in M. f x = g x"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   724
  shows "(\<integral>\<^sup>+x \<in> A. f x \<partial>M) = (\<integral>\<^sup>+x \<in> A. g x \<partial>M)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   725
apply (rule nn_integral_cong_AE) using assms(1) by auto
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   726
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   727
lemma nn_set_integral_set_mono:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   728
  "A \<subseteq> B \<Longrightarrow> (\<integral>\<^sup>+ x \<in> A. f x \<partial>M) \<le> (\<integral>\<^sup>+ x \<in> B. f x \<partial>M)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   729
by (auto intro!: nn_integral_mono split: split_indicator)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   730
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   731
lemma nn_set_integral_mono:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   732
  assumes [measurable]: "f \<in> borel_measurable M" "g \<in> borel_measurable M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   733
          "A \<in> sets M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   734
      and "AE x\<in>A in M. f x \<le> g x"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   735
  shows "(\<integral>\<^sup>+x \<in> A. f x \<partial>M) \<le> (\<integral>\<^sup>+x \<in> A. g x \<partial>M)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   736
by (auto intro!: nn_integral_mono_AE split: split_indicator simp: assms)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   737
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   738
lemma nn_set_integral_space [simp]:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   739
  shows "(\<integral>\<^sup>+ x \<in> space M. f x \<partial>M) = (\<integral>\<^sup>+x. f x \<partial>M)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   740
by (metis (mono_tags, lifting) indicator_simps(1) mult.right_neutral nn_integral_cong)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   741
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   742
lemma nn_integral_count_compose_inj:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   743
  assumes "inj_on g A"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   744
  shows "(\<integral>\<^sup>+x \<in> A. f (g x) \<partial>count_space UNIV) = (\<integral>\<^sup>+y \<in> g`A. f y \<partial>count_space UNIV)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   745
proof -
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   746
  have "(\<integral>\<^sup>+x \<in> A. f (g x) \<partial>count_space UNIV) = (\<integral>\<^sup>+x. f (g x) \<partial>count_space A)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   747
    by (auto simp add: nn_integral_count_space_indicator[symmetric])
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   748
  also have "\<dots> = (\<integral>\<^sup>+y. f y \<partial>count_space (g`A))"
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   749
    by (simp add: assms nn_integral_bij_count_space inj_on_imp_bij_betw)
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   750
  also have "\<dots> = (\<integral>\<^sup>+y \<in> g`A. f y \<partial>count_space UNIV)"
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   751
    by (auto simp add: nn_integral_count_space_indicator[symmetric])
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   752
  finally show ?thesis by simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   753
qed
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   754
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   755
lemma nn_integral_count_compose_bij:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   756
  assumes "bij_betw g A B"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   757
  shows "(\<integral>\<^sup>+x \<in> A. f (g x) \<partial>count_space UNIV) = (\<integral>\<^sup>+y \<in> B. f y \<partial>count_space UNIV)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   758
proof -
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   759
  have "inj_on g A" using assms bij_betw_def by auto
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   760
  then have "(\<integral>\<^sup>+x \<in> A. f (g x) \<partial>count_space UNIV) = (\<integral>\<^sup>+y \<in> g`A. f y \<partial>count_space UNIV)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   761
    by (rule nn_integral_count_compose_inj)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   762
  then show ?thesis using assms by (simp add: bij_betw_def)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   763
qed
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   764
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   765
lemma set_integral_null_delta:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   766
  fixes f::"_ \<Rightarrow> _ :: {banach, second_countable_topology}"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   767
  assumes [measurable]: "integrable M f" "A \<in> sets M" "B \<in> sets M"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   768
    and null: "(A - B) \<union> (B - A) \<in> null_sets M"
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   769
  shows "(\<integral>x \<in> A. f x \<partial>M) = (\<integral>x \<in> B. f x \<partial>M)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   770
proof (rule set_integral_cong_set)
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   771
  have *: "AE a in M. a \<notin> (A - B) \<union> (B - A)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   772
    using null AE_not_in by blast
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   773
  then show "AE x in M. (x \<in> B) = (x \<in> A)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   774
    by auto
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   775
qed (simp_all add: set_borel_measurable_def)
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   776
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   777
lemma set_integral_space:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   778
  assumes "integrable M f"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   779
  shows "(\<integral>x \<in> space M. f x \<partial>M) = (\<integral>x. f x \<partial>M)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   780
  by (metis (no_types, lifting) indicator_simps(1) integral_cong scaleR_one set_lebesgue_integral_def)
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   781
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   782
lemma null_if_pos_func_has_zero_nn_int:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   783
  fixes f::"'a \<Rightarrow> ennreal"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   784
  assumes [measurable]: "f \<in> borel_measurable M" "A \<in> sets M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   785
    and "AE x\<in>A in M. f x > 0" "(\<integral>\<^sup>+x\<in>A. f x \<partial>M) = 0"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   786
  shows "A \<in> null_sets M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   787
proof -
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   788
  have "AE x in M. f x * indicator A x = 0"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   789
    by (subst nn_integral_0_iff_AE[symmetric], auto simp add: assms(4))
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   790
  then have "AE x\<in>A in M. False" using assms(3) by auto
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   791
  then show "A \<in> null_sets M" using assms(2) by (simp add: AE_iff_null_sets)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   792
qed
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   793
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   794
lemma null_if_pos_func_has_zero_int:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   795
  assumes [measurable]: "integrable M f" "A \<in> sets M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   796
      and "AE x\<in>A in M. f x > 0" "(\<integral>x\<in>A. f x \<partial>M) = (0::real)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   797
  shows "A \<in> null_sets M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   798
proof -
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   799
  have "AE x in M. indicator A x * f x = 0"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   800
    apply (subst integral_nonneg_eq_0_iff_AE[symmetric])
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   801
    using assms integrable_mult_indicator[OF \<open>A \<in> sets M\<close> assms(1)]
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   802
    by (auto simp: set_lebesgue_integral_def)
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   803
  then have "AE x\<in>A in M. f x = 0" by auto
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   804
  then have "AE x\<in>A in M. False" using assms(3) by auto
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   805
  then show "A \<in> null_sets M" using assms(2) by (simp add: AE_iff_null_sets)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   806
qed
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   807
64911
f0e07600de47 isabelle update_cartouches -c -t;
wenzelm
parents: 64284
diff changeset
   808
text\<open>The next lemma is a variant of \<open>density_unique\<close>. Note that it uses the notation
f0e07600de47 isabelle update_cartouches -c -t;
wenzelm
parents: 64284
diff changeset
   809
for nonnegative set integrals introduced earlier.\<close>
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   810
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   811
lemma (in sigma_finite_measure) density_unique2:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   812
  assumes [measurable]: "f \<in> borel_measurable M" "f' \<in> borel_measurable M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   813
  assumes density_eq: "\<And>A. A \<in> sets M \<Longrightarrow> (\<integral>\<^sup>+ x \<in> A. f x \<partial>M) = (\<integral>\<^sup>+ x \<in> A. f' x \<partial>M)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   814
  shows "AE x in M. f x = f' x"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   815
proof (rule density_unique)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   816
  show "density M f = density M f'"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   817
    by (intro measure_eqI) (auto simp: emeasure_density intro!: density_eq)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   818
qed (auto simp add: assms)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   819
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   820
64911
f0e07600de47 isabelle update_cartouches -c -t;
wenzelm
parents: 64284
diff changeset
   821
text \<open>The next lemma implies the same statement for Banach-space valued functions
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   822
using Hahn-Banach theorem and linear forms. Since they are not yet easily available, I
64911
f0e07600de47 isabelle update_cartouches -c -t;
wenzelm
parents: 64284
diff changeset
   823
only formulate it for real-valued functions.\<close>
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   824
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   825
lemma density_unique_real:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   826
  fixes f f'::"_ \<Rightarrow> real"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   827
  assumes M[measurable]: "integrable M f" "integrable M f'"
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   828
  assumes density_eq: "\<And>A. A \<in> sets M \<Longrightarrow> (\<integral>x \<in> A. f x \<partial>M) = (\<integral>x \<in> A. f' x \<partial>M)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   829
  shows "AE x in M. f x = f' x"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   830
proof -
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   831
  define A where "A = {x \<in> space M. f x < f' x}"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   832
  then have [measurable]: "A \<in> sets M" by simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   833
  have "(\<integral>x \<in> A. (f' x - f x) \<partial>M) = (\<integral>x \<in> A. f' x \<partial>M) - (\<integral>x \<in> A. f x \<partial>M)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   834
    using \<open>A \<in> sets M\<close> M integrable_mult_indicator set_integrable_def by blast
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   835
  then have "(\<integral>x \<in> A. (f' x - f x) \<partial>M) = 0" using assms(3) by simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   836
  then have "A \<in> null_sets M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   837
    using A_def null_if_pos_func_has_zero_int[where ?f = "\<lambda>x. f' x - f x" and ?A = A] assms by auto
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   838
  then have "AE x in M. x \<notin> A" by (simp add: AE_not_in)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   839
  then have *: "AE x in M. f' x \<le> f x" unfolding A_def by auto
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   840
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   841
  define B where "B = {x \<in> space M. f' x < f x}"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   842
  then have [measurable]: "B \<in> sets M" by simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   843
  have "(\<integral>x \<in> B. (f x - f' x) \<partial>M) = (\<integral>x \<in> B. f x \<partial>M) - (\<integral>x \<in> B. f' x \<partial>M)"
67974
3f352a91b45a replacement of set integral abbreviations by actual definitions!
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
   844
    using \<open>B \<in> sets M\<close> M integrable_mult_indicator set_integrable_def by blast
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   845
  then have "(\<integral>x \<in> B. (f x - f' x) \<partial>M) = 0" using assms(3) by simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   846
  then have "B \<in> null_sets M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   847
    using B_def null_if_pos_func_has_zero_int[where ?f = "\<lambda>x. f x - f' x" and ?A = B] assms by auto
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   848
  then have "AE x in M. x \<notin> B" by (simp add: AE_not_in)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   849
  then have "AE x in M. f' x \<ge> f x" unfolding B_def by auto
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   850
  then show ?thesis using * by auto
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   851
qed
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 63958
diff changeset
   852
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   853
section \<open>Scheffé's lemma\<close>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   854
69566
c41954ee87cf more antiquotations -- less LaTeX macros;
wenzelm
parents: 69313
diff changeset
   855
text \<open>The next lemma shows that \<open>L\<^sup>1\<close> convergence of a sequence of functions follows from almost
64284
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   856
everywhere convergence and the weaker condition of the convergence of the integrated norms (or even
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   857
just the nontrivial inequality about them). Useful in a lot of contexts! This statement (or its
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   858
variations) are known as Scheffe lemma.
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   859
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   860
The formalization is more painful as one should jump back and forth between reals and ereals and justify
64911
f0e07600de47 isabelle update_cartouches -c -t;
wenzelm
parents: 64284
diff changeset
   861
all the time positivity or integrability (thankfully, measurability is handled more or less automatically).\<close>
64284
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   862
69737
ec3cc98c38db tagged 4 theories
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69566
diff changeset
   863
proposition Scheffe_lemma1:
64284
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   864
  assumes "\<And>n. integrable M (F n)" "integrable M f"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   865
          "AE x in M. (\<lambda>n. F n x) \<longlonglongrightarrow> f x"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   866
          "limsup (\<lambda>n. \<integral>\<^sup>+ x. norm(F n x) \<partial>M) \<le> (\<integral>\<^sup>+ x. norm(f x) \<partial>M)"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   867
  shows "(\<lambda>n. \<integral>\<^sup>+ x. norm(F n x - f x) \<partial>M) \<longlonglongrightarrow> 0"
69737
ec3cc98c38db tagged 4 theories
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69566
diff changeset
   868
proof -
64284
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   869
  have [measurable]: "\<And>n. F n \<in> borel_measurable M" "f \<in> borel_measurable M"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   870
    using assms(1) assms(2) by simp_all
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   871
  define G where "G = (\<lambda>n x. norm(f x) + norm(F n x) - norm(F n x - f x))"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   872
  have [measurable]: "\<And>n. G n \<in> borel_measurable M" unfolding G_def by simp
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   873
  have G_pos[simp]: "\<And>n x. G n x \<ge> 0"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   874
    unfolding G_def by (metis ge_iff_diff_ge_0 norm_minus_commute norm_triangle_ineq4)
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   875
  have finint: "(\<integral>\<^sup>+ x. norm(f x) \<partial>M) \<noteq> \<infinity>"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   876
    using has_bochner_integral_implies_finite_norm[OF has_bochner_integral_integrable[OF \<open>integrable M f\<close>]]
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   877
    by simp
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   878
  then have fin2: "2 * (\<integral>\<^sup>+ x. norm(f x) \<partial>M) \<noteq> \<infinity>"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   879
    by (auto simp: ennreal_mult_eq_top_iff)
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   880
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   881
  {
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   882
    fix x assume *: "(\<lambda>n. F n x) \<longlonglongrightarrow> f x"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   883
    then have "(\<lambda>n. norm(F n x)) \<longlonglongrightarrow> norm(f x)" using tendsto_norm by blast
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   884
    moreover have "(\<lambda>n. norm(F n x - f x)) \<longlonglongrightarrow> 0" using * Lim_null tendsto_norm_zero_iff by fastforce
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   885
    ultimately have a: "(\<lambda>n. norm(F n x) - norm(F n x - f x)) \<longlonglongrightarrow> norm(f x)" using tendsto_diff by fastforce
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   886
    have "(\<lambda>n. norm(f x) + (norm(F n x) - norm(F n x - f x))) \<longlonglongrightarrow> norm(f x) + norm(f x)"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   887
      by (rule tendsto_add) (auto simp add: a)
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   888
    moreover have "\<And>n. G n x = norm(f x) + (norm(F n x) - norm(F n x - f x))" unfolding G_def by simp
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   889
    ultimately have "(\<lambda>n. G n x) \<longlonglongrightarrow> 2 * norm(f x)" by simp
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   890
    then have "(\<lambda>n. ennreal(G n x)) \<longlonglongrightarrow> ennreal(2 * norm(f x))" by simp
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   891
    then have "liminf (\<lambda>n. ennreal(G n x)) = ennreal(2 * norm(f x))"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   892
      using sequentially_bot tendsto_iff_Liminf_eq_Limsup by blast
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   893
  }
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   894
  then have "AE x in M. liminf (\<lambda>n. ennreal(G n x)) = ennreal(2 * norm(f x))" using assms(3) by auto
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   895
  then have "(\<integral>\<^sup>+ x. liminf (\<lambda>n. ennreal (G n x)) \<partial>M) = (\<integral>\<^sup>+ x. 2 * ennreal(norm(f x)) \<partial>M)"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   896
    by (simp add: nn_integral_cong_AE ennreal_mult)
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   897
  also have "\<dots> = 2 * (\<integral>\<^sup>+ x. norm(f x) \<partial>M)" by (rule nn_integral_cmult) auto
64284
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   898
  finally have int_liminf: "(\<integral>\<^sup>+ x. liminf (\<lambda>n. ennreal (G n x)) \<partial>M) = 2 * (\<integral>\<^sup>+ x. norm(f x) \<partial>M)"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   899
    by simp
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   900
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   901
  have "(\<integral>\<^sup>+x. ennreal(norm(f x)) + ennreal(norm(F n x)) \<partial>M) = (\<integral>\<^sup>+x. norm(f x) \<partial>M) + (\<integral>\<^sup>+x. norm(F n x) \<partial>M)" for n
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   902
    by (rule nn_integral_add) (auto simp add: assms)
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   903
  then have "limsup (\<lambda>n. (\<integral>\<^sup>+x. ennreal(norm(f x)) + ennreal(norm(F n x)) \<partial>M)) =
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   904
      limsup (\<lambda>n. (\<integral>\<^sup>+x. norm(f x) \<partial>M) + (\<integral>\<^sup>+x. norm(F n x) \<partial>M))"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   905
    by simp
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   906
  also have "\<dots> = (\<integral>\<^sup>+x. norm(f x) \<partial>M) + limsup (\<lambda>n. (\<integral>\<^sup>+x. norm(F n x) \<partial>M))"
64284
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   907
    by (rule Limsup_const_add, auto simp add: finint)
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   908
  also have "\<dots> \<le> (\<integral>\<^sup>+x. norm(f x) \<partial>M) + (\<integral>\<^sup>+x. norm(f x) \<partial>M)"
64284
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   909
    using assms(4) by (simp add: add_left_mono)
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   910
  also have "\<dots> = 2 * (\<integral>\<^sup>+x. norm(f x) \<partial>M)"
64284
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   911
    unfolding one_add_one[symmetric] distrib_right by simp
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   912
  ultimately have a: "limsup (\<lambda>n. (\<integral>\<^sup>+x. ennreal(norm(f x)) + ennreal(norm(F n x)) \<partial>M)) \<le>
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   913
    2 * (\<integral>\<^sup>+x. norm(f x) \<partial>M)" by simp
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   914
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   915
  have le: "ennreal (norm (F n x - f x)) \<le> ennreal (norm (f x)) + ennreal (norm (F n x))" for n x
68403
223172b97d0b reorient -> split; documented split
nipkow
parents: 68046
diff changeset
   916
    by (simp add: norm_minus_commute norm_triangle_ineq4 ennreal_minus flip: ennreal_plus)
64284
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   917
  then have le2: "(\<integral>\<^sup>+ x. ennreal (norm (F n x - f x)) \<partial>M) \<le> (\<integral>\<^sup>+ x. ennreal (norm (f x)) + ennreal (norm (F n x)) \<partial>M)" for n
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   918
    by (rule nn_integral_mono)
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   919
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   920
  have "2 * (\<integral>\<^sup>+ x. norm(f x) \<partial>M) = (\<integral>\<^sup>+ x. liminf (\<lambda>n. ennreal (G n x)) \<partial>M)"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   921
    by (simp add: int_liminf)
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   922
  also have "\<dots> \<le> liminf (\<lambda>n. (\<integral>\<^sup>+x. G n x \<partial>M))"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   923
    by (rule nn_integral_liminf) auto
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   924
  also have "liminf (\<lambda>n. (\<integral>\<^sup>+x. G n x \<partial>M)) =
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   925
    liminf (\<lambda>n. (\<integral>\<^sup>+x. ennreal(norm(f x)) + ennreal(norm(F n x)) \<partial>M) - (\<integral>\<^sup>+x. norm(F n x - f x) \<partial>M))"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   926
  proof (intro arg_cong[where f=liminf] ext)
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   927
    fix n
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   928
    have "\<And>x. ennreal(G n x) = ennreal(norm(f x)) + ennreal(norm(F n x)) - ennreal(norm(F n x - f x))"
68403
223172b97d0b reorient -> split; documented split
nipkow
parents: 68046
diff changeset
   929
      unfolding G_def by (simp add: ennreal_minus flip: ennreal_plus)
64284
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   930
    moreover have "(\<integral>\<^sup>+x. ennreal(norm(f x)) + ennreal(norm(F n x)) - ennreal(norm(F n x - f x)) \<partial>M)
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   931
            = (\<integral>\<^sup>+x. ennreal(norm(f x)) + ennreal(norm(F n x)) \<partial>M) - (\<integral>\<^sup>+x. norm(F n x - f x) \<partial>M)"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   932
    proof (rule nn_integral_diff)
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   933
      from le show "AE x in M. ennreal (norm (F n x - f x)) \<le> ennreal (norm (f x)) + ennreal (norm (F n x))"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   934
        by simp
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   935
      from le2 have "(\<integral>\<^sup>+x. ennreal (norm (F n x - f x)) \<partial>M) < \<infinity>" using assms(1) assms(2)
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   936
        by (metis has_bochner_integral_implies_finite_norm integrable.simps Bochner_Integration.integrable_diff)
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   937
      then show "(\<integral>\<^sup>+x. ennreal (norm (F n x - f x)) \<partial>M) \<noteq> \<infinity>" by simp
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   938
    qed (auto simp add: assms)
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   939
    ultimately show "(\<integral>\<^sup>+x. G n x \<partial>M) = (\<integral>\<^sup>+x. ennreal(norm(f x)) + ennreal(norm(F n x)) \<partial>M) - (\<integral>\<^sup>+x. norm(F n x - f x) \<partial>M)"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   940
      by simp
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   941
  qed
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   942
  finally have "2 * (\<integral>\<^sup>+ x. norm(f x) \<partial>M) + limsup (\<lambda>n. (\<integral>\<^sup>+x. norm(F n x - f x) \<partial>M)) \<le>
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   943
    liminf (\<lambda>n. (\<integral>\<^sup>+x. ennreal(norm(f x)) + ennreal(norm(F n x)) \<partial>M) - (\<integral>\<^sup>+x. norm(F n x - f x) \<partial>M)) +
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   944
    limsup (\<lambda>n. (\<integral>\<^sup>+x. norm(F n x - f x) \<partial>M))"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   945
    by (intro add_mono) auto
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   946
  also have "\<dots> \<le> (limsup (\<lambda>n. \<integral>\<^sup>+x. ennreal(norm(f x)) + ennreal(norm(F n x)) \<partial>M) - limsup (\<lambda>n. \<integral>\<^sup>+x. norm (F n x - f x) \<partial>M)) +
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   947
    limsup (\<lambda>n. (\<integral>\<^sup>+x. norm(F n x - f x) \<partial>M))"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   948
    by (intro add_mono liminf_minus_ennreal le2) auto
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   949
  also have "\<dots> = limsup (\<lambda>n. (\<integral>\<^sup>+x. ennreal(norm(f x)) + ennreal(norm(F n x)) \<partial>M))"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   950
    by (intro diff_add_cancel_ennreal Limsup_mono always_eventually allI le2)
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   951
  also have "\<dots> \<le> 2 * (\<integral>\<^sup>+x. norm(f x) \<partial>M)"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   952
    by fact
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   953
  finally have "limsup (\<lambda>n. (\<integral>\<^sup>+x. norm(F n x - f x) \<partial>M)) = 0"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   954
    using fin2 by simp
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   955
  then show ?thesis
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   956
    by (rule tendsto_0_if_Limsup_eq_0_ennreal)
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   957
qed
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   958
69737
ec3cc98c38db tagged 4 theories
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69566
diff changeset
   959
proposition Scheffe_lemma2:
64284
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   960
  fixes F::"nat \<Rightarrow> 'a \<Rightarrow> 'b::{banach, second_countable_topology}"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   961
  assumes "\<And> n::nat. F n \<in> borel_measurable M" "integrable M f"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   962
          "AE x in M. (\<lambda>n. F n x) \<longlonglongrightarrow> f x"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   963
          "\<And>n. (\<integral>\<^sup>+ x. norm(F n x) \<partial>M) \<le> (\<integral>\<^sup>+ x. norm(f x) \<partial>M)"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   964
  shows "(\<lambda>n. \<integral>\<^sup>+ x. norm(F n x - f x) \<partial>M) \<longlonglongrightarrow> 0"
69737
ec3cc98c38db tagged 4 theories
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69566
diff changeset
   965
proof (rule Scheffe_lemma1)
64284
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   966
  fix n::nat
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   967
  have "(\<integral>\<^sup>+ x. norm(f x) \<partial>M) < \<infinity>" using assms(2) by (metis has_bochner_integral_implies_finite_norm integrable.cases)
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   968
  then have "(\<integral>\<^sup>+ x. norm(F n x) \<partial>M) < \<infinity>" using assms(4)[of n] by auto
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   969
  then show "integrable M (F n)" by (subst integrable_iff_bounded, simp add: assms(1)[of n])
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   970
qed (auto simp add: assms Limsup_bounded)
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
   971
69737
ec3cc98c38db tagged 4 theories
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69566
diff changeset
   972
lemma tendsto_set_lebesgue_integral_at_right:
68721
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   973
  fixes a b :: real and f :: "real \<Rightarrow> 'a :: {banach,second_countable_topology}"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   974
  assumes "a < b" and sets: "\<And>a'. a' \<in> {a<..b} \<Longrightarrow> {a'..b} \<in> sets M"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   975
      and "set_integrable M {a<..b} f"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   976
  shows   "((\<lambda>a'. set_lebesgue_integral M {a'..b} f) \<longlongrightarrow>
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   977
             set_lebesgue_integral M {a<..b} f) (at_right a)"
69737
ec3cc98c38db tagged 4 theories
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69566
diff changeset
   978
proof (rule tendsto_at_right_sequentially[OF assms(1)], goal_cases)
68721
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   979
  case (1 S)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   980
  have eq: "(\<Union>n. {S n..b}) = {a<..b}"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   981
  proof safe
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   982
    fix x n assume "x \<in> {S n..b}"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   983
    with 1(1,2)[of n] show "x \<in> {a<..b}" by auto
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   984
  next
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   985
    fix x assume "x \<in> {a<..b}"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   986
    with order_tendstoD[OF \<open>S \<longlonglongrightarrow> a\<close>, of x] show "x \<in> (\<Union>n. {S n..b})"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   987
      by (force simp: eventually_at_top_linorder dest: less_imp_le)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   988
  qed
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   989
  have "(\<lambda>n. set_lebesgue_integral M {S n..b} f) \<longlonglongrightarrow> set_lebesgue_integral M (\<Union>n. {S n..b}) f"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   990
    by (rule set_integral_cont_up) (insert assms 1, auto simp: eq incseq_def decseq_def less_imp_le)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   991
  with eq show ?case by simp
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   992
qed
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   993
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
   994
section \<open>Convergence of integrals over an interval\<close>
68721
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   995
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   996
text \<open>
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   997
  The next lemmas relate convergence of integrals over an interval to
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   998
  improper integrals.
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
   999
\<close>
69737
ec3cc98c38db tagged 4 theories
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69566
diff changeset
  1000
lemma tendsto_set_lebesgue_integral_at_left:
68721
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1001
  fixes a b :: real and f :: "real \<Rightarrow> 'a :: {banach,second_countable_topology}"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1002
  assumes "a < b" and sets: "\<And>b'. b' \<in> {a..<b} \<Longrightarrow> {a..b'} \<in> sets M"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1003
      and "set_integrable M {a..<b} f"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1004
  shows   "((\<lambda>b'. set_lebesgue_integral M {a..b'} f) \<longlongrightarrow>
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1005
             set_lebesgue_integral M {a..<b} f) (at_left b)"
69737
ec3cc98c38db tagged 4 theories
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69566
diff changeset
  1006
proof (rule tendsto_at_left_sequentially[OF assms(1)], goal_cases)
68721
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1007
  case (1 S)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1008
  have eq: "(\<Union>n. {a..S n}) = {a..<b}"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1009
  proof safe
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1010
    fix x n assume "x \<in> {a..S n}"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1011
    with 1(1,2)[of n] show "x \<in> {a..<b}" by auto
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1012
  next
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1013
    fix x assume "x \<in> {a..<b}"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1014
    with order_tendstoD[OF \<open>S \<longlonglongrightarrow> b\<close>, of x] show "x \<in> (\<Union>n. {a..S n})"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1015
      by (force simp: eventually_at_top_linorder dest: less_imp_le)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1016
  qed
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1017
  have "(\<lambda>n. set_lebesgue_integral M {a..S n} f) \<longlonglongrightarrow> set_lebesgue_integral M (\<Union>n. {a..S n}) f"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1018
    by (rule set_integral_cont_up) (insert assms 1, auto simp: eq incseq_def decseq_def less_imp_le)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1019
  with eq show ?case by simp
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1020
qed
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1021
69737
ec3cc98c38db tagged 4 theories
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69566
diff changeset
  1022
proposition tendsto_set_lebesgue_integral_at_top:
68721
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1023
  fixes f :: "real \<Rightarrow> 'a::{banach, second_countable_topology}"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1024
  assumes sets: "\<And>b. b \<ge> a \<Longrightarrow> {a..b} \<in> sets M"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1025
      and int: "set_integrable M {a..} f"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1026
  shows "((\<lambda>b. set_lebesgue_integral M {a..b} f) \<longlongrightarrow> set_lebesgue_integral M {a..} f) at_top"
69737
ec3cc98c38db tagged 4 theories
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69566
diff changeset
  1027
proof (rule tendsto_at_topI_sequentially)
68721
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1028
  fix X :: "nat \<Rightarrow> real" assume "filterlim X at_top sequentially"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1029
  show "(\<lambda>n. set_lebesgue_integral M {a..X n} f) \<longlonglongrightarrow> set_lebesgue_integral M {a..} f"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1030
    unfolding set_lebesgue_integral_def
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1031
  proof (rule integral_dominated_convergence)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1032
    show "integrable M (\<lambda>x. indicat_real {a..} x *\<^sub>R norm (f x))"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1033
      using integrable_norm[OF int[unfolded set_integrable_def]] by simp
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1034
    show "AE x in M. (\<lambda>n. indicator {a..X n} x *\<^sub>R f x) \<longlonglongrightarrow> indicat_real {a..} x *\<^sub>R f x"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1035
    proof
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1036
      fix x
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1037
      from \<open>filterlim X at_top sequentially\<close>
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1038
      have "eventually (\<lambda>n. x \<le> X n) sequentially"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1039
        unfolding filterlim_at_top_ge[where c=x] by auto
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1040
      then show "(\<lambda>n. indicator {a..X n} x *\<^sub>R f x) \<longlonglongrightarrow> indicat_real {a..} x *\<^sub>R f x"
70365
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 70136
diff changeset
  1041
        by (intro tendsto_eventually) (auto split: split_indicator elim!: eventually_mono)
68721
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1042
    qed
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1043
    fix n show "AE x in M. norm (indicator {a..X n} x *\<^sub>R f x) \<le> 
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1044
                             indicator {a..} x *\<^sub>R norm (f x)"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1045
      by (auto split: split_indicator)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1046
  next
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1047
    from int show "(\<lambda>x. indicat_real {a..} x *\<^sub>R f x) \<in> borel_measurable M"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1048
      by (simp add: set_integrable_def)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1049
  next
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1050
    fix n :: nat
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1051
    from sets have "{a..X n} \<in> sets M" by (cases "X n \<ge> a") auto
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1052
    with int have "set_integrable M {a..X n} f"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1053
      by (rule set_integrable_subset) auto
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1054
    thus "(\<lambda>x. indicat_real {a..X n} x *\<^sub>R f x) \<in> borel_measurable M"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1055
      by (simp add: set_integrable_def)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1056
  qed
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1057
qed
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1058
69737
ec3cc98c38db tagged 4 theories
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69566
diff changeset
  1059
proposition tendsto_set_lebesgue_integral_at_bot:
68721
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1060
  fixes f :: "real \<Rightarrow> 'a::{banach, second_countable_topology}"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1061
  assumes sets: "\<And>a. a \<le> b \<Longrightarrow> {a..b} \<in> sets M"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1062
      and int: "set_integrable M {..b} f"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1063
    shows "((\<lambda>a. set_lebesgue_integral M {a..b} f) \<longlongrightarrow> set_lebesgue_integral M {..b} f) at_bot"
69737
ec3cc98c38db tagged 4 theories
Angeliki KoutsoukouArgyraki <ak2110@cam.ac.uk>
parents: 69566
diff changeset
  1064
proof (rule tendsto_at_botI_sequentially)
68721
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1065
  fix X :: "nat \<Rightarrow> real" assume "filterlim X at_bot sequentially"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1066
  show "(\<lambda>n. set_lebesgue_integral M {X n..b} f) \<longlonglongrightarrow> set_lebesgue_integral M {..b} f"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1067
    unfolding set_lebesgue_integral_def
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1068
  proof (rule integral_dominated_convergence)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1069
    show "integrable M (\<lambda>x. indicat_real {..b} x *\<^sub>R norm (f x))"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1070
      using integrable_norm[OF int[unfolded set_integrable_def]] by simp
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1071
    show "AE x in M. (\<lambda>n. indicator {X n..b} x *\<^sub>R f x) \<longlonglongrightarrow> indicat_real {..b} x *\<^sub>R f x"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1072
    proof
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1073
      fix x
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1074
      from \<open>filterlim X at_bot sequentially\<close>
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1075
      have "eventually (\<lambda>n. x \<ge> X n) sequentially"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1076
        unfolding filterlim_at_bot_le[where c=x] by auto
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1077
      then show "(\<lambda>n. indicator {X n..b} x *\<^sub>R f x) \<longlonglongrightarrow> indicat_real {..b} x *\<^sub>R f x"
70365
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 70136
diff changeset
  1078
        by (intro tendsto_eventually) (auto split: split_indicator elim!: eventually_mono)
68721
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1079
    qed
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1080
    fix n show "AE x in M. norm (indicator {X n..b} x *\<^sub>R f x) \<le> 
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1081
                             indicator {..b} x *\<^sub>R norm (f x)"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1082
      by (auto split: split_indicator)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1083
  next
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1084
    from int show "(\<lambda>x. indicat_real {..b} x *\<^sub>R f x) \<in> borel_measurable M"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1085
      by (simp add: set_integrable_def)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1086
  next
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1087
    fix n :: nat
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1088
    from sets have "{X n..b} \<in> sets M" by (cases "X n \<le> b") auto
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1089
    with int have "set_integrable M {X n..b} f"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1090
      by (rule set_integrable_subset) auto
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1091
    thus "(\<lambda>x. indicat_real {X n..b} x *\<^sub>R f x) \<in> borel_measurable M"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1092
      by (simp add: set_integrable_def)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1093
  qed
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1094
qed
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68403
diff changeset
  1095
73253
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1096
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1097
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1098
theorem integral_Markov_inequality':
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1099
  fixes u :: "'a \<Rightarrow> real"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1100
  assumes [measurable]: "set_integrable M A u" and "A \<in> sets M"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1101
  assumes "AE x in M. x \<in> A \<longrightarrow> u x \<ge> 0" and "0 < (c::real)"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1102
  shows "emeasure M {x\<in>A. u x \<ge> c} \<le> (1/c::real) * (\<integral>x\<in>A. u x \<partial>M)"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1103
proof -
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1104
  have "(\<lambda>x. u x * indicator A x) \<in> borel_measurable M" 
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1105
    using assms by (auto simp: set_integrable_def mult_ac)
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1106
  hence "(\<lambda>x. ennreal (u x * indicator A x)) \<in> borel_measurable M"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1107
    by measurable
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1108
  also have "(\<lambda>x. ennreal (u x * indicator A x)) = (\<lambda>x. ennreal (u x) * indicator A x)"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1109
    by (intro ext) (auto simp: indicator_def)
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1110
  finally have meas: "\<dots> \<in> borel_measurable M" .
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1111
  from assms(3) have AE: "AE x in M. 0 \<le> u x * indicator A x"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1112
    by eventually_elim (auto simp: indicator_def)
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1113
  have nonneg: "set_lebesgue_integral M A u \<ge> 0"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1114
    unfolding set_lebesgue_integral_def
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1115
    by (intro Bochner_Integration.integral_nonneg_AE eventually_mono[OF AE]) (auto simp: mult_ac)
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1116
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1117
  have A: "A \<subseteq> space M"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1118
    using \<open>A \<in> sets M\<close> by (simp add: sets.sets_into_space)
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1119
  have "{x \<in> A. u x \<ge> c} = {x \<in> A. ennreal(1/c) * u x \<ge> 1}"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1120
    using \<open>c>0\<close> A by (auto simp: ennreal_mult'[symmetric])
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1121
  then have "emeasure M {x \<in> A. u x \<ge> c} = emeasure M ({x \<in> A. ennreal(1/c) * u x \<ge> 1})"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1122
    by simp
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1123
  also have "\<dots> \<le> ennreal(1/c) * (\<integral>\<^sup>+ x. ennreal(u x) * indicator A x \<partial>M)"
73253
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1124
    by (intro nn_integral_Markov_inequality meas assms)
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1125
  also have "(\<integral>\<^sup>+ x. ennreal(u x) * indicator A x \<partial>M) = ennreal (set_lebesgue_integral M A u)"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1126
    unfolding set_lebesgue_integral_def nn_integral_set_ennreal using assms AE
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1127
    by (subst nn_integral_eq_integral) (simp_all add: mult_ac set_integrable_def)
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1128
  finally show ?thesis
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1129
    using \<open>c > 0\<close> nonneg by (subst ennreal_mult) auto
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1130
qed
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1131
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1132
theorem integral_Markov_inequality'_measure:
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1133
  assumes [measurable]: "set_integrable M A u" and "A \<in> sets M" 
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1134
     and "AE x in M. x \<in> A \<longrightarrow> 0 \<le> u x" "0 < (c::real)"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1135
  shows "measure M {x\<in>A. u x \<ge> c} \<le> (\<integral>x\<in>A. u x \<partial>M) / c"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1136
proof -
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1137
  have nonneg: "set_lebesgue_integral M A u \<ge> 0"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1138
    unfolding set_lebesgue_integral_def
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1139
    by (intro Bochner_Integration.integral_nonneg_AE eventually_mono[OF assms(3)])
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1140
       (auto simp: mult_ac)
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1141
  have le: "emeasure M {x\<in>A. u x \<ge> c} \<le> ennreal ((1/c) * (\<integral>x\<in>A. u x \<partial>M))"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1142
    by (rule integral_Markov_inequality') (use assms in auto)
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1143
  also have "\<dots> < top"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1144
    by auto
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1145
  finally have "ennreal (measure M {x\<in>A. u x \<ge> c}) = emeasure M {x\<in>A. u x \<ge> c}"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1146
    by (intro emeasure_eq_ennreal_measure [symmetric]) auto
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1147
  also note le
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1148
  finally show ?thesis using nonneg
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1149
    by (subst (asm) ennreal_le_iff)
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1150
       (auto intro!: divide_nonneg_pos Bochner_Integration.integral_nonneg_AE assms)
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1151
qed
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1152
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1153
theorem%important (in finite_measure) Chernoff_ineq_ge:
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1154
  assumes s: "s > 0"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1155
  assumes integrable: "set_integrable M A (\<lambda>x. exp (s * f x))" and "A \<in> sets M"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1156
  shows   "measure M {x\<in>A. f x \<ge> a} \<le> exp (-s * a) * (\<integral>x\<in>A. exp (s * f x) \<partial>M)"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1157
proof -
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1158
  have "{x\<in>A. f x \<ge> a} = {x\<in>A. exp (s * f x) \<ge> exp (s * a)}"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1159
    using s by auto
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1160
  also have "measure M \<dots> \<le> set_lebesgue_integral M A (\<lambda>x. exp (s * f x)) / exp (s * a)"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1161
    by (intro integral_Markov_inequality'_measure assms) auto
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1162
  finally show ?thesis 
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1163
    by (simp add: exp_minus field_simps)
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1164
qed
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1165
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1166
theorem%important (in finite_measure) Chernoff_ineq_le:
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1167
  assumes s: "s > 0"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1168
  assumes integrable: "set_integrable M A (\<lambda>x. exp (-s * f x))" and "A \<in> sets M"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1169
  shows   "measure M {x\<in>A. f x \<le> a} \<le> exp (s * a) * (\<integral>x\<in>A. exp (-s * f x) \<partial>M)"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1170
proof -
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1171
  have "{x\<in>A. f x \<le> a} = {x\<in>A. exp (-s * f x) \<ge> exp (-s * a)}"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1172
    using s by auto
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1173
  also have "measure M \<dots> \<le> set_lebesgue_integral M A (\<lambda>x. exp (-s * f x)) / exp (-s * a)"
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1174
    by (intro integral_Markov_inequality'_measure assms) auto
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1175
  finally show ?thesis 
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1176
    by (simp add: exp_minus field_simps)
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1177
qed
f6bb31879698 HOL-Analysis/Probability: Hoeffding's inequality, negative binomial distribution, etc.
Manuel Eberl <eberlm@in.tum.de>
parents: 70721
diff changeset
  1178
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1179
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1180
section \<open>Integrable Simple Functions\<close>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1181
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1182
text \<open>This section is from the Martingales AFP entry, by Ata Keskin, TU München\<close>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1183
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1184
text \<open>We restate some basic results concerning Bochner-integrable functions.\<close>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1185
  
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1186
lemma integrable_implies_simple_function_sequence:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1187
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1188
  assumes "integrable M f"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1189
  obtains s where "\<And>i. simple_function M (s i)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1190
      and "\<And>i. emeasure M {y \<in> space M. s i y \<noteq> 0} \<noteq> \<infinity>"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1191
      and "\<And>x. x \<in> space M \<Longrightarrow> (\<lambda>i. s i x) \<longlonglongrightarrow> f x"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1192
      and "\<And>x i. x \<in> space M \<Longrightarrow> norm (s i x) \<le> 2 * norm (f x)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1193
proof-
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1194
  have f: "f \<in> borel_measurable M" "(\<integral>\<^sup>+x. norm (f x) \<partial>M) < \<infinity>" using assms unfolding integrable_iff_bounded by auto
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1195
  obtain s where s: "\<And>i. simple_function M (s i)" "\<And>x. x \<in> space M \<Longrightarrow> (\<lambda>i. s i x) \<longlonglongrightarrow> f x" "\<And>i x. x \<in> space M \<Longrightarrow> norm (s i x) \<le> 2 * norm (f x)" using borel_measurable_implies_sequence_metric[OF f(1)] unfolding norm_conv_dist by metis
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1196
  {
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1197
    fix i
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1198
    have "(\<integral>\<^sup>+x. norm (s i x) \<partial>M) \<le> (\<integral>\<^sup>+x. ennreal (2 * norm (f x)) \<partial>M)" using s by (intro nn_integral_mono, auto)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1199
    also have "\<dots> < \<infinity>" using f by (simp add: nn_integral_cmult ennreal_mult_less_top ennreal_mult)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1200
    finally have sbi: "Bochner_Integration.simple_bochner_integrable M (s i)" using s by (intro simple_bochner_integrableI_bounded) auto
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1201
    hence "emeasure M {y \<in> space M. s i y \<noteq> 0} \<noteq> \<infinity>" by (auto intro: integrableI_simple_bochner_integrable simple_bochner_integrable.cases)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1202
  }
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1203
  thus ?thesis using that s by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1204
qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1205
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1206
text \<open>Simple functions can be represented by sums of indicator functions.\<close>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1207
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1208
lemma simple_function_indicator_representation_banach:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1209
  fixes f ::"'a \<Rightarrow> 'b :: {second_countable_topology, banach}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1210
  assumes "simple_function M f" "x \<in> space M"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1211
  shows "f x = (\<Sum>y \<in> f ` space M. indicator (f -` {y} \<inter> space M) x *\<^sub>R y)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1212
  (is "?l = ?r")
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1213
proof -
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1214
  have "?r = (\<Sum>y \<in> f ` space M. (if y = f x then indicator (f -` {y} \<inter> space M) x *\<^sub>R y else 0))" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1215
    by (auto intro!: sum.cong)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1216
  also have "\<dots> =  indicator (f -` {f x} \<inter> space M) x *\<^sub>R f x" using assms by (auto dest: simple_functionD)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1217
  also have "\<dots> = f x" using assms by (auto simp: indicator_def)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1218
  finally show ?thesis by auto
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1219
qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1220
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1221
lemma simple_function_indicator_representation_AE:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1222
  fixes f ::"'a \<Rightarrow> 'b :: {second_countable_topology, banach}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1223
  assumes "simple_function M f"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1224
  shows "AE x in M. f x = (\<Sum>y \<in> f ` space M. indicator (f -` {y} \<inter> space M) x *\<^sub>R y)"  
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1225
  by (metis (mono_tags, lifting) AE_I2 simple_function_indicator_representation_banach assms)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1226
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1227
lemmas simple_function_scaleR[intro] = simple_function_compose2[where h="(*\<^sub>R)"]
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1228
lemmas integrable_simple_function = simple_bochner_integrable.intros[THEN has_bochner_integral_simple_bochner_integrable, THEN integrable.intros] 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1229
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1230
text \<open>Induction rule for simple integrable functions.\<close>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1231
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1232
lemma\<^marker>\<open>tag important\<close> integrable_simple_function_induct[consumes 2, case_names cong indicator add, induct set: simple_function]:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1233
  fixes f :: "'a \<Rightarrow> 'b :: {second_countable_topology, banach}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1234
  assumes f: "simple_function M f" "emeasure M {y \<in> space M. f y \<noteq> 0} \<noteq> \<infinity>"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1235
  assumes cong: "\<And>f g. simple_function M f \<Longrightarrow> emeasure M {y \<in> space M. f y \<noteq> 0} \<noteq> \<infinity> 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1236
                    \<Longrightarrow> simple_function M g \<Longrightarrow> emeasure M {y \<in> space M. g y \<noteq> 0} \<noteq> \<infinity> 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1237
                    \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> f x = g x) \<Longrightarrow> P f \<Longrightarrow> P g"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1238
  assumes indicator: "\<And>A y. A \<in> sets M \<Longrightarrow> emeasure M A < \<infinity> \<Longrightarrow> P (\<lambda>x. indicator A x *\<^sub>R y)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1239
  assumes add: "\<And>f g. simple_function M f \<Longrightarrow> emeasure M {y \<in> space M. f y \<noteq> 0} \<noteq> \<infinity> \<Longrightarrow> 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1240
                      simple_function M g \<Longrightarrow> emeasure M {y \<in> space M. g y \<noteq> 0} \<noteq> \<infinity> \<Longrightarrow> 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1241
                      (\<And>z. z \<in> space M \<Longrightarrow> norm (f z + g z) = norm (f z) + norm (g z)) \<Longrightarrow>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1242
                      P f \<Longrightarrow> P g \<Longrightarrow> P (\<lambda>x. f x + g x)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1243
  shows "P f"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1244
proof-
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1245
  let ?f = "\<lambda>x. (\<Sum>y\<in>f ` space M. indicat_real (f -` {y} \<inter> space M) x *\<^sub>R y)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1246
  have f_ae_eq: "f x = ?f x" if "x \<in> space M" for x using simple_function_indicator_representation_banach[OF f(1) that] .
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1247
  moreover have "emeasure M {y \<in> space M. ?f y \<noteq> 0} \<noteq> \<infinity>" by (metis (no_types, lifting) Collect_cong calculation f(2))
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1248
  moreover have "P (\<lambda>x. \<Sum>y\<in>S. indicat_real (f -` {y} \<inter> space M) x *\<^sub>R y)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1249
                "simple_function M (\<lambda>x. \<Sum>y\<in>S. indicat_real (f -` {y} \<inter> space M) x *\<^sub>R y)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1250
                "emeasure M {y \<in> space M. (\<Sum>x\<in>S. indicat_real (f -` {x} \<inter> space M) y *\<^sub>R x) \<noteq> 0} \<noteq> \<infinity>"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1251
                if "S \<subseteq> f ` space M" for S using simple_functionD(1)[OF assms(1), THEN rev_finite_subset, OF that] that 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1252
  proof (induction rule: finite_induct)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1253
    case empty
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1254
    {
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1255
      case 1
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1256
      then show ?case using indicator[of "{}"] by force
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1257
    next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1258
      case 2
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1259
      then show ?case by force 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1260
    next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1261
      case 3
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1262
      then show ?case by force 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1263
    }
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1264
  next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1265
    case (insert x F)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1266
    have "(f -` {x} \<inter> space M) \<subseteq> {y \<in> space M. f y \<noteq> 0}" if "x \<noteq> 0" using that by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1267
    moreover have "{y \<in> space M. f y \<noteq> 0} = space M - (f -` {0} \<inter> space M)" by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1268
    moreover have "space M - (f -` {0} \<inter> space M) \<in> sets M" using simple_functionD(2)[OF f(1)] by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1269
    ultimately have fin_0: "emeasure M (f -` {x} \<inter> space M) < \<infinity>" if "x \<noteq> 0" using that by (metis emeasure_mono f(2) infinity_ennreal_def top.not_eq_extremum top_unique)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1270
    hence fin_1: "emeasure M {y \<in> space M. indicat_real (f -` {x} \<inter> space M) y *\<^sub>R x \<noteq> 0} \<noteq> \<infinity>" if "x \<noteq> 0" by (metis (mono_tags, lifting) emeasure_mono f(1) indicator_simps(2) linorder_not_less mem_Collect_eq scaleR_eq_0_iff simple_functionD(2) subsetI that)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1271
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1272
    have *: "(\<Sum>y\<in>insert x F. indicat_real (f -` {y} \<inter> space M) xa *\<^sub>R y) = (\<Sum>y\<in>F. indicat_real (f -` {y} \<inter> space M) xa *\<^sub>R y) + indicat_real (f -` {x} \<inter> space M) xa *\<^sub>R x" for xa by (metis (no_types, lifting) Diff_empty Diff_insert0 add.commute insert.hyps(1) insert.hyps(2) sum.insert_remove)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1273
    have **: "{y \<in> space M. (\<Sum>x\<in>insert x F. indicat_real (f -` {x} \<inter> space M) y *\<^sub>R x) \<noteq> 0} \<subseteq> {y \<in> space M. (\<Sum>x\<in>F. indicat_real (f -` {x} \<inter> space M) y *\<^sub>R x) \<noteq> 0} \<union> {y \<in> space M. indicat_real (f -` {x} \<inter> space M) y *\<^sub>R x \<noteq> 0}" unfolding * by fastforce    
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1274
    {
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1275
      case 1
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1276
      hence x: "x \<in> f ` space M" and F: "F \<subseteq> f ` space M" by auto
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1277
      show ?case 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1278
      proof (cases "x = 0")
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1279
        case True
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1280
        then show ?thesis unfolding * using insert(3)[OF F] by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1281
      next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1282
        case False
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1283
        have norm_argument: "norm ((\<Sum>y\<in>F. indicat_real (f -` {y} \<inter> space M) z *\<^sub>R y) + indicat_real (f -` {x} \<inter> space M) z *\<^sub>R x) = norm (\<Sum>y\<in>F. indicat_real (f -` {y} \<inter> space M) z *\<^sub>R y) + norm (indicat_real (f -` {x} \<inter> space M) z *\<^sub>R x)" if z: "z \<in> space M" for z
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1284
        proof (cases "f z = x")
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1285
          case True
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1286
          have "indicat_real (f -` {y} \<inter> space M) z *\<^sub>R y = 0" if "y \<in> F" for y
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1287
            using True insert(2) z that 1 unfolding indicator_def by force
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1288
          hence "(\<Sum>y\<in>F. indicat_real (f -` {y} \<inter> space M) z *\<^sub>R y) = 0" by (meson sum.neutral)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1289
          then show ?thesis by force
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1290
        next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1291
          case False
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1292
          then show ?thesis by force
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1293
        qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1294
        show ?thesis 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1295
          using False simple_functionD(2)[OF f(1)] insert(3,5)[OF F] simple_function_scaleR fin_0 fin_1 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1296
          by (subst *, subst add, subst simple_function_sum) (blast intro: norm_argument indicator)+
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1297
      qed 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1298
    next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1299
      case 2
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1300
      hence x: "x \<in> f ` space M" and F: "F \<subseteq> f ` space M" by auto
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1301
      show ?case 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1302
      proof (cases "x = 0")
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1303
        case True
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1304
        then show ?thesis unfolding * using insert(4)[OF F] by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1305
      next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1306
        case False
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1307
        then show ?thesis unfolding * using insert(4)[OF F] simple_functionD(2)[OF f(1)] by fast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1308
      qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1309
    next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1310
      case 3
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1311
      hence x: "x \<in> f ` space M" and F: "F \<subseteq> f ` space M" by auto
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1312
      show ?case 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1313
      proof (cases "x = 0")
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1314
        case True
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1315
        then show ?thesis unfolding * using insert(5)[OF F] by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1316
      next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1317
        case False
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1318
        have "emeasure M {y \<in> space M. (\<Sum>x\<in>insert x F. indicat_real (f -` {x} \<inter> space M) y *\<^sub>R x) \<noteq> 0} \<le> emeasure M ({y \<in> space M. (\<Sum>x\<in>F. indicat_real (f -` {x} \<inter> space M) y *\<^sub>R x) \<noteq> 0} \<union> {y \<in> space M. indicat_real (f -` {x} \<inter> space M) y *\<^sub>R x \<noteq> 0})"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1319
          using ** simple_functionD(2)[OF insert(4)[OF F]] simple_functionD(2)[OF f(1)] by (intro emeasure_mono, force+)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1320
        also have "\<dots> \<le> emeasure M {y \<in> space M. (\<Sum>x\<in>F. indicat_real (f -` {x} \<inter> space M) y *\<^sub>R x) \<noteq> 0} + emeasure M {y \<in> space M. indicat_real (f -` {x} \<inter> space M) y *\<^sub>R x \<noteq> 0}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1321
          using simple_functionD(2)[OF insert(4)[OF F]] simple_functionD(2)[OF f(1)] by (intro emeasure_subadditive, force+)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1322
        also have "\<dots> < \<infinity>" using insert(5)[OF F] fin_1[OF False] by (simp add: less_top)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1323
        finally show ?thesis by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1324
      qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1325
    }
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1326
  qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1327
  moreover have "simple_function M (\<lambda>x. \<Sum>y\<in>f ` space M. indicat_real (f -` {y} \<inter> space M) x *\<^sub>R y)" using calculation by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1328
  moreover have "P (\<lambda>x. \<Sum>y\<in>f ` space M. indicat_real (f -` {y} \<inter> space M) x *\<^sub>R y)" using calculation by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1329
  ultimately show ?thesis by (intro cong[OF _ _ f(1,2)], blast, presburger+) 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1330
qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1331
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1332
text \<open>Induction rule for non-negative simple integrable functions\<close>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1333
lemma\<^marker>\<open>tag important\<close> integrable_simple_function_induct_nn[consumes 3, case_names cong indicator add, induct set: simple_function]:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1334
  fixes f :: "'a \<Rightarrow> 'b :: {second_countable_topology, banach, linorder_topology, ordered_real_vector}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1335
  assumes f: "simple_function M f" "emeasure M {y \<in> space M. f y \<noteq> 0} \<noteq> \<infinity>" "\<And>x. x \<in> space M \<longrightarrow> f x \<ge> 0"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1336
  assumes cong: "\<And>f g. simple_function M f \<Longrightarrow> emeasure M {y \<in> space M. f y \<noteq> 0} \<noteq> \<infinity> \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> f x \<ge> 0) \<Longrightarrow> simple_function M g \<Longrightarrow> emeasure M {y \<in> space M. g y \<noteq> 0} \<noteq> \<infinity> \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> g x \<ge> 0) \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> f x = g x) \<Longrightarrow> P f \<Longrightarrow> P g"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1337
  assumes indicator: "\<And>A y. y \<ge> 0 \<Longrightarrow> A \<in> sets M \<Longrightarrow> emeasure M A < \<infinity> \<Longrightarrow> P (\<lambda>x. indicator A x *\<^sub>R y)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1338
  assumes add: "\<And>f g. (\<And>x. x \<in> space M \<Longrightarrow> f x \<ge> 0) \<Longrightarrow> simple_function M f \<Longrightarrow> emeasure M {y \<in> space M. f y \<noteq> 0} \<noteq> \<infinity> \<Longrightarrow> 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1339
                      (\<And>x. x \<in> space M \<Longrightarrow> g x \<ge> 0) \<Longrightarrow> simple_function M g \<Longrightarrow> emeasure M {y \<in> space M. g y \<noteq> 0} \<noteq> \<infinity> \<Longrightarrow> 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1340
                      (\<And>z. z \<in> space M \<Longrightarrow> norm (f z + g z) = norm (f z) + norm (g z)) \<Longrightarrow>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1341
                      P f \<Longrightarrow> P g \<Longrightarrow> P (\<lambda>x. f x + g x)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1342
  shows "P f"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1343
proof-
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1344
  let ?f = "\<lambda>x. (\<Sum>y\<in>f ` space M. indicat_real (f -` {y} \<inter> space M) x *\<^sub>R y)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1345
  have f_ae_eq: "f x = ?f x" if "x \<in> space M" for x using simple_function_indicator_representation_banach[OF f(1) that] .
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1346
  moreover have "emeasure M {y \<in> space M. ?f y \<noteq> 0} \<noteq> \<infinity>" by (metis (no_types, lifting) Collect_cong calculation f(2))
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1347
  moreover have "P (\<lambda>x. \<Sum>y\<in>S. indicat_real (f -` {y} \<inter> space M) x *\<^sub>R y)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1348
                "simple_function M (\<lambda>x. \<Sum>y\<in>S. indicat_real (f -` {y} \<inter> space M) x *\<^sub>R y)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1349
                "emeasure M {y \<in> space M. (\<Sum>x\<in>S. indicat_real (f -` {x} \<inter> space M) y *\<^sub>R x) \<noteq> 0} \<noteq> \<infinity>"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1350
                "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> (\<Sum>y\<in>S. indicat_real (f -` {y} \<inter> space M) x *\<^sub>R y)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1351
                if "S \<subseteq> f ` space M" for S using simple_functionD(1)[OF assms(1), THEN rev_finite_subset, OF that] that 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1352
  proof (induction rule: finite_subset_induct')
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1353
    case empty
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1354
    {
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1355
      case 1
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1356
      then show ?case using indicator[of 0 "{}"] by force
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1357
    next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1358
      case 2
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1359
      then show ?case by force 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1360
    next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1361
      case 3
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1362
      then show ?case by force 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1363
    next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1364
      case 4
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1365
      then show ?case by force 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1366
    }
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1367
  next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1368
    case (insert x F)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1369
    have "(f -` {x} \<inter> space M) \<subseteq> {y \<in> space M. f y \<noteq> 0}" if "x \<noteq> 0" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1370
      using that by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1371
    moreover have "{y \<in> space M. f y \<noteq> 0} = space M - (f -` {0} \<inter> space M)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1372
      by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1373
    moreover have "space M - (f -` {0} \<inter> space M) \<in> sets M" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1374
      using simple_functionD(2)[OF f(1)] by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1375
    ultimately have fin_0: "emeasure M (f -` {x} \<inter> space M) < \<infinity>" if "x \<noteq> 0" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1376
      using that by (metis emeasure_mono f(2) infinity_ennreal_def top.not_eq_extremum top_unique)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1377
    hence fin_1: "emeasure M {y \<in> space M. indicat_real (f -` {x} \<inter> space M) y *\<^sub>R x \<noteq> 0} \<noteq> \<infinity>" if "x \<noteq> 0" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1378
      by (metis (mono_tags, lifting) emeasure_mono f(1) indicator_simps(2) linorder_not_less mem_Collect_eq scaleR_eq_0_iff simple_functionD(2) subsetI that)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1379
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1380
    have nonneg_x: "x \<ge> 0" using insert f by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1381
    have *: "(\<Sum>y\<in>insert x F. indicat_real (f -` {y} \<inter> space M) xa *\<^sub>R y) = (\<Sum>y\<in>F. indicat_real (f -` {y} \<inter> space M) xa *\<^sub>R y) + indicat_real (f -` {x} \<inter> space M) xa *\<^sub>R x" for xa by (metis (no_types, lifting) add.commute insert.hyps(1) insert.hyps(4) sum.insert)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1382
    have **: "{y \<in> space M. (\<Sum>x\<in>insert x F. indicat_real (f -` {x} \<inter> space M) y *\<^sub>R x) \<noteq> 0} \<subseteq> {y \<in> space M. (\<Sum>x\<in>F. indicat_real (f -` {x} \<inter> space M) y *\<^sub>R x) \<noteq> 0} \<union> {y \<in> space M. indicat_real (f -` {x} \<inter> space M) y *\<^sub>R x \<noteq> 0}" unfolding * by fastforce    
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1383
    {
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1384
      case 1
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1385
      show ?case 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1386
      proof (cases "x = 0")
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1387
        case True
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1388
        then show ?thesis unfolding * using insert by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1389
      next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1390
        case False
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1391
        have norm_argument: "norm ((\<Sum>y\<in>F. indicat_real (f -` {y} \<inter> space M) z *\<^sub>R y) + indicat_real (f -` {x} \<inter> space M) z *\<^sub>R x) 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1392
              = norm (\<Sum>y\<in>F. indicat_real (f -` {y} \<inter> space M) z *\<^sub>R y) + norm (indicat_real (f -` {x} \<inter> space M) z *\<^sub>R x)" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1393
          if z: "z \<in> space M" for z
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1394
        proof (cases "f z = x")
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1395
          case True
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1396
          have "indicat_real (f -` {y} \<inter> space M) z *\<^sub>R y = 0" if "y \<in> F" for y 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1397
            using True insert z that 1 unfolding indicator_def by force
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1398
          hence "(\<Sum>y\<in>F. indicat_real (f -` {y} \<inter> space M) z *\<^sub>R y) = 0" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1399
            by (meson sum.neutral)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1400
          thus ?thesis by force
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1401
        qed (force)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1402
        show ?thesis using False fin_0 fin_1 f norm_argument 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1403
          by (subst *, subst add, presburger add: insert, intro insert, intro insert, fastforce simp add: indicator_def intro!: insert(2) f(3), auto intro!: indicator insert nonneg_x)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1404
      qed 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1405
    next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1406
      case 2
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1407
      show ?case 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1408
      proof (cases "x = 0")
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1409
        case True
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1410
        then show ?thesis unfolding * using insert by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1411
      next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1412
        case False
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1413
        then show ?thesis unfolding * using insert simple_functionD(2)[OF f(1)] by fast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1414
      qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1415
    next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1416
      case 3
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1417
      show ?case 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1418
      proof (cases "x = 0")
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1419
        case True
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1420
        then show ?thesis unfolding * using insert by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1421
      next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1422
        case False
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1423
        have "emeasure M {y \<in> space M. (\<Sum>x\<in>insert x F. indicat_real (f -` {x} \<inter> space M) y *\<^sub>R x) \<noteq> 0} 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1424
           \<le> emeasure M ({y \<in> space M. (\<Sum>x\<in>F. indicat_real (f -` {x} \<inter> space M) y *\<^sub>R x) \<noteq> 0} \<union> {y \<in> space M. indicat_real (f -` {x} \<inter> space M) y *\<^sub>R x \<noteq> 0})"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1425
          using ** simple_functionD(2)[OF insert(6)] simple_functionD(2)[OF f(1)] insert.IH(2) by (intro emeasure_mono, blast, simp) 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1426
        also have "\<dots> \<le> emeasure M {y \<in> space M. (\<Sum>x\<in>F. indicat_real (f -` {x} \<inter> space M) y *\<^sub>R x) \<noteq> 0} + emeasure M {y \<in> space M. indicat_real (f -` {x} \<inter> space M) y *\<^sub>R x \<noteq> 0}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1427
          using simple_functionD(2)[OF insert(6)] simple_functionD(2)[OF f(1)] by (intro emeasure_subadditive, force+)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1428
        also have "\<dots> < \<infinity>" using insert(7) fin_1[OF False] by (simp add: less_top)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1429
        finally show ?thesis by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1430
      qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1431
    next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1432
      case (4 \<xi>)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1433
      thus ?case using insert nonneg_x f(3) by (auto simp add: scaleR_nonneg_nonneg intro: sum_nonneg)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1434
    }
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1435
  qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1436
  moreover have "simple_function M (\<lambda>x. \<Sum>y\<in>f ` space M. indicat_real (f -` {y} \<inter> space M) x *\<^sub>R y)" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1437
    using calculation by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1438
  moreover have "P (\<lambda>x. \<Sum>y\<in>f ` space M. indicat_real (f -` {y} \<inter> space M) x *\<^sub>R y)" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1439
    using calculation by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1440
  moreover have "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> f x" using f(3) by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1441
  ultimately show ?thesis
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1442
    by (smt (verit) Collect_cong f(1) local.cong) 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1443
qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1444
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1445
lemma finite_nn_integral_imp_ae_finite:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1446
  fixes f :: "'a \<Rightarrow> ennreal"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1447
  assumes "f \<in> borel_measurable M" "(\<integral>\<^sup>+x. f x \<partial>M) < \<infinity>"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1448
  shows "AE x in M. f x < \<infinity>"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1449
proof (rule ccontr, goal_cases)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1450
  case 1
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1451
  let ?A = "space M \<inter> {x. f x = \<infinity>}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1452
  have *: "emeasure M ?A > 0" using 1 assms(1) 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1453
    by (metis (mono_tags, lifting) assms(2) eventually_mono infinity_ennreal_def nn_integral_noteq_infinite top.not_eq_extremum)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1454
  have "(\<integral>\<^sup>+x. f x * indicator ?A x \<partial>M) = (\<integral>\<^sup>+x. \<infinity> * indicator ?A x \<partial>M)" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1455
    by (metis (mono_tags, lifting) indicator_inter_arith indicator_simps(2) mem_Collect_eq mult_eq_0_iff)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1456
  also have "\<dots> = \<infinity> * emeasure M ?A" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1457
    using assms(1) by (intro nn_integral_cmult_indicator, simp)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1458
  also have "\<dots> = \<infinity>" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1459
    using * by fastforce
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1460
  finally have "(\<integral>\<^sup>+x. f x * indicator ?A x \<partial>M) = \<infinity>" .
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1461
  moreover have "(\<integral>\<^sup>+x. f x * indicator ?A x \<partial>M) \<le> (\<integral>\<^sup>+x. f x \<partial>M)" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1462
    by (intro nn_integral_mono, simp add: indicator_def)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1463
  ultimately show ?case using assms(2) by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1464
qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1465
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1466
text \<open>Convergence in L1-Norm implies existence of a subsequence which convergences almost everywhere. 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1467
      This lemma is easier to use than the existing one in \<^theory>\<open>HOL-Analysis.Bochner_Integration\<close>\<close>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1468
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1469
lemma cauchy_L1_AE_cauchy_subseq:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1470
  fixes s :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::{banach, second_countable_topology}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1471
  assumes [measurable]: "\<And>n. integrable M (s n)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1472
      and "\<And>e. e > 0 \<Longrightarrow> \<exists>N. \<forall>i\<ge>N. \<forall>j\<ge>N. LINT x|M. norm (s i x - s j x) < e"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1473
  obtains r where "strict_mono r" "AE x in M. Cauchy (\<lambda>i. s (r i) x)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1474
proof-
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1475
  have "\<exists>r. \<forall>n. (\<forall>i\<ge>r n. \<forall>j\<ge> r n. LINT x|M. norm (s i x - s j x) < (1 / 2) ^ n) \<and> (r (Suc n) > r n)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1476
  proof (intro dependent_nat_choice, goal_cases)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1477
    case 1
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1478
    then show ?case using assms(2) by presburger
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1479
  next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1480
    case (2 x n)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1481
    obtain N where *: "LINT x|M. norm (s i x - s j x) < (1 / 2) ^ Suc n" if "i \<ge> N" "j \<ge> N" for i j 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1482
      using assms(2)[of "(1 / 2) ^ Suc n"] by auto
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1483
    {
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1484
      fix i j assume "i \<ge> max N (Suc x)" "j \<ge> max N (Suc x)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1485
      hence "integral\<^sup>L M (\<lambda>x. norm (s i x - s j x)) < (1 / 2) ^ Suc n" using * by fastforce
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1486
    }
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1487
    then show ?case by fastforce
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1488
  qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1489
  then obtain r where strict_mono: "strict_mono r" and "\<forall>i\<ge>r n. \<forall>j\<ge> r n. LINT x|M. norm (s i x - s j x) < (1 / 2) ^ n" for n 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1490
    using strict_mono_Suc_iff by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1491
  hence r_is: "LINT x|M. norm (s (r (Suc n)) x - s (r n) x) < (1 / 2) ^ n" for n by (simp add: strict_mono_leD)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1492
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1493
  define g where "g = (\<lambda>n x. (\<Sum>i\<le>n. ennreal (norm (s (r (Suc i)) x - s (r i) x))))"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1494
  define g' where "g' = (\<lambda>x. \<Sum>i. ennreal (norm (s (r (Suc i)) x - s (r i) x)))"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1495
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1496
  have integrable_g: "(\<integral>\<^sup>+ x. g n x \<partial>M) < 2" for n
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1497
  proof -
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1498
    have "(\<integral>\<^sup>+ x. g n x \<partial>M) = (\<integral>\<^sup>+ x. (\<Sum>i\<le>n. ennreal (norm (s (r (Suc i)) x - s (r i) x))) \<partial>M)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1499
      using g_def by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1500
    also have "\<dots> = (\<Sum>i\<le>n. (\<integral>\<^sup>+ x. ennreal (norm (s (r (Suc i)) x - s (r i) x)) \<partial>M))" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1501
      by (intro nn_integral_sum, simp)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1502
    also have "\<dots> = (\<Sum>i\<le>n. LINT x|M. norm (s (r (Suc i)) x - s (r i) x))" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1503
      unfolding dist_norm using assms(1) by (subst nn_integral_eq_integral[OF integrable_norm], auto)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1504
    also have "\<dots> < ennreal (\<Sum>i\<le>n. (1 / 2) ^ i)" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1505
      by (intro ennreal_lessI[OF sum_pos sum_strict_mono[OF finite_atMost _ r_is]], auto)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1506
    also have "\<dots> \<le> ennreal 2" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1507
      unfolding sum_gp0[of "1 / 2" n] by (intro ennreal_leI, auto)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1508
    finally show "(\<integral>\<^sup>+ x. g n x \<partial>M) < 2" by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1509
  qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1510
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1511
  have integrable_g': "(\<integral>\<^sup>+ x. g' x \<partial>M) \<le> 2"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1512
  proof -
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1513
    have "incseq (\<lambda>n. g n x)" for x by (intro incseq_SucI, auto simp add: g_def ennreal_leI)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1514
    hence "convergent (\<lambda>n. g n x)" for x
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1515
      unfolding convergent_def using LIMSEQ_incseq_SUP by fast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1516
    hence "(\<lambda>n. g n x) \<longlonglongrightarrow> g' x" for x 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1517
      unfolding g_def g'_def by (intro summable_iff_convergent'[THEN iffD2, THEN summable_LIMSEQ'], blast)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1518
    hence "(\<integral>\<^sup>+ x. g' x \<partial>M) = (\<integral>\<^sup>+ x. liminf (\<lambda>n. g n x) \<partial>M)" by (metis lim_imp_Liminf trivial_limit_sequentially)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1519
    also have "\<dots> \<le> liminf (\<lambda>n. \<integral>\<^sup>+ x. g n x \<partial>M)" by (intro nn_integral_liminf, simp add: g_def)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1520
    also have "\<dots> \<le> liminf (\<lambda>n. 2)" using integrable_g by (intro Liminf_mono) (simp add: order_le_less)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1521
    also have "\<dots> = 2" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1522
      using sequentially_bot tendsto_iff_Liminf_eq_Limsup by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1523
    finally show ?thesis .
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1524
  qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1525
  hence "AE x in M. g' x < \<infinity>" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1526
    by (intro finite_nn_integral_imp_ae_finite) (auto simp add: order_le_less_trans g'_def)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1527
  moreover have "summable (\<lambda>i. norm (s (r (Suc i)) x - s (r i) x))" if "g' x \<noteq> \<infinity>" for x 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1528
    using that unfolding g'_def by (intro summable_suminf_not_top) fastforce+ 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1529
  ultimately have ae_summable: "AE x in M. summable (\<lambda>i. s (r (Suc i)) x - s (r i) x)" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1530
    using summable_norm_cancel unfolding dist_norm by force
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1531
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1532
  {
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1533
    fix x assume "summable (\<lambda>i. s (r (Suc i)) x - s (r i) x)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1534
    hence "(\<lambda>n. \<Sum>i<n. s (r (Suc i)) x - s (r i) x) \<longlonglongrightarrow> (\<Sum>i. s (r (Suc i)) x - s (r i) x)" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1535
      using summable_LIMSEQ by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1536
    moreover have "(\<lambda>n. (\<Sum>i<n. s (r (Suc i)) x - s (r i) x)) = (\<lambda>n. s (r n) x - s (r 0) x)" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1537
      using sum_lessThan_telescope by fastforce
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1538
    ultimately have "(\<lambda>n. s (r n) x - s (r 0) x) \<longlonglongrightarrow> (\<Sum>i. s (r (Suc i)) x - s (r i) x)" by argo
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1539
    hence "(\<lambda>n. s (r n) x - s (r 0) x + s (r 0) x) \<longlonglongrightarrow> (\<Sum>i. s (r (Suc i)) x - s (r i) x) + s (r 0) x" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1540
      by (intro isCont_tendsto_compose[of _ "\<lambda>z. z + s (r 0) x"], auto)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1541
    hence "Cauchy (\<lambda>n. s (r n) x)" by (simp add: LIMSEQ_imp_Cauchy)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1542
  }
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1543
  hence "AE x in M. Cauchy (\<lambda>i. s (r i) x)" using ae_summable by fast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1544
  thus ?thesis by (rule that[OF strict_mono(1)])
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1545
qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1546
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1547
subsection \<open>Totally Ordered Banach Spaces\<close>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1548
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1549
lemma integrable_max[simp, intro]:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1550
  fixes f :: "'a \<Rightarrow> 'b :: {second_countable_topology, banach, linorder_topology}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1551
  assumes fg[measurable]: "integrable M f" "integrable M g"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1552
  shows "integrable M (\<lambda>x. max (f x) (g x))"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1553
proof (rule Bochner_Integration.integrable_bound)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1554
  {
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1555
    fix x y :: 'b                                             
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1556
    have "norm (max x y) \<le> max (norm x) (norm y)" by linarith
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1557
    also have "\<dots> \<le> norm x + norm y" by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1558
    finally have "norm (max x y) \<le> norm (norm x + norm y)" by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1559
  }
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1560
  thus "AE x in M. norm (max (f x) (g x)) \<le> norm (norm (f x) + norm (g x))" by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1561
qed (auto intro: Bochner_Integration.integrable_add[OF integrable_norm[OF fg(1)] integrable_norm[OF fg(2)]])
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1562
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1563
lemma integrable_min[simp, intro]:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1564
  fixes f :: "'a \<Rightarrow> 'b :: {second_countable_topology, banach, linorder_topology}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1565
  assumes [measurable]: "integrable M f" "integrable M g"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1566
  shows "integrable M (\<lambda>x. min (f x) (g x))"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1567
proof -
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1568
  have "norm (min (f x) (g x)) \<le> norm (f x) \<or> norm (min (f x) (g x)) \<le> norm (g x)" for x by linarith
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1569
  thus ?thesis 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1570
    by (intro integrable_bound[OF integrable_max[OF integrable_norm(1,1), OF assms]], auto)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1571
qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1572
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1573
text \<open>Restatement of \<open>integral_nonneg_AE\<close> for functions taking values in a Banach space.\<close>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1574
lemma integral_nonneg_AE_banach:                        
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1575
  fixes f :: "'a \<Rightarrow> 'b :: {second_countable_topology, banach, linorder_topology, ordered_real_vector}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1576
  assumes [measurable]: "f \<in> borel_measurable M" and nonneg: "AE x in M. 0 \<le> f x"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1577
  shows "0 \<le> integral\<^sup>L M f"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1578
proof cases
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1579
  assume integrable: "integrable M f"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1580
  hence max: "(\<lambda>x. max 0 (f x)) \<in> borel_measurable M" "\<And>x. 0 \<le> max 0 (f x)" "integrable M (\<lambda>x. max 0 (f x))" by auto
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1581
  hence "0 \<le> integral\<^sup>L M (\<lambda>x. max 0 (f x))"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1582
  proof -
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1583
  obtain s where *: "\<And>i. simple_function M (s i)" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1584
                    "\<And>i. emeasure M {y \<in> space M. s i y \<noteq> 0} \<noteq> \<infinity>" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1585
                    "\<And>x. x \<in> space M \<Longrightarrow> (\<lambda>i. s i x) \<longlonglongrightarrow> f x" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1586
                    "\<And>x i. x \<in> space M \<Longrightarrow> norm (s i x) \<le> 2 * norm (f x)" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1587
    using integrable_implies_simple_function_sequence[OF integrable] by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1588
  have simple: "\<And>i. simple_function M (\<lambda>x. max 0 (s i x))" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1589
    using * by fast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1590
    have "\<And>i. {y \<in> space M. max 0 (s i y) \<noteq> 0} \<subseteq> {y \<in> space M. s i y \<noteq> 0}" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1591
      unfolding max_def by force
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1592
    moreover have "\<And>i. {y \<in> space M. s i y \<noteq> 0} \<in> sets M" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1593
      using * by measurable
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1594
    ultimately have "\<And>i. emeasure M {y \<in> space M. max 0 (s i y) \<noteq> 0} \<le> emeasure M {y \<in> space M. s i y \<noteq> 0}" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1595
      by (rule emeasure_mono) 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1596
    hence **:"\<And>i. emeasure M {y \<in> space M. max 0 (s i y) \<noteq> 0} \<noteq> \<infinity>" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1597
      using *(2) by (auto intro: order.strict_trans1 simp add:  top.not_eq_extremum)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1598
    have "\<And>x. x \<in> space M \<Longrightarrow> (\<lambda>i. max 0 (s i x)) \<longlonglongrightarrow> max 0 (f x)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1599
      using *(3) tendsto_max by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1600
    moreover have "\<And>x i. x \<in> space M \<Longrightarrow> norm (max 0 (s i x)) \<le> norm (2 *\<^sub>R f x)" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1601
      using *(4) unfolding max_def by auto
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1602
    ultimately have tendsto: "(\<lambda>i. integral\<^sup>L M (\<lambda>x. max 0 (s i x))) \<longlonglongrightarrow> integral\<^sup>L M (\<lambda>x. max 0 (f x))" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1603
      using borel_measurable_simple_function simple integrable by (intro integral_dominated_convergence[OF max(1) _ integrable_norm[OF integrable_scaleR_right], of _ 2 f], blast+)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1604
    {
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1605
      fix h :: "'a \<Rightarrow> 'b :: {second_countable_topology, banach, linorder_topology, ordered_real_vector}" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1606
      assume "simple_function M h" "emeasure M {y \<in> space M. h y \<noteq> 0} \<noteq> \<infinity>" "\<And>x. x \<in> space M \<longrightarrow> h x \<ge> 0"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1607
      hence *: "integral\<^sup>L M h \<ge> 0"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1608
      proof (induct rule: integrable_simple_function_induct_nn)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1609
        case (cong f g)                   
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1610
        then show ?case using Bochner_Integration.integral_cong by force
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1611
      next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1612
        case (indicator A y)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1613
        hence "A \<noteq> {} \<Longrightarrow> y \<ge> 0" using sets.sets_into_space by fastforce
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1614
        then show ?case using indicator by (cases "A = {}", auto simp add: scaleR_nonneg_nonneg)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1615
      next
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1616
        case (add f g)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1617
        then show ?case by (simp add: integrable_simple_function)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1618
      qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1619
    }
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1620
    thus ?thesis using LIMSEQ_le_const[OF tendsto, of 0] ** simple by fastforce
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1621
  qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1622
  also have "\<dots> = integral\<^sup>L M f" using nonneg by (auto intro: integral_cong_AE)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1623
  finally show ?thesis .
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1624
qed (simp add: not_integrable_integral_eq)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1625
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1626
lemma integral_mono_AE_banach:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1627
  fixes f g :: "'a \<Rightarrow> 'b :: {second_countable_topology, banach, linorder_topology, ordered_real_vector}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1628
  assumes "integrable M f" "integrable M g" "AE x in M. f x \<le> g x"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1629
  shows "integral\<^sup>L M f \<le> integral\<^sup>L M g"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1630
  using integral_nonneg_AE_banach[of "\<lambda>x. g x - f x"] assms Bochner_Integration.integral_diff[OF assms(1,2)] by force
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1631
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1632
lemma integral_mono_banach:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1633
  fixes f g :: "'a \<Rightarrow> 'b :: {second_countable_topology, banach, linorder_topology, ordered_real_vector}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1634
  assumes "integrable M f" "integrable M g" "\<And>x. x \<in> space M \<Longrightarrow> f x \<le> g x"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1635
  shows "integral\<^sup>L M f \<le> integral\<^sup>L M g"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1636
  using integral_mono_AE_banach assms by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1637
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1638
subsection \<open>Auxiliary Lemmas for Set Integrals\<close>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1639
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1640
lemma nn_set_integral_eq_set_integral:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1641
  assumes [measurable]:"integrable M f"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1642
      and "AE x \<in> A in M. 0 \<le> f x" "A \<in> sets M"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1643
    shows "(\<integral>\<^sup>+x\<in>A. f x \<partial>M) = (\<integral> x \<in> A. f x \<partial>M)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1644
proof-
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1645
  have "(\<integral>\<^sup>+x. indicator A x *\<^sub>R f x \<partial>M) = (\<integral> x \<in> A. f x \<partial>M)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1646
    unfolding set_lebesgue_integral_def 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1647
    using assms(2) by (intro nn_integral_eq_integral[of _ "\<lambda>x. indicat_real A x *\<^sub>R f x"], blast intro: assms integrable_mult_indicator, fastforce)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1648
  moreover have "(\<integral>\<^sup>+x. indicator A x *\<^sub>R f x \<partial>M) = (\<integral>\<^sup>+x\<in>A. f x \<partial>M)"  
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1649
    by (metis ennreal_0 indicator_simps(1) indicator_simps(2) mult.commute mult_1 mult_zero_left real_scaleR_def)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1650
  ultimately show ?thesis by argo
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1651
qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1652
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1653
lemma set_integral_restrict_space:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1654
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1655
  assumes "\<Omega> \<inter> space M \<in> sets M"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1656
  shows "set_lebesgue_integral (restrict_space M \<Omega>) A f = set_lebesgue_integral M A (\<lambda>x. indicator \<Omega> x *\<^sub>R f x)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1657
  unfolding set_lebesgue_integral_def 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1658
  by (subst integral_restrict_space, auto intro!: integrable_mult_indicator assms simp: mult.commute)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1659
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1660
lemma set_integral_const:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1661
  fixes c :: "'b::{banach, second_countable_topology}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1662
  assumes "A \<in> sets M" "emeasure M A \<noteq> \<infinity>"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1663
  shows "set_lebesgue_integral M A (\<lambda>_. c) = measure M A *\<^sub>R c"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1664
  unfolding set_lebesgue_integral_def 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1665
  using assms by (metis has_bochner_integral_indicator has_bochner_integral_integral_eq infinity_ennreal_def less_top)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1666
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1667
lemma set_integral_mono_banach:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1668
  fixes f g :: "'a \<Rightarrow> 'b :: {second_countable_topology, banach, linorder_topology, ordered_real_vector}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1669
  assumes "set_integrable M A f" "set_integrable M A g"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1670
    "\<And>x. x \<in> A \<Longrightarrow> f x \<le> g x"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1671
  shows "(LINT x:A|M. f x) \<le> (LINT x:A|M. g x)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1672
  using assms unfolding set_integrable_def set_lebesgue_integral_def
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1673
  by (auto intro: integral_mono_banach split: split_indicator)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1674
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1675
lemma set_integral_mono_AE_banach:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1676
  fixes f g :: "'a \<Rightarrow> 'b :: {second_countable_topology, banach, linorder_topology, ordered_real_vector}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1677
  assumes "set_integrable M A f" "set_integrable M A g" "AE x\<in>A in M. f x \<le> g x"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1678
  shows "set_lebesgue_integral M A f \<le> set_lebesgue_integral M A g" using assms unfolding set_lebesgue_integral_def by (auto simp add: set_integrable_def intro!: integral_mono_AE_banach[of M "\<lambda>x. indicator A x *\<^sub>R f x" "\<lambda>x. indicator A x *\<^sub>R g x"], simp add: indicator_def)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1679
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1680
subsection \<open>Integrability and Measurability of the Diameter\<close>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1681
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1682
context
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1683
  fixes s :: "nat \<Rightarrow> 'a \<Rightarrow> 'b :: {second_countable_topology, banach}" and M
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1684
  assumes bounded: "\<And>x. x \<in> space M \<Longrightarrow> bounded (range (\<lambda>i. s i x))"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1685
begin
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1686
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1687
lemma borel_measurable_diameter: 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1688
  assumes [measurable]: "\<And>i. (s i) \<in> borel_measurable M"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1689
  shows "(\<lambda>x. diameter {s i x |i. n \<le> i}) \<in> borel_measurable M"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1690
proof -
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1691
  have "{s i x |i. N \<le> i} \<noteq> {}" for x N by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1692
  hence diameter_SUP: "diameter {s i x |i. N \<le> i} = (SUP (i, j) \<in> {N..} \<times> {N..}. dist (s i x) (s j x))" for x N unfolding diameter_def by (auto intro!: arg_cong[of _ _ Sup])
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1693
  
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1694
  have "case_prod dist ` ({s i x |i. n \<le> i} \<times> {s i x |i. n \<le> i}) = ((\<lambda>(i, j). dist (s i x) (s j x)) ` ({n..} \<times> {n..}))" for x by fast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1695
  hence *: "(\<lambda>x. diameter {s i x |i. n \<le> i}) =  (\<lambda>x. Sup ((\<lambda>(i, j). dist (s i x) (s j x)) ` ({n..} \<times> {n..})))" using diameter_SUP by (simp add: case_prod_beta')
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1696
  
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1697
  have "bounded ((\<lambda>(i, j). dist (s i x) (s j x)) ` ({n..} \<times> {n..}))" if "x \<in> space M" for x by (rule bounded_imp_dist_bounded[OF bounded, OF that])
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1698
  hence bdd: "bdd_above ((\<lambda>(i, j). dist (s i x) (s j x)) ` ({n..} \<times> {n..}))" if "x \<in> space M" for x using that bounded_imp_bdd_above by presburger
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1699
  have "fst p \<in> borel_measurable M" "snd p \<in> borel_measurable M" if "p \<in> s ` {n..} \<times> s ` {n..}" for p using that by fastforce+
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1700
  hence "(\<lambda>x. fst p x - snd p x) \<in> borel_measurable M" if "p \<in> s ` {n..} \<times> s ` {n..}" for p using that borel_measurable_diff by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1701
  hence "(\<lambda>x. case p of (f, g) \<Rightarrow> dist (f x) (g x)) \<in> borel_measurable M" if "p \<in> s ` {n..} \<times> s ` {n..}" for p unfolding dist_norm using that by measurable
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1702
  moreover have "countable (s ` {n..} \<times> s ` {n..})" by (intro countable_SIGMA countable_image, auto)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1703
  ultimately show ?thesis unfolding * by (auto intro!: borel_measurable_cSUP bdd)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1704
qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1705
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1706
lemma integrable_bound_diameter:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1707
  fixes f :: "'a \<Rightarrow> real"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1708
  assumes "integrable M f" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1709
      and [measurable]: "\<And>i. (s i) \<in> borel_measurable M"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1710
      and "\<And>x i. x \<in> space M \<Longrightarrow> norm (s i x) \<le> f x"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1711
    shows "integrable M (\<lambda>x. diameter {s i x |i. n \<le> i})"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1712
proof -
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1713
  have "{s i x |i. N \<le> i} \<noteq> {}" for x N by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1714
  hence diameter_SUP: "diameter {s i x |i. N \<le> i} = (SUP (i, j) \<in> {N..} \<times> {N..}. dist (s i x) (s j x))" for x N unfolding diameter_def by (auto intro!: arg_cong[of _ _ Sup])
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1715
  {
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1716
    fix x assume x: "x \<in> space M"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1717
    let ?S = "(\<lambda>(i, j). dist (s i x) (s j x)) ` ({n..} \<times> {n..})"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1718
    have "case_prod dist ` ({s i x |i. n \<le> i} \<times> {s i x |i. n \<le> i}) = (\<lambda>(i, j). dist (s i x) (s j x)) ` ({n..} \<times> {n..})" by fast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1719
    hence *: "diameter {s i x |i. n \<le> i} =  Sup ?S" using diameter_SUP by (simp add: case_prod_beta')
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1720
    
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1721
    have "bounded ?S" by (rule bounded_imp_dist_bounded[OF bounded[OF x]])
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1722
    hence Sup_S_nonneg:"0 \<le> Sup ?S" by (auto intro!: cSup_upper2 x bounded_imp_bdd_above)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1723
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1724
    have "dist (s i x) (s j x) \<le>  2 * f x" for i j by (intro dist_triangle2[THEN order_trans, of _ 0]) (metis norm_conv_dist assms(3) x add_mono mult_2)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1725
    hence "\<forall>c \<in> ?S. c \<le> 2 * f x" by force
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1726
    hence "Sup ?S \<le> 2 * f x" by (intro cSup_least, auto)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1727
    hence "norm (Sup ?S) \<le> 2 * norm (f x)" using Sup_S_nonneg by auto
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1728
    also have "\<dots> = norm (2 *\<^sub>R f x)" by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1729
    finally have "norm (diameter {s i x |i. n \<le> i}) \<le> norm (2 *\<^sub>R f x)" unfolding * .
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1730
  }
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1731
  hence "AE x in M. norm (diameter {s i x |i. n \<le> i}) \<le> norm (2 *\<^sub>R f x)" by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1732
  thus  "integrable M (\<lambda>x. diameter {s i x |i. n \<le> i})" using borel_measurable_diameter by (intro Bochner_Integration.integrable_bound[OF assms(1)[THEN integrable_scaleR_right[of 2]]], measurable)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1733
qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1734
end    
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1735
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1736
subsection \<open>Averaging Theorem\<close>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1737
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1738
text \<open>We aim to lift results from the real case to arbitrary Banach spaces. 
79950
82aaa0d8fc3b isabelle update -u cite;
wenzelm
parents: 79787
diff changeset
  1739
      Our fundamental tool in this regard will be the averaging theorem. The proof of this theorem is due to Serge Lang (Real and Functional Analysis) \<^cite>\<open>"Lang_1993"\<close>. 
79787
b053bd598887 avoid suspicious Unicode;
wenzelm
parents: 79772
diff changeset
  1740
      The theorem allows us to make statements about a function's value almost everywhere, depending on the value its integral takes on various sets of the measure space.\<close>
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1741
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1742
text \<open>Before we introduce and prove the averaging theorem, we will first show the following lemma which is crucial for our proof. 
79950
82aaa0d8fc3b isabelle update -u cite;
wenzelm
parents: 79787
diff changeset
  1743
      While not stated exactly in this manner, our proof makes use of the characterization of second-countable topological spaces given in the book General Topology by Ryszard Engelking (Theorem 4.1.15) \<^cite>\<open>"engelking_1989"\<close>.
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1744
    (Engelking's book \emph{General Topology})\<close>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1745
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1746
lemma balls_countable_basis:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1747
  obtains D :: "'a :: {metric_space, second_countable_topology} set" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1748
  where "topological_basis (case_prod ball ` (D \<times> (\<rat> \<inter> {0<..})))"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1749
    and "countable D"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1750
    and "D \<noteq> {}"    
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1751
proof -
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1752
  obtain D :: "'a set" where dense_subset: "countable D" "D \<noteq> {}" "\<lbrakk>open U; U \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>y \<in> D. y \<in> U" for U using countable_dense_exists by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1753
  have "topological_basis (case_prod ball ` (D \<times> (\<rat> \<inter> {0<..})))"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1754
  proof (intro topological_basis_iff[THEN iffD2], fast, clarify)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1755
    fix U and x :: 'a assume asm: "open U" "x \<in> U"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1756
    obtain e where e: "e > 0" "ball x e \<subseteq> U" using asm openE by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1757
    obtain y where y: "y \<in> D" "y \<in> ball x (e / 3)" using dense_subset(3)[OF open_ball, of x "e / 3"] centre_in_ball[THEN iffD2, OF divide_pos_pos[OF e(1), of 3]] by force
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1758
    obtain r where r: "r \<in> \<rat> \<inter> {e/3<..<e/2}" unfolding Rats_def using of_rat_dense[OF divide_strict_left_mono[OF _ e(1)], of 2 3] by auto
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1759
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1760
    have *: "x \<in> ball y r" using r y by (simp add: dist_commute)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1761
    hence "ball y r \<subseteq> U" using r by (intro order_trans[OF _ e(2)], simp, metric)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1762
    moreover have "ball y r \<in> (case_prod ball ` (D \<times> (\<rat> \<inter> {0<..})))" using y(1) r by force
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1763
    ultimately show "\<exists>B'\<in>(case_prod ball ` (D \<times> (\<rat> \<inter> {0<..}))). x \<in> B' \<and> B' \<subseteq> U" using * by meson
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1764
  qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1765
  thus ?thesis using that dense_subset by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1766
qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1767
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1768
context sigma_finite_measure
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1769
begin         
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1770
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1771
text \<open>To show statements concerning \<open>\<sigma>\<close>-finite measure spaces, one usually shows the statement for finite measure spaces and uses a limiting argument to show it for the \<open>\<sigma>\<close>-finite case.
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1772
      The following induction scheme formalizes this.\<close>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1773
lemma sigma_finite_measure_induct[case_names finite_measure, consumes 0]:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1774
  assumes "\<And>(N :: 'a measure) \<Omega>. finite_measure N 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1775
                              \<Longrightarrow> N = restrict_space M \<Omega>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1776
                              \<Longrightarrow> \<Omega> \<in> sets M 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1777
                              \<Longrightarrow> emeasure N \<Omega> \<noteq> \<infinity> 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1778
                              \<Longrightarrow> emeasure N \<Omega> \<noteq> 0 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1779
                              \<Longrightarrow> almost_everywhere N Q"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1780
      and [measurable]: "Measurable.pred M Q"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1781
  shows "almost_everywhere M Q"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1782
proof -
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1783
  have *: "almost_everywhere N Q" if "finite_measure N" "N = restrict_space M \<Omega>" "\<Omega> \<in> sets M" "emeasure N \<Omega> \<noteq> \<infinity>" for N \<Omega> using that by (cases "emeasure N \<Omega> = 0", auto intro: emeasure_0_AE assms(1))
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1784
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1785
  obtain A :: "nat \<Rightarrow> 'a set" where A: "range A \<subseteq> sets M" "(\<Union>i. A i) = space M" and emeasure_finite: "emeasure M (A i) \<noteq> \<infinity>" for i using sigma_finite by metis
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1786
  note A(1)[measurable]
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1787
  have space_restr: "space (restrict_space M (A i)) = A i" for i unfolding space_restrict_space by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1788
  {
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1789
    fix i    
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1790
    have *: "{x \<in> A i \<inter> space M. Q x} = {x \<in> space M. Q x} \<inter> (A i)" by fast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1791
    have "Measurable.pred (restrict_space M (A i)) Q" using A by (intro measurableI, auto simp add: space_restr intro!: sets_restrict_space_iff[THEN iffD2], measurable, auto)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1792
  }
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1793
  note this[measurable]
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1794
  {
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1795
    fix i
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1796
    have "finite_measure (restrict_space M (A i))" using emeasure_finite by (intro finite_measureI, subst space_restr, subst emeasure_restrict_space, auto)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1797
    hence "emeasure (restrict_space M (A i)) {x \<in> A i. \<not>Q x} = 0" using emeasure_finite by (intro AE_iff_measurable[THEN iffD1, OF _ _ *], measurable, subst space_restr[symmetric], intro sets.top, auto simp add: emeasure_restrict_space)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1798
    hence "emeasure M {x \<in> A i. \<not> Q x} = 0" by (subst emeasure_restrict_space[symmetric], auto)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1799
  }
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1800
  hence "emeasure M (\<Union>i. {x \<in> A i. \<not> Q x}) = 0" by (intro emeasure_UN_eq_0, auto)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1801
  moreover have "(\<Union>i. {x \<in> A i. \<not> Q x}) = {x \<in> space M. \<not> Q x}" using A by auto
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1802
  ultimately show ?thesis by (intro AE_iff_measurable[THEN iffD2], auto)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1803
qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1804
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1805
text \<open>Real Functional Analysis - Lang\<close>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1806
text \<open>The Averaging Theorem allows us to make statements concerning how a function behaves almost everywhere, depending on its behaviour on average.\<close>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1807
lemma averaging_theorem:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1808
  fixes f::"_ \<Rightarrow> 'b::{second_countable_topology, banach}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1809
  assumes [measurable]: "integrable M f" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1810
      and closed: "closed S"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1811
      and "\<And>A. A \<in> sets M \<Longrightarrow> measure M A > 0 \<Longrightarrow> (1 / measure M A) *\<^sub>R set_lebesgue_integral M A f \<in> S"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1812
    shows "AE x in M. f x \<in> S"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1813
proof (induct rule: sigma_finite_measure_induct)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1814
  case (finite_measure N \<Omega>)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1815
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1816
  interpret finite_measure N by (rule finite_measure)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1817
  
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1818
  have integrable[measurable]: "integrable N f" using assms finite_measure by (auto simp: integrable_restrict_space integrable_mult_indicator)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1819
  have average: "(1 / Sigma_Algebra.measure N A) *\<^sub>R set_lebesgue_integral N A f \<in> S" if "A \<in> sets N" "measure N A > 0" for A
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1820
  proof -
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1821
    have *: "A \<in> sets M" using that by (simp add: sets_restrict_space_iff finite_measure)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1822
    have "A = A \<inter> \<Omega>" by (metis finite_measure(2,3) inf.orderE sets.sets_into_space space_restrict_space that(1))
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1823
    hence "set_lebesgue_integral N A f = set_lebesgue_integral M A f" unfolding finite_measure by (subst set_integral_restrict_space, auto simp add: finite_measure set_lebesgue_integral_def indicator_inter_arith[symmetric])
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1824
    moreover have "measure N A = measure M A" using that by (auto intro!: measure_restrict_space simp add: finite_measure sets_restrict_space_iff)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1825
    ultimately show ?thesis using that * assms(3) by presburger
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1826
  qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1827
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1828
  obtain D :: "'b set" where balls_basis: "topological_basis (case_prod ball ` (D \<times> (\<rat> \<inter> {0<..})))" and countable_D: "countable D" using balls_countable_basis by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1829
  have countable_balls: "countable (case_prod ball ` (D \<times> (\<rat> \<inter> {0<..})))" using countable_rat countable_D by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1830
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1831
  obtain B where B_balls: "B \<subseteq> case_prod ball ` (D \<times> (\<rat> \<inter> {0<..}))" "\<Union>B = -S" using topological_basis[THEN iffD1, OF balls_basis] open_Compl[OF assms(2)] by meson
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1832
  hence countable_B: "countable B" using countable_balls countable_subset by fast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1833
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1834
  define b where "b = from_nat_into (B \<union> {{}})"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1835
  have "B \<union> {{}} \<noteq> {}" by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1836
  have range_b: "range b = B \<union> {{}}" using countable_B by (auto simp add: b_def intro!: range_from_nat_into)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1837
  have open_b: "open (b i)" for i unfolding b_def using B_balls open_ball from_nat_into[of "B \<union> {{}}" i] by force
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1838
  have Union_range_b: "\<Union>(range b) = -S" using B_balls range_b by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1839
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1840
  {
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1841
    fix v r assume ball_in_Compl: "ball v r \<subseteq> -S"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1842
    define A where "A = f -` ball v r \<inter> space N"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1843
    have dist_less: "dist (f x) v < r" if "x \<in> A" for x using that unfolding A_def vimage_def by (simp add: dist_commute)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1844
    hence AE_less: "AE x \<in> A in N. norm (f x - v) < r" by (auto simp add: dist_norm)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1845
    have *: "A \<in> sets N" unfolding A_def by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1846
    have "emeasure N A = 0" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1847
    proof -
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1848
      {
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1849
        assume asm: "emeasure N A > 0"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1850
        hence measure_pos: "measure N A > 0" unfolding emeasure_eq_measure by simp
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1851
        hence "(1 / measure N A) *\<^sub>R set_lebesgue_integral N A f - v 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1852
             = (1 / measure N A) *\<^sub>R set_lebesgue_integral N A (\<lambda>x. f x - v)" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1853
          using integrable integrable_const * 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1854
          by (subst set_integral_diff(2), auto simp add: set_integrable_def set_integral_const[OF *] algebra_simps intro!: integrable_mult_indicator)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1855
        moreover have "norm (\<integral>x\<in>A. (f x - v)\<partial>N) \<le> (\<integral>x\<in>A. norm (f x - v)\<partial>N)" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1856
          using * by (auto intro!: integral_norm_bound[of N "\<lambda>x. indicator A x *\<^sub>R (f x - v)", THEN order_trans] integrable_mult_indicator integrable simp add: set_lebesgue_integral_def)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1857
        ultimately have "norm ((1 / measure N A) *\<^sub>R set_lebesgue_integral N A f - v) 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1858
                       \<le> set_lebesgue_integral N A (\<lambda>x. norm (f x - v)) / measure N A" using asm by (auto intro: divide_right_mono)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1859
        also have "\<dots> < set_lebesgue_integral N A (\<lambda>x. r) / measure N A" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1860
          unfolding set_lebesgue_integral_def 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1861
          using asm * integrable integrable_const AE_less measure_pos
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1862
          by (intro divide_strict_right_mono integral_less_AE[of _ _ A] integrable_mult_indicator)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1863
            (fastforce simp add: dist_less dist_norm indicator_def)+
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1864
        also have "\<dots> = r" using * measure_pos by (simp add: set_integral_const)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1865
        finally have "dist ((1 / measure N A) *\<^sub>R set_lebesgue_integral N A f) v < r" by (subst dist_norm)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1866
        hence "False" using average[OF * measure_pos] by (metis ComplD dist_commute in_mono mem_ball ball_in_Compl)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1867
      }
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1868
      thus ?thesis by fastforce
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1869
    qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1870
  }
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1871
  note * = this
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1872
  {
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1873
    fix b' assume "b' \<in> B"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1874
    hence ball_subset_Compl: "b' \<subseteq> -S" and ball_radius_pos: "\<exists>v \<in> D. \<exists>r>0. b' = ball v r" using B_balls by (blast, fast)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1875
  }
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1876
  note ** = this
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1877
  hence "emeasure N (f -` b i \<inter> space N) = 0" for i by (cases "b i = {}", simp) (metis UnE singletonD  * range_b[THEN eq_refl, THEN range_subsetD])
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1878
  hence "emeasure N (\<Union>i. f -` b i \<inter> space N) = 0" using open_b by (intro emeasure_UN_eq_0) fastforce+
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1879
  moreover have "(\<Union>i. f -` b i \<inter> space N) = f -` (\<Union>(range b)) \<inter> space N" by blast
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1880
  ultimately have "emeasure N (f -` (-S) \<inter> space N) = 0" using Union_range_b by argo
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1881
  hence "AE x in N. f x \<notin> -S" using open_Compl[OF assms(2)] by (intro AE_iff_measurable[THEN iffD2], auto)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1882
  thus ?case by force
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1883
qed (simp add: pred_sets2[OF borel_closed] assms(2))
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1884
  
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1885
lemma density_zero:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1886
  fixes f::"'a \<Rightarrow> 'b::{second_countable_topology, banach}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1887
  assumes "integrable M f"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1888
      and density_0: "\<And>A. A \<in> sets M \<Longrightarrow> set_lebesgue_integral M A f = 0"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1889
  shows "AE x in M. f x = 0"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1890
  using averaging_theorem[OF assms(1), of "{0}"] assms(2)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1891
  by (simp add: scaleR_nonneg_nonneg)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1892
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1893
text \<open>The following lemma shows that densities are unique in Banach spaces.\<close>
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1894
lemma density_unique_banach:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1895
  fixes f f'::"'a \<Rightarrow> 'b::{second_countable_topology, banach}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1896
  assumes "integrable M f" "integrable M f'"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1897
      and density_eq: "\<And>A. A \<in> sets M \<Longrightarrow> set_lebesgue_integral M A f = set_lebesgue_integral M A f'"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1898
  shows "AE x in M. f x = f' x"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1899
proof-
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1900
  { 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1901
    fix A assume asm: "A \<in> sets M"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1902
    hence "LINT x|M. indicat_real A x *\<^sub>R (f x - f' x) = 0" using density_eq assms(1,2) by (simp add: set_lebesgue_integral_def algebra_simps Bochner_Integration.integral_diff[OF integrable_mult_indicator(1,1)])
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1903
  }
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1904
  thus ?thesis using density_zero[OF Bochner_Integration.integrable_diff[OF assms(1,2)]] by (simp add: set_lebesgue_integral_def)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1905
qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1906
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1907
lemma density_nonneg:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1908
  fixes f::"_ \<Rightarrow> 'b::{second_countable_topology, banach, linorder_topology, ordered_real_vector}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1909
  assumes "integrable M f" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1910
      and "\<And>A. A \<in> sets M \<Longrightarrow> set_lebesgue_integral M A f \<ge> 0"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1911
    shows "AE x in M. f x \<ge> 0"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1912
  using averaging_theorem[OF assms(1), of "{0..}", OF closed_atLeast] assms(2)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1913
  by (simp add: scaleR_nonneg_nonneg)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1914
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1915
corollary integral_nonneg_eq_0_iff_AE_banach:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1916
  fixes f :: "'a \<Rightarrow> 'b :: {second_countable_topology, banach, linorder_topology, ordered_real_vector}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1917
  assumes f[measurable]: "integrable M f" and nonneg: "AE x in M. 0 \<le> f x"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1918
  shows "integral\<^sup>L M f = 0 \<longleftrightarrow> (AE x in M. f x = 0)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1919
proof 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1920
  assume *: "integral\<^sup>L M f = 0"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1921
  {
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1922
    fix A assume asm: "A \<in> sets M"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1923
    have "0 \<le> integral\<^sup>L M (\<lambda>x. indicator A x *\<^sub>R f x)" using nonneg by (subst integral_zero[of M, symmetric], intro integral_mono_AE_banach integrable_mult_indicator asm f integrable_zero, auto simp add: indicator_def)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1924
    moreover have "\<dots> \<le> integral\<^sup>L M f" using nonneg by (intro integral_mono_AE_banach integrable_mult_indicator asm f, auto simp add: indicator_def)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1925
    ultimately have "set_lebesgue_integral M A f = 0" unfolding set_lebesgue_integral_def using * by force
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1926
  }
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1927
  thus "AE x in M. f x = 0" by (intro density_zero f, blast)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1928
qed (auto simp add: integral_eq_zero_AE)
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1929
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1930
corollary integral_eq_mono_AE_eq_AE:
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1931
  fixes f g :: "'a \<Rightarrow> 'b :: {second_countable_topology, banach, linorder_topology, ordered_real_vector}"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1932
  assumes "integrable M f" "integrable M g" "integral\<^sup>L M f = integral\<^sup>L M g" "AE x in M. f x \<le> g x" 
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1933
  shows "AE x in M. f x = g x"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1934
proof -
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1935
  define h where "h = (\<lambda>x. g x - f x)"
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1936
  have "AE x in M. h x = 0" unfolding h_def using assms by (subst integral_nonneg_eq_0_iff_AE_banach[symmetric]) auto
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1937
  then show ?thesis unfolding h_def by auto
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1938
qed
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1939
59092
d469103c0737 add integral substitution theorems from Manuel Eberl, Jeremy Avigad, Luke Serafin, and Sudeep Kanav
hoelzl
parents:
diff changeset
  1940
end
79772
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1941
817d33f8aa7f Moving valuable library material from Martingales into the distribution
paulson <lp15@cam.ac.uk>
parents: 79630
diff changeset
  1942
end