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