src/HOL/Probability/Caratheodory.thy
author paulson
Wed Oct 28 11:42:31 2009 +0000 (2009-10-28)
changeset 33271 7be66dee1a5a
child 33536 fd28b7399f2b
permissions -rw-r--r--
New theory Probability, which contains a development of measure theory
paulson@33271
     1
header {*Caratheodory Extension Theorem*}
paulson@33271
     2
paulson@33271
     3
theory Caratheodory
paulson@33271
     4
  imports Sigma_Algebra SupInf SeriesPlus
paulson@33271
     5
paulson@33271
     6
begin
paulson@33271
     7
paulson@33271
     8
text{*From the Hurd/Coble measure theory development, translated by Lawrence Paulson.*}
paulson@33271
     9
paulson@33271
    10
subsection {* Measure Spaces *}
paulson@33271
    11
paulson@33271
    12
text {*A measure assigns a nonnegative real to every measurable set. 
paulson@33271
    13
       It is countably additive for disjoint sets.*}
paulson@33271
    14
paulson@33271
    15
record 'a measure_space = "'a algebra" +
paulson@33271
    16
  measure:: "'a set \<Rightarrow> real"
paulson@33271
    17
paulson@33271
    18
definition
paulson@33271
    19
  disjoint_family  where
paulson@33271
    20
  "disjoint_family A \<longleftrightarrow> (\<forall>m n. m \<noteq> n \<longrightarrow> A m \<inter> A n = {})"
paulson@33271
    21
paulson@33271
    22
definition
paulson@33271
    23
  positive  where
paulson@33271
    24
  "positive M f \<longleftrightarrow> f {} = (0::real) & (\<forall>x \<in> sets M. 0 \<le> f x)"
paulson@33271
    25
paulson@33271
    26
definition
paulson@33271
    27
  additive  where
paulson@33271
    28
  "additive M f \<longleftrightarrow> 
paulson@33271
    29
    (\<forall>x \<in> sets M. \<forall>y \<in> sets M. x \<inter> y = {} 
paulson@33271
    30
    \<longrightarrow> f (x \<union> y) = f x + f y)"
paulson@33271
    31
paulson@33271
    32
definition
paulson@33271
    33
  countably_additive  where
paulson@33271
    34
  "countably_additive M f \<longleftrightarrow> 
paulson@33271
    35
    (\<forall>A. range A \<subseteq> sets M \<longrightarrow> 
paulson@33271
    36
         disjoint_family A \<longrightarrow>
paulson@33271
    37
         (\<Union>i. A i) \<in> sets M \<longrightarrow> 
paulson@33271
    38
         (\<lambda>n. f (A n))  sums  f (\<Union>i. A i))"
paulson@33271
    39
paulson@33271
    40
definition
paulson@33271
    41
  increasing  where
paulson@33271
    42
  "increasing M f \<longleftrightarrow> (\<forall>x \<in> sets M. \<forall>y \<in> sets M. x \<subseteq> y \<longrightarrow> f x \<le> f y)"
paulson@33271
    43
paulson@33271
    44
definition
paulson@33271
    45
  subadditive  where
paulson@33271
    46
  "subadditive M f \<longleftrightarrow> 
paulson@33271
    47
    (\<forall>x \<in> sets M. \<forall>y \<in> sets M. x \<inter> y = {} 
paulson@33271
    48
    \<longrightarrow> f (x \<union> y) \<le> f x + f y)"
paulson@33271
    49
paulson@33271
    50
definition
paulson@33271
    51
  countably_subadditive  where
paulson@33271
    52
  "countably_subadditive M f \<longleftrightarrow> 
paulson@33271
    53
    (\<forall>A. range A \<subseteq> sets M \<longrightarrow> 
paulson@33271
    54
         disjoint_family A \<longrightarrow>
paulson@33271
    55
         (\<Union>i. A i) \<in> sets M \<longrightarrow> 
paulson@33271
    56
         summable (f o A) \<longrightarrow>
paulson@33271
    57
         f (\<Union>i. A i) \<le> suminf (\<lambda>n. f (A n)))"
paulson@33271
    58
paulson@33271
    59
definition
paulson@33271
    60
  lambda_system where
paulson@33271
    61
  "lambda_system M f = 
paulson@33271
    62
    {l. l \<in> sets M & (\<forall>x \<in> sets M. f (l \<inter> x) + f ((space M - l) \<inter> x) = f x)}"
paulson@33271
    63
paulson@33271
    64
definition
paulson@33271
    65
  outer_measure_space where
paulson@33271
    66
  "outer_measure_space M f  \<longleftrightarrow> 
paulson@33271
    67
     positive M f & increasing M f & countably_subadditive M f"
paulson@33271
    68
paulson@33271
    69
definition
paulson@33271
    70
  measure_set where
paulson@33271
    71
  "measure_set M f X =
paulson@33271
    72
     {r . \<exists>A. range A \<subseteq> sets M & disjoint_family A & X \<subseteq> (\<Union>i. A i) & (f \<circ> A) sums r}"
paulson@33271
    73
paulson@33271
    74
paulson@33271
    75
locale measure_space = sigma_algebra +
paulson@33271
    76
  assumes positive: "!!a. a \<in> sets M \<Longrightarrow> 0 \<le> measure M a"
paulson@33271
    77
      and empty_measure [simp]: "measure M {} = (0::real)"
paulson@33271
    78
      and ca: "countably_additive M (measure M)"
paulson@33271
    79
paulson@33271
    80
subsection {* Basic Lemmas *}
paulson@33271
    81
paulson@33271
    82
lemma positive_imp_0: "positive M f \<Longrightarrow> f {} = 0"
paulson@33271
    83
  by (simp add: positive_def) 
paulson@33271
    84
paulson@33271
    85
lemma positive_imp_pos: "positive M f \<Longrightarrow> x \<in> sets M \<Longrightarrow> 0 \<le> f x"
paulson@33271
    86
  by (simp add: positive_def) 
paulson@33271
    87
paulson@33271
    88
lemma increasingD:
paulson@33271
    89
     "increasing M f \<Longrightarrow> x \<subseteq> y \<Longrightarrow> x\<in>sets M \<Longrightarrow> y\<in>sets M \<Longrightarrow> f x \<le> f y"
paulson@33271
    90
  by (auto simp add: increasing_def)
paulson@33271
    91
paulson@33271
    92
lemma subadditiveD:
paulson@33271
    93
     "subadditive M f \<Longrightarrow> x \<inter> y = {} \<Longrightarrow> x\<in>sets M \<Longrightarrow> y\<in>sets M 
paulson@33271
    94
      \<Longrightarrow> f (x \<union> y) \<le> f x + f y"
paulson@33271
    95
  by (auto simp add: subadditive_def)
paulson@33271
    96
paulson@33271
    97
lemma additiveD:
paulson@33271
    98
     "additive M f \<Longrightarrow> x \<inter> y = {} \<Longrightarrow> x\<in>sets M \<Longrightarrow> y\<in>sets M 
paulson@33271
    99
      \<Longrightarrow> f (x \<union> y) = f x + f y"
paulson@33271
   100
  by (auto simp add: additive_def)
paulson@33271
   101
paulson@33271
   102
lemma countably_additiveD:
paulson@33271
   103
  "countably_additive M f \<Longrightarrow> range A \<subseteq> sets M \<Longrightarrow> disjoint_family A 
paulson@33271
   104
   \<Longrightarrow> (\<Union>i. A i) \<in> sets M \<Longrightarrow> (\<lambda>n. f (A n))  sums  f (\<Union>i. A i)"
paulson@33271
   105
  by (simp add: countably_additive_def) 
paulson@33271
   106
paulson@33271
   107
lemma Int_Diff_disjoint: "A \<inter> B \<inter> (A - B) = {}"
paulson@33271
   108
  by blast
paulson@33271
   109
paulson@33271
   110
lemma Int_Diff_Un: "A \<inter> B \<union> (A - B) = A"
paulson@33271
   111
  by blast
paulson@33271
   112
paulson@33271
   113
lemma disjoint_family_subset:
paulson@33271
   114
     "disjoint_family A \<Longrightarrow> (!!x. B x \<subseteq> A x) \<Longrightarrow> disjoint_family B"
paulson@33271
   115
  by (force simp add: disjoint_family_def) 
paulson@33271
   116
paulson@33271
   117
subsection {* A Two-Element Series *}
paulson@33271
   118
paulson@33271
   119
definition binaryset :: "'a set \<Rightarrow> 'a set \<Rightarrow> nat \<Rightarrow> 'a set "
paulson@33271
   120
  where "binaryset A B = (\<lambda>\<^isup>x. {})(0 := A, Suc 0 := B)"
paulson@33271
   121
paulson@33271
   122
lemma range_binaryset_eq: "range(binaryset A B) = {A,B,{}}"
paulson@33271
   123
  apply (simp add: binaryset_def) 
paulson@33271
   124
  apply (rule set_ext) 
paulson@33271
   125
  apply (auto simp add: image_iff) 
paulson@33271
   126
  done
paulson@33271
   127
paulson@33271
   128
lemma UN_binaryset_eq: "(\<Union>i. binaryset A B i) = A \<union> B"
paulson@33271
   129
  by (simp add: UNION_eq_Union_image range_binaryset_eq) 
paulson@33271
   130
paulson@33271
   131
lemma LIMSEQ_binaryset: 
paulson@33271
   132
  assumes f: "f {} = 0"
paulson@33271
   133
  shows  "(\<lambda>n. \<Sum>i = 0..<n. f (binaryset A B i)) ----> f A + f B"
paulson@33271
   134
