src/HOL/Analysis/Nonnegative_Lebesgue_Integration.thy
author hoelzl
Fri, 30 Sep 2016 16:08:38 +0200
changeset 64008 17a20ca86d62
parent 63918 6bf55e6e0b75
child 64267 b9a1486e79be
permissions -rw-r--r--
HOL-Probability: more about probability, prepare for Markov processes in the AFP
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/Nonnegative_Lebesgue_Integration.thy
42067
66c8281349ec standardized headers
hoelzl
parents: 41981
diff changeset
     2
    Author:     Johannes Hölzl, TU München
66c8281349ec standardized headers
hoelzl
parents: 41981
diff changeset
     3
    Author:     Armin Heller, TU München
66c8281349ec standardized headers
hoelzl
parents: 41981
diff changeset
     4
*)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
     5
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
     6
section \<open>Lebesgue Integration for Nonnegative Functions\<close>
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
     7
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
     8
theory Nonnegative_Lebesgue_Integration
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
     9
  imports Measure_Space Borel_Space
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
    10
begin
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
    11
56994
8d5e5ec1cac3 fixed document generation for HOL-Probability
hoelzl
parents: 56993
diff changeset
    12
subsection "Simple function"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
    13
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
    14
text \<open>
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    15
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
    16
Our simple functions are not restricted to nonnegative real numbers. Instead
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    17
they are just functions with a finite range and are measurable when singleton
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    18
sets are measurable.
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
    19
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
    20
\<close>
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    21
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
    22
definition "simple_function M g \<longleftrightarrow>
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    23
    finite (g ` space M) \<and>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    24
    (\<forall>x \<in> g ` space M. g -` {x} \<inter> space M \<in> sets M)"
36624
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
    25
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
    26
lemma simple_functionD:
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
    27
  assumes "simple_function M g"
40875
9a9d33f6fb46 generalized simple_functionD
hoelzl
parents: 40873
diff changeset
    28
  shows "finite (g ` space M)" and "g -` X \<inter> space M \<in> sets M"
40871
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
    29
proof -
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
    30
  show "finite (g ` space M)"
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
    31
    using assms unfolding simple_function_def by auto
40875
9a9d33f6fb46 generalized simple_functionD
hoelzl
parents: 40873
diff changeset
    32
  have "g -` X \<inter> space M = g -` (X \<inter> g`space M) \<inter> space M" by auto
9a9d33f6fb46 generalized simple_functionD
hoelzl
parents: 40873
diff changeset
    33
  also have "\<dots> = (\<Union>x\<in>X \<inter> g`space M. g-`{x} \<inter> space M)" by auto
9a9d33f6fb46 generalized simple_functionD
hoelzl
parents: 40873
diff changeset
    34
  finally show "g -` X \<inter> space M \<in> sets M" using assms
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 50001
diff changeset
    35
    by (auto simp del: UN_simps simp: simple_function_def)
40871
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
    36
qed
36624
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
    37
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
    38
lemma measurable_simple_function[measurable_dest]:
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
    39
  "simple_function M f \<Longrightarrow> f \<in> measurable M (count_space UNIV)"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
    40
  unfolding simple_function_def measurable_def
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
    41
proof safe
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
    42
  fix A assume "finite (f ` space M)" "\<forall>x\<in>f ` space M. f -` {x} \<inter> space M \<in> sets M"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
    43
  then have "(\<Union>x\<in>f ` space M. if x \<in> A then f -` {x} \<inter> space M else {}) \<in> sets M"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
    44
    by (intro sets.finite_UN) auto
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
    45
  also have "(\<Union>x\<in>f ` space M. if x \<in> A then f -` {x} \<inter> space M else {}) = f -` A \<inter> space M"
62390
842917225d56 more canonical names
nipkow
parents: 62343
diff changeset
    46
    by (auto split: if_split_asm)
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
    47
  finally show "f -` A \<inter> space M \<in> sets M" .
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
    48
qed simp
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
    49
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
    50
lemma borel_measurable_simple_function:
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
    51
  "simple_function M f \<Longrightarrow> f \<in> borel_measurable M"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
    52
  by (auto dest!: measurable_simple_function simp: measurable_def)
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
    53
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
    54
lemma simple_function_measurable2[intro]:
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
    55
  assumes "simple_function M f" "simple_function M g"
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
    56
  shows "f -` A \<inter> g -` B \<inter> space M \<in> sets M"
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
    57
proof -
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
    58
  have "f -` A \<inter> g -` B \<inter> space M = (f -` A \<inter> space M) \<inter> (g -` B \<inter> space M)"
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
    59
    by auto
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
    60
  then show ?thesis using assms[THEN simple_functionD(2)] by auto
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
    61
qed
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
    62
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
    63
lemma simple_function_indicator_representation:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
    64
  fixes f ::"'a \<Rightarrow> ennreal"
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
    65
  assumes f: "simple_function M f" and x: "x \<in> space M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    66
  shows "f x = (\<Sum>y \<in> f ` space M. y * indicator (f -` {y} \<inter> space M) x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    67
  (is "?l = ?r")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    68
