src/HOL/Probability/Radon_Nikodym.thy
author hoelzl
Wed, 01 Dec 2010 19:20:30 +0100
changeset 40859 de0b30e6c2d2
parent 39097 943c7b348524
child 40871 688f6ff859e1
permissions -rw-r--r--
Support product spaces on sigma finite measures. Introduce the almost everywhere quantifier. Introduce 'morphism' theorems for most constants. Prove uniqueness of measures on cut stable generators. Prove uniqueness of the Radon-Nikodym derivative. Removed misleading suffix from borel_space and lebesgue_space. Use product spaces to introduce Fubini on the Lebesgue integral. Combine Euclidean_Lebesgue and Lebesgue_Measure. Generalize theorems about mutual information and entropy to arbitrary probability spaces. Remove simproc mult_log as it does not work with interpretations. Introduce completion of measure spaces. Change type of sigma. Introduce dynkin systems.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
     1
theory Radon_Nikodym
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
     2
imports Lebesgue_Integration
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
     3
begin
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
     4
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
     5
lemma less_\<omega>_Ex_of_nat: "x < \<omega> \<longleftrightarrow> (\<exists>n. x < of_nat n)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
     6
proof safe
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
     7
  assume "x < \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
     8
  then obtain r where "0 \<le> r" "x = Real r" by (cases x) auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
     9
  moreover obtain n where "r < of_nat n" using ex_less_of_nat by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
    10
  ultimately show "\<exists>n. x < of_nat n" by (auto simp: real_eq_of_nat)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
    11