proof -
paulson@33271
   135
  have "(\<lambda>n. \<Sum>i = 0..< Suc (Suc n). f (binaryset A B i)) = (\<lambda>n. f A + f B)"
paulson@33271
   136
    proof 
paulson@33271
   137
      fix n
paulson@33271
   138
      show "(\<Sum>i\<Colon>nat = 0\<Colon>nat..<Suc (Suc n). f (binaryset A B i)) = f A + f B"
paulson@33271
   139
	by (induct n)  (auto simp add: binaryset_def f) 
paulson@33271
   140
    qed
paulson@33271
   141
  moreover
paulson@33271
   142
  have "... ----> f A + f B" by (rule LIMSEQ_const) 
paulson@33271
   143
  ultimately
paulson@33271
   144
  have "(\<lambda>n. \<Sum>i = 0..< Suc (Suc n). f (binaryset A B i)) ----> f A + f B" 
paulson@33271
   145
    by metis
paulson@33271
   146
  hence "(\<lambda>n. \<Sum>i = 0..< n+2. f (binaryset A B i)) ----> f A + f B"
paulson@33271
   147
    by simp
paulson@33271
   148
  thus ?thesis by (rule LIMSEQ_offset [where k=2])
paulson@33271
   149
qed
paulson@33271
   150
paulson@33271
   151
lemma binaryset_sums:
paulson@33271
   152
  assumes f: "f {} = 0"
paulson@33271
   153
  shows  "(\<lambda>n. f (binaryset A B n)) sums (f A + f B)"
paulson@33271
   154
    by (simp add: sums_def LIMSEQ_binaryset [where f=f, OF f]) 
paulson@33271
   155
paulson@33271
   156
lemma suminf_binaryset_eq:
paulson@33271
   157
     "f {} = 0 \<Longrightarrow> suminf (\<lambda>n. f (binaryset A B n)) = f A + f B"
paulson@33271
   158
  by (metis binaryset_sums sums_unique)
paulson@33271
   159
paulson@33271
   160
paulson@33271
   161
subsection {* Lambda Systems *}
paulson@33271
   162
paulson@33271
   163
lemma (in algebra) lambda_system_eq:
paulson@33271
   164
    "lambda_system M f = 
paulson@33271
   165
        {l. l \<in> sets M & (\<forall>x \<in> sets M. f (x \<inter> l) + f (x - l) = f x)}"
paulson@33271
   166
proof -
paulson@33271
   167
  have [simp]: "!!l x. l \<in> sets M \<Longrightarrow> x \<in> sets M \<Longrightarrow> (space M - l) \<inter> x = x - l"
paulson@33271
   168
    by (metis Diff_eq Int_Diff Int_absorb1 Int_commute sets_into_space)
paulson@33271
   169
  show ?thesis
paulson@33271
   170
    by (auto simp add: lambda_system_def) (metis Diff_Compl Int_commute)+
paulson@33271
   171
qed
paulson@33271
   172
paulson@33271
   173
lemma (in algebra) lambda_system_empty:
paulson@33271
   174
    "positive M f \<Longrightarrow> {} \<in> lambda_system M f"
paulson@33271
   175
  by (auto simp add: positive_def lambda_system_eq) 
paulson@33271
   176
paulson@33271
   177
lemma lambda_system_sets:
paulson@33271
   178
    "x \<in> lambda_system M f \<Longrightarrow> x \<in> sets M"
paulson@33271
   179
  by (simp add:  lambda_system_def)
paulson@33271
   180
paulson@33271
   181
lemma (in algebra) lambda_system_Compl:
paulson@33271
   182
  fixes f:: "'a set \<Rightarrow> real"
paulson@33271
   183
  assumes x: "x \<in> lambda_system M f"
paulson@33271
   184
  shows "space M - x \<in> lambda_system M f"
paulson@33271
   185
  proof -
paulson@33271
   186
    have "x \<subseteq> space M"
paulson@33271
   187
      by (metis sets_into_space lambda_system_sets x)
paulson@33271
   188
    hence "space M - (space M - x) = x"
paulson@33271
   189
      by (metis double_diff equalityE) 
paulson@33271
   190
    with x show ?thesis
paulson@33271
   191
      by (force simp add: lambda_system_def)
paulson@33271
   192
  qed
paulson@33271
   193
paulson@33271
   194
lemma (in algebra) lambda_system_Int:
paulson@33271
   195
  fixes f:: "'a set \<Rightarrow> real"
paulson@33271
   196
  assumes xl: "x \<in> lambda_system M f" and yl: "y \<in> lambda_system M f"
paulson@33271
   197
  shows "x \<inter> y \<in> lambda_system M f"
paulson@33271
   198
  proof -
paulson@33271
   199
    from xl yl show ?thesis
paulson@33271
   200
      proof (auto simp add: positive_def lambda_system_eq Int)
paulson@33271
   201
	fix u
paulson@33271
   202
	assume x: "x \<in> sets M" and y: "y \<in> sets M" and u: "u \<in> sets M"
paulson@33271
   203
           and fx: "\<forall>z\<in>sets M. f (z \<inter> x) + f (z - x) = f z"
paulson@33271
   204
           and fy: "\<forall>z\<in>sets M. f (z \<inter> y) + f (z - y) = f z"
paulson@33271
   205
	have "u - x \<inter> y \<in> sets M"
paulson@33271
   206
	  by (metis Diff Diff_Int Un u x y)
paulson@33271
   207
	moreover
paulson@33271
   208
	have "(u - (x \<inter> y)) \<inter> y = u \<inter> y - x" by blast
paulson@33271
   209
	moreover
paulson@33271
   210
	have "u - x \<inter> y - y = u - y" by blast
paulson@33271
   211
	ultimately
paulson@33271
   212
	have ey: "f (u - x \<inter> y) = f (u \<inter> y - x) + f (u - y)" using fy
paulson@33271
   213
	  by force
paulson@33271
   214
	have "f (u \<inter> (x \<inter> y)) + f (u - x \<inter> y) 
paulson@33271
   215
              = (f (u \<inter> (x \<inter> y)) + f (u \<inter> y - x)) + f (u - y)"
paulson@33271
   216
	  by (simp add: ey) 
paulson@33271
   217
	also have "... =  (f ((u \<inter> y) \<inter> x) + f (u \<inter> y - x)) + f (u - y)"
paulson@33271
   218
	  by (simp add: Int_ac) 
paulson@33271
   219
	also have "... = f (u \<inter> y) + f (u - y)"
paulson@33271
   220
	  using fx [THEN bspec, of "u \<inter> y"] Int y u
paulson@33271
   221
	  by force
paulson@33271
   222
	also have "... = f u"
paulson@33271
   223
	  by (metis fy u) 
paulson@33271
   224
	finally show "f (u \<inter> (x \<inter> y)) + f (u - x \<inter> y) = f u" .
paulson@33271
   225
      qed
paulson@33271
   226
  qed
paulson@33271
   227
paulson@33271
   228
paulson@33271
   229
lemma (in algebra) lambda_system_Un:
paulson@33271
   230
  fixes f:: "'a set \<Rightarrow> real"
paulson@33271
   231
  assumes xl: "x \<in> lambda_system M f" and yl: "y \<in> lambda_system M f"
paulson@33271
   232
  shows "x \<union> y \<in> lambda_system M f"
paulson@33271
   233
proof -
paulson@33271
   234
  have "(space M - x) \<inter> (space M - y) \<in> sets M"
paulson@33271
   235
    by (metis Diff_Un Un compl_sets lambda_system_sets xl yl) 
paulson@33271
   236
  moreover
paulson@33271
   237
  have "x \<union> y = space M - ((space M - x) \<inter> (space M - y))"
paulson@33271
   238
    by auto  (metis subsetD lambda_system_sets sets_into_space xl yl)+
paulson@33271
   239
  ultimately show ?thesis
paulson@33271
   240
    by (metis lambda_system_Compl lambda_system_Int xl yl) 
paulson@33271
   241
qed
paulson@33271
   242
paulson@33271
   243
lemma (in algebra) lambda_system_algebra:
paulson@33271
   244
    "positive M f \<Longrightarrow> algebra (M (|sets := lambda_system M f|))"
paulson@33271
   245
  apply (auto simp add: algebra_def) 
paulson@33271
   246
  apply (metis lambda_system_sets set_mp sets_into_space)
paulson@33271
   247
  apply (metis lambda_system_empty)
paulson@33271
   248
  apply (metis lambda_system_Compl)
paulson@33271
   249
  apply (metis lambda_system_Un) 
paulson@33271
   250
  done
paulson@33271
   251
paulson@33271
   252
lemma (in algebra) lambda_system_strong_additive:
paulson@33271
   253
  assumes z: "z \<in> sets M" and disj: "x \<inter> y = {}"
paulson@33271
   254
      and xl: "x \<in> lambda_system M f" and yl: "y \<in> lambda_system M f"
paulson@33271
   255
  shows "f (z \<inter> (x \<union> y)) = f (z \<inter> x) + f (z \<inter> y)"
paulson@33271
   256
  proof -
paulson@33271
   257
    have "z \<inter> x = (z \<inter> (x \<union> y)) \<inter> x" using disj by blast
paulson@33271
   258
    moreover
paulson@33271
   259
    have "z \<inter> y = (z \<inter> (x \<union> y)) - x" using disj by blast
paulson@33271
   260
    moreover 
paulson@33271
   261
    have "(z \<inter> (x \<union> y)) \<in> sets M"
paulson@33271
   262
      by (metis Int Un lambda_system_sets xl yl z) 
paulson@33271
   263
    ultimately show ?thesis using xl yl
paulson@33271
   264
      by (simp add: lambda_system_eq)
paulson@33271
   265
  qed
