src/HOL/Probability/Measure.thy
author paulson
Wed, 28 Oct 2009 11:42:31 +0000
changeset 33271 7be66dee1a5a
child 33273 9290fbf0a30e
permissions -rw-r--r--
New theory Probability, which contains a development of measure theory
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
     1
header {*Measures*}
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
     2
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
     3
theory Measure
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
     4
  imports Caratheodory FuncSet
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
     5
begin
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
     6
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
     7
text{*From the Hurd/Coble measure theory development, translated by Lawrence Paulson.*}
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
definition prod_sets where
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    10
  "prod_sets A B = {z. \<exists>x \<in> A. \<exists>y \<in> B. z = x \<times> y}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    11
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    12
lemma prod_setsI: "x \<in> A \<Longrightarrow> y \<in> B \<Longrightarrow> (x \<times> y) \<in> prod_sets A B"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    13
  by (auto simp add: prod_sets_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    14
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    15
definition
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    16
  closed_cdi  where
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    17
  "closed_cdi M \<longleftrightarrow>
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    18
   sets M \<subseteq> Pow (space M) &
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    19
   (\<forall>s \<in> sets M. space M - s \<in> sets M) &
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    20
   (\<forall>A. (range A \<subseteq> sets M) & (A 0 = {}) & (\<forall>n. A n \<subseteq> A (Suc n)) \<longrightarrow>
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    21
        (\<Union>i. A i) \<in> sets M) &
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    22
   (\<forall>A. (range A \<subseteq> sets M) & disjoint_family A \<longrightarrow> (\<Union>i::nat. A i) \<in> sets M)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    23
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    24
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    25
inductive_set
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    26
  smallest_ccdi_sets :: "('a, 'b) algebra_scheme \<Rightarrow> 'a set set"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    27
  for M
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    28
  where
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    29
    Basic [intro]: 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    30
      "a \<in> sets M \<Longrightarrow> a \<in> smallest_ccdi_sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    31
  | Compl [intro]:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    32
      "a \<in> smallest_ccdi_sets M \<Longrightarrow> space M - a \<in> smallest_ccdi_sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    33
  | Inc:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    34
      "range A \<in> Pow(smallest_ccdi_sets M) \<Longrightarrow> A 0 = {} \<Longrightarrow> (\<And>n. A n \<subseteq> A (Suc n))
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    35
       \<Longrightarrow> (\<Union>i. A i) \<in> smallest_ccdi_sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    36
  | Disj:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    37
      "range A \<in> Pow(smallest_ccdi_sets M) \<Longrightarrow> disjoint_family A
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    38
       \<Longrightarrow> (\<Union>i::nat. A i) \<in> smallest_ccdi_sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    39
  monos Pow_mono
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    40
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    41
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    42
definition
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    43
  smallest_closed_cdi  where
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    44
  "smallest_closed_cdi M = (|space = space M, sets = smallest_ccdi_sets M|)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    45
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    46
definition
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    47
  measurable  where
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    48
  "measurable a b = {f . sigma_algebra a & sigma_algebra b &
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    49
			 f \<in> (space a -> space b) &
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    50
			 (\<forall>y \<in> sets b. (f -` y) \<inter> (space a) \<in> sets a)}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    51
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    52
definition
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    53
  measure_preserving  where
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    54
  "measure_preserving m1 m2 =
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    55
     measurable m1 m2 \<inter> 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    56
     {f . measure_space m1 & measure_space m2 &
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    57
          (\<forall>y \<in> sets m2. measure m1 ((f -` y) \<inter> (space m1)) = measure m2 y)}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    58
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    59
lemma space_smallest_closed_cdi [simp]:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    60
     "space (smallest_closed_cdi M) = space M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    61
  by (simp add: smallest_closed_cdi_def)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    62
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    63
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    64
lemma (in algebra) smallest_closed_cdi1: "sets M \<subseteq> sets (smallest_closed_cdi M)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    65
  by (auto simp add: smallest_closed_cdi_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    66
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    67
lemma (in algebra) smallest_ccdi_sets:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    68
     "smallest_ccdi_sets M \<subseteq> Pow (space M)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    69
  apply (rule subsetI) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    70
  apply (erule smallest_ccdi_sets.induct) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    71
  apply (auto intro: range_subsetD dest: sets_into_space)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    72
  done
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    73
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    74
lemma (in algebra) smallest_closed_cdi2: "closed_cdi (smallest_closed_cdi M)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    75
  apply (auto simp add: closed_cdi_def smallest_closed_cdi_def smallest_ccdi_sets)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    76
  apply (blast intro: smallest_ccdi_sets.Inc smallest_ccdi_sets.Disj) +
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    77
  done
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    78
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    79
lemma (in algebra) smallest_closed_cdi3:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    80
     "sets (smallest_closed_cdi M) \<subseteq> Pow (space M)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    81
  by (simp add: smallest_closed_cdi_def smallest_ccdi_sets) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    82
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    83
lemma closed_cdi_subset: "closed_cdi M \<Longrightarrow> sets M \<subseteq> Pow (space M)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    84
  by (simp add: closed_cdi_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    85
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    86
lemma closed_cdi_Compl: "closed_cdi M \<Longrightarrow> s \<in> sets M \<Longrightarrow> space M - s \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    87
  by (simp add: closed_cdi_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    88
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    89
lemma closed_cdi_Inc:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    90
     "closed_cdi M \<Longrightarrow> range A \<subseteq> sets M \<Longrightarrow> A 0 = {} \<Longrightarrow> (!!n. A n \<subseteq> A (Suc n)) \<Longrightarrow>
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    91
        (\<Union>i. A i) \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    92
  by (simp add: closed_cdi_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    93
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    94
lemma closed_cdi_Disj:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    95
     "closed_cdi M \<Longrightarrow> range A \<subseteq> sets M \<Longrightarrow> disjoint_family A \<Longrightarrow> (\<Union>i::nat. A i) \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    96
  by (simp add: closed_cdi_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    97
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    98
lemma closed_cdi_Un:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    99
  assumes cdi: "closed_cdi M" and empty: "{} \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   100
      and A: "A \<in> sets M" and B: "B \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   101
      and disj: "A \<inter> B = {}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   102
    shows "A \<union> B \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   103
proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   104
  have ra: "range (binaryset A B) \<subseteq> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   105
   by (simp add: range_binaryset_eq empty A B) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   106
 have di:  "disjoint_family (binaryset A B)" using disj
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   107
   by (simp add: disjoint_family_def binaryset_def Int_commute) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   108
 from closed_cdi_Disj [OF cdi ra di]
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   109
 show ?thesis
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   110
   by (simp add: UN_binaryset_eq) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   111
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   112
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   113
lemma (in algebra) smallest_ccdi_sets_Un:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   114
  assumes A: "A \<in> smallest_ccdi_sets M" and B: "B \<in> smallest_ccdi_sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   115
      and disj: "A \<inter> B = {}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   116
    shows "A \<union> B \<in> smallest_ccdi_sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   117
proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   118
  have ra: "range (binaryset A B) \<in> Pow (smallest_ccdi_sets M)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   119
    by (simp add: range_binaryset_eq  A B empty_sets smallest_ccdi_sets.Basic)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   120
  have di:  "disjoint_family (binaryset A B)" using disj
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   121
    by (simp add: disjoint_family_def binaryset_def Int_commute) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   122
  from Disj [OF ra di]
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   123
  show ?thesis
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   124
    by (simp add: UN_binaryset_eq) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   125
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   126
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   127
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   128
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   129
lemma (in algebra) smallest_ccdi_sets_Int1:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   130
  assumes a: "a \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   131
  shows "b \<in> smallest_ccdi_sets M \<Longrightarrow> a \<inter> b \<in> smallest_ccdi_sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   132
proof (induct rule: smallest_ccdi_sets.induct)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   133
  case (Basic x)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   134
  thus ?case
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   135
    by (metis a Int smallest_ccdi_sets.Basic)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   136
next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   137
  case (Compl x)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   138
  have "a \<inter> (space M - x) = space M - ((space M - a) \<union> (a \<inter> x))"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   139
    by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   140
  also have "... \<in> smallest_ccdi_sets M" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   141
    by (metis smallest_ccdi_sets.Compl a Compl(2) Diff_Int2 Diff_Int_distrib2
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   142
           Diff_disjoint Int_Diff Int_empty_right Un_commute
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   143
           smallest_ccdi_sets.Basic smallest_ccdi_sets.Compl
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   144
           smallest_ccdi_sets_Un) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   145
  finally show ?case .
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   146
next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   147
  case (Inc A)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   148
  have 1: "(\<Union>i. (\<lambda>i. a \<inter> A i) i) = a \<inter> (\<Union>i. A i)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   149
    by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   150
  have "range (\<lambda>i. a \<inter> A i) \<in> Pow(smallest_ccdi_sets M)" using Inc
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   151
    by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   152
  moreover have "(\<lambda>i. a \<inter> A i) 0 = {}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   153
    by (simp add: Inc) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   154
  moreover have "!!n. (\<lambda>i. a \<inter> A i) n \<subseteq> (\<lambda>i. a \<inter> A i) (Suc n)" using Inc
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   155
    by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   156
  ultimately have 2: "(\<Union>i. (\<lambda>i. a \<inter> A i) i) \<in> smallest_ccdi_sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   157
    by (rule smallest_ccdi_sets.Inc) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   158
  show ?case
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   159
    by (metis 1 2)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   160
next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   161
  case (Disj A)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   162
  have 1: "(\<Union>i. (\<lambda>i. a \<inter> A i) i) = a \<inter> (\<Union>i. A i)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   163
    by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   164
  have "range (\<lambda>i. a \<inter> A i) \<in> Pow(smallest_ccdi_sets M)" using Disj
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   165
    by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   166
  moreover have "disjoint_family (\<lambda>i. a \<inter> A i)" using Disj
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   167
    by (auto simp add: disjoint_family_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   168
  ultimately have 2: "(\<Union>i. (\<lambda>i. a \<inter> A i) i) \<in> smallest_ccdi_sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   169
    by (rule smallest_ccdi_sets.Disj) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   170
  show ?case
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   171
    by (metis 1 2)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   172
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   173
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   174
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   175
lemma (in algebra) smallest_ccdi_sets_Int:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   176
  assumes b: "b \<in> smallest_ccdi_sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   177
  shows "a \<in> smallest_ccdi_sets M \<Longrightarrow> a \<inter> b \<in> smallest_ccdi_sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   178
proof (induct rule: smallest_ccdi_sets.induct)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   179
  case (Basic x)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   180
  thus ?case
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   181
    by (metis b smallest_ccdi_sets_Int1)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   182
next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   183
  case (Compl x)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   184
  have "(space M - x) \<inter> b = space M - (x \<inter> b \<union> (space M - b))"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   185
    by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   186
  also have "... \<in> smallest_ccdi_sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   187
    by (metis Compl(2) Diff_disjoint Int_Diff Int_commute Int_empty_right b 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   188
           smallest_ccdi_sets.Compl smallest_ccdi_sets_Un) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   189
  finally show ?case .
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   190
next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   191
  case (Inc A)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   192
  have 1: "(\<Union>i. (\<lambda>i. A i \<inter> b) i) = (\<Union>i. A i) \<inter> b"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   193
    by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   194
  have "range (\<lambda>i. A i \<inter> b) \<in> Pow(smallest_ccdi_sets M)" using Inc
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   195
    by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   196
  moreover have "(\<lambda>i. A i \<inter> b) 0 = {}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   197
    by (simp add: Inc) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   198
  moreover have "!!n. (\<lambda>i. A i \<inter> b) n \<subseteq> (\<lambda>i. A i \<inter> b) (Suc n)" using Inc
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   199
    by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   200
  ultimately have 2: "(\<Union>i. (\<lambda>i. A i \<inter> b) i) \<in> smallest_ccdi_sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   201
    by (rule smallest_ccdi_sets.Inc) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   202
  show ?case
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   203
    by (metis 1 2)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   204
next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   205
  case (Disj A)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   206
  have 1: "(\<Union>i. (\<lambda>i. A i \<inter> b) i) = (\<Union>i. A i) \<inter> b"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   207
    by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   208
  have "range (\<lambda>i. A i \<inter> b) \<in> Pow(smallest_ccdi_sets M)" using Disj
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   209
    by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   210
  moreover have "disjoint_family (\<lambda>i. A i \<inter> b)" using Disj
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   211
    by (auto simp add: disjoint_family_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   212
  ultimately have 2: "(\<Union>i. (\<lambda>i. A i \<inter> b) i) \<in> smallest_ccdi_sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   213
    by (rule smallest_ccdi_sets.Disj) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   214
  show ?case
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   215
    by (metis 1 2)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   216
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   217
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   218
lemma (in algebra) sets_smallest_closed_cdi_Int:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   219
   "a \<in> sets (smallest_closed_cdi M) \<Longrightarrow> b \<in> sets (smallest_closed_cdi M)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   220
    \<Longrightarrow> a \<inter> b \<in> sets (smallest_closed_cdi M)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   221
  by (simp add: smallest_ccdi_sets_Int smallest_closed_cdi_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   222
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   223
lemma algebra_iff_Int:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   224
     "algebra M \<longleftrightarrow> 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   225
       sets M \<subseteq> Pow (space M) & {} \<in> sets M & 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   226
       (\<forall>a \<in> sets M. space M - a \<in> sets M) &
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   227
       (\<forall>a \<in> sets M. \<forall> b \<in> sets M. a \<inter> b \<in> sets M)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   228
proof (auto simp add: algebra.Int, auto simp add: algebra_def)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   229
  fix a b
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   230
  assume ab: "sets M \<subseteq> Pow (space M)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   231
             "\<forall>a\<in>sets M. space M - a \<in> sets M" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   232
             "\<forall>a\<in>sets M. \<forall>b\<in>sets M. a \<inter> b \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   233
             "a \<in> sets M" "b \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   234
  hence "a \<union> b = space M - ((space M - a) \<inter> (space M - b))"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   235
    by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   236
  also have "... \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   237
    by (metis ab)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   238
  finally show "a \<union> b \<in> sets M" .
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   239
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   240
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   241
lemma (in algebra) sigma_property_disjoint_lemma:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   242
  assumes sbC: "sets M \<subseteq> C"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   243
      and ccdi: "closed_cdi (|space = space M, sets = C|)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   244
  shows "sigma_sets (space M) (sets M) \<subseteq> C"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   245
proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   246
  have "smallest_ccdi_sets M \<in> {B . sets M \<subseteq> B \<and> sigma_algebra (|space = space M, sets = B|)}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   247
    apply (auto simp add: sigma_algebra_disjoint_iff algebra_iff_Int 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   248
            smallest_ccdi_sets_Int)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   249
    apply (metis Union_Pow_eq Union_upper subsetD smallest_ccdi_sets) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   250
    apply (blast intro: smallest_ccdi_sets.Disj) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   251
    done
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   252
  hence "sigma_sets (space M) (sets M) \<subseteq> smallest_ccdi_sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   253
    by auto 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   254
       (metis sigma_algebra.sigma_sets_subset algebra.simps(1) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   255
          algebra.simps(2) subsetD) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   256
  also have "...  \<subseteq> C"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   257
    proof
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   258
      fix x
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   259
      assume x: "x \<in> smallest_ccdi_sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   260
      thus "x \<in> C"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   261
	proof (induct rule: smallest_ccdi_sets.induct)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   262
	  case (Basic x)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   263
	  thus ?case
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   264
	    by (metis Basic subsetD sbC)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   265
	next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   266
	  case (Compl x)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   267
	  thus ?case
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   268
	    by (blast intro: closed_cdi_Compl [OF ccdi, simplified])
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   269
 	next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   270
	  case (Inc A)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   271
	  thus ?case
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   272
	       by (auto intro: closed_cdi_Inc [OF ccdi, simplified]) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   273
	next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   274
	  case (Disj A)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   275
	  thus ?case
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   276
	       by (auto intro: closed_cdi_Disj [OF ccdi, simplified]) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   277
	qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   278
    qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   279
  finally show ?thesis .
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
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   282
lemma (in algebra) sigma_property_disjoint:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   283
  assumes sbC: "sets M \<subseteq> C"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   284
      and compl: "!!s. s \<in> C \<inter> sigma_sets (space M) (sets M) \<Longrightarrow> space M - s \<in> C"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   285
      and inc: "!!A. range A \<subseteq> C \<inter> sigma_sets (space M) (sets M) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   286
                     \<Longrightarrow> A 0 = {} \<Longrightarrow> (!!n. A n \<subseteq> A (Suc n)) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   287
                     \<Longrightarrow> (\<Union>i. A i) \<in> C"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   288
      and disj: "!!A. range A \<subseteq> C \<inter> sigma_sets (space M) (sets M) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   289
                      \<Longrightarrow> disjoint_family A \<Longrightarrow> (\<Union>i::nat. A i) \<in> C"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   290
  shows "sigma_sets (space M) (sets M) \<subseteq> C"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   291
proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   292
  have "sigma_sets (space M) (sets M) \<subseteq> C \<inter> sigma_sets (space M) (sets M)" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   293
    proof (rule sigma_property_disjoint_lemma) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   294
      show "sets M \<subseteq> C \<inter> sigma_sets (space M) (sets M)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   295
	by (metis Int_greatest Set.subsetI sbC sigma_sets.Basic)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   296
    next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   297
      show "closed_cdi \<lparr>space = space M, sets = C \<inter> sigma_sets (space M) (sets M)\<rparr>"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   298
	by (simp add: closed_cdi_def compl inc disj)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   299
           (metis PowI Set.subsetI le_infI2 sigma_sets_into_sp space_closed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   300
	     IntE sigma_sets.Compl range_subsetD sigma_sets.Union)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   301
    qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   302
  thus ?thesis
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   303
    by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   304
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   305
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   306
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   307
(* or just countably_additiveD [OF measure_space.ca] *)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   308
lemma (in measure_space) measure_countably_additive:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   309
    "range A \<subseteq> sets M
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   310
     \<Longrightarrow> disjoint_family A \<Longrightarrow> (\<Union>i. A i) \<in> sets M
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   311
     \<Longrightarrow> (measure M o A)  sums  measure M (\<Union>i. A i)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   312
  by (insert ca) (simp add: countably_additive_def o_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   313
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   314
lemma (in measure_space) additive:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   315
     "additive M (measure M)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   316
proof (rule algebra.countably_additive_additive [OF _ _ ca]) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   317
  show "algebra M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   318
    by (blast intro: sigma_algebra.axioms local.sigma_algebra_axioms)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   319
  show "positive M (measure M)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   320
    by (simp add: positive_def empty_measure positive) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   321
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   322
 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   323
lemma (in measure_space) measure_additive:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   324
     "a \<in> sets M \<Longrightarrow> b \<in> sets M \<Longrightarrow> a \<inter> b = {} 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   325
      \<Longrightarrow> measure M a + measure M b = measure M (a \<union> b)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   326
  by (metis additiveD additive)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   327
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   328
lemma (in measure_space) measure_compl:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   329
  assumes s: "s \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   330
  shows "measure M (space M - s) = measure M (space M) - measure M s"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   331
proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   332
  have "measure M (space M) = measure M (s \<union> (space M - s))" using s
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   333
    by (metis Un_Diff_cancel Un_absorb1 s sets_into_space)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   334
  also have "... = measure M s + measure M (space M - s)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   335
    by (rule additiveD [OF additive]) (auto simp add: s) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   336
  finally have "measure M (space M) = measure M s + measure M (space M - s)" .
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   337
  thus ?thesis
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   338
    by arith
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   339
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   340
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   341
lemma disjoint_family_Suc:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   342
  assumes Suc: "!!n. A n \<subseteq> A (Suc n)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   343
  shows "disjoint_family (\<lambda>i. A (Suc i) - A i)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   344
proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   345
  {
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   346
    fix m
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   347
    have "!!n. A n \<subseteq> A (m+n)" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   348
    proof (induct m)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   349
      case 0 show ?case by simp
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   350
    next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   351
      case (Suc m) thus ?case
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   352
	by (metis Suc_eq_plus1 assms nat_add_commute nat_add_left_commute subset_trans)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   353
    qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   354
  }
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   355
  hence "!!m n. m < n \<Longrightarrow> A m \<subseteq> A n"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   356
    by (metis add_commute le_add_diff_inverse nat_less_le)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   357
  thus ?thesis
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   358
    by (auto simp add: disjoint_family_def)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   359
      (metis insert_absorb insert_subset le_SucE le_anti_sym not_leE) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   360
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   361
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   362
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   363
lemma (in measure_space) measure_countable_increasing:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   364
  assumes A: "range A \<subseteq> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   365
      and A0: "A 0 = {}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   366
      and ASuc: "!!n.  A n \<subseteq> A (Suc n)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   367
  shows "(measure M o A) ----> measure M (\<Union>i. A i)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   368
proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   369
  {
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   370
    fix n
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   371
    have "(measure M \<circ> A) n =
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   372
          setsum (measure M \<circ> (\<lambda>i. A (Suc i) - A i)) {0..<n}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   373
      proof (induct n)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   374
	case 0 thus ?case by (auto simp add: A0 empty_measure)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   375
      next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   376
	case (Suc m) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   377
	have "A (Suc m) = A m \<union> (A (Suc m) - A m)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   378
	  by (metis ASuc Un_Diff_cancel Un_absorb1)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   379
	hence "measure M (A (Suc m)) =
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   380
               measure M (A m) + measure M (A (Suc m) - A m)" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   381
	  by (subst measure_additive) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   382
             (auto simp add: measure_additive range_subsetD [OF A]) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   383
	with Suc show ?case
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   384
	  by simp
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   385
      qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   386
  }
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   387
  hence Meq: "measure M o A = (\<lambda>n. setsum (measure M o (\<lambda>i. A(Suc i) - A i)) {0..<n})"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   388
    by (blast intro: ext) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   389
  have Aeq: "(\<Union>i. A (Suc i) - A i) = (\<Union>i. A i)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   390
    proof (rule UN_finite2_eq [where k=1], simp) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   391
      fix i
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   392
      show "(\<Union>i\<in>{0..<i}. A (Suc i) - A i) = (\<Union>i\<in>{0..<Suc i}. A i)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   393
	proof (induct i)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   394
	  case 0 thus ?case by (simp add: A0)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   395
	next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   396
	  case (Suc i) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   397
	  thus ?case
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   398
	    by (auto simp add: atLeastLessThanSuc intro: subsetD [OF ASuc])
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   399
	qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   400
    qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   401
  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
   402
    by (metis A Diff range_subsetD)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   403
  have A2: "(\<Union>i. A (Suc i) - A i) \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   404
    by (blast intro: countable_UN range_subsetD [OF A])  
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   405
  have "(measure M o (\<lambda>i. A (Suc i) - A i)) sums measure M (\<Union>i. A (Suc i) - A i)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   406
    by (rule measure_countably_additive) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   407
       (auto simp add: disjoint_family_Suc ASuc A1 A2)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   408
  also have "... =  measure M (\<Union>i. A i)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   409
    by (simp add: Aeq) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   410
  finally have "(measure M o (\<lambda>i. A (Suc i) - A i)) sums measure M (\<Union>i. A i)" .
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   411
  thus ?thesis
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   412
    by (auto simp add: sums_iff Meq dest: summable_sumr_LIMSEQ_suminf) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   413
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   414
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   415
lemma (in measure_space) monotone_convergence:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   416
  assumes A: "range A \<subseteq> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   417
      and ASuc: "!!n.  A n \<subseteq> A (Suc n)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   418
  shows "(measure M \<circ> A) ----> measure M (\<Union>i. A i)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   419
proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   420
  have ueq: "(\<Union>i. nat_case {} A i) = (\<Union>i. A i)" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   421
    by (auto simp add: split: nat.splits) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   422
  have meq: "measure M \<circ> A = (\<lambda>n. (measure M \<circ> nat_case {} A) (Suc n))"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   423
    by (rule ext) simp
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   424
  have "(measure M \<circ> nat_case {} A) ----> measure M (\<Union>i. nat_case {} A i)" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   425
    by (rule measure_countable_increasing) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   426
       (auto simp add: range_subsetD [OF A] subsetD [OF ASuc] split: nat.splits) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   427
  also have "... = measure M (\<Union>i. A i)" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   428
    by (simp add: ueq) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   429
  finally have "(measure M \<circ> nat_case {} A) ---->  measure M (\<Union>i. A i)" .
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   430
  thus ?thesis using meq
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   431
    by (metis LIMSEQ_Suc)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   432
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   433
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   434
lemma measurable_sigma_preimages:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   435
  assumes a: "sigma_algebra a" and b: "sigma_algebra b"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   436
      and f: "f \<in> space a -> space b"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   437
      and ba: "!!y. y \<in> sets b ==> f -` y \<in> sets a"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   438
  shows "sigma_algebra (|space = space a, sets = (vimage f) ` (sets b) |)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   439
proof (simp add: sigma_algebra_iff2, intro conjI) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   440
  show "op -` f ` sets b \<subseteq> Pow (space a)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   441
    by auto (metis IntE a algebra.Int_space_eq1 ba sigma_algebra_iff vimageI) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   442
next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   443
  show "{} \<in> op -` f ` sets b"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   444
    by (metis algebra.empty_sets b image_iff sigma_algebra_iff vimage_empty)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   445
next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   446
  { fix y
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   447
    assume y: "y \<in> sets b"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   448
    with a b f
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   449
    have "space a - f -` y = f -` (space b - y)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   450
      by (auto simp add: sigma_algebra_iff2) (blast intro: ba) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   451
    hence "space a - (f -` y) \<in> (vimage f) ` sets b"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   452
      by auto
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   453
         (metis b y subsetD equalityE imageI sigma_algebra.sigma_sets_eq
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   454
                sigma_sets.Compl) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   455
  } 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   456
  thus "\<forall>s\<in>sets b. space a - f -` s \<in> (vimage f) ` sets b"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   457
    by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   458
next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   459
  {
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   460
    fix A:: "nat \<Rightarrow> 'a set"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   461
    assume A: "range A \<subseteq> (vimage f) ` (sets b)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   462
    have  "(\<Union>i. A i) \<in> (vimage f) ` (sets b)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   463
      proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   464
	def B \<equiv> "\<lambda>i. @v. v \<in> sets b \<and> f -` v = A i"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   465
	{ 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   466
	  fix i
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   467
	  have "A i \<in> (vimage f) ` (sets b)" using A
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   468
	    by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   469
	  hence "\<exists>v. v \<in> sets b \<and> f -` v = A i"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   470
	    by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   471
	  hence "B i \<in> sets b \<and> f -` B i = A i" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   472
	    by (simp add: B_def) (erule someI_ex)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   473
	} note B = this
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   474
	show ?thesis
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   475
	  proof
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   476
	    show "(\<Union>i. A i) = f -` (\<Union>i. B i)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   477
	      by (simp add: vimage_UN B) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   478
	   show "(\<Union>i. B i) \<in> sets b" using B
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   479
	     by (auto intro: sigma_algebra.countable_UN [OF b]) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   480
	  qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   481
      qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   482
  }
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   483
  thus "\<forall>A::nat \<Rightarrow> 'a set.
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   484
           range A \<subseteq> (vimage f) ` sets b \<longrightarrow> (\<Union>i. A i) \<in> (vimage f) ` sets b"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   485
    by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   486
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   487
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   488
lemma (in sigma_algebra) measurable_sigma:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   489
  assumes B: "B \<subseteq> Pow X" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   490
      and f: "f \<in> space M -> X"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   491
      and ba: "!!y. y \<in> B ==> (f -` y) \<inter> space M \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   492
  shows "f \<in> measurable M (sigma X B)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   493
proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   494
  have "sigma_sets X B \<subseteq> {y . (f -` y) \<inter> space M \<in> sets M & y \<subseteq> X}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   495
    proof clarify
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   496
      fix x
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   497
      assume "x \<in> sigma_sets X B"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   498
      thus "f -` x \<inter> space M \<in> sets M \<and> x \<subseteq> X"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   499
	proof induct
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   500
	  case (Basic a)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   501
	  thus ?case
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   502
	    by (auto simp add: ba) (metis B subsetD PowD) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   503
        next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   504
	  case Empty
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   505
	  thus ?case
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   506
	    by auto
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   507
        next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   508
	  case (Compl a)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   509
	  have [simp]: "f -` X \<inter> space M = space M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   510
	    by (auto simp add: funcset_mem [OF f]) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   511
	  thus ?case
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   512
	    by (auto simp add: vimage_Diff Diff_Int_distrib2 compl_sets Compl)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   513
	next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   514
	  case (Union a)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   515
	  thus ?case
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   516
	    by (simp add: vimage_UN, simp only: UN_extend_simps(4))
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   517
	       (blast intro: countable_UN)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   518
	qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   519
    qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   520
  thus ?thesis
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   521
    by (simp add: measurable_def sigma_algebra_axioms sigma_algebra_sigma B f) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   522
       (auto simp add: sigma_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   523
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   524
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   525
lemma measurable_subset:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   526
     "measurable a b \<subseteq> measurable a (sigma (space b) (sets b))"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   527
  apply clarify
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   528
  apply (rule sigma_algebra.measurable_sigma) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   529
  apply (auto simp add: measurable_def)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   530
  apply (metis algebra.sets_into_space subsetD sigma_algebra_iff) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   531
  done
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   532
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   533
lemma measurable_eqI: 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   534
     "space m1 = space m1' \<Longrightarrow> space m2 = space m2'
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   535
      \<Longrightarrow> sets m1 = sets m1' \<Longrightarrow> sets m2 = sets m2'
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   536
      \<Longrightarrow> measurable m1 m2 = measurable m1' m2'"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   537
  by (simp add: measurable_def sigma_algebra_iff2) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   538
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   539
lemma measure_preserving_lift:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   540
  fixes f :: "'a1 \<Rightarrow> 'a2" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   541
    and m1 :: "('a1, 'b1) measure_space_scheme"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   542
    and m2 :: "('a2, 'b2) measure_space_scheme"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   543
  assumes m1: "measure_space m1" and m2: "measure_space m2" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   544
  defines "m x \<equiv> (|space = space m2, sets = x, measure = measure m2, ... = more m2|)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   545
  assumes setsm2: "sets m2 = sigma_sets (space m2) a"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   546
      and fmp: "f \<in> measure_preserving m1 (m a)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   547
  shows "f \<in> measure_preserving m1 m2"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   548
proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   549
  have [simp]: "!!x. space (m x) = space m2 & sets (m x) = x & measure (m x) = measure m2"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   550
    by (simp add: m_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   551
  have sa1: "sigma_algebra m1" using m1 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   552
    by (simp add: measure_space_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   553
  show ?thesis using fmp
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   554
    proof (clarsimp simp add: measure_preserving_def m1 m2) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   555
      assume fm: "f \<in> measurable m1 (m a)" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   556
	 and mam: "measure_space (m a)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   557
	 and meq: "\<forall>y\<in>a. measure m1 (f -` y \<inter> space m1) = measure m2 y"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   558
      have "f \<in> measurable m1 (sigma (space (m a)) (sets (m a)))"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   559
	by (rule subsetD [OF measurable_subset fm]) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   560
      also have "... = measurable m1 m2"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   561
	by (rule measurable_eqI) (simp_all add: m_def setsm2 sigma_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   562
      finally have f12: "f \<in> measurable m1 m2" .
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   563
      hence ffn: "f \<in> space m1 \<rightarrow> space m2"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   564
	by (simp add: measurable_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   565
      have "space m1 \<subseteq> f -` (space m2)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   566
	by auto (metis PiE ffn)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   567
      hence fveq [simp]: "(f -` (space m2)) \<inter> space m1 = space m1"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   568
	by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   569
      {
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   570
	fix y
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   571
	assume y: "y \<in> sets m2" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   572
	have ama: "algebra (m a)"  using mam
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   573
	  by (simp add: measure_space_def sigma_algebra_iff) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   574
	have spa: "space m2 \<in> a" using algebra.top [OF ama]
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   575
	  by (simp add: m_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   576
	have "sigma_sets (space m2) a = sigma_sets (space (m a)) (sets (m a))"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   577
	  by (simp add: m_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   578
	also have "... \<subseteq> {s . measure m1 ((f -` s) \<inter> space m1) = measure m2 s}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   579
	  proof (rule algebra.sigma_property_disjoint, auto simp add: ama) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   580
	    fix x
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   581
	    assume x: "x \<in> a"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   582
	    thus "measure m1 (f -` x \<inter> space m1) = measure m2 x"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   583
	      by (simp add: meq)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   584
	  next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   585
	    fix s
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   586
	    assume eq: "measure m1 (f -` s \<inter> space m1) = measure m2 s"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   587
	       and s: "s \<in> sigma_sets (space m2) a"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   588
	    hence s2: "s \<in> sets m2"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   589
	      by (simp add: setsm2) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   590
	    thus "measure m1 (f -` (space m2 - s) \<inter> space m1) =
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   591
                  measure m2 (space m2 - s)" using f12
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   592
	      by (simp add: vimage_Diff Diff_Int_distrib2 eq m1 m2
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   593
		    measure_space.measure_compl measurable_def)  
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   594
	         (metis fveq meq spa) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   595
	  next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   596
	    fix A
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   597
	      assume A0: "A 0 = {}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   598
	 	 and ASuc: "!!n.  A n \<subseteq> A (Suc n)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   599
		 and rA1: "range A \<subseteq> 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   600
		           {s. measure m1 (f -` s \<inter> space m1) = measure m2 s}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   601
		 and "range A \<subseteq> sigma_sets (space m2) a"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   602
	      hence rA2: "range A \<subseteq> sets m2" by (metis setsm2)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   603
	      have eq1: "!!i. measure m1 (f -` A i \<inter> space m1) = measure m2 (A i)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   604
		using rA1 by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   605
	      have "(measure m2 \<circ> A) = measure m1 o (\<lambda>i. (f -` A i \<inter> space m1))" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   606
		by (simp add: o_def eq1) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   607
	      also have "... ----> measure m1 (\<Union>i. f -` A i \<inter> space m1)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   608
		proof (rule measure_space.measure_countable_increasing [OF m1])
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   609
		  show "range (\<lambda>i. f -` A i \<inter> space m1) \<subseteq> sets m1"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   610
		    using f12 rA2 by (auto simp add: measurable_def)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   611
		  show "f -` A 0 \<inter> space m1 = {}" using A0
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   612
		    by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   613
		  show "\<And>n. f -` A n \<inter> space m1 \<subseteq> f -` A (Suc n) \<inter> space m1"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   614
		    using ASuc by auto
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   615
		qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   616
	      also have "... = measure m1 (f -` (\<Union>i. A i) \<inter> space m1)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   617
		by (simp add: vimage_UN)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   618
	      finally have "(measure m2 \<circ> A) ----> measure m1 (f -` (\<Union>i. A i) \<inter> space m1)" .
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   619
	      moreover
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   620
	      have "(measure m2 \<circ> A) ----> measure m2 (\<Union>i. A i)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   621
		by (rule measure_space.measure_countable_increasing 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   622
		          [OF m2 rA2, OF A0 ASuc])
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   623
	      ultimately 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   624
	      show "measure m1 (f -` (\<Union>i. A i) \<inter> space m1) =
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   625
                    measure m2 (\<Union>i. A i)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   626
		by (rule LIMSEQ_unique) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   627
	  next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   628
	    fix A :: "nat => 'a2 set"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   629
	      assume dA: "disjoint_family A"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   630
		 and rA1: "range A \<subseteq> 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   631
		           {s. measure m1 (f -` s \<inter> space m1) = measure m2 s}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   632
		 and "range A \<subseteq> sigma_sets (space m2) a"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   633
	      hence rA2: "range A \<subseteq> sets m2" by (metis setsm2)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   634
	      hence Um2: "(\<Union>i. A i) \<in> sets m2"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   635
		by (metis range_subsetD setsm2 sigma_sets.Union)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   636
	      have "!!i. measure m1 (f -` A i \<inter> space m1) = measure m2 (A i)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   637
		using rA1 by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   638
	      hence "measure m2 o A = measure m1 o (\<lambda>i. f -` A i \<inter> space m1)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   639
		by (simp add: o_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   640
	      also have "... sums measure m1 (\<Union>i. f -` A i \<inter> space m1)" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   641
		proof (rule measure_space.measure_countably_additive [OF m1] )
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   642
		  show "range (\<lambda>i. f -` A i \<inter> space m1) \<subseteq> sets m1"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   643
		    using f12 rA2 by (auto simp add: measurable_def)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   644
		  show "disjoint_family (\<lambda>i. f -` A i \<inter> space m1)" using dA
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   645
		    by (auto simp add: disjoint_family_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   646
		  show "(\<Union>i. f -` A i \<inter> space m1) \<in> sets m1"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   647
		    proof (rule sigma_algebra.countable_UN [OF sa1])
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   648
		      show "range (\<lambda>i. f -` A i \<inter> space m1) \<subseteq> sets m1" using f12 rA2
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   649
			by (auto simp add: measurable_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   650
		    qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   651
 		qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   652
	      finally have "(measure m2 o A) sums measure m1 (\<Union>i. f -` A i \<inter> space m1)" .
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   653
	      with measure_space.measure_countably_additive [OF m2 rA2 dA Um2] 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   654
	      have "measure m1 (\<Union>i. f -` A i \<inter> space m1) = measure m2 (\<Union>i. A i)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   655
		by (metis sums_unique) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   656
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   657
	      moreover have "measure m1 (f -` (\<Union>i. A i) \<inter> space m1) = measure m1 (\<Union>i. f -` A i \<inter> space m1)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   658
		by (simp add: vimage_UN)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   659
	      ultimately show "measure m1 (f -` (\<Union>i. A i) \<inter> space m1) =
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   660
                    measure m2 (\<Union>i. A i)" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   661
		by metis
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   662
	  qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   663
	finally have "sigma_sets (space m2) a 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   664
              \<subseteq> {s . measure m1 ((f -` s) \<inter> space m1) = measure m2 s}" .
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   665
	hence "measure m1 (f -` y \<inter> space m1) = measure m2 y" using y
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   666
	  by (force simp add: setsm2) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   667
      }
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   668
      thus "f \<in> measurable m1 m2 \<and>
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   669
       (\<forall>y\<in>sets m2.
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   670
           measure m1 (f -` y \<inter> space m1) = measure m2 y)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   671
	by (blast intro: f12) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   672
    qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   673
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   674
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   675
lemma measurable_ident:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   676
     "sigma_algebra M ==> id \<in> measurable M M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   677
  apply (simp add: measurable_def)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   678
  apply (auto simp add: sigma_algebra_def algebra.Int algebra.top)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   679
  done
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   680
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   681
lemma measurable_comp:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   682
  fixes f :: "'a \<Rightarrow> 'b" and g :: "'b \<Rightarrow> 'c" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   683
  shows "f \<in> measurable a b \<Longrightarrow> g \<in> measurable b c \<Longrightarrow> (g o f) \<in> measurable a c"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   684
  apply (auto simp add: measurable_def vimage_compose) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   685
  apply (subgoal_tac "f -` g -` y \<inter> space a = f -` (g -` y \<inter> space b) \<inter> space a")
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   686
  apply force+
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   687
  done
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   688
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   689
 lemma measurable_strong:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   690
  fixes f :: "'a \<Rightarrow> 'b" and g :: "'b \<Rightarrow> 'c" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   691
  assumes f: "f \<in> measurable a b" and g: "g \<in> (space b -> space c)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   692
      and c: "sigma_algebra c"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   693
      and t: "f ` (space a) \<subseteq> t"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   694
      and cb: "\<And>s. s \<in> sets c \<Longrightarrow> (g -` s) \<inter> t \<in> sets b"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   695
  shows "(g o f) \<in> measurable a c"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   696
proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   697
  have a: "sigma_algebra a" and b: "sigma_algebra b"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   698
   and fab: "f \<in> (space a -> space b)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   699
   and ba: "\<And>y. y \<in> sets b \<Longrightarrow> (f -` y) \<inter> (space a) \<in> sets a" using f
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   700
     by (auto simp add: measurable_def)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   701
  have eq: "f -` g -` y \<inter> space a = f -` (g -` y \<inter> t) \<inter> space a" using t
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   702
    by force
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   703
  show ?thesis
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   704
    apply (auto simp add: measurable_def vimage_compose a c) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   705
    apply (metis funcset_mem fab g) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   706
    apply (subst eq, metis ba cb) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   707
    done
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   708
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   709
 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   710
lemma measurable_mono1:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   711
     "a \<subseteq> b \<Longrightarrow> sigma_algebra \<lparr>space = X, sets = b\<rparr>
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   712
      \<Longrightarrow> measurable \<lparr>space = X, sets = a\<rparr> c \<subseteq> measurable \<lparr>space = X, sets = b\<rparr> c"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   713
  by (auto simp add: measurable_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   714
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   715
lemma measurable_up_sigma:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   716
   "measurable a b \<subseteq> measurable (sigma (space a) (sets a)) b"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   717
  apply (auto simp add: measurable_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   718
  apply (metis sigma_algebra_iff2 sigma_algebra_sigma)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   719
  apply (metis algebra.simps(2) sigma_algebra.sigma_sets_eq sigma_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   720
  done
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   721
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   722
lemma measure_preserving_up:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   723
   "f \<in> measure_preserving \<lparr>space = space m1, sets = a, measure = measure m1\<rparr> m2 \<Longrightarrow>
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   724
    measure_space m1 \<Longrightarrow> sigma_algebra m1 \<Longrightarrow> a \<subseteq> sets m1 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   725
    \<Longrightarrow> f \<in> measure_preserving m1 m2"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   726
  by (auto simp add: measure_preserving_def measurable_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   727
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   728
lemma measure_preserving_up_sigma:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   729
   "measure_space m1 \<Longrightarrow> (sets m1 = sets (sigma (space m1) a))
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   730
    \<Longrightarrow> measure_preserving \<lparr>space = space m1, sets = a, measure = measure m1\<rparr> m2 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   731
        \<subseteq> measure_preserving m1 m2"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   732
  apply (rule subsetI) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   733
  apply (rule measure_preserving_up) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   734
  apply (simp_all add: measure_space_def sigma_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   735
  apply (metis sigma_algebra.sigma_sets_eq subsetI sigma_sets.Basic) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   736
  done
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   737
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   738
lemma (in sigma_algebra) measurable_prod_sigma:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   739
  assumes 1: "(fst o f) \<in> measurable M a1" and 2: "(snd o f) \<in> measurable M a2"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   740
  shows "f \<in> measurable M (sigma ((space a1) \<times> (space a2)) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   741
                          (prod_sets (sets a1) (sets a2)))"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   742
proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   743
  from 1 have sa1: "sigma_algebra a1" and fn1: "fst \<circ> f \<in> space M \<rightarrow> space a1"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   744
     and q1: "\<forall>y\<in>sets a1. (fst \<circ> f) -` y \<inter> space M \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   745
    by (auto simp add: measurable_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   746
  from 2 have sa2: "sigma_algebra a2" and fn2: "snd \<circ> f \<in> space M \<rightarrow> space a2"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   747
     and q2: "\<forall>y\<in>sets a2. (snd \<circ> f) -` y \<inter> space M \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   748
    by (auto simp add: measurable_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   749
  show ?thesis
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   750
    proof (rule measurable_sigma) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   751
      show "prod_sets (sets a1) (sets a2) \<subseteq> Pow (space a1 \<times> space a2)" using sa1 sa2
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   752
        by (force simp add: prod_sets_def sigma_algebra_iff algebra_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   753
    next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   754
      show "f \<in> space M \<rightarrow> space a1 \<times> space a2" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   755
        by (rule prod_final [OF fn1 fn2])
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   756
    next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   757
      fix z
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   758
      assume z: "z \<in> prod_sets (sets a1) (sets a2)" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   759
      thus "f -` z \<inter> space M \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   760
        proof (auto simp add: prod_sets_def vimage_Times) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   761
          fix x y
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   762
          assume x: "x \<in> sets a1" and y: "y \<in> sets a2"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   763
          have "(fst \<circ> f) -` x \<inter> (snd \<circ> f) -` y \<inter> space M = 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   764
                ((fst \<circ> f) -` x \<inter> space M) \<inter> ((snd \<circ> f) -` y \<inter> space M)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   765
            by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   766
          also have "...  \<in> sets M" using x y q1 q2
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   767
            by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   768
          finally show "(fst \<circ> f) -` x \<inter> (snd \<circ> f) -` y \<inter> space M \<in> sets M" .
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   769
        qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   770
    qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   771
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   772
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   773
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   774
lemma (in measure_space) measurable_range_reduce:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   775
   "f \<in> measurable M \<lparr>space = s, sets = Pow s\<rparr> \<Longrightarrow>
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   776
    s \<noteq> {} 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   777
    \<Longrightarrow> f \<in> measurable M \<lparr>space = s \<inter> (f ` space M), sets = Pow (s \<inter> (f ` space M))\<rparr>"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   778
  by (simp add: measurable_def sigma_algebra_Pow del: Pow_Int_eq) blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   779
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   780
lemma (in measure_space) measurable_Pow_to_Pow:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   781
   "(sets M = Pow (space M)) \<Longrightarrow> f \<in> measurable M \<lparr>space = UNIV, sets = Pow UNIV\<rparr>"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   782
  by (auto simp add: measurable_def sigma_algebra_def sigma_algebra_axioms_def algebra_def)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   783
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   784
lemma (in measure_space) measurable_Pow_to_Pow_image:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   785
   "sets M = Pow (space M)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   786
    \<Longrightarrow> f \<in> measurable M \<lparr>space = f ` space M, sets = Pow (f ` space M)\<rparr>"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   787
  by (simp add: measurable_def sigma_algebra_Pow) intro_locales
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   788
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   789
lemma (in measure_space) measure_real_sum_image:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   790
  assumes s: "s \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   791
      and ssets: "\<And>x. x \<in> s ==> {x} \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   792
      and fin: "finite s"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   793
  shows "measure M s = (\<Sum>x\<in>s. measure M {x})"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   794
proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   795
  {
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   796
    fix u
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   797
    assume u: "u \<subseteq> s & u \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   798
    hence "finite u"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   799
      by (metis fin finite_subset) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   800
    hence "measure M u = (\<Sum>x\<in>u. measure M {x})" using u
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   801
      proof (induct u)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   802
        case empty
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   803
        thus ?case by simp
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   804
      next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   805
        case (insert x t)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   806
        hence x: "x \<in> s" and t: "t \<subseteq> s" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   807
          by (simp_all add: insert_subset) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   808
        hence ts: "t \<in> sets M"  using insert
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   809
          by (metis Diff_insert_absorb Diff ssets)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   810
        have "measure M (insert x t) = measure M ({x} \<union> t)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   811
          by simp
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   812
        also have "... = measure M {x} + measure M t" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   813
          by (simp add: measure_additive insert insert_disjoint ssets x ts 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   814
                  del: Un_insert_left)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   815
        also have "... = (\<Sum>x\<in>insert x t. measure M {x})" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   816
          by (simp add: x t ts insert) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   817
        finally show ?case .
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   818
      qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   819
    }
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   820
  thus ?thesis
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   821
    by (metis subset_refl s)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   822
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   823
  
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   824
lemma (in sigma_algebra) sigma_algebra_extend:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   825
     "sigma_algebra \<lparr>space = space M, sets = sets M, measure_space.measure = f\<rparr>"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   826
proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   827
  have 1: "sigma_algebra M \<Longrightarrow> ?thesis"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   828
    by (simp add: sigma_algebra_def algebra_def sigma_algebra_axioms_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   829
  show ?thesis
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   830
    by (rule 1) intro_locales
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   831
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   832
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   833
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   834
lemma (in sigma_algebra) finite_additivity_sufficient:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   835
  assumes fin: "finite (space M)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   836
      and posf: "positive M f" and addf: "additive M f" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   837
  defines "Mf \<equiv> \<lparr>space = space M, sets = sets M, measure = f\<rparr>"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   838
  shows "measure_space Mf" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   839
proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   840
  have [simp]: "f {} = 0" using posf
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   841
    by (simp add: positive_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   842
  have "countably_additive Mf f"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   843
    proof (auto simp add: countably_additive_def positive_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   844
      fix A :: "nat \<Rightarrow> 'a set"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   845
      assume A: "range A \<subseteq> sets Mf"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   846
         and disj: "disjoint_family A"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   847
         and UnA: "(\<Union>i. A i) \<in> sets Mf"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   848
      def I \<equiv> "{i. A i \<noteq> {}}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   849
      have "Union (A ` I) \<subseteq> space M" using A
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   850
        by (auto simp add: Mf_def) (metis range_subsetD subsetD sets_into_space) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   851
      hence "finite (A ` I)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   852
        by (metis finite_UnionD finite_subset fin) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   853
      moreover have "inj_on A I" using disj
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   854
        by (auto simp add: I_def disjoint_family_def inj_on_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   855
      ultimately have finI: "finite I"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   856
        by (metis finite_imageD)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   857
      hence "\<exists>N. \<forall>m\<ge>N. A m = {}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   858
        proof (cases "I = {}")
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   859
          case True thus ?thesis by (simp add: I_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   860
        next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   861
          case False
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   862
          hence "\<forall>i\<in>I. i < Suc(Max I)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   863
            by (simp add: Max_less_iff [symmetric] finI) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   864
          hence "\<forall>m \<ge> Suc(Max I). A m = {}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   865
            by (simp add: I_def) (metis less_le_not_le) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   866
          thus ?thesis
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   867
            by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   868
        qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   869
      then obtain N where N: "\<forall>m\<ge>N. A m = {}" by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   870
      hence "\<forall>m\<ge>N. (f o A) m = 0"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   871
        by simp 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   872
      hence "(\<lambda>n. f (A n)) sums setsum (f o A) {0..<N}" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   873
        by (simp add: series_zero o_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   874
      also have "... = f (\<Union>i<N. A i)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   875
        proof (induct N)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   876
          case 0 thus ?case by simp
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   877
        next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   878
          case (Suc n) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   879
          have "f (A n \<union> (\<Union> x<n. A x)) = f (A n) + f (\<Union> i<n. A i)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   880
            proof (rule Caratheodory.additiveD [OF addf])
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   881
              show "A n \<inter> (\<Union> x<n. A x) = {}" using disj
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   882
                by (auto simp add: disjoint_family_def nat_less_le) blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   883
              show "A n \<in> sets M" using A 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   884
                by (force simp add: Mf_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   885
              show "(\<Union>i<n. A i) \<in> sets M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   886
                proof (induct n)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   887
                  case 0 thus ?case by simp
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   888
                next
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   889
                  case (Suc n) thus ?case using A
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   890
                    by (simp add: lessThan_Suc Mf_def Un range_subsetD) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   891
                qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   892
            qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   893
          thus ?case using Suc
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   894
            by (simp add: lessThan_Suc) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   895
        qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   896
      also have "... = f (\<Union>i. A i)" 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   897
        proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   898
          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
   899
            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
   900
          thus ?thesis by simp
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   901
        qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   902
      finally show "(\<lambda>n. f (A n)) sums f (\<Union>i. A i)" .
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   903
    qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   904
  thus ?thesis using posf 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   905
    by (simp add: Mf_def measure_space_def measure_space_axioms_def sigma_algebra_extend positive_def) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   906
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   907
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   908
lemma finite_additivity_sufficient:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   909
     "sigma_algebra M 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   910
      \<Longrightarrow> finite (space M) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   911
      \<Longrightarrow> positive M (measure M) \<Longrightarrow> additive M (measure M) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   912
      \<Longrightarrow> measure_space M"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   913
  by (rule measure_down [OF sigma_algebra.finite_additivity_sufficient], auto) 
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   914
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   915
end
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   916