src/HOL/Probability/Measure.thy
author hoelzl
Fri, 21 Jan 2011 11:39:26 +0100
changeset 41660 7795aaab6038
parent 41545 9c869baf1c66
child 41661 baf1964bc468
permissions -rw-r--r--
use AE_mp in AE_conjI proof
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
     1
(* Author: Lawrence C Paulson; Armin Heller, Johannes Hoelzl, TU Muenchen *)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
     2
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
     3
theory Measure
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
     4
  imports Caratheodory
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
     5
begin
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
     6
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
     7
lemma inj_on_image_eq_iff:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
     8
  assumes "inj_on f S"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
     9
  assumes "A \<subseteq> S" "B \<subseteq> S"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    10
  shows "(f ` A = f ` B) \<longleftrightarrow> (A = B)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    11
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    12
  have "inj_on f (A \<union> B)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    13
    using assms by (auto intro: subset_inj_on)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    14
  from inj_on_Un_image_eq_iff[OF this]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    15
  show ?thesis .
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    16
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    17
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    18
lemma image_vimage_inter_eq:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    19
  assumes "f ` S = T" "X \<subseteq> T"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    20
  shows "f ` (f -` X \<inter> S) = X"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    21
proof (intro antisym)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    22
  have "f ` (f -` X \<inter> S) \<subseteq> f ` (f -` X)" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    23
  also have "\<dots> = X \<inter> range f" by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    24
  also have "\<dots> = X" using assms by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    25
  finally show "f ` (f -` X \<inter> S) \<subseteq> X" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    26
next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    27
  show "X \<subseteq> f ` (f -` X \<inter> S)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    28
  proof
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    29
    fix x assume "x \<in> X"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    30
    then have "x \<in> T" using `X \<subseteq> T` by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    31
    then obtain y where "x = f y" "y \<in> S"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    32
      using assms by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    33
    then have "{y} \<subseteq> f -` X \<inter> S" using `x \<in> X` by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    34
    moreover have "x \<in> f ` {y}" using `x = f y` by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    35
    ultimately show "x \<in> f ` (f -` X \<inter> S)" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    36
  qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    37
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    38
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    39
text {*
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    40
  This formalisation of measure theory is based on the work of Hurd/Coble wand
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    41
  was later translated by Lawrence Paulson to Isabelle/HOL. Later it was
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    42
  modified to use the positive infinite reals and to prove the uniqueness of
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    43
  cut stable measures.
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
    44
*}
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    45
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    46
section {* Equations for the measure function @{text \<mu>} *}
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    47
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    48
lemma (in measure_space) measure_countably_additive:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    49
  assumes "range A \<subseteq> sets M" "disjoint_family A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    50
  shows "psuminf (\<lambda>i. \<mu> (A i)) = \<mu> (\<Union>i. A i)"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    51
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    52
  have "(\<Union> i. A i) \<in> sets M" using assms(1) by (rule countable_UN)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    53
  with ca assms show ?thesis by (simp add: countably_additive_def)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    54
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    55
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    56
lemma (in measure_space) measure_space_cong:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    57
  assumes "\<And>A. A \<in> sets M \<Longrightarrow> \<nu> A = \<mu> A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    58
  shows "measure_space M \<nu>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    59
proof
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    60
  show "\<nu> {} = 0" using assms by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    61
  show "countably_additive M \<nu>" unfolding countably_additive_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    62
  proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    63
    fix A :: "nat \<Rightarrow> 'a set" assume A: "range A \<subseteq> sets M" "disjoint_family A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    64
    then have "\<And>i. A i \<in> sets M" "(UNION UNIV A) \<in> sets M" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    65
    from this[THEN assms] measure_countably_additive[OF A]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    66
    show "(\<Sum>\<^isub>\<infinity>n. \<nu> (A n)) = \<nu> (UNION UNIV A)" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    67
  qed
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    68
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    69
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    70
lemma (in measure_space) additive: "additive M \<mu>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    71
proof (rule algebra.countably_additive_additive [OF _ _ ca])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    72
  show "algebra M" by default
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    73
  show "positive \<mu>" by (simp add: positive_def)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    74
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    75
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    76
lemma (in measure_space) measure_additive:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    77
     "a \<in> sets M \<Longrightarrow> b \<in> sets M \<Longrightarrow> a \<inter> b = {}
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    78
      \<Longrightarrow> \<mu> a + \<mu> b = \<mu> (a \<union> b)"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    79
  by (metis additiveD additive)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    80
36624
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
    81
lemma (in measure_space) measure_mono:
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
    82
  assumes "a \<subseteq> b" "a \<in> sets M" "b \<in> sets M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    83
  shows "\<mu> a \<le> \<mu> b"
36624
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
    84
proof -
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
    85
  have "b = a \<union> (b - a)" using assms by auto
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
    86
  moreover have "{} = a \<inter> (b - a)" by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    87
  ultimately have "\<mu> b = \<mu> a + \<mu> (b - a)"
36624
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
    88
    using measure_additive[of a "b - a"] local.Diff[of b a] assms by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    89
  moreover have "\<mu> (b - a) \<ge> 0" using assms by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    90
  ultimately show "\<mu> a \<le> \<mu> b" by auto
36624
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
    91
qed
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
    92
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    93
lemma (in measure_space) measure_compl:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    94
  assumes s: "s \<in> sets M" and fin: "\<mu> s \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    95
  shows "\<mu> (space M - s) = \<mu> (space M) - \<mu> s"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    96
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    97
  have s_less_space: "\<mu> s \<le> \<mu> (space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    98
    using s by (auto intro!: measure_mono sets_into_space)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
    99
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   100
  have "\<mu> (space M) = \<mu> (s \<union> (space M - s))" using s
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   101
    by (metis Un_Diff_cancel Un_absorb1 s sets_into_space)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   102
  also have "... = \<mu> s + \<mu> (space M - s)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   103
    by (rule additiveD [OF additive]) (auto simp add: s)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   104
  finally have "\<mu> (space M) = \<mu> s + \<mu> (space M - s)" .
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   105
  thus ?thesis
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
   106
    unfolding minus_pextreal_eq2[OF s_less_space fin]
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   107
    by (simp add: ac_simps)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   108
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   109
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   110
lemma (in measure_space) measure_Diff:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   111
  assumes finite: "\<mu> B \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   112
  and measurable: "A \<in> sets M" "B \<in> sets M" "B \<subseteq> A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   113
  shows "\<mu> (A - B) = \<mu> A - \<mu> B"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   114
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   115
  have *: "(A - B) \<union> B = A" using `B \<subseteq> A` by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   116
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   117
  have "\<mu> ((A - B) \<union> B) = \<mu> (A - B) + \<mu> B"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   118
    using measurable by (rule_tac measure_additive[symmetric]) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   119
  thus ?thesis unfolding * using `\<mu> B \<noteq> \<omega>`
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
   120
    by (simp add: pextreal_cancel_plus_minus)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   121
qed
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   122
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   123
lemma (in measure_space) measure_countable_increasing:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   124
  assumes A: "range A \<subseteq> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   125
      and A0: "A 0 = {}"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   126
      and ASuc: "\<And>n.  A n \<subseteq> A (Suc n)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   127
  shows "(SUP n. \<mu> (A n)) = \<mu> (\<Union>i. A i)"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   128
proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   129
  {
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   130
    fix n
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   131
    have "\<mu> (A n) =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   132
          setsum (\<mu> \<circ> (\<lambda>i. A (Suc i) - A i)) {..<n}"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   133
      proof (induct n)
37032
58a0757031dd speed up some proofs and fix some warnings
huffman
parents: 36670
diff changeset
   134
        case 0 thus ?case by (auto simp add: A0)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   135
      next
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   136
        case (Suc m)
33536
fd28b7399f2b eliminated hard tabulators;
wenzelm
parents: 33273
diff changeset
   137
        have "A (Suc m) = A m \<union> (A (Suc m) - A m)"
fd28b7399f2b eliminated hard tabulators;
wenzelm
parents: 33273
diff changeset
   138
          by (metis ASuc Un_Diff_cancel Un_absorb1)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   139
        hence "\<mu> (A (Suc m)) =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   140
               \<mu> (A m) + \<mu> (A (Suc m) - A m)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   141
          by (subst measure_additive)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   142
             (auto simp add: measure_additive range_subsetD [OF A])
33536
fd28b7399f2b eliminated hard tabulators;
wenzelm
parents: 33273
diff changeset
   143
        with Suc show ?case
fd28b7399f2b eliminated hard tabulators;
wenzelm
parents: 33273
diff changeset
   144
          by simp
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   145
      qed }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   146
  note Meq = this
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   147
  have Aeq: "(\<Union>i. A (Suc i) - A i) = (\<Union>i. A i)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   148
    proof (rule UN_finite2_eq [where k=1], simp)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   149
      fix i
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   150
      show "(\<Union>i\<in>{0..<i}. A (Suc i) - A i) = (\<Union>i\<in>{0..<Suc i}. A i)"
33536
fd28b7399f2b eliminated hard tabulators;
wenzelm
parents: 33273
diff changeset
   151
        proof (induct i)
fd28b7399f2b eliminated hard tabulators;
wenzelm
parents: 33273
diff changeset
   152
          case 0 thus ?case by (simp add: A0)
fd28b7399f2b eliminated hard tabulators;
wenzelm
parents: 33273
diff changeset
   153
        next
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   154
          case (Suc i)
33536
fd28b7399f2b eliminated hard tabulators;
wenzelm
parents: 33273
diff changeset
   155
          thus ?case
fd28b7399f2b eliminated hard tabulators;
wenzelm
parents: 33273
diff changeset
   156
            by (auto simp add: atLeastLessThanSuc intro: subsetD [OF ASuc])
fd28b7399f2b eliminated hard tabulators;
wenzelm
parents: 33273
diff changeset
   157
        qed
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   158
    qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   159
  have A1: "\<And>i. A (Suc i) - A i \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   160
    by (metis A Diff range_subsetD)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   161
  have A2: "(\<Union>i. A (Suc i) - A i) \<in> sets M"