paulson@33271
   266
paulson@33271
   267
lemma (in algebra) Int_space_eq1 [simp]: "x \<in> sets M \<Longrightarrow> space M \<inter> x = x"
paulson@33271
   268
  by (metis Int_absorb1 sets_into_space)
paulson@33271
   269
paulson@33271
   270
lemma (in algebra) Int_space_eq2 [simp]: "x \<in> sets M \<Longrightarrow> x \<inter> space M = x"
paulson@33271
   271
  by (metis Int_absorb2 sets_into_space)
paulson@33271
   272
paulson@33271
   273
lemma (in algebra) lambda_system_additive:
paulson@33271
   274
     "additive (M (|sets := lambda_system M f|)) f"
paulson@33271
   275
  proof (auto simp add: additive_def)
paulson@33271
   276
    fix x and y
paulson@33271
   277
    assume disj: "x \<inter> y = {}"
paulson@33271
   278
       and xl: "x \<in> lambda_system M f" and yl: "y \<in> lambda_system M f"
paulson@33271
   279
    hence  "x \<in> sets M" "y \<in> sets M" by (blast intro: lambda_system_sets)+
paulson@33271
   280
    thus "f (x \<union> y) = f x + f y" 
paulson@33271
   281
      using lambda_system_strong_additive [OF top disj xl yl]
paulson@33271
   282
      by (simp add: Un)
paulson@33271
   283
  qed
paulson@33271
   284
paulson@33271
   285
paulson@33271
   286
lemma (in algebra) countably_subadditive_subadditive:
paulson@33271
   287
  assumes f: "positive M f" and cs: "countably_subadditive M f"
paulson@33271
   288
  shows  "subadditive M f"
paulson@33271
   289
proof (auto simp add: subadditive_def) 
paulson@33271
   290
  fix x y
paulson@33271
   291
  assume x: "x \<in> sets M" and y: "y \<in> sets M" and "x \<inter> y = {}"
paulson@33271
   292
  hence "disjoint_family (binaryset x y)"
paulson@33271
   293
    by (auto simp add: disjoint_family_def binaryset_def) 
paulson@33271
   294
  hence "range (binaryset x y) \<subseteq> sets M \<longrightarrow> 
paulson@33271
   295
         (\<Union>i. binaryset x y i) \<in> sets M \<longrightarrow> 
paulson@33271
   296
         summable (f o (binaryset x y)) \<longrightarrow>
paulson@33271
   297
         f (\<Union>i. binaryset x y i) \<le> suminf (\<lambda>n. f (binaryset x y n))"
paulson@33271
   298
    using cs by (simp add: countably_subadditive_def) 
paulson@33271
   299
  hence "{x,y,{}} \<subseteq> sets M \<longrightarrow> x \<union> y \<in> sets M \<longrightarrow> 
paulson@33271
   300
         summable (f o (binaryset x y)) \<longrightarrow>
paulson@33271
   301
         f (x \<union> y) \<le> suminf (\<lambda>n. f (binaryset x y n))"
paulson@33271
   302
    by (simp add: range_binaryset_eq UN_binaryset_eq)
paulson@33271
   303
  thus "f (x \<union> y) \<le>  f x + f y" using f x y binaryset_sums
paulson@33271
   304
    by (auto simp add: Un sums_iff positive_def o_def) 
paulson@33271
   305
qed 
paulson@33271
   306
paulson@33271
   307
paulson@33271
   308
definition disjointed :: "(nat \<Rightarrow> 'a set) \<Rightarrow> nat \<Rightarrow> 'a set "
paulson@33271
   309
  where "disjointed A n = A n - (\<Union>i\<in>{0..<n}. A i)"
paulson@33271
   310
paulson@33271
   311
lemma finite_UN_disjointed_eq: "(\<Union>i\<in>{0..<n}. disjointed A i) = (\<Union>i\<in>{0..<n}. A i)"
paulson@33271
   312
proof (induct n)
paulson@33271
   313
  case 0 show ?case by simp
paulson@33271
   314
next
paulson@33271
   315
  case (Suc n)
paulson@33271
   316
  thus ?case by (simp add: atLeastLessThanSuc disjointed_def) 
paulson@33271
   317
qed
paulson@33271
   318
paulson@33271
   319
lemma UN_disjointed_eq: "(\<Union>i. disjointed A i) = (\<Union>i. A i)"
paulson@33271
   320
  apply (rule UN_finite2_eq [where k=0]) 
paulson@33271
   321
  apply (simp add: finite_UN_disjointed_eq) 
paulson@33271
   322
  done
paulson@33271
   323
paulson@33271
   324
lemma less_disjoint_disjointed: "m<n \<Longrightarrow> disjointed A m \<inter> disjointed A n = {}"
paulson@33271
   325
  by (auto simp add: disjointed_def)
paulson@33271
   326
paulson@33271
   327
lemma disjoint_family_disjointed: "disjoint_family (disjointed A)"
paulson@33271
   328
  by (simp add: disjoint_family_def) 
paulson@33271
   329
     (metis neq_iff Int_commute less_disjoint_disjointed)
paulson@33271
   330
paulson@33271
   331
lemma disjointed_subset: "disjointed A n \<subseteq> A n"
paulson@33271
   332
  by (auto simp add: disjointed_def)
paulson@33271
   333
paulson@33271
   334
paulson@33271
   335
lemma (in algebra) UNION_in_sets:
paulson@33271
   336
  fixes A:: "nat \<Rightarrow> 'a set"
paulson@33271
   337
  assumes A: "range A \<subseteq> sets M "
paulson@33271
   338
  shows  "(\<Union>i\<in>{0..<n}. A i) \<in> sets M"
paulson@33271
   339
proof (induct n)
paulson@33271
   340
  case 0 show ?case by simp
paulson@33271
   341
next
paulson@33271
   342
  case (Suc n) 
paulson@33271
   343
  thus ?case
paulson@33271
   344
    by (simp add: atLeastLessThanSuc) (metis A Un UNIV_I image_subset_iff)
paulson@33271
   345
qed
paulson@33271
   346
paulson@33271
   347
lemma (in algebra) range_disjointed_sets:
paulson@33271
   348
  assumes A: "range A \<subseteq> sets M "
paulson@33271
   349
  shows  "range (disjointed A) \<subseteq> sets M"
paulson@33271
   350
proof (auto simp add: disjointed_def) 
paulson@33271
   351
  fix n
paulson@33271
   352
  show "A n - (\<Union>i\<in>{0..<n}. A i) \<in> sets M" using UNION_in_sets
paulson@33271
   353
    by (metis A Diff UNIV_I disjointed_def image_subset_iff)
paulson@33271
   354
qed
paulson@33271
   355
paulson@33271
   356
lemma sigma_algebra_disjoint_iff: 
paulson@33271
   357
     "sigma_algebra M \<longleftrightarrow> 
paulson@33271
   358
      algebra M &
paulson@33271
   359
      (\<forall>A. range A \<subseteq> sets M \<longrightarrow> disjoint_family A \<longrightarrow> 
paulson@33271
   360
           (\<Union>i::nat. A i) \<in> sets M)"
paulson@33271
   361
proof (auto simp add: sigma_algebra_iff)
paulson@33271
   362
  fix A :: "nat \<Rightarrow> 'a set"
paulson@33271
   363
  assume M: "algebra M"
paulson@33271
   364
     and A: "range A \<subseteq> sets M"
paulson@33271
   365
     and UnA: "\<forall>A. range A \<subseteq> sets M \<longrightarrow>
paulson@33271
   366
               disjoint_family A \<longrightarrow> (\<Union>i::nat. A i) \<in> sets M"
paulson@33271
   367
  hence "range (disjointed A) \<subseteq> sets M \<longrightarrow>
paulson@33271
   368
         disjoint_family (disjointed A) \<longrightarrow>
paulson@33271
   369
         (\<Union>i. disjointed A i) \<in> sets M" by blast
paulson@33271
   370
  hence "(\<Union>i. disjointed A i) \<in> sets M"
paulson@33271
   371
    by (simp add: algebra.range_disjointed_sets M A disjoint_family_disjointed) 
paulson@33271
   372
  thus "(\<Union>i::nat. A i) \<in> sets M" by (simp add: UN_disjointed_eq)
paulson@33271
   373
qed
paulson@33271
   374
paulson@33271
   375
paulson@33271
   376
lemma (in algebra) additive_sum:
paulson@33271
   377
  fixes A:: "nat \<Rightarrow> 'a set"
paulson@33271
   378
  assumes f: "positive M f" and ad: "additive M f"
paulson@33271
   379
      and A: "range A \<subseteq> sets M"
paulson@33271
   380
      and disj: "disjoint_family A"
paulson@33271
   381
  shows  "setsum (f o A) {0..<n} = f (\<Union>i\<in>{0..<n}. A i)"
paulson@33271
   382
proof (induct n)
paulson@33271
   383
  case 0 show ?case using f by (simp add: positive_def) 
paulson@33271
   384
next
paulson@33271
   385
  case (Suc n) 
paulson@33271
   386
  have "A n \<inter> (\<Union>i\<in>{0..<n}. A i) = {}" using disj 
paulson@33271
   387
    by (auto simp add: disjoint_family_def neq_iff) blast
paulson@33271
   388
  moreover 
paulson@33271
   389
  have "A n \<in> sets M" using A by blast 
paulson@33271
   390
  moreover have "(\<Union>i\<in>{0..<n}. A i) \<in> sets M"
paulson@33271
   391
    by (metis A UNION_in_sets atLeast0LessThan)
paulson@33271
   392
  moreover 
paulson@33271
   393
  ultimately have "f (A n \<union> (\<Union>i\<in>{0..<n}. A i)) = f (A n) + f(\<Union>i\<in>{0..<n}. A i)"
