src/HOL/Probability/Lebesgue_Integration.thy
author hoelzl
Mon, 24 Jan 2011 22:29:50 +0100
changeset 41661 baf1964bc468
parent 41545 9c869baf1c66
child 41689 3e39b0e730d6
permissions -rw-r--r--
use pre-image measure, instead of image
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
     1
(* Author: Armin Heller, Johannes Hoelzl, TU Muenchen *)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
     2
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
     3
header {*Lebesgue Integration*}
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
     4
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
     5
theory Lebesgue_Integration
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
     6
imports Measure Borel_Space
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
     7
begin
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
     8
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
     9
lemma sums_If_finite:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    10
  assumes finite: "finite {r. P r}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    11
  shows "(\<lambda>r. if P r then f r else 0) sums (\<Sum>r\<in>{r. P r}. f r)" (is "?F sums _")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    12
proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    13
  assume "{r. P r} = {}" hence "\<And>r. \<not> P r" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    14
  thus ?thesis by (simp add: sums_zero)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    15
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    16
  assume not_empty: "{r. P r} \<noteq> {}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    17
  have "?F sums (\<Sum>r = 0..< Suc (Max {r. P r}). ?F r)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    18
    by (rule series_zero)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    19
       (auto simp add: Max_less_iff[OF finite not_empty] less_eq_Suc_le[symmetric])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    20
  also have "(\<Sum>r = 0..< Suc (Max {r. P r}). ?F r) = (\<Sum>r\<in>{r. P r}. f r)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    21
    by (subst setsum_cases)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    22
       (auto intro!: setsum_cong simp: Max_ge_iff[OF finite not_empty] less_Suc_eq_le)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    23
  finally show ?thesis .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    24
qed
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
    25
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    26
lemma sums_single:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    27
  "(\<lambda>r. if r = i then f r else 0) sums f i"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    28
  using sums_If_finite[of "\<lambda>r. r = i" f] by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    29
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    30
section "Simple function"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
    31
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    32
text {*
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    33
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    34
Our simple functions are not restricted to positive real numbers. Instead
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    35
they are just functions with a finite range and are measurable when singleton
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    36
sets are measurable.
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
    37
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    38
*}
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    39
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    40
definition (in sigma_algebra) "simple_function g \<longleftrightarrow>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    41
    finite (g ` space M) \<and>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    42
    (\<forall>x \<in> g ` space M. g -` {x} \<inter> space M \<in> sets M)"
36624
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
    43
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    44
lemma (in sigma_algebra) simple_functionD:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    45
  assumes "simple_function g"
40875
9a9d33f6fb46 generalized simple_functionD
hoelzl
parents: 40873
diff changeset
    46
  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
    47
proof -
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
    48
  show "finite (g ` space M)"
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
    49
    using assms unfolding simple_function_def by auto
40875
9a9d33f6fb46 generalized simple_functionD
hoelzl
parents: 40873
diff changeset
    50
  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
    51
  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
    52
  finally show "g -` X \<inter> space M \<in> sets M" using assms
9a9d33f6fb46 generalized simple_functionD
hoelzl
parents: 40873
diff changeset
    53
    by (auto intro!: finite_UN simp del: UN_simps simp: simple_function_def)
40871
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
    54
qed
36624
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
    55
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    56
lemma (in sigma_algebra) simple_function_indicator_representation:
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
    57
  fixes f ::"'a \<Rightarrow> pextreal"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    58
  assumes f: "simple_function f" and x: "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    59
  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
    60
  (is "?l = ?r")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    61