proof -
38705
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
    69
  have "?r = (\<Sum>y \<in> f ` space M.
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    70
    (if y = f x then y * indicator (f -` {y} \<inter> space M) x else 0))"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57275
diff changeset
    71
    by (auto intro!: setsum.cong)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    72
  also have "... =  f x *  indicator (f -` {f x} \<inter> space M) x"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57275
diff changeset
    73
    using assms by (auto dest: simple_functionD simp: setsum.delta)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    74
  also have "... = f x" using x by (auto simp: indicator_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    75
  finally show ?thesis by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    76
qed
36624
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
    77
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
    78
lemma simple_function_notspace:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
    79
  "simple_function M (\<lambda>x. h x * indicator (- space M) x::ennreal)" (is "simple_function M ?h")
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
    80
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    81
  have "?h ` space M \<subseteq> {0}" unfolding indicator_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    82
  hence [simp, intro]: "finite (?h ` space M)" by (auto intro: finite_subset)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    83
  have "?h -` {0} \<inter> space M = space M" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    84
  thus ?thesis unfolding simple_function_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    85
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    86
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
    87
lemma simple_function_cong:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    88
  assumes "\<And>t. t \<in> space M \<Longrightarrow> f t = g t"
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
    89
  shows "simple_function M f \<longleftrightarrow> simple_function M g"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    90
proof -
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
    91
  have "\<And>x. f -` {x} \<inter> space M = g -` {x} \<inter> space M"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
    92
    using assms by auto
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
    93
  with assms show ?thesis
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
    94
    by (simp add: simple_function_def cong: image_cong)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    95
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    96
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
    97
lemma simple_function_cong_algebra:
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
    98
  assumes "sets N = sets M" "space N = space M"
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
    99
  shows "simple_function M f \<longleftrightarrow> simple_function N f"
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   100
  unfolding simple_function_def assms ..
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   101
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   102
lemma simple_function_borel_measurable:
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   103
  fixes f :: "'a \<Rightarrow> 'x::{t2_space}"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   104
  assumes "f \<in> borel_measurable M" and "finite (f ` space M)"
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   105
  shows "simple_function M f"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   106
  using assms unfolding simple_function_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   107
  by (auto intro: borel_measurable_vimage)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   108
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   109
lemma simple_function_iff_borel_measurable:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   110
  fixes f :: "'a \<Rightarrow> 'x::{t2_space}"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   111
  shows "simple_function M f \<longleftrightarrow> finite (f ` space M) \<and> f \<in> borel_measurable M"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   112
  by (metis borel_measurable_simple_function simple_functionD(1) simple_function_borel_measurable)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   113
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   114
lemma simple_function_eq_measurable:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   115
  "simple_function M f \<longleftrightarrow> finite (f`space M) \<and> f \<in> measurable M (count_space UNIV)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   116
  using measurable_simple_function[of M f] by (fastforce simp: simple_function_def)
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   117
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   118
lemma simple_function_const[intro, simp]:
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   119
  "simple_function M (\<lambda>x. c)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   120
  by (auto intro: finite_subset simp: simple_function_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   121
lemma simple_function_compose[intro, simp]:
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   122
  assumes "simple_function M f"
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   123
  shows "simple_function M (g \<circ> f)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   124
  unfolding simple_function_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   125
proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   126
  show "finite ((g \<circ> f) ` space M)"
56154
f0a927235162 more complete set of lemmas wrt. image and composition
haftmann
parents: 54611
diff changeset
   127
    using assms unfolding simple_function_def by (auto simp: image_comp [symmetric])
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   128
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   129
  fix x assume "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   130
  let ?G = "g -` {g (f x)} \<inter> (f`space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   131
  have *: "(g \<circ> f) -` {(g \<circ> f) x} \<inter> space M =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   132
    (\<Union>x\<in>?G. f -` {x} \<inter> space M)" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   133
  show "(g \<circ> f) -` {(g \<circ> f) x} \<inter> space M \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   134
    using assms unfolding simple_function_def *
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   135
    by (rule_tac sets.finite_UN) auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   136
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   137
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   138
lemma simple_function_indicator[intro, simp]:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   139
  assumes "A \<in> sets M"
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   140
  shows "simple_function M (indicator A)"
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   141
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   142
  have "indicator A ` space M \<subseteq> {0, 1}" (is "?S \<subseteq> _")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   143
    by (auto simp: indicator_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   144
  hence "finite ?S" by (rule finite_subset) simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   145
  moreover have "- A \<inter> space M = space M - A" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   146
  ultimately show ?thesis unfolding simple_function_def
46905
6b1c0a80a57a prefer abs_def over def_raw;
wenzelm
parents: 46884
diff changeset
   147
    using assms by (auto simp: indicator_def [abs_def])
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   148
qed
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   149
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   150
lemma simple_function_Pair[intro, simp]:
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   151
  assumes "simple_function M f"
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   152
  assumes "simple_function M g"
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   153
  shows "simple_function M (\<lambda>x. (f x, g x))" (is "simple_function M ?p")
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   154
  unfolding simple_function_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   155
proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   156
  show "finite (?p ` space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   157
    using assms unfolding simple_function_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   158
    by (rule_tac finite_subset[of _ "f`space M \<times> g`space M"]) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   159
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   160
  fix x assume "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   161
  have "(\<lambda>x. (f x, g x)) -` {(f x, g x)} \<inter> space M =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   162
      (f -` {f x} \<inter> space M) \<inter> (g -` {g x} \<inter> space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   163
    by auto
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   164
  with \<open>x \<in> space M\<close> show "(\<lambda>x. (f x, g x)) -` {(f x, g x)} \<inter> space M \<in> sets M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   165
    using assms unfolding simple_function_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   166
qed
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   167
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   168
lemma simple_function_compose1:
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   169
  assumes "simple_function M f"
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   170
  shows "simple_function M (\<lambda>x. g (f x))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   171
  using simple_function_compose[OF assms, of g]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   172
  by (simp add: comp_def)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   173
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   174
lemma simple_function_compose2:
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   175
  assumes "simple_function M f" and "simple_function M g"
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   176
  shows "simple_function M (\<lambda>x. h (f x) (g x))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   177
proof -
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   178
  have "simple_function M ((\<lambda>(x, y). h x y) \<circ> (\<lambda>x. (f x, g x)))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   179
    using assms by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   180
  thus ?thesis by (simp_all add: comp_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   181
qed
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   182
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   183
lemmas simple_function_add[intro, simp] = simple_function_compose2[where h="op +"]
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   184
  and simple_function_diff[intro, simp] = simple_function_compose2[where h="op -"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   185
  and simple_function_uminus[intro, simp] = simple_function_compose[where g="uminus"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   186
  and simple_function_mult[intro, simp] = simple_function_compose2[where h="op *"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   187
  and simple_function_div[intro, simp] = simple_function_compose2[where h="op /"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   188
  and simple_function_inverse[intro, simp] = simple_function_compose[where g="inverse"]
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   189
  and simple_function_max[intro, simp] = simple_function_compose2[where h=max]
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   190
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   191
lemma simple_function_setsum[intro, simp]:
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   192
  assumes "\<And>i. i \<in> P \<Longrightarrow> simple_function M (f i)"
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   193
  shows "simple_function M (\<lambda>x. \<Sum>i\<in>P. f i x)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   194
proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   195
  assume "finite P" from this assms show ?thesis by induct auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   196
qed auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   197
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   198
lemma simple_function_ennreal[intro, simp]:
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   199
  fixes f g :: "'a \<Rightarrow> real" assumes sf: "simple_function M f"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   200
  shows "simple_function M (\<lambda>x. ennreal (f x))"
59587
8ea7b22525cb Removed the obsolete functions "natfloor" and "natceiling"
nipkow
parents: 59452
diff changeset
   201
  by (rule simple_function_compose1[OF sf])
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   202
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
   203
lemma simple_function_real_of_nat[intro, simp]:
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   204
  fixes f g :: "'a \<Rightarrow> nat" assumes sf: "simple_function M f"
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   205
  shows "simple_function M (\<lambda>x. real (f x))"
59587
8ea7b22525cb Removed the obsolete functions "natfloor" and "natceiling"
nipkow
parents: 59452
diff changeset
   206
  by (rule simple_function_compose1[OF sf])
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   207
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   208
lemma borel_measurable_implies_simple_function_sequence:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   209
  fixes u :: "'a \<Rightarrow> ennreal"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   210
  assumes u[measurable]: "u \<in> borel_measurable M"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   211
  shows "\<exists>f. incseq f \<and> (\<forall>i. (\<forall>x. f i x < top) \<and> simple_function M (f i)) \<and> u = (SUP i. f i)"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   212
proof -
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62975
diff changeset
   213
  define f where [abs_def]:
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62975
diff changeset
   214
    "f i x = real_of_int (floor (enn2real (min i (u x)) * 2^i)) / 2^i" for i x
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   215
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   216
  have [simp]: "0 \<le> f i x" for i x
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   217
    by (auto simp: f_def intro!: divide_nonneg_nonneg mult_nonneg_nonneg enn2real_nonneg)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   218
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   219
  have *: "2^n * real_of_int x = real_of_int (2^n * x)" for n x
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   220
    by simp
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   221
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   222
  have "real_of_int \<lfloor>real i * 2 ^ i\<rfloor> = real_of_int \<lfloor>i * 2 ^ i\<rfloor>" for i
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   223
    by (intro arg_cong[where f=real_of_int]) simp
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   224
  then have [simp]: "real_of_int \<lfloor>real i * 2 ^ i\<rfloor> = i * 2 ^ i" for i
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   225
    unfolding floor_of_nat by simp
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   226
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   227
  have "incseq f"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   228
  proof (intro monoI le_funI)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   229
    fix m n :: nat and x assume "m \<le> n"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   230
    moreover
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   231
    { fix d :: nat
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   232
      have "\<lfloor>2^d::real\<rfloor> * \<lfloor>2^m * enn2real (min (of_nat m) (u x))\<rfloor> \<le>
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   233
        \<lfloor>2^d * (2^m * enn2real (min (of_nat m) (u x)))\<rfloor>"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   234
        by (rule le_mult_floor) (auto simp: enn2real_nonneg)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   235
      also have "\<dots> \<le> \<lfloor>2^d * (2^m * enn2real (min (of_nat d + of_nat m) (u x)))\<rfloor>"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   236
        by (intro floor_mono mult_mono enn2real_mono min.mono)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   237
           (auto simp: enn2real_nonneg min_less_iff_disj of_nat_less_top)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   238
      finally have "f m x \<le> f (m + d) x"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   239
        unfolding f_def
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   240
        by (auto simp: field_simps power_add * simp del: of_int_mult) }
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   241
    ultimately show "f m x \<le> f n x"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   242
      by (auto simp add: le_iff_add)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   243
  qed
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   244
  then have inc_f: "incseq (\<lambda>i. ennreal (f i x))" for x
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   245
    by (auto simp: incseq_def le_fun_def)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   246
  then have "incseq (\<lambda>i x. ennreal (f i x))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   247
    by (auto simp: incseq_def le_fun_def)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   248
  moreover
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   249
  have "simple_function M (f i)" for i
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   250
  proof (rule simple_function_borel_measurable)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   251
    have "\<lfloor>enn2real (min (of_nat i) (u x)) * 2 ^ i\<rfloor> \<le> \<lfloor>int i * 2 ^ i\<rfloor>" for x
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   252
      by (cases "u x" rule: ennreal_cases)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   253
         (auto split: split_min intro!: floor_mono)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   254
    then have "f i ` space M \<subseteq> (\<lambda>n. real_of_int n / 2^i) ` {0 .. of_nat i * 2^i}"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   255
      unfolding floor_of_int by (auto simp: f_def enn2real_nonneg intro!: imageI)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   256
    then show "finite (f i ` space M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   257
      by (rule finite_subset) auto
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   258
    show "f i \<in> borel_measurable M"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   259
      unfolding f_def enn2real_def by measurable
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   260
  qed
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   261
  moreover
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   262
  { fix x
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   263
    have "(SUP i. ennreal (f i x)) = u x"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   264
    proof (cases "u x" rule: ennreal_cases)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   265
      case top then show ?thesis
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   266
        by (simp add: f_def inf_min[symmetric] ennreal_of_nat_eq_real_of_nat[symmetric]
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   267
                      ennreal_SUP_of_nat_eq_top)
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   268
    next
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   269
      case (real r)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   270
      obtain n where "r \<le> of_nat n" using real_arch_simple by auto
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   271
      then have min_eq_r: "\<forall>\<^sub>F x in sequentially. min (real x) r = r"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   272
        by (auto simp: eventually_sequentially intro!: exI[of _ n] split: split_min)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   273
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   274
      have "(\<lambda>i. real_of_int \<lfloor>min (real i) r * 2^i\<rfloor> / 2^i) \<longlonglongrightarrow> r"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   275
      proof (rule tendsto_sandwich)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   276
        show "(\<lambda>n. r - (1/2)^n) \<longlonglongrightarrow> r"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   277
          by (auto intro!: tendsto_eq_intros LIMSEQ_power_zero)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   278
        show "\<forall>\<^sub>F n in sequentially. real_of_int \<lfloor>min (real n) r * 2 ^ n\<rfloor> / 2 ^ n \<le> r"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   279
          using min_eq_r by eventually_elim (auto simp: field_simps)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   280
        have *: "r * (2 ^ n * 2 ^ n) \<le> 2^n + 2^n * real_of_int \<lfloor>r * 2 ^ n\<rfloor>" for n
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   281
          using real_of_int_floor_ge_diff_one[of "r * 2^n", THEN mult_left_mono, of "2^n"]
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   282
          by (auto simp: field_simps)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   283
        show "\<forall>\<^sub>F n in sequentially. r - (1/2)^n \<le> real_of_int \<lfloor>min (real n) r * 2 ^ n\<rfloor> / 2 ^ n"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   284
          using min_eq_r by eventually_elim (insert *, auto simp: field_simps)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   285
      qed auto
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   286
      then have "(\<lambda>i. ennreal (f i x)) \<longlonglongrightarrow> ennreal r"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   287
        by (simp add: real f_def ennreal_of_nat_eq_real_of_nat min_ennreal)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   288
      from LIMSEQ_unique[OF LIMSEQ_SUP[OF inc_f] this]
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   289
      show ?thesis
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   290
        by (simp add: real)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   291
    qed }
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   292
  ultimately show ?thesis
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   293
    by (intro exI[of _ "\<lambda>i x. ennreal (f i x)"]) auto
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   294
qed
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   295
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   296
lemma borel_measurable_implies_simple_function_sequence':
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   297
  fixes u :: "'a \<Rightarrow> ennreal"
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   298
  assumes u: "u \<in> borel_measurable M"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   299
  obtains f where
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   300
    "\<And>i. simple_function M (f i)" "incseq f" "\<And>i x. f i x < top" "\<And>x. (SUP i. f i x) = u x"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   301
  using borel_measurable_implies_simple_function_sequence[OF u] by (auto simp: fun_eq_iff) blast
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   302
49796
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   303
lemma simple_function_induct[consumes 1, case_names cong set mult add, induct set: simple_function]:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   304
  fixes u :: "'a \<Rightarrow> ennreal"
49796
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   305
  assumes u: "simple_function M u"
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   306
  assumes cong: "\<And>f g. simple_function M f \<Longrightarrow> simple_function M g \<Longrightarrow> (AE x in M. f x = g x) \<Longrightarrow> P f \<Longrightarrow> P g"
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   307
  assumes set: "\<And>A. A \<in> sets M \<Longrightarrow> P (indicator A)"
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   308
  assumes mult: "\<And>u c. P u \<Longrightarrow> P (\<lambda>x. c * u x)"
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   309
  assumes add: "\<And>u v. P u \<Longrightarrow> P v \<Longrightarrow> P (\<lambda>x. v x + u x)"
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   310
  shows "P u"
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   311
proof (rule cong)
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   312
  from AE_space show "AE x in M. (\<Sum>y\<in>u ` space M. y * indicator (u -` {y} \<inter> space M) x) = u x"
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   313
  proof eventually_elim
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   314
    fix x assume x: "x \<in> space M"
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   315
    from simple_function_indicator_representation[OF u x]
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   316
    show "(\<Sum>y\<in>u ` space M. y * indicator (u -` {y} \<inter> space M) x) = u x" ..
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   317
  qed
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   318
next
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   319
  from u have "finite (u ` space M)"
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   320
    unfolding simple_function_def by auto
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   321
  then show "P (\<lambda>x. \<Sum>y\<in>u ` space M. y * indicator (u -` {y} \<inter> space M) x)"
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   322
  proof induct
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   323
    case empty show ?case
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   324
      using set[of "{}"] by (simp add: indicator_def[abs_def])
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   325
  qed (auto intro!: add mult set simple_functionD u)
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   326
next
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   327
  show "simple_function M (\<lambda>x. (\<Sum>y\<in>u ` space M. y * indicator (u -` {y} \<inter> space M) x))"
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   328
    apply (subst simple_function_cong)
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   329
    apply (rule simple_function_indicator_representation[symmetric])
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   330
    apply (auto intro: u)
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   331
    done
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   332
qed fact
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   333
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   334
lemma simple_function_induct_nn[consumes 1, case_names cong set mult add]:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   335
  fixes u :: "'a \<Rightarrow> ennreal"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   336
  assumes u: "simple_function M u"
49799
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
   337
  assumes cong: "\<And>f g. simple_function M f \<Longrightarrow> simple_function M g \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> f x = g x) \<Longrightarrow> P f \<Longrightarrow> P g"
49796
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   338
  assumes set: "\<And>A. A \<in> sets M \<Longrightarrow> P (indicator A)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   339
  assumes mult: "\<And>u c. simple_function M u \<Longrightarrow> P u \<Longrightarrow> P (\<lambda>x. c * u x)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   340
  assumes add: "\<And>u v. simple_function M u \<Longrightarrow> P u \<Longrightarrow> simple_function M v \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> u x = 0 \<or> v x = 0) \<Longrightarrow> P v \<Longrightarrow> P (\<lambda>x. v x + u x)"
49796
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   341
  shows "P u"
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   342
proof -
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   343
  show ?thesis
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   344
  proof (rule cong)
49799
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
   345
    fix x assume x: "x \<in> space M"
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
   346
    from simple_function_indicator_representation[OF u x]
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
   347
    show "(\<Sum>y\<in>u ` space M. y * indicator (u -` {y} \<inter> space M) x) = u x" ..
49796
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   348
  next
49799
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
   349
    show "simple_function M (\<lambda>x. (\<Sum>y\<in>u ` space M. y * indicator (u -` {y} \<inter> space M) x))"
49796
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   350
      apply (subst simple_function_cong)
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   351
      apply (rule simple_function_indicator_representation[symmetric])
49799
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
   352
      apply (auto intro: u)
49796
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   353
      done
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   354
  next
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   355
    from u have "finite (u ` space M)"
49796
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   356
      unfolding simple_function_def by auto
49799
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
   357
    then show "P (\<lambda>x. \<Sum>y\<in>u ` space M. y * indicator (u -` {y} \<inter> space M) x)"
49796
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   358
    proof induct
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   359
      case empty show ?case
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   360
        using set[of "{}"] by (simp add: indicator_def[abs_def])
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   361
    next
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   362
      case (insert x S)
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   363
      { fix z have "(\<Sum>y\<in>S. y * indicator (u -` {y} \<inter> space M) z) = 0 \<or>
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   364
          x * indicator (u -` {x} \<inter> space M) z = 0"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   365
          using insert by (subst setsum_eq_0_iff) (auto simp: indicator_def) }
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   366
      note disj = this
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   367
      from insert show ?case
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   368
        by (auto intro!: add mult set simple_functionD u simple_function_setsum disj)
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   369
    qed
49796
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   370
  qed fact
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   371
qed
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   372
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   373
lemma borel_measurable_induct[consumes 1, case_names cong set mult add seq, induct set: borel_measurable]:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   374
  fixes u :: "'a \<Rightarrow> ennreal"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   375
  assumes u: "u \<in> borel_measurable M"
49799
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
   376
  assumes cong: "\<And>f g. f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> f x = g x) \<Longrightarrow> P g \<Longrightarrow> P f"
49796
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   377
  assumes set: "\<And>A. A \<in> sets M \<Longrightarrow> P (indicator A)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   378
  assumes mult': "\<And>u c. c < top \<Longrightarrow> u \<in> borel_measurable M \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> u x < top) \<Longrightarrow> P u \<Longrightarrow> P (\<lambda>x. c * u x)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   379
  assumes add: "\<And>u v. u \<in> borel_measurable M\<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> u x < top) \<Longrightarrow> P u \<Longrightarrow> v \<in> borel_measurable M \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> v x < top) \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> u x = 0 \<or> v x = 0) \<Longrightarrow> P v \<Longrightarrow> P (\<lambda>x. v x + u x)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   380
  assumes seq: "\<And>U. (\<And>i. U i \<in> borel_measurable M) \<Longrightarrow> (\<And>i x. x \<in> space M \<Longrightarrow> U i x < top) \<Longrightarrow> (\<And>i. P (U i)) \<Longrightarrow> incseq U \<Longrightarrow> u = (SUP i. U i) \<Longrightarrow> P (SUP i. U i)"
49796
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   381
  shows "P u"
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   382
  using u
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   383
proof (induct rule: borel_measurable_implies_simple_function_sequence')
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   384
  fix U assume U: "\<And>i. simple_function M (U i)" "incseq U" "\<And>i x. U i x < top" and sup: "\<And>x. (SUP i. U i x) = u x"
49799
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
   385
  have u_eq: "u = (SUP i. U i)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   386
    using u sup by auto
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   387
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   388
  have not_inf: "\<And>x i. x \<in> space M \<Longrightarrow> U i x < top"
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   389
    using U by (auto simp: image_iff eq_commute)
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
   390
49797
28066863284c add induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49796
diff changeset
   391
  from U have "\<And>i. U i \<in> borel_measurable M"
28066863284c add induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49796
diff changeset
   392
    by (simp add: borel_measurable_simple_function)
28066863284c add induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49796
diff changeset
   393
49799
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
   394
  show "P u"
49796
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   395
    unfolding u_eq
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   396
  proof (rule seq)
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   397
    fix i show "P (U i)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   398
      using \<open>simple_function M (U i)\<close> not_inf[of _ i]
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   399
    proof (induct rule: simple_function_induct_nn)
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   400
      case (mult u c)
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   401
      show ?case
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   402
      proof cases
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   403
        assume "c = 0 \<or> space M = {} \<or> (\<forall>x\<in>space M. u x = 0)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   404
        with mult(1) show ?thesis
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   405
          by (intro cong[of "\<lambda>x. c * u x" "indicator {}"] set)
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   406
             (auto dest!: borel_measurable_simple_function)
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   407
      next
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   408
        assume "\<not> (c = 0 \<or> space M = {} \<or> (\<forall>x\<in>space M. u x = 0))"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   409
        then obtain x where "space M \<noteq> {}" and x: "x \<in> space M" "u x \<noteq> 0" "c \<noteq> 0"
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   410
          by auto
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   411
        with mult(3)[of x] have "c < top"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   412
          by (auto simp: ennreal_mult_less_top)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   413
        then have u_fin: "x' \<in> space M \<Longrightarrow> u x' < top" for x'
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   414
          using mult(3)[of x'] \<open>c \<noteq> 0\<close> by (auto simp: ennreal_mult_less_top)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   415
        then have "P u"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   416
          by (rule mult)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   417
        with u_fin \<open>c < top\<close> mult(1) show ?thesis
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   418
          by (intro mult') (auto dest!: borel_measurable_simple_function)
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   419
      qed
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   420
    qed (auto intro: cong intro!: set add dest!: borel_measurable_simple_function)
49797
28066863284c add induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49796
diff changeset
   421
  qed fact+
49796
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   422
qed
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   423
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   424
lemma simple_function_If_set:
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   425
  assumes sf: "simple_function M f" "simple_function M g" and A: "A \<inter> space M \<in> sets M"
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   426
  shows "simple_function M (\<lambda>x. if x \<in> A then f x else g x)" (is "simple_function M ?IF")
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   427
proof -
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62975
diff changeset
   428
  define F where "F x = f -` {x} \<inter> space M" for x
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62975
diff changeset
   429
  define G where "G x = g -` {x} \<inter> space M" for x
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   430
  show ?thesis unfolding simple_function_def
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   431
  proof safe
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   432
    have "?IF ` space M \<subseteq> f ` space M \<union> g ` space M" by auto
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   433
    from finite_subset[OF this] assms
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   434
    show "finite (?IF ` space M)" unfolding simple_function_def by auto
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   435
  next
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   436
    fix x assume "x \<in> space M"
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   437
    then have *: "?IF -` {?IF x} \<inter> space M = (if x \<in> A
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   438
      then ((F (f x) \<inter> (A \<inter> space M)) \<union> (G (f x) - (G (f x) \<inter> (A \<inter> space M))))
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   439
      else ((F (g x) \<inter> (A \<inter> space M)) \<union> (G (g x) - (G (g x) \<inter> (A \<inter> space M)))))"
62390
842917225d56 more canonical names
nipkow
parents: 62343
diff changeset
   440
      using sets.sets_into_space[OF A] by (auto split: if_split_asm simp: G_def F_def)
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   441
    have [intro]: "\<And>x. F x \<in> sets M" "\<And>x. G x \<in> sets M"
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   442
      unfolding F_def G_def using sf[THEN simple_functionD(2)] by auto
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   443
    show "?IF -` {?IF x} \<inter> space M \<in> sets M" unfolding * using A by auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   444
  qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   445
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   446
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   447
lemma simple_function_If:
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   448
  assumes sf: "simple_function M f" "simple_function M g" and P: "{x\<in>space M. P x} \<in> sets M"
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   449
  shows "simple_function M (\<lambda>x. if P x then f x else g x)"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   450
proof -
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   451
  have "{x\<in>space M. P x} = {x. P x} \<inter> space M" by auto
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   452
  with simple_function_If_set[OF sf, of "{x. P x}"] P show ?thesis by simp
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   453
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   454
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   455
lemma simple_function_subalgebra:
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   456
  assumes "simple_function N f"
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   457
  and N_subalgebra: "sets N \<subseteq> sets M" "space N = space M"
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   458
  shows "simple_function M f"
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   459
  using assms unfolding simple_function_def by auto
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   460
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   461
lemma simple_function_comp:
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   462
  assumes T: "T \<in> measurable M M'"
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   463
    and f: "simple_function M' f"
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   464
  shows "simple_function M (\<lambda>x. f (T x))"
41661
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   465
proof (intro simple_function_def[THEN iffD2] conjI ballI)
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   466
  have "(\<lambda>x. f (T x)) ` space M \<subseteq> f ` space M'"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   467
    using T unfolding measurable_def by auto
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   468
  then show "finite ((\<lambda>x. f (T x)) ` space M)"
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   469
    using f unfolding simple_function_def by (auto intro: finite_subset)
41661
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   470
  fix i assume i: "i \<in> (\<lambda>x. f (T x)) ` space M"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   471
  then have "i \<in> f ` space M'"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   472
    using T unfolding measurable_def by auto
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   473
  then have "f -` {i} \<inter> space M' \<in> sets M'"
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   474
    using f unfolding simple_function_def by auto
41661
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   475
  then have "T -` (f -` {i} \<inter> space M') \<inter> space M \<in> sets M"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   476
    using T unfolding measurable_def by auto
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   477
  also have "T -` (f -` {i} \<inter> space M') \<inter> space M = (\<lambda>x. f (T x)) -` {i} \<inter> space M"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   478
    using T unfolding measurable_def by auto
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   479
  finally show "(\<lambda>x. f (T x)) -` {i} \<inter> space M \<in> sets M" .
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   480
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   481
56994
8d5e5ec1cac3 fixed document generation for HOL-Probability
hoelzl
parents: 56993
diff changeset
   482
subsection "Simple integral"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   483
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   484
definition simple_integral :: "'a measure \<Rightarrow> ('a \<Rightarrow> ennreal) \<Rightarrow> ennreal" ("integral\<^sup>S") where
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   485
  "integral\<^sup>S M f = (\<Sum>x \<in> f ` space M. x * emeasure M (f -` {x} \<inter> space M))"
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   486
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   487
syntax
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   488
  "_simple_integral" :: "pttrn \<Rightarrow> ennreal \<Rightarrow> 'a measure \<Rightarrow> ennreal" ("\<integral>\<^sup>S _. _ \<partial>_" [60,61] 110)
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   489
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   490
translations
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   491
  "\<integral>\<^sup>S x. f \<partial>M" == "CONST simple_integral M (%x. f)"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   492
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   493
lemma simple_integral_cong:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   494
  assumes "\<And>t. t \<in> space M \<Longrightarrow> f t = g t"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   495
  shows "integral\<^sup>S M f = integral\<^sup>S M g"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   496
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   497
  have "f ` space M = g ` space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   498
    "\<And>x. f -` {x} \<inter> space M = g -` {x} \<inter> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   499
    using assms by (auto intro!: image_eqI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   500
  thus ?thesis unfolding simple_integral_def by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   501
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   502
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   503
lemma simple_integral_const[simp]:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   504
  "(\<integral>\<^sup>Sx. c \<partial>M) = c * (emeasure M) (space M)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   505
proof (cases "space M = {}")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   506
  case True thus ?thesis unfolding simple_integral_def by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   507
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   508
  case False hence "(\<lambda>x. c) ` space M = {c}" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   509
  thus ?thesis unfolding simple_integral_def by simp
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   510
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   511
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   512
lemma simple_function_partition:
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   513
  assumes f: "simple_function M f" and g: "simple_function M g"
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   514
  assumes sub: "\<And>x y. x \<in> space M \<Longrightarrow> y \<in> space M \<Longrightarrow> g x = g y \<Longrightarrow> f x = f y"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   515
  assumes v: "\<And>x. x \<in> space M \<Longrightarrow> f x = v (g x)"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   516
  shows "integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x\<in>space M. g x = y})"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   517
    (is "_ = ?r")
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   518
proof -
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   519
  from f g have [simp]: "finite (f`space M)" "finite (g`space M)"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   520
    by (auto simp: simple_function_def)
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   521
  from f g have [measurable]: "f \<in> measurable M (count_space UNIV)" "g \<in> measurable M (count_space UNIV)"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   522
    by (auto intro: measurable_simple_function)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   523
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   524
  { fix y assume "y \<in> space M"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   525
    then have "f ` space M \<inter> {i. \<exists>x\<in>space M. i = f x \<and> g y = g x} = {v (g y)}"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   526
      by (auto cong: sub simp: v[symmetric]) }
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   527
  note eq = this
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   528
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   529
  have "integral\<^sup>S M f =
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
   530
    (\<Sum>y\<in>f`space M. y * (\<Sum>z\<in>g`space M.
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   531
      if \<exists>x\<in>space M. y = f x \<and> z = g x then emeasure M {x\<in>space M. g x = z} else 0))"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   532
    unfolding simple_integral_def
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   533
  proof (safe intro!: setsum.cong ennreal_mult_left_cong)
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   534
    fix y assume y: "y \<in> space M" "f y \<noteq> 0"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
   535
    have [simp]: "g ` space M \<inter> {z. \<exists>x\<in>space M. f y = f x \<and> z = g x} =
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   536
        {z. \<exists>x\<in>space M. f y = f x \<and> z = g x}"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   537
      by auto
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   538
    have eq:"(\<Union>i\<in>{z. \<exists>x\<in>space M. f y = f x \<and> z = g x}. {x \<in> space M. g x = i}) =
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   539
        f -` {f y} \<inter> space M"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   540
      by (auto simp: eq_commute cong: sub rev_conj_cong)
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   541
    have "finite (g`space M)" by simp
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   542
    then have "finite {z. \<exists>x\<in>space M. f y = f x \<and> z = g x}"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   543
      by (rule rev_finite_subset) auto
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   544
    then show "emeasure M (f -` {f y} \<inter> space M) =
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   545
      (\<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. f y = f x \<and> z = g x then emeasure M {x \<in> space M. g x = z} else 0)"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57275
diff changeset
   546
      apply (simp add: setsum.If_cases)
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   547
      apply (subst setsum_emeasure)
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   548
      apply (auto simp: disjoint_family_on_def eq)
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   549
      done
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   550
  qed
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
   551
  also have "\<dots> = (\<Sum>y\<in>f`space M. (\<Sum>z\<in>g`space M.
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   552
      if \<exists>x\<in>space M. y = f x \<and> z = g x then y * emeasure M {x\<in>space M. g x = z} else 0))"
63918
6bf55e6e0b75 left_distrib ~> distrib_right, right_distrib ~> distrib_left
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents: 63627
diff changeset
   553
    by (auto intro!: setsum.cong simp: setsum_distrib_left)
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   554
  also have "\<dots> = ?r"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57275
diff changeset
   555
    by (subst setsum.commute)
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57275
diff changeset
   556
       (auto intro!: setsum.cong simp: setsum.If_cases scaleR_setsum_right[symmetric] eq)
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   557
  finally show "integral\<^sup>S M f = ?r" .
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   558
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   559
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   560
lemma simple_integral_add[simp]:
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   561
  assumes f: "simple_function M f" and "\<And>x. 0 \<le> f x" and g: "simple_function M g" and "\<And>x. 0 \<le> g x"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   562
  shows "(\<integral>\<^sup>Sx. f x + g x \<partial>M) = integral\<^sup>S M f + integral\<^sup>S M g"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   563
proof -
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   564
  have "(\<integral>\<^sup>Sx. f x + g x \<partial>M) =
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   565
    (\<Sum>y\<in>(\<lambda>x. (f x, g x))`space M. (fst y + snd y) * emeasure M {x\<in>space M. (f x, g x) = y})"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   566
    by (intro simple_function_partition) (auto intro: f g)
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   567
  also have "\<dots> = (\<Sum>y\<in>(\<lambda>x. (f x, g x))`space M. fst y * emeasure M {x\<in>space M. (f x, g x) = y}) +
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   568
    (\<Sum>y\<in>(\<lambda>x. (f x, g x))`space M. snd y * emeasure M {x\<in>space M. (f x, g x) = y})"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   569
    using assms(2,4) by (auto intro!: setsum.cong distrib_right simp: setsum.distrib[symmetric])
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   570
  also have "(\<Sum>y\<in>(\<lambda>x. (f x, g x))`space M. fst y * emeasure M {x\<in>space M. (f x, g x) = y}) = (\<integral>\<^sup>Sx. f x \<partial>M)"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   571
    by (intro simple_function_partition[symmetric]) (auto intro: f g)
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   572
  also have "(\<Sum>y\<in>(\<lambda>x. (f x, g x))`space M. snd y * emeasure M {x\<in>space M. (f x, g x) = y}) = (\<integral>\<^sup>Sx. g x \<partial>M)"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   573
    by (intro simple_function_partition[symmetric]) (auto intro: f g)
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   574
  finally show ?thesis .
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   575
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   576
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   577
lemma simple_integral_setsum[simp]:
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   578
  assumes "\<And>i x. i \<in> P \<Longrightarrow> 0 \<le> f i x"
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   579
  assumes "\<And>i. i \<in> P \<Longrightarrow> simple_function M (f i)"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   580
  shows "(\<integral>\<^sup>Sx. (\<Sum>i\<in>P. f i x) \<partial>M) = (\<Sum>i\<in>P. integral\<^sup>S M (f i))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   581
proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   582
  assume "finite P"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   583
  from this assms show ?thesis
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   584
    by induct (auto simp: simple_function_setsum simple_integral_add setsum_nonneg)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   585
qed auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   586
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   587
lemma simple_integral_mult[simp]:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   588
  assumes f: "simple_function M f"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   589
  shows "(\<integral>\<^sup>Sx. c * f x \<partial>M) = c * integral\<^sup>S M f"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   590
proof -
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   591
  have "(\<integral>\<^sup>Sx. c * f x \<partial>M) = (\<Sum>y\<in>f ` space M. (c * y) * emeasure M {x\<in>space M. f x = y})"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   592
    using f by (intro simple_function_partition) auto
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   593
  also have "\<dots> = c * integral\<^sup>S M f"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   594
    using f unfolding simple_integral_def
63918
6bf55e6e0b75 left_distrib ~> distrib_right, right_distrib ~> distrib_left
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents: 63627
diff changeset
   595
    by (subst setsum_distrib_left) (auto simp: mult.assoc Int_def conj_commute)
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   596
  finally show ?thesis .
40871
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   597
qed
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   598
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   599
lemma simple_integral_mono_AE:
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   600
  assumes f[measurable]: "simple_function M f" and g[measurable]: "simple_function M g"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   601
  and mono: "AE x in M. f x \<le> g x"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   602
  shows "integral\<^sup>S M f \<le> integral\<^sup>S M g"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   603
proof -
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   604
  let ?\<mu> = "\<lambda>P. emeasure M {x\<in>space M. P x}"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   605
  have "integral\<^sup>S M f = (\<Sum>y\<in>(\<lambda>x. (f x, g x))`space M. fst y * ?\<mu> (\<lambda>x. (f x, g x) = y))"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   606
    using f g by (intro simple_function_partition) auto
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   607
  also have "\<dots> \<le> (\<Sum>y\<in>(\<lambda>x. (f x, g x))`space M. snd y * ?\<mu> (\<lambda>x. (f x, g x) = y))"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   608
  proof (clarsimp intro!: setsum_mono)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   609
    fix x assume "x \<in> space M"
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   610
    let ?M = "?\<mu> (\<lambda>y. f y = f x \<and> g y = g x)"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   611
    show "f x * ?M \<le> g x * ?M"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   612
    proof cases
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   613
      assume "?M \<noteq> 0"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   614
      then have "0 < ?M"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   615
        by (simp add: less_le)
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   616
      also have "\<dots> \<le> ?\<mu> (\<lambda>y. f x \<le> g x)"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   617
        using mono by (intro emeasure_mono_AE) auto
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   618
      finally have "\<not> \<not> f x \<le> g x"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   619
        by (intro notI) auto
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   620
      then show ?thesis
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   621
        by (intro mult_right_mono) auto
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   622
    qed simp
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   623
  qed
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   624
  also have "\<dots> = integral\<^sup>S M g"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   625
    using f g by (intro simple_function_partition[symmetric]) auto
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   626
  finally show ?thesis .
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   627
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   628
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   629
lemma simple_integral_mono:
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   630
  assumes "simple_function M f" and "simple_function M g"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   631
  and mono: "\<And> x. x \<in> space M \<Longrightarrow> f x \<le> g x"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   632
  shows "integral\<^sup>S M f \<le> integral\<^sup>S M g"
41705
1100512e16d8 add auto support for AE_mp
hoelzl
parents: 41689
diff changeset
   633
  using assms by (intro simple_integral_mono_AE) auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   634
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   635
lemma simple_integral_cong_AE:
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   636
  assumes "simple_function M f" and "simple_function M g"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   637
  and "AE x in M. f x = g x"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   638
  shows "integral\<^sup>S M f = integral\<^sup>S M g"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   639
  using assms by (auto simp: eq_iff intro!: simple_integral_mono_AE)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   640
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   641
lemma simple_integral_cong':
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   642
  assumes sf: "simple_function M f" "simple_function M g"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   643
  and mea: "(emeasure M) {x\<in>space M. f x \<noteq> g x} = 0"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   644
  shows "integral\<^sup>S M f = integral\<^sup>S M g"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   645
proof (intro simple_integral_cong_AE sf AE_I)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   646
  show "(emeasure M) {x\<in>space M. f x \<noteq> g x} = 0" by fact
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   647
  show "{x \<in> space M. f x \<noteq> g x} \<in> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   648
    using sf[THEN borel_measurable_simple_function] by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   649
qed simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   650
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   651
lemma simple_integral_indicator:
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   652
  assumes A: "A \<in> sets M"
49796
182fa22e7ee8 introduce induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49795
diff changeset
   653
  assumes f: "simple_function M f"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   654
  shows "(\<integral>\<^sup>Sx. f x * indicator A x \<partial>M) =
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   655
    (\<Sum>x \<in> f ` space M. x * emeasure M (f -` {x} \<inter> space M \<inter> A))"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   656
proof -
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   657
  have eq: "(\<lambda>x. (f x, indicator A x)) ` space M \<inter> {x. snd x = 1} = (\<lambda>x. (f x, 1::ennreal))`A"
62390
842917225d56 more canonical names
nipkow
parents: 62343
diff changeset
   658
    using A[THEN sets.sets_into_space] by (auto simp: indicator_def image_iff split: if_split_asm)
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   659
  have eq2: "\<And>x. f x \<notin> f ` A \<Longrightarrow> f -` {f x} \<inter> space M \<inter> A = {}"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   660
    by (auto simp: image_iff)
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   661
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   662
  have "(\<integral>\<^sup>Sx. f x * indicator A x \<partial>M) =
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   663
    (\<Sum>y\<in>(\<lambda>x. (f x, indicator A x))`space M. (fst y * snd y) * emeasure M {x\<in>space M. (f x, indicator A x) = y})"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   664
    using assms by (intro simple_function_partition) auto
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   665
  also have "\<dots> = (\<Sum>y\<in>(\<lambda>x. (f x, indicator A x::ennreal))`space M.
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   666
    if snd y = 1 then fst y * emeasure M (f -` {fst y} \<inter> space M \<inter> A) else 0)"
62390
842917225d56 more canonical names
nipkow
parents: 62343
diff changeset
   667
    by (auto simp: indicator_def split: if_split_asm intro!: arg_cong2[where f="op *"] arg_cong2[where f=emeasure] setsum.cong)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   668
  also have "\<dots> = (\<Sum>y\<in>(\<lambda>x. (f x, 1::ennreal))`A. fst y * emeasure M (f -` {fst y} \<inter> space M \<inter> A))"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57275
diff changeset
   669
    using assms by (subst setsum.If_cases) (auto intro!: simple_functionD(1) simp: eq)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   670
  also have "\<dots> = (\<Sum>y\<in>fst`(\<lambda>x. (f x, 1::ennreal))`A. y * emeasure M (f -` {y} \<inter> space M \<inter> A))"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57275
diff changeset
   671
    by (subst setsum.reindex [of fst]) (auto simp: inj_on_def)
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   672
  also have "\<dots> = (\<Sum>x \<in> f ` space M. x * emeasure M (f -` {x} \<inter> space M \<inter> A))"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   673
    using A[THEN sets.sets_into_space]
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57275
diff changeset
   674
    by (intro setsum.mono_neutral_cong_left simple_functionD f) (auto simp: image_comp comp_def eq2)
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   675
  finally show ?thesis .
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   676
qed
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   677
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   678
lemma simple_integral_indicator_only[simp]:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   679
  assumes "A \<in> sets M"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   680
  shows "integral\<^sup>S M (indicator A) = emeasure M A"
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   681
  using simple_integral_indicator[OF assms, of "\<lambda>x. 1"] sets.sets_into_space[OF assms]
62390
842917225d56 more canonical names
nipkow
parents: 62343
diff changeset
   682
  by (simp_all add: image_constant_conv Int_absorb1 split: if_split_asm)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   683
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   684
lemma simple_integral_null_set:
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   685
  assumes "simple_function M u" "\<And>x. 0 \<le> u x" and "N \<in> null_sets M"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   686
  shows "(\<integral>\<^sup>Sx. u x * indicator N x \<partial>M) = 0"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   687
proof -
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   688
  have "AE x in M. indicator N x = (0 :: ennreal)"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   689
    using \<open>N \<in> null_sets M\<close> by (auto simp: indicator_def intro!: AE_I[of _ _ N])
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   690
  then have "(\<integral>\<^sup>Sx. u x * indicator N x \<partial>M) = (\<integral>\<^sup>Sx. 0 \<partial>M)"
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   691
    using assms apply (intro simple_integral_cong_AE) by auto
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   692
  then show ?thesis by simp
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   693
qed
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   694
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   695
lemma simple_integral_cong_AE_mult_indicator:
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   696
  assumes sf: "simple_function M f" and eq: "AE x in M. x \<in> S" and "S \<in> sets M"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   697
  shows "integral\<^sup>S M f = (\<integral>\<^sup>Sx. f x * indicator S x \<partial>M)"
41705
1100512e16d8 add auto support for AE_mp
hoelzl
parents: 41689
diff changeset
   698
  using assms by (intro simple_integral_cong_AE) auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   699
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   700
lemma simple_integral_cmult_indicator:
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   701
  assumes A: "A \<in> sets M"
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
   702
  shows "(\<integral>\<^sup>Sx. c * indicator A x \<partial>M) = c * emeasure M A"
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   703
  using simple_integral_mult[OF simple_function_indicator[OF A]]
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   704
  unfolding simple_integral_indicator_only[OF A] by simp
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   705
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   706
lemma simple_integral_nonneg:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   707
  assumes f: "simple_function M f" and ae: "AE x in M. 0 \<le> f x"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   708
  shows "0 \<le> integral\<^sup>S M f"
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   709
proof -
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   710
  have "integral\<^sup>S M (\<lambda>x. 0) \<le> integral\<^sup>S M f"
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   711
    using simple_integral_mono_AE[OF _ f ae] by auto
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   712
  then show ?thesis by simp
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   713
qed
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   714
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   715
subsection \<open>Integral on nonnegative functions\<close>
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   716
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   717
definition nn_integral :: "'a measure \<Rightarrow> ('a \<Rightarrow> ennreal) \<Rightarrow> ennreal" ("integral\<^sup>N") where
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   718
  "integral\<^sup>N M f = (SUP g : {g. simple_function M g \<and> g \<le> f}. integral\<^sup>S M g)"
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   719
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   720
syntax
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   721
  "_nn_integral" :: "pttrn \<Rightarrow> ennreal \<Rightarrow> 'a measure \<Rightarrow> ennreal" ("\<integral>\<^sup>+((2 _./ _)/ \<partial>_)" [60,61] 110)
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   722
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   723
translations
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   724
  "\<integral>\<^sup>+x. f \<partial>M" == "CONST nn_integral M (\<lambda>x. f)"
40872
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   725
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   726
lemma nn_integral_def_finite:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   727
  "integral\<^sup>N M f = (SUP g : {g. simple_function M g \<and> g \<le> f \<and> (\<forall>x. g x < top)}. integral\<^sup>S M g)"
56218
1c3f1f2431f9 elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
haftmann
parents: 56213
diff changeset
   728
    (is "_ = SUPREMUM ?A ?f")
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   729
  unfolding nn_integral_def
44928
7ef6505bde7f renamed Complete_Lattices lemmas, removed legacy names
hoelzl
parents: 44890
diff changeset
   730
proof (safe intro!: antisym SUP_least)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   731
  fix g assume g[measurable]: "simple_function M g" "g \<le> f"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   732
56218
1c3f1f2431f9 elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
haftmann
parents: 56213
diff changeset
   733
  show "integral\<^sup>S M g \<le> SUPREMUM ?A ?f"
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   734
  proof cases
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   735
    assume ae: "AE x in M. g x \<noteq> top"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   736
    let ?G = "{x \<in> space M. g x \<noteq> top}"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   737
    have "integral\<^sup>S M g = integral\<^sup>S M (\<lambda>x. g x * indicator ?G x)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   738
    proof (rule simple_integral_cong_AE)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   739
      show "AE x in M. g x = g x * indicator ?G x"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   740
        using ae AE_space by eventually_elim auto
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   741
    qed (insert g, auto)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   742
    also have "\<dots> \<le> SUPREMUM ?A ?f"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   743
      using g by (intro SUP_upper) (auto simp: le_fun_def less_top split: split_indicator)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   744
    finally show ?thesis .
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   745
  next
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   746
    assume nAE: "\<not> (AE x in M. g x \<noteq> top)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   747
    then have "emeasure M {x\<in>space M. g x = top} \<noteq> 0" (is "emeasure M ?G \<noteq> 0")
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   748
      by (subst (asm) AE_iff_measurable[OF _ refl]) auto
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   749
    then have "top = (SUP n. (\<integral>\<^sup>Sx. of_nat n * indicator ?G x \<partial>M))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   750
      by (simp add: ennreal_SUP_of_nat_eq_top ennreal_top_eq_mult_iff SUP_mult_right_ennreal[symmetric])
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   751
    also have "\<dots> \<le> SUPREMUM ?A ?f"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   752
      using g
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   753
      by (safe intro!: SUP_least SUP_upper)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   754
         (auto simp: le_fun_def of_nat_less_top top_unique[symmetric] split: split_indicator
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   755
               intro: order_trans[of _ "g x" "f x" for x, OF order_trans[of _ top]])
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   756
    finally show ?thesis
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   757
      by (simp add: top_unique del: SUP_eq_top_iff Sup_eq_top_iff)
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   758
  qed
44928
7ef6505bde7f renamed Complete_Lattices lemmas, removed legacy names
hoelzl
parents: 44890
diff changeset
   759
qed (auto intro: SUP_upper)
40873
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   760
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   761
lemma nn_integral_mono_AE:
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   762
  assumes ae: "AE x in M. u x \<le> v x" shows "integral\<^sup>N M u \<le> integral\<^sup>N M v"
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   763
  unfolding nn_integral_def
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   764
proof (safe intro!: SUP_mono)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   765
  fix n assume n: "simple_function M n" "n \<le> u"
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   766
  from ae[THEN AE_E] guess N . note N = this
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   767
  then have ae_N: "AE x in M. x \<notin> N" by (auto intro: AE_not_in)
46731
5302e932d1e5 avoid undeclared variables in let bindings;
wenzelm
parents: 46671
diff changeset
   768
  let ?n = "\<lambda>x. n x * indicator (space M - N) x"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   769
  have "AE x in M. n x \<le> ?n x" "simple_function M ?n"
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   770
    using n N ae_N by auto
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   771
  moreover
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   772
  { fix x have "?n x \<le> v x"
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   773
    proof cases
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   774
      assume x: "x \<in> space M - N"
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   775
      with N have "u x \<le> v x" by auto
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   776
      with n(2)[THEN le_funD, of x] x show ?thesis
62390
842917225d56 more canonical names
nipkow
parents: 62343
diff changeset
   777
        by (auto simp: max_def split: if_split_asm)
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   778
    qed simp }
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   779
  then have "?n \<le> v" by (auto simp: le_funI)
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   780
  moreover have "integral\<^sup>S M n \<le> integral\<^sup>S M ?n"
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   781
    using ae_N N n by (auto intro!: simple_integral_mono_AE)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   782
  ultimately show "\<exists>m\<in>{g. simple_function M g \<and> g \<le> v}. integral\<^sup>S M n \<le> integral\<^sup>S M m"
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   783
    by force
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   784
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   785
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   786
lemma nn_integral_mono:
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   787
  "(\<And>x. x \<in> space M \<Longrightarrow> u x \<le> v x) \<Longrightarrow> integral\<^sup>N M u \<le> integral\<^sup>N M v"
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   788
  by (auto intro: nn_integral_mono_AE)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   789
60175
831ddb69db9b add lfp/gfp rule for nn_integral
hoelzl
parents: 60064
diff changeset
   790
lemma mono_nn_integral: "mono F \<Longrightarrow> mono (\<lambda>x. integral\<^sup>N M (F x))"
831ddb69db9b add lfp/gfp rule for nn_integral
hoelzl
parents: 60064
diff changeset
   791
  by (auto simp add: mono_def le_fun_def intro!: nn_integral_mono)
831ddb69db9b add lfp/gfp rule for nn_integral
hoelzl
parents: 60064
diff changeset
   792
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   793
lemma nn_integral_cong_AE:
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   794
  "AE x in M. u x = v x \<Longrightarrow> integral\<^sup>N M u = integral\<^sup>N M v"
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   795
  by (auto simp: eq_iff intro!: nn_integral_mono_AE)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   796
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   797
lemma nn_integral_cong:
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   798
  "(\<And>x. x \<in> space M \<Longrightarrow> u x = v x) \<Longrightarrow> integral\<^sup>N M u = integral\<^sup>N M v"
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   799
  by (auto intro: nn_integral_cong_AE)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   800
59426
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
   801
lemma nn_integral_cong_simp:
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
   802
  "(\<And>x. x \<in> space M =simp=> u x = v x) \<Longrightarrow> integral\<^sup>N M u = integral\<^sup>N M v"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
   803
  by (auto intro: nn_integral_cong simp: simp_implies_def)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
   804
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   805
lemma nn_integral_cong_strong:
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   806
  "M = N \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> u x = v x) \<Longrightarrow> integral\<^sup>N M u = integral\<^sup>N N v"
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   807
  by (auto intro: nn_integral_cong)
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
   808
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   809
lemma incseq_nn_integral:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   810
  assumes "incseq f" shows "incseq (\<lambda>i. integral\<^sup>N M (f i))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   811
proof -
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   812
  have "\<And>i x. f i x \<le> f (Suc i) x"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   813
    using assms by (auto dest!: incseq_SucD simp: le_fun_def)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   814
  then show ?thesis
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   815
    by (auto intro!: incseq_SucI nn_integral_mono)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   816
qed
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   817
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   818
lemma nn_integral_eq_simple_integral:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   819
  assumes f: "simple_function M f" shows "integral\<^sup>N M f = integral\<^sup>S M f"
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   820
proof -
46731
5302e932d1e5 avoid undeclared variables in let bindings;
wenzelm
parents: 46671
diff changeset
   821
  let ?f = "\<lambda>x. f x * indicator (space M) x"
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   822
  have f': "simple_function M ?f" using f by auto
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   823
  have "integral\<^sup>N M ?f \<le> integral\<^sup>S M ?f" using f'
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   824
    by (force intro!: SUP_least simple_integral_mono simp: le_fun_def nn_integral_def)
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   825
  moreover have "integral\<^sup>S M ?f \<le> integral\<^sup>N M ?f"
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   826
    unfolding nn_integral_def
44928
7ef6505bde7f renamed Complete_Lattices lemmas, removed legacy names
hoelzl
parents: 44890
diff changeset
   827
    using f' by (auto intro!: SUP_upper)
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   828
  ultimately show ?thesis
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   829
    by (simp cong: nn_integral_cong simple_integral_cong)
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   830
qed
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   831
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   832
text \<open>Beppo-Levi monotone convergence theorem\<close>
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   833
lemma nn_integral_monotone_convergence_SUP:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   834
  assumes f: "incseq f" and [measurable]: "\<And>i. f i \<in> borel_measurable M"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   835
  shows "(\<integral>\<^sup>+ x. (SUP i. f i x) \<partial>M) = (SUP i. integral\<^sup>N M (f i))"
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   836
proof (rule antisym)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   837
  show "(\<integral>\<^sup>+ x. (SUP i. f i x) \<partial>M) \<le> (SUP i. (\<integral>\<^sup>+ x. f i x \<partial>M))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   838
    unfolding nn_integral_def_finite[of _ "\<lambda>x. SUP i. f i x"]
44928
7ef6505bde7f renamed Complete_Lattices lemmas, removed legacy names
hoelzl
parents: 44890
diff changeset
   839
  proof (safe intro!: SUP_least)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   840
    fix u assume sf_u[simp]: "simple_function M u" and
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   841
      u: "u \<le> (\<lambda>x. SUP i. f i x)" and u_range: "\<forall>x. u x < top"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   842
    note sf_u[THEN borel_measurable_simple_function, measurable]
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   843
    show "integral\<^sup>S M u \<le> (SUP j. \<integral>\<^sup>+x. f j x \<partial>M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   844
    proof (rule ennreal_approx_unit)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   845
      fix a :: ennreal assume "a < 1"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   846
      let ?au = "\<lambda>x. a * u x"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   847
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   848
      let ?B = "\<lambda>c i. {x\<in>space M. ?au x = c \<and> c \<le> f i x}"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   849
      have "integral\<^sup>S M ?au = (\<Sum>c\<in>?au`space M. c * (SUP i. emeasure M (?B c i)))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   850
        unfolding simple_integral_def
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   851
      proof (intro setsum.cong ennreal_mult_left_cong refl)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   852
        fix c assume "c \<in> ?au ` space M" "c \<noteq> 0"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   853
        { fix x' assume x': "x' \<in> space M" "?au x' = c"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   854
          with \<open>c \<noteq> 0\<close> u_range have "?au x' < 1 * u x'"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   855
            by (intro ennreal_mult_strict_right_mono \<open>a < 1\<close>) (auto simp: less_le)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   856
          also have "\<dots> \<le> (SUP i. f i x')"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   857
            using u by (auto simp: le_fun_def)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   858
          finally have "\<exists>i. ?au x' \<le> f i x'"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   859
            by (auto simp: less_SUP_iff intro: less_imp_le) }
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   860
        then have *: "?au -` {c} \<inter> space M = (\<Union>i. ?B c i)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   861
          by auto
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   862
        show "emeasure M (?au -` {c} \<inter> space M) = (SUP i. emeasure M (?B c i))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   863
          unfolding * using f
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   864
          by (intro SUP_emeasure_incseq[symmetric])
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   865
             (auto simp: incseq_def le_fun_def intro: order_trans)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   866
      qed
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   867
      also have "\<dots> = (SUP i. \<Sum>c\<in>?au`space M. c * emeasure M (?B c i))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   868
        unfolding SUP_mult_left_ennreal using f
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   869
        by (intro ennreal_SUP_setsum[symmetric])
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   870
           (auto intro!: mult_mono emeasure_mono simp: incseq_def le_fun_def intro: order_trans)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   871
      also have "\<dots> \<le> (SUP i. integral\<^sup>N M (f i))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   872
      proof (intro SUP_subset_mono order_refl)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   873
        fix i
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   874
        have "(\<Sum>c\<in>?au`space M. c * emeasure M (?B c i)) =
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   875
          (\<integral>\<^sup>Sx. (a * u x) * indicator {x\<in>space M. a * u x \<le> f i x} x \<partial>M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   876
          by (subst simple_integral_indicator)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   877
             (auto intro!: setsum.cong ennreal_mult_left_cong arg_cong2[where f=emeasure])
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   878
        also have "\<dots> = (\<integral>\<^sup>+x. (a * u x) * indicator {x\<in>space M. a * u x \<le> f i x} x \<partial>M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   879
          by (rule nn_integral_eq_simple_integral[symmetric]) simp
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   880
        also have "\<dots> \<le> (\<integral>\<^sup>+x. f i x \<partial>M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   881
          by (intro nn_integral_mono) (auto split: split_indicator)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   882
        finally show "(\<Sum>c\<in>?au`space M. c * emeasure M (?B c i)) \<le> (\<integral>\<^sup>+x. f i x \<partial>M)" .
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   883
      qed
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   884
      finally show "a * integral\<^sup>S M u \<le> (SUP i. integral\<^sup>N M (f i))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   885
        by simp
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   886
    qed
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   887
  qed
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   888
qed (auto intro!: SUP_least SUP_upper nn_integral_mono)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   889
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   890
lemma sup_continuous_nn_integral[order_continuous_intros]:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   891
  assumes f: "\<And>y. sup_continuous (f y)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   892
  assumes [measurable]: "\<And>x. (\<lambda>y. f y x) \<in> borel_measurable M"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   893
  shows "sup_continuous (\<lambda>x. (\<integral>\<^sup>+y. f y x \<partial>M))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   894
  unfolding sup_continuous_def
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   895
proof safe
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   896
  fix C :: "nat \<Rightarrow> 'b" assume C: "incseq C"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   897
  with sup_continuous_mono[OF f] show "(\<integral>\<^sup>+ y. f y (SUPREMUM UNIV C) \<partial>M) = (SUP i. \<integral>\<^sup>+ y. f y (C i) \<partial>M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   898
    unfolding sup_continuousD[OF f C]
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   899
    by (subst nn_integral_monotone_convergence_SUP) (auto simp: mono_def le_fun_def)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   900
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   901
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   902
lemma nn_integral_monotone_convergence_SUP_AE:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   903
  assumes f: "\<And>i. AE x in M. f i x \<le> f (Suc i) x" "\<And>i. f i \<in> borel_measurable M"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   904
  shows "(\<integral>\<^sup>+ x. (SUP i. f i x) \<partial>M) = (SUP i. integral\<^sup>N M (f i))"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   905
proof -
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   906
  from f have "AE x in M. \<forall>i. f i x \<le> f (Suc i) x"
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   907
    by (simp add: AE_all_countable)
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   908
  from this[THEN AE_E] guess N . note N = this
46731
5302e932d1e5 avoid undeclared variables in let bindings;
wenzelm
parents: 46671
diff changeset
   909
  let ?f = "\<lambda>i x. if x \<in> space M - N then f i x else 0"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   910
  have f_eq: "AE x in M. \<forall>i. ?f i x = f i x" using N by (auto intro!: AE_I[of _ _ N])
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   911
  then have "(\<integral>\<^sup>+ x. (SUP i. f i x) \<partial>M) = (\<integral>\<^sup>+ x. (SUP i. ?f i x) \<partial>M)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   912
    by (auto intro!: nn_integral_cong_AE)
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   913
  also have "\<dots> = (SUP i. (\<integral>\<^sup>+ x. ?f i x \<partial>M))"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   914
  proof (rule nn_integral_monotone_convergence_SUP)
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   915
    show "incseq ?f" using N(1) by (force intro!: incseq_SucI le_funI)
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   916
    { fix i show "(\<lambda>x. if x \<in> space M - N then f i x else 0) \<in> borel_measurable M"
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   917
        using f N(3) by (intro measurable_If_set) auto }
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   918
  qed
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   919
  also have "\<dots> = (SUP i. (\<integral>\<^sup>+ x. f i x \<partial>M))"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   920
    using f_eq by (force intro!: arg_cong[where f="SUPREMUM UNIV"] nn_integral_cong_AE ext)
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   921
  finally show ?thesis .
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   922
qed
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   923
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   924
lemma nn_integral_monotone_convergence_simple:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   925
  "incseq f \<Longrightarrow> (\<And>i. simple_function M (f i)) \<Longrightarrow> (SUP i. \<integral>\<^sup>S x. f i x \<partial>M) = (\<integral>\<^sup>+x. (SUP i. f i x) \<partial>M)"
63092
a949b2a5f51d eliminated use of empty "assms";
wenzelm
parents: 63040
diff changeset
   926
  using nn_integral_monotone_convergence_SUP[of f M]
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   927
  by (simp add: nn_integral_eq_simple_integral[symmetric] borel_measurable_simple_function)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   928
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   929
lemma SUP_simple_integral_sequences:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   930
  assumes f: "incseq f" "\<And>i. simple_function M (f i)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   931
  and g: "incseq g" "\<And>i. simple_function M (g i)"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   932
  and eq: "AE x in M. (SUP i. f i x) = (SUP i. g i x)"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   933
  shows "(SUP i. integral\<^sup>S M (f i)) = (SUP i. integral\<^sup>S M (g i))"
56218
1c3f1f2431f9 elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
haftmann
parents: 56213
diff changeset
   934
    (is "SUPREMUM _ ?F = SUPREMUM _ ?G")
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   935
proof -
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   936
  have "(SUP i. integral\<^sup>S M (f i)) = (\<integral>\<^sup>+x. (SUP i. f i x) \<partial>M)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   937
    using f by (rule nn_integral_monotone_convergence_simple)
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   938
  also have "\<dots> = (\<integral>\<^sup>+x. (SUP i. g i x) \<partial>M)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   939
    unfolding eq[THEN nn_integral_cong_AE] ..
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   940
  also have "\<dots> = (SUP i. ?G i)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   941
    using g by (rule nn_integral_monotone_convergence_simple[symmetric])
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   942
  finally show ?thesis by simp
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   943
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   944
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   945
lemma nn_integral_const[simp]: "(\<integral>\<^sup>+ x. c \<partial>M) = c * emeasure M (space M)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   946
  by (subst nn_integral_eq_simple_integral) auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   947
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   948
lemma nn_integral_linear:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   949
  assumes f: "f \<in> borel_measurable M" and g: "g \<in> borel_measurable M"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   950
  shows "(\<integral>\<^sup>+ x. a * f x + g x \<partial>M) = a * integral\<^sup>N M f + integral\<^sup>N M g"
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   951
    (is "integral\<^sup>N M ?L = _")
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   952
proof -
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   953
  from borel_measurable_implies_simple_function_sequence'[OF f(1)] guess u .
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   954
  note u = nn_integral_monotone_convergence_simple[OF this(2,1)] this
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   955
  from borel_measurable_implies_simple_function_sequence'[OF g(1)] guess v .
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   956
  note v = nn_integral_monotone_convergence_simple[OF this(2,1)] this
46731
5302e932d1e5 avoid undeclared variables in let bindings;
wenzelm
parents: 46671
diff changeset
   957
  let ?L' = "\<lambda>i x. a * u i x + v i x"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   958
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   959
  have "?L \<in> borel_measurable M" using assms by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   960
  from borel_measurable_implies_simple_function_sequence'[OF this] guess l .
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   961
  note l = nn_integral_monotone_convergence_simple[OF this(2,1)] this
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   962
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   963
  have inc: "incseq (\<lambda>i. a * integral\<^sup>S M (u i))" "incseq (\<lambda>i. integral\<^sup>S M (v i))"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   964
    using u v by (auto simp: incseq_Suc_iff le_fun_def intro!: add_mono mult_left_mono simple_integral_mono)
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   965
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   966
  have l': "(SUP i. integral\<^sup>S M (l i)) = (SUP i. integral\<^sup>S M (?L' i))"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   967
  proof (rule SUP_simple_integral_sequences[OF l(3,2)])
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   968
    show "incseq ?L'" "\<And>i. simple_function M (?L' i)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   969
      using u v unfolding incseq_Suc_iff le_fun_def
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   970
      by (auto intro!: add_mono mult_left_mono)
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   971
    { fix x
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   972
      have "(SUP i. a * u i x + v i x) = a * (SUP i. u i x) + (SUP i. v i x)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   973
        using u(3) v(3) u(4)[of _ x] v(4)[of _ x] unfolding SUP_mult_left_ennreal
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   974
        by (auto intro!: ennreal_SUP_add simp: incseq_Suc_iff le_fun_def add_mono mult_left_mono) }
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
   975
    then show "AE x in M. (SUP i. l i x) = (SUP i. ?L' i x)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   976
      unfolding l(5) using u(5) v(5) by (intro AE_I2) auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   977
  qed
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
   978
  also have "\<dots> = (SUP i. a * integral\<^sup>S M (u i) + integral\<^sup>S M (v i))"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   979
    using u(2) v(2) by auto
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   980
  finally show ?thesis
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   981
    unfolding l(5)[symmetric] l(1)[symmetric]
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   982
    by (simp add: ennreal_SUP_add[OF inc] v u SUP_mult_left_ennreal[symmetric])
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   983
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   984
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   985
lemma nn_integral_cmult: "f \<in> borel_measurable M \<Longrightarrow> (\<integral>\<^sup>+ x. c * f x \<partial>M) = c * integral\<^sup>N M f"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   986
  using nn_integral_linear[of f M "\<lambda>x. 0" c] by simp
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   987
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   988
lemma nn_integral_multc: "f \<in> borel_measurable M \<Longrightarrow> (\<integral>\<^sup>+ x. f x * c \<partial>M) = integral\<^sup>N M f * c"
63092
a949b2a5f51d eliminated use of empty "assms";
wenzelm
parents: 63040
diff changeset
   989
  unfolding mult.commute[of _ c] nn_integral_cmult by simp
41096
843c40bbc379 integral over setprod
hoelzl
parents: 41095
diff changeset
   990
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   991
lemma nn_integral_divide: "f \<in> borel_measurable M \<Longrightarrow> (\<integral>\<^sup>+ x. f x / c \<partial>M) = (\<integral>\<^sup>+ x. f x \<partial>M) / c"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   992
   unfolding divide_ennreal_def by (rule nn_integral_multc)
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   993
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   994
lemma nn_integral_indicator[simp]: "A \<in> sets M \<Longrightarrow> (\<integral>\<^sup>+ x. indicator A x\<partial>M) = (emeasure M) A"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   995
  by (subst nn_integral_eq_simple_integral) (auto simp: simple_integral_indicator)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   996
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   997
lemma nn_integral_cmult_indicator: "A \<in> sets M \<Longrightarrow> (\<integral>\<^sup>+ x. c * indicator A x \<partial>M) = c * emeasure M A"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   998
  by (subst nn_integral_eq_simple_integral)
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
   999
     (auto simp: simple_function_indicator simple_integral_indicator)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1000
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1001
lemma nn_integral_indicator':
50097
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1002
  assumes [measurable]: "A \<inter> space M \<in> sets M"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
  1003
  shows "(\<integral>\<^sup>+ x. indicator A x \<partial>M) = emeasure M (A \<inter> space M)"
50097
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1004
proof -
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
  1005
  have "(\<integral>\<^sup>+ x. indicator A x \<partial>M) = (\<integral>\<^sup>+ x. indicator (A \<inter> space M) x \<partial>M)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1006
    by (intro nn_integral_cong) (simp split: split_indicator)
50097
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1007
  also have "\<dots> = emeasure M (A \<inter> space M)"
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1008
    by simp
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1009
  finally show ?thesis .
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1010
qed
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1011
62083
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
  1012
lemma nn_integral_indicator_singleton[simp]:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1013
  assumes [measurable]: "{y} \<in> sets M" shows "(\<integral>\<^sup>+x. f x * indicator {y} x \<partial>M) = f y * emeasure M {y}"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1014
proof -
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1015
  have "(\<integral>\<^sup>+x. f x * indicator {y} x \<partial>M) = (\<integral>\<^sup>+x. f y * indicator {y} x \<partial>M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1016
    by (auto intro!: nn_integral_cong split: split_indicator)
62083
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
  1017
  then show ?thesis
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
  1018
    by (simp add: nn_integral_cmult)
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
  1019
qed
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
  1020
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1021
lemma nn_integral_set_ennreal:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1022
  "(\<integral>\<^sup>+x. ennreal (f x) * indicator A x \<partial>M) = (\<integral>\<^sup>+x. ennreal (f x * indicator A x) \<partial>M)"
62083
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
  1023
  by (rule nn_integral_cong) (simp split: split_indicator)
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
  1024
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
  1025
lemma nn_integral_indicator_singleton'[simp]:
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
  1026
  assumes [measurable]: "{y} \<in> sets M"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1027
  shows "(\<integral>\<^sup>+x. ennreal (f x * indicator {y} x) \<partial>M) = f y * emeasure M {y}"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1028
  by (subst nn_integral_set_ennreal[symmetric]) (simp add: nn_integral_indicator_singleton)
62083
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 61969
diff changeset
  1029
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1030
lemma nn_integral_add:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1031
  "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> (\<integral>\<^sup>+ x. f x + g x \<partial>M) = integral\<^sup>N M f + integral\<^sup>N M g"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1032
  using nn_integral_linear[of f M g 1] by simp
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1033
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1034
lemma nn_integral_setsum:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1035
  "(\<And>i. i \<in> P \<Longrightarrow> f i \<in> borel_measurable M) \<Longrightarrow> (\<integral>\<^sup>+ x. (\<Sum>i\<in>P. f i x) \<partial>M) = (\<Sum>i\<in>P. integral\<^sup>N M (f i))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1036
  by (induction P rule: infinite_finite_induct) (auto simp: nn_integral_add)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1037
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1038
lemma nn_integral_suminf:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1039
  assumes f: "\<And>i. f i \<in> borel_measurable M"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1040
  shows "(\<integral>\<^sup>+ x. (\<Sum>i. f i x) \<partial>M) = (\<Sum>i. integral\<^sup>N M (f i))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1041
proof -
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1042
  have all_pos: "AE x in M. \<forall>i. 0 \<le> f i x"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1043
    using assms by (auto simp: AE_all_countable)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1044
  have "(\<Sum>i. integral\<^sup>N M (f i)) = (SUP n. \<Sum>i<n. integral\<^sup>N M (f i))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1045
    by (rule suminf_eq_SUP)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1046
  also have "\<dots> = (SUP n. \<integral>\<^sup>+x. (\<Sum>i<n. f i x) \<partial>M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1047
    unfolding nn_integral_setsum[OF f] ..
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1048
  also have "\<dots> = \<integral>\<^sup>+x. (SUP n. \<Sum>i<n. f i x) \<partial>M" using f all_pos
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1049
    by (intro nn_integral_monotone_convergence_SUP_AE[symmetric])
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1050
       (elim AE_mp, auto simp: setsum_nonneg simp del: setsum_lessThan_Suc intro!: AE_I2 setsum_mono3)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1051
  also have "\<dots> = \<integral>\<^sup>+x. (\<Sum>i. f i x) \<partial>M" using all_pos
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1052
    by (intro nn_integral_cong_AE) (auto simp: suminf_eq_SUP)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1053
  finally show ?thesis by simp
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1054
qed
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1055
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1056
lemma nn_integral_bound_simple_function:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1057
  assumes bnd: "\<And>x. x \<in> space M \<Longrightarrow> f x < \<infinity>"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1058
  assumes f[measurable]: "simple_function M f"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1059
  assumes supp: "emeasure M {x\<in>space M. f x \<noteq> 0} < \<infinity>"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1060
  shows "nn_integral M f < \<infinity>"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1061
proof cases
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1062
  assume "space M = {}"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1063
  then have "nn_integral M f = (\<integral>\<^sup>+x. 0 \<partial>M)"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1064
    by (intro nn_integral_cong) auto
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1065
  then show ?thesis by simp
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1066
next
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1067
  assume "space M \<noteq> {}"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1068
  with simple_functionD(1)[OF f] bnd have bnd: "0 \<le> Max (f`space M) \<and> Max (f`space M) < \<infinity>"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1069
    by (subst Max_less_iff) (auto simp: Max_ge_iff)
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  1070
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1071
  have "nn_integral M f \<le> (\<integral>\<^sup>+x. Max (f`space M) * indicator {x\<in>space M. f x \<noteq> 0} x \<partial>M)"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1072
  proof (rule nn_integral_mono)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1073
    fix x assume "x \<in> space M"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1074
    with f show "f x \<le> Max (f ` space M) * indicator {x \<in> space M. f x \<noteq> 0} x"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1075
      by (auto split: split_indicator intro!: Max_ge simple_functionD)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1076
  qed
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1077
  also have "\<dots> < \<infinity>"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1078
    using bnd supp by (subst nn_integral_cmult) (auto simp: ennreal_mult_less_top)
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1079
  finally show ?thesis .
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1080
qed
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1081
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1082
lemma nn_integral_Markov_inequality:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1083
  assumes u: "u \<in> borel_measurable M" and "A \<in> sets M"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
  1084
  shows "(emeasure M) ({x\<in>space M. 1 \<le> c * u x} \<inter> A) \<le> c * (\<integral>\<^sup>+ x. u x * indicator A x \<partial>M)"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1085
    (is "(emeasure M) ?A \<le> _ * ?PI")
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
  1086
proof -
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
  1087
  have "?A \<in> sets M"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1088
    using \<open>A \<in> sets M\<close> u by auto
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
  1089
  hence "(emeasure M) ?A = (\<integral>\<^sup>+ x. indicator ?A x \<partial>M)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1090
    using nn_integral_indicator by simp
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1091
  also have "\<dots> \<le> (\<integral>\<^sup>+ x. c * (u x * indicator A x) \<partial>M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1092
    using u by (auto intro!: nn_integral_mono_AE simp: indicator_def)
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
  1093
  also have "\<dots> = c * (\<integral>\<^sup>+ x. u x * indicator A x \<partial>M)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1094
    using assms by (auto intro!: nn_integral_cmult)
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
  1095
  finally show ?thesis .
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
  1096
qed
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
  1097
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1098
lemma nn_integral_noteq_infinite:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1099
  assumes g: "g \<in> borel_measurable M" and "integral\<^sup>N M g \<noteq> \<infinity>"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1100
  shows "AE x in M. g x \<noteq> \<infinity>"
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
  1101
proof (rule ccontr)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1102
  assume c: "\<not> (AE x in M. g x \<noteq> \<infinity>)"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1103
  have "(emeasure M) {x\<in>space M. g x = \<infinity>} \<noteq> 0"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1104
    using c g by (auto simp add: AE_iff_null)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1105
  then have "0 < (emeasure M) {x\<in>space M. g x = \<infinity>}"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1106
    by (auto simp: zero_less_iff_neq_zero)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1107
  then have "\<infinity> = \<infinity> * (emeasure M) {x\<in>space M. g x = \<infinity>}"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1108
    by (auto simp: ennreal_top_eq_mult_iff)
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
  1109
  also have "\<dots> \<le> (\<integral>\<^sup>+x. \<infinity> * indicator {x\<in>space M. g x = \<infinity>} x \<partial>M)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1110
    using g by (subst nn_integral_cmult_indicator) auto
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1111
  also have "\<dots> \<le> integral\<^sup>N M g"
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1112
    using assms by (auto intro!: nn_integral_mono_AE simp: indicator_def)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1113
  finally show False
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1114
    using \<open>integral\<^sup>N M g \<noteq> \<infinity>\<close> by (auto simp: top_unique)
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
  1115
qed
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
  1116
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1117
lemma nn_integral_PInf:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1118
  assumes f: "f \<in> borel_measurable M" and not_Inf: "integral\<^sup>N M f \<noteq> \<infinity>"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1119
  shows "emeasure M (f -` {\<infinity>} \<inter> space M) = 0"
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
  1120
proof -
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1121
  have "\<infinity> * emeasure M (f -` {\<infinity>} \<inter> space M) = (\<integral>\<^sup>+ x. \<infinity> * indicator (f -` {\<infinity>} \<inter> space M) x \<partial>M)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1122
    using f by (subst nn_integral_cmult_indicator) (auto simp: measurable_sets)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1123
  also have "\<dots> \<le> integral\<^sup>N M f"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1124
    by (auto intro!: nn_integral_mono simp: indicator_def)
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1125
  finally have "\<infinity> * (emeasure M) (f -` {\<infinity>} \<inter> space M) \<le> integral\<^sup>N M f"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1126
    by simp
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1127
  then show ?thesis
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1128
    using assms by (auto simp: ennreal_top_mult top_unique split: if_split_asm)
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
  1129
qed
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
  1130
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1131
lemma simple_integral_PInf:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1132
  "simple_function M f \<Longrightarrow> integral\<^sup>S M f \<noteq> \<infinity> \<Longrightarrow> emeasure M (f -` {\<infinity>} \<inter> space M) = 0"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1133
  by (rule nn_integral_PInf) (auto simp: nn_integral_eq_simple_integral borel_measurable_simple_function)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1134
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1135
lemma nn_integral_PInf_AE:
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1136
  assumes "f \<in> borel_measurable M" "integral\<^sup>N M f \<noteq> \<infinity>" shows "AE x in M. f x \<noteq> \<infinity>"
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
  1137
proof (rule AE_I)
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
  1138
  show "(emeasure M) (f -` {\<infinity>} \<inter> space M) = 0"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1139
    by (rule nn_integral_PInf[OF assms])
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
  1140
  show "f -` {\<infinity>} \<inter> space M \<in> sets M"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
  1141
    using assms by (auto intro: borel_measurable_vimage)
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
  1142
qed auto
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56571
diff changeset
  1143
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1144
lemma nn_integral_diff:
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
  1145
  assumes f: "f \<in> borel_measurable M"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1146
  and g: "g \<in> borel_measurable M"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1147
  and fin: "integral\<^sup>N M g \<noteq> \<infinity>"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1148
  and mono: "AE x in M. g x \<le> f x"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1149
  shows "(\<integral>\<^sup>+ x. f x - g x \<partial>M) = integral\<^sup>N M f - integral\<^sup>N M g"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1150
proof -
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1151
  have diff: "(\<lambda>x. f x - g x) \<in> borel_measurable M"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1152
    using assms by auto
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1153
  have "AE x in M. f x = f x - g x + g x"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1154
    using diff_add_cancel_ennreal mono nn_integral_noteq_infinite[OF g fin] assms by auto
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1155
  then have **: "integral\<^sup>N M f = (\<integral>\<^sup>+x. f x - g x \<partial>M) + integral\<^sup>N M g"
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1156
    unfolding nn_integral_add[OF diff g, symmetric]
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1157
    by (rule nn_integral_cong_AE)
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
  1158
  show ?thesis unfolding **
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1159
    using fin
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1160
    by (cases rule: ennreal2_cases[of "\<integral>\<^sup>+ x. f x - g x \<partial>M" "integral\<^sup>N M g"]) auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1161
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1162
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1163
lemma nn_integral_mult_bounded_inf:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1164
  assumes f: "f \<in> borel_measurable M" "(\<integral>\<^sup>+x. f x \<partial>M) < \<infinity>" and c: "c \<noteq> \<infinity>" and ae: "AE x in M. g x \<le> c * f x"
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1165
  shows "(\<integral>\<^sup>+x. g x \<partial>M) < \<infinity>"
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1166
proof -
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1167
  have "(\<integral>\<^sup>+x. g x \<partial>M) \<le> (\<integral>\<^sup>+x. c * f x \<partial>M)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1168
    by (intro nn_integral_mono_AE ae)
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1169
  also have "(\<integral>\<^sup>+x. c * f x \<partial>M) < \<infinity>"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1170
    using c f by (subst nn_integral_cmult) (auto simp: ennreal_mult_less_top top_unique not_less)
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1171
  finally show ?thesis .
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1172
qed
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1173
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1174
text \<open>Fatou's lemma: convergence theorem on limes inferior\<close>
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1175
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1176
lemma nn_integral_monotone_convergence_INF_AE':
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1177
  assumes f: "\<And>i. AE x in M. f (Suc i) x \<le> f i x" and [measurable]: "\<And>i. f i \<in> borel_measurable M"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1178
    and *: "(\<integral>\<^sup>+ x. f 0 x \<partial>M) < \<infinity>"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1179
  shows "(\<integral>\<^sup>+ x. (INF i. f i x) \<partial>M) = (INF i. integral\<^sup>N M (f i))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1180
proof (rule ennreal_minus_cancel)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1181
  have "integral\<^sup>N M (f 0) - (\<integral>\<^sup>+ x. (INF i. f i x) \<partial>M) = (\<integral>\<^sup>+x. f 0 x - (INF i. f i x) \<partial>M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1182
  proof (rule nn_integral_diff[symmetric])
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1183
    have "(\<integral>\<^sup>+ x. (INF i. f i x) \<partial>M) \<le> (\<integral>\<^sup>+ x. f 0 x \<partial>M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1184
      by (intro nn_integral_mono INF_lower) simp
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1185
    with * show "(\<integral>\<^sup>+ x. (INF i. f i x) \<partial>M) \<noteq> \<infinity>"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1186
      by simp
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1187
  qed (auto intro: INF_lower)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1188
  also have "\<dots> = (\<integral>\<^sup>+x. (SUP i. f 0 x - f i x) \<partial>M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1189
    by (simp add: ennreal_INF_const_minus)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1190
  also have "\<dots> = (SUP i. (\<integral>\<^sup>+x. f 0 x - f i x \<partial>M))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1191
  proof (intro nn_integral_monotone_convergence_SUP_AE)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1192
    show "AE x in M. f 0 x - f i x \<le> f 0 x - f (Suc i) x" for i
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1193
      using f[of i] by eventually_elim (auto simp: ennreal_mono_minus)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1194
  qed simp
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1195
  also have "\<dots> = (SUP i. nn_integral M (f 0) - (\<integral>\<^sup>+x. f i x \<partial>M))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1196
  proof (subst nn_integral_diff[symmetric])
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1197
    fix i
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1198
    have dec: "AE x in M. \<forall>i. f (Suc i) x \<le> f i x"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1199
      unfolding AE_all_countable using f by auto
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1200
    then show "AE x in M. f i x \<le> f 0 x"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1201
      using dec by eventually_elim (auto intro: lift_Suc_antimono_le[of "\<lambda>i. f i x" 0 i for x])
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1202
    then have "(\<integral>\<^sup>+ x. f i x \<partial>M) \<le> (\<integral>\<^sup>+ x. f 0 x \<partial>M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1203
      by (rule nn_integral_mono_AE)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1204
    with * show "(\<integral>\<^sup>+ x. f i x \<partial>M) \<noteq> \<infinity>"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1205
      by simp
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1206
  qed (insert f, auto simp: decseq_def le_fun_def)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1207
  finally show "integral\<^sup>N M (f 0) - (\<integral>\<^sup>+ x. (INF i. f i x) \<partial>M) =
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1208
    integral\<^sup>N M (f 0) - (INF i. \<integral>\<^sup>+ x. f i x \<partial>M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1209
    by (simp add: ennreal_INF_const_minus)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1210
qed (insert *, auto intro!: nn_integral_mono intro: INF_lower)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1211
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1212
lemma nn_integral_monotone_convergence_INF_AE:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1213
  fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> ennreal"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1214
  assumes f: "\<And>i. AE x in M. f (Suc i) x \<le> f i x"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1215
    and [measurable]: "\<And>i. f i \<in> borel_measurable M"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1216
    and fin: "(\<integral>\<^sup>+ x. f i x \<partial>M) < \<infinity>"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1217
  shows "(\<integral>\<^sup>+ x. (INF i. f i x) \<partial>M) = (INF i. integral\<^sup>N M (f i))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1218
proof -
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1219
  { fix f :: "nat \<Rightarrow> ennreal" and j assume "decseq f"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1220
    then have "(INF i. f i) = (INF i. f (i + j))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1221
      apply (intro INF_eq)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1222
      apply (rule_tac x="i" in bexI)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1223
      apply (auto simp: decseq_def le_fun_def)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1224
      done }
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1225
  note INF_shift = this
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1226
  have mono: "AE x in M. \<forall>i. f (Suc i) x \<le> f i x"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1227
    using f by (auto simp: AE_all_countable)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1228
  then have "AE x in M. (INF i. f i x) = (INF n. f (n + i) x)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1229
    by eventually_elim (auto intro!: decseq_SucI INF_shift)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1230
  then have "(\<integral>\<^sup>+ x. (INF i. f i x) \<partial>M) = (\<integral>\<^sup>+ x. (INF n. f (n + i) x) \<partial>M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1231
    by (rule nn_integral_cong_AE)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1232
  also have "\<dots> = (INF n. (\<integral>\<^sup>+ x. f (n + i) x \<partial>M))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1233
    by (rule nn_integral_monotone_convergence_INF_AE') (insert assms, auto)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1234
  also have "\<dots> = (INF n. (\<integral>\<^sup>+ x. f n x \<partial>M))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1235
    by (intro INF_shift[symmetric] decseq_SucI nn_integral_mono_AE f)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1236
  finally show ?thesis .
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1237
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1238
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1239
lemma nn_integral_monotone_convergence_INF_decseq:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1240
  assumes f: "decseq f" and *: "\<And>i. f i \<in> borel_measurable M" "(\<integral>\<^sup>+ x. f i x \<partial>M) < \<infinity>"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1241
  shows "(\<integral>\<^sup>+ x. (INF i. f i x) \<partial>M) = (INF i. integral\<^sup>N M (f i))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1242
  using nn_integral_monotone_convergence_INF_AE[of f M i, OF _ *] f by (auto simp: decseq_Suc_iff le_fun_def)
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1243
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1244
lemma nn_integral_liminf:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1245
  fixes u :: "nat \<Rightarrow> 'a \<Rightarrow> ennreal"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1246
  assumes u: "\<And>i. u i \<in> borel_measurable M"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1247
  shows "(\<integral>\<^sup>+ x. liminf (\<lambda>n. u n x) \<partial>M) \<le> liminf (\<lambda>n. integral\<^sup>N M (u n))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1248
proof -
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1249
  have "(\<integral>\<^sup>+ x. liminf (\<lambda>n. u n x) \<partial>M) = (SUP n. \<integral>\<^sup>+ x. (INF i:{n..}. u i x) \<partial>M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1250
    unfolding liminf_SUP_INF using u
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1251
    by (intro nn_integral_monotone_convergence_SUP_AE)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1252
       (auto intro!: AE_I2 intro: INF_greatest INF_superset_mono)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1253
  also have "\<dots> \<le> liminf (\<lambda>n. integral\<^sup>N M (u n))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1254
    by (auto simp: liminf_SUP_INF intro!: SUP_mono INF_greatest nn_integral_mono INF_lower)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1255
  finally show ?thesis .
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1256
qed
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1257
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1258
lemma nn_integral_limsup:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1259
  fixes u :: "nat \<Rightarrow> 'a \<Rightarrow> ennreal"
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1260
  assumes [measurable]: "\<And>i. u i \<in> borel_measurable M" "w \<in> borel_measurable M"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1261
  assumes bounds: "\<And>i. AE x in M. u i x \<le> w x" and w: "(\<integral>\<^sup>+x. w x \<partial>M) < \<infinity>"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1262
  shows "limsup (\<lambda>n. integral\<^sup>N M (u n)) \<le> (\<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M)"
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1263
proof -
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1264
  have bnd: "AE x in M. \<forall>i. u i x \<le> w x"
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1265
    using bounds by (auto simp: AE_all_countable)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1266
  then have "(\<integral>\<^sup>+ x. (SUP n. u n x) \<partial>M) \<le> (\<integral>\<^sup>+ x. w x \<partial>M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1267
    by (auto intro!: nn_integral_mono_AE elim: eventually_mono intro: SUP_least)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1268
  then have "(\<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M) = (INF n. \<integral>\<^sup>+ x. (SUP i:{n..}. u i x) \<partial>M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1269
    unfolding limsup_INF_SUP using bnd w
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1270
    by (intro nn_integral_monotone_convergence_INF_AE')
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1271
       (auto intro!: AE_I2 intro: SUP_least SUP_subset_mono)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1272
  also have "\<dots> \<ge> limsup (\<lambda>n. integral\<^sup>N M (u n))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1273
    by (auto simp: limsup_INF_SUP intro!: INF_mono SUP_least exI nn_integral_mono SUP_upper)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1274
  finally (xtrans) show ?thesis .
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1275
qed
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1276
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1277
lemma nn_integral_LIMSEQ:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1278
  assumes f: "incseq f" "\<And>i. f i \<in> borel_measurable M"
61969
e01015e49041 more symbols;
wenzelm
parents: 61942
diff changeset
  1279
    and u: "\<And>x. (\<lambda>i. f i x) \<longlonglongrightarrow> u x"
e01015e49041 more symbols;
wenzelm
parents: 61942
diff changeset
  1280
  shows "(\<lambda>n. integral\<^sup>N M (f n)) \<longlonglongrightarrow> integral\<^sup>N M u"
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1281
proof -
61969
e01015e49041 more symbols;
wenzelm
parents: 61942
diff changeset
  1282
  have "(\<lambda>n. integral\<^sup>N M (f n)) \<longlonglongrightarrow> (SUP n. integral\<^sup>N M (f n))"
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1283
    using f by (intro LIMSEQ_SUP[of "\<lambda>n. integral\<^sup>N M (f n)"] incseq_nn_integral)
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1284
  also have "(SUP n. integral\<^sup>N M (f n)) = integral\<^sup>N M (\<lambda>x. SUP n. f n x)"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1285
    using f by (intro nn_integral_monotone_convergence_SUP[symmetric])
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1286
  also have "integral\<^sup>N M (\<lambda>x. SUP n. f n x) = integral\<^sup>N M (\<lambda>x. u x)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1287
    using f by (subst LIMSEQ_SUP[THEN LIMSEQ_unique, OF _ u]) (auto simp: incseq_def le_fun_def)
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1288
  finally show ?thesis .
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1289
qed
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1290
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1291
lemma nn_integral_dominated_convergence:
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1292
  assumes [measurable]:
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1293
       "\<And>i. u i \<in> borel_measurable M" "u' \<in> borel_measurable M" "w \<in> borel_measurable M"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1294
    and bound: "\<And>j. AE x in M. u j x \<le> w x"
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1295
    and w: "(\<integral>\<^sup>+x. w x \<partial>M) < \<infinity>"
61969
e01015e49041 more symbols;
wenzelm
parents: 61942
diff changeset
  1296
    and u': "AE x in M. (\<lambda>i. u i x) \<longlonglongrightarrow> u' x"
e01015e49041 more symbols;
wenzelm
parents: 61942
diff changeset
  1297
  shows "(\<lambda>i. (\<integral>\<^sup>+x. u i x \<partial>M)) \<longlonglongrightarrow> (\<integral>\<^sup>+x. u' x \<partial>M)"
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1298
proof -
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1299
  have "limsup (\<lambda>n. integral\<^sup>N M (u n)) \<le> (\<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M)"
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1300
    by (intro nn_integral_limsup[OF _ _ bound w]) auto
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1301
  moreover have "(\<integral>\<^sup>+ x. limsup (\<lambda>n. u n x) \<partial>M) = (\<integral>\<^sup>+ x. u' x \<partial>M)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1302
    using u' by (intro nn_integral_cong_AE, eventually_elim) (metis tendsto_iff_Liminf_eq_Limsup sequentially_bot)
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1303
  moreover have "(\<integral>\<^sup>+ x. liminf (\<lambda>n. u n x) \<partial>M) = (\<integral>\<^sup>+ x. u' x \<partial>M)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1304
    using u' by (intro nn_integral_cong_AE, eventually_elim) (metis tendsto_iff_Liminf_eq_Limsup sequentially_bot)
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1305
  moreover have "(\<integral>\<^sup>+x. liminf (\<lambda>n. u n x) \<partial>M) \<le> liminf (\<lambda>n. integral\<^sup>N M (u n))"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1306
    by (intro nn_integral_liminf) auto
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1307
  moreover have "liminf (\<lambda>n. integral\<^sup>N M (u n)) \<le> limsup (\<lambda>n. integral\<^sup>N M (u n))"
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1308
    by (intro Liminf_le_Limsup sequentially_bot)
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1309
  ultimately show ?thesis
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1310
    by (intro Liminf_eq_Limsup) auto
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1311
qed
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 56949
diff changeset
  1312
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1313
lemma inf_continuous_nn_integral[order_continuous_intros]:
60175
831ddb69db9b add lfp/gfp rule for nn_integral
hoelzl
parents: 60064
diff changeset
  1314
  assumes f: "\<And>y. inf_continuous (f y)"
60614
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60175
diff changeset
  1315
  assumes [measurable]: "\<And>x. (\<lambda>y. f y x) \<in> borel_measurable M"
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60175
diff changeset
  1316
  assumes bnd: "\<And>x. (\<integral>\<^sup>+ y. f y x \<partial>M) \<noteq> \<infinity>"
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60175
diff changeset
  1317
  shows "inf_continuous (\<lambda>x. (\<integral>\<^sup>+y. f y x \<partial>M))"
60175
831ddb69db9b add lfp/gfp rule for nn_integral
hoelzl
parents: 60064
diff changeset
  1318
  unfolding inf_continuous_def
831ddb69db9b add lfp/gfp rule for nn_integral
hoelzl
parents: 60064
diff changeset
  1319
proof safe
60614
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60175
diff changeset
  1320
  fix C :: "nat \<Rightarrow> 'b" assume C: "decseq C"
e39e6881985c generalized inf and sup_continuous; added intro rules
hoelzl
parents: 60175
diff changeset
  1321
  then show "(\<integral>\<^sup>+ y. f y (INFIMUM UNIV C) \<partial>M) = (INF i. \<integral>\<^sup>+ y. f y (C i) \<partial>M)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1322
    using inf_continuous_mono[OF f] bnd
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1323
    by (auto simp add: inf_continuousD[OF f C] fun_eq_iff antimono_def mono_def le_fun_def less_top
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1324
             intro!: nn_integral_monotone_convergence_INF_decseq)
60175
831ddb69db9b add lfp/gfp rule for nn_integral
hoelzl
parents: 60064
diff changeset
  1325
qed
831ddb69db9b add lfp/gfp rule for nn_integral
hoelzl
parents: 60064
diff changeset
  1326
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1327
lemma nn_integral_null_set:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
  1328
  assumes "N \<in> null_sets M" shows "(\<integral>\<^sup>+ x. u x * indicator N x \<partial>M) = 0"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1329
proof -
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
  1330
  have "(\<integral>\<^sup>+ x. u x * indicator N x \<partial>M) = (\<integral>\<^sup>+ x. 0 \<partial>M)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1331
  proof (intro nn_integral_cong_AE AE_I)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1332
    show "{x \<in> space M. u x * indicator N x \<noteq> 0} \<subseteq> N"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1333
      by (auto simp: indicator_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1334
    show "(emeasure M) N = 0" "N \<in> sets M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1335
      using assms by auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1336
  qed
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1337
  then show ?thesis by simp
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1338
qed
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1339
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1340
lemma nn_integral_0_iff:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1341
  assumes u: "u \<in> borel_measurable M"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1342
  shows "integral\<^sup>N M u = 0 \<longleftrightarrow> emeasure M {x\<in>space M. u x \<noteq> 0} = 0"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1343
    (is "_ \<longleftrightarrow> (emeasure M) ?A = 0")
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1344
proof -
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1345
  have u_eq: "(\<integral>\<^sup>+ x. u x * indicator ?A x \<partial>M) = integral\<^sup>N M u"
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1346
    by (auto intro!: nn_integral_cong simp: indicator_def)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1347
  show ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1348
  proof
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1349
    assume "(emeasure M) ?A = 0"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1350
    with nn_integral_null_set[of ?A M u] u
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1351
    show "integral\<^sup>N M u = 0" by (simp add: u_eq null_sets_def)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1352
  next
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1353
    assume *: "integral\<^sup>N M u = 0"
46731
5302e932d1e5 avoid undeclared variables in let bindings;
wenzelm
parents: 46671
diff changeset
  1354
    let ?M = "\<lambda>n. {x \<in> space M. 1 \<le> real (n::nat) * u x}"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1355
    have "0 = (SUP n. (emeasure M) (?M n \<inter> ?A))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1356
    proof -
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
  1357
      { fix n :: nat
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1358
        from nn_integral_Markov_inequality[OF u, of ?A "of_nat n"] u
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1359
        have "(emeasure M) (?M n \<inter> ?A) \<le> 0"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1360
          by (simp add: ennreal_of_nat_eq_real_of_nat u_eq *)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1361
        moreover have "0 \<le> (emeasure M) (?M n \<inter> ?A)" using u by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1362
        ultimately have "(emeasure M) (?M n \<inter> ?A) = 0" by auto }
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1363
      thus ?thesis by simp
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1364
    qed
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1365
    also have "\<dots> = (emeasure M) (\<Union>n. ?M n \<inter> ?A)"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1366
    proof (safe intro!: SUP_emeasure_incseq)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1367
      fix n show "?M n \<inter> ?A \<in> sets M"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
  1368
        using u by (auto intro!: sets.Int)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1369
    next
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
  1370
      show "incseq (\<lambda>n. {x \<in> space M. 1 \<le> real n * u x} \<inter> {x \<in> space M. u x \<noteq> 0})"
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
  1371
      proof (safe intro!: incseq_SucI)
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
  1372
        fix n :: nat and x
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
  1373
        assume *: "1 \<le> real n * u x"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1374
        also have "real n * u x \<le> real (Suc n) * u x"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1375
          by (auto intro!: mult_right_mono)
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
  1376
        finally show "1 \<le> real (Suc n) * u x" by auto
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
  1377
      qed
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1378
    qed
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1379
    also have "\<dots> = (emeasure M) {x\<in>space M. 0 < u x}"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1380
    proof (safe intro!: arg_cong[where f="(emeasure M)"])
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
  1381
      fix x assume "0 < u x" and [simp, intro]: "x \<in> space M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1382
      show "x \<in> (\<Union>n. ?M n \<inter> ?A)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1383
      proof (cases "u x" rule: ennreal_cases)
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1384
        case (real r) with \<open>0 < u x\<close> have "0 < r" by auto
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
  1385
        obtain j :: nat where "1 / r \<le> real j" using real_arch_simple ..
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1386
        hence "1 / r * r \<le> real j * r" unfolding mult_le_cancel_right using \<open>0 < r\<close> by auto
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1387
        hence "1 \<le> real j * r" using real \<open>0 < r\<close> by auto
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1388
        thus ?thesis using \<open>0 < r\<close> real
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1389
          by (auto simp: ennreal_of_nat_eq_real_of_nat ennreal_1[symmetric] ennreal_mult[symmetric]
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1390
                   simp del: ennreal_1)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1391
      qed (insert \<open>0 < u x\<close>, auto simp: ennreal_mult_top)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1392
    qed (auto simp: zero_less_iff_neq_zero)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1393
    finally show "emeasure M ?A = 0"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1394
      by (simp add: zero_less_iff_neq_zero)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1395
  qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1396
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1397
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1398
lemma nn_integral_0_iff_AE:
41705
1100512e16d8 add auto support for AE_mp
hoelzl
parents: 41689
diff changeset
  1399
  assumes u: "u \<in> borel_measurable M"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1400
  shows "integral\<^sup>N M u = 0 \<longleftrightarrow> (AE x in M. u x = 0)"
41705
1100512e16d8 add auto support for AE_mp
hoelzl
parents: 41689
diff changeset
  1401
proof -
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1402
  have sets: "{x\<in>space M. u x \<noteq> 0} \<in> sets M"
41705
1100512e16d8 add auto support for AE_mp
hoelzl
parents: 41689
diff changeset
  1403
    using u by auto
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1404
  show "integral\<^sup>N M u = 0 \<longleftrightarrow> (AE x in M. u x = 0)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1405
    using nn_integral_0_iff[of u] AE_iff_null[OF sets] u by auto
41705
1100512e16d8 add auto support for AE_mp
hoelzl
parents: 41689
diff changeset
  1406
qed
1100512e16d8 add auto support for AE_mp
hoelzl
parents: 41689
diff changeset
  1407
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  1408
lemma AE_iff_nn_integral:
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1409
  "{x\<in>space M. P x} \<in> sets M \<Longrightarrow> (AE x in M. P x) \<longleftrightarrow> integral\<^sup>N M (indicator {x. \<not> P x}) = 0"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1410
  by (subst nn_integral_0_iff_AE) (auto simp: indicator_def[abs_def])
50001
382bd3173584 add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents: 49800
diff changeset
  1411
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1412
lemma nn_integral_less:
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1413
  assumes [measurable]: "f \<in> borel_measurable M" "g \<in> borel_measurable M"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1414
  assumes f: "(\<integral>\<^sup>+x. f x \<partial>M) \<noteq> \<infinity>"
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1415
  assumes ord: "AE x in M. f x \<le> g x" "\<not> (AE x in M. g x \<le> f x)"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1416
  shows "(\<integral>\<^sup>+x. f x \<partial>M) < (\<integral>\<^sup>+x. g x \<partial>M)"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1417
proof -
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1418
  have "0 < (\<integral>\<^sup>+x. g x - f x \<partial>M)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1419
  proof (intro order_le_neq_trans notI)
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1420
    assume "0 = (\<integral>\<^sup>+x. g x - f x \<partial>M)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1421
    then have "AE x in M. g x - f x = 0"
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1422
      using nn_integral_0_iff_AE[of "\<lambda>x. g x - f x" M] by simp
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1423
    with ord(1) have "AE x in M. g x \<le> f x"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1424
      by eventually_elim (auto simp: ennreal_minus_eq_0)
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1425
    with ord show False
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1426
      by simp
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1427
  qed simp
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1428
  also have "\<dots> = (\<integral>\<^sup>+x. g x \<partial>M) - (\<integral>\<^sup>+x. f x \<partial>M)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1429
    using f by (subst nn_integral_diff) (auto simp: ord)
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1430
  finally show ?thesis
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1431
    using f by (auto dest!: ennreal_minus_pos_iff[rotated] simp: less_top)
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1432
qed
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1433
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1434
lemma nn_integral_subalgebra:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1435
  assumes f: "f \<in> borel_measurable N"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1436
  and N: "sets N \<subseteq> sets M" "space N = space M" "\<And>A. A \<in> sets N \<Longrightarrow> emeasure N A = emeasure M A"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1437
  shows "integral\<^sup>N N f = integral\<^sup>N M f"
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1438
proof -
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1439
  have [simp]: "\<And>f :: 'a \<Rightarrow> ennreal. f \<in> borel_measurable N \<Longrightarrow> f \<in> borel_measurable M"
49799
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
  1440
    using N by (auto simp: measurable_def)
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
  1441
  have [simp]: "\<And>P. (AE x in N. P x) \<Longrightarrow> (AE x in M. P x)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1442
    using N by (auto simp add: eventually_ae_filter null_sets_def subset_eq)
49799
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
  1443
  have [simp]: "\<And>A. A \<in> sets N \<Longrightarrow> A \<in> sets M"
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
  1444
    using N by auto
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
  1445
  from f show ?thesis
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
  1446
    apply induct
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1447
    apply (simp_all add: nn_integral_add nn_integral_cmult nn_integral_monotone_convergence_SUP N)
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1448
    apply (auto intro!: nn_integral_cong cong: nn_integral_cong simp: N(2)[symmetric])
49799
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
  1449
    done
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1450
qed
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1451
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1452
lemma nn_integral_nat_function:
50097
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1453
  fixes f :: "'a \<Rightarrow> nat"
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1454
  assumes "f \<in> measurable M (count_space UNIV)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1455
  shows "(\<integral>\<^sup>+x. of_nat (f x) \<partial>M) = (\<Sum>t. emeasure M {x\<in>space M. t < f x})"
50097
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1456
proof -
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62975
diff changeset
  1457
  define F where "F i = {x\<in>space M. i < f x}" for i
50097
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1458
  with assms have [measurable]: "\<And>i. F i \<in> sets M"
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1459
    by auto
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1460
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1461
  { fix x assume "x \<in> space M"
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1462
    have "(\<lambda>i. if i < f x then 1 else 0) sums (of_nat (f x)::real)"
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1463
      using sums_If_finite[of "\<lambda>i. i < f x" "\<lambda>_. 1::real"] by simp
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1464
    then have "(\<lambda>i. ennreal (if i < f x then 1 else 0)) sums of_nat(f x)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1465
      unfolding ennreal_of_nat_eq_real_of_nat
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1466
      by (subst sums_ennreal) auto
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1467
    moreover have "\<And>i. ennreal (if i < f x then 1 else 0) = indicator (F i) x"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1468
      using \<open>x \<in> space M\<close> by (simp add: one_ennreal_def F_def)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1469
    ultimately have "of_nat (f x) = (\<Sum>i. indicator (F i) x :: ennreal)"
50097
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1470
      by (simp add: sums_iff) }
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1471
  then have "(\<integral>\<^sup>+x. of_nat (f x) \<partial>M) = (\<integral>\<^sup>+x. (\<Sum>i. indicator (F i) x) \<partial>M)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1472
    by (simp cong: nn_integral_cong)
50097
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1473
  also have "\<dots> = (\<Sum>i. emeasure M (F i))"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1474
    by (simp add: nn_integral_suminf)
50097
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1475
  finally show ?thesis
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1476
    by (simp add: F_def)
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1477
qed
32973da2d4f7 rules for intergration: integrating nat-functions, integrals on finite measures, constant multiplication
hoelzl
parents: 50027
diff changeset
  1478
60175
831ddb69db9b add lfp/gfp rule for nn_integral
hoelzl
parents: 60064
diff changeset
  1479
lemma nn_integral_lfp:
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1480
  assumes sets[simp]: "\<And>s. sets (M s) = sets N"
60175
831ddb69db9b add lfp/gfp rule for nn_integral
hoelzl
parents: 60064
diff changeset
  1481
  assumes f: "sup_continuous f"
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1482
  assumes g: "sup_continuous g"
60175
831ddb69db9b add lfp/gfp rule for nn_integral
hoelzl
parents: 60064
diff changeset
  1483
  assumes meas: "\<And>F. F \<in> borel_measurable N \<Longrightarrow> f F \<in> borel_measurable N"
831ddb69db9b add lfp/gfp rule for nn_integral
hoelzl
parents: 60064
diff changeset
  1484
  assumes step: "\<And>F s. F \<in> borel_measurable N \<Longrightarrow> integral\<^sup>N (M s) (f F) = g (\<lambda>s. integral\<^sup>N (M s) F) s"
831ddb69db9b add lfp/gfp rule for nn_integral
hoelzl
parents: 60064
diff changeset
  1485
  shows "(\<integral>\<^sup>+\<omega>. lfp f \<omega> \<partial>M s) = lfp g s"
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1486
proof (subst lfp_transfer_bounded[where \<alpha>="\<lambda>F s. \<integral>\<^sup>+x. F x \<partial>M s" and g=g and f=f and P="\<lambda>f. f \<in> borel_measurable N", symmetric])
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1487
  fix C :: "nat \<Rightarrow> 'b \<Rightarrow> ennreal" assume "incseq C" "\<And>i. C i \<in> borel_measurable N"
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1488
  then show "(\<lambda>s. \<integral>\<^sup>+x. (SUP i. C i) x \<partial>M s) = (SUP i. (\<lambda>s. \<integral>\<^sup>+x. C i x \<partial>M s))"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1489
    unfolding SUP_apply[abs_def]
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1490
    by (subst nn_integral_monotone_convergence_SUP)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1491
       (auto simp: mono_def fun_eq_iff intro!: arg_cong2[where f=emeasure] cong: measurable_cong_sets)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1492
qed (auto simp add: step le_fun_def SUP_apply[abs_def] bot_fun_def bot_ennreal intro!: meas f g)
60175
831ddb69db9b add lfp/gfp rule for nn_integral
hoelzl
parents: 60064
diff changeset
  1493
831ddb69db9b add lfp/gfp rule for nn_integral
hoelzl
parents: 60064
diff changeset
  1494
lemma nn_integral_gfp:
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1495
  assumes sets[simp]: "\<And>s. sets (M s) = sets N"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1496
  assumes f: "inf_continuous f" and g: "inf_continuous g"
60175
831ddb69db9b add lfp/gfp rule for nn_integral
hoelzl
parents: 60064
diff changeset
  1497
  assumes meas: "\<And>F. F \<in> borel_measurable N \<Longrightarrow> f F \<in> borel_measurable N"
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1498
  assumes bound: "\<And>F s. F \<in> borel_measurable N \<Longrightarrow> (\<integral>\<^sup>+x. f F x \<partial>M s) < \<infinity>"
60175
831ddb69db9b add lfp/gfp rule for nn_integral
hoelzl
parents: 60064
diff changeset
  1499
  assumes non_zero: "\<And>s. emeasure (M s) (space (M s)) \<noteq> 0"
831ddb69db9b add lfp/gfp rule for nn_integral
hoelzl
parents: 60064
diff changeset
  1500
  assumes step: "\<And>F s. F \<in> borel_measurable N \<Longrightarrow> integral\<^sup>N (M s) (f F) = g (\<lambda>s. integral\<^sup>N (M s) F) s"
831ddb69db9b add lfp/gfp rule for nn_integral
hoelzl
parents: 60064
diff changeset
  1501
  shows "(\<integral>\<^sup>+\<omega>. gfp f \<omega> \<partial>M s) = gfp g s"
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1502
proof (subst gfp_transfer_bounded[where \<alpha>="\<lambda>F s. \<integral>\<^sup>+x. F x \<partial>M s" and g=g and f=f
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1503
    and P="\<lambda>F. F \<in> borel_measurable N \<and> (\<forall>s. (\<integral>\<^sup>+x. F x \<partial>M s) < \<infinity>)", symmetric])
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1504
  fix C :: "nat \<Rightarrow> 'b \<Rightarrow> ennreal" assume "decseq C" "\<And>i. C i \<in> borel_measurable N \<and> (\<forall>s. integral\<^sup>N (M s) (C i) < \<infinity>)"
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1505
  then show "(\<lambda>s. \<integral>\<^sup>+x. (INF i. C i) x \<partial>M s) = (INF i. (\<lambda>s. \<integral>\<^sup>+x. C i x \<partial>M s))"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1506
    unfolding INF_apply[abs_def]
61359
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61169
diff changeset
  1507
    by (subst nn_integral_monotone_convergence_INF_decseq)
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1508
       (auto simp: mono_def fun_eq_iff intro!: arg_cong2[where f=emeasure] cong: measurable_cong_sets)
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1509
next
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1510
  show "\<And>x. g x \<le> (\<lambda>s. integral\<^sup>N (M s) (f top))"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1511
    by (subst step)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1512
       (auto simp add: top_fun_def less_le non_zero le_fun_def ennreal_top_mult
63566
e5abbdee461a more accurate cong del;
wenzelm
parents: 63540
diff changeset
  1513
             cong del: if_weak_cong intro!: monoD[OF inf_continuous_mono[OF g], THEN le_funD])
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1514
next
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1515
  fix C assume "\<And>i::nat. C i \<in> borel_measurable N \<and> (\<forall>s. integral\<^sup>N (M s) (C i) < \<infinity>)" "decseq C"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1516
  with bound show "INFIMUM UNIV C \<in> borel_measurable N \<and> (\<forall>s. integral\<^sup>N (M s) (INFIMUM UNIV C) < \<infinity>)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1517
    unfolding INF_apply[abs_def]
61359
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61169
diff changeset
  1518
    by (subst nn_integral_monotone_convergence_INF_decseq)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1519
       (auto simp: INF_less_iff cong: measurable_cong_sets intro!: borel_measurable_INF)
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1520
next
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1521
  show "\<And>x. x \<in> borel_measurable N \<and> (\<forall>s. integral\<^sup>N (M s) x < \<infinity>) \<Longrightarrow>
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1522
         (\<lambda>s. integral\<^sup>N (M s) (f x)) = g (\<lambda>s. integral\<^sup>N (M s) x)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1523
    by (subst step) auto
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60614
diff changeset
  1524
qed (insert bound, auto simp add: le_fun_def INF_apply[abs_def] top_fun_def intro!: meas f g)
60175
831ddb69db9b add lfp/gfp rule for nn_integral
hoelzl
parents: 60064
diff changeset
  1525
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1526
subsection \<open>Integral under concrete measures\<close>
56994
8d5e5ec1cac3 fixed document generation for HOL-Probability
hoelzl
parents: 56993
diff changeset
  1527
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63167
diff changeset
  1528
lemma nn_integral_mono_measure:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63167
diff changeset
  1529
  assumes "sets M = sets N" "M \<le> N" shows "nn_integral M f \<le> nn_integral N f"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63167
diff changeset
  1530
  unfolding nn_integral_def
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63167
diff changeset
  1531
proof (intro SUP_subset_mono)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63167
diff changeset
  1532
  note \<open>sets M = sets N\<close>[simp]  \<open>sets M = sets N\<close>[THEN sets_eq_imp_space_eq, simp]
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63167
diff changeset
  1533
  show "{g. simple_function M g \<and> g \<le> f} \<subseteq> {g. simple_function N g \<and> g \<le> f}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63167
diff changeset
  1534
    by (simp add: simple_function_def)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63167
diff changeset
  1535
  show "integral\<^sup>S M x \<le> integral\<^sup>S N x" for x
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63167
diff changeset
  1536
    using le_measureD3[OF \<open>M \<le> N\<close>]
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63167
diff changeset
  1537
    by (auto simp add: simple_integral_def intro!: setsum_mono mult_mono)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63167
diff changeset
  1538
qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63167
diff changeset
  1539
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  1540
lemma nn_integral_empty:
60064
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1541
  assumes "space M = {}"
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1542
  shows "nn_integral M f = 0"
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1543
proof -
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1544
  have "(\<integral>\<^sup>+ x. f x \<partial>M) = (\<integral>\<^sup>+ x. 0 \<partial>M)"
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1545
    by(rule nn_integral_cong)(simp add: assms)
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1546
  thus ?thesis by simp
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1547
qed
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1548
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63167
diff changeset
  1549
lemma nn_integral_bot[simp]: "nn_integral bot f = 0"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63167
diff changeset
  1550
  by (simp add: nn_integral_empty)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63167
diff changeset
  1551
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1552
subsubsection \<open>Distributions\<close>
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1553
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1554
lemma nn_integral_distr:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1555
  assumes T: "T \<in> measurable M M'" and f: "f \<in> borel_measurable (distr M M' T)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1556
  shows "integral\<^sup>N (distr M M' T) f = (\<integral>\<^sup>+ x. f (T x) \<partial>M)"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  1557
  using f
49797
28066863284c add induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49796
diff changeset
  1558
proof induct
28066863284c add induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49796
diff changeset
  1559
  case (cong f g)
49799
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
  1560
  with T show ?case
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1561
    apply (subst nn_integral_cong[of _ f g])
49799
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
  1562
    apply simp
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1563
    apply (subst nn_integral_cong[of _ "\<lambda>x. f (T x)" "\<lambda>x. g (T x)"])
49799
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
  1564
    apply (simp add: measurable_def Pi_iff)
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
  1565
    apply simp
49797
28066863284c add induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49796
diff changeset
  1566
    done
28066863284c add induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49796
diff changeset
  1567
next
28066863284c add induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49796
diff changeset
  1568
  case (set A)
28066863284c add induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49796
diff changeset
  1569
  then have eq: "\<And>x. x \<in> space M \<Longrightarrow> indicator A (T x) = indicator (T -` A \<inter> space M) x"
28066863284c add induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49796
diff changeset
  1570
    by (auto simp: indicator_def)
28066863284c add induction rules for simple functions and for Borel measurable functions
hoelzl
parents: 49796
diff changeset
  1571
  from set T show ?case
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1572
    by (subst nn_integral_cong[OF eq])
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1573
       (auto simp add: emeasure_distr intro!: nn_integral_indicator[symmetric] measurable_sets)
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1574
qed (simp_all add: measurable_compose[OF T] T nn_integral_cmult nn_integral_add
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1575
                   nn_integral_monotone_convergence_SUP le_fun_def incseq_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1576
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1577
subsubsection \<open>Counting space\<close>
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1578
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1579
lemma simple_function_count_space[simp]:
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1580
  "simple_function (count_space A) f \<longleftrightarrow> finite (f ` A)"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1581
  unfolding simple_function_def by simp
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1582
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1583
lemma nn_integral_count_space:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1584
  assumes A: "finite {a\<in>A. 0 < f a}"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1585
  shows "integral\<^sup>N (count_space A) f = (\<Sum>a|a\<in>A \<and> 0 < f a. f a)"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1586
proof -
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
  1587
  have *: "(\<integral>\<^sup>+x. max 0 (f x) \<partial>count_space A) =
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
  1588
    (\<integral>\<^sup>+ x. (\<Sum>a|a\<in>A \<and> 0 < f a. f a * indicator {a} x) \<partial>count_space A)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1589
    by (auto intro!: nn_integral_cong
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57275
diff changeset
  1590
             simp add: indicator_def if_distrib setsum.If_cases[OF A] max_def le_less)
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
  1591
  also have "\<dots> = (\<Sum>a|a\<in>A \<and> 0 < f a. \<integral>\<^sup>+ x. f a * indicator {a} x \<partial>count_space A)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1592
    by (subst nn_integral_setsum) (simp_all add: AE_count_space  less_imp_le)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1593
  also have "\<dots> = (\<Sum>a|a\<in>A \<and> 0 < f a. f a)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1594
    by (auto intro!: setsum.cong simp: one_ennreal_def[symmetric] max_def)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1595
  finally show ?thesis by (simp add: max.absorb2)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1596
qed
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1597
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1598
lemma nn_integral_count_space_finite:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1599
    "finite A \<Longrightarrow> (\<integral>\<^sup>+x. f x \<partial>count_space A) = (\<Sum>a\<in>A. f a)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1600
  by (auto intro!: setsum.mono_neutral_left simp: nn_integral_count_space less_le)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1601
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1602
lemma nn_integral_count_space':
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1603
  assumes "finite A" "\<And>x. x \<in> B \<Longrightarrow> x \<notin> A \<Longrightarrow> f x = 0" "A \<subseteq> B"
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1604
  shows "(\<integral>\<^sup>+x. f x \<partial>count_space B) = (\<Sum>x\<in>A. f x)"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1605
proof -
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1606
  have "(\<integral>\<^sup>+x. f x \<partial>count_space B) = (\<Sum>a | a \<in> B \<and> 0 < f a. f a)"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1607
    using assms(2,3)
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1608
    by (intro nn_integral_count_space finite_subset[OF _ \<open>finite A\<close>]) (auto simp: less_le)
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1609
  also have "\<dots> = (\<Sum>a\<in>A. f a)"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1610
    using assms by (intro setsum.mono_neutral_cong_left) (auto simp: less_le)
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1611
  finally show ?thesis .
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1612
qed
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1613
59011
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59002
diff changeset
  1614
lemma nn_integral_bij_count_space:
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59002
diff changeset
  1615
  assumes g: "bij_betw g A B"
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59002
diff changeset
  1616
  shows "(\<integral>\<^sup>+x. f (g x) \<partial>count_space A) = (\<integral>\<^sup>+x. f x \<partial>count_space B)"
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59002
diff changeset
  1617
  using g[THEN bij_betw_imp_funcset]
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59002
diff changeset
  1618
  by (subst distr_bij_count_space[OF g, symmetric])
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59002
diff changeset
  1619
     (auto intro!: nn_integral_distr[symmetric])
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59002
diff changeset
  1620
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1621
lemma nn_integral_indicator_finite:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1622
  fixes f :: "'a \<Rightarrow> ennreal"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1623
  assumes f: "finite A" and [measurable]: "\<And>a. a \<in> A \<Longrightarrow> {a} \<in> sets M"
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1624
  shows "(\<integral>\<^sup>+x. f x * indicator A x \<partial>M) = (\<Sum>x\<in>A. f x * emeasure M {x})"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1625
proof -
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1626
  from f have "(\<integral>\<^sup>+x. f x * indicator A x \<partial>M) = (\<integral>\<^sup>+x. (\<Sum>a\<in>A. f a * indicator {a} x) \<partial>M)"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1627
    by (intro nn_integral_cong) (auto simp: indicator_def if_distrib[where f="\<lambda>a. x * a" for x] setsum.If_cases)
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1628
  also have "\<dots> = (\<Sum>a\<in>A. f a * emeasure M {a})"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1629
    by (subst nn_integral_setsum) auto
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1630
  finally show ?thesis .
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1631
qed
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1632
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1633
lemma nn_integral_count_space_nat:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1634
  fixes f :: "nat \<Rightarrow> ennreal"
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1635
  shows "(\<integral>\<^sup>+i. f i \<partial>count_space UNIV) = (\<Sum>i. f i)"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1636
proof -
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1637
  have "(\<integral>\<^sup>+i. f i \<partial>count_space UNIV) =
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1638
    (\<integral>\<^sup>+i. (\<Sum>j. f j * indicator {j} i) \<partial>count_space UNIV)"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1639
  proof (intro nn_integral_cong)
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1640
    fix i
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1641
    have "f i = (\<Sum>j\<in>{i}. f j * indicator {j} i)"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1642
      by simp
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1643
    also have "\<dots> = (\<Sum>j. f j * indicator {j} i)"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1644
      by (rule suminf_finite[symmetric]) auto
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1645
    finally show "f i = (\<Sum>j. f j * indicator {j} i)" .
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1646
  qed
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1647
  also have "\<dots> = (\<Sum>j. (\<integral>\<^sup>+i. f j * indicator {j} i \<partial>count_space UNIV))"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1648
    by (rule nn_integral_suminf) auto
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1649
  finally show ?thesis
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1650
    by simp
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1651
qed
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1652
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1653
lemma nn_integral_enat_function:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1654
  assumes f: "f \<in> measurable M (count_space UNIV)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1655
  shows "(\<integral>\<^sup>+ x. ennreal_of_enat (f x) \<partial>M) = (\<Sum>t. emeasure M {x \<in> space M. t < f x})"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1656
proof -
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62975
diff changeset
  1657
  define F where "F i = {x\<in>space M. i < f x}" for i :: nat
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1658
  with assms have [measurable]: "\<And>i. F i \<in> sets M"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1659
    by auto
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1660
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1661
  { fix x assume "x \<in> space M"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1662
    have "(\<lambda>i::nat. if i < f x then 1 else 0) sums ennreal_of_enat (f x)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1663
      using sums_If_finite[of "\<lambda>r. r < f x" "\<lambda>_. 1 :: ennreal"]
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1664
      by (cases "f x") (simp_all add: sums_def of_nat_tendsto_top_ennreal)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1665
    also have "(\<lambda>i. (if i < f x then 1 else 0)) = (\<lambda>i. indicator (F i) x)"
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 63092
diff changeset
  1666
      using \<open>x \<in> space M\<close> by (simp add: one_ennreal_def F_def fun_eq_iff)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1667
    finally have "ennreal_of_enat (f x) = (\<Sum>i. indicator (F i) x)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1668
      by (simp add: sums_iff) }
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1669
  then have "(\<integral>\<^sup>+x. ennreal_of_enat (f x) \<partial>M) = (\<integral>\<^sup>+x. (\<Sum>i. indicator (F i) x) \<partial>M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1670
    by (simp cong: nn_integral_cong)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1671
  also have "\<dots> = (\<Sum>i. emeasure M (F i))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1672
    by (simp add: nn_integral_suminf)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1673
  finally show ?thesis
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1674
    by (simp add: F_def)
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1675
qed
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1676
59426
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1677
lemma nn_integral_count_space_nn_integral:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1678
  fixes f :: "'i \<Rightarrow> 'a \<Rightarrow> ennreal"
59426
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1679
  assumes "countable I" and [measurable]: "\<And>i. i \<in> I \<Longrightarrow> f i \<in> borel_measurable M"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1680
  shows "(\<integral>\<^sup>+x. \<integral>\<^sup>+i. f i x \<partial>count_space I \<partial>M) = (\<integral>\<^sup>+i. \<integral>\<^sup>+x. f i x \<partial>M \<partial>count_space I)"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1681
proof cases
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1682
  assume "finite I" then show ?thesis
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1683
    by (simp add: nn_integral_count_space_finite nn_integral_setsum)
59426
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1684
next
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1685
  assume "infinite I"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1686
  then have [simp]: "I \<noteq> {}"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1687
    by auto
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1688
  note * = bij_betw_from_nat_into[OF \<open>countable I\<close> \<open>infinite I\<close>]
59426
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1689
  have **: "\<And>f. (\<And>i. 0 \<le> f i) \<Longrightarrow> (\<integral>\<^sup>+i. f i \<partial>count_space I) = (\<Sum>n. f (from_nat_into I n))"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1690
    by (simp add: nn_integral_bij_count_space[symmetric, OF *] nn_integral_count_space_nat)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1691
  show ?thesis
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1692
    by (simp add: ** nn_integral_suminf from_nat_into)
59426
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1693
qed
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1694
64008
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63918
diff changeset
  1695
lemma of_bool_Bex_eq_nn_integral:
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63918
diff changeset
  1696
  assumes unique: "\<And>x y. x \<in> X \<Longrightarrow> y \<in> X \<Longrightarrow> P x \<Longrightarrow> P y \<Longrightarrow> x = y"
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63918
diff changeset
  1697
  shows "of_bool (\<exists>y\<in>X. P y) = (\<integral>\<^sup>+y. of_bool (P y) \<partial>count_space X)"
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63918
diff changeset
  1698
proof cases
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63918
diff changeset
  1699
  assume "\<exists>y\<in>X. P y"
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63918
diff changeset
  1700
  then obtain y where "P y" "y \<in> X" by auto
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63918
diff changeset
  1701
  then show ?thesis
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63918
diff changeset
  1702
    by (subst nn_integral_count_space'[where A="{y}"]) (auto dest: unique)
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63918
diff changeset
  1703
qed (auto cong: nn_integral_cong_simp)
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63918
diff changeset
  1704
59426
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1705
lemma emeasure_UN_countable:
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  1706
  assumes sets[measurable]: "\<And>i. i \<in> I \<Longrightarrow> X i \<in> sets M" and I[simp]: "countable I"
59426
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1707
  assumes disj: "disjoint_family_on X I"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1708
  shows "emeasure M (UNION I X) = (\<integral>\<^sup>+i. emeasure M (X i) \<partial>count_space I)"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1709
proof -
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1710
  have eq: "\<And>x. indicator (UNION I X) x = \<integral>\<^sup>+ i. indicator (X i) x \<partial>count_space I"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  1711
  proof cases
59426
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1712
    fix x assume x: "x \<in> UNION I X"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1713
    then obtain j where j: "x \<in> X j" "j \<in> I"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1714
      by auto
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1715
    with disj have "\<And>i. i \<in> I \<Longrightarrow> indicator (X i) x = (indicator {j} i::ennreal)"
59426
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1716
      by (auto simp: disjoint_family_on_def split: split_indicator)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1717
    with x j show "?thesis x"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1718
      by (simp cong: nn_integral_cong_simp)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1719
  qed (auto simp: nn_integral_0_iff_AE)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1720
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1721
  note sets.countable_UN'[unfolded subset_eq, measurable]
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1722
  have "emeasure M (UNION I X) = (\<integral>\<^sup>+x. indicator (UNION I X) x \<partial>M)"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1723
    by simp
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1724
  also have "\<dots> = (\<integral>\<^sup>+i. \<integral>\<^sup>+x. indicator (X i) x \<partial>M \<partial>count_space I)"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1725
    by (simp add: eq nn_integral_count_space_nn_integral)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1726
  finally show ?thesis
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1727
    by (simp cong: nn_integral_cong_simp)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1728
qed
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59425
diff changeset
  1729
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1730
lemma emeasure_countable_singleton:
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1731
  assumes sets: "\<And>x. x \<in> X \<Longrightarrow> {x} \<in> sets M" and X: "countable X"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1732
  shows "emeasure M X = (\<integral>\<^sup>+x. emeasure M {x} \<partial>count_space X)"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1733
proof -
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1734
  have "emeasure M (\<Union>i\<in>X. {i}) = (\<integral>\<^sup>+x. emeasure M {x} \<partial>count_space X)"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1735
    using assms by (intro emeasure_UN_countable) (auto simp: disjoint_family_on_def)
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1736
  also have "(\<Union>i\<in>X. {i}) = X" by auto
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1737
  finally show ?thesis .
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1738
qed
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1739
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1740
lemma measure_eqI_countable:
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1741
  assumes [simp]: "sets M = Pow A" "sets N = Pow A" and A: "countable A"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1742
  assumes eq: "\<And>a. a \<in> A \<Longrightarrow> emeasure M {a} = emeasure N {a}"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1743
  shows "M = N"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1744
proof (rule measure_eqI)
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1745
  fix X assume "X \<in> sets M"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1746
  then have X: "X \<subseteq> A" by auto
63540
f8652d0534fa tuned proofs -- avoid unstructured calculation;
wenzelm
parents: 63333
diff changeset
  1747
  moreover from A X have "countable X" by (auto dest: countable_subset)
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1748
  ultimately have
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1749
    "emeasure M X = (\<integral>\<^sup>+a. emeasure M {a} \<partial>count_space X)"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1750
    "emeasure N X = (\<integral>\<^sup>+a. emeasure N {a} \<partial>count_space X)"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1751
    by (auto intro!: emeasure_countable_singleton)
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1752
  moreover have "(\<integral>\<^sup>+a. emeasure M {a} \<partial>count_space X) = (\<integral>\<^sup>+a. emeasure N {a} \<partial>count_space X)"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1753
    using X by (intro nn_integral_cong eq) auto
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1754
  ultimately show "emeasure M X = emeasure N X"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1755
    by simp
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1756
qed simp
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
  1757
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1758
lemma measure_eqI_countable_AE:
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1759
  assumes [simp]: "sets M = UNIV" "sets N = UNIV"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1760
  assumes ae: "AE x in M. x \<in> \<Omega>" "AE x in N. x \<in> \<Omega>" and [simp]: "countable \<Omega>"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1761
  assumes eq: "\<And>x. x \<in> \<Omega> \<Longrightarrow> emeasure M {x} = emeasure N {x}"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1762
  shows "M = N"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1763
proof (rule measure_eqI)
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1764
  fix A
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1765
  have "emeasure N A = emeasure N {x\<in>\<Omega>. x \<in> A}"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1766
    using ae by (intro emeasure_eq_AE) auto
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1767
  also have "\<dots> = (\<integral>\<^sup>+x. emeasure N {x} \<partial>count_space {x\<in>\<Omega>. x \<in> A})"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1768
    by (intro emeasure_countable_singleton) auto
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1769
  also have "\<dots> = (\<integral>\<^sup>+x. emeasure M {x} \<partial>count_space {x\<in>\<Omega>. x \<in> A})"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1770
    by (intro nn_integral_cong eq[symmetric]) auto
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1771
  also have "\<dots> = emeasure M {x\<in>\<Omega>. x \<in> A}"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1772
    by (intro emeasure_countable_singleton[symmetric]) auto
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1773
  also have "\<dots> = emeasure M A"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1774
    using ae by (intro emeasure_eq_AE) auto
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1775
  finally show "emeasure M A = emeasure N A" ..
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1776
qed simp
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1777
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1778
lemma nn_integral_monotone_convergence_SUP_nat:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1779
  fixes f :: "'a \<Rightarrow> nat \<Rightarrow> ennreal"
60064
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1780
  assumes chain: "Complete_Partial_Order.chain op \<le> (f ` Y)"
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1781
  and nonempty: "Y \<noteq> {}"
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1782
  shows "(\<integral>\<^sup>+ x. (SUP i:Y. f i x) \<partial>count_space UNIV) = (SUP i:Y. (\<integral>\<^sup>+ x. f i x \<partial>count_space UNIV))"
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1783
  (is "?lhs = ?rhs" is "integral\<^sup>N ?M _ = _")
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1784
proof (rule order_class.order.antisym)
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1785
  show "?rhs \<le> ?lhs"
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1786
    by (auto intro!: SUP_least SUP_upper nn_integral_mono)
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1787
next
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1788
  have "\<exists>g. incseq g \<and> range g \<subseteq> (\<lambda>i. f i x) ` Y \<and> (SUP i:Y. f i x) = (SUP i. g i)" for x
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1789
    by (rule ennreal_Sup_countable_SUP) (simp add: nonempty)
60064
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1790
  then obtain g where incseq: "\<And>x. incseq (g x)"
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1791
    and range: "\<And>x. range (g x) \<subseteq> (\<lambda>i. f i x) ` Y"
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1792
    and sup: "\<And>x. (SUP i:Y. f i x) = (SUP i. g x i)" by moura
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1793
  from incseq have incseq': "incseq (\<lambda>i x. g x i)"
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1794
    by(blast intro: incseq_SucI le_funI dest: incseq_SucD)
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1795
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1796
  have "?lhs = \<integral>\<^sup>+ x. (SUP i. g x i) \<partial>?M" by(simp add: sup)
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1797
  also have "\<dots> = (SUP i. \<integral>\<^sup>+ x. g x i \<partial>?M)" using incseq'
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1798
    by(rule nn_integral_monotone_convergence_SUP) simp
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1799
  also have "\<dots> \<le> (SUP i:Y. \<integral>\<^sup>+ x. f i x \<partial>?M)"
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1800
  proof(rule SUP_least)
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1801
    fix n
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1802
    have "\<And>x. \<exists>i. g x n = f i x \<and> i \<in> Y" using range by blast
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1803
    then obtain I where I: "\<And>x. g x n = f (I x) x" "\<And>x. I x \<in> Y" by moura
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1804
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1805
    have "(\<integral>\<^sup>+ x. g x n \<partial>count_space UNIV) = (\<Sum>x. g x n)"
60064
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1806
      by(rule nn_integral_count_space_nat)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1807
    also have "\<dots> = (SUP m. \<Sum>x<m. g x n)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1808
      by(rule suminf_eq_SUP)
60064
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1809
    also have "\<dots> \<le> (SUP i:Y. \<integral>\<^sup>+ x. f i x \<partial>?M)"
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1810
    proof(rule SUP_mono)
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1811
      fix m
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1812
      show "\<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> (\<integral>\<^sup>+ x. f m' x \<partial>?M)"
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1813
      proof(cases "m > 0")
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1814
        case False
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1815
        thus ?thesis using nonempty by auto
60064
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1816
      next
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1817
        case True
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1818
        let ?Y = "I ` {..<m}"
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1819
        have "f ` ?Y \<subseteq> f ` Y" using I by auto
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1820
        with chain have chain': "Complete_Partial_Order.chain op \<le> (f ` ?Y)" by(rule chain_subset)
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1821
        hence "Sup (f ` ?Y) \<in> f ` ?Y"
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1822
          by(rule ccpo_class.in_chain_finite)(auto simp add: True lessThan_empty_iff)
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1823
        then obtain m' where "m' < m" and m': "(SUP i:?Y. f i) = f (I m')" by auto
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1824
        have "I m' \<in> Y" using I by blast
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1825
        have "(\<Sum>x<m. g x n) \<le> (\<Sum>x<m. f (I m') x)"
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1826
        proof(rule setsum_mono)
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1827
          fix x
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1828
          assume "x \<in> {..<m}"
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1829
          hence "x < m" by simp
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1830
          have "g x n = f (I x) x" by(simp add: I)
62343
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 62083
diff changeset
  1831
          also have "\<dots> \<le> (SUP i:?Y. f i) x" unfolding Sup_fun_def image_image
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 62083
diff changeset
  1832
            using \<open>x \<in> {..<m}\<close> by (rule Sup_upper [OF imageI])
60064
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1833
          also have "\<dots> = f (I m') x" unfolding m' by simp
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1834
          finally show "g x n \<le> f (I m') x" .
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1835
        qed
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1836
        also have "\<dots> \<le> (SUP m. (\<Sum>x<m. f (I m') x))"
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1837
          by(rule SUP_upper) simp
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1838
        also have "\<dots> = (\<Sum>x. f (I m') x)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1839
          by(rule suminf_eq_SUP[symmetric])
60064
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1840
        also have "\<dots> = (\<integral>\<^sup>+ x. f (I m') x \<partial>?M)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1841
          by(rule nn_integral_count_space_nat[symmetric])
60064
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1842
        finally show ?thesis using \<open>I m' \<in> Y\<close> by blast
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1843
      qed
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1844
    qed
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1845
    finally show "(\<integral>\<^sup>+ x. g x n \<partial>count_space UNIV) \<le> \<dots>" .
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1846
  qed
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1847
  finally show "?lhs \<le> ?rhs" .
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1848
qed
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1849
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1850
lemma power_series_tendsto_at_left:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1851
  assumes nonneg: "\<And>i. 0 \<le> f i" and summable: "\<And>z. 0 \<le> z \<Longrightarrow> z < 1 \<Longrightarrow> summable (\<lambda>n. f n * z^n)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1852
  shows "((\<lambda>z. ennreal (\<Sum>n. f n * z^n)) \<longlongrightarrow> (\<Sum>n. ennreal (f n))) (at_left (1::real))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1853
proof (intro tendsto_at_left_sequentially)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1854
  show "0 < (1::real)" by simp
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1855
  fix S :: "nat \<Rightarrow> real" assume S: "\<And>n. S n < 1" "\<And>n. 0 < S n" "S \<longlonglongrightarrow> 1" "incseq S"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1856
  then have S_nonneg: "\<And>i. 0 \<le> S i" by (auto intro: less_imp_le)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1857
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1858
  have "(\<lambda>i. (\<integral>\<^sup>+n. f n * S i^n \<partial>count_space UNIV)) \<longlonglongrightarrow> (\<integral>\<^sup>+n. ennreal (f n) \<partial>count_space UNIV)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1859
  proof (rule nn_integral_LIMSEQ)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1860
    show "incseq (\<lambda>i n. ennreal (f n * S i^n))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1861
      using S by (auto intro!: mult_mono power_mono nonneg ennreal_leI
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1862
                       simp: incseq_def le_fun_def less_imp_le)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1863
    fix n have "(\<lambda>i. ennreal (f n * S i^n)) \<longlonglongrightarrow> ennreal (f n * 1^n)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1864
      by (intro tendsto_intros tendsto_ennrealI S)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1865
    then show "(\<lambda>i. ennreal (f n * S i^n)) \<longlonglongrightarrow> ennreal (f n)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1866
      by simp
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1867
  qed (auto simp: S_nonneg intro!: mult_nonneg_nonneg nonneg)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1868
  also have "(\<lambda>i. (\<integral>\<^sup>+n. f n * S i^n \<partial>count_space UNIV)) = (\<lambda>i. \<Sum>n. f n * S i^n)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1869
    by (subst nn_integral_count_space_nat)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1870
       (intro ext suminf_ennreal2 mult_nonneg_nonneg nonneg S_nonneg
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1871
              zero_le_power summable S)+
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1872
  also have "(\<integral>\<^sup>+n. ennreal (f n) \<partial>count_space UNIV) = (\<Sum>n. ennreal (f n))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1873
    by (simp add: nn_integral_count_space_nat nonneg)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1874
  finally show "(\<lambda>n. ennreal (\<Sum>na. f na * S n ^ na)) \<longlonglongrightarrow> (\<Sum>n. ennreal (f n))" .
60064
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1875
qed
63124d48a2ee add lemma about monotone convergence for countable integrals over arbitrary sequences
Andreas Lochbihler
parents: 59779
diff changeset
  1876
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1877
subsubsection \<open>Measures with Restricted Space\<close>
54417
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 54230
diff changeset
  1878
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1879
lemma simple_function_restrict_space_ennreal:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1880
  fixes f :: "'a \<Rightarrow> ennreal"
57137
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1881
  assumes "\<Omega> \<inter> space M \<in> sets M"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1882
  shows "simple_function (restrict_space M \<Omega>) f \<longleftrightarrow> simple_function M (\<lambda>x. f x * indicator \<Omega> x)"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1883
proof -
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1884
  { assume "finite (f ` space (restrict_space M \<Omega>))"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1885
    then have "finite (f ` space (restrict_space M \<Omega>) \<union> {0})" by simp
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1886
    then have "finite ((\<lambda>x. f x * indicator \<Omega> x) ` space M)"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1887
      by (rule rev_finite_subset) (auto split: split_indicator simp: space_restrict_space) }
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1888
  moreover
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1889
  { assume "finite ((\<lambda>x. f x * indicator \<Omega> x) ` space M)"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1890
    then have "finite (f ` space (restrict_space M \<Omega>))"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1891
      by (rule rev_finite_subset) (auto split: split_indicator simp: space_restrict_space) }
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1892
  ultimately show ?thesis
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1893
    unfolding
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1894
      simple_function_iff_borel_measurable borel_measurable_restrict_space_iff_ennreal[OF assms]
57137
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1895
    by auto
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1896
qed
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1897
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1898
lemma simple_function_restrict_space:
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1899
  fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1900
  assumes "\<Omega> \<inter> space M \<in> sets M"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1901
  shows "simple_function (restrict_space M \<Omega>) f \<longleftrightarrow> simple_function M (\<lambda>x. indicator \<Omega> x *\<^sub>R f x)"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1902
proof -
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1903
  { assume "finite (f ` space (restrict_space M \<Omega>))"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1904
    then have "finite (f ` space (restrict_space M \<Omega>) \<union> {0})" by simp
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1905
    then have "finite ((\<lambda>x. indicator \<Omega> x *\<^sub>R f x) ` space M)"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1906
      by (rule rev_finite_subset) (auto split: split_indicator simp: space_restrict_space) }
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1907
  moreover
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1908
  { assume "finite ((\<lambda>x. indicator \<Omega> x *\<^sub>R f x) ` space M)"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1909
    then have "finite (f ` space (restrict_space M \<Omega>))"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1910
      by (rule rev_finite_subset) (auto split: split_indicator simp: space_restrict_space) }
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1911
  ultimately show ?thesis
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1912
    unfolding simple_function_iff_borel_measurable
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1913
      borel_measurable_restrict_space_iff[OF assms]
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1914
    by auto
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1915
qed
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1916
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1917
lemma simple_integral_restrict_space:
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1918
  assumes \<Omega>: "\<Omega> \<inter> space M \<in> sets M" "simple_function (restrict_space M \<Omega>) f"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1919
  shows "simple_integral (restrict_space M \<Omega>) f = simple_integral M (\<lambda>x. f x * indicator \<Omega> x)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1920
  using simple_function_restrict_space_ennreal[THEN iffD1, OF \<Omega>, THEN simple_functionD(1)]
57137
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1921
  by (auto simp add: space_restrict_space emeasure_restrict_space[OF \<Omega>(1)] le_infI2 simple_integral_def
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1922
           split: split_indicator split_indicator_asm
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1923
           intro!: setsum.mono_neutral_cong_left ennreal_mult_left_cong arg_cong2[where f=emeasure])
57137
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1924
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  1925
lemma nn_integral_restrict_space:
57137
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1926
  assumes \<Omega>[simp]: "\<Omega> \<inter> space M \<in> sets M"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1927
  shows "nn_integral (restrict_space M \<Omega>) f = nn_integral M (\<lambda>x. f x * indicator \<Omega> x)"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1928
proof -
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1929
  let ?R = "restrict_space M \<Omega>" and ?X = "\<lambda>M f. {s. simple_function M s \<and> s \<le> f \<and> (\<forall>x. s x < top)}"
57137
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1930
  have "integral\<^sup>S ?R ` ?X ?R f = integral\<^sup>S M ` ?X M (\<lambda>x. f x * indicator \<Omega> x)"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1931
  proof (safe intro!: image_eqI)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1932
    fix s assume s: "simple_function ?R s" "s \<le> f" "\<forall>x. s x < top"
57137
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1933
    from s show "integral\<^sup>S (restrict_space M \<Omega>) s = integral\<^sup>S M (\<lambda>x. s x * indicator \<Omega> x)"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1934
      by (intro simple_integral_restrict_space) auto
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1935
    from s show "simple_function M (\<lambda>x. s x * indicator \<Omega> x)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1936
      by (simp add: simple_function_restrict_space_ennreal)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1937
    from s show "(\<lambda>x. s x * indicator \<Omega> x) \<le> (\<lambda>x. f x * indicator \<Omega> x)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1938
      "\<And>x. s x * indicator \<Omega> x < top"
57137
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1939
      by (auto split: split_indicator simp: le_fun_def image_subset_iff)
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1940
  next
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1941
    fix s assume s: "simple_function M s" "s \<le> (\<lambda>x. f x * indicator \<Omega> x)" "\<forall>x. s x < top"
57137
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1942
    then have "simple_function M (\<lambda>x. s x * indicator (\<Omega> \<inter> space M) x)" (is ?s')
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1943
      by (intro simple_function_mult simple_function_indicator) auto
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1944
    also have "?s' \<longleftrightarrow> simple_function M (\<lambda>x. s x * indicator \<Omega> x)"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1945
      by (rule simple_function_cong) (auto split: split_indicator)
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1946
    finally show sf: "simple_function (restrict_space M \<Omega>) s"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1947
      by (simp add: simple_function_restrict_space_ennreal)
57137
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1948
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1949
    from s have s_eq: "s = (\<lambda>x. s x * indicator \<Omega> x)"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1950
      by (auto simp add: fun_eq_iff le_fun_def image_subset_iff
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1951
                  split: split_indicator split_indicator_asm
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1952
                  intro: antisym)
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1953
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1954
    show "integral\<^sup>S M s = integral\<^sup>S (restrict_space M \<Omega>) s"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1955
      by (subst s_eq) (rule simple_integral_restrict_space[symmetric, OF \<Omega> sf])
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1956
    show "\<And>x. s x < top"
57137
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1957
      using s by (auto simp: image_subset_iff)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1958
    from s show "s \<le> f"
57137
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1959
      by (subst s_eq) (auto simp: image_subset_iff le_fun_def split: split_indicator split_indicator_asm)
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1960
  qed
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  1961
  then show ?thesis
62343
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 62083
diff changeset
  1962
    unfolding nn_integral_def_finite by (simp cong del: strong_SUP_cong)
54417
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 54230
diff changeset
  1963
qed
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 54230
diff changeset
  1964
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1965
lemma nn_integral_count_space_indicator:
59779
b6bda9140e39 fix parameter order of NO_MATCH
hoelzl
parents: 59587
diff changeset
  1966
  assumes "NO_MATCH (UNIV::'a set) (X::'a set)"
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1967
  shows "(\<integral>\<^sup>+x. f x \<partial>count_space X) = (\<integral>\<^sup>+x. f x * indicator X x \<partial>count_space UNIV)"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1968
  by (simp add: nn_integral_restrict_space[symmetric] restrict_count_space)
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1969
59425
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  1970
lemma nn_integral_count_space_eq:
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  1971
  "(\<And>x. x \<in> A - B \<Longrightarrow> f x = 0) \<Longrightarrow> (\<And>x. x \<in> B - A \<Longrightarrow> f x = 0) \<Longrightarrow>
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  1972
    (\<integral>\<^sup>+x. f x \<partial>count_space A) = (\<integral>\<^sup>+x. f x \<partial>count_space B)"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  1973
  by (auto simp: nn_integral_count_space_indicator intro!: nn_integral_cong split: split_indicator)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  1974
59023
4999a616336c register pmf as BNF
Andreas Lochbihler
parents: 59011
diff changeset
  1975
lemma nn_integral_ge_point:
4999a616336c register pmf as BNF
Andreas Lochbihler
parents: 59011
diff changeset
  1976
  assumes "x \<in> A"
4999a616336c register pmf as BNF
Andreas Lochbihler
parents: 59011
diff changeset
  1977
  shows "p x \<le> \<integral>\<^sup>+ x. p x \<partial>count_space A"
4999a616336c register pmf as BNF
Andreas Lochbihler
parents: 59011
diff changeset
  1978
proof -
4999a616336c register pmf as BNF
Andreas Lochbihler
parents: 59011
diff changeset
  1979
  from assms have "p x \<le> \<integral>\<^sup>+ x. p x \<partial>count_space {x}"
4999a616336c register pmf as BNF
Andreas Lochbihler
parents: 59011
diff changeset
  1980
    by(auto simp add: nn_integral_count_space_finite max_def)
4999a616336c register pmf as BNF
Andreas Lochbihler
parents: 59011
diff changeset
  1981
  also have "\<dots> = \<integral>\<^sup>+ x'. p x' * indicator {x} x' \<partial>count_space A"
4999a616336c register pmf as BNF
Andreas Lochbihler
parents: 59011
diff changeset
  1982
    using assms by(auto simp add: nn_integral_count_space_indicator indicator_def intro!: nn_integral_cong)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1983
  also have "\<dots> \<le> \<integral>\<^sup>+ x. p x \<partial>count_space A"
59023
4999a616336c register pmf as BNF
Andreas Lochbihler
parents: 59011
diff changeset
  1984
    by(rule nn_integral_mono)(simp add: indicator_def)
4999a616336c register pmf as BNF
Andreas Lochbihler
parents: 59011
diff changeset
  1985
  finally show ?thesis .
4999a616336c register pmf as BNF
Andreas Lochbihler
parents: 59011
diff changeset
  1986
qed
4999a616336c register pmf as BNF
Andreas Lochbihler
parents: 59011
diff changeset
  1987
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1988
subsubsection \<open>Measure spaces with an associated density\<close>
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1989
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1990
definition density :: "'a measure \<Rightarrow> ('a \<Rightarrow> ennreal) \<Rightarrow> 'a measure" where
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
  1991
  "density M f = measure_of (space M) (sets M) (\<lambda>A. \<integral>\<^sup>+ x. f x * indicator A x \<partial>M)"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1992
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  1993
lemma
59048
7dc8ac6f0895 add congruence solver to measurability prover
hoelzl
parents: 59023
diff changeset
  1994
  shows sets_density[simp, measurable_cong]: "sets (density M f) = sets M"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1995
    and space_density[simp]: "space (density M f) = space M"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1996
  by (auto simp: density_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  1997
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1998
(* FIXME: add conversion to simplify space, sets and measurable *)
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1999
lemma space_density_imp[measurable_dest]:
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  2000
  "\<And>x M f. x \<in> space (density M f) \<Longrightarrow> x \<in> space M" by auto
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  2001
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  2002
lemma
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2003
  shows measurable_density_eq1[simp]: "g \<in> measurable (density Mg f) Mg' \<longleftrightarrow> g \<in> measurable Mg Mg'"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2004
    and measurable_density_eq2[simp]: "h \<in> measurable Mh (density Mh' f) \<longleftrightarrow> h \<in> measurable Mh Mh'"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2005
    and simple_function_density_eq[simp]: "simple_function (density Mu f) u \<longleftrightarrow> simple_function Mu u"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2006
  unfolding measurable_def simple_function_def by simp_all
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2007
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2008
lemma density_cong: "f \<in> borel_measurable M \<Longrightarrow> f' \<in> borel_measurable M \<Longrightarrow>
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2009
  (AE x in M. f x = f' x) \<Longrightarrow> density M f = density M f'"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  2010
  unfolding density_def by (auto intro!: measure_of_eq nn_integral_cong_AE sets.space_closed)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2011
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2012
lemma emeasure_density:
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 50001
diff changeset
  2013
  assumes f[measurable]: "f \<in> borel_measurable M" and A[measurable]: "A \<in> sets M"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
  2014
  shows "emeasure (density M f) A = (\<integral>\<^sup>+ x. f x * indicator A x \<partial>M)"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2015
    (is "_ = ?\<mu> A")
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2016
  unfolding density_def
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2017
proof (rule emeasure_measure_of_sigma)
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2018
  show "sigma_algebra (space M) (sets M)" ..
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2019
  show "positive (sets M) ?\<mu>"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2020
    using f by (auto simp: positive_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2021
  show "countably_additive (sets M) ?\<mu>"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2022
  proof (intro countably_additiveI)
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2023
    fix A :: "nat \<Rightarrow> 'a set" assume "range A \<subseteq> sets M"
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 50001
diff changeset
  2024
    then have "\<And>i. A i \<in> sets M" by auto
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2025
    then have *: "\<And>i. (\<lambda>x. f x * indicator (A i) x) \<in> borel_measurable M"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2026
      by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2027
    assume disj: "disjoint_family A"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2028
    then have "(\<Sum>n. ?\<mu> (A n)) = (\<integral>\<^sup>+ x. (\<Sum>n. f x * indicator (A n) x) \<partial>M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2029
       using f * by (subst nn_integral_suminf) auto
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2030
    also have "(\<integral>\<^sup>+ x. (\<Sum>n. f x * indicator (A n) x) \<partial>M) = (\<integral>\<^sup>+ x. f x * (\<Sum>n. indicator (A n) x) \<partial>M)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2031
      using f by (auto intro!: ennreal_suminf_cmult nn_integral_cong_AE)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2032
    also have "\<dots> = (\<integral>\<^sup>+ x. f x * indicator (\<Union>n. A n) x \<partial>M)"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2033
      unfolding suminf_indicator[OF disj] ..
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2034
    finally show "(\<Sum>i. \<integral>\<^sup>+ x. f x * indicator (A i) x \<partial>M) = \<integral>\<^sup>+ x. f x * indicator (\<Union>i. A i) x \<partial>M" .
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2035
  qed
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2036
qed fact
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2037
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2038
lemma null_sets_density_iff:
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2039
  assumes f: "f \<in> borel_measurable M"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2040
  shows "A \<in> null_sets (density M f) \<longleftrightarrow> A \<in> sets M \<and> (AE x in M. x \<in> A \<longrightarrow> f x = 0)"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2041
proof -
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2042
  { assume "A \<in> sets M"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2043
    have "(\<integral>\<^sup>+x. f x * indicator A x \<partial>M) = 0 \<longleftrightarrow> emeasure M {x \<in> space M. f x * indicator A x \<noteq> 0} = 0"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2044
      using f \<open>A \<in> sets M\<close> by (intro nn_integral_0_iff) auto
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2045
    also have "\<dots> \<longleftrightarrow> (AE x in M. f x * indicator A x = 0)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2046
      using f \<open>A \<in> sets M\<close> by (intro AE_iff_measurable[OF _ refl, symmetric]) auto
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2047
    also have "(AE x in M. f x * indicator A x = 0) \<longleftrightarrow> (AE x in M. x \<in> A \<longrightarrow> f x \<le> 0)"
62390
842917225d56 more canonical names
nipkow
parents: 62343
diff changeset
  2048
      by (auto simp add: indicator_def max_def split: if_split_asm)
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
  2049
    finally have "(\<integral>\<^sup>+x. f x * indicator A x \<partial>M) = 0 \<longleftrightarrow> (AE x in M. x \<in> A \<longrightarrow> f x \<le> 0)" . }
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2050
  with f show ?thesis
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2051
    by (simp add: null_sets_def emeasure_density cong: conj_cong)
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2052
qed
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2053
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2054
lemma AE_density:
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2055
  assumes f: "f \<in> borel_measurable M"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2056
  shows "(AE x in density M f. P x) \<longleftrightarrow> (AE x in M. 0 < f x \<longrightarrow> P x)"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2057
proof
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2058
  assume "AE x in density M f. P x"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2059
  with f obtain N where "{x \<in> space M. \<not> P x} \<subseteq> N" "N \<in> sets M" and ae: "AE x in M. x \<in> N \<longrightarrow> f x = 0"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2060
    by (auto simp: eventually_ae_filter null_sets_density_iff)
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2061
  then have "AE x in M. x \<notin> N \<longrightarrow> P x" by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2062
  with ae show "AE x in M. 0 < f x \<longrightarrow> P x"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2063
    by (rule eventually_elim2) auto
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2064
next
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2065
  fix N assume ae: "AE x in M. 0 < f x \<longrightarrow> P x"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2066
  then obtain N where "{x \<in> space M. \<not> (0 < f x \<longrightarrow> P x)} \<subseteq> N" "N \<in> null_sets M"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2067
    by (auto simp: eventually_ae_filter)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2068
  then have *: "{x \<in> space (density M f). \<not> P x} \<subseteq> N \<union> {x\<in>space M. f x = 0}"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2069
    "N \<union> {x\<in>space M. f x = 0} \<in> sets M" and ae2: "AE x in M. x \<notin> N"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2070
    using f by (auto simp: subset_eq zero_less_iff_neq_zero intro!: AE_not_in)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2071
  show "AE x in density M f. P x"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2072
    using ae2
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2073
    unfolding eventually_ae_filter[of _ "density M f"] Bex_def null_sets_density_iff[OF f]
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2074
    by (intro exI[of _ "N \<union> {x\<in>space M. f x = 0}"] conjI *) (auto elim: eventually_elim2)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  2075
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  2076
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2077
lemma nn_integral_density:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2078
  assumes f: "f \<in> borel_measurable M"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2079
  assumes g: "g \<in> borel_measurable M"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  2080
  shows "integral\<^sup>N (density M f) g = (\<integral>\<^sup>+ x. f x * g x \<partial>M)"
49798
8d5668f73c42 induction prove for positive_integral_density
hoelzl
parents: 49797
diff changeset
  2081
using g proof induct
8d5668f73c42 induction prove for positive_integral_density
hoelzl
parents: 49797
diff changeset
  2082
  case (cong u v)
49799
15ea98537c76 strong nonnegativ (instead of ae nn) for induction rule
hoelzl
parents: 49798
diff changeset
  2083
  then show ?case
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  2084
    apply (subst nn_integral_cong[OF cong(3)])
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  2085
    apply (simp_all cong: nn_integral_cong)
49798
8d5668f73c42 induction prove for positive_integral_density
hoelzl
parents: 49797
diff changeset
  2086
    done
8d5668f73c42 induction prove for positive_integral_density
hoelzl
parents: 49797
diff changeset
  2087
next
8d5668f73c42 induction prove for positive_integral_density
hoelzl
parents: 49797
diff changeset
  2088
  case (set A) then show ?case
8d5668f73c42 induction prove for positive_integral_density
hoelzl
parents: 49797
diff changeset
  2089
    by (simp add: emeasure_density f)
8d5668f73c42 induction prove for positive_integral_density
hoelzl
parents: 49797
diff changeset
  2090
next
8d5668f73c42 induction prove for positive_integral_density
hoelzl
parents: 49797
diff changeset
  2091
  case (mult u c)
8d5668f73c42 induction prove for positive_integral_density
hoelzl
parents: 49797
diff changeset
  2092
  moreover have "\<And>x. f x * (c * u x) = c * (f x * u x)" by (simp add: field_simps)
8d5668f73c42 induction prove for positive_integral_density
hoelzl
parents: 49797
diff changeset
  2093
  ultimately show ?case
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  2094
    using f by (simp add: nn_integral_cmult)
49798
8d5668f73c42 induction prove for positive_integral_density
hoelzl
parents: 49797
diff changeset
  2095
next
8d5668f73c42 induction prove for positive_integral_density
hoelzl
parents: 49797
diff changeset
  2096
  case (add u v)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  2097
  then have "\<And>x. f x * (v x + u x) = f x * v x + f x * u x"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2098
    by (simp add: distrib_left)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
  2099
  with add f show ?case
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2100
    by (auto simp add: nn_integral_add intro!: nn_integral_add[symmetric])
49798
8d5668f73c42 induction prove for positive_integral_density
hoelzl
parents: 49797
diff changeset
  2101
next
8d5668f73c42 induction prove for positive_integral_density
hoelzl
parents: 49797
diff changeset
  2102
  case (seq U)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2103
  have eq: "AE x in M. f x * (SUP i. U i x) = (SUP i. f x * U i x)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2104
    by eventually_elim (simp add: SUP_mult_left_ennreal seq)
49798
8d5668f73c42 induction prove for positive_integral_density
hoelzl
parents: 49797
diff changeset
  2105
  from seq f show ?case
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  2106
    apply (simp add: nn_integral_monotone_convergence_SUP)
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  2107
    apply (subst nn_integral_cong_AE[OF eq])
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  2108
    apply (subst nn_integral_monotone_convergence_SUP_AE)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2109
    apply (auto simp: incseq_def le_fun_def intro!: mult_left_mono)
49798
8d5668f73c42 induction prove for positive_integral_density
hoelzl
parents: 49797
diff changeset
  2110
    done
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2111
qed
38705
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  2112
57275
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57137
diff changeset
  2113
lemma density_distr:
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57137
diff changeset
  2114
  assumes [measurable]: "f \<in> borel_measurable N" "X \<in> measurable M N"
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57137
diff changeset
  2115
  shows "density (distr M N X) f = distr (density M (\<lambda>x. f (X x))) N X"
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57137
diff changeset
  2116
  by (intro measure_eqI)
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57137
diff changeset
  2117
     (auto simp add: emeasure_density nn_integral_distr emeasure_distr
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57137
diff changeset
  2118
           split: split_indicator intro!: nn_integral_cong)
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57137
diff changeset
  2119
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2120
lemma emeasure_restricted:
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2121
  assumes S: "S \<in> sets M" and X: "X \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2122
  shows "emeasure (density M (indicator S)) X = emeasure M (S \<inter> X)"
38705
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  2123
proof -
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
  2124
  have "emeasure (density M (indicator S)) X = (\<integral>\<^sup>+x. indicator S x * indicator X x \<partial>M)"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2125
    using S X by (simp add: emeasure_density)
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
  2126
  also have "\<dots> = (\<integral>\<^sup>+x. indicator (S \<inter> X) x \<partial>M)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  2127
    by (auto intro!: nn_integral_cong simp: indicator_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2128
  also have "\<dots> = emeasure M (S \<inter> X)"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
  2129
    using S X by (simp add: sets.Int)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2130
  finally show ?thesis .
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2131
qed
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2132
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2133
lemma measure_restricted:
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2134
  "S \<in> sets M \<Longrightarrow> X \<in> sets M \<Longrightarrow> measure (density M (indicator S)) X = measure M (S \<inter> X)"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2135
  by (simp add: emeasure_restricted measure_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2136
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2137
lemma (in finite_measure) finite_measure_restricted:
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2138
  "S \<in> sets M \<Longrightarrow> finite_measure (density M (indicator S))"
61169
4de9ff3ea29a tuned proofs -- less legacy;
wenzelm
parents: 60636
diff changeset
  2139
  by standard (simp add: emeasure_restricted)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2140
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2141
lemma emeasure_density_const:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2142
  "A \<in> sets M \<Longrightarrow> emeasure (density M (\<lambda>_. c)) A = c * emeasure M A"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  2143
  by (auto simp: nn_integral_cmult_indicator emeasure_density)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2144
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2145
lemma measure_density_const:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2146
  "A \<in> sets M \<Longrightarrow> c \<noteq> \<infinity> \<Longrightarrow> measure (density M (\<lambda>_. c)) A = enn2real c * measure M A"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2147
  by (auto simp: emeasure_density_const measure_def enn2real_mult)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2148
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2149
lemma density_density_eq:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2150
   "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow>
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2151
   density (density M f) g = density M (\<lambda>x. f x * g x)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  2152
  by (auto intro!: measure_eqI simp: emeasure_density nn_integral_density ac_simps)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2153
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2154
lemma distr_density_distr:
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2155
  assumes T: "T \<in> measurable M M'" and T': "T' \<in> measurable M' M"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2156
    and inv: "\<forall>x\<in>space M. T' (T x) = x"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2157
  assumes f: "f \<in> borel_measurable M'"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2158
  shows "distr (density (distr M M' T) f) M T' = density M (f \<circ> T)" (is "?R = ?L")
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2159
proof (rule measure_eqI)
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2160
  fix A assume A: "A \<in> sets ?R"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2161
  { fix x assume "x \<in> space M"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
  2162
    with sets.sets_into_space[OF A]
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2163
    have "indicator (T' -` A \<inter> space M') (T x) = (indicator A x :: ennreal)"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2164
      using T inv by (auto simp: indicator_def measurable_space) }
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2165
  with A T T' f show "emeasure ?R A = emeasure ?L A"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2166
    by (simp add: measurable_comp emeasure_density emeasure_distr
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  2167
                  nn_integral_distr measurable_sets cong: nn_integral_cong)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2168
qed simp
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2169
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2170
lemma density_density_divide:
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2171
  fixes f g :: "'a \<Rightarrow> real"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2172
  assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2173
  assumes g: "g \<in> borel_measurable M" "AE x in M. 0 \<le> g x"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2174
  assumes ac: "AE x in M. f x = 0 \<longrightarrow> g x = 0"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2175
  shows "density (density M f) (\<lambda>x. g x / f x) = density M g"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2176
proof -
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2177
  have "density M g = density M (\<lambda>x. ennreal (f x) * ennreal (g x / f x))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2178
    using f g ac by (auto intro!: density_cong measurable_If simp: ennreal_mult[symmetric])
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2179
  then show ?thesis
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2180
    using f g by (subst density_density_eq) auto
38705
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  2181
qed
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  2182
59425
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2183
lemma density_1: "density M (\<lambda>_. 1) = M"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2184
  by (intro measure_eqI) (auto simp: emeasure_density)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2185
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2186
lemma emeasure_density_add:
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  2187
  assumes X: "X \<in> sets M"
59425
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2188
  assumes Mf[measurable]: "f \<in> borel_measurable M"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2189
  assumes Mg[measurable]: "g \<in> borel_measurable M"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  2190
  shows "emeasure (density M f) X + emeasure (density M g) X =
59425
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2191
           emeasure (density M (\<lambda>x. f x + g x)) X"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2192
  using assms
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2193
  apply (subst (1 2 3) emeasure_density, simp_all) []
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2194
  apply (subst nn_integral_add[symmetric], simp_all) []
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2195
  apply (intro nn_integral_cong, simp split: split_indicator)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2196
  done
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2197
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  2198
subsubsection \<open>Point measure\<close>
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2199
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2200
definition point_measure :: "'a set \<Rightarrow> ('a \<Rightarrow> ennreal) \<Rightarrow> 'a measure" where
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2201
  "point_measure A f = density (count_space A) f"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2202
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2203
lemma
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2204
  shows space_point_measure: "space (point_measure A f) = A"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2205
    and sets_point_measure: "sets (point_measure A f) = Pow A"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2206
  by (auto simp: point_measure_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2207
59048
7dc8ac6f0895 add congruence solver to measurability prover
hoelzl
parents: 59023
diff changeset
  2208
lemma sets_point_measure_count_space[measurable_cong]: "sets (point_measure A f) = sets (count_space A)"
7dc8ac6f0895 add congruence solver to measurability prover
hoelzl
parents: 59023
diff changeset
  2209
  by (simp add: sets_point_measure)
7dc8ac6f0895 add congruence solver to measurability prover
hoelzl
parents: 59023
diff changeset
  2210
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2211
lemma measurable_point_measure_eq1[simp]:
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2212
  "g \<in> measurable (point_measure A f) M \<longleftrightarrow> g \<in> A \<rightarrow> space M"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2213
  unfolding point_measure_def by simp
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2214
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2215
lemma measurable_point_measure_eq2_finite[simp]:
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2216
  "finite A \<Longrightarrow>
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2217
   g \<in> measurable M (point_measure A f) \<longleftrightarrow>
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2218
    (g \<in> space M \<rightarrow> A \<and> (\<forall>a\<in>A. g -` {a} \<inter> space M \<in> sets M))"
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 50001
diff changeset
  2219
  unfolding point_measure_def by (simp add: measurable_count_space_eq2)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2220
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2221
lemma simple_function_point_measure[simp]:
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2222
  "simple_function (point_measure A f) g \<longleftrightarrow> finite (g ` A)"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2223
  by (simp add: point_measure_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2224
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2225
lemma emeasure_point_measure:
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2226
  assumes A: "finite {a\<in>X. 0 < f a}" "X \<subseteq> A"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2227
  shows "emeasure (point_measure A f) X = (\<Sum>a|a\<in>X \<and> 0 < f a. f a)"
35977
30d42bfd0174 Added finite measure space.
hoelzl
parents: 35833
diff changeset
  2228
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2229
  have "{a. (a \<in> X \<longrightarrow> a \<in> A \<and> 0 < f a) \<and> a \<in> X} = {a\<in>X. 0 < f a}"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  2230
    using \<open>X \<subseteq> A\<close> by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2231
  with A show ?thesis
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2232
    by (simp add: emeasure_density nn_integral_count_space point_measure_def indicator_def)
35977
30d42bfd0174 Added finite measure space.
hoelzl
parents: 35833
diff changeset
  2233
qed
30d42bfd0174 Added finite measure space.
hoelzl
parents: 35833
diff changeset
  2234
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2235
lemma emeasure_point_measure_finite:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2236
  "finite A \<Longrightarrow> X \<subseteq> A \<Longrightarrow> emeasure (point_measure A f) X = (\<Sum>a\<in>X. f a)"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57275
diff changeset
  2237
  by (subst emeasure_point_measure) (auto dest: finite_subset intro!: setsum.mono_neutral_left simp: less_le)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2238
49795
9f2fb9b25a77 joint distribution of independent variables
hoelzl
parents: 49775
diff changeset
  2239
lemma emeasure_point_measure_finite2:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2240
  "X \<subseteq> A \<Longrightarrow> finite X \<Longrightarrow> emeasure (point_measure A f) X = (\<Sum>a\<in>X. f a)"
49795
9f2fb9b25a77 joint distribution of independent variables
hoelzl
parents: 49775
diff changeset
  2241
  by (subst emeasure_point_measure)
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57275
diff changeset
  2242
     (auto dest: finite_subset intro!: setsum.mono_neutral_left simp: less_le)
49795
9f2fb9b25a77 joint distribution of independent variables
hoelzl
parents: 49775
diff changeset
  2243
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2244
lemma null_sets_point_measure_iff:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2245
  "X \<in> null_sets (point_measure A f) \<longleftrightarrow> X \<subseteq> A \<and> (\<forall>x\<in>X. f x = 0)"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2246
 by (auto simp: AE_count_space null_sets_density_iff point_measure_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2247
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2248
lemma AE_point_measure:
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2249
  "(AE x in point_measure A f. P x) \<longleftrightarrow> (\<forall>x\<in>A. 0 < f x \<longrightarrow> P x)"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2250
  unfolding point_measure_def
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2251
  by (subst AE_density) (auto simp: AE_density AE_count_space point_measure_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2252
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  2253
lemma nn_integral_point_measure:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2254
  "finite {a\<in>A. 0 < f a \<and> 0 < g a} \<Longrightarrow>
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  2255
    integral\<^sup>N (point_measure A f) g = (\<Sum>a|a\<in>A \<and> 0 < f a \<and> 0 < g a. f a * g a)"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2256
  unfolding point_measure_def
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2257
  by (subst nn_integral_density)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2258
     (simp_all add: nn_integral_density nn_integral_count_space ennreal_zero_less_mult_iff)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2259
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  2260
lemma nn_integral_point_measure_finite:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2261
  "finite A \<Longrightarrow> integral\<^sup>N (point_measure A f) g = (\<Sum>a\<in>A. f a * g a)"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57275
diff changeset
  2262
  by (subst nn_integral_point_measure) (auto intro!: setsum.mono_neutral_left simp: less_le)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2263
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  2264
subsubsection \<open>Uniform measure\<close>
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2265
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2266
definition "uniform_measure M A = density M (\<lambda>x. indicator A x / emeasure M A)"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2267
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2268
lemma
59048
7dc8ac6f0895 add congruence solver to measurability prover
hoelzl
parents: 59023
diff changeset
  2269
  shows sets_uniform_measure[simp, measurable_cong]: "sets (uniform_measure M A) = sets M"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2270
    and space_uniform_measure[simp]: "space (uniform_measure M A) = space M"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2271
  by (auto simp: uniform_measure_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2272
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2273
lemma emeasure_uniform_measure[simp]:
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2274
  assumes A: "A \<in> sets M" and B: "B \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2275
  shows "emeasure (uniform_measure M A) B = emeasure M (A \<inter> B) / emeasure M A"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2276
proof -
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 51340
diff changeset
  2277
  from A B have "emeasure (uniform_measure M A) B = (\<integral>\<^sup>+x. (1 / emeasure M A) * indicator (A \<inter> B) x \<partial>M)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2278
    by (auto simp add: uniform_measure_def emeasure_density divide_ennreal_def split: split_indicator
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
  2279
             intro!: nn_integral_cong)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2280
  also have "\<dots> = emeasure M (A \<inter> B) / emeasure M A"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2281
    using A B
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2282
    by (subst nn_integral_cmult_indicator) (simp_all add: sets.Int divide_ennreal_def mult.commute)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2283
  finally show ?thesis .
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2284
qed
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2285
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2286
lemma measure_uniform_measure[simp]:
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2287
  assumes A: "emeasure M A \<noteq> 0" "emeasure M A \<noteq> \<infinity>" and B: "B \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2288
  shows "measure (uniform_measure M A) B = measure M (A \<inter> B) / measure M A"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2289
  using emeasure_uniform_measure[OF emeasure_neq_0_sets[OF A(1)] B] A
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2290
  by (cases "emeasure M A" "emeasure M (A \<inter> B)" rule: ennreal2_cases)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2291
     (simp_all add: measure_def divide_ennreal top_ennreal.rep_eq top_ereal_def ennreal_top_divide)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2292
58606
9c66f7c541fb add Giry monad
hoelzl
parents: 57512
diff changeset
  2293
lemma AE_uniform_measureI:
9c66f7c541fb add Giry monad
hoelzl
parents: 57512
diff changeset
  2294
  "A \<in> sets M \<Longrightarrow> (AE x in M. x \<in> A \<longrightarrow> P x) \<Longrightarrow> (AE x in uniform_measure M A. P x)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2295
  unfolding uniform_measure_def by (auto simp: AE_density divide_ennreal_def)
58606
9c66f7c541fb add Giry monad
hoelzl
parents: 57512
diff changeset
  2296
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2297
lemma emeasure_uniform_measure_1:
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2298
  "emeasure M S \<noteq> 0 \<Longrightarrow> emeasure M S \<noteq> \<infinity> \<Longrightarrow> emeasure (uniform_measure M S) S = 1"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2299
  by (subst emeasure_uniform_measure)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2300
     (simp_all add: emeasure_neq_0_sets emeasure_eq_ennreal_measure divide_ennreal
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2301
                    zero_less_iff_neq_zero[symmetric])
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2302
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2303
lemma nn_integral_uniform_measure:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2304
  assumes f[measurable]: "f \<in> borel_measurable M" and S[measurable]: "S \<in> sets M"
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2305
  shows "(\<integral>\<^sup>+x. f x \<partial>uniform_measure M S) = (\<integral>\<^sup>+x. f x * indicator S x \<partial>M) / emeasure M S"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2306
proof -
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2307
  { assume "emeasure M S = \<infinity>"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2308
    then have ?thesis
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2309
      by (simp add: uniform_measure_def nn_integral_density f) }
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2310
  moreover
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2311
  { assume [simp]: "emeasure M S = 0"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2312
    then have ae: "AE x in M. x \<notin> S"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2313
      using sets.sets_into_space[OF S]
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2314
      by (subst AE_iff_measurable[OF _ refl]) (simp_all add: subset_eq cong: rev_conj_cong)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2315
    from ae have "(\<integral>\<^sup>+ x. indicator S x / 0 * f x \<partial>M) = 0"
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2316
      by (subst nn_integral_0_iff_AE) auto
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2317
    moreover from ae have "(\<integral>\<^sup>+ x. f x * indicator S x \<partial>M) = 0"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2318
      by (subst nn_integral_0_iff_AE) auto
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2319
    ultimately have ?thesis
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2320
      by (simp add: uniform_measure_def nn_integral_density f) }
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2321
  moreover have "emeasure M S \<noteq> 0 \<Longrightarrow> emeasure M S \<noteq> \<infinity> \<Longrightarrow> ?thesis"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2322
    unfolding uniform_measure_def
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2323
    by (subst nn_integral_density)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2324
       (auto simp: ennreal_times_divide f nn_integral_divide[symmetric] mult.commute)
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2325
  ultimately show ?thesis by blast
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2326
qed
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2327
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2328
lemma AE_uniform_measure:
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2329
  assumes "emeasure M A \<noteq> 0" "emeasure M A < \<infinity>"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2330
  shows "(AE x in uniform_measure M A. P x) \<longleftrightarrow> (AE x in M. x \<in> A \<longrightarrow> P x)"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2331
proof -
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2332
  have "A \<in> sets M"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  2333
    using \<open>emeasure M A \<noteq> 0\<close> by (metis emeasure_notin_sets)
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2334
  moreover have "\<And>x. 0 < indicator A x / emeasure M A \<longleftrightarrow> x \<in> A"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2335
    using assms
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2336
    by (cases "emeasure M A") (auto split: split_indicator simp: ennreal_zero_less_divide)
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2337
  ultimately show ?thesis
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2338
    unfolding uniform_measure_def by (simp add: AE_density)
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2339
qed
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2340
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  2341
subsubsection \<open>Null measure\<close>
59425
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2342
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2343
lemma null_measure_eq_density: "null_measure M = density M (\<lambda>_. 0)"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2344
  by (intro measure_eqI) (simp_all add: emeasure_density)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2345
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2346
lemma nn_integral_null_measure[simp]: "(\<integral>\<^sup>+x. f x \<partial>null_measure M) = 0"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2347
  by (auto simp add: nn_integral_def simple_integral_def SUP_constant bot_ennreal_def le_fun_def
59425
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2348
           intro!: exI[of _ "\<lambda>x. 0"])
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2349
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2350
lemma density_null_measure[simp]: "density (null_measure M) f = null_measure M"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2351
proof (intro measure_eqI)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2352
  fix A show "emeasure (density (null_measure M) f) A = emeasure (null_measure M) A"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2353
    by (simp add: density_def) (simp only: null_measure_def[symmetric] emeasure_null_measure)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2354
qed simp
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59357
diff changeset
  2355
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  2356
subsubsection \<open>Uniform count measure\<close>
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2357
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2358
definition "uniform_count_measure A = point_measure A (\<lambda>x. 1 / card A)"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  2359
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  2360
lemma
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2361
  shows space_uniform_count_measure: "space (uniform_count_measure A) = A"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2362
    and sets_uniform_count_measure: "sets (uniform_count_measure A) = Pow A"
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2363
    unfolding uniform_count_measure_def by (auto simp: space_point_measure sets_point_measure)
59048
7dc8ac6f0895 add congruence solver to measurability prover
hoelzl
parents: 59023
diff changeset
  2364
7dc8ac6f0895 add congruence solver to measurability prover
hoelzl
parents: 59023
diff changeset
  2365
lemma sets_uniform_count_measure_count_space[measurable_cong]:
7dc8ac6f0895 add congruence solver to measurability prover
hoelzl
parents: 59023
diff changeset
  2366
  "sets (uniform_count_measure A) = sets (count_space A)"
7dc8ac6f0895 add congruence solver to measurability prover
hoelzl
parents: 59023
diff changeset
  2367
  by (simp add: sets_uniform_count_measure)
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  2368
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2369
lemma emeasure_uniform_count_measure:
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2370
  "finite A \<Longrightarrow> X \<subseteq> A \<Longrightarrow> emeasure (uniform_count_measure A) X = card X / card A"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2371
  by (simp add: emeasure_point_measure_finite uniform_count_measure_def divide_inverse ennreal_mult
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2372
                ennreal_of_nat_eq_real_of_nat)
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  2373
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2374
lemma measure_uniform_count_measure:
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2375
  "finite A \<Longrightarrow> X \<subseteq> A \<Longrightarrow> measure (uniform_count_measure A) X = card X / card A"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2376
  by (simp add: emeasure_point_measure_finite uniform_count_measure_def measure_def enn2real_mult)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46905
diff changeset
  2377
61633
64e6d712af16 add lemmas
Andreas Lochbihler
parents: 61632
diff changeset
  2378
lemma space_uniform_count_measure_empty_iff [simp]:
64e6d712af16 add lemmas
Andreas Lochbihler
parents: 61632
diff changeset
  2379
  "space (uniform_count_measure X) = {} \<longleftrightarrow> X = {}"
64e6d712af16 add lemmas
Andreas Lochbihler
parents: 61632
diff changeset
  2380
by(simp add: space_uniform_count_measure)
64e6d712af16 add lemmas
Andreas Lochbihler
parents: 61632
diff changeset
  2381
64e6d712af16 add lemmas
Andreas Lochbihler
parents: 61632
diff changeset
  2382
lemma sets_uniform_count_measure_eq_UNIV [simp]:
64e6d712af16 add lemmas
Andreas Lochbihler
parents: 61632
diff changeset
  2383
  "sets (uniform_count_measure UNIV) = UNIV \<longleftrightarrow> True"
64e6d712af16 add lemmas
Andreas Lochbihler
parents: 61632
diff changeset
  2384
  "UNIV = sets (uniform_count_measure UNIV) \<longleftrightarrow> True"
64e6d712af16 add lemmas
Andreas Lochbihler
parents: 61632
diff changeset
  2385
by(simp_all add: sets_uniform_count_measure)
64e6d712af16 add lemmas
Andreas Lochbihler
parents: 61632
diff changeset
  2386
61634
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2387
subsubsection \<open>Scaled measure\<close>
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2388
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2389
lemma nn_integral_scale_measure:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2390
  assumes f: "f \<in> borel_measurable M"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2391
  shows "nn_integral (scale_measure r M) f = r * nn_integral M f"
61634
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2392
  using f
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2393
proof induction
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2394
  case (cong f g)
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2395
  thus ?case
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2396
    by(simp add: cong.hyps space_scale_measure cong: nn_integral_cong_simp)
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2397
next
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2398
  case (mult f c)
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2399
  thus ?case
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2400
    by(simp add: nn_integral_cmult max_def mult.assoc mult.left_commute)
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2401
next
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2402
  case (add f g)
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2403
  thus ?case
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2404
    by(simp add: nn_integral_add distrib_left)
61634
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2405
next
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2406
  case (seq U)
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2407
  thus ?case
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2408
    by(simp add: nn_integral_monotone_convergence_SUP SUP_mult_left_ennreal)
61634
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2409
qed simp
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2410
35748
5f35613d9a65 Equality of integral and infinite sum.
hoelzl
parents: 35692
diff changeset
  2411
end