paulson@33271
   394
    using ad UNION_in_sets A by (auto simp add: additive_def) 
paulson@33271
   395
  with Suc.hyps show ?case using ad
paulson@33271
   396
    by (auto simp add: atLeastLessThanSuc additive_def) 
paulson@33271
   397
qed
paulson@33271
   398
paulson@33271
   399
paulson@33271
   400
lemma countably_subadditiveD:
paulson@33271
   401
  "countably_subadditive M f \<Longrightarrow> range A \<subseteq> sets M \<Longrightarrow> disjoint_family A \<Longrightarrow>
paulson@33271
   402
   (\<Union>i. A i) \<in> sets M \<Longrightarrow> summable (f o A) \<Longrightarrow> f (\<Union>i. A i) \<le> suminf (f o A)" 
paulson@33271
   403
  by (auto simp add: countably_subadditive_def o_def)
paulson@33271
   404
paulson@33271
   405
lemma (in algebra) increasing_additive_summable:
paulson@33271
   406
  fixes A:: "nat \<Rightarrow> 'a set"
paulson@33271
   407
  assumes f: "positive M f" and ad: "additive M f"
paulson@33271
   408
      and inc: "increasing M f"
paulson@33271
   409
      and A: "range A \<subseteq> sets M"
paulson@33271
   410
      and disj: "disjoint_family A"
paulson@33271
   411
  shows  "summable (f o A)"
paulson@33271
   412
proof (rule pos_summable) 
paulson@33271
   413
  fix n
paulson@33271
   414
  show "0 \<le> (f \<circ> A) n" using f A
paulson@33271
   415
    by (force simp add: positive_def)
paulson@33271
   416
  next
paulson@33271
   417
  fix n
paulson@33271
   418
  have "setsum (f \<circ> A) {0..<n} = f (\<Union>i\<in>{0..<n}. A i)"
paulson@33271
   419
    by (rule additive_sum [OF f ad A disj]) 
paulson@33271
   420
  also have "... \<le> f (space M)" using space_closed A
paulson@33271
   421
    by (blast intro: increasingD [OF inc] UNION_in_sets top) 
paulson@33271
   422
  finally show "setsum (f \<circ> A) {0..<n} \<le> f (space M)" .
paulson@33271
   423
qed
paulson@33271
   424
paulson@33271
   425
lemma lambda_system_positive:
paulson@33271
   426
     "positive M f \<Longrightarrow> positive (M (|sets := lambda_system M f|)) f"
paulson@33271
   427
  by (simp add: positive_def lambda_system_def) 
paulson@33271
   428
paulson@33271
   429
lemma lambda_system_increasing:
paulson@33271
   430
   "increasing M f \<Longrightarrow> increasing (M (|sets := lambda_system M f|)) f"
paulson@33271
   431
  by (simp add: increasing_def lambda_system_def) 
paulson@33271
   432
paulson@33271
   433
lemma (in algebra) lambda_system_strong_sum:
paulson@33271
   434
  fixes A:: "nat \<Rightarrow> 'a set"
paulson@33271
   435
  assumes f: "positive M f" and a: "a \<in> sets M"
paulson@33271
   436
      and A: "range A \<subseteq> lambda_system M f"
paulson@33271
   437
      and disj: "disjoint_family A"
paulson@33271
   438
  shows  "(\<Sum>i = 0..<n. f (a \<inter>A i)) = f (a \<inter> (\<Union>i\<in>{0..<n}. A i))"
paulson@33271
   439
proof (induct n)
paulson@33271
   440
  case 0 show ?case using f by (simp add: positive_def) 
paulson@33271
   441
next
paulson@33271
   442
  case (Suc n) 
paulson@33271
   443
  have 2: "A n \<inter> UNION {0..<n} A = {}" using disj
paulson@33271
   444
    by (force simp add: disjoint_family_def neq_iff) 
paulson@33271
   445
  have 3: "A n \<in> lambda_system M f" using A
paulson@33271
   446
    by blast
paulson@33271
   447
  have 4: "UNION {0..<n} A \<in> lambda_system M f"
paulson@33271
   448
    using A algebra.UNION_in_sets [OF local.lambda_system_algebra [OF f]] 
paulson@33271
   449
    by simp
paulson@33271
   450
  from Suc.hyps show ?case
paulson@33271
   451
    by (simp add: atLeastLessThanSuc lambda_system_strong_additive [OF a 2 3 4])
paulson@33271
   452
qed
paulson@33271
   453
paulson@33271
   454
paulson@33271
   455
lemma (in sigma_algebra) lambda_system_caratheodory:
paulson@33271
   456
  assumes oms: "outer_measure_space M f"
paulson@33271
   457
      and A: "range A \<subseteq> lambda_system M f"
paulson@33271
   458
      and disj: "disjoint_family A"
paulson@33271
   459
  shows  "(\<Union>i. A i) \<in> lambda_system M f & (f \<circ> A)  sums  f (\<Union>i. A i)"
paulson@33271
   460
proof -
paulson@33271
   461
  have pos: "positive M f" and inc: "increasing M f" 
paulson@33271
   462
   and csa: "countably_subadditive M f" 
paulson@33271
   463
    by (metis oms outer_measure_space_def)+
paulson@33271
   464
  have sa: "subadditive M f"
paulson@33271
   465
    by (metis countably_subadditive_subadditive csa pos) 
paulson@33271
   466
  have A': "range A \<subseteq> sets (M(|sets := lambda_system M f|))" using A 
paulson@33271
   467
    by simp
paulson@33271
   468
  have alg_ls: "algebra (M(|sets := lambda_system M f|))"
paulson@33271
   469
    by (rule lambda_system_algebra [OF pos]) 
paulson@33271
   470
  have A'': "range A \<subseteq> sets M"
paulson@33271
   471
     by (metis A image_subset_iff lambda_system_sets)
paulson@33271
   472
  have sumfA: "summable (f \<circ> A)" 