proof -
38705
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
    62
  have "?r = (\<Sum>y \<in> f ` space M.
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    63
    (if y = f x then y * indicator (f -` {y} \<inter> space M) x else 0))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    64
    by (auto intro!: setsum_cong2)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    65
  also have "... =  f x *  indicator (f -` {f x} \<inter> space M) x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    66
    using assms by (auto dest: simple_functionD simp: setsum_delta)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    67
  also have "... = f x" using x by (auto simp: indicator_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    68
  finally show ?thesis by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    69
qed
36624
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
    70
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    71
lemma (in measure_space) simple_function_notspace:
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
    72
  "simple_function (\<lambda>x. h x * indicator (- space M) x::pextreal)" (is "simple_function ?h")
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
    73
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    74
  have "?h ` space M \<subseteq> {0}" unfolding indicator_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    75
  hence [simp, intro]: "finite (?h ` space M)" by (auto intro: finite_subset)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    76
  have "?h -` {0} \<inter> space M = space M" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    77
  thus ?thesis unfolding simple_function_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    78
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    79
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    80
lemma (in sigma_algebra) simple_function_cong:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    81
  assumes "\<And>t. t \<in> space M \<Longrightarrow> f t = g t"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    82
  shows "simple_function f \<longleftrightarrow> simple_function g"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    83
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    84
  have "f ` space M = g ` space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    85
    "\<And>x. f -` {x} \<inter> space M = g -` {x} \<inter> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    86
    using assms by (auto intro!: image_eqI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    87
  thus ?thesis unfolding simple_function_def using assms by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    88
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    89
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    90
lemma (in sigma_algebra) borel_measurable_simple_function:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    91
  assumes "simple_function f"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    92
  shows "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    93
proof (rule borel_measurableI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    94
  fix S
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    95
  let ?I = "f ` (f -` S \<inter> space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    96
  have *: "(\<Union>x\<in>?I. f -` {x} \<inter> space M) = f -` S \<inter> space M" (is "?U = _") by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    97
  have "finite ?I"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    98
    using assms unfolding simple_function_def by (auto intro: finite_subset)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
    99
  hence "?U \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   100
    apply (rule finite_UN)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   101
    using assms unfolding simple_function_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   102
  thus "f -` S \<inter> space M \<in> sets M" unfolding * .
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   103
qed
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   104
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   105
lemma (in sigma_algebra) simple_function_borel_measurable:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   106
  fixes f :: "'a \<Rightarrow> 'x::t2_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   107
  assumes "f \<in> borel_measurable M" and "finite (f ` space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   108
  shows "simple_function f"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   109
  using assms unfolding simple_function_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   110
  by (auto intro: borel_measurable_vimage)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   111
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   112
lemma (in sigma_algebra) simple_function_const[intro, simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   113
  "simple_function (\<lambda>x. c)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   114
  by (auto intro: finite_subset simp: simple_function_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   115
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   116
lemma (in sigma_algebra) simple_function_compose[intro, simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   117
  assumes "simple_function f"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   118
  shows "simple_function (g \<circ> f)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   119
  unfolding simple_function_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   120
proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   121
  show "finite ((g \<circ> f) ` space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   122
    using assms unfolding simple_function_def by (auto simp: image_compose)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   123
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   124
  fix x assume "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   125
  let ?G = "g -` {g (f x)} \<inter> (f`space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   126
  have *: "(g \<circ> f) -` {(g \<circ> f) x} \<inter> space M =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   127
    (\<Union>x\<in>?G. f -` {x} \<inter> space M)" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   128
  show "(g \<circ> f) -` {(g \<circ> f) x} \<inter> space M \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   129
    using assms unfolding simple_function_def *
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   130
    by (rule_tac finite_UN) (auto intro!: finite_UN)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   131
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   132
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   133
lemma (in sigma_algebra) simple_function_indicator[intro, simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   134
  assumes "A \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   135
  shows "simple_function (indicator A)"
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   136
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   137
  have "indicator A ` space M \<subseteq> {0, 1}" (is "?S \<subseteq> _")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   138
    by (auto simp: indicator_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   139
  hence "finite ?S" by (rule finite_subset) simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   140
  moreover have "- A \<inter> space M = space M - A" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   141
  ultimately show ?thesis unfolding simple_function_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   142
    using assms by (auto simp: indicator_def_raw)
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   143
qed
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   144
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   145
lemma (in sigma_algebra) simple_function_Pair[intro, simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   146
  assumes "simple_function f"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   147
  assumes "simple_function g"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   148
  shows "simple_function (\<lambda>x. (f x, g x))" (is "simple_function ?p")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   149
  unfolding simple_function_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   150
proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   151
  show "finite (?p ` space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   152
    using assms unfolding simple_function_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   153
    by (rule_tac finite_subset[of _ "f`space M \<times> g`space M"]) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   154
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   155
  fix x assume "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   156
  have "(\<lambda>x. (f x, g x)) -` {(f x, g x)} \<inter> space M =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   157
      (f -` {f x} \<inter> space M) \<inter> (g -` {g x} \<inter> space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   158
    by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   159
  with `x \<in> space M` show "(\<lambda>x. (f x, g x)) -` {(f x, g x)} \<inter> space M \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   160
    using assms unfolding simple_function_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   161
qed
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   162
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   163
lemma (in sigma_algebra) simple_function_compose1:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   164
  assumes "simple_function f"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   165
  shows "simple_function (\<lambda>x. g (f x))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   166
  using simple_function_compose[OF assms, of g]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   167
  by (simp add: comp_def)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   168
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   169
lemma (in sigma_algebra) simple_function_compose2:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   170
  assumes "simple_function f" and "simple_function g"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   171
  shows "simple_function (\<lambda>x. h (f x) (g x))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   172
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   173
  have "simple_function ((\<lambda>(x, y). h x y) \<circ> (\<lambda>x. (f x, g x)))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   174
    using assms by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   175
  thus ?thesis by (simp_all add: comp_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   176
qed
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   177
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   178
lemmas (in sigma_algebra) simple_function_add[intro, simp] = simple_function_compose2[where h="op +"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   179
  and simple_function_diff[intro, simp] = simple_function_compose2[where h="op -"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   180
  and simple_function_uminus[intro, simp] = simple_function_compose[where g="uminus"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   181
  and simple_function_mult[intro, simp] = simple_function_compose2[where h="op *"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   182
  and simple_function_div[intro, simp] = simple_function_compose2[where h="op /"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   183
  and simple_function_inverse[intro, simp] = simple_function_compose[where g="inverse"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   184
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   185
lemma (in sigma_algebra) simple_function_setsum[intro, simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   186
  assumes "\<And>i. i \<in> P \<Longrightarrow> simple_function (f i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   187
  shows "simple_function (\<lambda>x. \<Sum>i\<in>P. f i x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   188
proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   189
  assume "finite P" from this assms show ?thesis by induct auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   190
qed auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   191
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   192
lemma (in sigma_algebra) simple_function_le_measurable:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   193
  assumes "simple_function f" "simple_function g"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   194
  shows "{x \<in> space M. f x \<le> g x} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   195
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   196
  have *: "{x \<in> space M. f x \<le> g x} =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   197
    (\<Union>(F, G)\<in>f`space M \<times> g`space M.
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   198
      if F \<le> G then (f -` {F} \<inter> space M) \<inter> (g -` {G} \<inter> space M) else {})"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   199
    apply (auto split: split_if_asm)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   200
    apply (rule_tac x=x in bexI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   201
    apply (rule_tac x=x in bexI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   202
    by simp_all
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   203
  have **: "\<And>x y. x \<in> space M \<Longrightarrow> y \<in> space M \<Longrightarrow>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   204
    (f -` {f x} \<inter> space M) \<inter> (g -` {g y} \<inter> space M) \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   205
    using assms unfolding simple_function_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   206
  have "finite (f`space M \<times> g`space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   207
    using assms unfolding simple_function_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   208
  thus ?thesis unfolding *
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   209
    apply (rule finite_UN)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   210
    using assms unfolding simple_function_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   211
    by (auto intro!: **)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   212
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   213
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   214
lemma (in sigma_algebra) borel_measurable_implies_simple_function_sequence:
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
   215
  fixes u :: "'a \<Rightarrow> pextreal"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   216
  assumes u: "u \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   217
  shows "\<exists>f. (\<forall>i. simple_function (f i) \<and> (\<forall>x\<in>space M. f i x \<noteq> \<omega>)) \<and> f \<up> u"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   218
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   219
  have "\<exists>f. \<forall>x j. (of_nat j \<le> u x \<longrightarrow> f x j = j*2^j) \<and>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   220
    (u x < of_nat j \<longrightarrow> of_nat (f x j) \<le> u x * 2^j \<and> u x * 2^j < of_nat (Suc (f x j)))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   221
    (is "\<exists>f. \<forall>x j. ?P x j (f x j)")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   222
  proof(rule choice, rule, rule choice, rule)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   223
    fix x j show "\<exists>n. ?P x j n"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   224
    proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   225
      assume *: "u x < of_nat j"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   226
      then obtain r where r: "u x = Real r" "0 \<le> r" by (cases "u x") auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   227
      from reals_Archimedean6a[of "r * 2^j"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   228
      obtain n :: nat where "real n \<le> r * 2 ^ j" "r * 2 ^ j < real (Suc n)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   229
        using `0 \<le> r` by (auto simp: zero_le_power zero_le_mult_iff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   230
      thus ?thesis using r * by (auto intro!: exI[of _ n])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   231
    qed auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   232
  qed
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   233
  then obtain f where top: "\<And>j x. of_nat j \<le> u x \<Longrightarrow> f x j = j*2^j" and
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   234
    upper: "\<And>j x. u x < of_nat j \<Longrightarrow> of_nat (f x j) \<le> u x * 2^j" and
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   235
    lower: "\<And>j x. u x < of_nat j \<Longrightarrow> u x * 2^j < of_nat (Suc (f x j))" by blast
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   236
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   237
  { fix j x P
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   238
    assume 1: "of_nat j \<le> u x \<Longrightarrow> P (j * 2^j)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   239
    assume 2: "\<And>k. \<lbrakk> u x < of_nat j ; of_nat k \<le> u x * 2^j ; u x * 2^j < of_nat (Suc k) \<rbrakk> \<Longrightarrow> P k"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   240
    have "P (f x j)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   241
    proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   242
      assume "of_nat j \<le> u x" thus "P (f x j)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   243
        using top[of j x] 1 by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   244
    next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   245
      assume "\<not> of_nat j \<le> u x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   246
      hence "u x < of_nat j" "of_nat (f x j) \<le> u x * 2^j" "u x * 2^j < of_nat (Suc (f x j))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   247
        using upper lower by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   248
      from 2[OF this] show "P (f x j)" .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   249
    qed }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   250
  note fI = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   251
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   252
  { fix j x
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   253
    have "f x j = j * 2 ^ j \<longleftrightarrow> of_nat j \<le> u x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   254
      by (rule fI, simp, cases "u x") (auto split: split_if_asm) }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   255
  note f_eq = this
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   256
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   257
  { fix j x
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   258
    have "f x j \<le> j * 2 ^ j"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   259
    proof (rule fI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   260
      fix k assume *: "u x < of_nat j"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   261
      assume "of_nat k \<le> u x * 2 ^ j"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   262
      also have "\<dots> \<le> of_nat (j * 2^j)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   263
        using * by (cases "u x") (auto simp: zero_le_mult_iff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   264
      finally show "k \<le> j*2^j" by (auto simp del: real_of_nat_mult)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   265
    qed simp }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   266
  note f_upper = this
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   267
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
   268
  let "?g j x" = "of_nat (f x j) / 2^j :: pextreal"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   269
  show ?thesis unfolding simple_function_def isoton_fun_expand unfolding isoton_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   270
  proof (safe intro!: exI[of _ ?g])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   271
    fix j
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   272
    have *: "?g j ` space M \<subseteq> (\<lambda>x. of_nat x / 2^j) ` {..j * 2^j}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   273
      using f_upper by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   274
    thus "finite (?g j ` space M)" by (rule finite_subset) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   275
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   276
    fix j t assume "t \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   277
    have **: "?g j -` {?g j t} \<inter> space M = {x \<in> space M. f t j = f x j}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   278
      by (auto simp: power_le_zero_eq Real_eq_Real mult_le_0_iff)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   279
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   280
    show "?g j -` {?g j t} \<inter> space M \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   281
    proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   282
      assume "of_nat j \<le> u t"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   283
      hence "?g j -` {?g j t} \<inter> space M = {x\<in>space M. of_nat j \<le> u x}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   284
        unfolding ** f_eq[symmetric] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   285
      thus "?g j -` {?g j t} \<inter> space M \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   286
        using u by auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   287
    next
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   288
      assume not_t: "\<not> of_nat j \<le> u t"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   289
      hence less: "f t j < j*2^j" using f_eq[symmetric] `f t j \<le> j*2^j` by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   290
      have split_vimage: "?g j -` {?g j t} \<inter> space M =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   291
          {x\<in>space M. of_nat (f t j)/2^j \<le> u x} \<inter> {x\<in>space M. u x < of_nat (Suc (f t j))/2^j}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   292
        unfolding **
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   293
      proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   294
        fix x assume [simp]: "f t j = f x j"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   295
        have *: "\<not> of_nat j \<le> u x" using not_t f_eq[symmetric] by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   296
        hence "of_nat (f t j) \<le> u x * 2^j \<and> u x * 2^j < of_nat (Suc (f t j))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   297
          using upper lower by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   298
        hence "of_nat (f t j) / 2^j \<le> u x \<and> u x < of_nat (Suc (f t j))/2^j" using *
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   299
          by (cases "u x") (auto simp: zero_le_mult_iff power_le_zero_eq divide_real_def[symmetric] field_simps)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   300
        thus "of_nat (f t j) / 2^j \<le> u x" "u x < of_nat (Suc (f t j))/2^j" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   301
      next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   302
        fix x
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   303
        assume "of_nat (f t j) / 2^j \<le> u x" "u x < of_nat (Suc (f t j))/2^j"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   304
        hence "of_nat (f t j) \<le> u x * 2 ^ j \<and> u x * 2 ^ j < of_nat (Suc (f t j))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   305
          by (cases "u x") (auto simp: zero_le_mult_iff power_le_zero_eq divide_real_def[symmetric] field_simps)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   306
        hence 1: "of_nat (f t j) \<le> u x * 2 ^ j" and 2: "u x * 2 ^ j < of_nat (Suc (f t j))" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   307
        note 2
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   308
        also have "\<dots> \<le> of_nat (j*2^j)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   309
          using less by (auto simp: zero_le_mult_iff simp del: real_of_nat_mult)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   310
        finally have bound_ux: "u x < of_nat j"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   311
          by (cases "u x") (auto simp: zero_le_mult_iff power_le_zero_eq)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   312
        show "f t j = f x j"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   313
        proof (rule antisym)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   314
          from 1 lower[OF bound_ux]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   315
          show "f t j \<le> f x j" by (cases "u x") (auto split: split_if_asm)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   316
          from upper[OF bound_ux] 2
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   317
          show "f x j \<le> f t j" by (cases "u x") (auto split: split_if_asm)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   318
        qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   319
      qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   320
      show ?thesis unfolding split_vimage using u by auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   321
    qed
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   322
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   323
    fix j t assume "?g j t = \<omega>" thus False by (auto simp: power_le_zero_eq)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   324
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   325
    fix t
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   326
    { fix i
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   327
      have "f t i * 2 \<le> f t (Suc i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   328
      proof (rule fI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   329
        assume "of_nat (Suc i) \<le> u t"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   330
        hence "of_nat i \<le> u t" by (cases "u t") auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   331
        thus "f t i * 2 \<le> Suc i * 2 ^ Suc i" unfolding f_eq[symmetric] by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   332
      next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   333
        fix k
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   334
        assume *: "u t * 2 ^ Suc i < of_nat (Suc k)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   335
        show "f t i * 2 \<le> k"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   336
        proof (rule fI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   337
          assume "of_nat i \<le> u t"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   338
          hence "of_nat (i * 2^Suc i) \<le> u t * 2^Suc i"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   339
            by (cases "u t") (auto simp: zero_le_mult_iff power_le_zero_eq)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   340
          also have "\<dots> < of_nat (Suc k)" using * by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   341
          finally show "i * 2 ^ i * 2 \<le> k"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   342
            by (auto simp del: real_of_nat_mult)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   343
        next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   344
          fix j assume "of_nat j \<le> u t * 2 ^ i"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   345
          with * show "j * 2 \<le> k" by (cases "u t") (auto simp: zero_le_mult_iff power_le_zero_eq)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   346
        qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   347
      qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   348
      thus "?g i t \<le> ?g (Suc i) t"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   349
        by (auto simp: zero_le_mult_iff power_le_zero_eq divide_real_def[symmetric] field_simps) }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   350
    hence mono: "mono (\<lambda>i. ?g i t)" unfolding mono_iff_le_Suc by auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   351
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   352
    show "(SUP j. of_nat (f t j) / 2 ^ j) = u t"
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
   353
    proof (rule pextreal_SUPI)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   354
      fix j show "of_nat (f t j) / 2 ^ j \<le> u t"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   355
      proof (rule fI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   356
        assume "of_nat j \<le> u t" thus "of_nat (j * 2 ^ j) / 2 ^ j \<le> u t"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   357
          by (cases "u t") (auto simp: power_le_zero_eq divide_real_def[symmetric] field_simps)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   358
      next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   359
        fix k assume "of_nat k \<le> u t * 2 ^ j"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   360
        thus "of_nat k / 2 ^ j \<le> u t"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   361
          by (cases "u t")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   362
             (auto simp: power_le_zero_eq divide_real_def[symmetric] field_simps zero_le_mult_iff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   363
      qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   364
    next
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
   365
      fix y :: pextreal assume *: "\<And>j. j \<in> UNIV \<Longrightarrow> of_nat (f t j) / 2 ^ j \<le> y"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   366
      show "u t \<le> y"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   367
      proof (cases "u t")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   368
        case (preal r)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   369
        show ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   370
        proof (rule ccontr)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   371
          assume "\<not> u t \<le> y"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   372
          then obtain p where p: "y = Real p" "0 \<le> p" "p < r" using preal by (cases y) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   373
          with LIMSEQ_inverse_realpow_zero[of 2, unfolded LIMSEQ_iff, rule_format, of "r - p"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   374
          obtain n where n: "\<And>N. n \<le> N \<Longrightarrow> inverse (2^N) < r - p" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   375
          let ?N = "max n (natfloor r + 1)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   376
          have "u t < of_nat ?N" "n \<le> ?N"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   377
            using ge_natfloor_plus_one_imp_gt[of r n] preal
38705
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
   378
            using real_natfloor_add_one_gt
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
   379
            by (auto simp: max_def real_of_nat_Suc)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   380
          from lower[OF this(1)]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   381
          have "r < (real (f t ?N) + 1) / 2 ^ ?N" unfolding less_divide_eq
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   382
            using preal by (auto simp add: power_le_zero_eq zero_le_mult_iff real_of_nat_Suc split: split_if_asm)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   383
          hence "u t < of_nat (f t ?N) / 2 ^ ?N + 1 / 2 ^ ?N"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   384
            using preal by (auto simp: field_simps divide_real_def[symmetric])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   385
          with n[OF `n \<le> ?N`] p preal *[of ?N]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   386
          show False
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   387
            by (cases "f t ?N") (auto simp: power_le_zero_eq split: split_if_asm)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   388
        qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   389
      next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   390
        case infinite
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   391
        { fix j have "f t j = j*2^j" using top[of j t] infinite by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   392
          hence "of_nat j \<le> y" using *[of j]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   393
            by (cases y) (auto simp: power_le_zero_eq zero_le_mult_iff field_simps) }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   394
        note all_less_y = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   395
        show ?thesis unfolding infinite
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   396
        proof (rule ccontr)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   397
          assume "\<not> \<omega> \<le> y" then obtain r where r: "y = Real r" "0 \<le> r" by (cases y) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   398
          moreover obtain n ::nat where "r < real n" using ex_less_of_nat by (auto simp: real_eq_of_nat)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   399
          with all_less_y[of n] r show False by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   400
        qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   401
      qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   402
    qed
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   403
  qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   404
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   405
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   406
lemma (in sigma_algebra) borel_measurable_implies_simple_function_sequence':
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
   407
  fixes u :: "'a \<Rightarrow> pextreal"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   408
  assumes "u \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   409
  obtains (x) f where "f \<up> u" "\<And>i. simple_function (f i)" "\<And>i. \<omega>\<notin>f i`space M"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   410
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   411
  from borel_measurable_implies_simple_function_sequence[OF assms]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   412
  obtain f where x: "\<And>i. simple_function (f i)" "f \<up> u"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   413
    and fin: "\<And>i. \<And>x. x\<in>space M \<Longrightarrow> f i x \<noteq> \<omega>" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   414
  { fix i from fin[of _ i] have "\<omega> \<notin> f i`space M" by fastsimp }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   415
  with x show thesis by (auto intro!: that[of f])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   416
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   417
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   418
lemma (in sigma_algebra) simple_function_eq_borel_measurable:
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
   419
  fixes f :: "'a \<Rightarrow> pextreal"
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   420
  shows "simple_function f \<longleftrightarrow>
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   421
    finite (f`space M) \<and> f \<in> borel_measurable M"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   422
  using simple_function_borel_measurable[of f]
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   423
    borel_measurable_simple_function[of f]
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   424
  by (fastsimp simp: simple_function_def)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   425
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   426
lemma (in measure_space) simple_function_restricted:
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
   427
  fixes f :: "'a \<Rightarrow> pextreal" assumes "A \<in> sets M"
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   428
  shows "sigma_algebra.simple_function (restricted_space A) f \<longleftrightarrow> simple_function (\<lambda>x. f x * indicator A x)"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   429
    (is "sigma_algebra.simple_function ?R f \<longleftrightarrow> simple_function ?f")
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   430
proof -
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   431
  interpret R: sigma_algebra ?R by (rule restricted_sigma_algebra[OF `A \<in> sets M`])
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   432
  have "finite (f`A) \<longleftrightarrow> finite (?f`space M)"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   433
  proof cases
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   434
    assume "A = space M"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   435
    then have "f`A = ?f`space M" by (fastsimp simp: image_iff)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   436
    then show ?thesis by simp
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   437
  next
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   438
    assume "A \<noteq> space M"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   439
    then obtain x where x: "x \<in> space M" "x \<notin> A"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   440
      using sets_into_space `A \<in> sets M` by auto
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   441
    have *: "?f`space M = f`A \<union> {0}"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   442
    proof (auto simp add: image_iff)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   443
      show "\<exists>x\<in>space M. f x = 0 \<or> indicator A x = 0"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   444
        using x by (auto intro!: bexI[of _ x])
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   445
    next
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   446
      fix x assume "x \<in> A"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   447
      then show "\<exists>y\<in>space M. f x = f y * indicator A y"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   448
        using `A \<in> sets M` sets_into_space by (auto intro!: bexI[of _ x])
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   449
    next
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   450
      fix x
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
   451
      assume "indicator A x \<noteq> (0::pextreal)"
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   452
      then have "x \<in> A" by (auto simp: indicator_def split: split_if_asm)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   453
      moreover assume "x \<in> space M" "\<forall>y\<in>A. ?f x \<noteq> f y"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   454
      ultimately show "f x = 0" by auto
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   455
    qed
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   456
    then show ?thesis by auto
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   457
  qed
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   458
  then show ?thesis
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   459
    unfolding simple_function_eq_borel_measurable
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   460
      R.simple_function_eq_borel_measurable
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   461
    unfolding borel_measurable_restricted[OF `A \<in> sets M`]
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   462
    by auto
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   463
qed
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   464
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   465
lemma (in sigma_algebra) simple_function_subalgebra:
41545
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
   466
  assumes "sigma_algebra.simple_function N f"
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
   467
  and N_subalgebra: "sets N \<subseteq> sets M" "space N = space M" "sigma_algebra N"
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   468
  shows "simple_function f"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   469
  using assms
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   470
  unfolding simple_function_def
41545
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
   471
  unfolding sigma_algebra.simple_function_def[OF N_subalgebra(3)]
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   472
  by auto
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   473
41661
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   474
lemma (in measure_space) simple_function_vimage:
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   475
  assumes T: "sigma_algebra M'" "T \<in> measurable M M'"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   476
    and f: "sigma_algebra.simple_function M' f"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   477
  shows "simple_function (\<lambda>x. f (T x))"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   478
proof (intro simple_function_def[THEN iffD2] conjI ballI)
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   479
  interpret T: sigma_algebra M' by fact
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   480
  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
   481
    using T unfolding measurable_def by auto
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   482
  then show "finite ((\<lambda>x. f (T x)) ` space M)"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   483
    using f unfolding T.simple_function_def by (auto intro: finite_subset)
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   484
  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
   485
  then have "i \<in> f ` space M'"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   486
    using T unfolding measurable_def by auto
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   487
  then have "f -` {i} \<inter> space M' \<in> sets M'"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   488
    using f unfolding T.simple_function_def by auto
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   489
  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
   490
    using T unfolding measurable_def by auto
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   491
  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
   492
    using T unfolding measurable_def by auto
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   493
  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
   494
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   495
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   496
section "Simple integral"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   497
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
   498
definition (in measure_space) simple_integral (binder "\<integral>\<^isup>S " 10) where
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   499
  "simple_integral f = (\<Sum>x \<in> f ` space M. x * \<mu> (f -` {x} \<inter> space M))"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   500
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   501
lemma (in measure_space) simple_integral_cong:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   502
  assumes "\<And>t. t \<in> space M \<Longrightarrow> f t = g t"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   503
  shows "simple_integral f = simple_integral g"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   504
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   505
  have "f ` space M = g ` space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   506
    "\<And>x. f -` {x} \<inter> space M = g -` {x} \<inter> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   507
    using assms by (auto intro!: image_eqI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   508
  thus ?thesis unfolding simple_integral_def by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   509
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   510
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   511
lemma (in measure_space) simple_integral_cong_measure:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   512
  assumes "\<And>A. A \<in> sets M \<Longrightarrow> \<nu> A = \<mu> A" and "simple_function f"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   513
  shows "measure_space.simple_integral M \<nu> f = simple_integral f"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   514
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   515
  interpret v: measure_space M \<nu>
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   516
    by (rule measure_space_cong) fact
40871
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   517
  from simple_functionD[OF `simple_function f`] assms show ?thesis
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   518
    unfolding simple_integral_def v.simple_integral_def
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   519
    by (auto intro!: setsum_cong)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   520
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   521
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   522
lemma (in measure_space) simple_integral_const[simp]:
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
   523
  "(\<integral>\<^isup>Sx. c) = c * \<mu> (space M)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   524
proof (cases "space M = {}")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   525
  case True thus ?thesis unfolding simple_integral_def by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   526
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   527
  case False hence "(\<lambda>x. c) ` space M = {c}" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   528
  thus ?thesis unfolding simple_integral_def by simp
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   529
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   530
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   531
lemma (in measure_space) simple_function_partition:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   532
  assumes "simple_function f" and "simple_function g"
39910
10097e0a9dbd constant `contents` renamed to `the_elem`
haftmann
parents: 39302
diff changeset
   533
  shows "simple_integral f = (\<Sum>A\<in>(\<lambda>x. f -` {f x} \<inter> g -` {g x} \<inter> space M) ` space M. the_elem (f`A) * \<mu> A)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   534
    (is "_ = setsum _ (?p ` space M)")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   535
proof-
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   536
  let "?sub x" = "?p ` (f -` {x} \<inter> space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   537
  let ?SIGMA = "Sigma (f`space M) ?sub"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   538
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   539
  have [intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   540
    "finite (f ` space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   541
    "finite (g ` space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   542
    using assms unfolding simple_function_def by simp_all
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   543
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   544
  { fix A
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   545
    have "?p ` (A \<inter> space M) \<subseteq>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   546
      (\<lambda>(x,y). f -` {x} \<inter> g -` {y} \<inter> space M) ` (f`space M \<times> g`space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   547
      by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   548
    hence "finite (?p ` (A \<inter> space M))"
40786
0a54cfc9add3 gave more standard finite set rules simp and intro attribute
nipkow
parents: 39910
diff changeset
   549
      by (rule finite_subset) auto }
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   550
  note this[intro, simp]
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   551
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   552
  { fix x assume "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   553
    have "\<Union>(?sub (f x)) = (f -` {f x} \<inter> space M)" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   554
    moreover {
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   555
      fix x y
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   556
      have *: "f -` {f x} \<inter> g -` {g x} \<inter> space M
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   557
          = (f -` {f x} \<inter> space M) \<inter> (g -` {g x} \<inter> space M)" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   558
      assume "x \<in> space M" "y \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   559
      hence "f -` {f x} \<inter> g -` {g x} \<inter> space M \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   560
        using assms unfolding simple_function_def * by auto }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   561
    ultimately
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   562
    have "\<mu> (f -` {f x} \<inter> space M) = setsum (\<mu>) (?sub (f x))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   563
      by (subst measure_finitely_additive) auto }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   564
  hence "simple_integral f = (\<Sum>(x,A)\<in>?SIGMA. x * \<mu> A)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   565
    unfolding simple_integral_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   566
    by (subst setsum_Sigma[symmetric],
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   567
       auto intro!: setsum_cong simp: setsum_right_distrib[symmetric])
39910
10097e0a9dbd constant `contents` renamed to `the_elem`
haftmann
parents: 39302
diff changeset
   568
  also have "\<dots> = (\<Sum>A\<in>?p ` space M. the_elem (f`A) * \<mu> A)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   569
  proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   570
    have [simp]: "\<And>x. x \<in> space M \<Longrightarrow> f ` ?p x = {f x}" by (auto intro!: imageI)
39910
10097e0a9dbd constant `contents` renamed to `the_elem`
haftmann
parents: 39302
diff changeset
   571
    have "(\<lambda>A. (the_elem (f ` A), A)) ` ?p ` space M
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   572
      = (\<lambda>x. (f x, ?p x)) ` space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   573
    proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   574
      fix x assume "x \<in> space M"
39910
10097e0a9dbd constant `contents` renamed to `the_elem`
haftmann
parents: 39302
diff changeset
   575
      thus "(f x, ?p x) \<in> (\<lambda>A. (the_elem (f`A), A)) ` ?p ` space M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   576
        by (auto intro!: image_eqI[of _ _ "?p x"])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   577
    qed auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   578
    thus ?thesis
39910
10097e0a9dbd constant `contents` renamed to `the_elem`
haftmann
parents: 39302
diff changeset
   579
      apply (auto intro!: setsum_reindex_cong[of "\<lambda>A. (the_elem (f`A), A)"] inj_onI)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   580
      apply (rule_tac x="xa" in image_eqI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   581
      by simp_all
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   582
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   583
  finally show ?thesis .
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   584
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   585
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   586
lemma (in measure_space) simple_integral_add[simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   587
  assumes "simple_function f" and "simple_function g"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
   588
  shows "(\<integral>\<^isup>Sx. f x + g x) = simple_integral f + simple_integral g"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   589
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   590
  { fix x let ?S = "g -` {g x} \<inter> f -` {f x} \<inter> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   591
    assume "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   592
    hence "(\<lambda>a. f a + g a) ` ?S = {f x + g x}" "f ` ?S = {f x}" "g ` ?S = {g x}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   593
        "(\<lambda>x. (f x, g x)) -` {(f x, g x)} \<inter> space M = ?S"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   594
      by auto }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   595
  thus ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   596
    unfolding
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   597
      simple_function_partition[OF simple_function_add[OF assms] simple_function_Pair[OF assms]]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   598
      simple_function_partition[OF `simple_function f` `simple_function g`]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   599
      simple_function_partition[OF `simple_function g` `simple_function f`]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   600
    apply (subst (3) Int_commute)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   601
    by (auto simp add: field_simps setsum_addf[symmetric] intro!: setsum_cong)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   602
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   603
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   604
lemma (in measure_space) simple_integral_setsum[simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   605
  assumes "\<And>i. i \<in> P \<Longrightarrow> simple_function (f i)"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
   606
  shows "(\<integral>\<^isup>Sx. \<Sum>i\<in>P. f i x) = (\<Sum>i\<in>P. simple_integral (f i))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   607
proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   608
  assume "finite P"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   609
  from this assms show ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   610
    by induct (auto simp: simple_function_setsum simple_integral_add)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   611
qed auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   612
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   613
lemma (in measure_space) simple_integral_mult[simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   614
  assumes "simple_function f"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
   615
  shows "(\<integral>\<^isup>Sx. c * f x) = c * simple_integral f"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   616
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   617
  note mult = simple_function_mult[OF simple_function_const[of c] assms]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   618
  { fix x let ?S = "f -` {f x} \<inter> (\<lambda>x. c * f x) -` {c * f x} \<inter> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   619
    assume "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   620
    hence "(\<lambda>x. c * f x) ` ?S = {c * f x}" "f ` ?S = {f x}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   621
      by auto }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   622
  thus ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   623
    unfolding simple_function_partition[OF mult assms]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   624
      simple_function_partition[OF assms mult]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   625
    by (auto simp: setsum_right_distrib field_simps intro!: setsum_cong)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   626
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   627
40871
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   628
lemma (in sigma_algebra) simple_function_If:
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   629
  assumes sf: "simple_function f" "simple_function g" and A: "A \<in> sets M"
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   630
  shows "simple_function (\<lambda>x. if x \<in> A then f x else g x)" (is "simple_function ?IF")
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   631
proof -
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   632
  def F \<equiv> "\<lambda>x. f -` {x} \<inter> space M" and G \<equiv> "\<lambda>x. g -` {x} \<inter> space M"
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   633
  show ?thesis unfolding simple_function_def
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   634
  proof safe
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   635
    have "?IF ` space M \<subseteq> f ` space M \<union> g ` space M" by auto
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   636
    from finite_subset[OF this] assms
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   637
    show "finite (?IF ` space M)" unfolding simple_function_def by auto
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   638
  next
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   639
    fix x assume "x \<in> space M"
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   640
    then have *: "?IF -` {?IF x} \<inter> space M = (if x \<in> A
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   641
      then ((F (f x) \<inter> A) \<union> (G (f x) - (G (f x) \<inter> A)))
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   642
      else ((F (g x) \<inter> A) \<union> (G (g x) - (G (g x) \<inter> A))))"
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   643
      using sets_into_space[OF A] by (auto split: split_if_asm simp: G_def F_def)
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   644
    have [intro]: "\<And>x. F x \<in> sets M" "\<And>x. G x \<in> sets M"
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   645
      unfolding F_def G_def using sf[THEN simple_functionD(2)] by auto
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   646
    show "?IF -` {?IF x} \<inter> space M \<in> sets M" unfolding * using A by auto
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   647
  qed
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   648
qed
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   649
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   650
lemma (in measure_space) simple_integral_mono_AE:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   651
  assumes "simple_function f" and "simple_function g"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   652
  and mono: "AE x. f x \<le> g x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   653
  shows "simple_integral f \<le> simple_integral g"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   654
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   655
  let "?S x" = "(g -` {g x} \<inter> space M) \<inter> (f -` {f x} \<inter> space M)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   656
  have *: "\<And>x. g -` {g x} \<inter> f -` {f x} \<inter> space M = ?S x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   657
    "\<And>x. f -` {f x} \<inter> g -` {g x} \<inter> space M = ?S x" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   658
  show ?thesis
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   659
    unfolding *
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   660
      simple_function_partition[OF `simple_function f` `simple_function g`]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   661
      simple_function_partition[OF `simple_function g` `simple_function f`]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   662
  proof (safe intro!: setsum_mono)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   663
    fix x assume "x \<in> space M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   664
    then have *: "f ` ?S x = {f x}" "g ` ?S x = {g x}" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   665
    show "the_elem (f`?S x) * \<mu> (?S x) \<le> the_elem (g`?S x) * \<mu> (?S x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   666
    proof (cases "f x \<le> g x")
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   667
      case True then show ?thesis using * by (auto intro!: mult_right_mono)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   668
    next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   669
      case False
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   670
      obtain N where N: "{x\<in>space M. \<not> f x \<le> g x} \<subseteq> N" "N \<in> sets M" "\<mu> N = 0"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   671
        using mono by (auto elim!: AE_E)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   672
      have "?S x \<subseteq> N" using N `x \<in> space M` False by auto
40871
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   673
      moreover have "?S x \<in> sets M" using assms
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   674
        by (rule_tac Int) (auto intro!: simple_functionD)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   675
      ultimately have "\<mu> (?S x) \<le> \<mu> N"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   676
        using `N \<in> sets M` by (auto intro!: measure_mono)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   677
      then show ?thesis using `\<mu> N = 0` by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   678
    qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   679
  qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   680
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   681
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   682
lemma (in measure_space) simple_integral_mono:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   683
  assumes "simple_function f" and "simple_function g"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   684
  and mono: "\<And> x. x \<in> space M \<Longrightarrow> f x \<le> g x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   685
  shows "simple_integral f \<le> simple_integral g"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   686
proof (rule simple_integral_mono_AE[OF assms(1, 2)])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   687
  show "AE x. f x \<le> g x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   688
    using mono by (rule AE_cong) auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   689
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   690
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   691
lemma (in measure_space) simple_integral_cong_AE:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   692
  assumes "simple_function f" "simple_function g" and "AE x. f x = g x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   693
  shows "simple_integral f = simple_integral g"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   694
  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
   695
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   696
lemma (in measure_space) simple_integral_cong':
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   697
  assumes sf: "simple_function f" "simple_function g"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   698
  and mea: "\<mu> {x\<in>space M. f x \<noteq> g x} = 0"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   699
  shows "simple_integral f = simple_integral g"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   700
proof (intro simple_integral_cong_AE sf AE_I)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   701
  show "\<mu> {x\<in>space M. f x \<noteq> g x} = 0" by fact
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   702
  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
   703
    using sf[THEN borel_measurable_simple_function] by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   704
qed simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   705
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   706
lemma (in measure_space) simple_integral_indicator:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   707
  assumes "A \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   708
  assumes "simple_function f"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
   709
  shows "(\<integral>\<^isup>Sx. f x * indicator A x) =
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   710
    (\<Sum>x \<in> f ` space M. x * \<mu> (f -` {x} \<inter> space M \<inter> A))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   711
proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   712
  assume "A = space M"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
   713
  moreover hence "(\<integral>\<^isup>Sx. f x * indicator A x) = simple_integral f"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   714
    by (auto intro!: simple_integral_cong)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   715
  moreover have "\<And>X. X \<inter> space M \<inter> space M = X \<inter> space M" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   716
  ultimately show ?thesis by (simp add: simple_integral_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   717
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   718
  assume "A \<noteq> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   719
  then obtain x where x: "x \<in> space M" "x \<notin> A" using sets_into_space[OF assms(1)] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   720
  have I: "(\<lambda>x. f x * indicator A x) ` space M = f ` A \<union> {0}" (is "?I ` _ = _")
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   721
  proof safe
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   722
    fix y assume "?I y \<notin> f ` A" hence "y \<notin> A" by auto thus "?I y = 0" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   723
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   724
    fix y assume "y \<in> A" thus "f y \<in> ?I ` space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   725
      using sets_into_space[OF assms(1)] by (auto intro!: image_eqI[of _ _ y])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   726
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   727
    show "0 \<in> ?I ` space M" using x by (auto intro!: image_eqI[of _ _ x])
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   728
  qed
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
   729
  have *: "(\<integral>\<^isup>Sx. f x * indicator A x) =
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   730
    (\<Sum>x \<in> f ` space M \<union> {0}. x * \<mu> (f -` {x} \<inter> space M \<inter> A))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   731
    unfolding simple_integral_def I
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   732
  proof (rule setsum_mono_zero_cong_left)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   733
    show "finite (f ` space M \<union> {0})"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   734
      using assms(2) unfolding simple_function_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   735
    show "f ` A \<union> {0} \<subseteq> f`space M \<union> {0}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   736
      using sets_into_space[OF assms(1)] by auto
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   737
    have "\<And>x. f x \<notin> f ` A \<Longrightarrow> f -` {f x} \<inter> space M \<inter> A = {}"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   738
      by (auto simp: image_iff)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   739
    thus "\<forall>i\<in>f ` space M \<union> {0} - (f ` A \<union> {0}).
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   740
      i * \<mu> (f -` {i} \<inter> space M \<inter> A) = 0" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   741
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   742
    fix x assume "x \<in> f`A \<union> {0}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   743
    hence "x \<noteq> 0 \<Longrightarrow> ?I -` {x} \<inter> space M = f -` {x} \<inter> space M \<inter> A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   744
      by (auto simp: indicator_def split: split_if_asm)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   745
    thus "x * \<mu> (?I -` {x} \<inter> space M) =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   746
      x * \<mu> (f -` {x} \<inter> space M \<inter> A)" by (cases "x = 0") simp_all
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   747
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   748
  show ?thesis unfolding *
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   749
    using assms(2) unfolding simple_function_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   750
    by (auto intro!: setsum_mono_zero_cong_right)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   751
qed
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   752
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   753
lemma (in measure_space) simple_integral_indicator_only[simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   754
  assumes "A \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   755
  shows "simple_integral (indicator A) = \<mu> A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   756
proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   757
  assume "space M = {}" hence "A = {}" using sets_into_space[OF assms] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   758
  thus ?thesis unfolding simple_integral_def using `space M = {}` by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   759
next
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
   760
  assume "space M \<noteq> {}" hence "(\<lambda>x. 1) ` space M = {1::pextreal}" by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   761
  thus ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   762
    using simple_integral_indicator[OF assms simple_function_const[of 1]]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   763
    using sets_into_space[OF assms]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   764
    by (auto intro!: arg_cong[where f="\<mu>"])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   765
qed
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   766
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   767
lemma (in measure_space) simple_integral_null_set:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   768
  assumes "simple_function u" "N \<in> null_sets"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
   769
  shows "(\<integral>\<^isup>Sx. u x * indicator N x) = 0"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   770
proof -
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
   771
  have "AE x. indicator N x = (0 :: pextreal)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   772
    using `N \<in> null_sets` by (auto simp: indicator_def intro!: AE_I[of _ N])
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
   773
  then have "(\<integral>\<^isup>Sx. u x * indicator N x) = (\<integral>\<^isup>Sx. 0)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   774
    using assms by (intro simple_integral_cong_AE) (auto intro!: AE_disjI2)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   775
  then show ?thesis by simp
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   776
qed
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   777
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   778
lemma (in measure_space) simple_integral_cong_AE_mult_indicator:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   779
  assumes sf: "simple_function f" and eq: "AE x. x \<in> S" and "S \<in> sets M"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
   780
  shows "simple_integral f = (\<integral>\<^isup>Sx. f x * indicator S x)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   781
proof (rule simple_integral_cong_AE)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   782
  show "simple_function f" by fact
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   783
  show "simple_function (\<lambda>x. f x * indicator S x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   784
    using sf `S \<in> sets M` by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   785
  from eq show "AE x. f x = f x * indicator S x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   786
    by (rule AE_mp) simp
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   787
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   788
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   789
lemma (in measure_space) simple_integral_restricted:
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   790
  assumes "A \<in> sets M"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   791
  assumes sf: "simple_function (\<lambda>x. f x * indicator A x)"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
   792
  shows "measure_space.simple_integral (restricted_space A) \<mu> f = (\<integral>\<^isup>Sx. f x * indicator A x)"
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   793
    (is "_ = simple_integral ?f")
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   794
  unfolding measure_space.simple_integral_def[OF restricted_measure_space[OF `A \<in> sets M`]]
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   795
  unfolding simple_integral_def
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   796
proof (simp, safe intro!: setsum_mono_zero_cong_left)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   797
  from sf show "finite (?f ` space M)"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   798
    unfolding simple_function_def by auto
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   799
next
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   800
  fix x assume "x \<in> A"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   801
  then show "f x \<in> ?f ` space M"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   802
    using sets_into_space `A \<in> sets M` by (auto intro!: image_eqI[of _ _ x])
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   803
next
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   804
  fix x assume "x \<in> space M" "?f x \<notin> f`A"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   805
  then have "x \<notin> A" by (auto simp: image_iff)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   806
  then show "?f x * \<mu> (?f -` {?f x} \<inter> space M) = 0" by simp
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   807
next
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   808
  fix x assume "x \<in> A"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   809
  then have "f x \<noteq> 0 \<Longrightarrow>
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   810
    f -` {f x} \<inter> A = ?f -` {f x} \<inter> space M"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   811
    using `A \<in> sets M` sets_into_space
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   812
    by (auto simp: indicator_def split: split_if_asm)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   813
  then show "f x * \<mu> (f -` {f x} \<inter> A) =
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   814
    f x * \<mu> (?f -` {f x} \<inter> space M)"
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
   815
    unfolding pextreal_mult_cancel_left by auto
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   816
qed
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   817
41545
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
   818
lemma (in measure_space) simple_integral_subalgebra:
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
   819
  assumes N: "measure_space N \<mu>" and [simp]: "space N = space M"
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
   820
  shows "measure_space.simple_integral N \<mu> = simple_integral"
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   821
  unfolding simple_integral_def_raw
41545
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
   822
  unfolding measure_space.simple_integral_def_raw[OF N] by simp
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
   823
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   824
lemma (in measure_space) simple_integral_vimage:
41661
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   825
  assumes T: "sigma_algebra M'" "T \<in> measurable M M'"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   826
    and f: "sigma_algebra.simple_function M' f"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   827
  shows "measure_space.simple_integral M' (\<lambda>A. \<mu> (T -` A \<inter> space M)) f = (\<integral>\<^isup>S x. f (T x))"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   828
    (is "measure_space.simple_integral M' ?nu f = _")
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   829
proof -
41661
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   830
  interpret T: measure_space M' ?nu using T by (rule measure_space_vimage) auto
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   831
  show "T.simple_integral f = (\<integral>\<^isup>S x. f (T x))"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   832
    unfolding simple_integral_def T.simple_integral_def
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   833
  proof (intro setsum_mono_zero_cong_right ballI)
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   834
    show "(\<lambda>x. f (T x)) ` space M \<subseteq> f ` space M'"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   835
      using T unfolding measurable_def by auto
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   836
    show "finite (f ` space M')"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   837
      using f unfolding T.simple_function_def by auto
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   838
  next
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   839
    fix i assume "i \<in> f ` space M' - (\<lambda>x. f (T x)) ` space M"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   840
    then have "T -` (f -` {i} \<inter> space M') \<inter> space M = {}" by (auto simp: image_iff)
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   841
    then show "i * \<mu> (T -` (f -` {i} \<inter> space M') \<inter> space M) = 0" by simp
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   842
  next
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   843
    fix i assume "i \<in> (\<lambda>x. f (T x)) ` space M"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   844
    then 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
   845
      using T unfolding measurable_def by auto
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   846
    then show "i * \<mu> (T -` (f -` {i} \<inter> space M') \<inter> space M) = i * \<mu> ((\<lambda>x. f (T x)) -` {i} \<inter> space M)"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   847
      by auto
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
   848
  qed
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   849
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   850
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   851
section "Continuous posititve integration"
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   852
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
   853
definition (in measure_space) positive_integral (binder "\<integral>\<^isup>+ " 10) where
40873
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   854
  "positive_integral f = SUPR {g. simple_function g \<and> g \<le> f} simple_integral"
40872
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   855
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   856
lemma (in measure_space) positive_integral_alt:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   857
  "positive_integral f =
40873
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   858
    (SUPR {g. simple_function g \<and> g \<le> f \<and> \<omega> \<notin> g`space M} simple_integral)" (is "_ = ?alt")
40872
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   859
proof (rule antisym SUP_leI)
40873
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   860
  show "positive_integral f \<le> ?alt" unfolding positive_integral_def
40872
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   861
  proof (safe intro!: SUP_leI)
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   862
    fix g assume g: "simple_function g" "g \<le> f"
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   863
    let ?G = "g -` {\<omega>} \<inter> space M"
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   864
    show "simple_integral g \<le>
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   865
      SUPR {g. simple_function g \<and> g \<le> f \<and> \<omega> \<notin> g ` space M} simple_integral"
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   866
      (is "simple_integral g \<le> SUPR ?A simple_integral")
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   867
    proof cases
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   868
      let ?g = "\<lambda>x. indicator (space M - ?G) x * g x"
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   869
      have g': "simple_function ?g"
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   870
        using g by (auto intro: simple_functionD)
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   871
      moreover
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   872
      assume "\<mu> ?G = 0"
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   873
      then have "AE x. g x = ?g x" using g
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   874
        by (intro AE_I[where N="?G"])
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   875
           (auto intro: simple_functionD simp: indicator_def)
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   876
      with g(1) g' have "simple_integral g = simple_integral ?g"
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   877
        by (rule simple_integral_cong_AE)
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   878
      moreover have "?g \<le> g" by (auto simp: le_fun_def indicator_def)
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   879
      from this `g \<le> f` have "?g \<le> f" by (rule order_trans)
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   880
      moreover have "\<omega> \<notin> ?g ` space M"
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   881
        by (auto simp: indicator_def split: split_if_asm)
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   882
      ultimately show ?thesis by (auto intro!: le_SUPI)
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   883
    next
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   884
      assume "\<mu> ?G \<noteq> 0"
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   885
      then have "?G \<noteq> {}" by auto
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   886
      then have "\<omega> \<in> g`space M" by force
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   887
      then have "space M \<noteq> {}" by auto
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   888
      have "SUPR ?A simple_integral = \<omega>"
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   889
      proof (intro SUP_\<omega>[THEN iffD2] allI impI)
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   890
        fix x assume "x < \<omega>"
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   891
        then guess n unfolding less_\<omega>_Ex_of_nat .. note n = this
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   892
        then have "0 < n" by (intro neq0_conv[THEN iffD1] notI) simp
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   893
        let ?g = "\<lambda>x. (of_nat n / (if \<mu> ?G = \<omega> then 1 else \<mu> ?G)) * indicator ?G x"
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   894
        show "\<exists>i\<in>?A. x < simple_integral i"
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   895
        proof (intro bexI impI CollectI conjI)
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   896
          show "simple_function ?g" using g
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   897
            by (auto intro!: simple_functionD simple_function_add)
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   898
          have "?g \<le> g" by (auto simp: le_fun_def indicator_def)
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   899
          from this g(2) show "?g \<le> f" by (rule order_trans)
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   900
          show "\<omega> \<notin> ?g ` space M"
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   901
            using `\<mu> ?G \<noteq> 0` by (auto simp: indicator_def split: split_if_asm)
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   902
          have "x < (of_nat n / (if \<mu> ?G = \<omega> then 1 else \<mu> ?G)) * \<mu> ?G"
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   903
            using n `\<mu> ?G \<noteq> 0` `0 < n`
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
   904
            by (auto simp: pextreal_noteq_omega_Ex field_simps)
40872
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   905
          also have "\<dots> = simple_integral ?g" using g `space M \<noteq> {}`
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   906
            by (subst simple_integral_indicator)
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   907
               (auto simp: image_constant ac_simps dest: simple_functionD)
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   908
          finally show "x < simple_integral ?g" .
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   909
        qed
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   910
      qed
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   911
      then show ?thesis by simp
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   912
    qed
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   913
  qed
40872
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
   914
qed (auto intro!: SUP_subset simp: positive_integral_def)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   915
40873
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   916
lemma (in measure_space) positive_integral_cong_measure:
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   917
  assumes "\<And>A. A \<in> sets M \<Longrightarrow> \<nu> A = \<mu> A"
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   918
  shows "measure_space.positive_integral M \<nu> f = positive_integral f"
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   919
proof -
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   920
  interpret v: measure_space M \<nu>
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   921
    by (rule measure_space_cong) fact
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   922
  with assms show ?thesis
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   923
    unfolding positive_integral_def v.positive_integral_def SUPR_def
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   924
    by (auto intro!: arg_cong[where f=Sup] image_cong
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   925
             simp: simple_integral_cong_measure[of \<nu>])
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   926
qed
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   927
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   928
lemma (in measure_space) positive_integral_alt1:
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   929
  "positive_integral f =
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   930
    (SUP g : {g. simple_function g \<and> (\<forall>x\<in>space M. g x \<le> f x \<and> g x \<noteq> \<omega>)}. simple_integral g)"
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   931
  unfolding positive_integral_alt SUPR_def
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   932
proof (safe intro!: arg_cong[where f=Sup])
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   933
  fix g let ?g = "\<lambda>x. if x \<in> space M then g x else f x"
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   934
  assume "simple_function g" "\<forall>x\<in>space M. g x \<le> f x \<and> g x \<noteq> \<omega>"
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   935
  hence "?g \<le> f" "simple_function ?g" "simple_integral g = simple_integral ?g"
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   936
    "\<omega> \<notin> g`space M"
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   937
    unfolding le_fun_def by (auto cong: simple_function_cong simple_integral_cong)
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   938
  thus "simple_integral g \<in> simple_integral ` {g. simple_function g \<and> g \<le> f \<and> \<omega> \<notin> g`space M}"
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   939
    by auto
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   940
next
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   941
  fix g assume "simple_function g" "g \<le> f" "\<omega> \<notin> g`space M"
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   942
  hence "simple_function g" "\<forall>x\<in>space M. g x \<le> f x \<and> g x \<noteq> \<omega>"
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   943
    by (auto simp add: le_fun_def image_iff)
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   944
  thus "simple_integral g \<in> simple_integral ` {g. simple_function g \<and> (\<forall>x\<in>space M. g x \<le> f x \<and> g x \<noteq> \<omega>)}"
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   945
    by auto
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   946
qed
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   947
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   948
lemma (in measure_space) positive_integral_cong:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   949
  assumes "\<And>x. x \<in> space M \<Longrightarrow> f x = g x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   950
  shows "positive_integral f = positive_integral g"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   951
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   952
  have "\<And>h. (\<forall>x\<in>space M. h x \<le> f x \<and> h x \<noteq> \<omega>) = (\<forall>x\<in>space M. h x \<le> g x \<and> h x \<noteq> \<omega>)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   953
    using assms by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   954
  thus ?thesis unfolding positive_integral_alt1 by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   955
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   956
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   957
lemma (in measure_space) positive_integral_eq_simple_integral:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   958
  assumes "simple_function f"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   959
  shows "positive_integral f = simple_integral f"
40873
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
   960
  unfolding positive_integral_def
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
   961
proof (safe intro!: pextreal_SUPI)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   962
  fix g assume "simple_function g" "g \<le> f"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   963
  with assms show "simple_integral g \<le> simple_integral f"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   964
    by (auto intro!: simple_integral_mono simp: le_fun_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   965
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   966
  fix y assume "\<forall>x. x\<in>{g. simple_function g \<and> g \<le> f} \<longrightarrow> simple_integral x \<le> y"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   967
  with assms show "simple_integral f \<le> y" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   968
qed
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
   969
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   970
lemma (in measure_space) positive_integral_mono_AE:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   971
  assumes ae: "AE x. u x \<le> v x"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   972
  shows "positive_integral u \<le> positive_integral v"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   973
  unfolding positive_integral_alt1
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
   974
proof (safe intro!: SUPR_mono)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   975
  fix a assume a: "simple_function a" and mono: "\<forall>x\<in>space M. a x \<le> u x \<and> a x \<noteq> \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   976
  from ae obtain N where N: "{x\<in>space M. \<not> u x \<le> v x} \<subseteq> N" "N \<in> sets M" "\<mu> N = 0"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   977
    by (auto elim!: AE_E)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   978
  have "simple_function (\<lambda>x. a x * indicator (space M - N) x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   979
    using `N \<in> sets M` a by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   980
  with a show "\<exists>b\<in>{g. simple_function g \<and> (\<forall>x\<in>space M. g x \<le> v x \<and> g x \<noteq> \<omega>)}.
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   981
    simple_integral a \<le> simple_integral b"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   982
  proof (safe intro!: bexI[of _ "\<lambda>x. a x * indicator (space M - N) x"]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   983
                      simple_integral_mono_AE)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   984
    show "AE x. a x \<le> a x * indicator (space M - N) x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   985
    proof (rule AE_I, rule subset_refl)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   986
      have *: "{x \<in> space M. \<not> a x \<le> a x * indicator (space M - N) x} =
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   987
        N \<inter> {x \<in> space M. a x \<noteq> 0}" (is "?N = _")
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   988
        using `N \<in> sets M`[THEN sets_into_space] by (auto simp: indicator_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   989
      then show "?N \<in> sets M" 
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   990
        using `N \<in> sets M` `simple_function a`[THEN borel_measurable_simple_function]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   991
        by (auto intro!: measure_mono Int)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   992
      then have "\<mu> ?N \<le> \<mu> N"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   993
        unfolding * using `N \<in> sets M` by (auto intro!: measure_mono)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   994
      then show "\<mu> ?N = 0" using `\<mu> N = 0` by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   995
    qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   996
  next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   997
    fix x assume "x \<in> space M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   998
    show "a x * indicator (space M - N) x \<le> v x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
   999
    proof (cases "x \<in> N")
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1000
      case True then show ?thesis by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1001
    next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1002
      case False
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1003
      with N mono have "a x \<le> u x" "u x \<le> v x" using `x \<in> space M` by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1004
      with False `x \<in> space M` show "a x * indicator (space M - N) x \<le> v x" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1005
    qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1006
    assume "a x * indicator (space M - N) x = \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1007
    with mono `x \<in> space M` show False
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1008
      by (simp split: split_if_asm add: indicator_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1009
  qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1010
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1011
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1012
lemma (in measure_space) positive_integral_cong_AE:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1013
  "AE x. u x = v x \<Longrightarrow> positive_integral u = positive_integral v"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1014
  by (auto simp: eq_iff intro!: positive_integral_mono_AE)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1015
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1016
lemma (in measure_space) positive_integral_mono:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1017
  assumes mono: "\<And>x. x \<in> space M \<Longrightarrow> u x \<le> v x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1018
  shows "positive_integral u \<le> positive_integral v"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1019
  using mono by (auto intro!: AE_cong positive_integral_mono_AE)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1020
40873
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
  1021
lemma image_set_cong:
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
  1022
  assumes A: "\<And>x. x \<in> A \<Longrightarrow> \<exists>y\<in>B. f x = g y"
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
  1023
  assumes B: "\<And>y. y \<in> B \<Longrightarrow> \<exists>x\<in>A. g y = f x"
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
  1024
  shows "f ` A = g ` B"
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
  1025
  using assms by blast
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
  1026
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1027
lemma (in measure_space) positive_integral_SUP_approx:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1028
  assumes "f \<up> s"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1029
  and f: "\<And>i. f i \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1030
  and "simple_function u"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1031
  and le: "u \<le> s" and real: "\<omega> \<notin> u`space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1032
  shows "simple_integral u \<le> (SUP i. positive_integral (f i))" (is "_ \<le> ?S")
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  1033
proof (rule pextreal_le_mult_one_interval)
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  1034
  fix a :: pextreal assume "0 < a" "a < 1"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1035
  hence "a \<noteq> 0" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1036
  let "?B i" = "{x \<in> space M. a * u x \<le> f i x}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1037
  have B: "\<And>i. ?B i \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1038
    using f `simple_function u` by (auto simp: borel_measurable_simple_function)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1039
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1040
  let "?uB i x" = "u x * indicator (?B i) x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1041
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1042
  { fix i have "?B i \<subseteq> ?B (Suc i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1043
    proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1044
      fix i x assume "a * u x \<le> f i x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1045
      also have "\<dots> \<le> f (Suc i) x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1046
        using `f \<up> s` unfolding isoton_def le_fun_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1047
      finally show "a * u x \<le> f (Suc i) x" .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1048
    qed }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1049
  note B_mono = this
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1050
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1051
  have u: "\<And>x. x \<in> space M \<Longrightarrow> u -` {u x} \<inter> space M \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1052
    using `simple_function u` by (auto simp add: simple_function_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1053
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1054
  have "\<And>i. (\<lambda>n. (u -` {i} \<inter> space M) \<inter> ?B n) \<up> (u -` {i} \<inter> space M)" using B_mono unfolding isoton_def
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1055
  proof safe
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1056
    fix x i assume "x \<in> space M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1057
    show "x \<in> (\<Union>i. (u -` {u x} \<inter> space M) \<inter> ?B i)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1058
    proof cases
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1059
      assume "u x = 0" thus ?thesis using `x \<in> space M` by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1060
    next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1061
      assume "u x \<noteq> 0"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1062
      with `a < 1` real `x \<in> space M`
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  1063
      have "a * u x < 1 * u x" by (rule_tac pextreal_mult_strict_right_mono) (auto simp: image_iff)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1064
      also have "\<dots> \<le> (SUP i. f i x)" using le `f \<up> s`
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1065
        unfolding isoton_fun_expand by (auto simp: isoton_def le_fun_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1066
      finally obtain i where "a * u x < f i x" unfolding SUPR_def
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1067
        by (auto simp add: less_Sup_iff)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1068
      hence "a * u x \<le> f i x" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1069
      thus ?thesis using `x \<in> space M` by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1070
    qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1071
  qed auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1072
  note measure_conv = measure_up[OF Int[OF u B] this]
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1073
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1074
  have "simple_integral u = (SUP i. simple_integral (?uB i))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1075
    unfolding simple_integral_indicator[OF B `simple_function u`]
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  1076
  proof (subst SUPR_pextreal_setsum, safe)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1077
    fix x n assume "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1078
    have "\<mu> (u -` {u x} \<inter> space M \<inter> {x \<in> space M. a * u x \<le> f n x})
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1079
      \<le> \<mu> (u -` {u x} \<inter> space M \<inter> {x \<in> space M. a * u x \<le> f (Suc n) x})"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1080
      using B_mono Int[OF u[OF `x \<in> space M`] B] by (auto intro!: measure_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1081
    thus "u x * \<mu> (u -` {u x} \<inter> space M \<inter> ?B n)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1082
            \<le> u x * \<mu> (u -` {u x} \<inter> space M \<inter> ?B (Suc n))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1083
      by (auto intro: mult_left_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1084
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1085
    show "simple_integral u =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1086
      (\<Sum>i\<in>u ` space M. SUP n. i * \<mu> (u -` {i} \<inter> space M \<inter> ?B n))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1087
      using measure_conv unfolding simple_integral_def isoton_def
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  1088
      by (auto intro!: setsum_cong simp: pextreal_SUP_cmult)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1089
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1090
  moreover
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1091
  have "a * (SUP i. simple_integral (?uB i)) \<le> ?S"
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  1092
    unfolding pextreal_SUP_cmult[symmetric]
38705
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  1093
  proof (safe intro!: SUP_mono bexI)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1094
    fix i
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1095
    have "a * simple_integral (?uB i) = (\<integral>\<^isup>Sx. a * ?uB i x)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1096
      using B `simple_function u`
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1097
      by (subst simple_integral_mult[symmetric]) (auto simp: field_simps)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1098
    also have "\<dots> \<le> positive_integral (f i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1099
    proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1100
      have "\<And>x. a * ?uB i x \<le> f i x" unfolding indicator_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1101
      hence *: "simple_function (\<lambda>x. a * ?uB i x)" using B assms(3)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1102
        by (auto intro!: simple_integral_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1103
      show ?thesis unfolding positive_integral_eq_simple_integral[OF *, symmetric]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1104
        by (auto intro!: positive_integral_mono simp: indicator_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1105
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1106
    finally show "a * simple_integral (?uB i) \<le> positive_integral (f i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1107
      by auto
38705
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  1108
  qed simp
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1109
  ultimately show "a * simple_integral u \<le> ?S" by simp
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1110
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1111
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1112
text {* Beppo-Levi monotone convergence theorem *}
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1113
lemma (in measure_space) positive_integral_isoton:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1114
  assumes "f \<up> u" "\<And>i. f i \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1115
  shows "(\<lambda>i. positive_integral (f i)) \<up> positive_integral u"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1116
  unfolding isoton_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1117
proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1118
  fix i show "positive_integral (f i) \<le> positive_integral (f (Suc i))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1119
    apply (rule positive_integral_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1120
    using `f \<up> u` unfolding isoton_def le_fun_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1121
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1122
  have u: "u = (SUP i. f i)" using `f \<up> u` unfolding isoton_def by auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1123
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1124
  show "(SUP i. positive_integral (f i)) = positive_integral u"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1125
  proof (rule antisym)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1126
    from `f \<up> u`[THEN isoton_Sup, unfolded le_fun_def]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1127
    show "(SUP j. positive_integral (f j)) \<le> positive_integral u"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1128
      by (auto intro!: SUP_leI positive_integral_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1129
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1130
    show "positive_integral u \<le> (SUP i. positive_integral (f i))"
40873
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
  1131
      unfolding positive_integral_alt[of u]
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1132
      by (auto intro!: SUP_leI positive_integral_SUP_approx[OF assms])
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1133
  qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1134
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1135
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1136
lemma (in measure_space) positive_integral_monotone_convergence_SUP:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1137
  assumes "\<And>i x. x \<in> space M \<Longrightarrow> f i x \<le> f (Suc i) x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1138
  assumes "\<And>i. f i \<in> borel_measurable M"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1139
  shows "(SUP i. positive_integral (f i)) = (\<integral>\<^isup>+ x. SUP i. f i x)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1140
    (is "_ = positive_integral ?u")
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1141
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1142
  show ?thesis
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1143
  proof (rule antisym)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1144
    show "(SUP j. positive_integral (f j)) \<le> positive_integral ?u"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1145
      by (auto intro!: SUP_leI positive_integral_mono le_SUPI)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1146
  next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1147
    def rf \<equiv> "\<lambda>i. \<lambda>x\<in>space M. f i x" and ru \<equiv> "\<lambda>x\<in>space M. ?u x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1148
    have "\<And>i. rf i \<in> borel_measurable M" unfolding rf_def
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1149
      using assms by (simp cong: measurable_cong)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1150
    moreover have iso: "rf \<up> ru" using assms unfolding rf_def ru_def
41097
a1abfa4e2b44 use SUPR_ and INFI_apply instead of SUPR_, INFI_fun_expand
hoelzl
parents: 41096
diff changeset
  1151
      unfolding isoton_def le_fun_def fun_eq_iff SUPR_apply
40872
7c556a9240de Move SUP_commute, SUP_less_iff to HOL image;
hoelzl
parents: 40871
diff changeset
  1152
      using SUP_const[OF UNIV_not_empty]
41097
a1abfa4e2b44 use SUPR_ and INFI_apply instead of SUPR_, INFI_fun_expand
hoelzl
parents: 41096
diff changeset
  1153
      by (auto simp: restrict_def le_fun_def fun_eq_iff)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1154
    ultimately have "positive_integral ru \<le> (SUP i. positive_integral (rf i))"
40873
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
  1155
      unfolding positive_integral_alt[of ru]
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1156
      by (auto simp: le_fun_def intro!: SUP_leI positive_integral_SUP_approx)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1157
    then show "positive_integral ?u \<le> (SUP i. positive_integral (f i))"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1158
      unfolding ru_def rf_def by (simp cong: positive_integral_cong)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1159
  qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1160
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1161
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1162
lemma (in measure_space) SUP_simple_integral_sequences:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1163
  assumes f: "f \<up> u" "\<And>i. simple_function (f i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1164
  and g: "g \<up> u" "\<And>i. simple_function (g i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1165
  shows "(SUP i. simple_integral (f i)) = (SUP i. simple_integral (g i))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1166
    (is "SUPR _ ?F = SUPR _ ?G")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1167
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1168
  have "(SUP i. ?F i) = (SUP i. positive_integral (f i))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1169
    using assms by (simp add: positive_integral_eq_simple_integral)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1170
  also have "\<dots> = positive_integral u"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1171
    using positive_integral_isoton[OF f(1) borel_measurable_simple_function[OF f(2)]]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1172
    unfolding isoton_def by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1173
  also have "\<dots> = (SUP i. positive_integral (g i))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1174
    using positive_integral_isoton[OF g(1) borel_measurable_simple_function[OF g(2)]]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1175
    unfolding isoton_def by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1176
  also have "\<dots> = (SUP i. ?G i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1177
    using assms by (simp add: positive_integral_eq_simple_integral)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1178
  finally show ?thesis .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1179
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1180
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1181
lemma (in measure_space) positive_integral_const[simp]:
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1182
  "(\<integral>\<^isup>+ x. c) = c * \<mu> (space M)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1183
  by (subst positive_integral_eq_simple_integral) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1184
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1185
lemma (in measure_space) positive_integral_isoton_simple:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1186
  assumes "f \<up> u" and e: "\<And>i. simple_function (f i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1187
  shows "(\<lambda>i. simple_integral (f i)) \<up> positive_integral u"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1188
  using positive_integral_isoton[OF `f \<up> u` e(1)[THEN borel_measurable_simple_function]]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1189
  unfolding positive_integral_eq_simple_integral[OF e] .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1190
41661
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1191
lemma (in measure_space) positive_integral_vimage:
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1192
  assumes T: "sigma_algebra M'" "T \<in> measurable M M'" and f: "f \<in> borel_measurable M'"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1193
  shows "measure_space.positive_integral M' (\<lambda>A. \<mu> (T -` A \<inter> space M)) f = (\<integral>\<^isup>+ x. f (T x))"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1194
    (is "measure_space.positive_integral M' ?nu f = _")
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1195
proof -
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1196
  interpret T: measure_space M' ?nu using T by (rule measure_space_vimage) auto
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1197
  obtain f' where f': "f' \<up> f" "\<And>i. T.simple_function (f' i)"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1198
    using T.borel_measurable_implies_simple_function_sequence[OF f] by blast
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1199
  then have f: "(\<lambda>i x. f' i (T x)) \<up> (\<lambda>x. f (T x))" "\<And>i. simple_function (\<lambda>x. f' i (T x))"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1200
    using simple_function_vimage[OF T] unfolding isoton_fun_expand by auto
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1201
  show "T.positive_integral f = (\<integral>\<^isup>+ x. f (T x))"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1202
    using positive_integral_isoton_simple[OF f]
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1203
    using T.positive_integral_isoton_simple[OF f']
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1204
    unfolding simple_integral_vimage[OF T f'(2)] isoton_def
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1205
    by simp
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1206
qed
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1207
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1208
lemma (in measure_space) positive_integral_linear:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1209
  assumes f: "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1210
  and g: "g \<in> borel_measurable M"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1211
  shows "(\<integral>\<^isup>+ x. a * f x + g x) =
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1212
      a * positive_integral f + positive_integral g"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1213
    (is "positive_integral ?L = _")
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1214
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1215
  from borel_measurable_implies_simple_function_sequence'[OF f] guess u .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1216
  note u = this positive_integral_isoton_simple[OF this(1-2)]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1217
  from borel_measurable_implies_simple_function_sequence'[OF g] guess v .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1218
  note v = this positive_integral_isoton_simple[OF this(1-2)]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1219
  let "?L' i x" = "a * u i x + v i x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1220
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1221
  have "?L \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1222
    using assms by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1223
  from borel_measurable_implies_simple_function_sequence'[OF this] guess l .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1224
  note positive_integral_isoton_simple[OF this(1-2)] and l = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1225
  moreover have
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1226
      "(SUP i. simple_integral (l i)) = (SUP i. simple_integral (?L' i))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1227
  proof (rule SUP_simple_integral_sequences[OF l(1-2)])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1228
    show "?L' \<up> ?L" "\<And>i. simple_function (?L' i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1229
      using u v by (auto simp: isoton_fun_expand isoton_add isoton_cmult_right)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1230
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1231
  moreover from u v have L'_isoton:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1232
      "(\<lambda>i. simple_integral (?L' i)) \<up> a * positive_integral f + positive_integral g"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1233
    by (simp add: isoton_add isoton_cmult_right)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1234
  ultimately show ?thesis by (simp add: isoton_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1235
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1236
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1237
lemma (in measure_space) positive_integral_cmult:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1238
  assumes "f \<in> borel_measurable M"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1239
  shows "(\<integral>\<^isup>+ x. c * f x) = c * positive_integral f"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1240
  using positive_integral_linear[OF assms, of "\<lambda>x. 0" c] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1241
41096
843c40bbc379 integral over setprod
hoelzl
parents: 41095
diff changeset
  1242
lemma (in measure_space) positive_integral_multc:
843c40bbc379 integral over setprod
hoelzl
parents: 41095
diff changeset
  1243
  assumes "f \<in> borel_measurable M"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1244
  shows "(\<integral>\<^isup>+ x. f x * c) = positive_integral f * c"
41096
843c40bbc379 integral over setprod
hoelzl
parents: 41095
diff changeset
  1245
  unfolding mult_commute[of _ c] positive_integral_cmult[OF assms] by simp
843c40bbc379 integral over setprod
hoelzl
parents: 41095
diff changeset
  1246
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1247
lemma (in measure_space) positive_integral_indicator[simp]:
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1248
  "A \<in> sets M \<Longrightarrow> (\<integral>\<^isup>+ x. indicator A x) = \<mu> A"
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1249
  by (subst positive_integral_eq_simple_integral)
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1250
     (auto simp: simple_function_indicator simple_integral_indicator)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1251
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1252
lemma (in measure_space) positive_integral_cmult_indicator:
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1253
  "A \<in> sets M \<Longrightarrow> (\<integral>\<^isup>+ x. c * indicator A x) = c * \<mu> A"
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1254
  by (subst positive_integral_eq_simple_integral)
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1255
     (auto simp: simple_function_indicator simple_integral_indicator)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1256
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1257
lemma (in measure_space) positive_integral_add:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1258
  assumes "f \<in> borel_measurable M" "g \<in> borel_measurable M"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1259
  shows "(\<integral>\<^isup>+ x. f x + g x) = positive_integral f + positive_integral g"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1260
  using positive_integral_linear[OF assms, of 1] by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1261
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1262
lemma (in measure_space) positive_integral_setsum:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1263
  assumes "\<And>i. i\<in>P \<Longrightarrow> f i \<in> borel_measurable M"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1264
  shows "(\<integral>\<^isup>+ x. \<Sum>i\<in>P. f i x) = (\<Sum>i\<in>P. positive_integral (f i))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1265
proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1266
  assume "finite P"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1267
  from this assms show ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1268
  proof induct
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1269
    case (insert i P)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1270
    have "f i \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1271
      "(\<lambda>x. \<Sum>i\<in>P. f i x) \<in> borel_measurable M"
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  1272
      using insert by (auto intro!: borel_measurable_pextreal_setsum)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1273
    from positive_integral_add[OF this]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1274
    show ?case using insert by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1275
  qed simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1276
qed simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1277
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1278
lemma (in measure_space) positive_integral_diff:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1279
  assumes f: "f \<in> borel_measurable M" and g: "g \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1280
  and fin: "positive_integral g \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1281
  and mono: "\<And>x. x \<in> space M \<Longrightarrow> g x \<le> f x"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1282
  shows "(\<integral>\<^isup>+ x. f x - g x) = positive_integral f - positive_integral g"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1283
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1284
  have borel: "(\<lambda>x. f x - g x) \<in> borel_measurable M"
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  1285
    using f g by (rule borel_measurable_pextreal_diff)
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1286
  have "(\<integral>\<^isup>+x. f x - g x) + positive_integral g =
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1287
    positive_integral f"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1288
    unfolding positive_integral_add[OF borel g, symmetric]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1289
  proof (rule positive_integral_cong)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1290
    fix x assume "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1291
    from mono[OF this] show "f x - g x + g x = f x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1292
      by (cases "f x", cases "g x", simp, simp, cases "g x", auto)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1293
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1294
  with mono show ?thesis
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  1295
    by (subst minus_pextreal_eq2[OF _ fin]) (auto intro!: positive_integral_mono)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1296
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1297
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1298
lemma (in measure_space) positive_integral_psuminf:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1299
  assumes "\<And>i. f i \<in> borel_measurable M"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1300
  shows "(\<integral>\<^isup>+ x. \<Sum>\<^isub>\<infinity> i. f i x) = (\<Sum>\<^isub>\<infinity> i. positive_integral (f i))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1301
proof -
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1302
  have "(\<lambda>i. (\<integral>\<^isup>+x. \<Sum>i<i. f i x)) \<up> (\<integral>\<^isup>+x. \<Sum>\<^isub>\<infinity>i. f i x)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1303
    by (rule positive_integral_isoton)
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  1304
       (auto intro!: borel_measurable_pextreal_setsum assms positive_integral_mono
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1305
                     arg_cong[where f=Sup]
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
  1306
             simp: isoton_def le_fun_def psuminf_def fun_eq_iff SUPR_def Sup_fun_def)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1307
  thus ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1308
    by (auto simp: isoton_def psuminf_def positive_integral_setsum[OF assms])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1309
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1310
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1311
text {* Fatou's lemma: convergence theorem on limes inferior *}
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1312
lemma (in measure_space) positive_integral_lim_INF:
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  1313
  fixes u :: "nat \<Rightarrow> 'a \<Rightarrow> pextreal"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1314
  assumes "\<And>i. u i \<in> borel_measurable M"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1315
  shows "(\<integral>\<^isup>+ x. SUP n. INF m. u (m + n) x) \<le>
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1316
    (SUP n. INF m. positive_integral (u (m + n)))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1317
proof -
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1318
  have "(\<integral>\<^isup>+x. SUP n. INF m. u (m + n) x)
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1319
      = (SUP n. (\<integral>\<^isup>+x. INF m. u (m + n) x))"
41097
a1abfa4e2b44 use SUPR_ and INFI_apply instead of SUPR_, INFI_fun_expand
hoelzl
parents: 41096
diff changeset
  1320
    using assms
a1abfa4e2b44 use SUPR_ and INFI_apply instead of SUPR_, INFI_fun_expand
hoelzl
parents: 41096
diff changeset
  1321
    by (intro positive_integral_monotone_convergence_SUP[symmetric] INF_mono)
a1abfa4e2b44 use SUPR_ and INFI_apply instead of SUPR_, INFI_fun_expand
hoelzl
parents: 41096
diff changeset
  1322
       (auto simp del: add_Suc simp add: add_Suc[symmetric])
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1323
  also have "\<dots> \<le> (SUP n. INF m. positive_integral (u (m + n)))"
41097
a1abfa4e2b44 use SUPR_ and INFI_apply instead of SUPR_, INFI_fun_expand
hoelzl
parents: 41096
diff changeset
  1324
    by (auto intro!: SUP_mono bexI le_INFI positive_integral_mono INF_leI)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1325
  finally show ?thesis .
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1326
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1327
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1328
lemma (in measure_space) measure_space_density:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1329
  assumes borel: "u \<in> borel_measurable M"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1330
  shows "measure_space M (\<lambda>A. (\<integral>\<^isup>+ x. u x * indicator A x))" (is "measure_space M ?v")
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1331
proof
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1332
  show "?v {} = 0" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1333
  show "countably_additive M ?v"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1334
    unfolding countably_additive_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1335
  proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1336
    fix A :: "nat \<Rightarrow> 'a set"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1337
    assume "range A \<subseteq> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1338
    hence "\<And>i. (\<lambda>x. u x * indicator (A i) x) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1339
      using borel by (auto intro: borel_measurable_indicator)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1340
    moreover assume "disjoint_family A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1341
    note psuminf_indicator[OF this]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1342
    ultimately show "(\<Sum>\<^isub>\<infinity>n. ?v (A n)) = ?v (\<Union>x. A x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1343
      by (simp add: positive_integral_psuminf[symmetric])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1344
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1345
qed
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1346
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1347
lemma (in measure_space) positive_integral_translated_density:
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1348
  assumes "f \<in> borel_measurable M" "g \<in> borel_measurable M"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1349
  shows "measure_space.positive_integral M (\<lambda>A. (\<integral>\<^isup>+ x. f x * indicator A x)) g = 
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1350
         (\<integral>\<^isup>+ x. f x * g x)" (is "measure_space.positive_integral M ?T _ = _")
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1351
proof -
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1352
  from measure_space_density[OF assms(1)]
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1353
  interpret T: measure_space M ?T .
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1354
  from borel_measurable_implies_simple_function_sequence[OF assms(2)]
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1355
  obtain G where G: "\<And>i. simple_function (G i)" "G \<up> g" by blast
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1356
  note G_borel = borel_measurable_simple_function[OF this(1)]
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1357
  from T.positive_integral_isoton[OF `G \<up> g` G_borel]
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1358
  have *: "(\<lambda>i. T.positive_integral (G i)) \<up> T.positive_integral g" .
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1359
  { fix i
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1360
    have [simp]: "finite (G i ` space M)"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1361
      using G(1) unfolding simple_function_def by auto
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1362
    have "T.positive_integral (G i) = T.simple_integral (G i)"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1363
      using G T.positive_integral_eq_simple_integral by simp
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1364
    also have "\<dots> = (\<integral>\<^isup>+x. f x * (\<Sum>y\<in>G i`space M. y * indicator (G i -` {y} \<inter> space M) x))"
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1365
      apply (simp add: T.simple_integral_def)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1366
      apply (subst positive_integral_cmult[symmetric])
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1367
      using G_borel assms(1) apply (fastsimp intro: borel_measurable_indicator borel_measurable_vimage)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1368
      apply (subst positive_integral_setsum[symmetric])
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1369
      using G_borel assms(1) apply (fastsimp intro: borel_measurable_indicator borel_measurable_vimage)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1370
      by (simp add: setsum_right_distrib field_simps)
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1371
    also have "\<dots> = (\<integral>\<^isup>+x. f x * G i x)"
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1372
      by (auto intro!: positive_integral_cong
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1373
               simp: indicator_def if_distrib setsum_cases)
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1374
    finally have "T.positive_integral (G i) = (\<integral>\<^isup>+x. f x * G i x)" . }
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1375
  with * have eq_Tg: "(\<lambda>i. (\<integral>\<^isup>+x. f x * G i x)) \<up> T.positive_integral g" by simp
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1376
  from G(2) have "(\<lambda>i x. f x * G i x) \<up> (\<lambda>x. f x * g x)"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1377
    unfolding isoton_fun_expand by (auto intro!: isoton_cmult_right)
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1378
  then have "(\<lambda>i. (\<integral>\<^isup>+x. f x * G i x)) \<up> (\<integral>\<^isup>+x. f x * g x)"
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  1379
    using assms(1) G_borel by (auto intro!: positive_integral_isoton borel_measurable_pextreal_times)
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1380
  with eq_Tg show "T.positive_integral g = (\<integral>\<^isup>+x. f x * g x)"
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1381
    unfolding isoton_def by simp
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1382
qed
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1383
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1384
lemma (in measure_space) positive_integral_null_set:
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1385
  assumes "N \<in> null_sets" shows "(\<integral>\<^isup>+ x. u x * indicator N x) = 0"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1386
proof -
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1387
  have "(\<integral>\<^isup>+ x. u x * indicator N x) = (\<integral>\<^isup>+ x. 0)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1388
  proof (intro positive_integral_cong_AE AE_I)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1389
    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
  1390
      by (auto simp: indicator_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1391
    show "\<mu> N = 0" "N \<in> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1392
      using assms by auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1393
  qed
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1394
  then show ?thesis by simp
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1395
qed
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1396
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1397
lemma (in measure_space) positive_integral_Markov_inequality:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1398
  assumes borel: "u \<in> borel_measurable M" and "A \<in> sets M" and c: "c \<noteq> \<omega>"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1399
  shows "\<mu> ({x\<in>space M. 1 \<le> c * u x} \<inter> A) \<le> c * (\<integral>\<^isup>+ x. u x * indicator A x)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1400
    (is "\<mu> ?A \<le> _ * ?PI")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1401
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1402
  have "?A \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1403
    using `A \<in> sets M` borel by auto
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1404
  hence "\<mu> ?A = (\<integral>\<^isup>+ x. indicator ?A x)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1405
    using positive_integral_indicator by simp
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1406
  also have "\<dots> \<le> (\<integral>\<^isup>+ x. c * (u x * indicator A x))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1407
  proof (rule positive_integral_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1408
    fix x assume "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1409
    show "indicator ?A x \<le> c * (u x * indicator A x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1410
      by (cases "x \<in> ?A") auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1411
  qed
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1412
  also have "\<dots> = c * (\<integral>\<^isup>+ x. u x * indicator A x)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1413
    using assms
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1414
    by (auto intro!: positive_integral_cmult borel_measurable_indicator)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1415
  finally show ?thesis .
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1416
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1417
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1418
lemma (in measure_space) positive_integral_0_iff:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1419
  assumes borel: "u \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1420
  shows "positive_integral u = 0 \<longleftrightarrow> \<mu> {x\<in>space M. u x \<noteq> 0} = 0"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1421
    (is "_ \<longleftrightarrow> \<mu> ?A = 0")
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1422
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1423
  have A: "?A \<in> sets M" using borel by auto
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1424
  have u: "(\<integral>\<^isup>+ x. u x * indicator ?A x) = positive_integral u"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1425
    by (auto intro!: positive_integral_cong simp: indicator_def)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1426
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1427
  show ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1428
  proof
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1429
    assume "\<mu> ?A = 0"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1430
    hence "?A \<in> null_sets" using `?A \<in> sets M` by auto
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1431
    from positive_integral_null_set[OF this]
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1432
    have "0 = (\<integral>\<^isup>+ x. u x * indicator ?A x)" by simp
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1433
    thus "positive_integral u = 0" unfolding u by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1434
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1435
    assume *: "positive_integral u = 0"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1436
    let "?M n" = "{x \<in> space M. 1 \<le> of_nat n * u x}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1437
    have "0 = (SUP n. \<mu> (?M n \<inter> ?A))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1438
    proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1439
      { fix n
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1440
        from positive_integral_Markov_inequality[OF borel `?A \<in> sets M`, of "of_nat n"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1441
        have "\<mu> (?M n \<inter> ?A) = 0" unfolding * u by simp }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1442
      thus ?thesis by simp
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1443
    qed
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1444
    also have "\<dots> = \<mu> (\<Union>n. ?M n \<inter> ?A)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1445
    proof (safe intro!: continuity_from_below)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1446
      fix n show "?M n \<inter> ?A \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1447
        using borel by (auto intro!: Int)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1448
    next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1449
      fix n x assume "1 \<le> of_nat n * u x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1450
      also have "\<dots> \<le> of_nat (Suc n) * u x"
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  1451
        by (subst (1 2) mult_commute) (auto intro!: pextreal_mult_cancel)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1452
      finally show "1 \<le> of_nat (Suc n) * u x" .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1453
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1454
    also have "\<dots> = \<mu> ?A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1455
    proof (safe intro!: arg_cong[where f="\<mu>"])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1456
      fix x assume "u x \<noteq> 0" and [simp, intro]: "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1457
      show "x \<in> (\<Union>n. ?M n \<inter> ?A)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1458
      proof (cases "u x")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1459
        case (preal r)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1460
        obtain j where "1 / r \<le> of_nat j" using ex_le_of_nat ..
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1461
        hence "1 / r * r \<le> of_nat j * r" using preal unfolding mult_le_cancel_right by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1462
        hence "1 \<le> of_nat j * r" using preal `u x \<noteq> 0` by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1463
        thus ?thesis using `u x \<noteq> 0` preal by (auto simp: real_of_nat_def[symmetric])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1464
      qed auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1465
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1466
    finally show "\<mu> ?A = 0" by simp
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1467
  qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1468
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1469
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1470
lemma (in measure_space) positive_integral_restricted:
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1471
  assumes "A \<in> sets M"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1472
  shows "measure_space.positive_integral (restricted_space A) \<mu> f = (\<integral>\<^isup>+ x. f x * indicator A x)"
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1473
    (is "measure_space.positive_integral ?R \<mu> f = positive_integral ?f")
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1474
proof -
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1475
  have msR: "measure_space ?R \<mu>" by (rule restricted_measure_space[OF `A \<in> sets M`])
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1476
  then interpret R: measure_space ?R \<mu> .
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1477
  have saR: "sigma_algebra ?R" by fact
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1478
  have *: "R.positive_integral f = R.positive_integral ?f"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1479
    by (intro R.positive_integral_cong) auto
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1480
  show ?thesis
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1481
    unfolding * R.positive_integral_def positive_integral_def
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1482
    unfolding simple_function_restricted[OF `A \<in> sets M`]
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1483
    apply (simp add: SUPR_def)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1484
    apply (rule arg_cong[where f=Sup])
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1485
  proof (auto simp add: image_iff simple_integral_restricted[OF `A \<in> sets M`])
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1486
    fix g assume "simple_function (\<lambda>x. g x * indicator A x)"
40873
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
  1487
      "g \<le> f"
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
  1488
    then show "\<exists>x. simple_function x \<and> x \<le> (\<lambda>x. f x * indicator A x) \<and>
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1489
      (\<integral>\<^isup>Sx. g x * indicator A x) = simple_integral x"
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1490
      apply (rule_tac exI[of _ "\<lambda>x. g x * indicator A x"])
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1491
      by (auto simp: indicator_def le_fun_def)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1492
  next
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1493
    fix g assume g: "simple_function g" "g \<le> (\<lambda>x. f x * indicator A x)"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1494
    then have *: "(\<lambda>x. g x * indicator A x) = g"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1495
      "\<And>x. g x * indicator A x = g x"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1496
      "\<And>x. g x \<le> f x"
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
  1497
      by (auto simp: le_fun_def fun_eq_iff indicator_def split: split_if_asm)
40873
1ef85f4e7097 Shorter definition for positive_integral.
hoelzl
parents: 40872
diff changeset
  1498
    from g show "\<exists>x. simple_function (\<lambda>xa. x xa * indicator A xa) \<and> x \<le> f \<and>
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1499
      simple_integral g = simple_integral (\<lambda>xa. x xa * indicator A xa)"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1500
      using `A \<in> sets M`[THEN sets_into_space]
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1501
      apply (rule_tac exI[of _ "\<lambda>x. g x * indicator A x"])
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1502
      by (fastsimp simp: le_fun_def *)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1503
  qed
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1504
qed
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1505
41545
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1506
lemma (in measure_space) positive_integral_subalgebra:
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1507
  assumes borel: "f \<in> borel_measurable N"
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1508
  and N: "sets N \<subseteq> sets M" "space N = space M" and sa: "sigma_algebra N"
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1509
  shows "measure_space.positive_integral N \<mu> f = positive_integral f"
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1510
proof -
41545
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1511
  interpret N: measure_space N \<mu> using measure_space_subalgebra[OF sa N] .
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1512
  from N.borel_measurable_implies_simple_function_sequence[OF borel]
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1513
  obtain fs where Nsf: "\<And>i. N.simple_function (fs i)" and "fs \<up> f" by blast
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1514
  then have sf: "\<And>i. simple_function (fs i)"
41545
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1515
    using simple_function_subalgebra[OF _ N sa] by blast
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1516
  from positive_integral_isoton_simple[OF `fs \<up> f` sf] N.positive_integral_isoton_simple[OF `fs \<up> f` Nsf]
41545
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1517
  show ?thesis unfolding isoton_def simple_integral_def N.simple_integral_def `space N = space M` by simp
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1518
qed
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  1519
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
  1520
section "Lebesgue Integral"
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
  1521
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1522
definition (in measure_space) integrable where
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1523
  "integrable f \<longleftrightarrow> f \<in> borel_measurable M \<and>
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1524
    (\<integral>\<^isup>+ x. Real (f x)) \<noteq> \<omega> \<and>
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1525
    (\<integral>\<^isup>+ x. Real (- f x)) \<noteq> \<omega>"
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
  1526
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1527
lemma (in measure_space) integrableD[dest]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1528
  assumes "integrable f"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1529
  shows "f \<in> borel_measurable M"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1530
  "(\<integral>\<^isup>+ x. Real (f x)) \<noteq> \<omega>"
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1531
  "(\<integral>\<^isup>+ x. Real (- f x)) \<noteq> \<omega>"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1532
  using assms unfolding integrable_def by auto
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
  1533
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1534
definition (in measure_space) integral (binder "\<integral> " 10) where
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1535
  "integral f = real ((\<integral>\<^isup>+ x. Real (f x))) - real ((\<integral>\<^isup>+ x. Real (- f x)))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1536
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1537
lemma (in measure_space) integral_cong:
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1538
  assumes cong: "\<And>x. x \<in> space M \<Longrightarrow> f x = g x"
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1539
  shows "integral f = integral g"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1540
  using assms by (simp cong: positive_integral_cong add: integral_def)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1541
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1542
lemma (in measure_space) integral_cong_measure:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1543
  assumes "\<And>A. A \<in> sets M \<Longrightarrow> \<nu> A = \<mu> A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1544
  shows "measure_space.integral M \<nu> f = integral f"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1545
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1546
  interpret v: measure_space M \<nu>
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1547
    by (rule measure_space_cong) fact
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1548
  show ?thesis
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1549
    unfolding integral_def v.integral_def
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1550
    by (simp add: positive_integral_cong_measure[OF assms])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1551
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1552
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1553
lemma (in measure_space) integral_cong_AE:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1554
  assumes cong: "AE x. f x = g x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1555
  shows "integral f = integral g"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1556
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1557
  have "AE x. Real (f x) = Real (g x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1558
    using cong by (rule AE_mp) simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1559
  moreover have "AE x. Real (- f x) = Real (- g x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1560
    using cong by (rule AE_mp) simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1561
  ultimately show ?thesis
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1562
    by (simp cong: positive_integral_cong_AE add: integral_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1563
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1564
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1565
lemma (in measure_space) integrable_cong:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1566
  "(\<And>x. x \<in> space M \<Longrightarrow> f x = g x) \<Longrightarrow> integrable f \<longleftrightarrow> integrable g"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1567
  by (simp cong: positive_integral_cong measurable_cong add: integrable_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1568
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1569
lemma (in measure_space) integral_eq_positive_integral:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1570
  assumes "\<And>x. 0 \<le> f x"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1571
  shows "integral f = real ((\<integral>\<^isup>+ x. Real (f x)))"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1572
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1573
  have "\<And>x. Real (- f x) = 0" using assms by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1574
  thus ?thesis by (simp del: Real_eq_0 add: integral_def)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1575
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1576
41661
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1577
lemma (in measure_space) integral_vimage:
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1578
  assumes T: "sigma_algebra M'" "T \<in> measurable M M'"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1579
  assumes f: "measure_space.integrable M' (\<lambda>A. \<mu> (T -` A \<inter> space M)) f"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1580
  shows "integrable (\<lambda>x. f (T x))" (is ?P)
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1581
    and "measure_space.integral M' (\<lambda>A. \<mu> (T -` A \<inter> space M)) f = (\<integral>x. f (T x))" (is ?I)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1582
proof -
41661
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1583
  interpret T: measure_space M' "\<lambda>A. \<mu> (T -` A \<inter> space M)"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1584
    using T by (rule measure_space_vimage) auto
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1585
  from measurable_comp[OF T(2), of f borel]
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1586
  have borel: "(\<lambda>x. Real (f x)) \<in> borel_measurable M'" "(\<lambda>x. Real (- f x)) \<in> borel_measurable M'"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1587
    and "(\<lambda>x. f (T x)) \<in> borel_measurable M"
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1588
    using f unfolding T.integrable_def by (auto simp: comp_def)
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1589
  then show ?P ?I
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1590
    using f unfolding T.integral_def integral_def T.integrable_def integrable_def
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41545
diff changeset
  1591
    unfolding borel[THEN positive_integral_vimage[OF T]] by auto
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1592
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1593
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1594
lemma (in measure_space) integral_minus[intro, simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1595
  assumes "integrable f"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1596
  shows "integrable (\<lambda>x. - f x)" "(\<integral>x. - f x) = - integral f"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1597
  using assms by (auto simp: integrable_def integral_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1598
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1599
lemma (in measure_space) integral_of_positive_diff:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1600
  assumes integrable: "integrable u" "integrable v"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1601
  and f_def: "\<And>x. f x = u x - v x" and pos: "\<And>x. 0 \<le> u x" "\<And>x. 0 \<le> v x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1602
  shows "integrable f" and "integral f = integral u - integral v"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1603
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1604
  let ?PI = positive_integral
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1605
  let "?f x" = "Real (f x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1606
  let "?mf x" = "Real (- f x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1607
  let "?u x" = "Real (u x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1608
  let "?v x" = "Real (v x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1609
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1610
  from borel_measurable_diff[of u v] integrable
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1611
  have f_borel: "?f \<in> borel_measurable M" and
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1612
    mf_borel: "?mf \<in> borel_measurable M" and
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1613
    v_borel: "?v \<in> borel_measurable M" and
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1614
    u_borel: "?u \<in> borel_measurable M" and
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1615
    "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1616
    by (auto simp: f_def[symmetric] integrable_def)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1617
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1618
  have "?PI (\<lambda>x. Real (u x - v x)) \<le> ?PI ?u"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1619
    using pos by (auto intro!: positive_integral_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1620
  moreover have "?PI (\<lambda>x. Real (v x - u x)) \<le> ?PI ?v"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1621
    using pos by (auto intro!: positive_integral_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1622
  ultimately show f: "integrable f"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1623
    using `integrable u` `integrable v` `f \<in> borel_measurable M`
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1624
    by (auto simp: integrable_def f_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1625
  hence mf: "integrable (\<lambda>x. - f x)" ..
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1626
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1627
  have *: "\<And>x. Real (- v x) = 0" "\<And>x. Real (- u x) = 0"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1628
    using pos by auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1629
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1630
  have "\<And>x. ?u x + ?mf x = ?v x + ?f x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1631
    unfolding f_def using pos by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1632
  hence "?PI (\<lambda>x. ?u x + ?mf x) = ?PI (\<lambda>x. ?v x + ?f x)" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1633
  hence "real (?PI ?u + ?PI ?mf) = real (?PI ?v + ?PI ?f)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1634
    using positive_integral_add[OF u_borel mf_borel]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1635
    using positive_integral_add[OF v_borel f_borel]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1636
    by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1637
  then show "integral f = integral u - integral v"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1638
    using f mf `integrable u` `integrable v`
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1639
    unfolding integral_def integrable_def *
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1640
    by (cases "?PI ?f", cases "?PI ?mf", cases "?PI ?v", cases "?PI ?u")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1641
       (auto simp add: field_simps)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1642
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1643
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1644
lemma (in measure_space) integral_linear:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1645
  assumes "integrable f" "integrable g" and "0 \<le> a"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1646
  shows "integrable (\<lambda>t. a * f t + g t)"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1647
  and "(\<integral> t. a * f t + g t) = a * integral f + integral g"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1648
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1649
  let ?PI = positive_integral
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1650
  let "?f x" = "Real (f x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1651
  let "?g x" = "Real (g x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1652
  let "?mf x" = "Real (- f x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1653
  let "?mg x" = "Real (- g x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1654
  let "?p t" = "max 0 (a * f t) + max 0 (g t)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1655
  let "?n t" = "max 0 (- (a * f t)) + max 0 (- g t)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1657
  have pos: "?f \<in> borel_measurable M" "?g \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1658
    and neg: "?mf \<in> borel_measurable M" "?mg \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1659
    and p: "?p \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1660
    and n: "?n \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1661
    using assms by (simp_all add: integrable_def)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1662
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1663
  have *: "\<And>x. Real (?p x) = Real a * ?f x + ?g x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1664
          "\<And>x. Real (?n x) = Real a * ?mf x + ?mg x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1665
          "\<And>x. Real (- ?p x) = 0"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1666
          "\<And>x. Real (- ?n x) = 0"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1667
    using `0 \<le> a` by (auto simp: max_def min_def zero_le_mult_iff mult_le_0_iff add_nonpos_nonpos)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1668
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1669
  note linear =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1670
    positive_integral_linear[OF pos]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1671
    positive_integral_linear[OF neg]
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1672
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1673
  have "integrable ?p" "integrable ?n"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1674
      "\<And>t. a * f t + g t = ?p t - ?n t" "\<And>t. 0 \<le> ?p t" "\<And>t. 0 \<le> ?n t"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1675
    using assms p n unfolding integrable_def * linear by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1676
  note diff = integral_of_positive_diff[OF this]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1677
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1678
  show "integrable (\<lambda>t. a * f t + g t)" by (rule diff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1679
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1680
  from assms show "(\<integral> t. a * f t + g t) = a * integral f + integral g"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1681
    unfolding diff(2) unfolding integral_def * linear integrable_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1682
    by (cases "?PI ?f", cases "?PI ?mf", cases "?PI ?g", cases "?PI ?mg")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1683
       (auto simp add: field_simps zero_le_mult_iff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1684
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1685
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1686
lemma (in measure_space) integral_add[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1687
  assumes "integrable f" "integrable g"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1688
  shows "integrable (\<lambda>t. f t + g t)"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1689
  and "(\<integral> t. f t + g t) = integral f + integral g"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1690
  using assms integral_linear[where a=1] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1691
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1692
lemma (in measure_space) integral_zero[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1693
  shows "integrable (\<lambda>x. 0)"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1694
  and "(\<integral> x.0) = 0"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1695
  unfolding integrable_def integral_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1696
  by (auto simp add: borel_measurable_const)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1697
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1698
lemma (in measure_space) integral_cmult[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1699
  assumes "integrable f"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1700
  shows "integrable (\<lambda>t. a * f t)" (is ?P)
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1701
  and "(\<integral> t. a * f t) = a * integral f" (is ?I)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1702
proof -
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1703
  have "integrable (\<lambda>t. a * f t) \<and> (\<integral> t. a * f t) = a * integral f"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1704
  proof (cases rule: le_cases)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1705
    assume "0 \<le> a" show ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1706
      using integral_linear[OF assms integral_zero(1) `0 \<le> a`]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1707
      by (simp add: integral_zero)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1708
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1709
    assume "a \<le> 0" hence "0 \<le> - a" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1710
    have *: "\<And>t. - a * t + 0 = (-a) * t" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1711
    show ?thesis using integral_linear[OF assms integral_zero(1) `0 \<le> - a`]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1712
        integral_minus(1)[of "\<lambda>t. - a * f t"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1713
      unfolding * integral_zero by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1714
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1715
  thus ?P ?I by auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1716
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1717
41096
843c40bbc379 integral over setprod
hoelzl
parents: 41095
diff changeset
  1718
lemma (in measure_space) integral_multc:
843c40bbc379 integral over setprod
hoelzl
parents: 41095
diff changeset
  1719
  assumes "integrable f"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1720
  shows "(\<integral> x. f x * c) = integral f * c"
41096
843c40bbc379 integral over setprod
hoelzl
parents: 41095
diff changeset
  1721
  unfolding mult_commute[of _ c] integral_cmult[OF assms] ..
843c40bbc379 integral over setprod
hoelzl
parents: 41095
diff changeset
  1722
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1723
lemma (in measure_space) integral_mono_AE:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1724
  assumes fg: "integrable f" "integrable g"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1725
  and mono: "AE t. f t \<le> g t"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1726
  shows "integral f \<le> integral g"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1727
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1728
  have "AE x. Real (f x) \<le> Real (g x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1729
    using mono by (rule AE_mp) (auto intro!: AE_cong)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1730
  moreover have "AE x. Real (- g x) \<le> Real (- f x)" 
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1731
    using mono by (rule AE_mp) (auto intro!: AE_cong)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1732
  ultimately show ?thesis using fg
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1733
    by (auto simp: integral_def integrable_def diff_minus
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  1734
             intro!: add_mono real_of_pextreal_mono positive_integral_mono_AE)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1735
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1736
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1737
lemma (in measure_space) integral_mono:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1738
  assumes fg: "integrable f" "integrable g"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1739
  and mono: "\<And>t. t \<in> space M \<Longrightarrow> f t \<le> g t"
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1740
  shows "integral f \<le> integral g"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1741
  apply (rule integral_mono_AE[OF fg])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1742
  using mono by (rule AE_cong) auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1743
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1744
lemma (in measure_space) integral_diff[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1745
  assumes f: "integrable f" and g: "integrable g"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1746
  shows "integrable (\<lambda>t. f t - g t)"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1747
  and "(\<integral> t. f t - g t) = integral f - integral g"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1748
  using integral_add[OF f integral_minus(1)[OF g]]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1749
  unfolding diff_minus integral_minus(2)[OF g]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1750
  by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1751
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1752
lemma (in measure_space) integral_indicator[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1753
  assumes "a \<in> sets M" and "\<mu> a \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1754
  shows "integral (indicator a) = real (\<mu> a)" (is ?int)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1755
  and "integrable (indicator a)" (is ?able)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1756
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1757
  have *:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1758
    "\<And>A x. Real (indicator A x) = indicator A x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1759
    "\<And>A x. Real (- indicator A x) = 0" unfolding indicator_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1760
  show ?int ?able
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1761
    using assms unfolding integral_def integrable_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1762
    by (auto simp: * positive_integral_indicator borel_measurable_indicator)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1763
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1764
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1765
lemma (in measure_space) integral_cmul_indicator:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1766
  assumes "A \<in> sets M" and "c \<noteq> 0 \<Longrightarrow> \<mu> A \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1767
  shows "integrable (\<lambda>x. c * indicator A x)" (is ?P)
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1768
  and "(\<integral>x. c * indicator A x) = c * real (\<mu> A)" (is ?I)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1769
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1770
  show ?P
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1771
  proof (cases "c = 0")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1772
    case False with assms show ?thesis by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1773
  qed simp
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1774
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1775
  show ?I
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1776
  proof (cases "c = 0")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1777
    case False with assms show ?thesis by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1778
  qed simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1779
qed
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1780
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1781
lemma (in measure_space) integral_setsum[simp, intro]:
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1782
  assumes "\<And>n. n \<in> S \<Longrightarrow> integrable (f n)"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1783
  shows "(\<integral>x. \<Sum> i \<in> S. f i x) = (\<Sum> i \<in> S. integral (f i))" (is "?int S")
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1784
    and "integrable (\<lambda>x. \<Sum> i \<in> S. f i x)" (is "?I S")
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1785
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1786
  have "?int S \<and> ?I S"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1787
  proof (cases "finite S")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1788
    assume "finite S"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1789
    from this assms show ?thesis by (induct S) simp_all
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1790
  qed simp
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1791
  thus "?int S" and "?I S" by auto
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1792
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1793
36624
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
  1794
lemma (in measure_space) integrable_abs:
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
  1795
  assumes "integrable f"
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
  1796
  shows "integrable (\<lambda> x. \<bar>f x\<bar>)"
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
  1797
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1798
  have *:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1799
    "\<And>x. Real \<bar>f x\<bar> = Real (f x) + Real (- f x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1800
    "\<And>x. Real (- \<bar>f x\<bar>) = 0" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1801
  have abs: "(\<lambda>x. \<bar>f x\<bar>) \<in> borel_measurable M" and
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1802
    f: "(\<lambda>x. Real (f x)) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1803
        "(\<lambda>x. Real (- f x)) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1804
    using assms unfolding integrable_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1805
  from abs assms show ?thesis unfolding integrable_def *
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1806
    using positive_integral_linear[OF f, of 1] by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1807
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1808
41545
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1809
lemma (in measure_space) integral_subalgebra:
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1810
  assumes borel: "f \<in> borel_measurable N"
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1811
  and N: "sets N \<subseteq> sets M" "space N = space M" and sa: "sigma_algebra N"
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1812
  shows "measure_space.integrable N \<mu> f \<longleftrightarrow> integrable f" (is ?P)
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1813
    and "measure_space.integral N \<mu> f = integral f" (is ?I)
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1814
proof -
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1815
  interpret N: measure_space N \<mu> using measure_space_subalgebra[OF sa N] .
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1816
  have "(\<lambda>x. Real (f x)) \<in> borel_measurable N" "(\<lambda>x. Real (- f x)) \<in> borel_measurable N"
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1817
    using borel by auto
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1818
  note * = this[THEN positive_integral_subalgebra[OF _ N sa]]
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1819
  have "f \<in> borel_measurable M \<longleftrightarrow> f \<in> borel_measurable N"
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1820
    using assms unfolding measurable_def by auto
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1821
  then show ?P ?I unfolding integrable_def N.integrable_def integral_def N.integral_def
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1822
    unfolding * by auto
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1823
qed
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41544
diff changeset
  1824
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1825
lemma (in measure_space) integrable_bound:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1826
  assumes "integrable f"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1827
  and f: "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> f x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1828
    "\<And>x. x \<in> space M \<Longrightarrow> \<bar>g x\<bar> \<le> f x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1829
  assumes borel: "g \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1830
  shows "integrable g"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1831
proof -
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1832
  have "(\<integral>\<^isup>+ x. Real (g x)) \<le> (\<integral>\<^isup>+ x. Real \<bar>g x\<bar>)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1833
    by (auto intro!: positive_integral_mono)
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1834
  also have "\<dots> \<le> (\<integral>\<^isup>+ x. Real (f x))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1835
    using f by (auto intro!: positive_integral_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1836
  also have "\<dots> < \<omega>"
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  1837
    using `integrable f` unfolding integrable_def by (auto simp: pextreal_less_\<omega>)
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1838
  finally have pos: "(\<integral>\<^isup>+ x. Real (g x)) < \<omega>" .
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1839
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1840
  have "(\<integral>\<^isup>+ x. Real (- g x)) \<le> (\<integral>\<^isup>+ x. Real (\<bar>g x\<bar>))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1841
    by (auto intro!: positive_integral_mono)
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1842
  also have "\<dots> \<le> (\<integral>\<^isup>+ x. Real (f x))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1843
    using f by (auto intro!: positive_integral_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1844
  also have "\<dots> < \<omega>"
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  1845
    using `integrable f` unfolding integrable_def by (auto simp: pextreal_less_\<omega>)
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1846
  finally have neg: "(\<integral>\<^isup>+ x. Real (- g x)) < \<omega>" .
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1847
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1848
  from neg pos borel show ?thesis
36624
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
  1849
    unfolding integrable_def by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1850
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1851
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1852
lemma (in measure_space) integrable_abs_iff:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1853
  "f \<in> borel_measurable M \<Longrightarrow> integrable (\<lambda> x. \<bar>f x\<bar>) \<longleftrightarrow> integrable f"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1854
  by (auto intro!: integrable_bound[where g=f] integrable_abs)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1855
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1856
lemma (in measure_space) integrable_max:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1857
  assumes int: "integrable f" "integrable g"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1858
  shows "integrable (\<lambda> x. max (f x) (g x))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1859
proof (rule integrable_bound)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1860
  show "integrable (\<lambda>x. \<bar>f x\<bar> + \<bar>g x\<bar>)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1861
    using int by (simp add: integrable_abs)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1862
  show "(\<lambda>x. max (f x) (g x)) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1863
    using int unfolding integrable_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1864
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1865
  fix x assume "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1866
  show "0 \<le> \<bar>f x\<bar> + \<bar>g x\<bar>" "\<bar>max (f x) (g x)\<bar> \<le> \<bar>f x\<bar> + \<bar>g x\<bar>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1867
    by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1868
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1869
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1870
lemma (in measure_space) integrable_min:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1871
  assumes int: "integrable f" "integrable g"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1872
  shows "integrable (\<lambda> x. min (f x) (g x))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1873
proof (rule integrable_bound)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1874
  show "integrable (\<lambda>x. \<bar>f x\<bar> + \<bar>g x\<bar>)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1875
    using int by (simp add: integrable_abs)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1876
  show "(\<lambda>x. min (f x) (g x)) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1877
    using int unfolding integrable_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1878
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1879
  fix x assume "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1880
  show "0 \<le> \<bar>f x\<bar> + \<bar>g x\<bar>" "\<bar>min (f x) (g x)\<bar> \<le> \<bar>f x\<bar> + \<bar>g x\<bar>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1881
    by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1882
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1883
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1884
lemma (in measure_space) integral_triangle_inequality:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1885
  assumes "integrable f"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1886
  shows "\<bar>integral f\<bar> \<le> (\<integral>x. \<bar>f x\<bar>)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1887
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1888
  have "\<bar>integral f\<bar> = max (integral f) (- integral f)" by auto
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1889
  also have "\<dots> \<le> (\<integral>x. \<bar>f x\<bar>)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1890
      using assms integral_minus(2)[of f, symmetric]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1891
      by (auto intro!: integral_mono integrable_abs simp del: integral_minus)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1892
  finally show ?thesis .
36624
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
  1893
qed
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
  1894
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1895
lemma (in measure_space) integral_positive:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1896
  assumes "integrable f" "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> f x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1897
  shows "0 \<le> integral f"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1898
proof -
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1899
  have "0 = (\<integral>x. 0)" by (auto simp: integral_zero)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1900
  also have "\<dots> \<le> integral f"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1901
    using assms by (rule integral_mono[OF integral_zero(1)])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1902
  finally show ?thesis .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1903
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1904
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1905
lemma (in measure_space) integral_monotone_convergence_pos:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1906
  assumes i: "\<And>i. integrable (f i)" and mono: "\<And>x. mono (\<lambda>n. f n x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1907
  and pos: "\<And>x i. 0 \<le> f i x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1908
  and lim: "\<And>x. (\<lambda>i. f i x) ----> u x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1909
  and ilim: "(\<lambda>i. integral (f i)) ----> x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1910
  shows "integrable u"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1911
  and "integral u = x"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1912
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1913
  { fix x have "0 \<le> u x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1914
      using mono pos[of 0 x] incseq_le[OF _ lim, of x 0]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1915
      by (simp add: mono_def incseq_def) }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1916
  note pos_u = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1917
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1918
  hence [simp]: "\<And>i x. Real (- f i x) = 0" "\<And>x. Real (- u x) = 0"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1919
    using pos by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1920
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1921
  have SUP_F: "\<And>x. (SUP n. Real (f n x)) = Real (u x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1922
    using mono pos pos_u lim by (rule SUP_eq_LIMSEQ[THEN iffD2])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1923
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1924
  have borel_f: "\<And>i. (\<lambda>x. Real (f i x)) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1925
    using i unfolding integrable_def by auto
41097
a1abfa4e2b44 use SUPR_ and INFI_apply instead of SUPR_, INFI_fun_expand
hoelzl
parents: 41096
diff changeset
  1926
  hence "(\<lambda>x. SUP i. Real (f i x)) \<in> borel_measurable M"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1927
    by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1928
  hence borel_u: "u \<in> borel_measurable M"
41097
a1abfa4e2b44 use SUPR_ and INFI_apply instead of SUPR_, INFI_fun_expand
hoelzl
parents: 41096
diff changeset
  1929
    using pos_u by (auto simp: borel_measurable_Real_eq SUP_F)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1930
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1931
  have integral_eq: "\<And>n. (\<integral>\<^isup>+ x. Real (f n x)) = Real (integral (f n))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1932
    using i unfolding integral_def integrable_def by (auto simp: Real_real)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1933
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1934
  have pos_integral: "\<And>n. 0 \<le> integral (f n)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1935
    using pos i by (auto simp: integral_positive)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1936
  hence "0 \<le> x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1937
    using LIMSEQ_le_const[OF ilim, of 0] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1938
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1939
  have "(\<lambda>i. (\<integral>\<^isup>+ x. Real (f i x))) \<up> (\<integral>\<^isup>+ x. Real (u x))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1940
  proof (rule positive_integral_isoton)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1941
    from SUP_F mono pos
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1942
    show "(\<lambda>i x. Real (f i x)) \<up> (\<lambda>x. Real (u x))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1943
      unfolding isoton_fun_expand by (auto simp: isoton_def mono_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1944
  qed (rule borel_f)
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1945
  hence pI: "(\<integral>\<^isup>+ x. Real (u x)) =
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1946
      (SUP n. (\<integral>\<^isup>+ x. Real (f n x)))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1947
    unfolding isoton_def by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1948
  also have "\<dots> = Real x" unfolding integral_eq
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1949
  proof (rule SUP_eq_LIMSEQ[THEN iffD2])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1950
    show "mono (\<lambda>n. integral (f n))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1951
      using mono i by (auto simp: mono_def intro!: integral_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1952
    show "\<And>n. 0 \<le> integral (f n)" using pos_integral .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1953
    show "0 \<le> x" using `0 \<le> x` .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1954
    show "(\<lambda>n. integral (f n)) ----> x" using ilim .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1955
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1956
  finally show  "integrable u" "integral u = x" using borel_u `0 \<le> x`
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1957
    unfolding integrable_def integral_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1958
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1959
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1960
lemma (in measure_space) integral_monotone_convergence:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1961
  assumes f: "\<And>i. integrable (f i)" and "mono f"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1962
  and lim: "\<And>x. (\<lambda>i. f i x) ----> u x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1963
  and ilim: "(\<lambda>i. integral (f i)) ----> x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1964
  shows "integrable u"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1965
  and "integral u = x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1966
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1967
  have 1: "\<And>i. integrable (\<lambda>x. f i x - f 0 x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1968
      using f by (auto intro!: integral_diff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1969
  have 2: "\<And>x. mono (\<lambda>n. f n x - f 0 x)" using `mono f`
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1970
      unfolding mono_def le_fun_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1971
  have 3: "\<And>x n. 0 \<le> f n x - f 0 x" using `mono f`
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1972
      unfolding mono_def le_fun_def by (auto simp: field_simps)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1973
  have 4: "\<And>x. (\<lambda>i. f i x - f 0 x) ----> u x - f 0 x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1974
    using lim by (auto intro!: LIMSEQ_diff)
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1975
  have 5: "(\<lambda>i. (\<integral>x. f i x - f 0 x)) ----> x - integral (f 0)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1976
    using f ilim by (auto intro!: LIMSEQ_diff simp: integral_diff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1977
  note diff = integral_monotone_convergence_pos[OF 1 2 3 4 5]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1978
  have "integrable (\<lambda>x. (u x - f 0 x) + f 0 x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1979
    using diff(1) f by (rule integral_add(1))
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1980
  with diff(2) f show "integrable u" "integral u = x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1981
    by (auto simp: integral_diff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1982
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1983
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1984
lemma (in measure_space) integral_0_iff:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1985
  assumes "integrable f"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1986
  shows "(\<integral>x. \<bar>f x\<bar>) = 0 \<longleftrightarrow> \<mu> {x\<in>space M. f x \<noteq> 0} = 0"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1987
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1988
  have *: "\<And>x. Real (- \<bar>f x\<bar>) = 0" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1989
  have "integrable (\<lambda>x. \<bar>f x\<bar>)" using assms by (rule integrable_abs)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1990
  hence "(\<lambda>x. Real (\<bar>f x\<bar>)) \<in> borel_measurable M"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  1991
    "(\<integral>\<^isup>+ x. Real \<bar>f x\<bar>) \<noteq> \<omega>" unfolding integrable_def by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1992
  from positive_integral_0_iff[OF this(1)] this(2)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  1993
  show ?thesis unfolding integral_def *
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  1994
    by (simp add: real_of_pextreal_eq_0)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1995
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  1996
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1997
lemma (in measure_space) positive_integral_omega:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1998
  assumes "f \<in> borel_measurable M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  1999
  and "positive_integral f \<noteq> \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  2000
  shows "\<mu> (f -` {\<omega>} \<inter> space M) = 0"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  2001
proof -
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2002
  have "\<omega> * \<mu> (f -` {\<omega>} \<inter> space M) = (\<integral>\<^isup>+ x. \<omega> * indicator (f -` {\<omega>} \<inter> space M) x)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  2003
    using positive_integral_cmult_indicator[OF borel_measurable_vimage, OF assms(1), of \<omega> \<omega>] by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  2004
  also have "\<dots> \<le> positive_integral f"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  2005
    by (auto intro!: positive_integral_mono simp: indicator_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  2006
  finally show ?thesis
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  2007
    using assms(2) by (cases ?thesis) auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  2008
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  2009
41026
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2010
lemma (in measure_space) positive_integral_omega_AE:
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2011
  assumes "f \<in> borel_measurable M" "positive_integral f \<noteq> \<omega>" shows "AE x. f x \<noteq> \<omega>"
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2012
proof (rule AE_I)
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2013
  show "\<mu> (f -` {\<omega>} \<inter> space M) = 0"
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2014
    by (rule positive_integral_omega[OF assms])
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2015
  show "f -` {\<omega>} \<inter> space M \<in> sets M"
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2016
    using assms by (auto intro: borel_measurable_vimage)
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2017
qed auto
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2018
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  2019
lemma (in measure_space) simple_integral_omega:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  2020
  assumes "simple_function f"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  2021
  and "simple_integral f \<noteq> \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  2022
  shows "\<mu> (f -` {\<omega>} \<inter> space M) = 0"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  2023
proof (rule positive_integral_omega)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  2024
  show "f \<in> borel_measurable M" using assms by (auto intro: borel_measurable_simple_function)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  2025
  show "positive_integral f \<noteq> \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  2026
    using assms by (simp add: positive_integral_eq_simple_integral)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  2027
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40786
diff changeset
  2028
41026
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2029
lemma (in measure_space) integral_real:
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2030
  fixes f :: "'a \<Rightarrow> pextreal"
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2031
  assumes "AE x. f x \<noteq> \<omega>"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2032
  shows "(\<integral>x. real (f x)) = real (positive_integral f)" (is ?plus)
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2033
    and "(\<integral>x. - real (f x)) = - real (positive_integral f)" (is ?minus)
41026
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2034
proof -
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2035
  have "(\<integral>\<^isup>+ x. Real (real (f x))) = positive_integral f"
41026
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2036
    apply (rule positive_integral_cong_AE)
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2037
    apply (rule AE_mp[OF assms(1)])
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2038
    by (auto intro!: AE_cong simp: Real_real)
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2039
  moreover
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2040
  have "(\<integral>\<^isup>+ x. Real (- real (f x))) = (\<integral>\<^isup>+ x. 0)"
41026
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2041
    by (intro positive_integral_cong) auto
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2042
  ultimately show ?plus ?minus
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2043
    by (auto simp: integral_def integrable_def)
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2044
qed
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
  2045
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2046
lemma (in measure_space) integral_dominated_convergence:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2047
  assumes u: "\<And>i. integrable (u i)" and bound: "\<And>x j. x\<in>space M \<Longrightarrow> \<bar>u j x\<bar> \<le> w x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2048
  and w: "integrable w" "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> w x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2049
  and u': "\<And>x. x \<in> space M \<Longrightarrow> (\<lambda>i. u i x) ----> u' x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2050
  shows "integrable u'"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2051
  and "(\<lambda>i. (\<integral>x. \<bar>u i x - u' x\<bar>)) ----> 0" (is "?lim_diff")
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2052
  and "(\<lambda>i. integral (u i)) ----> integral u'" (is ?lim)
36624
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
  2053
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2054
  { fix x j assume x: "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2055
    from u'[OF x] have "(\<lambda>i. \<bar>u i x\<bar>) ----> \<bar>u' x\<bar>" by (rule LIMSEQ_imp_rabs)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2056
    from LIMSEQ_le_const2[OF this]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2057
    have "\<bar>u' x\<bar> \<le> w x" using bound[OF x] by auto }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2058
  note u'_bound = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2059
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2060
  from u[unfolded integrable_def]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2061
  have u'_borel: "u' \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2062
    using u' by (blast intro: borel_measurable_LIMSEQ[of u])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2063
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2064
  show "integrable u'"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2065
  proof (rule integrable_bound)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2066
    show "integrable w" by fact
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2067
    show "u' \<in> borel_measurable M" by fact
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2068
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2069
    fix x assume x: "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2070
    thus "0 \<le> w x" by fact
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2071
    show "\<bar>u' x\<bar> \<le> w x" using u'_bound[OF x] .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2072
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2073
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2074
  let "?diff n x" = "2 * w x - \<bar>u n x - u' x\<bar>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2075
  have diff: "\<And>n. integrable (\<lambda>x. \<bar>u n x - u' x\<bar>)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2076
    using w u `integrable u'`
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2077
    by (auto intro!: integral_add integral_diff integral_cmult integrable_abs)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2078
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2079
  { fix j x assume x: "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2080
    have "\<bar>u j x - u' x\<bar> \<le> \<bar>u j x\<bar> + \<bar>u' x\<bar>" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2081
    also have "\<dots> \<le> w x + w x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2082
      by (rule add_mono[OF bound[OF x] u'_bound[OF x]])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2083
    finally have "\<bar>u j x - u' x\<bar> \<le> 2 * w x" by simp }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2084
  note diff_less_2w = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2085
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2086
  have PI_diff: "\<And>m n. (\<integral>\<^isup>+ x. Real (?diff (m + n) x)) =
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2087
    (\<integral>\<^isup>+ x. Real (2 * w x)) - (\<integral>\<^isup>+ x. Real \<bar>u (m + n) x - u' x\<bar>)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2088
    using diff w diff_less_2w
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2089
    by (subst positive_integral_diff[symmetric])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2090
       (auto simp: integrable_def intro!: positive_integral_cong)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2091
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2092
  have "integrable (\<lambda>x. 2 * w x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2093
    using w by (auto intro: integral_cmult)
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2094
  hence I2w_fin: "(\<integral>\<^isup>+ x. Real (2 * w x)) \<noteq> \<omega>" and
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2095
    borel_2w: "(\<lambda>x. Real (2 * w x)) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2096
    unfolding integrable_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2097
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2098
  have "(INF n. SUP m. (\<integral>\<^isup>+ x. Real \<bar>u (m + n) x - u' x\<bar>)) = 0" (is "?lim_SUP = 0")
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2099
  proof cases
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2100
    assume eq_0: "(\<integral>\<^isup>+ x. Real (2 * w x)) = 0"
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2101
    have "\<And>i. (\<integral>\<^isup>+ x. Real \<bar>u i x - u' x\<bar>) \<le> (\<integral>\<^isup>+ x. Real (2 * w x))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2102
    proof (rule positive_integral_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2103
      fix i x assume "x \<in> space M" from diff_less_2w[OF this, of i]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2104
      show "Real \<bar>u i x - u' x\<bar> \<le> Real (2 * w x)" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2105
    qed
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2106
    hence "\<And>i. (\<integral>\<^isup>+ x. Real \<bar>u i x - u' x\<bar>) = 0" using eq_0 by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2107
    thus ?thesis by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2108
  next
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2109
    assume neq_0: "(\<integral>\<^isup>+ x. Real (2 * w x)) \<noteq> 0"
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2110
    have "(\<integral>\<^isup>+ x. Real (2 * w x)) = (\<integral>\<^isup>+ x. SUP n. INF m. Real (?diff (m + n) x))"
41097
a1abfa4e2b44 use SUPR_ and INFI_apply instead of SUPR_, INFI_fun_expand
hoelzl
parents: 41096
diff changeset
  2111
    proof (rule positive_integral_cong, subst add_commute)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2112
      fix x assume x: "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2113
      show "Real (2 * w x) = (SUP n. INF m. Real (?diff (n + m) x))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2114
      proof (rule LIMSEQ_imp_lim_INF[symmetric])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2115
        fix j show "0 \<le> ?diff j x" using diff_less_2w[OF x, of j] by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2116
      next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2117
        have "(\<lambda>i. ?diff i x) ----> 2 * w x - \<bar>u' x - u' x\<bar>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2118
          using u'[OF x] by (safe intro!: LIMSEQ_diff LIMSEQ_const LIMSEQ_imp_rabs)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2119
        thus "(\<lambda>i. ?diff i x) ----> 2 * w x" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2120
      qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2121
    qed
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2122
    also have "\<dots> \<le> (SUP n. INF m. (\<integral>\<^isup>+ x. Real (?diff (m + n) x)))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2123
      using u'_borel w u unfolding integrable_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2124
      by (auto intro!: positive_integral_lim_INF)
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2125
    also have "\<dots> = (\<integral>\<^isup>+ x. Real (2 * w x)) -
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2126
        (INF n. SUP m. (\<integral>\<^isup>+ x. Real \<bar>u (m + n) x - u' x\<bar>))"
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  2127
      unfolding PI_diff pextreal_INF_minus[OF I2w_fin] pextreal_SUP_minus ..
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  2128
    finally show ?thesis using neq_0 I2w_fin by (rule pextreal_le_minus_imp_0)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2129
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2130
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2131
  have [simp]: "\<And>n m x. Real (- \<bar>u (m + n) x - u' x\<bar>) = 0" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2132
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2133
  have [simp]: "\<And>n m. (\<integral>\<^isup>+ x. Real \<bar>u (m + n) x - u' x\<bar>) =
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2134
    Real ((\<integral>x. \<bar>u (n + m) x - u' x\<bar>))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2135
    using diff by (subst add_commute) (simp add: integral_def integrable_def Real_real)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2136
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2137
  have "(SUP n. INF m. (\<integral>\<^isup>+ x. Real \<bar>u (m + n) x - u' x\<bar>)) \<le> ?lim_SUP"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2138
    (is "?lim_INF \<le> _") by (subst (1 2) add_commute) (rule lim_INF_le_lim_SUP)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2139
  hence "?lim_INF = Real 0" "?lim_SUP = Real 0" using `?lim_SUP = 0` by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2140
  thus ?lim_diff using diff by (auto intro!: integral_positive lim_INF_eq_lim_SUP)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2141
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2142
  show ?lim
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2143
  proof (rule LIMSEQ_I)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2144
    fix r :: real assume "0 < r"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2145
    from LIMSEQ_D[OF `?lim_diff` this]
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2146
    obtain N where N: "\<And>n. N \<le> n \<Longrightarrow> (\<integral>x. \<bar>u n x - u' x\<bar>) < r"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2147
      using diff by (auto simp: integral_positive)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2148
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2149
    show "\<exists>N. \<forall>n\<ge>N. norm (integral (u n) - integral u') < r"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2150
    proof (safe intro!: exI[of _ N])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2151
      fix n assume "N \<le> n"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2152
      have "\<bar>integral (u n) - integral u'\<bar> = \<bar>(\<integral>x. u n x - u' x)\<bar>"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2153
        using u `integrable u'` by (auto simp: integral_diff)
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2154
      also have "\<dots> \<le> (\<integral>x. \<bar>u n x - u' x\<bar>)" using u `integrable u'`
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2155
        by (rule_tac integral_triangle_inequality) (auto intro!: integral_diff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2156
      also note N[OF `N \<le> n`]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2157
      finally show "norm (integral (u n) - integral u') < r" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2158
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2159
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2160
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2161
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2162
lemma (in measure_space) integral_sums:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2163
  assumes borel: "\<And>i. integrable (f i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2164
  and summable: "\<And>x. x \<in> space M \<Longrightarrow> summable (\<lambda>i. \<bar>f i x\<bar>)"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2165
  and sums: "summable (\<lambda>i. (\<integral>x. \<bar>f i x\<bar>))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2166
  shows "integrable (\<lambda>x. (\<Sum>i. f i x))" (is "integrable ?S")
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2167
  and "(\<lambda>i. integral (f i)) sums (\<integral>x. (\<Sum>i. f i x))" (is ?integral)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2168
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2169
  have "\<forall>x\<in>space M. \<exists>w. (\<lambda>i. \<bar>f i x\<bar>) sums w"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2170
    using summable unfolding summable_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2171
  from bchoice[OF this]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2172
  obtain w where w: "\<And>x. x \<in> space M \<Longrightarrow> (\<lambda>i. \<bar>f i x\<bar>) sums w x" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2173
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2174
  let "?w y" = "if y \<in> space M then w y else 0"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2175
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2176
  obtain x where abs_sum: "(\<lambda>i. (\<integral>x. \<bar>f i x\<bar>)) sums x"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2177
    using sums unfolding summable_def ..
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2178
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2179
  have 1: "\<And>n. integrable (\<lambda>x. \<Sum>i = 0..<n. f i x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2180
    using borel by (auto intro!: integral_setsum)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2181
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2182
  { fix j x assume [simp]: "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2183
    have "\<bar>\<Sum>i = 0..< j. f i x\<bar> \<le> (\<Sum>i = 0..< j. \<bar>f i x\<bar>)" by (rule setsum_abs)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2184
    also have "\<dots> \<le> w x" using w[of x] series_pos_le[of "\<lambda>i. \<bar>f i x\<bar>"] unfolding sums_iff by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2185
    finally have "\<bar>\<Sum>i = 0..<j. f i x\<bar> \<le> ?w x" by simp }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2186
  note 2 = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2187
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2188
  have 3: "integrable ?w"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2189
  proof (rule integral_monotone_convergence(1))
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2190
    let "?F n y" = "(\<Sum>i = 0..<n. \<bar>f i y\<bar>)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2191
    let "?w' n y" = "if y \<in> space M then ?F n y else 0"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2192
    have "\<And>n. integrable (?F n)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2193
      using borel by (auto intro!: integral_setsum integrable_abs)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2194
    thus "\<And>n. integrable (?w' n)" by (simp cong: integrable_cong)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2195
    show "mono ?w'"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2196
      by (auto simp: mono_def le_fun_def intro!: setsum_mono2)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2197
    { fix x show "(\<lambda>n. ?w' n x) ----> ?w x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2198
        using w by (cases "x \<in> space M") (simp_all add: LIMSEQ_const sums_def) }
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2199
    have *: "\<And>n. integral (?w' n) = (\<Sum>i = 0..< n. (\<integral>x. \<bar>f i x\<bar>))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2200
      using borel by (simp add: integral_setsum integrable_abs cong: integral_cong)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2201
    from abs_sum
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2202
    show "(\<lambda>i. integral (?w' i)) ----> x" unfolding * sums_def .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2203
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2204
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2205
  have 4: "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> ?w x" using 2[of _ 0] by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2206
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2207
  from summable[THEN summable_rabs_cancel]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2208
  have 5: "\<And>x. x \<in> space M \<Longrightarrow> (\<lambda>n. \<Sum>i = 0..<n. f i x) ----> (\<Sum>i. f i x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2209
    by (auto intro: summable_sumr_LIMSEQ_suminf)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2210
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2211
  note int = integral_dominated_convergence(1,3)[OF 1 2 3 4 5]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2212
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2213
  from int show "integrable ?S" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2214
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2215
  show ?integral unfolding sums_def integral_setsum(1)[symmetric, OF borel]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2216
    using int(2) by simp
36624
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
  2217
qed
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
  2218
35748
5f35613d9a65 Equality of integral and infinite sum.
hoelzl
parents: 35692
diff changeset
  2219
section "Lebesgue integration on countable spaces"
5f35613d9a65 Equality of integral and infinite sum.
hoelzl
parents: 35692
diff changeset
  2220
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2221
lemma (in measure_space) integral_on_countable:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2222
  assumes f: "f \<in> borel_measurable M"
35748
5f35613d9a65 Equality of integral and infinite sum.
hoelzl
parents: 35692
diff changeset
  2223
  and bij: "bij_betw enum S (f ` space M)"
5f35613d9a65 Equality of integral and infinite sum.
hoelzl
parents: 35692
diff changeset
  2224
  and enum_zero: "enum ` (-S) \<subseteq> {0}"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2225
  and fin: "\<And>x. x \<noteq> 0 \<Longrightarrow> \<mu> (f -` {x} \<inter> space M) \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2226
  and abs_summable: "summable (\<lambda>r. \<bar>enum r * real (\<mu> (f -` {enum r} \<inter> space M))\<bar>)"
35748
5f35613d9a65 Equality of integral and infinite sum.
hoelzl
parents: 35692
diff changeset
  2227
  shows "integrable f"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2228
  and "(\<lambda>r. enum r * real (\<mu> (f -` {enum r} \<inter> space M))) sums integral f" (is ?sums)
35748
5f35613d9a65 Equality of integral and infinite sum.
hoelzl
parents: 35692
diff changeset
  2229
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2230
  let "?A r" = "f -` {enum r} \<inter> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2231
  let "?F r x" = "enum r * indicator (?A r) x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2232
  have enum_eq: "\<And>r. enum r * real (\<mu> (?A r)) = integral (?F r)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2233
    using f fin by (simp add: borel_measurable_vimage integral_cmul_indicator)
35748
5f35613d9a65 Equality of integral and infinite sum.
hoelzl
parents: 35692
diff changeset
  2234
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2235
  { fix x assume "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2236
    hence "f x \<in> enum ` S" using bij unfolding bij_betw_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2237
    then obtain i where "i\<in>S" "enum i = f x" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2238
    have F: "\<And>j. ?F j x = (if j = i then f x else 0)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2239
    proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2240
      fix j assume "j = i"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2241
      thus "?thesis j" using `x \<in> space M` `enum i = f x` by (simp add: indicator_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2242
    next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2243
      fix j assume "j \<noteq> i"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2244
      show "?thesis j" using bij `i \<in> S` `j \<noteq> i` `enum i = f x` enum_zero
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2245
        by (cases "j \<in> S") (auto simp add: indicator_def bij_betw_def inj_on_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2246
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2247
    hence F_abs: "\<And>j. \<bar>if j = i then f x else 0\<bar> = (if j = i then \<bar>f x\<bar> else 0)" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2248
    have "(\<lambda>i. ?F i x) sums f x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2249
         "(\<lambda>i. \<bar>?F i x\<bar>) sums \<bar>f x\<bar>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2250
      by (auto intro!: sums_single simp: F F_abs) }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2251
  note F_sums_f = this(1) and F_abs_sums_f = this(2)
35748
5f35613d9a65 Equality of integral and infinite sum.
hoelzl
parents: 35692
diff changeset
  2252
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2253
  have int_f: "integral f = (\<integral>x. \<Sum>r. ?F r x)" "integrable f = integrable (\<lambda>x. \<Sum>r. ?F r x)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2254
    using F_sums_f by (auto intro!: integral_cong integrable_cong simp: sums_iff)
35748
5f35613d9a65 Equality of integral and infinite sum.
hoelzl
parents: 35692
diff changeset
  2255
5f35613d9a65 Equality of integral and infinite sum.
hoelzl
parents: 35692
diff changeset
  2256
  { fix r
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2257
    have "(\<integral>x. \<bar>?F r x\<bar>) = (\<integral>x. \<bar>enum r\<bar> * indicator (?A r) x)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2258
      by (auto simp: indicator_def intro!: integral_cong)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2259
    also have "\<dots> = \<bar>enum r\<bar> * real (\<mu> (?A r))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2260
      using f fin by (simp add: borel_measurable_vimage integral_cmul_indicator)
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2261
    finally have "(\<integral>x. \<bar>?F r x\<bar>) = \<bar>enum r * real (\<mu> (?A r))\<bar>"
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  2262
      by (simp add: abs_mult_pos real_pextreal_pos) }
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2263
  note int_abs_F = this
35748
5f35613d9a65 Equality of integral and infinite sum.
hoelzl
parents: 35692
diff changeset
  2264
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2265
  have 1: "\<And>i. integrable (\<lambda>x. ?F i x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2266
    using f fin by (simp add: borel_measurable_vimage integral_cmul_indicator)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2267
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2268
  have 2: "\<And>x. x \<in> space M \<Longrightarrow> summable (\<lambda>i. \<bar>?F i x\<bar>)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2269
    using F_abs_sums_f unfolding sums_iff by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2270
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2271
  from integral_sums(2)[OF 1 2, unfolded int_abs_F, OF _ abs_summable]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2272
  show ?sums unfolding enum_eq int_f by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2273
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2274
  from integral_sums(1)[OF 1 2, unfolded int_abs_F, OF _ abs_summable]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2275
  show "integrable f" unfolding int_f by simp
35748
5f35613d9a65 Equality of integral and infinite sum.
hoelzl
parents: 35692
diff changeset
  2276
qed
5f35613d9a65 Equality of integral and infinite sum.
hoelzl
parents: 35692
diff changeset
  2277
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
  2278
section "Lebesgue integration on finite space"
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
  2279
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2280
lemma (in measure_space) integral_on_finite:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2281
  assumes f: "f \<in> borel_measurable M" and finite: "finite (f`space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2282
  and fin: "\<And>x. x \<noteq> 0 \<Longrightarrow> \<mu> (f -` {x} \<inter> space M) \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2283
  shows "integrable f"
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2284
  and "(\<integral>x. f x) =
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2285
    (\<Sum> r \<in> f`space M. r * real (\<mu> (f -` {r} \<inter> space M)))" (is "?integral")
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  2286
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2287
  let "?A r" = "f -` {r} \<inter> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2288
  let "?S x" = "\<Sum>r\<in>f`space M. r * indicator (?A r) x"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  2289
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2290
  { fix x assume "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2291
    have "f x = (\<Sum>r\<in>f`space M. if x \<in> ?A r then r else 0)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2292
      using finite `x \<in> space M` by (simp add: setsum_cases)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2293
    also have "\<dots> = ?S x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2294
      by (auto intro!: setsum_cong)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2295
    finally have "f x = ?S x" . }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2296
  note f_eq = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2297
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2298
  have f_eq_S: "integrable f \<longleftrightarrow> integrable ?S" "integral f = integral ?S"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2299
    by (auto intro!: integrable_cong integral_cong simp only: f_eq)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2300
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2301
  show "integrable f" ?integral using fin f f_eq_S
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2302
    by (simp_all add: integral_cmul_indicator borel_measurable_vimage)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  2303
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents:
diff changeset
  2304
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  2305
lemma (in finite_measure_space) simple_function_finite[simp, intro]: "simple_function f"
40875
9a9d33f6fb46 generalized simple_functionD
hoelzl
parents: 40873
diff changeset
  2306
  unfolding simple_function_def using finite_space by auto
35977
30d42bfd0174 Added finite measure space.
hoelzl
parents: 35833
diff changeset
  2307
38705
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  2308
lemma (in finite_measure_space) borel_measurable_finite[intro, simp]: "f \<in> borel_measurable M"
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38705
diff changeset
  2309
  by (auto intro: borel_measurable_simple_function)
38705
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  2310
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  2311
lemma (in finite_measure_space) positive_integral_finite_eq_setsum:
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  2312
  "positive_integral f = (\<Sum>x \<in> space M. f x * \<mu> {x})"
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  2313
proof -
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2314
  have *: "positive_integral f = (\<integral>\<^isup>+ x. \<Sum>y\<in>space M. f y * indicator {y} x)"
38705
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  2315
    by (auto intro!: positive_integral_cong simp add: indicator_def if_distrib setsum_cases[OF finite_space])
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  2316
  show ?thesis unfolding * using borel_measurable_finite[of f]
40875
9a9d33f6fb46 generalized simple_functionD
hoelzl
parents: 40873
diff changeset
  2317
    by (simp add: positive_integral_setsum positive_integral_cmult_indicator)
38705
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  2318
qed
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  2319
35977
30d42bfd0174 Added finite measure space.
hoelzl
parents: 35833
diff changeset
  2320
lemma (in finite_measure_space) integral_finite_singleton:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2321
  shows "integrable f"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 38642
diff changeset
  2322
  and "integral f = (\<Sum>x \<in> space M. f x * real (\<mu> {x}))" (is ?I)
35977
30d42bfd0174 Added finite measure space.
hoelzl
parents: 35833
diff changeset
  2323
proof -
38705
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  2324
  have [simp]:
41544
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2325
    "(\<integral>\<^isup>+ x. Real (f x)) = (\<Sum>x \<in> space M. Real (f x) * \<mu> {x})"
c3b977fee8a3 introduced integral syntax
hoelzl
parents: 41097
diff changeset
  2326
    "(\<integral>\<^isup>+ x. Real (- f x)) = (\<Sum>x \<in> space M. Real (- f x) * \<mu> {x})"
38705
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  2327
    unfolding positive_integral_finite_eq_setsum by auto
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  2328
  show "integrable f" using finite_space finite_measure
40875
9a9d33f6fb46 generalized simple_functionD
hoelzl
parents: 40873
diff changeset
  2329
    by (simp add: setsum_\<omega> integrable_def)
38705
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  2330
  show ?I using finite_measure
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  2331
    apply (simp add: integral_def real_of_pextreal_setsum[symmetric]
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40875
diff changeset
  2332
      real_of_pextreal_mult[symmetric] setsum_subtractf[symmetric])
38705
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  2333
    by (rule setsum_cong) (simp_all split: split_if)
35977
30d42bfd0174 Added finite measure space.
hoelzl
parents: 35833
diff changeset
  2334
qed
30d42bfd0174 Added finite measure space.
hoelzl
parents: 35833
diff changeset
  2335
35748
5f35613d9a65 Equality of integral and infinite sum.
hoelzl
parents: 35692
diff changeset
  2336
end