qed auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
    12
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    13
lemma (in sigma_finite_measure) Ex_finite_integrable_function:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    14
  shows "\<exists>h\<in>borel_measurable M. positive_integral h \<noteq> \<omega> \<and> (\<forall>x\<in>space M. 0 < h x \<and> h x < \<omega>)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    15
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    16
  obtain A :: "nat \<Rightarrow> 'a set" where
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    17
    range: "range A \<subseteq> sets M" and
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    18
    space: "(\<Union>i. A i) = space M" and
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    19
    measure: "\<And>i. \<mu> (A i) \<noteq> \<omega>" and
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    20
    disjoint: "disjoint_family A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    21
    using disjoint_sigma_finite by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    22
  let "?B i" = "2^Suc i * \<mu> (A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    23
  have "\<forall>i. \<exists>x. 0 < x \<and> x < inverse (?B i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    24
  proof
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    25
    fix i show "\<exists>x. 0 < x \<and> x < inverse (?B i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    26
    proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    27
      assume "\<mu> (A i) = 0"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    28
      then show ?thesis by (auto intro!: exI[of _ 1])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    29
    next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    30
      assume not_0: "\<mu> (A i) \<noteq> 0"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    31
      then have "?B i \<noteq> \<omega>" using measure[of i] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    32
      then have "inverse (?B i) \<noteq> 0" unfolding pinfreal_inverse_eq_0 by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    33
      then show ?thesis using measure[of i] not_0
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    34
        by (auto intro!: exI[of _ "inverse (?B i) / 2"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    35
                 simp: pinfreal_noteq_omega_Ex zero_le_mult_iff zero_less_mult_iff mult_le_0_iff power_le_zero_eq)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    36
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    37
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    38
  from choice[OF this] obtain n where n: "\<And>i. 0 < n i"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    39
    "\<And>i. n i < inverse (2^Suc i * \<mu> (A i))" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    40
  let "?h x" = "\<Sum>\<^isub>\<infinity> i. n i * indicator (A i) x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    41
  show ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    42
  proof (safe intro!: bexI[of _ ?h] del: notI)
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38656
diff changeset
    43
    have "\<And>i. A i \<in> sets M"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38656
diff changeset
    44
      using range by fastsimp+
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38656
diff changeset
    45
    then have "positive_integral ?h = (\<Sum>\<^isub>\<infinity> i. n i * \<mu> (A i))"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38656
diff changeset
    46
      by (simp add: positive_integral_psuminf positive_integral_cmult_indicator)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    47
    also have "\<dots> \<le> (\<Sum>\<^isub>\<infinity> i. Real ((1 / 2)^Suc i))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    48
    proof (rule psuminf_le)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    49
      fix N show "n N * \<mu> (A N) \<le> Real ((1 / 2) ^ Suc N)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    50
        using measure[of N] n[of N]
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38656
diff changeset
    51
        by (cases "n N")
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38656
diff changeset
    52
           (auto simp: pinfreal_noteq_omega_Ex field_simps zero_le_mult_iff
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38656
diff changeset
    53
                       mult_le_0_iff mult_less_0_iff power_less_zero_eq
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38656
diff changeset
    54
                       power_le_zero_eq inverse_eq_divide less_divide_eq
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38656
diff changeset
    55
                       power_divide split: split_if_asm)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    56
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    57
    also have "\<dots> = Real 1"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    58
      by (rule suminf_imp_psuminf, rule power_half_series, auto)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    59
    finally show "positive_integral ?h \<noteq> \<omega>" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    60
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    61
    fix x assume "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    62
    then obtain i where "x \<in> A i" using space[symmetric] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    63
    from psuminf_cmult_indicator[OF disjoint, OF this]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    64
    have "?h x = n i" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    65
    then show "0 < ?h x" and "?h x < \<omega>" using n[of i] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    66
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    67
    show "?h \<in> borel_measurable M" using range
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38656
diff changeset
    68
      by (auto intro!: borel_measurable_psuminf borel_measurable_pinfreal_times)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    69
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    70
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    71
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    72
definition (in measure_space)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    73
  "absolutely_continuous \<nu> = (\<forall>N\<in>null_sets. \<nu> N = (0 :: pinfreal))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
    74
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
    75
lemma (in sigma_finite_measure) absolutely_continuous_AE:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
    76
  assumes "measure_space M \<nu>" "absolutely_continuous \<nu>" "AE x. P x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
    77
  shows "measure_space.almost_everywhere M \<nu> P"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
    78
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
    79
  interpret \<nu>: measure_space M \<nu> by fact
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
    80
  from `AE x. P x` obtain N where N: "N \<in> null_sets" and "{x\<in>space M. \<not> P x} \<subseteq> N"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
    81
    unfolding almost_everywhere_def by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
    82
  show "\<nu>.almost_everywhere P"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
    83
  proof (rule \<nu>.AE_I')
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
    84
    show "{x\<in>space M. \<not> P x} \<subseteq> N" by fact
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
    85
    from `absolutely_continuous \<nu>` show "N \<in> \<nu>.null_sets"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
    86
      using N unfolding absolutely_continuous_def by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
    87
  qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
    88
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
    89
39097
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
    90
lemma (in finite_measure_space) absolutely_continuousI:
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
    91
  assumes "finite_measure_space M \<nu>"
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
    92
  assumes v: "\<And>x. \<lbrakk> x \<in> space M ; \<mu> {x} = 0 \<rbrakk> \<Longrightarrow> \<nu> {x} = 0"
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
    93
  shows "absolutely_continuous \<nu>"
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
    94
proof (unfold absolutely_continuous_def sets_eq_Pow, safe)
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
    95
  fix N assume "\<mu> N = 0" "N \<subseteq> space M"
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
    96
  interpret v: finite_measure_space M \<nu> by fact
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
    97
  have "\<nu> N = \<nu> (\<Union>x\<in>N. {x})" by simp
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
    98
  also have "\<dots> = (\<Sum>x\<in>N. \<nu> {x})"
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
    99
  proof (rule v.measure_finitely_additive''[symmetric])
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
   100
    show "finite N" using `N \<subseteq> space M` finite_space by (auto intro: finite_subset)
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
   101
    show "disjoint_family_on (\<lambda>i. {i}) N" unfolding disjoint_family_on_def by auto
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
   102
    fix x assume "x \<in> N" thus "{x} \<in> sets M" using `N \<subseteq> space M` sets_eq_Pow by auto
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
   103
  qed
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
   104
  also have "\<dots> = 0"
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
   105
  proof (safe intro!: setsum_0')
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
   106
    fix x assume "x \<in> N"
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
   107
    hence "\<mu> {x} \<le> \<mu> N" using sets_eq_Pow `N \<subseteq> space M` by (auto intro!: measure_mono)
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
   108
    hence "\<mu> {x} = 0" using `\<mu> N = 0` by simp
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
   109
    thus "\<nu> {x} = 0" using v[of x] `x \<in> N` `N \<subseteq> space M` by auto
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
   110
  qed
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
   111
  finally show "\<nu> N = 0" .
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
   112
qed
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39092
diff changeset
   113
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   114
lemma (in finite_measure) Radon_Nikodym_aux_epsilon:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   115
  fixes e :: real assumes "0 < e"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   116
  assumes "finite_measure M s"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   117
  shows "\<exists>A\<in>sets M. real (\<mu> (space M)) - real (s (space M)) \<le>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   118
                    real (\<mu> A) - real (s A) \<and>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   119
                    (\<forall>B\<in>sets M. B \<subseteq> A \<longrightarrow> - e < real (\<mu> B) - real (s B))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   120
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   121
  let "?d A" = "real (\<mu> A) - real (s A)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   122
  interpret M': finite_measure M s by fact
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   123
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   124
  let "?A A" = "if (\<forall>B\<in>sets M. B \<subseteq> space M - A \<longrightarrow> -e < ?d B)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   125
    then {}
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   126
    else (SOME B. B \<in> sets M \<and> B \<subseteq> space M - A \<and> ?d B \<le> -e)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   127
  def A \<equiv> "\<lambda>n. ((\<lambda>B. B \<union> ?A B) ^^ n) {}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   128
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   129
  have A_simps[simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   130
    "A 0 = {}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   131
    "\<And>n. A (Suc n) = (A n \<union> ?A (A n))" unfolding A_def by simp_all
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   132
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   133
  { fix A assume "A \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   134
    have "?A A \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   135
      by (auto intro!: someI2[of _ _ "\<lambda>A. A \<in> sets M"] simp: not_less) }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   136
  note A'_in_sets = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   137
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   138
  { fix n have "A n \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   139
    proof (induct n)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   140
      case (Suc n) thus "A (Suc n) \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   141
        using A'_in_sets[of "A n"] by (auto split: split_if_asm)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   142
    qed (simp add: A_def) }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   143
  note A_in_sets = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   144
  hence "range A \<subseteq> sets M" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   145
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   146
  { fix n B
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   147
    assume Ex: "\<exists>B. B \<in> sets M \<and> B \<subseteq> space M - A n \<and> ?d B \<le> -e"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   148
    hence False: "\<not> (\<forall>B\<in>sets M. B \<subseteq> space M - A n \<longrightarrow> -e < ?d B)" by (auto simp: not_less)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   149
    have "?d (A (Suc n)) \<le> ?d (A n) - e" unfolding A_simps if_not_P[OF False]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   150
    proof (rule someI2_ex[OF Ex])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   151
      fix B assume "B \<in> sets M \<and> B \<subseteq> space M - A n \<and> ?d B \<le> - e"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   152
      hence "A n \<inter> B = {}" "B \<in> sets M" and dB: "?d B \<le> -e" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   153
      hence "?d (A n \<union> B) = ?d (A n) + ?d B"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   154
        using `A n \<in> sets M` real_finite_measure_Union M'.real_finite_measure_Union by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   155
      also have "\<dots> \<le> ?d (A n) - e" using dB by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   156
      finally show "?d (A n \<union> B) \<le> ?d (A n) - e" .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   157
    qed }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   158
  note dA_epsilon = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   159
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   160
  { fix n have "?d (A (Suc n)) \<le> ?d (A n)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   161
    proof (cases "\<exists>B. B\<in>sets M \<and> B \<subseteq> space M - A n \<and> ?d B \<le> - e")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   162
      case True from dA_epsilon[OF this] show ?thesis using `0 < e` by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   163
    next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   164
      case False
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   165
      hence "\<forall>B\<in>sets M. B \<subseteq> space M - A n \<longrightarrow> -e < ?d B" by (auto simp: not_le)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   166
      thus ?thesis by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   167
    qed }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   168
  note dA_mono = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   169
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   170
  show ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   171
  proof (cases "\<exists>n. \<forall>B\<in>sets M. B \<subseteq> space M - A n \<longrightarrow> -e < ?d B")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   172
    case True then obtain n where B: "\<And>B. \<lbrakk> B \<in> sets M; B \<subseteq> space M - A n\<rbrakk> \<Longrightarrow> -e < ?d B" by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   173
    show ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   174
    proof (safe intro!: bexI[of _ "space M - A n"])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   175
      fix B assume "B \<in> sets M" "B \<subseteq> space M - A n"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   176
      from B[OF this] show "-e < ?d B" .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   177
    next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   178
      show "space M - A n \<in> sets M" by (rule compl_sets) fact
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   179
    next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   180
      show "?d (space M) \<le> ?d (space M - A n)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   181
      proof (induct n)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   182
        fix n assume "?d (space M) \<le> ?d (space M - A n)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   183
        also have "\<dots> \<le> ?d (space M - A (Suc n))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   184
          using A_in_sets sets_into_space dA_mono[of n]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   185
            real_finite_measure_Diff[of "space M"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   186
            real_finite_measure_Diff[of "space M"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   187
            M'.real_finite_measure_Diff[of "space M"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   188
            M'.real_finite_measure_Diff[of "space M"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   189
          by (simp del: A_simps)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   190
        finally show "?d (space M) \<le> ?d (space M - A (Suc n))" .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   191
      qed simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   192
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   193
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   194
    case False hence B: "\<And>n. \<exists>B. B\<in>sets M \<and> B \<subseteq> space M - A n \<and> ?d B \<le> - e"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   195
      by (auto simp add: not_less)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   196
    { fix n have "?d (A n) \<le> - real n * e"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   197
      proof (induct n)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   198
        case (Suc n) with dA_epsilon[of n, OF B] show ?case by (simp del: A_simps add: real_of_nat_Suc field_simps)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   199
      qed simp } note dA_less = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   200
    have decseq: "decseq (\<lambda>n. ?d (A n))" unfolding decseq_eq_incseq
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   201
    proof (rule incseq_SucI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   202
      fix n show "- ?d (A n) \<le> - ?d (A (Suc n))" using dA_mono[of n] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   203
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   204
    from real_finite_continuity_from_below[of A] `range A \<subseteq> sets M`
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   205
      M'.real_finite_continuity_from_below[of A]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   206
    have convergent: "(\<lambda>i. ?d (A i)) ----> ?d (\<Union>i. A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   207
      by (auto intro!: LIMSEQ_diff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   208
    obtain n :: nat where "- ?d (\<Union>i. A i) / e < real n" using reals_Archimedean2 by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   209
    moreover from order_trans[OF decseq_le[OF decseq convergent] dA_less]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   210
    have "real n \<le> - ?d (\<Union>i. A i) / e" using `0<e` by (simp add: field_simps)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   211
    ultimately show ?thesis by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   212
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   213
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   214
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   215
lemma (in finite_measure) Radon_Nikodym_aux:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   216
  assumes "finite_measure M s"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   217
  shows "\<exists>A\<in>sets M. real (\<mu> (space M)) - real (s (space M)) \<le>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   218
                    real (\<mu> A) - real (s A) \<and>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   219
                    (\<forall>B\<in>sets M. B \<subseteq> A \<longrightarrow> 0 \<le> real (\<mu> B) - real (s B))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   220
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   221
  let "?d A" = "real (\<mu> A) - real (s A)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   222
  let "?P A B n" = "A \<in> sets M \<and> A \<subseteq> B \<and> ?d B \<le> ?d A \<and> (\<forall>C\<in>sets M. C \<subseteq> A \<longrightarrow> - 1 / real (Suc n) < ?d C)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   223
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   224
  interpret M': finite_measure M s by fact
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   225
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38656
diff changeset
   226
  let "?r S" = "restricted_space S"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   227
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   228
  { fix S n
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   229
    assume S: "S \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   230
    hence **: "\<And>X. X \<in> op \<inter> S ` sets M \<longleftrightarrow> X \<in> sets M \<and> X \<subseteq> S" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   231
    from M'.restricted_finite_measure[of S] restricted_finite_measure[of S] S
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   232
    have "finite_measure (?r S) \<mu>" "0 < 1 / real (Suc n)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   233
      "finite_measure (?r S) s" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   234
    from finite_measure.Radon_Nikodym_aux_epsilon[OF this] guess X ..
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   235
    hence "?P X S n"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   236
    proof (simp add: **, safe)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   237
      fix C assume C: "C \<in> sets M" "C \<subseteq> X" "X \<subseteq> S" and
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   238
        *: "\<forall>B\<in>sets M. S \<inter> B \<subseteq> X \<longrightarrow> - (1 / real (Suc n)) < ?d (S \<inter> B)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   239
      hence "C \<subseteq> S" "C \<subseteq> X" "S \<inter> C = C" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   240
      with *[THEN bspec, OF `C \<in> sets M`]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   241
      show "- (1 / real (Suc n)) < ?d C" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   242
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   243
    hence "\<exists>A. ?P A S n" by auto }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   244
  note Ex_P = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   245
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   246
  def A \<equiv> "nat_rec (space M) (\<lambda>n A. SOME B. ?P B A n)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   247
  have A_Suc: "\<And>n. A (Suc n) = (SOME B. ?P B (A n) n)" by (simp add: A_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   248
  have A_0[simp]: "A 0 = space M" unfolding A_def by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   249
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   250
  { fix i have "A i \<in> sets M" unfolding A_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   251
    proof (induct i)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   252
      case (Suc i)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   253
      from Ex_P[OF this, of i] show ?case unfolding nat_rec_Suc
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   254
        by (rule someI2_ex) simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   255
    qed simp }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   256
  note A_in_sets = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   257
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   258
  { fix n have "?P (A (Suc n)) (A n) n"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   259
      using Ex_P[OF A_in_sets] unfolding A_Suc
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   260
      by (rule someI2_ex) simp }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   261
  note P_A = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   262
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   263
  have "range A \<subseteq> sets M" using A_in_sets by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   264
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   265
  have A_mono: "\<And>i. A (Suc i) \<subseteq> A i" using P_A by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   266
  have mono_dA: "mono (\<lambda>i. ?d (A i))" using P_A by (simp add: mono_iff_le_Suc)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   267
  have epsilon: "\<And>C i. \<lbrakk> C \<in> sets M; C \<subseteq> A (Suc i) \<rbrakk> \<Longrightarrow> - 1 / real (Suc i) < ?d C"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   268
      using P_A by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   269
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   270
  show ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   271
  proof (safe intro!: bexI[of _ "\<Inter>i. A i"])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   272
    show "(\<Inter>i. A i) \<in> sets M" using A_in_sets by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   273
    from `range A \<subseteq> sets M` A_mono
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   274
      real_finite_continuity_from_above[of A]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   275
      M'.real_finite_continuity_from_above[of A]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   276
    have "(\<lambda>i. ?d (A i)) ----> ?d (\<Inter>i. A i)" by (auto intro!: LIMSEQ_diff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   277
    thus "?d (space M) \<le> ?d (\<Inter>i. A i)" using mono_dA[THEN monoD, of 0 _]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   278
      by (rule_tac LIMSEQ_le_const) (auto intro!: exI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   279
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   280
    fix B assume B: "B \<in> sets M" "B \<subseteq> (\<Inter>i. A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   281
    show "0 \<le> ?d B"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   282
    proof (rule ccontr)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   283
      assume "\<not> 0 \<le> ?d B"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   284
      hence "0 < - ?d B" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   285
      from ex_inverse_of_nat_Suc_less[OF this]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   286
      obtain n where *: "?d B < - 1 / real (Suc n)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   287
        by (auto simp: real_eq_of_nat inverse_eq_divide field_simps)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   288
      have "B \<subseteq> A (Suc n)" using B by (auto simp del: nat_rec_Suc)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   289
      from epsilon[OF B(1) this] *
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   290
      show False by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   291
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   292
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   293
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   294
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   295
lemma (in finite_measure) Radon_Nikodym_finite_measure:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   296
  assumes "finite_measure M \<nu>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   297
  assumes "absolutely_continuous \<nu>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   298
  shows "\<exists>f \<in> borel_measurable M. \<forall>A\<in>sets M. \<nu> A = positive_integral (\<lambda>x. f x * indicator A x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   299
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   300
  interpret M': finite_measure M \<nu> using assms(1) .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   301
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   302
  def G \<equiv> "{g \<in> borel_measurable M. \<forall>A\<in>sets M. positive_integral (\<lambda>x. g x * indicator A x) \<le> \<nu> A}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   303
  have "(\<lambda>x. 0) \<in> G" unfolding G_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   304
  hence "G \<noteq> {}" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   305
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   306
  { fix f g assume f: "f \<in> G" and g: "g \<in> G"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   307
    have "(\<lambda>x. max (g x) (f x)) \<in> G" (is "?max \<in> G") unfolding G_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   308
    proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   309
      show "?max \<in> borel_measurable M" using f g unfolding G_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   310
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   311
      let ?A = "{x \<in> space M. f x \<le> g x}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   312
      have "?A \<in> sets M" using f g unfolding G_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   313
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   314
      fix A assume "A \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   315
      hence sets: "?A \<inter> A \<in> sets M" "(space M - ?A) \<inter> A \<in> sets M" using `?A \<in> sets M` by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   316
      have union: "((?A \<inter> A) \<union> ((space M - ?A) \<inter> A)) = A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   317
        using sets_into_space[OF `A \<in> sets M`] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   318
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   319
      have "\<And>x. x \<in> space M \<Longrightarrow> max (g x) (f x) * indicator A x =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   320
        g x * indicator (?A \<inter> A) x + f x * indicator ((space M - ?A) \<inter> A) x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   321
        by (auto simp: indicator_def max_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   322
      hence "positive_integral (\<lambda>x. max (g x) (f x) * indicator A x) =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   323
        positive_integral (\<lambda>x. g x * indicator (?A \<inter> A) x) +
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   324
        positive_integral (\<lambda>x. f x * indicator ((space M - ?A) \<inter> A) x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   325
        using f g sets unfolding G_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   326
        by (auto cong: positive_integral_cong intro!: positive_integral_add borel_measurable_indicator)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   327
      also have "\<dots> \<le> \<nu> (?A \<inter> A) + \<nu> ((space M - ?A) \<inter> A)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   328
        using f g sets unfolding G_def by (auto intro!: add_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   329
      also have "\<dots> = \<nu> A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   330
        using M'.measure_additive[OF sets] union by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   331
      finally show "positive_integral (\<lambda>x. max (g x) (f x) * indicator A x) \<le> \<nu> A" .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   332
    qed }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   333
  note max_in_G = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   334
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   335
  { fix f g assume  "f \<up> g" and f: "\<And>i. f i \<in> G"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   336
    have "g \<in> G" unfolding G_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   337
    proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   338
      from `f \<up> g` have [simp]: "g = (SUP i. f i)" unfolding isoton_def by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   339
      have f_borel: "\<And>i. f i \<in> borel_measurable M" using f unfolding G_def by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   340
      thus "g \<in> borel_measurable M" by (auto intro!: borel_measurable_SUP)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   341
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   342
      fix A assume "A \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   343
      hence "\<And>i. (\<lambda>x. f i x * indicator A x) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   344
        using f_borel by (auto intro!: borel_measurable_indicator)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   345
      from positive_integral_isoton[OF isoton_indicator[OF `f \<up> g`] this]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   346
      have SUP: "positive_integral (\<lambda>x. g x * indicator A x) =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   347
          (SUP i. positive_integral (\<lambda>x. f i x * indicator A x))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   348
        unfolding isoton_def by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   349
      show "positive_integral (\<lambda>x. g x * indicator A x) \<le> \<nu> A" unfolding SUP
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   350
        using f `A \<in> sets M` unfolding G_def by (auto intro!: SUP_leI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   351
    qed }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   352
  note SUP_in_G = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   353
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   354
  let ?y = "SUP g : G. positive_integral g"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   355
  have "?y \<le> \<nu> (space M)" unfolding G_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   356
  proof (safe intro!: SUP_leI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   357
    fix g assume "\<forall>A\<in>sets M. positive_integral (\<lambda>x. g x * indicator A x) \<le> \<nu> A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   358
    from this[THEN bspec, OF top] show "positive_integral g \<le> \<nu> (space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   359
      by (simp cong: positive_integral_cong)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   360
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   361
  hence "?y \<noteq> \<omega>" using M'.finite_measure_of_space by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   362
  from SUPR_countable_SUPR[OF this `G \<noteq> {}`] guess ys .. note ys = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   363
  hence "\<forall>n. \<exists>g. g\<in>G \<and> positive_integral g = ys n"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   364
  proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   365
    fix n assume "range ys \<subseteq> positive_integral ` G"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   366
    hence "ys n \<in> positive_integral ` G" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   367
    thus "\<exists>g. g\<in>G \<and> positive_integral g = ys n" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   368
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   369
  from choice[OF this] obtain gs where "\<And>i. gs i \<in> G" "\<And>n. positive_integral (gs n) = ys n" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   370
  hence y_eq: "?y = (SUP i. positive_integral (gs i))" using ys by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   371
  let "?g i x" = "Max ((\<lambda>n. gs n x) ` {..i})"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   372
  def f \<equiv> "SUP i. ?g i"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   373
  have gs_not_empty: "\<And>i. (\<lambda>n. gs n x) ` {..i} \<noteq> {}" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   374
  { fix i have "?g i \<in> G"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   375
    proof (induct i)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   376
      case 0 thus ?case by simp fact
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   377
    next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   378
      case (Suc i)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   379
      with Suc gs_not_empty `gs (Suc i) \<in> G` show ?case
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   380
        by (auto simp add: atMost_Suc intro!: max_in_G)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   381
    qed }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   382
  note g_in_G = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   383
  have "\<And>x. \<forall>i. ?g i x \<le> ?g (Suc i) x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   384
    using gs_not_empty by (simp add: atMost_Suc)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   385
  hence isoton_g: "?g \<up> f" by (simp add: isoton_def le_fun_def f_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   386
  from SUP_in_G[OF this g_in_G] have "f \<in> G" .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   387
  hence [simp, intro]: "f \<in> borel_measurable M" unfolding G_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   388
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   389
  have "(\<lambda>i. positive_integral (?g i)) \<up> positive_integral f"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   390
    using isoton_g g_in_G by (auto intro!: positive_integral_isoton simp: G_def f_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   391
  hence "positive_integral f = (SUP i. positive_integral (?g i))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   392
    unfolding isoton_def by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   393
  also have "\<dots> = ?y"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   394
  proof (rule antisym)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   395
    show "(SUP i. positive_integral (?g i)) \<le> ?y"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   396
      using g_in_G by (auto intro!: exI Sup_mono simp: SUPR_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   397
    show "?y \<le> (SUP i. positive_integral (?g i))" unfolding y_eq
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   398
      by (auto intro!: SUP_mono positive_integral_mono Max_ge)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   399
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   400
  finally have int_f_eq_y: "positive_integral f = ?y" .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   401
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   402
  let "?t A" = "\<nu> A - positive_integral (\<lambda>x. f x * indicator A x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   403
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   404
  have "finite_measure M ?t"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   405
  proof
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   406
    show "?t {} = 0" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   407
    show "?t (space M) \<noteq> \<omega>" using M'.finite_measure by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   408
    show "countably_additive M ?t" unfolding countably_additive_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   409
    proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   410
      fix A :: "nat \<Rightarrow> 'a set"  assume A: "range A \<subseteq> sets M" "disjoint_family A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   411
      have "(\<Sum>\<^isub>\<infinity> n. positive_integral (\<lambda>x. f x * indicator (A n) x))
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   412
        = positive_integral (\<lambda>x. (\<Sum>\<^isub>\<infinity>n. f x * indicator (A n) x))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   413
        using `range A \<subseteq> sets M`
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   414
        by (rule_tac positive_integral_psuminf[symmetric]) (auto intro!: borel_measurable_indicator)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   415
      also have "\<dots> = positive_integral (\<lambda>x. f x * indicator (\<Union>n. A n) x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   416
        apply (rule positive_integral_cong)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   417
        apply (subst psuminf_cmult_right)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   418
        unfolding psuminf_indicator[OF `disjoint_family A`] ..
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   419
      finally have "(\<Sum>\<^isub>\<infinity> n. positive_integral (\<lambda>x. f x * indicator (A n) x))
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   420
        = positive_integral (\<lambda>x. f x * indicator (\<Union>n. A n) x)" .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   421
      moreover have "(\<Sum>\<^isub>\<infinity>n. \<nu> (A n)) = \<nu> (\<Union>n. A n)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   422
        using M'.measure_countably_additive A by (simp add: comp_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   423
      moreover have "\<And>i. positive_integral (\<lambda>x. f x * indicator (A i) x) \<le> \<nu> (A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   424
          using A `f \<in> G` unfolding G_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   425
      moreover have v_fin: "\<nu> (\<Union>i. A i) \<noteq> \<omega>" using M'.finite_measure A by (simp add: countable_UN)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   426
      moreover {
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   427
        have "positive_integral (\<lambda>x. f x * indicator (\<Union>i. A i) x) \<le> \<nu> (\<Union>i. A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   428
          using A `f \<in> G` unfolding G_def by (auto simp: countable_UN)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   429
        also have "\<nu> (\<Union>i. A i) < \<omega>" using v_fin by (simp add: pinfreal_less_\<omega>)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   430
        finally have "positive_integral (\<lambda>x. f x * indicator (\<Union>i. A i) x) \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   431
          by (simp add: pinfreal_less_\<omega>) }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   432
      ultimately
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   433
      show "(\<Sum>\<^isub>\<infinity> n. ?t (A n)) = ?t (\<Union>i. A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   434
        apply (subst psuminf_minus) by simp_all
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   435
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   436
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   437
  then interpret M: finite_measure M ?t .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   438
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   439
  have ac: "absolutely_continuous ?t" using `absolutely_continuous \<nu>` unfolding absolutely_continuous_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   440
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   441
  have upper_bound: "\<forall>A\<in>sets M. ?t A \<le> 0"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   442
  proof (rule ccontr)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   443
    assume "\<not> ?thesis"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   444
    then obtain A where A: "A \<in> sets M" and pos: "0 < ?t A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   445
      by (auto simp: not_le)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   446
    note pos
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   447
    also have "?t A \<le> ?t (space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   448
      using M.measure_mono[of A "space M"] A sets_into_space by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   449
    finally have pos_t: "0 < ?t (space M)" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   450
    moreover
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   451
    hence pos_M: "0 < \<mu> (space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   452
      using ac top unfolding absolutely_continuous_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   453
    moreover
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   454
    have "positive_integral (\<lambda>x. f x * indicator (space M) x) \<le> \<nu> (space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   455
      using `f \<in> G` unfolding G_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   456
    hence "positive_integral (\<lambda>x. f x * indicator (space M) x) \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   457
      using M'.finite_measure_of_space by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   458
    moreover
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   459
    def b \<equiv> "?t (space M) / \<mu> (space M) / 2"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   460
    ultimately have b: "b \<noteq> 0" "b \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   461
      using M'.finite_measure_of_space
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   462
      by (auto simp: pinfreal_inverse_eq_0 finite_measure_of_space)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   463
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   464
    have "finite_measure M (\<lambda>A. b * \<mu> A)" (is "finite_measure M ?b")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   465
    proof
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   466
      show "?b {} = 0" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   467
      show "?b (space M) \<noteq> \<omega>" using finite_measure_of_space b by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   468
      show "countably_additive M ?b"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   469
        unfolding countably_additive_def psuminf_cmult_right
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   470
        using measure_countably_additive by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   471
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   472
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   473
    from M.Radon_Nikodym_aux[OF this]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   474
    obtain A0 where "A0 \<in> sets M" and
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   475
      space_less_A0: "real (?t (space M)) - real (b * \<mu> (space M)) \<le> real (?t A0) - real (b * \<mu> A0)" and
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   476
      *: "\<And>B. \<lbrakk> B \<in> sets M ; B \<subseteq> A0 \<rbrakk> \<Longrightarrow> 0 \<le> real (?t B) - real (b * \<mu> B)" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   477
    { fix B assume "B \<in> sets M" "B \<subseteq> A0"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   478
      with *[OF this] have "b * \<mu> B \<le> ?t B"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   479
        using M'.finite_measure b finite_measure
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   480
        by (cases "b * \<mu> B", cases "?t B") (auto simp: field_simps) }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   481
    note bM_le_t = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   482
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   483
    let "?f0 x" = "f x + b * indicator A0 x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   484
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   485
    { fix A assume A: "A \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   486
      hence "A \<inter> A0 \<in> sets M" using `A0 \<in> sets M` by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   487
      have "positive_integral (\<lambda>x. ?f0 x  * indicator A x) =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   488
        positive_integral (\<lambda>x. f x * indicator A x + b * indicator (A \<inter> A0) x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   489
        by (auto intro!: positive_integral_cong simp: field_simps indicator_inter_arith)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   490
      hence "positive_integral (\<lambda>x. ?f0 x * indicator A x) =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   491
          positive_integral (\<lambda>x. f x * indicator A x) + b * \<mu> (A \<inter> A0)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   492
        using `A0 \<in> sets M` `A \<inter> A0 \<in> sets M` A
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   493
        by (simp add: borel_measurable_indicator positive_integral_add positive_integral_cmult_indicator) }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   494
    note f0_eq = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   495
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   496
    { fix A assume A: "A \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   497
      hence "A \<inter> A0 \<in> sets M" using `A0 \<in> sets M` by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   498
      have f_le_v: "positive_integral (\<lambda>x. f x * indicator A x) \<le> \<nu> A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   499
        using `f \<in> G` A unfolding G_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   500
      note f0_eq[OF A]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   501
      also have "positive_integral (\<lambda>x. f x * indicator A x) + b * \<mu> (A \<inter> A0) \<le>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   502
          positive_integral (\<lambda>x. f x * indicator A x) + ?t (A \<inter> A0)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   503
        using bM_le_t[OF `A \<inter> A0 \<in> sets M`] `A \<in> sets M` `A0 \<in> sets M`
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   504
        by (auto intro!: add_left_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   505
      also have "\<dots> \<le> positive_integral (\<lambda>x. f x * indicator A x) + ?t A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   506
        using M.measure_mono[simplified, OF _ `A \<inter> A0 \<in> sets M` `A \<in> sets M`]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   507
        by (auto intro!: add_left_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   508
      also have "\<dots> \<le> \<nu> A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   509
        using f_le_v M'.finite_measure[simplified, OF `A \<in> sets M`]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   510
        by (cases "positive_integral (\<lambda>x. f x * indicator A x)", cases "\<nu> A", auto)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   511
      finally have "positive_integral (\<lambda>x. ?f0 x * indicator A x) \<le> \<nu> A" . }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   512
    hence "?f0 \<in> G" using `A0 \<in> sets M` unfolding G_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   513
      by (auto intro!: borel_measurable_indicator borel_measurable_pinfreal_add borel_measurable_pinfreal_times)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   514
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   515
    have real: "?t (space M) \<noteq> \<omega>" "?t A0 \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   516
      "b * \<mu> (space M) \<noteq> \<omega>" "b * \<mu> A0 \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   517
      using `A0 \<in> sets M` b
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   518
        finite_measure[of A0] M.finite_measure[of A0]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   519
        finite_measure_of_space M.finite_measure_of_space
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   520
      by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   521
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   522
    have int_f_finite: "positive_integral f \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   523
      using M'.finite_measure_of_space pos_t unfolding pinfreal_zero_less_diff_iff
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   524
      by (auto cong: positive_integral_cong)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   525
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   526
    have "?t (space M) > b * \<mu> (space M)" unfolding b_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   527
      apply (simp add: field_simps)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   528
      apply (subst mult_assoc[symmetric])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   529
      apply (subst pinfreal_mult_inverse)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   530
      using finite_measure_of_space M'.finite_measure_of_space pos_t pos_M
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   531
      using pinfreal_mult_strict_right_mono[of "Real (1/2)" 1 "?t (space M)"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   532
      by simp_all
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   533
    hence  "0 < ?t (space M) - b * \<mu> (space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   534
      by (simp add: pinfreal_zero_less_diff_iff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   535
    also have "\<dots> \<le> ?t A0 - b * \<mu> A0"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   536
      using space_less_A0 pos_M pos_t b real[unfolded pinfreal_noteq_omega_Ex] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   537
    finally have "b * \<mu> A0 < ?t A0" unfolding pinfreal_zero_less_diff_iff .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   538
    hence "0 < ?t A0" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   539
    hence "0 < \<mu> A0" using ac unfolding absolutely_continuous_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   540
      using `A0 \<in> sets M` by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   541
    hence "0 < b * \<mu> A0" using b by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   542
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   543
    from int_f_finite this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   544
    have "?y + 0 < positive_integral f + b * \<mu> A0" unfolding int_f_eq_y
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   545
      by (rule pinfreal_less_add)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   546
    also have "\<dots> = positive_integral ?f0" using f0_eq[OF top] `A0 \<in> sets M` sets_into_space
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   547
      by (simp cong: positive_integral_cong)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   548
    finally have "?y < positive_integral ?f0" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   549
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   550
    moreover from `?f0 \<in> G` have "positive_integral ?f0 \<le> ?y" by (auto intro!: le_SUPI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   551
    ultimately show False by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   552
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   553
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   554
  show ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   555
  proof (safe intro!: bexI[of _ f])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   556
    fix A assume "A\<in>sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   557
    show "\<nu> A = positive_integral (\<lambda>x. f x * indicator A x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   558
    proof (rule antisym)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   559
      show "positive_integral (\<lambda>x. f x * indicator A x) \<le> \<nu> A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   560
        using `f \<in> G` `A \<in> sets M` unfolding G_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   561
      show "\<nu> A \<le> positive_integral (\<lambda>x. f x * indicator A x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   562
        using upper_bound[THEN bspec, OF `A \<in> sets M`]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   563
         by (simp add: pinfreal_zero_le_diff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   564
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   565
  qed simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   566
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   567
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   568
lemma (in finite_measure) split_space_into_finite_sets_and_rest:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   569
  assumes "measure_space M \<nu>"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   570
  assumes ac: "absolutely_continuous \<nu>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   571
  shows "\<exists>\<Omega>0\<in>sets M. \<exists>\<Omega>::nat\<Rightarrow>'a set. disjoint_family \<Omega> \<and> range \<Omega> \<subseteq> sets M \<and> \<Omega>0 = space M - (\<Union>i. \<Omega> i) \<and>
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   572
    (\<forall>A\<in>sets M. A \<subseteq> \<Omega>0 \<longrightarrow> (\<mu> A = 0 \<and> \<nu> A = 0) \<or> (\<mu> A > 0 \<and> \<nu> A = \<omega>)) \<and>
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   573
    (\<forall>i. \<nu> (\<Omega> i) \<noteq> \<omega>)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   574
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   575
  interpret v: measure_space M \<nu> by fact
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   576
  let ?Q = "{Q\<in>sets M. \<nu> Q \<noteq> \<omega>}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   577
  let ?a = "SUP Q:?Q. \<mu> Q"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   578
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   579
  have "{} \<in> ?Q" using v.empty_measure by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   580
  then have Q_not_empty: "?Q \<noteq> {}" by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   581
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   582
  have "?a \<le> \<mu> (space M)" using sets_into_space
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   583
    by (auto intro!: SUP_leI measure_mono top)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   584
  then have "?a \<noteq> \<omega>" using finite_measure_of_space
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   585
    by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   586
  from SUPR_countable_SUPR[OF this Q_not_empty]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   587
  obtain Q'' where "range Q'' \<subseteq> \<mu> ` ?Q" and a: "?a = (SUP i::nat. Q'' i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   588
    by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   589
  then have "\<forall>i. \<exists>Q'. Q'' i = \<mu> Q' \<and> Q' \<in> ?Q" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   590
  from choice[OF this] obtain Q' where Q': "\<And>i. Q'' i = \<mu> (Q' i)" "\<And>i. Q' i \<in> ?Q"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   591
    by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   592
  then have a_Lim: "?a = (SUP i::nat. \<mu> (Q' i))" using a by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   593
  let "?O n" = "\<Union>i\<le>n. Q' i"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   594
  have Union: "(SUP i. \<mu> (?O i)) = \<mu> (\<Union>i. ?O i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   595
  proof (rule continuity_from_below[of ?O])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   596
    show "range ?O \<subseteq> sets M" using Q' by (auto intro!: finite_UN)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   597
    show "\<And>i. ?O i \<subseteq> ?O (Suc i)" by fastsimp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   598
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   599
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   600
  have Q'_sets: "\<And>i. Q' i \<in> sets M" using Q' by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   601
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   602
  have O_sets: "\<And>i. ?O i \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   603
     using Q' by (auto intro!: finite_UN Un)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   604
  then have O_in_G: "\<And>i. ?O i \<in> ?Q"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   605
  proof (safe del: notI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   606
    fix i have "Q' ` {..i} \<subseteq> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   607
      using Q' by (auto intro: finite_UN)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   608
    with v.measure_finitely_subadditive[of "{.. i}" Q']
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   609
    have "\<nu> (?O i) \<le> (\<Sum>i\<le>i. \<nu> (Q' i))" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   610
    also have "\<dots> < \<omega>" unfolding setsum_\<omega> pinfreal_less_\<omega> using Q' by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   611
    finally show "\<nu> (?O i) \<noteq> \<omega>" unfolding pinfreal_less_\<omega> by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   612
  qed auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   613
  have O_mono: "\<And>n. ?O n \<subseteq> ?O (Suc n)" by fastsimp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   614
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   615
  have a_eq: "?a = \<mu> (\<Union>i. ?O i)" unfolding Union[symmetric]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   616
  proof (rule antisym)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   617
    show "?a \<le> (SUP i. \<mu> (?O i))" unfolding a_Lim
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   618
      using Q' by (auto intro!: SUP_mono measure_mono finite_UN)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   619
    show "(SUP i. \<mu> (?O i)) \<le> ?a" unfolding SUPR_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   620
    proof (safe intro!: Sup_mono, unfold bex_simps)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   621
      fix i
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   622
      have *: "(\<Union>Q' ` {..i}) = ?O i" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   623
      then show "\<exists>x. (x \<in> sets M \<and> \<nu> x \<noteq> \<omega>) \<and>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   624
        \<mu> (\<Union>Q' ` {..i}) \<le> \<mu> x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   625
        using O_in_G[of i] by (auto intro!: exI[of _ "?O i"])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   626
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   627
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   628
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   629
  let "?O_0" = "(\<Union>i. ?O i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   630
  have "?O_0 \<in> sets M" using Q' by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   631
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   632
  def Q \<equiv> "\<lambda>i. case i of 0 \<Rightarrow> Q' 0 | Suc n \<Rightarrow> ?O (Suc n) - ?O n"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   633
  { fix i have "Q i \<in> sets M" unfolding Q_def using Q'[of 0] by (cases i) (auto intro: O_sets) }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   634
  note Q_sets = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   635
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   636
  show ?thesis
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   637
  proof (intro bexI exI conjI ballI impI allI)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   638
    show "disjoint_family Q"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   639
      by (fastsimp simp: disjoint_family_on_def Q_def
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   640
        split: nat.split_asm)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   641
    show "range Q \<subseteq> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   642
      using Q_sets by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   643
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   644
    { fix A assume A: "A \<in> sets M" "A \<subseteq> space M - ?O_0"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   645
      show "\<mu> A = 0 \<and> \<nu> A = 0 \<or> 0 < \<mu> A \<and> \<nu> A = \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   646
      proof (rule disjCI, simp)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   647
        assume *: "0 < \<mu> A \<longrightarrow> \<nu> A \<noteq> \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   648
        show "\<mu> A = 0 \<and> \<nu> A = 0"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   649
        proof cases
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   650
          assume "\<mu> A = 0" moreover with ac A have "\<nu> A = 0"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   651
            unfolding absolutely_continuous_def by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   652
          ultimately show ?thesis by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   653
        next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   654
          assume "\<mu> A \<noteq> 0" with * have "\<nu> A \<noteq> \<omega>" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   655
          with A have "\<mu> ?O_0 + \<mu> A = \<mu> (?O_0 \<union> A)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   656
            using Q' by (auto intro!: measure_additive countable_UN)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   657
          also have "\<dots> = (SUP i. \<mu> (?O i \<union> A))"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   658
          proof (rule continuity_from_below[of "\<lambda>i. ?O i \<union> A", symmetric, simplified])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   659
            show "range (\<lambda>i. ?O i \<union> A) \<subseteq> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   660
              using `\<nu> A \<noteq> \<omega>` O_sets A by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   661
          qed fastsimp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   662
          also have "\<dots> \<le> ?a"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   663
          proof (safe intro!: SUPR_bound)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   664
            fix i have "?O i \<union> A \<in> ?Q"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   665
            proof (safe del: notI)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   666
              show "?O i \<union> A \<in> sets M" using O_sets A by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   667
              from O_in_G[of i]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   668
              moreover have "\<nu> (?O i \<union> A) \<le> \<nu> (?O i) + \<nu> A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   669
                using v.measure_subadditive[of "?O i" A] A O_sets by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   670
              ultimately show "\<nu> (?O i \<union> A) \<noteq> \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   671
                using `\<nu> A \<noteq> \<omega>` by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   672
            qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   673
            then show "\<mu> (?O i \<union> A) \<le> ?a" by (rule le_SUPI)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   674
          qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   675
          finally have "\<mu> A = 0" unfolding a_eq using finite_measure[OF `?O_0 \<in> sets M`]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   676
            by (cases "\<mu> A") (auto simp: pinfreal_noteq_omega_Ex)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   677
          with `\<mu> A \<noteq> 0` show ?thesis by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   678
        qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   679
      qed }
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   680
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   681
    { fix i show "\<nu> (Q i) \<noteq> \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   682
      proof (cases i)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   683
        case 0 then show ?thesis
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   684
          unfolding Q_def using Q'[of 0] by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   685
      next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   686
        case (Suc n)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   687
        then show ?thesis unfolding Q_def
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   688
          using `?O n \<in> ?Q` `?O (Suc n) \<in> ?Q` O_mono
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   689
          using v.measure_Diff[of "?O n" "?O (Suc n)"] by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   690
      qed }
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   691
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   692
    show "space M - ?O_0 \<in> sets M" using Q'_sets by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   693
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   694
    { fix j have "(\<Union>i\<le>j. ?O i) = (\<Union>i\<le>j. Q i)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   695
      proof (induct j)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   696
        case 0 then show ?case by (simp add: Q_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   697
      next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   698
        case (Suc j)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   699
        have eq: "\<And>j. (\<Union>i\<le>j. ?O i) = (\<Union>i\<le>j. Q' i)" by fastsimp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   700
        have "{..j} \<union> {..Suc j} = {..Suc j}" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   701
        then have "(\<Union>i\<le>Suc j. Q' i) = (\<Union>i\<le>j. Q' i) \<union> Q (Suc j)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   702
          by (simp add: UN_Un[symmetric] Q_def del: UN_Un)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   703
        then show ?case using Suc by (auto simp add: eq atMost_Suc)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   704
      qed }
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   705
    then have "(\<Union>j. (\<Union>i\<le>j. ?O i)) = (\<Union>j. (\<Union>i\<le>j. Q i))" by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   706
    then show "space M - ?O_0 = space M - (\<Union>i. Q i)" by fastsimp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   707
  qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   708
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   709
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   710
lemma (in finite_measure) Radon_Nikodym_finite_measure_infinite:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   711
  assumes "measure_space M \<nu>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   712
  assumes "absolutely_continuous \<nu>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   713
  shows "\<exists>f \<in> borel_measurable M. \<forall>A\<in>sets M. \<nu> A = positive_integral (\<lambda>x. f x * indicator A x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   714
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   715
  interpret v: measure_space M \<nu> by fact
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   716
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   717
  from split_space_into_finite_sets_and_rest[OF assms]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   718
  obtain Q0 and Q :: "nat \<Rightarrow> 'a set"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   719
    where Q: "disjoint_family Q" "range Q \<subseteq> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   720
    and Q0: "Q0 \<in> sets M" "Q0 = space M - (\<Union>i. Q i)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   721
    and in_Q0: "\<And>A. A \<in> sets M \<Longrightarrow> A \<subseteq> Q0 \<Longrightarrow> \<mu> A = 0 \<and> \<nu> A = 0 \<or> 0 < \<mu> A \<and> \<nu> A = \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   722
    and Q_fin: "\<And>i. \<nu> (Q i) \<noteq> \<omega>" by force
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   723
  from Q have Q_sets: "\<And>i. Q i \<in> sets M" by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   724
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   725
  have "\<forall>i. \<exists>f. f\<in>borel_measurable M \<and> (\<forall>A\<in>sets M.
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   726
    \<nu> (Q i \<inter> A) = positive_integral (\<lambda>x. f x * indicator (Q i \<inter> A) x))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   727
  proof
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   728
    fix i
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   729
    have indicator_eq: "\<And>f x A. (f x :: pinfreal) * indicator (Q i \<inter> A) x * indicator (Q i) x
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   730
      = (f x * indicator (Q i) x) * indicator A x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   731
      unfolding indicator_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   732
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 38656
diff changeset
   733
    have fm: "finite_measure (restricted_space (Q i)) \<mu>"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   734
      (is "finite_measure ?R \<mu>") by (rule restricted_finite_measure[OF Q_sets[of i]])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   735
    then interpret R: finite_measure ?R .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   736
    have fmv: "finite_measure ?R \<nu>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   737
      unfolding finite_measure_def finite_measure_axioms_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   738
    proof
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   739
      show "measure_space ?R \<nu>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   740
        using v.restricted_measure_space Q_sets[of i] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   741
      show "\<nu>  (space ?R) \<noteq> \<omega>"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   742
        using Q_fin by simp
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   743
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   744
    have "R.absolutely_continuous \<nu>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   745
      using `absolutely_continuous \<nu>` `Q i \<in> sets M`
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   746
      by (auto simp: R.absolutely_continuous_def absolutely_continuous_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   747
    from finite_measure.Radon_Nikodym_finite_measure[OF fm fmv this]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   748
    obtain f where f: "(\<lambda>x. f x * indicator (Q i) x) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   749
      and f_int: "\<And>A. A\<in>sets M \<Longrightarrow> \<nu> (Q i \<inter> A) = positive_integral (\<lambda>x. (f x * indicator (Q i) x) * indicator A x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   750
      unfolding Bex_def borel_measurable_restricted[OF `Q i \<in> sets M`]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   751
        positive_integral_restricted[OF `Q i \<in> sets M`] by (auto simp: indicator_eq)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   752
    then show "\<exists>f. f\<in>borel_measurable M \<and> (\<forall>A\<in>sets M.
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   753
      \<nu> (Q i \<inter> A) = positive_integral (\<lambda>x. f x * indicator (Q i \<inter> A) x))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   754
      by (fastsimp intro!: exI[of _ "\<lambda>x. f x * indicator (Q i) x"] positive_integral_cong
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   755
          simp: indicator_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   756
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   757
  from choice[OF this] obtain f where borel: "\<And>i. f i \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   758
    and f: "\<And>A i. A \<in> sets M \<Longrightarrow>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   759
      \<nu> (Q i \<inter> A) = positive_integral (\<lambda>x. f i x * indicator (Q i \<inter> A) x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   760
    by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   761
  let "?f x" =
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   762
    "(\<Sum>\<^isub>\<infinity> i. f i x * indicator (Q i) x) + \<omega> * indicator Q0 x"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   763
  show ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   764
  proof (safe intro!: bexI[of _ ?f])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   765
    show "?f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   766
      by (safe intro!: borel_measurable_psuminf borel_measurable_pinfreal_times
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   767
        borel_measurable_pinfreal_add borel_measurable_indicator
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   768
        borel_measurable_const borel Q_sets Q0 Diff countable_UN)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   769
    fix A assume "A \<in> sets M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   770
    have *:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   771
      "\<And>x i. indicator A x * (f i x * indicator (Q i) x) =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   772
        f i x * indicator (Q i \<inter> A) x"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   773
      "\<And>x i. (indicator A x * indicator Q0 x :: pinfreal) =
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   774
        indicator (Q0 \<inter> A) x" by (auto simp: indicator_def)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   775
    have "positive_integral (\<lambda>x. ?f x * indicator A x) =
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   776
      (\<Sum>\<^isub>\<infinity> i. \<nu> (Q i \<inter> A)) + \<omega> * \<mu> (Q0 \<inter> A)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   777
      unfolding f[OF `A \<in> sets M`]
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   778
      apply (simp del: pinfreal_times(2) add: field_simps *)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   779
      apply (subst positive_integral_add)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   780
      apply (fastsimp intro: Q0 `A \<in> sets M`)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   781
      apply (fastsimp intro: Q_sets `A \<in> sets M` borel_measurable_psuminf borel)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   782
      apply (subst positive_integral_cmult_indicator)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   783
      apply (fastsimp intro: Q0 `A \<in> sets M`)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   784
      unfolding psuminf_cmult_right[symmetric]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   785
      apply (subst positive_integral_psuminf)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   786
      apply (fastsimp intro: `A \<in> sets M` Q_sets borel)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   787
      apply (simp add: *)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   788
      done
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   789
    moreover have "(\<Sum>\<^isub>\<infinity>i. \<nu> (Q i \<inter> A)) = \<nu> ((\<Union>i. Q i) \<inter> A)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   790
      using Q Q_sets `A \<in> sets M`
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   791
      by (intro v.measure_countably_additive[of "\<lambda>i. Q i \<inter> A", unfolded comp_def, simplified])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   792
         (auto simp: disjoint_family_on_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   793
    moreover have "\<omega> * \<mu> (Q0 \<inter> A) = \<nu> (Q0 \<inter> A)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   794
    proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   795
      have "Q0 \<inter> A \<in> sets M" using Q0(1) `A \<in> sets M` by blast
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   796
      from in_Q0[OF this] show ?thesis by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   797
    qed
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   798
    moreover have "Q0 \<inter> A \<in> sets M" "((\<Union>i. Q i) \<inter> A) \<in> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   799
      using Q_sets `A \<in> sets M` Q0(1) by (auto intro!: countable_UN)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   800
    moreover have "((\<Union>i. Q i) \<inter> A) \<union> (Q0 \<inter> A) = A" "((\<Union>i. Q i) \<inter> A) \<inter> (Q0 \<inter> A) = {}"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   801
      using `A \<in> sets M` sets_into_space Q0 by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   802
    ultimately show "\<nu> A = positive_integral (\<lambda>x. ?f x * indicator A x)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   803
      using v.measure_additive[simplified, of "(\<Union>i. Q i) \<inter> A" "Q0 \<inter> A"]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   804
      by simp
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   805
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   806
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   807
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   808
lemma (in sigma_finite_measure) Radon_Nikodym:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   809
  assumes "measure_space M \<nu>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   810
  assumes "absolutely_continuous \<nu>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   811
  shows "\<exists>f \<in> borel_measurable M. \<forall>A\<in>sets M. \<nu> A = positive_integral (\<lambda>x. f x * indicator A x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   812
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   813
  from Ex_finite_integrable_function
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   814
  obtain h where finite: "positive_integral h \<noteq> \<omega>" and
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   815
    borel: "h \<in> borel_measurable M" and
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   816
    pos: "\<And>x. x \<in> space M \<Longrightarrow> 0 < h x" and
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   817
    "\<And>x. x \<in> space M \<Longrightarrow> h x < \<omega>" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   818
  let "?T A" = "positive_integral (\<lambda>x. h x * indicator A x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   819
  from measure_space_density[OF borel] finite
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   820
  interpret T: finite_measure M ?T
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   821
    unfolding finite_measure_def finite_measure_axioms_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   822
    by (simp cong: positive_integral_cong)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   823
  have "\<And>N. N \<in> sets M \<Longrightarrow> {x \<in> space M. h x \<noteq> 0 \<and> indicator N x \<noteq> (0::pinfreal)} = N"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   824
    using sets_into_space pos by (force simp: indicator_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   825
  then have "T.absolutely_continuous \<nu>" using assms(2) borel
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   826
    unfolding T.absolutely_continuous_def absolutely_continuous_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   827
    by (fastsimp simp: borel_measurable_indicator positive_integral_0_iff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   828
  from T.Radon_Nikodym_finite_measure_infinite[simplified, OF assms(1) this]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   829
  obtain f where f_borel: "f \<in> borel_measurable M" and
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   830
    fT: "\<And>A. A \<in> sets M \<Longrightarrow> \<nu> A = T.positive_integral (\<lambda>x. f x * indicator A x)" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   831
  show ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   832
  proof (safe intro!: bexI[of _ "\<lambda>x. h x * f x"])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   833
    show "(\<lambda>x. h x * f x) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   834
      using borel f_borel by (auto intro: borel_measurable_pinfreal_times)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   835
    fix A assume "A \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   836
    then have "(\<lambda>x. f x * indicator A x) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   837
      using f_borel by (auto intro: borel_measurable_pinfreal_times borel_measurable_indicator)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   838
    from positive_integral_translated_density[OF borel this]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   839
    show "\<nu> A = positive_integral (\<lambda>x. h x * f x * indicator A x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   840
      unfolding fT[OF `A \<in> sets M`] by (simp add: field_simps)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   841
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   842
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
   843
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   844
section "Uniqueness of densities"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   845
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   846
lemma (in measure_space) density_is_absolutely_continuous:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   847
  assumes "\<And>A. A \<in> sets M \<Longrightarrow> \<nu> A = positive_integral (\<lambda>x. f x * indicator A x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   848
  shows "absolutely_continuous \<nu>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   849
  using assms unfolding absolutely_continuous_def
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   850
  by (simp add: positive_integral_null_set)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   851
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   852
lemma (in measure_space) finite_density_unique:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   853
  assumes borel: "f \<in> borel_measurable M" "g \<in> borel_measurable M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   854
  and fin: "positive_integral f < \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   855
  shows "(\<forall>A\<in>sets M. positive_integral (\<lambda>x. f x * indicator A x) = positive_integral (\<lambda>x. g x * indicator A x))
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   856
    \<longleftrightarrow> (AE x. f x = g x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   857
    (is "(\<forall>A\<in>sets M. ?P f A = ?P g A) \<longleftrightarrow> _")
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   858
proof (intro iffI ballI)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   859
  fix A assume eq: "AE x. f x = g x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   860
  show "?P f A = ?P g A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   861
    by (rule positive_integral_cong_AE[OF AE_mp[OF eq]]) simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   862
next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   863
  assume eq: "\<forall>A\<in>sets M. ?P f A = ?P g A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   864
  from this[THEN bspec, OF top] fin
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   865
  have g_fin: "positive_integral g < \<omega>" by (simp cong: positive_integral_cong)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   866
  { fix f g assume borel: "f \<in> borel_measurable M" "g \<in> borel_measurable M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   867
      and g_fin: "positive_integral g < \<omega>" and eq: "\<forall>A\<in>sets M. ?P f A = ?P g A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   868
    let ?N = "{x\<in>space M. g x < f x}"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   869
    have N: "?N \<in> sets M" using borel by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   870
    have "?P (\<lambda>x. (f x - g x)) ?N = positive_integral (\<lambda>x. f x * indicator ?N x - g x * indicator ?N x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   871
      by (auto intro!: positive_integral_cong simp: indicator_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   872
    also have "\<dots> = ?P f ?N - ?P g ?N"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   873
    proof (rule positive_integral_diff)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   874
      show "(\<lambda>x. f x * indicator ?N x) \<in> borel_measurable M" "(\<lambda>x. g x * indicator ?N x) \<in> borel_measurable M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   875
        using borel N by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   876
      have "?P g ?N \<le> positive_integral g"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   877
        by (auto intro!: positive_integral_mono simp: indicator_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   878
      then show "?P g ?N \<noteq> \<omega>" using g_fin by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   879
      fix x assume "x \<in> space M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   880
      show "g x * indicator ?N x \<le> f x * indicator ?N x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   881
        by (auto simp: indicator_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   882
    qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   883
    also have "\<dots> = 0"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   884
      using eq[THEN bspec, OF N] by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   885
    finally have "\<mu> {x\<in>space M. (f x - g x) * indicator ?N x \<noteq> 0} = 0"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   886
      using borel N by (subst (asm) positive_integral_0_iff) auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   887
    moreover have "{x\<in>space M. (f x - g x) * indicator ?N x \<noteq> 0} = ?N"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   888
      by (auto simp: pinfreal_zero_le_diff)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   889
    ultimately have "?N \<in> null_sets" using N by simp }
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   890
  from this[OF borel g_fin eq] this[OF borel(2,1) fin]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   891
  have "{x\<in>space M. g x < f x} \<union> {x\<in>space M. f x < g x} \<in> null_sets"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   892
    using eq by (intro null_sets_Un) auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   893
  also have "{x\<in>space M. g x < f x} \<union> {x\<in>space M. f x < g x} = {x\<in>space M. f x \<noteq> g x}"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   894
    by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   895
  finally show "AE x. f x = g x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   896
    unfolding almost_everywhere_def by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   897
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   898
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   899
lemma (in finite_measure) density_unique_finite_measure:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   900
  assumes borel: "f \<in> borel_measurable M" "f' \<in> borel_measurable M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   901
  assumes f: "\<And>A. A \<in> sets M \<Longrightarrow> positive_integral (\<lambda>x. f x * indicator A x) = positive_integral (\<lambda>x. f' x * indicator A x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   902
    (is "\<And>A. A \<in> sets M \<Longrightarrow> ?P f A = ?P f' A")
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   903
  shows "AE x. f x = f' x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   904
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   905
  let "?\<nu> A" = "?P f A" and "?\<nu>' A" = "?P f' A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   906
  let "?f A x" = "f x * indicator A x" and "?f' A x" = "f' x * indicator A x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   907
  interpret M: measure_space M ?\<nu>
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   908
    using borel(1) by (rule measure_space_density)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   909
  have ac: "absolutely_continuous ?\<nu>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   910
    using f by (rule density_is_absolutely_continuous)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   911
  from split_space_into_finite_sets_and_rest[OF `measure_space M ?\<nu>` ac]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   912
  obtain Q0 and Q :: "nat \<Rightarrow> 'a set"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   913
    where Q: "disjoint_family Q" "range Q \<subseteq> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   914
    and Q0: "Q0 \<in> sets M" "Q0 = space M - (\<Union>i. Q i)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   915
    and in_Q0: "\<And>A. A \<in> sets M \<Longrightarrow> A \<subseteq> Q0 \<Longrightarrow> \<mu> A = 0 \<and> ?\<nu> A = 0 \<or> 0 < \<mu> A \<and> ?\<nu> A = \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   916
    and Q_fin: "\<And>i. ?\<nu> (Q i) \<noteq> \<omega>" by force
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   917
  from Q have Q_sets: "\<And>i. Q i \<in> sets M" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   918
  let ?N = "{x\<in>space M. f x \<noteq> f' x}"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   919
  have "?N \<in> sets M" using borel by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   920
  have *: "\<And>i x A. \<And>y::pinfreal. y * indicator (Q i) x * indicator A x = y * indicator (Q i \<inter> A) x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   921
    unfolding indicator_def by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   922
  have 1: "\<forall>i. AE x. ?f (Q i) x = ?f' (Q i) x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   923
    using borel Q_fin Q
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   924
    by (intro finite_density_unique[THEN iffD1] allI)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   925
       (auto intro!: borel_measurable_pinfreal_times f Int simp: *)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   926
  have 2: "AE x. ?f Q0 x = ?f' Q0 x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   927
  proof (rule AE_I')
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   928
    { fix f :: "'a \<Rightarrow> pinfreal" assume borel: "f \<in> borel_measurable M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   929
        and eq: "\<And>A. A \<in> sets M \<Longrightarrow> ?\<nu> A = positive_integral (\<lambda>x. f x * indicator A x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   930
      let "?A i" = "Q0 \<inter> {x \<in> space M. f x < of_nat i}"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   931
      have "(\<Union>i. ?A i) \<in> null_sets"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   932
      proof (rule null_sets_UN)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   933
        fix i have "?A i \<in> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   934
          using borel Q0(1) by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   935
        have "?\<nu> (?A i) \<le> positive_integral (\<lambda>x. of_nat i * indicator (?A i) x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   936
          unfolding eq[OF `?A i \<in> sets M`]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   937
          by (auto intro!: positive_integral_mono simp: indicator_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   938
        also have "\<dots> = of_nat i * \<mu> (?A i)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   939
          using `?A i \<in> sets M` by (auto intro!: positive_integral_cmult_indicator)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   940
        also have "\<dots> < \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   941
          using `?A i \<in> sets M`[THEN finite_measure] by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   942
        finally have "?\<nu> (?A i) \<noteq> \<omega>" by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   943
        then show "?A i \<in> null_sets" using in_Q0[OF `?A i \<in> sets M`] `?A i \<in> sets M` by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   944
      qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   945
      also have "(\<Union>i. ?A i) = Q0 \<inter> {x\<in>space M. f x < \<omega>}"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   946
        by (auto simp: less_\<omega>_Ex_of_nat)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   947
      finally have "Q0 \<inter> {x\<in>space M. f x \<noteq> \<omega>} \<in> null_sets" by (simp add: pinfreal_less_\<omega>) }
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   948
    from this[OF borel(1) refl] this[OF borel(2) f]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   949
    have "Q0 \<inter> {x\<in>space M. f x \<noteq> \<omega>} \<in> null_sets" "Q0 \<inter> {x\<in>space M. f' x \<noteq> \<omega>} \<in> null_sets" by simp_all
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   950
    then show "(Q0 \<inter> {x\<in>space M. f x \<noteq> \<omega>}) \<union> (Q0 \<inter> {x\<in>space M. f' x \<noteq> \<omega>}) \<in> null_sets" by (rule null_sets_Un)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   951
    show "{x \<in> space M. ?f Q0 x \<noteq> ?f' Q0 x} \<subseteq>
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   952
      (Q0 \<inter> {x\<in>space M. f x \<noteq> \<omega>}) \<union> (Q0 \<inter> {x\<in>space M. f' x \<noteq> \<omega>})" by (auto simp: indicator_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   953
  qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   954
  have **: "\<And>x. (?f Q0 x = ?f' Q0 x) \<longrightarrow> (\<forall>i. ?f (Q i) x = ?f' (Q i) x) \<longrightarrow>
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   955
    ?f (space M) x = ?f' (space M) x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   956
    by (auto simp: indicator_def Q0)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   957
  have 3: "AE x. ?f (space M) x = ?f' (space M) x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   958
    by (rule AE_mp[OF 1[unfolded all_AE_countable] AE_mp[OF 2]]) (simp add: **)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   959
  then show "AE x. f x = f' x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   960
    by (rule AE_mp) (auto intro!: AE_cong simp: indicator_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   961
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   962
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   963
lemma (in sigma_finite_measure) density_unique:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   964
  assumes borel: "f \<in> borel_measurable M" "f' \<in> borel_measurable M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   965
  assumes f: "\<And>A. A \<in> sets M \<Longrightarrow> positive_integral (\<lambda>x. f x * indicator A x) = positive_integral (\<lambda>x. f' x * indicator A x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   966
    (is "\<And>A. A \<in> sets M \<Longrightarrow> ?P f A = ?P f' A")
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   967
  shows "AE x. f x = f' x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   968
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   969
  obtain h where h_borel: "h \<in> borel_measurable M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   970
    and fin: "positive_integral h \<noteq> \<omega>" and pos: "\<And>x. x \<in> space M \<Longrightarrow> 0 < h x \<and> h x < \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   971
    using Ex_finite_integrable_function by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   972
  interpret h: measure_space M "\<lambda>A. positive_integral (\<lambda>x. h x * indicator A x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   973
    using h_borel by (rule measure_space_density)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   974
  interpret h: finite_measure M "\<lambda>A. positive_integral (\<lambda>x. h x * indicator A x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   975
    by default (simp cong: positive_integral_cong add: fin)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   976
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   977
  interpret f: measure_space M "\<lambda>A. positive_integral (\<lambda>x. f x * indicator A x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   978
    using borel(1) by (rule measure_space_density)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   979
  interpret f': measure_space M "\<lambda>A. positive_integral (\<lambda>x. f' x * indicator A x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   980
    using borel(2) by (rule measure_space_density)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   981
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   982
  { fix A assume "A \<in> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   983
    then have " {x \<in> space M. h x \<noteq> 0 \<and> indicator A x \<noteq> (0::pinfreal)} = A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   984
      using pos sets_into_space by (force simp: indicator_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   985
    then have "positive_integral (\<lambda>xa. h xa * indicator A xa) = 0 \<longleftrightarrow> A \<in> null_sets"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   986
      using h_borel `A \<in> sets M` by (simp add: positive_integral_0_iff) }
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   987
  note h_null_sets = this
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   988
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   989
  { fix A assume "A \<in> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   990
    have "positive_integral (\<lambda>x. h x * (f x * indicator A x)) =
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   991
      f.positive_integral (\<lambda>x. h x * indicator A x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   992
      using `A \<in> sets M` h_borel borel
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   993
      by (simp add: positive_integral_translated_density ac_simps cong: positive_integral_cong)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   994
    also have "\<dots> = f'.positive_integral (\<lambda>x. h x * indicator A x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   995
      by (rule f'.positive_integral_cong_measure) (rule f)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   996
    also have "\<dots> = positive_integral (\<lambda>x. h x * (f' x * indicator A x))"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   997
      using `A \<in> sets M` h_borel borel
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   998
      by (simp add: positive_integral_translated_density ac_simps cong: positive_integral_cong)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
   999
    finally have "positive_integral (\<lambda>x. h x * (f x * indicator A x)) = positive_integral (\<lambda>x. h x * (f' x * indicator A x))" . }
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1000
  then have "h.almost_everywhere (\<lambda>x. f x = f' x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1001
    using h_borel borel
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1002
    by (intro h.density_unique_finite_measure[OF borel])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1003
       (simp add: positive_integral_translated_density)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1004
  then show "AE x. f x = f' x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1005
    unfolding h.almost_everywhere_def almost_everywhere_def
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1006
    by (auto simp add: h_null_sets)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1007
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1008
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1009
lemma (in sigma_finite_measure) sigma_finite_iff_density_finite:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1010
  assumes \<nu>: "measure_space M \<nu>" and f: "f \<in> borel_measurable M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1011
    and eq: "\<And>A. A \<in> sets M \<Longrightarrow> \<nu> A = positive_integral (\<lambda>x. f x * indicator A x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1012
  shows "sigma_finite_measure M \<nu> \<longleftrightarrow> (AE x. f x \<noteq> \<omega>)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1013
proof
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1014
  assume "sigma_finite_measure M \<nu>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1015
  then interpret \<nu>: sigma_finite_measure M \<nu> .
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1016
  from \<nu>.Ex_finite_integrable_function obtain h where
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1017
    h: "h \<in> borel_measurable M" "\<nu>.positive_integral h \<noteq> \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1018
    and fin: "\<And>x. x \<in> space M \<Longrightarrow> 0 < h x \<and> h x < \<omega>" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1019
  have "AE x. f x * h x \<noteq> \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1020
  proof (rule AE_I')
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1021
    have "\<nu>.positive_integral h = positive_integral (\<lambda>x. f x * h x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1022
      by (simp add: \<nu>.positive_integral_cong_measure[symmetric, OF eq[symmetric]])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1023
         (intro positive_integral_translated_density f h)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1024
    then have "positive_integral (\<lambda>x. f x * h x) \<noteq> \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1025
      using h(2) by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1026
    then show "(\<lambda>x. f x * h x) -` {\<omega>} \<inter> space M \<in> null_sets"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1027
      using f h(1) by (auto intro!: positive_integral_omega borel_measurable_vimage)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1028
  qed auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1029
  then show "AE x. f x \<noteq> \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1030
  proof (rule AE_mp, intro AE_cong)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1031
    fix x assume "x \<in> space M" from this[THEN fin]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1032
    show "f x * h x \<noteq> \<omega> \<longrightarrow> f x \<noteq> \<omega>" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1033
  qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1034
next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1035
  assume AE: "AE x. f x \<noteq> \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1036
  from sigma_finite guess Q .. note Q = this
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1037
  interpret \<nu>: measure_space M \<nu> by fact
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1038
  def A \<equiv> "\<lambda>i. f -` (case i of 0 \<Rightarrow> {\<omega>} | Suc n \<Rightarrow> {.. of_nat (Suc n)}) \<inter> space M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1039
  { fix i j have "A i \<inter> Q j \<in> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1040
    unfolding A_def using f Q
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1041
    apply (rule_tac Int)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1042
    by (cases i) (auto intro: measurable_sets[OF f]) }
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1043
  note A_in_sets = this
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1044
  let "?A n" = "case prod_decode n of (i,j) \<Rightarrow> A i \<inter> Q j"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1045
  show "sigma_finite_measure M \<nu>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1046
  proof (default, intro exI conjI subsetI allI)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1047
    fix x assume "x \<in> range ?A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1048
    then obtain n where n: "x = ?A n" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1049
    then show "x \<in> sets M" using A_in_sets by (cases "prod_decode n") auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1050
  next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1051
    have "(\<Union>i. ?A i) = (\<Union>i j. A i \<inter> Q j)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1052
    proof safe
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1053
      fix x i j assume "x \<in> A i" "x \<in> Q j"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1054
      then show "x \<in> (\<Union>i. case prod_decode i of (i, j) \<Rightarrow> A i \<inter> Q j)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1055
        by (intro UN_I[of "prod_encode (i,j)"]) auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1056
    qed auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1057
    also have "\<dots> = (\<Union>i. A i) \<inter> space M" using Q by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1058
    also have "(\<Union>i. A i) = space M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1059
    proof safe
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1060
      fix x assume x: "x \<in> space M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1061
      show "x \<in> (\<Union>i. A i)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1062
      proof (cases "f x")
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1063
        case infinite then show ?thesis using x unfolding A_def by (auto intro: exI[of _ 0])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1064
      next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1065
        case (preal r)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1066
        with less_\<omega>_Ex_of_nat[of "f x"] obtain n where "f x < of_nat n" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1067
        then show ?thesis using x preal unfolding A_def by (auto intro!: exI[of _ "Suc n"])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1068
      qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1069
    qed (auto simp: A_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1070
    finally show "(\<Union>i. ?A i) = space M" by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1071
  next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1072
    fix n obtain i j where
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1073
      [simp]: "prod_decode n = (i, j)" by (cases "prod_decode n") auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1074
    have "positive_integral (\<lambda>x. f x * indicator (A i \<inter> Q j) x) \<noteq> \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1075
    proof (cases i)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1076
      case 0
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1077
      have "AE x. f x * indicator (A i \<inter> Q j) x = 0"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1078
        using AE by (rule AE_mp) (auto intro!: AE_cong simp: A_def `i = 0`)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1079
      then have "positive_integral (\<lambda>x. f x * indicator (A i \<inter> Q j) x) = 0"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1080
        using A_in_sets f
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1081
        apply (subst positive_integral_0_iff)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1082
        apply fast
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1083
        apply (subst (asm) AE_iff_null_set)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1084
        apply (intro borel_measurable_pinfreal_neq_const)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1085
        apply fast
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1086
        by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1087
      then show ?thesis by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1088
    next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1089
      case (Suc n)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1090
      then have "positive_integral (\<lambda>x. f x * indicator (A i \<inter> Q j) x) \<le>
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1091
        positive_integral (\<lambda>x. of_nat (Suc n) * indicator (Q j) x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1092
        by (auto intro!: positive_integral_mono simp: indicator_def A_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1093
      also have "\<dots> = of_nat (Suc n) * \<mu> (Q j)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1094
        using Q by (auto intro!: positive_integral_cmult_indicator)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1095
      also have "\<dots> < \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1096
        using Q by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1097
      finally show ?thesis by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1098
    qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1099
    then show "\<nu> (?A n) \<noteq> \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1100
      using A_in_sets Q eq by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1101
  qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1102
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1103
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1104
section "Radon Nikodym derivative"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1105
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1106
definition (in sigma_finite_measure)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1107
  "RN_deriv \<nu> \<equiv> SOME f. f \<in> borel_measurable M \<and>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1108
    (\<forall>A \<in> sets M. \<nu> A = positive_integral (\<lambda>x. f x * indicator A x))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1109
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1110
lemma (in sigma_finite_measure) RN_deriv_cong:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1111
  assumes cong: "\<And>A. A \<in> sets M \<Longrightarrow> \<mu>' A = \<mu> A" "\<And>A. A \<in> sets M \<Longrightarrow> \<nu>' A = \<nu> A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1112
  shows "sigma_finite_measure.RN_deriv M \<mu>' \<nu>' x = RN_deriv \<nu> x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1113
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1114
  interpret \<mu>': sigma_finite_measure M \<mu>'
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1115
    using cong(1) by (rule sigma_finite_measure_cong)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1116
  show ?thesis
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1117
    unfolding RN_deriv_def \<mu>'.RN_deriv_def
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1118
    by (simp add: cong positive_integral_cong_measure[OF cong(1)])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1119
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1120
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1121
lemma (in sigma_finite_measure) RN_deriv:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1122
  assumes "measure_space M \<nu>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1123
  assumes "absolutely_continuous \<nu>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1124
  shows "RN_deriv \<nu> \<in> borel_measurable M" (is ?borel)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1125
  and "\<And>A. A \<in> sets M \<Longrightarrow> \<nu> A = positive_integral (\<lambda>x. RN_deriv \<nu> x * indicator A x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1126
    (is "\<And>A. _ \<Longrightarrow> ?int A")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1127
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1128
  note Ex = Radon_Nikodym[OF assms, unfolded Bex_def]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1129
  thus ?borel unfolding RN_deriv_def by (rule someI2_ex) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1130
  fix A assume "A \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1131
  from Ex show "?int A" unfolding RN_deriv_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1132
    by (rule someI2_ex) (simp add: `A \<in> sets M`)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1133
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1134
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1135
lemma (in sigma_finite_measure) RN_deriv_positive_integral:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1136
  assumes \<nu>: "measure_space M \<nu>" "absolutely_continuous \<nu>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1137
    and f: "f \<in> borel_measurable M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1138
  shows "measure_space.positive_integral M \<nu> f = positive_integral (\<lambda>x. RN_deriv \<nu> x * f x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1139
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1140
  interpret \<nu>: measure_space M \<nu> by fact
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1141
  have "\<nu>.positive_integral f =
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1142
    measure_space.positive_integral M (\<lambda>A. positive_integral (\<lambda>x. RN_deriv \<nu> x * indicator A x)) f"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1143
    by (intro \<nu>.positive_integral_cong_measure[symmetric] RN_deriv(2)[OF \<nu>, symmetric])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1144
  also have "\<dots> = positive_integral (\<lambda>x. RN_deriv \<nu> x * f x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1145
    by (intro positive_integral_translated_density RN_deriv[OF \<nu>] f)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1146
  finally show ?thesis .
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1147
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1148
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1149
lemma (in sigma_finite_measure) RN_deriv_unique:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1150
  assumes \<nu>: "measure_space M \<nu>" "absolutely_continuous \<nu>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1151
  and f: "f \<in> borel_measurable M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1152
  and eq: "\<And>A. A \<in> sets M \<Longrightarrow> \<nu> A = positive_integral (\<lambda>x. f x * indicator A x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1153
  shows "AE x. f x = RN_deriv \<nu> x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1154
proof (rule density_unique[OF f RN_deriv(1)[OF \<nu>]])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1155
  fix A assume A: "A \<in> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1156
  show "positive_integral (\<lambda>x. f x * indicator A x) = positive_integral (\<lambda>x. RN_deriv \<nu> x * indicator A x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1157
    unfolding eq[OF A, symmetric] RN_deriv(2)[OF \<nu> A, symmetric] ..
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1158
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1159
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1160
lemma the_inv_into_in:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1161
  assumes "inj_on f A" and x: "x \<in> f`A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1162
  shows "the_inv_into A f x \<in> A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1163
  using assms by (auto simp: the_inv_into_f_f)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1164
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1165
lemma (in sigma_finite_measure) RN_deriv_vimage:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1166
  fixes f :: "'b \<Rightarrow> 'a"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1167
  assumes f: "bij_betw f S (space M)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1168
  assumes \<nu>: "measure_space M \<nu>" "absolutely_continuous \<nu>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1169
  shows "AE x.
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1170
    sigma_finite_measure.RN_deriv (vimage_algebra S f) (\<lambda>A. \<mu> (f ` A)) (\<lambda>A. \<nu> (f ` A)) (the_inv_into S f x) = RN_deriv \<nu> x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1171
proof (rule RN_deriv_unique[OF \<nu>])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1172
  interpret sf: sigma_finite_measure "vimage_algebra S f" "\<lambda>A. \<mu> (f ` A)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1173
    using f by (rule sigma_finite_measure_isomorphic)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1174
  interpret \<nu>: measure_space M \<nu> using \<nu>(1) .
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1175
  have \<nu>': "measure_space (vimage_algebra S f) (\<lambda>A. \<nu> (f ` A))"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1176
    using f by (rule \<nu>.measure_space_isomorphic)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1177
  { fix A assume "A \<in> sets M" then have "f ` (f -` A \<inter> S) = A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1178
      using sets_into_space f[unfolded bij_betw_def]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1179
      by (intro image_vimage_inter_eq[where T="space M"]) auto }
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1180
  note A_f = this
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1181
  then have ac: "sf.absolutely_continuous (\<lambda>A. \<nu> (f ` A))"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1182
    using \<nu>(2) by (auto simp: sf.absolutely_continuous_def absolutely_continuous_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1183
  show "(\<lambda>x. sf.RN_deriv (\<lambda>A. \<nu> (f ` A)) (the_inv_into S f x)) \<in> borel_measurable M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1184
    using sf.RN_deriv(1)[OF \<nu>' ac]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1185
    unfolding measurable_vimage_iff_inv[OF f] comp_def .
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1186
  fix A assume "A \<in> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1187
  then have *: "\<And>x. x \<in> space M \<Longrightarrow> indicator (f -` A \<inter> S) (the_inv_into S f x) = (indicator A x :: pinfreal)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1188
    using f[unfolded bij_betw_def]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1189
    unfolding indicator_def by (auto simp: f_the_inv_into_f the_inv_into_in)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1190
  have "\<nu> (f ` (f -` A \<inter> S)) = sf.positive_integral (\<lambda>x. sf.RN_deriv (\<lambda>A. \<nu> (f ` A)) x * indicator (f -` A \<inter> S) x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1191
    using `A \<in> sets M` by (force intro!: sf.RN_deriv(2)[OF \<nu>' ac])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1192
  also have "\<dots> = positive_integral (\<lambda>x. sf.RN_deriv (\<lambda>A. \<nu> (f ` A)) (the_inv_into S f x) * indicator A x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1193
    unfolding positive_integral_vimage_inv[OF f]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1194
    by (simp add: * cong: positive_integral_cong)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1195
  finally show "\<nu> A = positive_integral (\<lambda>x. sf.RN_deriv (\<lambda>A. \<nu> (f ` A)) (the_inv_into S f x) * indicator A x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1196
    unfolding A_f[OF `A \<in> sets M`] .
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1197
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1198
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1199
lemma (in sigma_finite_measure) RN_deriv_finite:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1200
  assumes sfm: "sigma_finite_measure M \<nu>" and ac: "absolutely_continuous \<nu>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1201
  shows "AE x. RN_deriv \<nu> x \<noteq> \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1202
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1203
  interpret \<nu>: sigma_finite_measure M \<nu> by fact
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1204
  have \<nu>: "measure_space M \<nu>" by default
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1205
  from sfm show ?thesis
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1206
    using sigma_finite_iff_density_finite[OF \<nu> RN_deriv[OF \<nu> ac]] by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1207
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1208
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1209
lemma (in sigma_finite_measure)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1210
  assumes \<nu>: "sigma_finite_measure M \<nu>" "absolutely_continuous \<nu>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1211
    and f: "f \<in> borel_measurable M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1212
  shows RN_deriv_integral: "measure_space.integral M \<nu> f = integral (\<lambda>x. real (RN_deriv \<nu> x) * f x)" (is ?integral)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1213
    and RN_deriv_integrable: "measure_space.integrable M \<nu> f \<longleftrightarrow> integrable (\<lambda>x. real (RN_deriv \<nu> x) * f x)" (is ?integrable)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1214
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1215
  interpret \<nu>: sigma_finite_measure M \<nu> by fact
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1216
  have ms: "measure_space M \<nu>" by default
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1217
  have minus_cong: "\<And>A B A' B'::pinfreal. A = A' \<Longrightarrow> B = B' \<Longrightarrow> real A - real B = real A' - real B'" by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1218
  have f': "(\<lambda>x. - f x) \<in> borel_measurable M" using f by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1219
  { fix f :: "'a \<Rightarrow> real" assume "f \<in> borel_measurable M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1220
    { fix x assume *: "RN_deriv \<nu> x \<noteq> \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1221
      have "Real (real (RN_deriv \<nu> x)) * Real (f x) = Real (real (RN_deriv \<nu> x) * f x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1222
        by (simp add: mult_le_0_iff)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1223
      then have "RN_deriv \<nu> x * Real (f x) = Real (real (RN_deriv \<nu> x) * f x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1224
        using * by (simp add: Real_real) }
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1225
    note * = this
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1226
    have "positive_integral (\<lambda>x. RN_deriv \<nu> x * Real (f x)) = positive_integral (\<lambda>x. Real (real (RN_deriv \<nu> x) * f x))"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1227
      apply (rule positive_integral_cong_AE)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1228
      apply (rule AE_mp[OF RN_deriv_finite[OF \<nu>]])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1229
      by (auto intro!: AE_cong simp: *) }
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1230
  with this[OF f] this[OF f'] f f'
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1231
  show ?integral ?integrable
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1232
    unfolding \<nu>.integral_def integral_def \<nu>.integrable_def integrable_def
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1233
    by (auto intro!: RN_deriv(1)[OF ms \<nu>(2)] minus_cong simp: RN_deriv_positive_integral[OF ms \<nu>(2)])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1234
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39097
diff changeset
  1235
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1236
lemma (in sigma_finite_measure) RN_deriv_singleton:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1237
  assumes "measure_space M \<nu>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1238
  and ac: "absolutely_continuous \<nu>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1239
  and "{x} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1240
  shows "\<nu> {x} = RN_deriv \<nu> x * \<mu> {x}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1241
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1242
  note deriv = RN_deriv[OF assms(1, 2)]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1243
  from deriv(2)[OF `{x} \<in> sets M`]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1244
  have "\<nu> {x} = positive_integral (\<lambda>w. RN_deriv \<nu> x * indicator {x} w)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1245
    by (auto simp: indicator_def intro!: positive_integral_cong)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1246
  thus ?thesis using positive_integral_cmult_indicator[OF `{x} \<in> sets M`]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1247
    by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1248
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1249
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1250
theorem (in finite_measure_space) RN_deriv_finite_measure:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1251
  assumes "measure_space M \<nu>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1252
  and ac: "absolutely_continuous \<nu>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1253
  and "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1254
  shows "\<nu> {x} = RN_deriv \<nu> x * \<mu> {x}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1255
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1256
  have "{x} \<in> sets M" using sets_eq_Pow `x \<in> space M` by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1257
  from RN_deriv_singleton[OF assms(1,2) this] show ?thesis .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1258
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1259
d5d342611edb Rewrite the Probability theory.
hoelzl
parents:
diff changeset
  1260
end