37032
58a0757031dd speed up some proofs and fix some warnings
huffman
parents: 36670
diff changeset
   162
    by (blast intro: range_subsetD [OF A])
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   163
  have "psuminf ( (\<lambda>i. \<mu> (A (Suc i) - A i))) = \<mu> (\<Union>i. A (Suc i) - A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   164
    by (rule measure_countably_additive)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   165
       (auto simp add: disjoint_family_Suc ASuc A1 A2)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   166
  also have "... =  \<mu> (\<Union>i. A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   167
    by (simp add: Aeq)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   168
  finally have "psuminf (\<lambda>i. \<mu> (A (Suc i) - A i)) = \<mu> (\<Union>i. A i)" .
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   169
  thus ?thesis
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   170
    by (auto simp add: Meq psuminf_def)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   171
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   172
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   173
lemma (in measure_space) continuity_from_below:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   174
  assumes A: "range A \<subseteq> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   175
      and ASuc: "!!n.  A n \<subseteq> A (Suc n)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   176
  shows "(SUP n. \<mu> (A n)) = \<mu> (\<Union>i. A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   177
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   178
  have *: "(SUP n. \<mu> (nat_case {} A (Suc n))) = (SUP n. \<mu> (nat_case {} A n))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   179
    apply (rule Sup_mono_offset_Suc)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   180
    apply (rule measure_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   181
    using assms by (auto split: nat.split)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   182
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   183
  have ueq: "(\<Union>i. nat_case {} A i) = (\<Union>i. A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   184
    by (auto simp add: split: nat.splits)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   185
  have meq: "\<And>n. \<mu> (A n) = (\<mu> \<circ> nat_case {} A) (Suc n)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   186
    by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   187
  have "(SUP n. \<mu> (nat_case {} A n)) = \<mu> (\<Union>i. nat_case {} A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   188
    by (rule measure_countable_increasing)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   189
       (auto simp add: range_subsetD [OF A] subsetD [OF ASuc] split: nat.splits)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   190
  also have "\<mu> (\<Union>i. nat_case {} A i) = \<mu> (\<Union>i. A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   191
    by (simp add: ueq)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   192
  finally have "(SUP n. \<mu> (nat_case {} A n)) = \<mu> (\<Union>i. A i)" .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   193
  thus ?thesis unfolding meq * comp_def .
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   194
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   195
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   196
lemma (in measure_space) measure_up:
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   197
  assumes "\<And>i. B i \<in> sets M" "B \<up> P"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   198
  shows "(\<lambda>i. \<mu> (B i)) \<up> \<mu> P"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   199
  using assms unfolding isoton_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   200
  by (auto intro!: measure_mono continuity_from_below)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   201
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   202
lemma (in measure_space) continuity_from_below':
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   203
  assumes A: "range A \<subseteq> sets M" "\<And>i. A i \<subseteq> A (Suc i)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   204
  shows "(\<lambda>i. (\<mu> (A i))) ----> (\<mu> (\<Union>i. A i))"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   205
proof- let ?A = "\<Union>i. A i"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   206
  have " (\<lambda>i. \<mu> (A i)) \<up> \<mu> ?A" apply(rule measure_up)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   207
    using assms unfolding complete_lattice_class.isoton_def by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   208
  thus ?thesis by(rule isotone_Lim(1))
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   209
qed
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   210
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   211
lemma (in measure_space) continuity_from_above:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   212
  assumes A: "range A \<subseteq> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   213
  and mono_Suc: "\<And>n.  A (Suc n) \<subseteq> A n"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   214
  and finite: "\<And>i. \<mu> (A i) \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   215
  shows "(INF n. \<mu> (A n)) = \<mu> (\<Inter>i. A i)"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   216
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   217
  { fix n have "A n \<subseteq> A 0" using mono_Suc by (induct n) auto }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   218
  note mono = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   219
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   220
  have le_MI: "\<mu> (\<Inter>i. A i) \<le> \<mu> (A 0)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   221
    using A by (auto intro!: measure_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   222
  hence *: "\<mu> (\<Inter>i. A i) \<noteq> \<omega>" using finite[of 0] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   223
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   224
  have le_IM: "(INF n. \<mu> (A n)) \<le> \<mu> (A 0)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   225
    by (rule INF_leI) simp
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   226
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   227
  have "\<mu> (A 0) - (INF n. \<mu> (A n)) = (SUP n. \<mu> (A 0 - A n))"
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
   228
    unfolding pextreal_SUP_minus[symmetric]
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   229
    using mono A finite by (subst measure_Diff) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   230
  also have "\<dots> = \<mu> (\<Union>i. A 0 - A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   231
  proof (rule continuity_from_below)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   232
    show "range (\<lambda>n. A 0 - A n) \<subseteq> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   233
      using A by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   234
    show "\<And>n. A 0 - A n \<subseteq> A 0 - A (Suc n)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   235
      using mono_Suc by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   236
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   237
  also have "\<dots> = \<mu> (A 0) - \<mu> (\<Inter>i. A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   238
    using mono A finite * by (simp, subst measure_Diff) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   239
  finally show ?thesis
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
   240
    by (rule pextreal_diff_eq_diff_imp_eq[OF finite[of 0] le_IM le_MI])
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   241
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   242
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   243
lemma (in measure_space) measure_down:
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   244
  assumes "\<And>i. B i \<in> sets M" "B \<down> P"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   245
  and finite: "\<And>i. \<mu> (B i) \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   246
  shows "(\<lambda>i. \<mu> (B i)) \<down> \<mu> P"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   247
  using assms unfolding antiton_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   248
  by (auto intro!: measure_mono continuity_from_above)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   249
lemma (in measure_space) measure_insert:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   250
  assumes sets: "{x} \<in> sets M" "A \<in> sets M" and "x \<notin> A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   251
  shows "\<mu> (insert x A) = \<mu> {x} + \<mu> A"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   252
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   253
  have "{x} \<inter> A = {}" using `x \<notin> A` by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   254
  from measure_additive[OF sets this] show ?thesis by simp
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   255
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   256
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   257
lemma (in measure_space) measure_finite_singleton:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   258
  assumes fin: "finite S"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   259
  and ssets: "\<And>x. x \<in> S \<Longrightarrow> {x} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   260
  shows "\<mu> S = (\<Sum>x\<in>S. \<mu> {x})"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   261
using assms proof induct
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   262
  case (insert x S)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   263
  have *: "\<mu> S = (\<Sum>x\<in>S. \<mu> {x})" "{x} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   264
    using insert.prems by (blast intro!: insert.hyps(3))+
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   265
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   266
  have "(\<Union>x\<in>S. {x}) \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   267
    using  insert.prems `finite S` by (blast intro!: finite_UN)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   268
  hence "S \<in> sets M" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   269
  from measure_insert[OF `{x} \<in> sets M` this `x \<notin> S`]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   270
  show ?case using `x \<notin> S` `finite S` * by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   271
qed simp
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   272
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   273
lemma (in measure_space) measure_finitely_additive':
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   274
  assumes "f \<in> ({..< n :: nat} \<rightarrow> sets M)"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   275
  assumes "\<And> a b. \<lbrakk>a < n ; b < n ; a \<noteq> b\<rbrakk> \<Longrightarrow> f a \<inter> f b = {}"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   276
  assumes "s = \<Union> (f ` {..< n})"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   277
  shows "(\<Sum>i<n. (\<mu> \<circ> f) i) = \<mu> s"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   278
proof -
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   279
  def f' == "\<lambda> i. (if i < n then f i else {})"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   280
  have rf: "range f' \<subseteq> sets M" unfolding f'_def
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   281
    using assms empty_sets by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   282
  have df: "disjoint_family f'" unfolding f'_def disjoint_family_on_def
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   283
    using assms by simp
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   284
  have "\<Union> range f' = (\<Union> i \<in> {..< n}. f i)"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   285
    unfolding f'_def by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   286
  then have "\<mu> s = \<mu> (\<Union> range f')"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   287
    using assms by simp
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   288
  then have part1: "(\<Sum>\<^isub>\<infinity> i. \<mu> (f' i)) = \<mu> s"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   289
    using df rf ca[unfolded countably_additive_def, rule_format, of f']
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   290
    by auto
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   291
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   292
  have "(\<Sum>\<^isub>\<infinity> i. \<mu> (f' i)) = (\<Sum> i< n. \<mu> (f' i))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   293
    by (rule psuminf_finite) (simp add: f'_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   294
  also have "\<dots> = (\<Sum>i<n. \<mu> (f i))"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   295
    unfolding f'_def by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   296
  finally have part2: "(\<Sum>\<^isub>\<infinity> i. \<mu> (f' i)) = (\<Sum>i<n. \<mu> (f i))" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   297
  show ?thesis using part1 part2 by auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   298
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   299
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   300
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   301
lemma (in measure_space) measure_finitely_additive:
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   302
  assumes "finite r"
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   303
  assumes "r \<subseteq> sets M"
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   304
  assumes d: "\<And> a b. \<lbrakk>a \<in> r ; b \<in> r ; a \<noteq> b\<rbrakk> \<Longrightarrow> a \<inter> b = {}"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   305
  shows "(\<Sum> i \<in> r. \<mu> i) = \<mu> (\<Union> r)"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   306
using assms
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   307
proof -
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   308
  (* counting the elements in r is enough *)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   309
  let ?R = "{..<card r}"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   310
  obtain f where f: "f ` ?R = r" "inj_on f ?R"
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   311
    using ex_bij_betw_nat_finite[unfolded bij_betw_def, OF `finite r`]
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   312
    unfolding atLeast0LessThan by auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   313
  hence f_into_sets: "f \<in> ?R \<rightarrow> sets M" using assms by auto
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   314
  have disj: "\<And> a b. \<lbrakk>a \<in> ?R ; b \<in> ?R ; a \<noteq> b\<rbrakk> \<Longrightarrow> f a \<inter> f b = {}"
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   315
  proof -
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   316
    fix a b assume asm: "a \<in> ?R" "b \<in> ?R" "a \<noteq> b"
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   317
    hence neq: "f a \<noteq> f b" using f[unfolded inj_on_def, rule_format] by blast
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   318
    from asm have "f a \<in> r" "f b \<in> r" using f by auto
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   319
    thus "f a \<inter> f b = {}" using d[of "f a" "f b"] f using neq by auto
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   320
  qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   321
  have "(\<Union> r) = (\<Union> i \<in> ?R. f i)"
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   322
    using f by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   323
  hence "\<mu> (\<Union> r)= \<mu> (\<Union> i \<in> ?R. f i)" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   324
  also have "\<dots> = (\<Sum> i \<in> ?R. \<mu> (f i))"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   325
    using measure_finitely_additive'[OF f_into_sets disj] by simp
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   326
  also have "\<dots> = (\<Sum> a \<in> r. \<mu> a)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   327
    using f[rule_format] setsum_reindex[of f ?R "\<lambda> a. \<mu> a"] by auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   328
  finally show ?thesis by simp
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   329
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   330
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   331
lemma (in measure_space) measure_finitely_additive'':
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   332
  assumes "finite s"
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   333
  assumes "\<And> i. i \<in> s \<Longrightarrow> a i \<in> sets M"
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   334
  assumes d: "disjoint_family_on a s"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   335
  shows "(\<Sum> i \<in> s. \<mu> (a i)) = \<mu> (\<Union> i \<in> s. a i)"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   336
using assms
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   337
proof -
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   338
  (* counting the elements in s is enough *)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   339
  let ?R = "{..< card s}"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   340
  obtain f where f: "f ` ?R = s" "inj_on f ?R"
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   341
    using ex_bij_betw_nat_finite[unfolded bij_betw_def, OF `finite s`]
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   342
    unfolding atLeast0LessThan by auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   343
  hence f_into_sets: "a \<circ> f \<in> ?R \<rightarrow> sets M" using assms unfolding o_def by auto
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   344
  have disj: "\<And> i j. \<lbrakk>i \<in> ?R ; j \<in> ?R ; i \<noteq> j\<rbrakk> \<Longrightarrow> (a \<circ> f) i \<inter> (a \<circ> f) j = {}"
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   345
  proof -
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   346
    fix i j assume asm: "i \<in> ?R" "j \<in> ?R" "i \<noteq> j"
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   347
    hence neq: "f i \<noteq> f j" using f[unfolded inj_on_def, rule_format] by blast
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   348
    from asm have "f i \<in> s" "f j \<in> s" using f by auto
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   349
    thus "(a \<circ> f) i \<inter> (a \<circ> f) j = {}"
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   350
      using d f neq unfolding disjoint_family_on_def by auto
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   351
  qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   352
  have "(\<Union> i \<in> s. a i) = (\<Union> i \<in> f ` ?R. a i)" using f by auto
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   353
  hence "(\<Union> i \<in> s. a i) = (\<Union> i \<in> ?R. a (f i))" by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   354
  hence "\<mu> (\<Union> i \<in> s. a i) = (\<Sum> i \<in> ?R. \<mu> (a (f i)))"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   355
    using measure_finitely_additive'[OF f_into_sets disj] by simp
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   356
  also have "\<dots> = (\<Sum> i \<in> s. \<mu> (a i))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   357
    using f[rule_format] setsum_reindex[of f ?R "\<lambda> i. \<mu> (a i)"] by auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   358
  finally show ?thesis by simp
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   359
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   360
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   361
lemma (in sigma_algebra) finite_additivity_sufficient:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   362
  assumes fin: "finite (space M)" and pos: "positive \<mu>" and add: "additive M \<mu>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   363
  shows "measure_space M \<mu>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   364
proof
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   365
  show [simp]: "\<mu> {} = 0" using pos by (simp add: positive_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   366
  show "countably_additive M \<mu>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   367
    proof (auto simp add: countably_additive_def)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   368
      fix A :: "nat \<Rightarrow> 'a set"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   369
      assume A: "range A \<subseteq> sets M"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   370
         and disj: "disjoint_family A"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   371
         and UnA: "(\<Union>i. A i) \<in> sets M"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   372
      def I \<equiv> "{i. A i \<noteq> {}}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   373
      have "Union (A ` I) \<subseteq> space M" using A
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   374
        by auto (metis range_subsetD subsetD sets_into_space)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   375
      hence "finite (A ` I)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   376
        by (metis finite_UnionD finite_subset fin)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   377
      moreover have "inj_on A I" using disj
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   378
        by (auto simp add: I_def disjoint_family_on_def inj_on_def)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   379
      ultimately have finI: "finite I"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   380
        by (metis finite_imageD)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   381
      hence "\<exists>N. \<forall>m\<ge>N. A m = {}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   382
        proof (cases "I = {}")
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   383
          case True thus ?thesis by (simp add: I_def)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   384
        next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   385
          case False
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   386
          hence "\<forall>i\<in>I. i < Suc(Max I)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   387
            by (simp add: Max_less_iff [symmetric] finI)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   388
          hence "\<forall>m \<ge> Suc(Max I). A m = {}"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   389
            by (simp add: I_def) (metis less_le_not_le)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   390
          thus ?thesis
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   391
            by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   392
        qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   393
      then obtain N where N: "\<forall>m\<ge>N. A m = {}" by blast
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   394
      then have "\<forall>m\<ge>N. \<mu> (A m) = 0" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   395
      then have "(\<Sum>\<^isub>\<infinity> n. \<mu> (A n)) = setsum (\<lambda>m. \<mu> (A m)) {..<N}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   396
        by (simp add: psuminf_finite)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   397
      also have "... = \<mu> (\<Union>i<N. A i)"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   398
        proof (induct N)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   399
          case 0 thus ?case by simp
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   400
        next
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   401
          case (Suc n)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   402
          have "\<mu> (A n \<union> (\<Union> x<n. A x)) = \<mu> (A n) + \<mu> (\<Union> i<n. A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   403
            proof (rule Caratheodory.additiveD [OF add])
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   404
              show "A n \<inter> (\<Union> x<n. A x) = {}" using disj
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
   405
                by (auto simp add: disjoint_family_on_def nat_less_le) blast
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   406
              show "A n \<in> sets M" using A
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   407
                by force
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   408
              show "(\<Union>i<n. A i) \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   409
                proof (induct n)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   410
                  case 0 thus ?case by simp
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   411
                next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   412
                  case (Suc n) thus ?case using A
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   413
                    by (simp add: lessThan_Suc Un range_subsetD)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   414
                qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   415
            qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   416
          thus ?case using Suc
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   417
            by (simp add: lessThan_Suc)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   418
        qed
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   419
      also have "... = \<mu> (\<Union>i. A i)"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   420
        proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   421
          have "(\<Union> i<N. A i) = (\<Union>i. A i)" using N
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   422
            by auto (metis Int_absorb N disjoint_iff_not_equal lessThan_iff not_leE)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   423
          thus ?thesis by simp
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   424
        qed
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   425
      finally show "(\<Sum>\<^isub>\<infinity> n. \<mu> (A n)) = \<mu> (\<Union>i. A i)" .
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   426
    qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   427
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   428
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   429
lemma (in measure_space) measure_setsum_split:
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   430
  assumes "finite r" and "a \<in> sets M" and br_in_M: "b ` r \<subseteq> sets M"
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   431
  assumes "(\<Union>i \<in> r. b i) = space M"
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   432
  assumes "disjoint_family_on b r"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   433
  shows "\<mu> a = (\<Sum> i \<in> r. \<mu> (a \<inter> (b i)))"
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   434
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   435
  have *: "\<mu> a = \<mu> (\<Union>i \<in> r. a \<inter> b i)"
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   436
    using assms by auto
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   437
  show ?thesis unfolding *
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   438
  proof (rule measure_finitely_additive''[symmetric])
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   439
    show "finite r" using `finite r` by auto
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   440
    { fix i assume "i \<in> r"
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   441
      hence "b i \<in> sets M" using br_in_M by auto
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   442
      thus "a \<inter> b i \<in> sets M" using `a \<in> sets M` by auto
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   443
    }
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   444
    show "disjoint_family_on (\<lambda>i. a \<inter> b i) r"
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   445
      using `disjoint_family_on b r`
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   446
      unfolding disjoint_family_on_def by auto
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   447
  qed
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   448
qed
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   449
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   450
lemma (in measure_space) measure_subadditive:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   451
  assumes measurable: "A \<in> sets M" "B \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   452
  shows "\<mu> (A \<union> B) \<le> \<mu> A + \<mu> B"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   453
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   454
  from measure_additive[of A "B - A"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   455
  have "\<mu> (A \<union> B) = \<mu> A + \<mu> (B - A)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   456
    using assms by (simp add: Diff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   457
  also have "\<dots> \<le> \<mu> A + \<mu> B"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   458
    using assms by (auto intro!: add_left_mono measure_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   459
  finally show ?thesis .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   460
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   461
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   462
lemma (in measure_space) measure_eq_0:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   463
  assumes "N \<in> sets M" and "\<mu> N = 0" and "K \<subseteq> N" and "K \<in> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   464
  shows "\<mu> K = 0"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   465
using measure_mono[OF assms(3,4,1)] assms(2) by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   466
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   467
lemma (in measure_space) measure_finitely_subadditive:
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   468
  assumes "finite I" "A ` I \<subseteq> sets M"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   469
  shows "\<mu> (\<Union>i\<in>I. A i) \<le> (\<Sum>i\<in>I. \<mu> (A i))"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   470
using assms proof induct
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   471
  case (insert i I)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   472
  then have "(\<Union>i\<in>I. A i) \<in> sets M" by (auto intro: finite_UN)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   473
  then have "\<mu> (\<Union>i\<in>insert i I. A i) \<le> \<mu> (A i) + \<mu> (\<Union>i\<in>I. A i)"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   474
    using insert by (simp add: measure_subadditive)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   475
  also have "\<dots> \<le> (\<Sum>i\<in>insert i I. \<mu> (A i))"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   476
    using insert by (auto intro!: add_left_mono)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   477
  finally show ?case .
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   478
qed simp
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   479
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   480
lemma (in measure_space) measure_countably_subadditive:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   481
  assumes "range f \<subseteq> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   482
  shows "\<mu> (\<Union>i. f i) \<le> (\<Sum>\<^isub>\<infinity> i. \<mu> (f i))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   483
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   484
  have "\<mu> (\<Union>i. f i) = \<mu> (\<Union>i. disjointed f i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   485
    unfolding UN_disjointed_eq ..
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   486
  also have "\<dots> = (\<Sum>\<^isub>\<infinity> i. \<mu> (disjointed f i))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   487
    using range_disjointed_sets[OF assms] measure_countably_additive
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   488
    by (simp add:  disjoint_family_disjointed comp_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   489
  also have "\<dots> \<le> (\<Sum>\<^isub>\<infinity> i. \<mu> (f i))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   490
  proof (rule psuminf_le, rule measure_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   491
    fix i show "disjointed f i \<subseteq> f i" by (rule disjointed_subset)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   492
    show "f i \<in> sets M" "disjointed f i \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   493
      using assms range_disjointed_sets[OF assms] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   494
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   495
  finally show ?thesis .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   496
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   497
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   498
lemma (in measure_space) measure_UN_eq_0:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   499
  assumes "\<And> i :: nat. \<mu> (N i) = 0" and "range N \<subseteq> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   500
  shows "\<mu> (\<Union> i. N i) = 0"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   501
using measure_countably_subadditive[OF assms(2)] assms(1) by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   502
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   503
lemma (in measure_space) measure_inter_full_set:
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   504
  assumes "S \<in> sets M" "T \<in> sets M" and not_\<omega>: "\<mu> (T - S) \<noteq> \<omega>"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   505
  assumes T: "\<mu> T = \<mu> (space M)"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   506
  shows "\<mu> (S \<inter> T) = \<mu> S"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   507
proof (rule antisym)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   508
  show " \<mu> (S \<inter> T) \<le> \<mu> S"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   509
    using assms by (auto intro!: measure_mono)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   510
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   511
  show "\<mu> S \<le> \<mu> (S \<inter> T)"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   512
  proof (rule ccontr)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   513
    assume contr: "\<not> ?thesis"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   514
    have "\<mu> (space M) = \<mu> ((T - S) \<union> (S \<inter> T))"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   515
      unfolding T[symmetric] by (auto intro!: arg_cong[where f="\<mu>"])
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   516
    also have "\<dots> \<le> \<mu> (T - S) + \<mu> (S \<inter> T)"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   517
      using assms by (auto intro!: measure_subadditive)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   518
    also have "\<dots> < \<mu> (T - S) + \<mu> S"
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
   519
      by (rule pextreal_less_add[OF not_\<omega>]) (insert contr, auto)
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   520
    also have "\<dots> = \<mu> (T \<union> S)"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   521
      using assms by (subst measure_additive) auto
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   522
    also have "\<dots> \<le> \<mu> (space M)"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   523
      using assms sets_into_space by (auto intro!: measure_mono)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   524
    finally show False ..
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   525
  qed
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   526
qed
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   527
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   528
lemma measure_unique_Int_stable:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   529
  fixes M E :: "'a algebra" and A :: "nat \<Rightarrow> 'a set"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   530
  assumes "Int_stable E" "M = sigma E"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   531
  and A: "range  A \<subseteq> sets E" "A \<up> space E"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   532
  and ms: "measure_space M \<mu>" "measure_space M \<nu>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   533
  and eq: "\<And>X. X \<in> sets E \<Longrightarrow> \<mu> X = \<nu> X"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   534
  and finite: "\<And>i. \<mu> (A i) \<noteq> \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   535
  assumes "X \<in> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   536
  shows "\<mu> X = \<nu> X"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   537
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   538
  let "?D F" = "{D. D \<in> sets M \<and> \<mu> (F \<inter> D) = \<nu> (F \<inter> D)}"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   539
  interpret M: measure_space M \<mu> by fact
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   540
  interpret M': measure_space M \<nu> by fact
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   541
  have "space E = space M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   542
    using `M = sigma E` by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   543
  have sets_E: "sets E \<subseteq> Pow (space E)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   544
  proof
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   545
    fix X assume "X \<in> sets E"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   546
    then have "X \<in> sets M" unfolding `M = sigma E`
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   547
      unfolding sigma_def by (auto intro!: sigma_sets.Basic)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   548
    with M.sets_into_space show "X \<in> Pow (space E)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   549
      unfolding `space E = space M` by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   550
  qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   551
  have A': "range A \<subseteq> sets M" using `M = sigma E` A
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   552
    by (auto simp: sets_sigma intro!: sigma_sets.Basic)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   553
  { fix F assume "F \<in> sets E" and "\<mu> F \<noteq> \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   554
    then have [intro]: "F \<in> sets M" unfolding `M = sigma E` sets_sigma
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   555
      by (intro sigma_sets.Basic)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   556
    have "\<nu> F \<noteq> \<omega>" using `\<mu> F \<noteq> \<omega>` `F \<in> sets E` eq by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   557
    interpret D: dynkin_system "\<lparr>space=space E, sets=?D F\<rparr>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   558
    proof (rule dynkin_systemI, simp_all)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   559
      fix A assume "A \<in> sets M \<and> \<mu> (F \<inter> A) = \<nu> (F \<inter> A)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   560
      then show "A \<subseteq> space E"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   561
        unfolding `space E = space M` using M.sets_into_space by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   562
    next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   563
      have "F \<inter> space E = F" using `F \<in> sets E` sets_E by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   564
      then show "space E \<in> sets M \<and> \<mu> (F \<inter> space E) = \<nu> (F \<inter> space E)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   565
        unfolding `space E = space M` using `F \<in> sets E` eq by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   566
    next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   567
      fix A assume *: "A \<in> sets M \<and> \<mu> (F \<inter> A) = \<nu> (F \<inter> A)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   568
      then have **: "F \<inter> (space M - A) = F - (F \<inter> A)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   569
        and [intro]: "F \<inter> A \<in> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   570
        using `F \<in> sets E` sets_E `space E = space M` by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   571
      have "\<nu> (F \<inter> A) \<le> \<nu> F" by (auto intro!: M'.measure_mono)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   572
      then have "\<nu> (F \<inter> A) \<noteq> \<omega>" using `\<nu> F \<noteq> \<omega>` by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   573
      have "\<mu> (F \<inter> A) \<le> \<mu> F" by (auto intro!: M.measure_mono)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   574
      then have "\<mu> (F \<inter> A) \<noteq> \<omega>" using `\<mu> F \<noteq> \<omega>` by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   575
      then have "\<mu> (F \<inter> (space M - A)) = \<mu> F - \<mu> (F \<inter> A)" unfolding **
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   576
        using `F \<inter> A \<in> sets M` by (auto intro!: M.measure_Diff)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   577
      also have "\<dots> = \<nu> F - \<nu> (F \<inter> A)" using eq `F \<in> sets E` * by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   578
      also have "\<dots> = \<nu> (F \<inter> (space M - A))" unfolding **
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   579
        using `F \<inter> A \<in> sets M` `\<nu> (F \<inter> A) \<noteq> \<omega>` by (auto intro!: M'.measure_Diff[symmetric])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   580
      finally show "space E - A \<in> sets M \<and> \<mu> (F \<inter> (space E - A)) = \<nu> (F \<inter> (space E - A))"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   581
        using `space E = space M` * by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   582
    next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   583
      fix A :: "nat \<Rightarrow> 'a set"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   584
      assume "disjoint_family A" "range A \<subseteq> {X \<in> sets M. \<mu> (F \<inter> X) = \<nu> (F \<inter> X)}"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   585
      then have A: "range (\<lambda>i. F \<inter> A i) \<subseteq> sets M" "F \<inter> (\<Union>x. A x) = (\<Union>x. F \<inter> A x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   586
        "disjoint_family (\<lambda>i. F \<inter> A i)" "\<And>i. \<mu> (F \<inter> A i) = \<nu> (F \<inter> A i)" "range A \<subseteq> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   587
        by ((fastsimp simp: disjoint_family_on_def)+)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   588
      then show "(\<Union>x. A x) \<in> sets M \<and> \<mu> (F \<inter> (\<Union>x. A x)) = \<nu> (F \<inter> (\<Union>x. A x))"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   589
        by (auto simp: M.measure_countably_additive[symmetric]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   590
                       M'.measure_countably_additive[symmetric]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   591
            simp del: UN_simps)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   592
    qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   593
    have *: "sigma E = \<lparr>space = space E, sets = ?D F\<rparr>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   594
      using `M = sigma E` `F \<in> sets E` `Int_stable E`
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   595
      by (intro D.dynkin_lemma)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   596
         (auto simp add: sets_sigma Int_stable_def eq intro: sigma_sets.Basic)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   597
    have "\<And>D. D \<in> sets M \<Longrightarrow> \<mu> (F \<inter> D) = \<nu> (F \<inter> D)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   598
      unfolding `M = sigma E` by (auto simp: *) }
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   599
  note * = this
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   600
  { fix i have "\<mu> (A i \<inter> X) = \<nu> (A i \<inter> X)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   601
      using *[of "A i" X] `X \<in> sets M` A finite by auto }
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   602
  moreover
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   603
  have "(\<lambda>i. A i \<inter> X) \<up> X"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   604
    using `X \<in> sets M` M.sets_into_space A `space E = space M`
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   605
    by (auto simp: isoton_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   606
  then have "(\<lambda>i. \<mu> (A i \<inter> X)) \<up> \<mu> X" "(\<lambda>i. \<nu> (A i \<inter> X)) \<up> \<nu> X"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   607
    using `X \<in> sets M` A' by (auto intro!: M.measure_up M'.measure_up M.Int)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   608
  ultimately show ?thesis by (simp add: isoton_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   609
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   610
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   611
section "Isomorphisms between measure spaces"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   612
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   613
lemma (in measure_space) measure_space_isomorphic:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   614
  fixes f :: "'c \<Rightarrow> 'a"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   615
  assumes "bij_betw f S (space M)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   616
  shows "measure_space (vimage_algebra S f) (\<lambda>A. \<mu> (f ` A))"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   617
    (is "measure_space ?T ?\<mu>")
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   618
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   619
  have "f \<in> S \<rightarrow> space M" using assms unfolding bij_betw_def by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   620
  then interpret T: sigma_algebra ?T by (rule sigma_algebra_vimage)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   621
  show ?thesis
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   622
  proof
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   623
    show "\<mu> (f`{}) = 0" by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   624
    show "countably_additive ?T (\<lambda>A. \<mu> (f ` A))"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   625
    proof (unfold countably_additive_def, intro allI impI)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   626
      fix A :: "nat \<Rightarrow> 'c set" assume "range A \<subseteq> sets ?T" "disjoint_family A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   627
      then have "\<forall>i. \<exists>F'. F' \<in> sets M \<and> A i = f -` F' \<inter> S"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   628
        by (auto simp: image_iff image_subset_iff Bex_def vimage_algebra_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   629
      from choice[OF this] obtain F where F: "\<And>i. F i \<in> sets M" and A: "\<And>i. A i = f -` F i \<inter> S" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   630
      then have [simp]: "\<And>i. f ` (A i) = F i"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   631
        using sets_into_space assms
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   632
        by (force intro!: image_vimage_inter_eq[where T="space M"] simp: bij_betw_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   633
      have "disjoint_family F"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   634
      proof (intro disjoint_family_on_bisimulation[OF `disjoint_family A`])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   635
        fix n m assume "A n \<inter> A m = {}"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   636
        then have "f -` (F n \<inter> F m) \<inter> S = {}" unfolding A by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   637
        moreover
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   638
        have "F n \<in> sets M" "F m \<in> sets M" using F by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   639
        then have "f`S = space M" "F n \<inter> F m \<subseteq> space M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   640
          using sets_into_space assms by (auto simp: bij_betw_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   641
        note image_vimage_inter_eq[OF this, symmetric]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   642
        ultimately show "F n \<inter> F m = {}" by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   643
      qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   644
      with F show "(\<Sum>\<^isub>\<infinity> i. \<mu> (f ` A i)) = \<mu> (f ` (\<Union>i. A i))"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   645
        by (auto simp add: image_UN intro!: measure_countably_additive)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   646
    qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   647
  qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   648
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   649
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   650
section "@{text \<mu>}-null sets"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   651
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   652
abbreviation (in measure_space) "null_sets \<equiv> {N\<in>sets M. \<mu> N = 0}"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   653
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   654
lemma (in measure_space) null_sets_Un[intro]:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   655
  assumes "N \<in> null_sets" "N' \<in> null_sets"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   656
  shows "N \<union> N' \<in> null_sets"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   657
proof (intro conjI CollectI)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   658
  show "N \<union> N' \<in> sets M" using assms by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   659
  have "\<mu> (N \<union> N') \<le> \<mu> N + \<mu> N'"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   660
    using assms by (intro measure_subadditive) auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   661
  then show "\<mu> (N \<union> N') = 0"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   662
    using assms by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   663
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   664
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   665
lemma UN_from_nat: "(\<Union>i. N i) = (\<Union>i. N (Countable.from_nat i))"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   666
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   667
  have "(\<Union>i. N i) = (\<Union>i. (N \<circ> Countable.from_nat) i)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   668
    unfolding SUPR_def image_compose
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   669
    unfolding surj_from_nat ..
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   670
  then show ?thesis by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   671
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   672
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   673
lemma (in measure_space) null_sets_UN[intro]:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   674
  assumes "\<And>i::'i::countable. N i \<in> null_sets"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   675
  shows "(\<Union>i. N i) \<in> null_sets"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   676
proof (intro conjI CollectI)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   677
  show "(\<Union>i. N i) \<in> sets M" using assms by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   678
  have "\<mu> (\<Union>i. N i) \<le> (\<Sum>\<^isub>\<infinity> n. \<mu> (N (Countable.from_nat n)))"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   679
    unfolding UN_from_nat[of N]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   680
    using assms by (intro measure_countably_subadditive) auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   681
  then show "\<mu> (\<Union>i. N i) = 0"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   682
    using assms by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   683
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   684
40871
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   685
lemma (in measure_space) null_sets_finite_UN:
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   686
  assumes "finite S" "\<And>i. i \<in> S \<Longrightarrow> A i \<in> null_sets"
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   687
  shows "(\<Union>i\<in>S. A i) \<in> null_sets"
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   688
proof (intro CollectI conjI)
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   689
  show "(\<Union>i\<in>S. A i) \<in> sets M" using assms by (intro finite_UN) auto
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   690
  have "\<mu> (\<Union>i\<in>S. A i) \<le> (\<Sum>i\<in>S. \<mu> (A i))"
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   691
    using assms by (intro measure_finitely_subadditive) auto
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   692
  then show "\<mu> (\<Union>i\<in>S. A i) = 0"
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   693
    using assms by auto
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   694
qed
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   695
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   696
lemma (in measure_space) null_set_Int1:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   697
  assumes "B \<in> null_sets" "A \<in> sets M" shows "A \<inter> B \<in> null_sets"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   698
using assms proof (intro CollectI conjI)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   699
  show "\<mu> (A \<inter> B) = 0" using assms by (intro measure_eq_0[of B "A \<inter> B"]) auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   700
qed auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   701
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   702
lemma (in measure_space) null_set_Int2:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   703
  assumes "B \<in> null_sets" "A \<in> sets M" shows "B \<inter> A \<in> null_sets"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   704
  using assms by (subst Int_commute) (rule null_set_Int1)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   705
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   706
lemma (in measure_space) measure_Diff_null_set:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   707
  assumes "B \<in> null_sets" "A \<in> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   708
  shows "\<mu> (A - B) = \<mu> A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   709
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   710
  have *: "A - B = (A - (A \<inter> B))" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   711
  have "A \<inter> B \<in> null_sets" using assms by (rule null_set_Int1)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   712
  then show ?thesis
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   713
    unfolding * using assms
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   714
    by (subst measure_Diff) auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   715
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   716
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   717
lemma (in measure_space) null_set_Diff:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   718
  assumes "B \<in> null_sets" "A \<in> sets M" shows "B - A \<in> null_sets"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   719
using assms proof (intro CollectI conjI)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   720
  show "\<mu> (B - A) = 0" using assms by (intro measure_eq_0[of B "B - A"]) auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   721
qed auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   722
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   723
lemma (in measure_space) measure_Un_null_set:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   724
  assumes "A \<in> sets M" "B \<in> null_sets"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   725
  shows "\<mu> (A \<union> B) = \<mu> A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   726
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   727
  have *: "A \<union> B = A \<union> (B - A)" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   728
  have "B - A \<in> null_sets" using assms(2,1) by (rule null_set_Diff)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   729
  then show ?thesis
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   730
    unfolding * using assms
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   731
    by (subst measure_additive[symmetric]) auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   732
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   733
40871
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   734
section "Formalise almost everywhere"
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   735
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   736
definition (in measure_space)
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   737
  almost_everywhere :: "('a \<Rightarrow> bool) \<Rightarrow> bool" (binder "AE " 10) where
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   738
  "almost_everywhere P \<longleftrightarrow> (\<exists>N\<in>null_sets. { x \<in> space M. \<not> P x } \<subseteq> N)"
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   739
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   740
lemma (in measure_space) AE_I':
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   741
  "N \<in> null_sets \<Longrightarrow> {x\<in>space M. \<not> P x} \<subseteq> N \<Longrightarrow> (AE x. P x)"
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   742
  unfolding almost_everywhere_def by auto
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   743
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   744
lemma (in measure_space) AE_iff_null_set:
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   745
  assumes "{x\<in>space M. \<not> P x} \<in> sets M" (is "?P \<in> sets M")
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   746
  shows "(AE x. P x) \<longleftrightarrow> {x\<in>space M. \<not> P x} \<in> null_sets"
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   747
proof
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   748
  assume "AE x. P x" then obtain N where N: "N \<in> sets M" "?P \<subseteq> N" "\<mu> N = 0"
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   749
    unfolding almost_everywhere_def by auto
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   750
  moreover have "\<mu> ?P \<le> \<mu> N"
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   751
    using assms N(1,2) by (auto intro: measure_mono)
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   752
  ultimately show "?P \<in> null_sets" using assms by auto
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   753
next
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   754
  assume "?P \<in> null_sets" with assms show "AE x. P x" by (auto intro: AE_I')
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   755
qed
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
   756
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   757
lemma (in measure_space) AE_True[intro, simp]: "AE x. True"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   758
  unfolding almost_everywhere_def by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   759
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   760
lemma (in measure_space) AE_E[consumes 1]:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   761
  assumes "AE x. P x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   762
  obtains N where "{x \<in> space M. \<not> P x} \<subseteq> N" "\<mu> N = 0" "N \<in> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   763
  using assms unfolding almost_everywhere_def by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   764
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   765
lemma (in measure_space) AE_I:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   766
  assumes "{x \<in> space M. \<not> P x} \<subseteq> N" "\<mu> N = 0" "N \<in> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   767
  shows "AE x. P x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   768
  using assms unfolding almost_everywhere_def by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   769
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   770
lemma (in measure_space) AE_mp:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   771
  assumes AE_P: "AE x. P x" and AE_imp: "AE x. P x \<longrightarrow> Q x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   772
  shows "AE x. Q x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   773
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   774
  from AE_P obtain A where P: "{x\<in>space M. \<not> P x} \<subseteq> A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   775
    and A: "A \<in> sets M" "\<mu> A = 0"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   776
    by (auto elim!: AE_E)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   777
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   778
  from AE_imp obtain B where imp: "{x\<in>space M. P x \<and> \<not> Q x} \<subseteq> B"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   779
    and B: "B \<in> sets M" "\<mu> B = 0"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   780
    by (auto elim!: AE_E)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   781
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   782
  show ?thesis
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   783
  proof (intro AE_I)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   784
    show "A \<union> B \<in> sets M" "\<mu> (A \<union> B) = 0" using A B
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   785
      using measure_subadditive[of A B] by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   786
    show "{x\<in>space M. \<not> Q x} \<subseteq> A \<union> B"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   787
      using P imp by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   788
  qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   789
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   790
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   791
lemma (in measure_space) AE_iffI:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   792
  assumes P: "AE x. P x" and Q: "AE x. P x \<longleftrightarrow> Q x" shows "AE x. Q x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   793
  using AE_mp[OF Q, of "\<lambda>x. P x \<longrightarrow> Q x"] AE_mp[OF P, of Q] by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   794
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   795
lemma (in measure_space) AE_disjI1:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   796
  assumes P: "AE x. P x" shows "AE x. P x \<or> Q x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   797
  by (rule AE_mp[OF P]) auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   798
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   799
lemma (in measure_space) AE_disjI2:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   800
  assumes P: "AE x. Q x" shows "AE x. P x \<or> Q x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   801
  by (rule AE_mp[OF P]) auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   802
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   803
lemma (in measure_space) AE_conjI:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   804
  assumes AE_P: "AE x. P x" and AE_Q: "AE x. Q x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   805
  shows "AE x. P x \<and> Q x"
41660
7795aaab6038 use AE_mp in AE_conjI proof
hoelzl
parents: 41545
diff changeset
   806
  apply (rule AE_mp[OF AE_P])
7795aaab6038 use AE_mp in AE_conjI proof
hoelzl
parents: 41545
diff changeset
   807
  apply (rule AE_mp[OF AE_Q])
7795aaab6038 use AE_mp in AE_conjI proof
hoelzl
parents: 41545
diff changeset
   808
  by simp
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   809
41660
7795aaab6038 use AE_mp in AE_conjI proof
hoelzl
parents: 41545
diff changeset
   810
lemma (in measure_space) AE_conj_iff[simp]:
7795aaab6038 use AE_mp in AE_conjI proof
hoelzl
parents: 41545
diff changeset
   811
  shows "(AE x. P x \<and> Q x) \<longleftrightarrow> (AE x. P x) \<and> (AE x. Q x)"
7795aaab6038 use AE_mp in AE_conjI proof
hoelzl
parents: 41545
diff changeset
   812
proof (intro conjI iffI AE_conjI)
7795aaab6038 use AE_mp in AE_conjI proof
hoelzl
parents: 41545
diff changeset
   813
  assume *: "AE x. P x \<and> Q x"
7795aaab6038 use AE_mp in AE_conjI proof
hoelzl
parents: 41545
diff changeset
   814
  from * show "AE x. P x" by (rule AE_mp) auto
7795aaab6038 use AE_mp in AE_conjI proof
hoelzl
parents: 41545
diff changeset
   815
  from * show "AE x. Q x" by (rule AE_mp) auto
7795aaab6038 use AE_mp in AE_conjI proof
hoelzl
parents: 41545
diff changeset
   816
qed auto
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   817
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   818
lemma (in measure_space) AE_E2:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   819
  assumes "AE x. P x" "{x\<in>space M. P x} \<in> sets M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   820
  shows "\<mu> {x\<in>space M. \<not> P x} = 0" (is "\<mu> ?P = 0")
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   821
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   822
  obtain A where A: "?P \<subseteq> A" "A \<in> sets M" "\<mu> A = 0"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   823
    using assms by (auto elim!: AE_E)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   824
  have "?P = space M - {x\<in>space M. P x}" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   825
  then have "?P \<in> sets M" using assms by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   826
  with assms `?P \<subseteq> A` `A \<in> sets M` have "\<mu> ?P \<le> \<mu> A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   827
    by (auto intro!: measure_mono)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   828
  then show "\<mu> ?P = 0" using A by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   829
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   830
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   831
lemma (in measure_space) AE_space[simp, intro]: "AE x. x \<in> space M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   832
  by (rule AE_I[where N="{}"]) auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   833
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   834
lemma (in measure_space) AE_cong:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   835
  assumes "\<And>x. x \<in> space M \<Longrightarrow> P x" shows "AE x. P x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   836
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   837
  have [simp]: "\<And>x. (x \<in> space M \<longrightarrow> P x) \<longleftrightarrow> True" using assms by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   838
  show ?thesis
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   839
    by (rule AE_mp[OF AE_space]) auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   840
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   841
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   842
lemma (in measure_space) all_AE_countable:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   843
  "(\<forall>i::'i::countable. AE x. P i x) \<longleftrightarrow> (AE x. \<forall>i. P i x)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   844
proof
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   845
  assume "\<forall>i. AE x. P i x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   846
  from this[unfolded almost_everywhere_def Bex_def, THEN choice]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   847
  obtain N where N: "\<And>i. N i \<in> null_sets" "\<And>i. {x\<in>space M. \<not> P i x} \<subseteq> N i" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   848
  have "{x\<in>space M. \<not> (\<forall>i. P i x)} \<subseteq> (\<Union>i. {x\<in>space M. \<not> P i x})" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   849
  also have "\<dots> \<subseteq> (\<Union>i. N i)" using N by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   850
  finally have "{x\<in>space M. \<not> (\<forall>i. P i x)} \<subseteq> (\<Union>i. N i)" .
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   851
  moreover from N have "(\<Union>i. N i) \<in> null_sets"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   852
    by (intro null_sets_UN) auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   853
  ultimately show "AE x. \<forall>i. P i x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   854
    unfolding almost_everywhere_def by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   855
next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   856
  assume *: "AE x. \<forall>i. P i x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   857
  show "\<forall>i. AE x. P i x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   858
    by (rule allI, rule AE_mp[OF *]) simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   859
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   860
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   861
lemma (in measure_space) restricted_measure_space:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   862
  assumes "S \<in> sets M"
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   863
  shows "measure_space (restricted_space S) \<mu>"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   864
    (is "measure_space ?r \<mu>")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   865
  unfolding measure_space_def measure_space_axioms_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   866
proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   867
  show "sigma_algebra ?r" using restricted_sigma_algebra[OF assms] .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   868
  show "\<mu> {} = 0" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   869
  show "countably_additive ?r \<mu>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   870
    unfolding countably_additive_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   871
  proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   872
    fix A :: "nat \<Rightarrow> 'a set"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   873
    assume *: "range A \<subseteq> sets ?r" and **: "disjoint_family A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   874
    from restriction_in_sets[OF assms *[simplified]] **
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   875
    show "(\<Sum>\<^isub>\<infinity> n. \<mu> (A n)) = \<mu> (\<Union>i. A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   876
      using measure_countably_additive by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   877
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   878
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   879
39089
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   880
lemma (in measure_space) measure_space_vimage:
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   881
  fixes M' :: "'b algebra"
39089
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   882
  assumes "f \<in> measurable M M'"
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   883
  and "sigma_algebra M'"
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   884
  shows "measure_space M' (\<lambda>A. \<mu> (f -` A \<inter> space M))" (is "measure_space M' ?T")
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   885
proof -
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   886
  interpret M': sigma_algebra M' by fact
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   887
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   888
  show ?thesis
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   889
  proof
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   890
    show "?T {} = 0" by simp
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   891
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   892
    show "countably_additive M' ?T"
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   893
    proof (unfold countably_additive_def, safe)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   894
      fix A :: "nat \<Rightarrow> 'b set" assume "range A \<subseteq> sets M'" "disjoint_family A"
39089
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   895
      hence *: "\<And>i. f -` (A i) \<inter> space M \<in> sets M"
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   896
        using `f \<in> measurable M M'` by (auto simp: measurable_def)
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   897
      moreover have "(\<Union>i. f -`  A i \<inter> space M) \<in> sets M"
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   898
        using * by blast
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   899
      moreover have **: "disjoint_family (\<lambda>i. f -` A i \<inter> space M)"
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   900
        using `disjoint_family A` by (auto simp: disjoint_family_on_def)
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   901
      ultimately show "(\<Sum>\<^isub>\<infinity> i. ?T (A i)) = ?T (\<Union>i. A i)"
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   902
        using measure_countably_additive[OF _ **] by (auto simp: comp_def vimage_UN)
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   903
    qed
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   904
  qed
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   905
qed
df379a447753 vimage of measurable function is a measure space
hoelzl
parents: 38656
diff changeset
   906
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   907
lemma (in measure_space) measure_space_subalgebra:
41545
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41023
diff changeset
   908
  assumes "sigma_algebra N" and [simp]: "sets N \<subseteq> sets M" "space N = space M"
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41023
diff changeset
   909
  shows "measure_space N \<mu>"
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   910
proof -
41545
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41023
diff changeset
   911
  interpret N: sigma_algebra N by fact
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   912
  show ?thesis
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   913
  proof
41545
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41023
diff changeset
   914
    from `sets N \<subseteq> sets M` have "\<And>A. range A \<subseteq> sets N \<Longrightarrow> range A \<subseteq> sets M" by blast
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41023
diff changeset
   915
    then show "countably_additive N \<mu>"
9c869baf1c66 tuned formalization of subalgebra
hoelzl
parents: 41023
diff changeset
   916
      by (auto intro!: measure_countably_additive simp: countably_additive_def)
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   917
  qed simp
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   918
qed
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   919
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   920
section "@{text \<sigma>}-finite Measures"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   921
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   922
locale sigma_finite_measure = measure_space +
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   923
  assumes sigma_finite: "\<exists>A::nat \<Rightarrow> 'a set. range A \<subseteq> sets M \<and> (\<Union>i. A i) = space M \<and> (\<forall>i. \<mu> (A i) \<noteq> \<omega>)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   924
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   925
lemma (in sigma_finite_measure) restricted_sigma_finite_measure:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   926
  assumes "S \<in> sets M"
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   927
  shows "sigma_finite_measure (restricted_space S) \<mu>"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   928
    (is "sigma_finite_measure ?r _")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   929
  unfolding sigma_finite_measure_def sigma_finite_measure_axioms_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   930
proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   931
  show "measure_space ?r \<mu>" using restricted_measure_space[OF assms] .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   932
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   933
  obtain A :: "nat \<Rightarrow> 'a set" where
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   934
      "range A \<subseteq> sets M" "(\<Union>i. A i) = space M" "\<And>i. \<mu> (A i) \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   935
    using sigma_finite by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   936
  show "\<exists>A::nat \<Rightarrow> 'a set. range A \<subseteq> sets ?r \<and> (\<Union>i. A i) = space ?r \<and> (\<forall>i. \<mu> (A i) \<noteq> \<omega>)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   937
  proof (safe intro!: exI[of _ "\<lambda>i. A i \<inter> S"] del: notI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   938
    fix i
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   939
    show "A i \<inter> S \<in> sets ?r"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   940
      using `range A \<subseteq> sets M` `S \<in> sets M` by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   941
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   942
    fix x i assume "x \<in> S" thus "x \<in> space ?r" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   943
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   944
    fix x assume "x \<in> space ?r" thus "x \<in> (\<Union>i. A i \<inter> S)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   945
      using `(\<Union>i. A i) = space M` `S \<in> sets M` by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   946
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   947
    fix i
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   948
    have "\<mu> (A i \<inter> S) \<le> \<mu> (A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   949
      using `range A \<subseteq> sets M` `S \<in> sets M` by (auto intro!: measure_mono)
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
   950
    also have "\<dots> < \<omega>" using `\<mu> (A i) \<noteq> \<omega>` by (auto simp: pextreal_less_\<omega>)
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
   951
    finally show "\<mu> (A i \<inter> S) \<noteq> \<omega>" by (auto simp: pextreal_less_\<omega>)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   952
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   953
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   954
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   955
lemma (in sigma_finite_measure) sigma_finite_measure_cong:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   956
  assumes cong: "\<And>A. A \<in> sets M \<Longrightarrow> \<mu>' A = \<mu> A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   957
  shows "sigma_finite_measure M \<mu>'"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   958
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   959
  interpret \<mu>': measure_space M \<mu>'
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   960
    using cong by (rule measure_space_cong)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   961
  from sigma_finite guess A .. note A = this
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   962
  then have "\<And>i. A i \<in> sets M" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   963
  with A have fin: "(\<forall>i. \<mu>' (A i) \<noteq> \<omega>)" using cong by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   964
  show ?thesis
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   965
    apply default
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   966
    using A fin by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   967
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   968
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   969
lemma (in sigma_finite_measure) disjoint_sigma_finite:
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   970
  "\<exists>A::nat\<Rightarrow>'a set. range A \<subseteq> sets M \<and> (\<Union>i. A i) = space M \<and>
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   971
    (\<forall>i. \<mu> (A i) \<noteq> \<omega>) \<and> disjoint_family A"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   972
proof -
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   973
  obtain A :: "nat \<Rightarrow> 'a set" where
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   974
    range: "range A \<subseteq> sets M" and
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   975
    space: "(\<Union>i. A i) = space M" and
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   976
    measure: "\<And>i. \<mu> (A i) \<noteq> \<omega>"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   977
    using sigma_finite by auto
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   978
  note range' = range_disjointed_sets[OF range] range
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   979
  { fix i
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   980
    have "\<mu> (disjointed A i) \<le> \<mu> (A i)"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   981
      using range' disjointed_subset[of A i] by (auto intro!: measure_mono)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   982
    then have "\<mu> (disjointed A i) \<noteq> \<omega>"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   983
      using measure[of i] by auto }
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   984
  with disjoint_family_disjointed UN_disjointed_eq[of A] space range'
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   985
  show ?thesis by (auto intro!: exI[of _ "disjointed A"])
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   986
qed
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
   987
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   988
lemma (in sigma_finite_measure) sigma_finite_up:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   989
  "\<exists>F. range F \<subseteq> sets M \<and> F \<up> space M \<and> (\<forall>i. \<mu> (F i) \<noteq> \<omega>)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   990
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   991
  obtain F :: "nat \<Rightarrow> 'a set" where
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   992
    F: "range F \<subseteq> sets M" "(\<Union>i. F i) = space M" "\<And>i. \<mu> (F i) \<noteq> \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   993
    using sigma_finite by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   994
  then show ?thesis unfolding isoton_def
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   995
  proof (intro exI[of _ "\<lambda>n. \<Union>i\<le>n. F i"] conjI allI)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   996
    from F have "\<And>x. x \<in> space M \<Longrightarrow> \<exists>i. x \<in> F i" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   997
    then show "(\<Union>n. \<Union> i\<le>n. F i) = space M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   998
      using F by fastsimp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
   999
  next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1000
    fix n
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1001
    have "\<mu> (\<Union> i\<le>n. F i) \<le> (\<Sum>i\<le>n. \<mu> (F i))" using F
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1002
      by (auto intro!: measure_finitely_subadditive)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1003
    also have "\<dots> < \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1004
      using F by (auto simp: setsum_\<omega>)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1005
    finally show "\<mu> (\<Union> i\<le>n. F i) \<noteq> \<omega>" by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1006
  qed force+
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1007
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1008
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1009
lemma (in sigma_finite_measure) sigma_finite_measure_isomorphic:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1010
  assumes f: "bij_betw f S (space M)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1011
  shows "sigma_finite_measure (vimage_algebra S f) (\<lambda>A. \<mu> (f ` A))"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1012
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1013
  interpret M: measure_space "vimage_algebra S f" "\<lambda>A. \<mu> (f ` A)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1014
    using f by (rule measure_space_isomorphic)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1015
  show ?thesis
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1016
  proof default
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1017
    from sigma_finite guess A::"nat \<Rightarrow> 'a set" .. note A = this
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1018
    show "\<exists>A::nat\<Rightarrow>'b set. range A \<subseteq> sets (vimage_algebra S f) \<and> (\<Union>i. A i) = space (vimage_algebra S f) \<and> (\<forall>i. \<mu> (f ` A i) \<noteq> \<omega>)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1019
    proof (intro exI conjI)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1020
      show "(\<Union>i::nat. f -` A i \<inter> S) = space (vimage_algebra S f)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1021
        using A f[THEN bij_betw_imp_funcset] by (auto simp: vimage_UN[symmetric])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1022
      show "range (\<lambda>i. f -` A i \<inter> S) \<subseteq> sets (vimage_algebra S f)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1023
        using A by (auto simp: vimage_algebra_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1024
      have "\<And>i. f ` (f -` A i \<inter> S) = A i"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1025
        using f A sets_into_space
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1026
        by (intro image_vimage_inter_eq) (auto simp: bij_betw_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1027
      then show "\<forall>i. \<mu> (f ` (f -` A i \<inter> S)) \<noteq> \<omega>"  using A by simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1028
    qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1029
  qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1030
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1031
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1032
section "Real measure values"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1033
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1034
lemma (in measure_space) real_measure_Union:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1035
  assumes finite: "\<mu> A \<noteq> \<omega>" "\<mu> B \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1036
  and measurable: "A \<in> sets M" "B \<in> sets M" "A \<inter> B = {}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1037
  shows "real (\<mu> (A \<union> B)) = real (\<mu> A) + real (\<mu> B)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1038
  unfolding measure_additive[symmetric, OF measurable]
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
  1039
  using finite by (auto simp: real_of_pextreal_add)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1040
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1041
lemma (in measure_space) real_measure_finite_Union:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1042
  assumes measurable:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1043
    "finite S" "\<And>i. i \<in> S \<Longrightarrow> A i \<in> sets M" "disjoint_family_on A S"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1044
  assumes finite: "\<And>i. i \<in> S \<Longrightarrow> \<mu> (A i) \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1045
  shows "real (\<mu> (\<Union>i\<in>S. A i)) = (\<Sum>i\<in>S. real (\<mu> (A i)))"
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
  1046
  using real_of_pextreal_setsum[of S, OF finite]
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1047
        measure_finitely_additive''[symmetric, OF measurable]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1048
  by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1049
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1050
lemma (in measure_space) real_measure_Diff:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1051
  assumes finite: "\<mu> A \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1052
  and measurable: "A \<in> sets M" "B \<in> sets M" "B \<subseteq> A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1053
  shows "real (\<mu> (A - B)) = real (\<mu> A) - real (\<mu> B)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1054
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1055
  have "\<mu> (A - B) \<le> \<mu> A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1056
    "\<mu> B \<le> \<mu> A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1057
    using measurable by (auto intro!: measure_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1058
  hence "real (\<mu> ((A - B) \<union> B)) = real (\<mu> (A - B)) + real (\<mu> B)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1059
    using measurable finite by (rule_tac real_measure_Union) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1060
  thus ?thesis using `B \<subseteq> A` by (auto simp: Un_absorb2)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1061
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1062
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1063
lemma (in measure_space) real_measure_UNION:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1064
  assumes measurable: "range A \<subseteq> sets M" "disjoint_family A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1065
  assumes finite: "\<mu> (\<Union>i. A i) \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1066
  shows "(\<lambda>i. real (\<mu> (A i))) sums (real (\<mu> (\<Union>i. A i)))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1067
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1068
  have *: "(\<Sum>\<^isub>\<infinity> i. \<mu> (A i)) = \<mu> (\<Union>i. A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1069
    using measure_countably_additive[OF measurable] by (simp add: comp_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1070
  hence "(\<Sum>\<^isub>\<infinity> i. \<mu> (A i)) \<noteq> \<omega>" using finite by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1071
  from psuminf_imp_suminf[OF this]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1072
  show ?thesis using * by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1073
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1074
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1075
lemma (in measure_space) real_measure_subadditive:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1076
  assumes measurable: "A \<in> sets M" "B \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1077
  and fin: "\<mu> A \<noteq> \<omega>" "\<mu> B \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1078
  shows "real (\<mu> (A \<union> B)) \<le> real (\<mu> A) + real (\<mu> B)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1079
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1080
  have "real (\<mu> (A \<union> B)) \<le> real (\<mu> A + \<mu> B)"
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
  1081
    using measure_subadditive[OF measurable] fin by (auto intro!: real_of_pextreal_mono)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1082
  also have "\<dots> = real (\<mu> A) + real (\<mu> B)"
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
  1083
    using fin by (simp add: real_of_pextreal_add)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1084
  finally show ?thesis .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1085
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1086
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1087
lemma (in measure_space) real_measure_countably_subadditive:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1088
  assumes "range f \<subseteq> sets M" and "(\<Sum>\<^isub>\<infinity> i. \<mu> (f i)) \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1089
  shows "real (\<mu> (\<Union>i. f i)) \<le> (\<Sum> i. real (\<mu> (f i)))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1090
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1091
  have "real (\<mu> (\<Union>i. f i)) \<le> real (\<Sum>\<^isub>\<infinity> i. \<mu> (f i))"
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
  1092
    using assms by (auto intro!: real_of_pextreal_mono measure_countably_subadditive)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1093
  also have "\<dots> = (\<Sum> i. real (\<mu> (f i)))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1094
    using assms by (auto intro!: sums_unique psuminf_imp_suminf)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1095
  finally show ?thesis .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1096
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1097
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1098
lemma (in measure_space) real_measure_setsum_singleton:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1099
  assumes S: "finite S" "\<And>x. x \<in> S \<Longrightarrow> {x} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1100
  and fin: "\<And>x. x \<in> S \<Longrightarrow> \<mu> {x} \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1101
  shows "real (\<mu> S) = (\<Sum>x\<in>S. real (\<mu> {x}))"
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
  1102
  using measure_finite_singleton[OF S] fin by (simp add: real_of_pextreal_setsum)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1103
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1104
lemma (in measure_space) real_continuity_from_below:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1105
  assumes A: "range A \<subseteq> sets M" "\<And>i. A i \<subseteq> A (Suc i)" and "\<mu> (\<Union>i. A i) \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1106
  shows "(\<lambda>i. real (\<mu> (A i))) ----> real (\<mu> (\<Union>i. A i))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1107
proof (rule SUP_eq_LIMSEQ[THEN iffD1])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1108
  { fix n have "\<mu> (A n) \<le> \<mu> (\<Union>i. A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1109
      using A by (auto intro!: measure_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1110
    hence "\<mu> (A n) \<noteq> \<omega>" using assms by auto }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1111
  note this[simp]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1112
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1113
  show "mono (\<lambda>i. real (\<mu> (A i)))" unfolding mono_iff_le_Suc using A
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
  1114
    by (auto intro!: real_of_pextreal_mono measure_mono)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1115
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1116
  show "(SUP n. Real (real (\<mu> (A n)))) = Real (real (\<mu> (\<Union>i. A i)))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1117
    using continuity_from_below[OF A(1), OF A(2)]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1118
    using assms by (simp add: Real_real)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1119
qed simp_all
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1120
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1121
lemma (in measure_space) real_continuity_from_above:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1122
  assumes A: "range A \<subseteq> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1123
  and mono_Suc: "\<And>n.  A (Suc n) \<subseteq> A n"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1124
  and finite: "\<And>i. \<mu> (A i) \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1125
  shows "(\<lambda>n. real (\<mu> (A n))) ----> real (\<mu> (\<Inter>i. A i))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1126
proof (rule INF_eq_LIMSEQ[THEN iffD1])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1127
  { fix n have "\<mu> (\<Inter>i. A i) \<le> \<mu> (A n)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1128
      using A by (auto intro!: measure_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1129
    hence "\<mu> (\<Inter>i. A i) \<noteq> \<omega>" using assms by auto }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1130
  note this[simp]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1131
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1132
  show "mono (\<lambda>i. - real (\<mu> (A i)))" unfolding mono_iff_le_Suc using assms
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
  1133
    by (auto intro!: real_of_pextreal_mono measure_mono)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1134
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1135
  show "(INF n. Real (real (\<mu> (A n)))) =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1136
    Real (real (\<mu> (\<Inter>i. A i)))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1137
    using continuity_from_above[OF A, OF mono_Suc finite]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1138
    using assms by (simp add: Real_real)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1139
qed simp_all
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1140
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1141
locale finite_measure = measure_space +
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1142
  assumes finite_measure_of_space: "\<mu> (space M) \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1143
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1144
sublocale finite_measure < sigma_finite_measure
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1145
proof
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1146
  show "\<exists>A. range A \<subseteq> sets M \<and> (\<Union>i. A i) = space M \<and> (\<forall>i. \<mu> (A i) \<noteq> \<omega>)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1147
    using finite_measure_of_space by (auto intro!: exI[of _ "\<lambda>x. space M"])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1148
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1149
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1150
lemma (in finite_measure) finite_measure[simp, intro]:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1151
  assumes "A \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1152
  shows "\<mu> A \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1153
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1154
  from `A \<in> sets M` have "A \<subseteq> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1155
    using sets_into_space by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1156
  hence "\<mu> A \<le> \<mu> (space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1157
    using assms top by (rule measure_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1158
  also have "\<dots> < \<omega>"
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
  1159
    using finite_measure_of_space unfolding pextreal_less_\<omega> .
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
  1160
  finally show ?thesis unfolding pextreal_less_\<omega> .
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1161
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1162
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1163
lemma (in finite_measure) restricted_finite_measure:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1164
  assumes "S \<in> sets M"
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1165
  shows "finite_measure (restricted_space S) \<mu>"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1166
    (is "finite_measure ?r _")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1167
  unfolding finite_measure_def finite_measure_axioms_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1168
proof (safe del: notI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1169
  show "measure_space ?r \<mu>" using restricted_measure_space[OF assms] .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1170
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1171
  show "\<mu> (space ?r) \<noteq> \<omega>" using finite_measure[OF `S \<in> sets M`] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1172
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1173
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1174
lemma (in measure_space) restricted_to_finite_measure:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1175
  assumes "S \<in> sets M" "\<mu> S \<noteq> \<omega>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1176
  shows "finite_measure (restricted_space S) \<mu>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1177
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1178
  have "measure_space (restricted_space S) \<mu>"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1179
    using `S \<in> sets M` by (rule restricted_measure_space)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1180
  then show ?thesis
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1181
    unfolding finite_measure_def finite_measure_axioms_def
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1182
    using assms by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1183
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1184
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1185
lemma (in finite_measure) real_finite_measure_Diff:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1186
  assumes "A \<in> sets M" "B \<in> sets M" "B \<subseteq> A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1187
  shows "real (\<mu> (A - B)) = real (\<mu> A) - real (\<mu> B)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1188
  using finite_measure[OF `A \<in> sets M`] by (rule real_measure_Diff[OF _ assms])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1189
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1190
lemma (in finite_measure) real_finite_measure_Union:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1191
  assumes sets: "A \<in> sets M" "B \<in> sets M" and "A \<inter> B = {}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1192
  shows "real (\<mu> (A \<union> B)) = real (\<mu> A) + real (\<mu> B)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1193
  using sets by (auto intro!: real_measure_Union[OF _ _ assms] finite_measure)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1194
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1195
lemma (in finite_measure) real_finite_measure_finite_Union:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1196
  assumes "finite S" and dis: "disjoint_family_on A S"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1197
  and *: "\<And>i. i \<in> S \<Longrightarrow> A i \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1198
  shows "real (\<mu> (\<Union>i\<in>S. A i)) = (\<Sum>i\<in>S. real (\<mu> (A i)))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1199
proof (rule real_measure_finite_Union[OF `finite S` _ dis])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1200
  fix i assume "i \<in> S" from *[OF this] show "A i \<in> sets M" .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1201
  from finite_measure[OF this] show "\<mu> (A i) \<noteq> \<omega>" .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1202
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1203
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1204
lemma (in finite_measure) real_finite_measure_UNION:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1205
  assumes measurable: "range A \<subseteq> sets M" "disjoint_family A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1206
  shows "(\<lambda>i. real (\<mu> (A i))) sums (real (\<mu> (\<Union>i. A i)))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1207
proof (rule real_measure_UNION[OF assms])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1208
  have "(\<Union>i. A i) \<in> sets M" using measurable(1) by (rule countable_UN)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1209
  thus "\<mu> (\<Union>i. A i) \<noteq> \<omega>" by (rule finite_measure)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1210
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1211
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1212
lemma (in finite_measure) real_measure_mono:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1213
  "A \<in> sets M \<Longrightarrow> B \<in> sets M \<Longrightarrow> A \<subseteq> B \<Longrightarrow> real (\<mu> A) \<le> real (\<mu> B)"
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
  1214
  by (auto intro!: measure_mono real_of_pextreal_mono finite_measure)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1215
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1216
lemma (in finite_measure) real_finite_measure_subadditive:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1217
  assumes measurable: "A \<in> sets M" "B \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1218
  shows "real (\<mu> (A \<union> B)) \<le> real (\<mu> A) + real (\<mu> B)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1219
  using measurable measurable[THEN finite_measure] by (rule real_measure_subadditive)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1220
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1221
lemma (in finite_measure) real_finite_measure_countably_subadditive:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1222
  assumes "range f \<subseteq> sets M" and "summable (\<lambda>i. real (\<mu> (f i)))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1223
  shows "real (\<mu> (\<Union>i. f i)) \<le> (\<Sum> i. real (\<mu> (f i)))"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1224
proof (rule real_measure_countably_subadditive[OF assms(1)])
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1225
  have *: "\<And>i. f i \<in> sets M" using assms by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1226
  have "(\<lambda>i. real (\<mu> (f i))) sums (\<Sum>i. real (\<mu> (f i)))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1227
    using assms(2) by (rule summable_sums)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1228
  from suminf_imp_psuminf[OF this]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1229
  have "(\<Sum>\<^isub>\<infinity>i. \<mu> (f i)) = Real (\<Sum>i. real (\<mu> (f i)))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1230
    using * by (simp add: Real_real finite_measure)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1231
  thus "(\<Sum>\<^isub>\<infinity>i. \<mu> (f i)) \<noteq> \<omega>" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1232
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1233
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1234
lemma (in finite_measure) real_finite_measure_finite_singelton:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1235
  assumes "finite S" and *: "\<And>x. x \<in> S \<Longrightarrow> {x} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1236
  shows "real (\<mu> S) = (\<Sum>x\<in>S. real (\<mu> {x}))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1237
proof (rule real_measure_setsum_singleton[OF `finite S`])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1238
  fix x assume "x \<in> S" thus "{x} \<in> sets M" by (rule *)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1239
  with finite_measure show "\<mu> {x} \<noteq> \<omega>" .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1240
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1241
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1242
lemma (in finite_measure) real_finite_continuity_from_below:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1243
  assumes "range A \<subseteq> sets M" "\<And>i. A i \<subseteq> A (Suc i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1244
  shows "(\<lambda>i. real (\<mu> (A i))) ----> real (\<mu> (\<Union>i. A i))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1245
  using real_continuity_from_below[OF assms(1), OF assms(2) finite_measure] assms by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1246
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1247
lemma (in finite_measure) real_finite_continuity_from_above:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1248
  assumes A: "range A \<subseteq> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1249
  and mono_Suc: "\<And>n.  A (Suc n) \<subseteq> A n"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1250
  shows "(\<lambda>n. real (\<mu> (A n))) ----> real (\<mu> (\<Inter>i. A i))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1251
  using real_continuity_from_above[OF A, OF mono_Suc finite_measure] A
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1252
  by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1253
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1254
lemma (in finite_measure) real_finite_measure_finite_Union':
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1255
  assumes "finite S" "A`S \<subseteq> sets M" "disjoint_family_on A S"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1256
  shows "real (\<mu> (\<Union>i\<in>S. A i)) = (\<Sum>i\<in>S. real (\<mu> (A i)))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1257
  using assms real_finite_measure_finite_Union[of S A] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1258
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1259
lemma (in finite_measure) finite_measure_compl:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1260
  assumes s: "s \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1261
  shows "\<mu> (space M - s) = \<mu> (space M) - \<mu> s"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1262
  using measure_compl[OF s, OF finite_measure, OF s] .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1263
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1264
lemma (in finite_measure) finite_measure_inter_full_set:
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1265
  assumes "S \<in> sets M" "T \<in> sets M"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1266
  assumes T: "\<mu> T = \<mu> (space M)"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1267
  shows "\<mu> (S \<inter> T) = \<mu> S"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1268
  using measure_inter_full_set[OF assms(1,2) finite_measure assms(3)] assms
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1269
  by auto
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1270
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1271
section {* Measure preserving *}
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1272
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1273
definition "measure_preserving A \<mu> B \<nu> =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1274
    {f \<in> measurable A B. (\<forall>y \<in> sets B. \<mu> (f -` y \<inter> space A) = \<nu> y)}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1275
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1276
lemma (in finite_measure) measure_preserving_lift:
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1277
  fixes f :: "'a \<Rightarrow> 'a2" and A :: "'a2 algebra"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1278
  assumes "algebra A"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1279
  assumes "finite_measure (sigma A) \<nu>" (is "finite_measure ?sA _")
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1280
  assumes fmp: "f \<in> measure_preserving M \<mu> A \<nu>"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1281
  shows "f \<in> measure_preserving M \<mu> (sigma A) \<nu>"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1282
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1283
  interpret sA: finite_measure ?sA \<nu> by fact
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1284
  interpret A: algebra A by fact
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1285
  show ?thesis using fmp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1286
    proof (clarsimp simp add: measure_preserving_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1287
      assume fm: "f \<in> measurable M A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1288
         and meq: "\<forall>y\<in>sets A. \<mu> (f -` y \<inter> space M) = \<nu> y"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1289
      have f12: "f \<in> measurable M ?sA"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1290
        using measurable_subset[OF A.sets_into_space] fm by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1291
      hence ffn: "f \<in> space M \<rightarrow> space A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1292
        by (simp add: measurable_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1293
      have "space M \<subseteq> f -` (space A)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1294
        by auto (metis PiE ffn)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1295
      hence fveq [simp]: "(f -` (space A)) \<inter> space M = space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1296
        by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1297
      {
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1298
        fix y
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1299
        assume y: "y \<in> sets ?sA"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1300
        have "sets ?sA = sigma_sets (space A) (sets A)" (is "_ = ?A") by (auto simp: sigma_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1301
        also have "\<dots> \<subseteq> {s . \<mu> ((f -` s) \<inter> space M) = \<nu> s}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1302
          proof (rule A.sigma_property_disjoint, auto)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1303
            fix x assume "x \<in> sets A" then show "\<mu> (f -` x \<inter> space M) = \<nu> x" by (simp add: meq)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1304
          next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1305
            fix s
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1306
            assume eq: "\<mu> (f -` s \<inter> space M) = \<nu> s" and s: "s \<in> ?A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1307
            then have s': "s \<in> sets ?sA" by (simp add: sigma_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1308
            show "\<mu> (f -` (space A - s) \<inter> space M) = \<nu> (space A - s)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1309
              using sA.finite_measure_compl[OF s']
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1310
              using measurable_sets[OF f12 s'] meq[THEN bspec, OF A.top]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1311
              by (simp add: vimage_Diff Diff_Int_distrib2 finite_measure_compl eq)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1312
          next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1313
            fix S
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1314
            assume S0: "S 0 = {}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1315
               and SSuc: "\<And>n.  S n \<subseteq> S (Suc n)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1316
               and rS1: "range S \<subseteq> {s. \<mu> (f -` s \<inter> space M) = \<nu> s}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1317
               and "range S \<subseteq> ?A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1318
            hence rS2: "range S \<subseteq> sets ?sA" by (simp add: sigma_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1319
            have eq1: "\<And>i. \<mu> (f -` S i \<inter> space M) = \<nu> (S i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1320
              using rS1 by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1321
            have *: "(\<lambda>n. \<nu> (S n)) = (\<lambda>n. \<mu> (f -` S n \<inter> space M))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1322
              by (simp add: eq1)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1323
            have "(SUP n. ... n) = \<mu> (\<Union>i. f -` S i \<inter> space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1324
              proof (rule measure_countable_increasing)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1325
                show "range (\<lambda>i. f -` S i \<inter> space M) \<subseteq> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1326
                  using f12 rS2 by (auto simp add: measurable_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1327
                show "f -` S 0 \<inter> space M = {}" using S0
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1328
                  by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1329
                show "\<And>n. f -` S n \<inter> space M \<subseteq> f -` S (Suc n) \<inter> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1330
                  using SSuc by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1331
              qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1332
            also have "\<mu> (\<Union>i. f -` S i \<inter> space M) = \<mu> (f -` (\<Union>i. S i) \<inter> space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1333
              by (simp add: vimage_UN)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1334
            finally have "(SUP n. \<nu> (S n)) = \<mu> (f -` (\<Union>i. S i) \<inter> space M)" unfolding * .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1335
            moreover
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1336
            have "(SUP n. \<nu> (S n)) = \<nu> (\<Union>i. S i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1337
              by (rule sA.measure_countable_increasing[OF rS2, OF S0 SSuc])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1338
            ultimately
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1339
            show "\<mu> (f -` (\<Union>i. S i) \<inter> space M) = \<nu> (\<Union>i. S i)" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1340
          next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1341
            fix S :: "nat => 'a2 set"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1342
              assume dS: "disjoint_family S"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1343
                 and rS1: "range S \<subseteq> {s. \<mu> (f -` s \<inter> space M) = \<nu> s}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1344
                 and "range S \<subseteq> ?A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1345
              hence rS2: "range S \<subseteq> sets ?sA" by (simp add: sigma_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1346
              have "\<And>i. \<mu> (f -` S i \<inter> space M) = \<nu> (S i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1347
                using rS1 by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1348
              hence *: "(\<lambda>i. \<nu> (S i)) = (\<lambda>n. \<mu> (f -` S n \<inter> space M))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1349
                by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1350
              have "psuminf ... = \<mu> (\<Union>i. f -` S i \<inter> space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1351
                proof (rule measure_countably_additive)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1352
                  show "range (\<lambda>i. f -` S i \<inter> space M) \<subseteq> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1353
                    using f12 rS2 by (auto simp add: measurable_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1354
                  show "disjoint_family (\<lambda>i. f -` S i \<inter> space M)" using dS
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1355
                    by (auto simp add: disjoint_family_on_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1356
                qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1357
              hence "(\<Sum>\<^isub>\<infinity> i. \<nu> (S i)) = \<mu> (\<Union>i. f -` S i \<inter> space M)" unfolding * .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1358
              with sA.measure_countably_additive [OF rS2 dS]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1359
              have "\<mu> (\<Union>i. f -` S i \<inter> space M) = \<nu> (\<Union>i. S i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1360
                by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1361
              moreover have "\<mu> (f -` (\<Union>i. S i) \<inter> space M) = \<mu> (\<Union>i. f -` S i \<inter> space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1362
                by (simp add: vimage_UN)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1363
              ultimately show "\<mu> (f -` (\<Union>i. S i) \<inter> space M) = \<nu> (\<Union>i. S i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1364
                by metis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1365
          qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1366
        finally have "sets ?sA \<subseteq> {s . \<mu> ((f -` s) \<inter> space M) = \<nu> s}" .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1367
        hence "\<mu> (f -` y \<inter> space M) = \<nu> y" using y by force
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1368
      }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1369
      thus "f \<in> measurable M ?sA \<and> (\<forall>y\<in>sets ?sA. \<mu> (f -` y \<inter> space M) = \<nu> y)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1370
        by (blast intro: f12)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1371
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1372
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1373
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1374
section "Finite spaces"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1375
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1376
locale finite_measure_space = measure_space + finite_sigma_algebra +
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1377
  assumes finite_single_measure[simp]: "\<And>x. x \<in> space M \<Longrightarrow> \<mu> {x} \<noteq> \<omega>"
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1378
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1379
lemma (in finite_measure_space) sum_over_space: "(\<Sum>x\<in>space M. \<mu> {x}) = \<mu> (space M)"
36624
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
  1380
  using measure_finitely_additive''[of "space M" "\<lambda>i. {i}"]
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
  1381
  by (simp add: sets_eq_Pow disjoint_family_on_def finite_space)
25153c08655e Cleanup information theory
hoelzl
parents: 35977
diff changeset
  1382
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1383
lemma finite_measure_spaceI:
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1384
  assumes "finite (space M)" "sets M = Pow(space M)" and space: "\<mu> (space M) \<noteq> \<omega>"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1385
    and add: "\<And>A B. A\<subseteq>space M \<Longrightarrow> B\<subseteq>space M \<Longrightarrow> A \<inter> B = {} \<Longrightarrow> \<mu> (A \<union> B) = \<mu> A + \<mu> B"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1386
    and "\<mu> {} = 0"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1387
  shows "finite_measure_space M \<mu>"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1388
    unfolding finite_measure_space_def finite_measure_space_axioms_def
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1389
proof (intro allI impI conjI)
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1390
  show "measure_space M \<mu>"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1391
  proof (rule sigma_algebra.finite_additivity_sufficient)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1392
    have *: "\<lparr>space = space M, sets = sets M\<rparr> = M" by auto
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1393
    show "sigma_algebra M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1394
      using sigma_algebra_Pow[of "space M" "more M"] assms(2)[symmetric] by (simp add: *)
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1395
    show "finite (space M)" by fact
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1396
    show "positive \<mu>" unfolding positive_def by fact
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1397
    show "additive M \<mu>" unfolding additive_def using assms by simp
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1398
  qed
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1399
  then interpret measure_space M \<mu> .
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1400
  show "finite_sigma_algebra M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1401
  proof
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1402
    show "finite (space M)" by fact
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1403
    show "sets M = Pow (space M)" using assms by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39092
diff changeset
  1404
  qed
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1405
  { fix x assume *: "x \<in> space M"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1406
    with add[of "{x}" "space M - {x}"] space
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1407
    show "\<mu> {x} \<noteq> \<omega>" by (auto simp: insert_absorb[OF *] Diff_subset) }
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1408
qed
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1409
40871
688f6ff859e1 Generalized simple_functionD and less_SUP_iff.
hoelzl
parents: 40859
diff changeset
  1410
sublocale finite_measure_space \<subseteq> finite_measure
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1411
proof
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1412
  show "\<mu> (space M) \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1413
    unfolding sum_over_space[symmetric] setsum_\<omega>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1414
    using finite_space finite_single_measure by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1415
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1416
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1417
lemma finite_measure_space_iff:
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1418
  "finite_measure_space M \<mu> \<longleftrightarrow>
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1419
    finite (space M) \<and> sets M = Pow(space M) \<and> \<mu> (space M) \<noteq> \<omega> \<and> \<mu> {} = 0 \<and>
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1420
    (\<forall>A\<subseteq>space M. \<forall>B\<subseteq>space M. A \<inter> B = {} \<longrightarrow> \<mu> (A \<union> B) = \<mu> A + \<mu> B)"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1421
    (is "_ = ?rhs")
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1422
proof (intro iffI)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1423
  assume "finite_measure_space M \<mu>"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1424
  then interpret finite_measure_space M \<mu> .
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1425
  show ?rhs
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1426
    using finite_space sets_eq_Pow measure_additive empty_measure finite_measure
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1427
    by auto
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1428
next
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1429
  assume ?rhs then show "finite_measure_space M \<mu>"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1430
    by (auto intro!: finite_measure_spaceI)
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1431
qed
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39089
diff changeset
  1432
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1433
lemma psuminf_cmult_indicator:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1434
  assumes "disjoint_family A" "x \<in> A i"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1435
  shows "(\<Sum>\<^isub>\<infinity> n. f n * indicator (A n) x) = f i"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1436
proof -
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
  1437
  have **: "\<And>n. f n * indicator (A n) x = (if n = i then f n else 0 :: pextreal)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1438
    using `x \<in> A i` assms unfolding disjoint_family_on_def indicator_def by auto
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
  1439
  then have "\<And>n. (\<Sum>j<n. f j * indicator (A j) x) = (if i < n then f i else 0 :: pextreal)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1440
    by (auto simp: setsum_cases)
41023
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
  1441
  moreover have "(SUP n. if i < n then f i else 0) = (f i :: pextreal)"
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
  1442
  proof (rule pextreal_SUPI)
9118eb4eb8dc it is known as the extended reals, not the infinite reals
hoelzl
parents: 40871
diff changeset
  1443
    fix y :: pextreal assume "\<And>n. n \<in> UNIV \<Longrightarrow> (if i < n then f i else 0) \<le> y"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1444
    from this[of "Suc i"] show "f i \<le> y" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1445
  qed simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1446
  ultimately show ?thesis using `x \<in> A i` unfolding psuminf_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1447
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1448
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1449
lemma psuminf_indicator:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1450
  assumes "disjoint_family A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1451
  shows "(\<Sum>\<^isub>\<infinity> n. indicator (A n) x) = indicator (\<Union>i. A i) x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1452
proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1453
  assume *: "x \<in> (\<Union>i. A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1454
  then obtain i where "x \<in> A i" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1455
  from psuminf_cmult_indicator[OF assms, OF this, of "\<lambda>i. 1"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1456
  show ?thesis using * by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1457
qed simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1458
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 33657
diff changeset
  1459
end