paulson@33271
   473
    by (metis algebra.increasing_additive_summable [OF alg_ls]
paulson@33271
   474
          lambda_system_positive lambda_system_additive lambda_system_increasing
paulson@33271
   475
          A' oms outer_measure_space_def disj)
paulson@33271
   476
  have U_in: "(\<Union>i. A i) \<in> sets M"
paulson@33271
   477
    by (metis A countable_UN image_subset_iff lambda_system_sets)
paulson@33271
   478
  have U_eq: "f (\<Union>i. A i) = suminf (f o A)" 
paulson@33271
   479
    proof (rule antisym)
paulson@33271
   480
      show "f (\<Union>i. A i) \<le> suminf (f \<circ> A)"
paulson@33271
   481
	by (rule countably_subadditiveD [OF csa A'' disj U_in sumfA]) 
paulson@33271
   482
      show "suminf (f \<circ> A) \<le> f (\<Union>i. A i)"
paulson@33271
   483
	by (rule suminf_le [OF sumfA]) 
paulson@33271
   484
           (metis algebra.additive_sum [OF alg_ls] pos disj UN_Un Un_UNIV_right
paulson@33271
   485
	          lambda_system_positive lambda_system_additive 
paulson@33271
   486
                  subset_Un_eq increasingD [OF inc] A' A'' UNION_in_sets U_in) 
paulson@33271
   487
    qed
paulson@33271
   488
  {
paulson@33271
   489
    fix a 
paulson@33271
   490
    assume a [iff]: "a \<in> sets M" 
paulson@33271
   491
    have "f (a \<inter> (\<Union>i. A i)) + f (a - (\<Union>i. A i)) = f a"
paulson@33271
   492
    proof -
paulson@33271
   493
      have summ: "summable (f \<circ> (\<lambda>i. a \<inter> i) \<circ> A)" using pos A'' 
paulson@33271
   494
	apply -
paulson@33271
   495
	apply (rule summable_comparison_test [OF _ sumfA]) 
paulson@33271
   496
	apply (rule_tac x="0" in exI) 
paulson@33271
   497
	apply (simp add: positive_def) 
paulson@33271
   498
	apply (auto simp add: )
paulson@33271
   499
	apply (subst abs_of_nonneg)
paulson@33271
   500
	apply (metis A'' Int UNIV_I a image_subset_iff)
paulson@33271
   501
	apply (blast intro:  increasingD [OF inc] a)   
paulson@33271
   502
	done
paulson@33271
   503
      show ?thesis
paulson@33271
   504
      proof (rule antisym)
paulson@33271
   505
	have "range (\<lambda>i. a \<inter> A i) \<subseteq> sets M" using A''
paulson@33271
   506
	  by blast
paulson@33271
   507
	moreover 
paulson@33271
   508
	have "disjoint_family (\<lambda>i. a \<inter> A i)" using disj
paulson@33271
   509
	  by (auto simp add: disjoint_family_def) 
paulson@33271
   510
	moreover 
paulson@33271
   511
	have "a \<inter> (\<Union>i. A i) \<in> sets M"
paulson@33271
   512
	  by (metis Int U_in a)
paulson@33271
   513
	ultimately 
paulson@33271
   514
	have "f (a \<inter> (\<Union>i. A i)) \<le> suminf (f \<circ> (\<lambda>i. a \<inter> i) \<circ> A)"
paulson@33271
   515
	  using countably_subadditiveD [OF csa, of "(\<lambda>i. a \<inter> A i)"] summ
paulson@33271
   516
	  by (simp add: o_def) 
paulson@33271
   517
	moreover 
paulson@33271
   518
	have "suminf (f \<circ> (\<lambda>i. a \<inter> i) \<circ> A)  \<le> f a - f (a - (\<Union>i. A i))"
paulson@33271
   519
	  proof (rule suminf_le [OF summ])
paulson@33271
   520
	    fix n
paulson@33271
   521
	    have UNION_in: "(\<Union>i\<in>{0..<n}. A i) \<in> sets M"
paulson@33271
   522
	      by (metis A'' UNION_in_sets) 
paulson@33271
   523
	    have le_fa: "f (UNION {0..<n} A \<inter> a) \<le> f a" using A''
paulson@33271
   524
	      by (blast intro: increasingD [OF inc] A'' Int UNION_in_sets a) 
paulson@33271
   525
	    have ls: "(\<Union>i\<in>{0..<n}. A i) \<in> lambda_system M f"
paulson@33271
   526
	      using algebra.UNION_in_sets [OF lambda_system_algebra [OF pos]]
paulson@33271
   527
	      by (simp add: A) 
paulson@33271
   528
	    hence eq_fa: "f (a \<inter> (\<Union>i\<in>{0..<n}. A i)) + f (a - (\<Union>i\<in>{0..<n}. A i)) = f a"
paulson@33271
   529
	      by (simp add: lambda_system_eq UNION_in Diff_Compl a)
paulson@33271
   530
	    have "f (a - (\<Union>i. A i)) \<le> f (a - (\<Union>i\<in>{0..<n}. A i))"
paulson@33271
   531
	      by (blast intro: increasingD [OF inc] Diff UNION_eq_Union_image 
paulson@33271
   532
                               UNION_in U_in a) 
paulson@33271
   533
	    thus "setsum (f \<circ> (\<lambda>i. a \<inter> i) \<circ> A) {0..<n} \<le> f a - f (a - (\<Union>i. A i))"
paulson@33271
   534
	      using eq_fa
paulson@33271
   535
	      by (simp add: suminf_le [OF summ] lambda_system_strong_sum pos 
paulson@33271
   536
                            a A disj)
paulson@33271
   537
	  qed
paulson@33271
   538
	ultimately show "f (a \<inter> (\<Union>i. A i)) + f (a - (\<Union>i. A i)) \<le> f a" 
paulson@33271
   539
	  by arith
paulson@33271
   540
      next
paulson@33271
   541
	have "f a \<le> f (a \<inter> (\<Union>i. A i) \<union> (a - (\<Union>i. A i)))" 
paulson@33271
   542
	  by (blast intro:  increasingD [OF inc] a U_in)
paulson@33271
   543
	also have "... \<le>  f (a \<inter> (\<Union>i. A i)) + f (a - (\<Union>i. A i))"
paulson@33271
   544
	  by (blast intro: subadditiveD [OF sa] Int Diff U_in) 
paulson@33271
   545
	finally show "f a \<le> f (a \<inter> (\<Union>i. A i)) + f (a - (\<Union>i. A i))" .
paulson@33271
   546
        qed
paulson@33271
   547
     qed
paulson@33271
   548
  }
paulson@33271
   549
  thus  ?thesis
paulson@33271
   550
    by (simp add: lambda_system_eq sums_iff U_eq U_in sumfA)
paulson@33271
   551
qed
paulson@33271
   552
paulson@33271
   553
lemma (in sigma_algebra) caratheodory_lemma:
paulson@33271
   554
  assumes oms: "outer_measure_space M f"
paulson@33271
   555
  shows "measure_space (|space = space M, sets = lambda_system M f, measure = f|)"
paulson@33271
   556
proof -
paulson@33271
   557
  have pos: "positive M f" 
paulson@33271
   558
    by (metis oms outer_measure_space_def)
paulson@33271
   559
  have alg: "algebra (|space = space M, sets = lambda_system M f, measure = f|)"
paulson@33271
   560
    using lambda_system_algebra [OF pos]
paulson@33271
   561
    by (simp add: algebra_def) 
paulson@33271
   562
  then moreover 
paulson@33271
   563
  have "sigma_algebra (|space = space M, sets = lambda_system M f, measure = f|)"
paulson@33271
   564
    using lambda_system_caratheodory [OF oms]
paulson@33271
   565
    by (simp add: sigma_algebra_disjoint_iff) 
paulson@33271
   566
  moreover 
paulson@33271
   567
  have "measure_space_axioms (|space = space M, sets = lambda_system M f, measure = f|)" 
paulson@33271
   568
    using pos lambda_system_caratheodory [OF oms]
paulson@33271
   569
    by (simp add: measure_space_axioms_def positive_def lambda_system_sets 
paulson@33271
   570
                  countably_additive_def o_def) 
paulson@33271
   571
  ultimately 
paulson@33271
   572
  show ?thesis
paulson@33271
   573
    by intro_locales (auto simp add: sigma_algebra_def) 
paulson@33271
   574
qed
paulson@33271
   575
paulson@33271
   576
paulson@33271
   577
lemma (in algebra) inf_measure_nonempty:
paulson@33271
   578
  assumes f: "positive M f" and b: "b \<in> sets M" and a: "a \<subseteq> b"
paulson@33271
   579
  shows "f b \<in> measure_set M f a"
paulson@33271
   580
proof -
paulson@33271
   581
  have "(f \<circ> (\<lambda>i. {})(0 := b)) sums setsum (f \<circ> (\<lambda>i. {})(0 := b)) {0..<1::nat}"
paulson@33271
   582
    by (rule series_zero)  (simp add: positive_imp_0 [OF f]) 
paulson@33271
   583
  also have "... = f b" 
paulson@33271
   584
    by simp
paulson@33271
   585
  finally have "(f \<circ> (\<lambda>i. {})(0 := b)) sums f b" .
paulson@33271
   586
  thus ?thesis using a
paulson@33271
   587
    by (auto intro!: exI [of _ "(\<lambda>i. {})(0 := b)"] 
paulson@33271
   588
             simp add: measure_set_def disjoint_family_def b split_if_mem2) 
paulson@33271
   589
qed  
paulson@33271
   590
paulson@33271
   591
lemma (in algebra) inf_measure_pos0:
paulson@33271
   592
     "positive M f \<Longrightarrow> x \<in> measure_set M f a \<Longrightarrow> 0 \<le> x"
paulson@33271
   593
apply (auto simp add: positive_def measure_set_def sums_iff intro!: suminf_ge_zero)
paulson@33271
   594
apply blast
paulson@33271
   595
done
paulson@33271
   596
paulson@33271
   597
lemma (in algebra) inf_measure_pos:
paulson@33271
   598
  shows "positive M f \<Longrightarrow> x \<subseteq> space M \<Longrightarrow> 0 \<le> Inf (measure_set M f x)"
paulson@33271
   599
apply (rule Inf_greatest)
paulson@33271
   600
apply (metis emptyE inf_measure_nonempty top)
paulson@33271
   601
apply (metis inf_measure_pos0) 
paulson@33271
   602
done
paulson@33271
   603
paulson@33271
   604
lemma (in algebra) additive_increasing:
paulson@33271
   605
  assumes posf: "positive M f" and addf: "additive M f" 
paulson@33271
   606
  shows "increasing M f"
paulson@33271
   607
proof (auto simp add: increasing_def) 
paulson@33271
   608
  fix x y
paulson@33271
   609
  assume xy: "x \<in> sets M" "y \<in> sets M" "x \<subseteq> y"
paulson@33271
   610
  have "f x \<le> f x + f (y-x)" using posf
paulson@33271
   611
    by (simp add: positive_def) (metis Diff xy)
paulson@33271
   612
  also have "... = f (x \<union> (y-x))" using addf
paulson@33271
   613
    by (auto simp add: additive_def) (metis Diff_disjoint Un_Diff_cancel Diff xy) 
paulson@33271
   614
  also have "... = f y"
paulson@33271
   615
    by (metis Un_Diff_cancel Un_absorb1 xy)
paulson@33271
   616
  finally show "f x \<le> f y" .
paulson@33271
   617
qed
paulson@33271
   618
paulson@33271
   619
lemma (in algebra) countably_additive_additive:
paulson@33271
   620
  assumes posf: "positive M f" and ca: "countably_additive M f" 
paulson@33271
   621
  shows "additive M f"
paulson@33271
   622
proof (auto simp add: additive_def) 
paulson@33271
   623
  fix x y
paulson@33271
   624
  assume x: "x \<in> sets M" and y: "y \<in> sets M" and "x \<inter> y = {}"
paulson@33271
   625
  hence "disjoint_family (binaryset x y)"
paulson@33271
   626
    by (auto simp add: disjoint_family_def binaryset_def) 
paulson@33271
   627
  hence "range (binaryset x y) \<subseteq> sets M \<longrightarrow> 
paulson@33271
   628
         (\<Union>i. binaryset x y i) \<in> sets M \<longrightarrow> 
paulson@33271
   629
         f (\<Union>i. binaryset x y i) = suminf (\<lambda>n. f (binaryset x y n))"
paulson@33271
   630
    using ca
paulson@33271
   631
    by (simp add: countably_additive_def) (metis UN_binaryset_eq sums_unique) 
paulson@33271
   632
  hence "{x,y,{}} \<subseteq> sets M \<longrightarrow> x \<union> y \<in> sets M \<longrightarrow> 
paulson@33271
   633
         f (x \<union> y) = suminf (\<lambda>n. f (binaryset x y n))"
paulson@33271
   634
    by (simp add: range_binaryset_eq UN_binaryset_eq)
paulson@33271
   635
  thus "f (x \<union> y) = f x + f y" using posf x y
paulson@33271
   636
    by (simp add: Un suminf_binaryset_eq positive_def)
paulson@33271
   637
qed 
paulson@33271
   638
 
paulson@33271
   639
lemma (in algebra) inf_measure_agrees:
paulson@33271
   640
  assumes posf: "positive M f" and ca: "countably_additive M f" 
paulson@33271
   641
      and s: "s \<in> sets M"  
paulson@33271
   642
  shows "Inf (measure_set M f s) = f s"
paulson@33271
   643
proof (rule Inf_eq) 
paulson@33271
   644
  fix z
paulson@33271
   645
  assume z: "z \<in> measure_set M f s"
paulson@33271
   646
  from this obtain A where 
paulson@33271
   647
    A: "range A \<subseteq> sets M" and disj: "disjoint_family A"
paulson@33271
   648
    and "s \<subseteq> (\<Union>x. A x)" and sm: "summable (f \<circ> A)"
paulson@33271
   649
    and si: "suminf (f \<circ> A) = z"
paulson@33271
   650
    by (auto simp add: measure_set_def sums_iff) 
paulson@33271
   651
  hence seq: "s = (\<Union>i. A i \<inter> s)" by blast
paulson@33271
   652
  have inc: "increasing M f"
paulson@33271
   653
    by (metis additive_increasing ca countably_additive_additive posf)
paulson@33271
   654
  have sums: "(\<lambda>i. f (A i \<inter> s)) sums f (\<Union>i. A i \<inter> s)"
paulson@33271
   655
    proof (rule countably_additiveD [OF ca]) 
paulson@33271
   656
      show "range (\<lambda>n. A n \<inter> s) \<subseteq> sets M" using A s
paulson@33271
   657
	by blast
paulson@33271
   658
      show "disjoint_family (\<lambda>n. A n \<inter> s)" using disj
paulson@33271
   659
	by (auto simp add: disjoint_family_def)
paulson@33271
   660
      show "(\<Union>i. A i \<inter> s) \<in> sets M" using A s
paulson@33271
   661
	by (metis UN_extend_simps(4) s seq)
paulson@33271
   662
    qed
paulson@33271
   663
  hence "f s = suminf (\<lambda>i. f (A i \<inter> s))"
paulson@33271
   664
    by (metis Int_commute UN_simps(4) seq sums_iff) 
paulson@33271
   665
  also have "... \<le> suminf (f \<circ> A)" 
paulson@33271
   666
    proof (rule summable_le [OF _ _ sm]) 
paulson@33271
   667
      show "\<forall>n. f (A n \<inter> s) \<le> (f \<circ> A) n" using A s
paulson@33271
   668
	by (force intro: increasingD [OF inc]) 
paulson@33271
   669
      show "summable (\<lambda>i. f (A i \<inter> s))" using sums
paulson@33271
   670
	by (simp add: sums_iff) 
paulson@33271
   671
    qed
paulson@33271
   672
  also have "... = z" by (rule si) 
paulson@33271
   673
  finally show "f s \<le> z" .
paulson@33271
   674
next
paulson@33271
   675
  fix y
paulson@33271
   676
  assume y: "!!u. u \<in> measure_set M f s \<Longrightarrow> y \<le> u"
paulson@33271
   677
  thus "y \<le> f s"
paulson@33271
   678
    by (blast intro: inf_measure_nonempty [OF posf s subset_refl])
paulson@33271
   679
qed
paulson@33271
   680
paulson@33271
   681
lemma (in algebra) inf_measure_empty:
paulson@33271
   682
  assumes posf: "positive M f"
paulson@33271
   683
  shows "Inf (measure_set M f {}) = 0"
paulson@33271
   684
proof (rule antisym)
paulson@33271
   685
  show "0 \<le> Inf (measure_set M f {})"
paulson@33271
   686
    by (metis empty_subsetI inf_measure_pos posf) 
paulson@33271
   687
  show "Inf (measure_set M f {}) \<le> 0"
paulson@33271
   688
    by (metis Inf_lower empty_sets inf_measure_pos0 inf_measure_nonempty posf
paulson@33271
   689
              positive_imp_0 subset_refl) 
paulson@33271
   690
qed
paulson@33271
   691
paulson@33271
   692
lemma (in algebra) inf_measure_positive:
paulson@33271
   693
  "positive M f \<Longrightarrow> 
paulson@33271
   694
   positive (| space = space M, sets = Pow (space M) |)
paulson@33271
   695
                  (\<lambda>x. Inf (measure_set M f x))"
paulson@33271
   696
  by (simp add: positive_def inf_measure_empty inf_measure_pos) 
paulson@33271
   697
paulson@33271
   698
lemma (in algebra) inf_measure_increasing:
paulson@33271
   699
  assumes posf: "positive M f"
paulson@33271
   700
  shows "increasing (| space = space M, sets = Pow (space M) |)
paulson@33271
   701
                    (\<lambda>x. Inf (measure_set M f x))"
paulson@33271
   702
apply (auto simp add: increasing_def) 
paulson@33271
   703
apply (rule Inf_greatest, metis emptyE inf_measure_nonempty top posf)
paulson@33271
   704
apply (rule Inf_lower) 
paulson@33271
   705
apply (clarsimp simp add: measure_set_def, blast) 
paulson@33271
   706
apply (blast intro: inf_measure_pos0 posf)
paulson@33271
   707
done
paulson@33271
   708
paulson@33271
   709
paulson@33271
   710
lemma (in algebra) inf_measure_le:
paulson@33271
   711
  assumes posf: "positive M f" and inc: "increasing M f" 
paulson@33271
   712
      and x: "x \<in> {r . \<exists>A. range A \<subseteq> sets M & s \<subseteq> (\<Union>i. A i) & (f \<circ> A) sums r}"
paulson@33271
   713
  shows "Inf (measure_set M f s) \<le> x"
paulson@33271
   714
proof -
paulson@33271
   715
  from x
paulson@33271
   716
  obtain A where A: "range A \<subseteq> sets M" and ss: "s \<subseteq> (\<Union>i. A i)" 
paulson@33271
   717
             and sm: "summable (f \<circ> A)" and xeq: "suminf (f \<circ> A) = x"
paulson@33271
   718
    by (auto simp add: sums_iff)
paulson@33271
   719
  have dA: "range (disjointed A) \<subseteq> sets M"
paulson@33271
   720
    by (metis A range_disjointed_sets)
paulson@33271
   721
  have "\<forall>n. \<bar>(f o disjointed A) n\<bar> \<le> (f \<circ> A) n"
paulson@33271
   722
    proof (auto)
paulson@33271
   723
      fix n
paulson@33271
   724
      have "\<bar>f (disjointed A n)\<bar> = f (disjointed A n)" using posf dA
paulson@33271
   725
	by (auto simp add: positive_def image_subset_iff)
paulson@33271
   726
      also have "... \<le> f (A n)" 
paulson@33271
   727
	by (metis increasingD [OF inc] UNIV_I dA image_subset_iff disjointed_subset A)
paulson@33271
   728
      finally show "\<bar>f (disjointed A n)\<bar> \<le> f (A n)" .
paulson@33271
   729
    qed
paulson@33271
   730
  from Series.summable_le2 [OF this sm]
paulson@33271
   731
  have sda:  "summable (f o disjointed A)"  
paulson@33271
   732
             "suminf (f o disjointed A) \<le> suminf (f \<circ> A)"
paulson@33271
   733
    by blast+
paulson@33271
   734
  hence ley: "suminf (f o disjointed A) \<le> x"
paulson@33271
   735
    by (metis xeq) 
paulson@33271
   736
  from sda have "(f \<circ> disjointed A) sums suminf (f \<circ> disjointed A)"
paulson@33271
   737
    by (simp add: sums_iff) 
paulson@33271
   738
  hence y: "suminf (f o disjointed A) \<in> measure_set M f s"
paulson@33271
   739
    apply (auto simp add: measure_set_def)
paulson@33271
   740
    apply (rule_tac x="disjointed A" in exI) 
paulson@33271
   741
    apply (simp add: disjoint_family_disjointed UN_disjointed_eq ss dA)
paulson@33271
   742
    done
paulson@33271
   743
  show ?thesis
paulson@33271
   744
    by (blast intro: Inf_lower y order_trans [OF _ ley] inf_measure_pos0 posf)
paulson@33271
   745
qed
paulson@33271
   746
paulson@33271
   747
lemma (in algebra) inf_measure_close:
paulson@33271
   748
  assumes posf: "positive M f" and e: "0 < e" and ss: "s \<subseteq> (space M)"
paulson@33271
   749
  shows "\<exists>A l. range A \<subseteq> sets M & disjoint_family A & s \<subseteq> (\<Union>i. A i) & 
paulson@33271
   750
               (f \<circ> A) sums l & l \<le> Inf (measure_set M f s) + e"
paulson@33271
   751
proof -
paulson@33271
   752
  have " measure_set M f s \<noteq> {}" 
paulson@33271
   753
    by (metis emptyE ss inf_measure_nonempty [OF posf top])
paulson@33271
   754
  hence "\<exists>l \<in> measure_set M f s. l < Inf (measure_set M f s) + e" 
paulson@33271
   755
    by (rule Inf_close [OF _ e])
paulson@33271
   756
  thus ?thesis 
paulson@33271
   757
    by (auto simp add: measure_set_def, rule_tac x=" A" in exI, auto)
paulson@33271
   758
qed
paulson@33271
   759
paulson@33271
   760
lemma (in algebra) inf_measure_countably_subadditive:
paulson@33271
   761
  assumes posf: "positive M f" and inc: "increasing M f" 
paulson@33271
   762
  shows "countably_subadditive (| space = space M, sets = Pow (space M) |)
paulson@33271
   763
                  (\<lambda>x. Inf (measure_set M f x))"
paulson@33271
   764
proof (auto simp add: countably_subadditive_def o_def, rule field_le_epsilon)
paulson@33271
   765
  fix A :: "nat \<Rightarrow> 'a set" and e :: real
paulson@33271
   766
    assume A: "range A \<subseteq> Pow (space M)"
paulson@33271
   767
       and disj: "disjoint_family A"
paulson@33271
   768
       and sb: "(\<Union>i. A i) \<subseteq> space M"
paulson@33271
   769
       and sum1: "summable (\<lambda>n. Inf (measure_set M f (A n)))"
paulson@33271
   770
       and e: "0 < e"
paulson@33271
   771
    have "!!n. \<exists>B l. range B \<subseteq> sets M \<and> disjoint_family B \<and> A n \<subseteq> (\<Union>i. B i) \<and>
paulson@33271
   772
                    (f o B) sums l \<and>
paulson@33271
   773
                    l \<le> Inf (measure_set M f (A n)) + e * (1/2)^(Suc n)"
paulson@33271
   774
      apply (rule inf_measure_close [OF posf])
paulson@33271
   775
      apply (metis e half mult_pos_pos zero_less_power) 
paulson@33271
   776
      apply (metis UNIV_I UN_subset_iff sb)
paulson@33271
   777
      done
paulson@33271
   778
    hence "\<exists>BB ll. \<forall>n. range (BB n) \<subseteq> sets M \<and> disjoint_family (BB n) \<and>
paulson@33271
   779
                       A n \<subseteq> (\<Union>i. BB n i) \<and> (f o BB n) sums ll n \<and>
paulson@33271
   780
                       ll n \<le> Inf (measure_set M f (A n)) + e * (1/2)^(Suc n)"
paulson@33271
   781
      by (rule choice2)
paulson@33271
   782
    then obtain BB ll
paulson@33271
   783
      where BB: "!!n. (range (BB n) \<subseteq> sets M)"
paulson@33271
   784
        and disjBB: "!!n. disjoint_family (BB n)" 
paulson@33271
   785
        and sbBB: "!!n. A n \<subseteq> (\<Union>i. BB n i)"
paulson@33271
   786
        and BBsums: "!!n. (f o BB n) sums ll n"
paulson@33271
   787
        and ll: "!!n. ll n \<le> Inf (measure_set M f (A n)) + e * (1/2)^(Suc n)"
paulson@33271
   788
      by auto blast
paulson@33271
   789
    have llpos: "!!n. 0 \<le> ll n"
paulson@33271
   790
	by (metis BBsums sums_iff o_apply posf positive_imp_pos suminf_ge_zero 
paulson@33271
   791
              range_subsetD BB) 
paulson@33271
   792
    have sll: "summable ll &
paulson@33271
   793
               suminf ll \<le> suminf (\<lambda>n. Inf (measure_set M f (A n))) + e"
paulson@33271
   794
      proof -
paulson@33271
   795
	have "(\<lambda>n. e * (1/2)^(Suc n)) sums (e*1)"
paulson@33271
   796
	  by (rule sums_mult [OF power_half_series]) 
paulson@33271
   797
	hence sum0: "summable (\<lambda>n. e * (1 / 2) ^ Suc n)"
paulson@33271
   798
	  and eqe:  "(\<Sum>n. e * (1 / 2) ^ n / 2) = e"
paulson@33271
   799
	  by (auto simp add: sums_iff) 
paulson@33271
   800
	have 0: "suminf (\<lambda>n. Inf (measure_set M f (A n))) +
paulson@33271
   801
                 suminf (\<lambda>n. e * (1/2)^(Suc n)) =
paulson@33271
   802
                 suminf (\<lambda>n. Inf (measure_set M f (A n)) + e * (1/2)^(Suc n))"
paulson@33271
   803
	  by (rule suminf_add [OF sum1 sum0]) 
paulson@33271
   804
	have 1: "\<forall>n. \<bar>ll n\<bar> \<le> Inf (measure_set M f (A n)) + e * (1/2) ^ Suc n"
paulson@33271
   805
	  by (metis ll llpos abs_of_nonneg)
paulson@33271
   806
	have 2: "summable (\<lambda>n. Inf (measure_set M f (A n)) + e*(1/2)^(Suc n))"
paulson@33271
   807
	  by (rule summable_add [OF sum1 sum0]) 
paulson@33271
   808
	have "suminf ll \<le> (\<Sum>n. Inf (measure_set M f (A n)) + e*(1/2) ^ Suc n)"
paulson@33271
   809
	  using Series.summable_le2 [OF 1 2] by auto
paulson@33271
   810
	also have "... = (\<Sum>n. Inf (measure_set M f (A n))) + 
paulson@33271
   811
                         (\<Sum>n. e * (1 / 2) ^ Suc n)"
paulson@33271
   812
	  by (metis 0) 
paulson@33271
   813
	also have "... = (\<Sum>n. Inf (measure_set M f (A n))) + e"
paulson@33271
   814
	  by (simp add: eqe) 
paulson@33271
   815
	finally show ?thesis using  Series.summable_le2 [OF 1 2] by auto
paulson@33271
   816
      qed
paulson@33271
   817
    def C \<equiv> "(split BB) o nat_to_nat2"
paulson@33271
   818
    have C: "!!n. C n \<in> sets M"
paulson@33271
   819
      apply (rule_tac p="nat_to_nat2 n" in PairE)
paulson@33271
   820
      apply (simp add: C_def)
paulson@33271
   821
      apply (metis BB subsetD rangeI)  
paulson@33271
   822
      done
paulson@33271
   823
    have sbC: "(\<Union>i. A i) \<subseteq> (\<Union>i. C i)"
paulson@33271
   824
      proof (auto simp add: C_def)
paulson@33271
   825
	fix x i
paulson@33271
   826
	assume x: "x \<in> A i"
paulson@33271
   827
	with sbBB [of i] obtain j where "x \<in> BB i j"
paulson@33271
   828
	  by blast	  
paulson@33271
   829
	thus "\<exists>i. x \<in> split BB (nat_to_nat2 i)"
paulson@33271
   830
	  by (metis nat_to_nat2_surj internal_split_def prod.cases 
paulson@33271
   831
                prod_case_split surj_f_inv_f)
paulson@33271
   832
      qed 
paulson@33271
   833
    have "(f \<circ> C) = (f \<circ> (\<lambda>(x, y). BB x y)) \<circ> nat_to_nat2"
paulson@33271
   834
      by (rule ext)  (auto simp add: C_def) 
paulson@33271
   835
    also have "... sums suminf ll" 
paulson@33271
   836
      proof (rule suminf_2dimen)
paulson@33271
   837
	show "\<And>m n. 0 \<le> (f \<circ> (\<lambda>(x, y). BB x y)) (m, n)" using posf BB 
paulson@33271
   838
	  by (force simp add: positive_def)
paulson@33271
   839
	show "\<And>m. (\<lambda>n. (f \<circ> (\<lambda>(x, y). BB x y)) (m, n)) sums ll m"using BBsums BB
paulson@33271
   840
	  by (force simp add: o_def)
paulson@33271
   841
	show "summable ll" using sll
paulson@33271
   842
	  by auto
paulson@33271
   843
      qed
paulson@33271
   844
    finally have Csums: "(f \<circ> C) sums suminf ll" .
paulson@33271
   845
    have "Inf (measure_set M f (\<Union>i. A i)) \<le> suminf ll"
paulson@33271
   846
      apply (rule inf_measure_le [OF posf inc], auto)
paulson@33271
   847
      apply (rule_tac x="C" in exI)
paulson@33271
   848
      apply (auto simp add: C sbC Csums) 
paulson@33271
   849
      done
paulson@33271
   850
    also have "... \<le> (\<Sum>n. Inf (measure_set M f (A n))) + e" using sll
paulson@33271
   851
      by blast
paulson@33271
   852
    finally show "Inf (measure_set M f (\<Union>i. A i)) \<le> 
paulson@33271
   853
          (\<Sum>n. Inf (measure_set M f (A n))) + e" .
paulson@33271
   854
qed
paulson@33271
   855
paulson@33271
   856
lemma (in algebra) inf_measure_outer:
paulson@33271
   857
  "positive M f \<Longrightarrow> increasing M f 
paulson@33271
   858
   \<Longrightarrow> outer_measure_space (| space = space M, sets = Pow (space M) |)
paulson@33271
   859
                          (\<lambda>x. Inf (measure_set M f x))"
paulson@33271
   860
  by (simp add: outer_measure_space_def inf_measure_positive
paulson@33271
   861
                inf_measure_increasing inf_measure_countably_subadditive) 
paulson@33271
   862
paulson@33271
   863
(*MOVE UP*)
paulson@33271
   864
paulson@33271
   865
lemma (in algebra) algebra_subset_lambda_system:
paulson@33271
   866
  assumes posf: "positive M f" and inc: "increasing M f" 
paulson@33271
   867
      and add: "additive M f"
paulson@33271
   868
  shows "sets M \<subseteq> lambda_system (| space = space M, sets = Pow (space M) |)
paulson@33271
   869
                                (\<lambda>x. Inf (measure_set M f x))"
paulson@33271
   870
proof (auto dest: sets_into_space 
paulson@33271
   871
            simp add: algebra.lambda_system_eq [OF algebra_Pow]) 
paulson@33271
   872
  fix x s
paulson@33271
   873
  assume x: "x \<in> sets M"
paulson@33271
   874
     and s: "s \<subseteq> space M"
paulson@33271
   875
  have [simp]: "!!x. x \<in> sets M \<Longrightarrow> s \<inter> (space M - x) = s-x" using s 
paulson@33271
   876
    by blast
paulson@33271
   877
  have "Inf (measure_set M f (s\<inter>x)) + Inf (measure_set M f (s-x))
paulson@33271
   878
        \<le> Inf (measure_set M f s)"
paulson@33271
   879
    proof (rule field_le_epsilon) 
paulson@33271
   880
      fix e :: real
paulson@33271
   881
      assume e: "0 < e"
paulson@33271
   882
      from inf_measure_close [OF posf e s]
paulson@33271
   883
      obtain A l where A: "range A \<subseteq> sets M" and disj: "disjoint_family A"
paulson@33271
   884
                   and sUN: "s \<subseteq> (\<Union>i. A i)" and fsums: "(f \<circ> A) sums l"
paulson@33271
   885
	           and l: "l \<le> Inf (measure_set M f s) + e"
paulson@33271
   886
	by auto
paulson@33271
   887
      have [simp]: "!!x. x \<in> sets M \<Longrightarrow>
paulson@33271
   888
                      (f o (\<lambda>z. z \<inter> (space M - x)) o A) = (f o (\<lambda>z. z - x) o A)"
paulson@33271
   889
	by (rule ext, simp, metis A Int_Diff Int_space_eq2 range_subsetD)
paulson@33271
   890
      have  [simp]: "!!n. f (A n \<inter> x) + f (A n - x) = f (A n)"
paulson@33271
   891
	by (subst additiveD [OF add, symmetric])
paulson@33271
   892
 	   (auto simp add: x range_subsetD [OF A] Int_Diff_Un Int_Diff_disjoint)
paulson@33271
   893
      have fsumb: "summable (f \<circ> A)"
paulson@33271
   894
	by (metis fsums sums_iff) 
paulson@33271
   895
      { fix u
paulson@33271
   896
	assume u: "u \<in> sets M"
paulson@33271
   897
	have [simp]: "\<And>n. \<bar>f (A n \<inter> u)\<bar> \<le> f (A n)"
paulson@33271
   898
	  by (simp add: positive_imp_pos [OF posf]  increasingD [OF inc] 
paulson@33271
   899
                        u Int  range_subsetD [OF A]) 
paulson@33271
   900
	have 1: "summable (f o (\<lambda>z. z\<inter>u) o A)" 
paulson@33271
   901
          by (rule summable_comparison_test [OF _ fsumb]) simp
paulson@33271
   902
	have 2: "Inf (measure_set M f (s\<inter>u)) \<le> suminf (f o (\<lambda>z. z\<inter>u) o A)"
paulson@33271
   903
          proof (rule Inf_lower) 
paulson@33271
   904
            show "suminf (f \<circ> (\<lambda>z. z \<inter> u) \<circ> A) \<in> measure_set M f (s \<inter> u)"
paulson@33271
   905
              apply (simp add: measure_set_def) 
paulson@33271
   906
              apply (rule_tac x="(\<lambda>z. z \<inter> u) o A" in exI) 
paulson@33271
   907
              apply (auto simp add: disjoint_family_subset [OF disj])
paulson@33271
   908
              apply (blast intro: u range_subsetD [OF A]) 
paulson@33271
   909
              apply (blast dest: subsetD [OF sUN])
paulson@33271
   910
              apply (metis 1 o_assoc sums_iff) 
paulson@33271
   911
              done
paulson@33271
   912
          next
paulson@33271
   913
            show "\<And>x. x \<in> measure_set M f (s \<inter> u) \<Longrightarrow> 0 \<le> x"
paulson@33271
   914
              by (blast intro: inf_measure_pos0 [OF posf]) 
paulson@33271
   915
            qed
paulson@33271
   916
          note 1 2
paulson@33271
   917
      } note lesum = this
paulson@33271
   918
      have sum1: "summable (f o (\<lambda>z. z\<inter>x) o A)"
paulson@33271
   919
        and inf1: "Inf (measure_set M f (s\<inter>x)) \<le> suminf (f o (\<lambda>z. z\<inter>x) o A)"
paulson@33271
   920
        and sum2: "summable (f o (\<lambda>z. z \<inter> (space M - x)) o A)"
paulson@33271
   921
        and inf2: "Inf (measure_set M f (s \<inter> (space M - x))) 
paulson@33271
   922
                   \<le> suminf (f o (\<lambda>z. z \<inter> (space M - x)) o A)"
paulson@33271
   923
	by (metis Diff lesum top x)+
paulson@33271
   924
      hence "Inf (measure_set M f (s\<inter>x)) + Inf (measure_set M f (s-x))
paulson@33271
   925
           \<le> suminf (f o (\<lambda>s. s\<inter>x) o A) + suminf (f o (\<lambda>s. s-x) o A)"
paulson@33271
   926
	by (simp add: x)
paulson@33271
   927
      also have "... \<le> suminf (f o A)" using suminf_add [OF sum1 sum2] 
paulson@33271
   928
	by (simp add: x) (simp add: o_def) 
paulson@33271
   929
      also have "... \<le> Inf (measure_set M f s) + e"
paulson@33271
   930
	by (metis fsums l sums_unique) 
paulson@33271
   931
      finally show "Inf (measure_set M f (s\<inter>x)) + Inf (measure_set M f (s-x))
paulson@33271
   932
        \<le> Inf (measure_set M f s) + e" .
paulson@33271
   933
    qed
paulson@33271
   934
  moreover 
paulson@33271
   935
  have "Inf (measure_set M f s)
paulson@33271
   936
       \<le> Inf (measure_set M f (s\<inter>x)) + Inf (measure_set M f (s-x))"
paulson@33271
   937
    proof -
paulson@33271
   938
    have "Inf (measure_set M f s) = Inf (measure_set M f ((s\<inter>x) \<union> (s-x)))"
paulson@33271
   939
      by (metis Un_Diff_Int Un_commute)
paulson@33271
   940
    also have "... \<le> Inf (measure_set M f (s\<inter>x)) + Inf (measure_set M f (s-x))" 
paulson@33271
   941
      apply (rule subadditiveD) 
paulson@33271
   942
      apply (iprover intro: algebra.countably_subadditive_subadditive algebra_Pow 
paulson@33271
   943
	       inf_measure_positive inf_measure_countably_subadditive posf inc)
paulson@33271
   944
      apply (auto simp add: subsetD [OF s])  
paulson@33271
   945
      done
paulson@33271
   946
    finally show ?thesis .
paulson@33271
   947
    qed
paulson@33271
   948
  ultimately 
paulson@33271
   949
  show "Inf (measure_set M f (s\<inter>x)) + Inf (measure_set M f (s-x))
paulson@33271
   950
        = Inf (measure_set M f s)"
paulson@33271
   951
    by (rule order_antisym)
paulson@33271
   952
qed
paulson@33271
   953
paulson@33271
   954
lemma measure_down:
paulson@33271
   955
     "measure_space N \<Longrightarrow> sigma_algebra M \<Longrightarrow> sets M \<subseteq> sets N \<Longrightarrow>
paulson@33271
   956
      (measure M = measure N) \<Longrightarrow> measure_space M"
paulson@33271
   957
  by (simp add: measure_space_def measure_space_axioms_def positive_def 
paulson@33271
   958
                countably_additive_def) 
paulson@33271
   959
     blast
paulson@33271
   960
paulson@33271
   961
theorem (in algebra) caratheodory:
paulson@33271
   962
  assumes posf: "positive M f" and ca: "countably_additive M f" 
paulson@33271
   963
  shows "\<exists>MS :: 'a measure_space. 
paulson@33271
   964
             (\<forall>s \<in> sets M. measure MS s = f s) \<and>
paulson@33271
   965
             ((|space = space MS, sets = sets MS|) = sigma (space M) (sets M)) \<and>
paulson@33271
   966
             measure_space MS" 
paulson@33271
   967
  proof -
paulson@33271
   968
    have inc: "increasing M f"
paulson@33271
   969
      by (metis additive_increasing ca countably_additive_additive posf) 
paulson@33271
   970
    let ?infm = "(\<lambda>x. Inf (measure_set M f x))"
paulson@33271
   971
    def ls \<equiv> "lambda_system (|space = space M, sets = Pow (space M)|) ?infm"
paulson@33271
   972
    have mls: "measure_space (|space = space M, sets = ls, measure = ?infm|)"
paulson@33271
   973
      using sigma_algebra.caratheodory_lemma
paulson@33271
   974
              [OF sigma_algebra_Pow  inf_measure_outer [OF posf inc]]
paulson@33271
   975
      by (simp add: ls_def)
paulson@33271
   976
    hence sls: "sigma_algebra (|space = space M, sets = ls, measure = ?infm|)"
paulson@33271
   977
      by (simp add: measure_space_def) 
paulson@33271
   978
    have "sets M \<subseteq> ls" 
paulson@33271
   979
      by (simp add: ls_def)
paulson@33271
   980
         (metis ca posf inc countably_additive_additive algebra_subset_lambda_system)
paulson@33271
   981
    hence sgs_sb: "sigma_sets (space M) (sets M) \<subseteq> ls" 
paulson@33271
   982
      using sigma_algebra.sigma_sets_subset [OF sls, of "sets M"]
paulson@33271
   983
      by simp
paulson@33271
   984
    have "measure_space (|space = space M, 
paulson@33271
   985
                          sets = sigma_sets (space M) (sets M),
paulson@33271
   986
                          measure = ?infm|)"
paulson@33271
   987
      by (rule measure_down [OF mls], rule sigma_algebra_sigma_sets) 
paulson@33271
   988
         (simp_all add: sgs_sb space_closed)
paulson@33271
   989
    thus ?thesis
paulson@33271
   990
      by (force simp add: sigma_def inf_measure_agrees [OF posf ca]) 
paulson@33271
   991
qed
paulson@33271
   992
paulson@33271
   993
end