src/HOL/Analysis/Measure_Space.thy
author nipkow
Tue, 17 Jun 2025 06:29:55 +0200
changeset 82732 71574900b6ba
parent 82538 4b132ea7d575
permissions -rw-r--r--
merged
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
63627
6ddb43c6b711 rename HOL-Multivariate_Analysis to HOL-Analysis.
hoelzl
parents: 63626
diff changeset
     1
(*  Title:      HOL/Analysis/Measure_Space.thy
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
     2
    Author:     Lawrence C Paulson
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
     3
    Author:     Johannes Hölzl, TU München
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
     4
    Author:     Armin Heller, TU München
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
     5
*)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
     6
69517
dc20f278e8f3 tuned style and headers
nipkow
parents: 69313
diff changeset
     7
section \<open>Measure Spaces\<close>
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
     8
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
     9
theory Measure_Space
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    10
imports
66453
cc19f7ca2ed6 session-qualified theory imports: isabelle imports -U -i -d '~~/src/Benchmarks' -a;
wenzelm
parents: 64911
diff changeset
    11
  Measurable "HOL-Library.Extended_Nonnegative_Real"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    12
begin
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    13
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
    14
subsection\<^marker>\<open>tag unimportant\<close> "Relate extended reals and the indicator function"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
    15
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    16
lemma suminf_cmult_indicator:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
    17
  fixes f :: "nat \<Rightarrow> ennreal"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
    18
  assumes "disjoint_family A" "x \<in> A i"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    19
  shows "(\<Sum>n. f n * indicator (A n) x) = f i"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    20
proof -
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
    21
  have **: "\<And>n. f n * indicator (A n) x = (if n = i then f n else 0 :: ennreal)"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
    22
    using \<open>x \<in> A i\<close> assms unfolding disjoint_family_on_def indicator_def by auto
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
    23
  then have "\<And>n. (\<Sum>j<n. f j * indicator (A j) x) = (if i < n then f i else 0 :: ennreal)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
    24
    by (auto simp: sum.If_cases)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
    25
  moreover have "(SUP n. if i < n then f i else 0) = (f i :: ennreal)"
51000
c9adb50f74ad use order topology for extended reals
hoelzl
parents: 50419
diff changeset
    26
  proof (rule SUP_eqI)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
    27
    fix y :: ennreal assume "\<And>n. n \<in> UNIV \<Longrightarrow> (if i < n then f i else 0) \<le> y"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    28
    from this[of "Suc i"] show "f i \<le> y" by auto
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
    29
  qed (use assms in simp)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    30
  ultimately show ?thesis using assms
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
    31
    by (simp add: suminf_eq_SUP)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    32
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    33
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    34
lemma suminf_indicator:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    35
  assumes "disjoint_family A"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
    36
  shows "(\<Sum>n. indicator (A n) x :: ennreal) = indicator (\<Union>i. A i) x"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    37
proof cases
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    38
  assume *: "x \<in> (\<Union>i. A i)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    39
  then obtain i where "x \<in> A i" by auto
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
    40
  from suminf_cmult_indicator[OF assms(1), OF \<open>x \<in> A i\<close>, of "\<lambda>k. 1"]
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    41
  show ?thesis using * by simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    42
qed simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    43
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
    44
lemma sum_indicator_disjoint_family:
60727
53697011b03a move disjoint sets to their own theory
hoelzl
parents: 60715
diff changeset
    45
  fixes f :: "'d \<Rightarrow> 'e::semiring_1"
53697011b03a move disjoint sets to their own theory
hoelzl
parents: 60715
diff changeset
    46
  assumes d: "disjoint_family_on A P" and "x \<in> A j" and "finite P" and "j \<in> P"
53697011b03a move disjoint sets to their own theory
hoelzl
parents: 60715
diff changeset
    47
  shows "(\<Sum>i\<in>P. f i * indicator (A i) x) = f j"
53697011b03a move disjoint sets to their own theory
hoelzl
parents: 60715
diff changeset
    48
proof -
53697011b03a move disjoint sets to their own theory
hoelzl
parents: 60715
diff changeset
    49
  have "P \<inter> {i. x \<in> A i} = {j}"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
    50
    using d \<open>x \<in> A j\<close> \<open>j \<in> P\<close> unfolding disjoint_family_on_def
60727
53697011b03a move disjoint sets to their own theory
hoelzl
parents: 60715
diff changeset
    51
    by auto
73536
5131c388a9b0 simplified definition
haftmann
parents: 71840
diff changeset
    52
  with \<open>finite P\<close> show ?thesis
5131c388a9b0 simplified definition
haftmann
parents: 71840
diff changeset
    53
    by (simp add: indicator_def)
60727
53697011b03a move disjoint sets to their own theory
hoelzl
parents: 60715
diff changeset
    54
qed
53697011b03a move disjoint sets to their own theory
hoelzl
parents: 60715
diff changeset
    55
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
    56
text \<open>
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 69566
diff changeset
    57
  The type for emeasure spaces is already defined in \<^theory>\<open>HOL-Analysis.Sigma_Algebra\<close>, as it
68484
59793df7f853 clarified document antiquotation @{theory};
wenzelm
parents: 68403
diff changeset
    58
  is also used to represent sigma algebras (with an arbitrary emeasure).
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
    59
\<close>
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    60
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
    61
subsection\<^marker>\<open>tag unimportant\<close> "Extend binary sets"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    62
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    63
lemma LIMSEQ_binaryset:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    64
  assumes f: "f {} = 0"
61969
e01015e49041 more symbols;
wenzelm
parents: 61880
diff changeset
    65
  shows  "(\<lambda>n. \<Sum>i<n. f (binaryset A B i)) \<longlonglongrightarrow> f A + f B"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    66
proof -
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    67
  have "(\<lambda>n. \<Sum>i < Suc (Suc n). f (binaryset A B i)) = (\<lambda>n. f A + f B)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    68
    proof
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    69
      fix n
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    70
      show "(\<Sum>i < Suc (Suc n). f (binaryset A B i)) = f A + f B"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
    71
        by (induct n)  (auto simp: binaryset_def f)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    72
    qed
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
    73
  thus ?thesis
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
    74
    by (simp add: LIMSEQ_imp_Suc)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    75
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    76
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    77
lemma binaryset_sums:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    78
  assumes f: "f {} = 0"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    79
  shows  "(\<lambda>n. f (binaryset A B n)) sums (f A + f B)"
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
    80
  using LIMSEQ_binaryset f sums_def by blast
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    81
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    82
lemma suminf_binaryset_eq:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    83
  fixes f :: "'a set \<Rightarrow> 'b::{comm_monoid_add, t2_space}"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    84
  shows "f {} = 0 \<Longrightarrow> (\<Sum>n. f (binaryset A B n)) = f A + f B"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    85
  by (metis binaryset_sums sums_unique)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    86
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
    87
subsection\<^marker>\<open>tag unimportant\<close> \<open>Properties of a premeasure \<^term>\<open>\<mu>\<close>\<close>
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    88
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
    89
text \<open>
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 69566
diff changeset
    90
  The definitions for \<^const>\<open>positive\<close> and \<^const>\<open>countably_additive\<close> should be here, by they are
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 69566
diff changeset
    91
  necessary to define \<^typ>\<open>'a measure\<close> in \<^theory>\<open>HOL-Analysis.Sigma_Algebra\<close>.
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
    92
\<close>
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
    93
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
    94
definition subadditive where
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
    95
  "subadditive M f \<longleftrightarrow> (\<forall>x\<in>M. \<forall>y\<in>M. x \<inter> y = {} \<longrightarrow> f (x \<union> y) \<le> f x + f y)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
    96
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
    97
lemma subadditiveD: "subadditive M f \<Longrightarrow> x \<inter> y = {} \<Longrightarrow> x \<in> M \<Longrightarrow> y \<in> M \<Longrightarrow> f (x \<union> y) \<le> f x + f y"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
    98
  by (auto simp: subadditive_def)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
    99
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   100
definition countably_subadditive where
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   101
  "countably_subadditive M f \<longleftrightarrow>
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   102
    (\<forall>A. range A \<subseteq> M \<longrightarrow> disjoint_family A \<longrightarrow> (\<Union>i. A i) \<in> M \<longrightarrow> (f (\<Union>i. A i) \<le> (\<Sum>i. f (A i))))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   103
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   104
lemma (in ring_of_sets) countably_subadditive_subadditive:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   105
  fixes f :: "'a set \<Rightarrow> ennreal"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   106
  assumes f: "positive M f" and cs: "countably_subadditive M f"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   107
  shows  "subadditive M f"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   108
proof (auto simp: subadditive_def)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   109
  fix x y
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   110
  assume x: "x \<in> M" and y: "y \<in> M" and "x \<inter> y = {}"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   111
  hence "disjoint_family (binaryset x y)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   112
    by (auto simp: disjoint_family_on_def binaryset_def)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   113
  hence "range (binaryset x y) \<subseteq> M \<longrightarrow>
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   114
         (\<Union>i. binaryset x y i) \<in> M \<longrightarrow>
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   115
         f (\<Union>i. binaryset x y i) \<le> (\<Sum> n. f (binaryset x y n))"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   116
    using cs by (auto simp: countably_subadditive_def)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   117
  hence "{x,y,{}} \<subseteq> M \<longrightarrow> x \<union> y \<in> M \<longrightarrow>
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   118
         f (x \<union> y) \<le> (\<Sum> n. f (binaryset x y n))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   119
    by (simp add: range_binaryset_eq UN_binaryset_eq)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   120
  thus "f (x \<union> y) \<le>  f x + f y" using f x y
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   121
    by (auto simp: Un o_def suminf_binaryset_eq positive_def)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   122
qed
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   123
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   124
definition additive where
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   125
  "additive M \<mu> \<longleftrightarrow> (\<forall>x\<in>M. \<forall>y\<in>M. x \<inter> y = {} \<longrightarrow> \<mu> (x \<union> y) = \<mu> x + \<mu> y)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   126
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   127
definition increasing where
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   128
  "increasing M \<mu> \<longleftrightarrow> (\<forall>x\<in>M. \<forall>y\<in>M. x \<subseteq> y \<longrightarrow> \<mu> x \<le> \<mu> y)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   129
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   130
lemma positiveD1: "positive M f \<Longrightarrow> f {} = 0" by (auto simp: positive_def)
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   131
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   132
lemma positiveD_empty:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   133
  "positive M f \<Longrightarrow> f {} = 0"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   134
  by (auto simp: positive_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   135
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   136
lemma additiveD:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   137
  "additive M f \<Longrightarrow> x \<inter> y = {} \<Longrightarrow> x \<in> M \<Longrightarrow> y \<in> M \<Longrightarrow> f (x \<union> y) = f x + f y"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   138
  by (auto simp: additive_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   139
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   140
lemma increasingD:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   141
  "increasing M f \<Longrightarrow> x \<subseteq> y \<Longrightarrow> x\<in>M \<Longrightarrow> y\<in>M \<Longrightarrow> f x \<le> f y"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   142
  by (auto simp: increasing_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   143
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
   144
lemma countably_additiveI[case_names countably]:
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   145
  "(\<And>A. \<lbrakk>range A \<subseteq> M; disjoint_family A; (\<Union>i. A i) \<in> M\<rbrakk> \<Longrightarrow> (\<Sum>i. f(A i)) = f(\<Union>i. A i))
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   146
  \<Longrightarrow> countably_additive M f"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   147
  by (simp add: countably_additive_def)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   148
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   149
lemma (in ring_of_sets) disjointed_additive:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   150
  assumes f: "positive M f" "additive M f" and A: "range A \<subseteq> M" "incseq A"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   151
  shows "(\<Sum>i\<le>n. f (disjointed A i)) = f (A n)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   152
proof (induct n)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   153
  case (Suc n)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   154
  then have "(\<Sum>i\<le>Suc n. f (disjointed A i)) = f (A n) + f (disjointed A (Suc n))"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   155
    by simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   156
  also have "\<dots> = f (A n \<union> disjointed A (Suc n))"
60727
53697011b03a move disjoint sets to their own theory
hoelzl
parents: 60715
diff changeset
   157
    using A by (subst f(2)[THEN additiveD]) (auto simp: disjointed_mono)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   158
  also have "A n \<union> disjointed A (Suc n) = A (Suc n)"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   159
    using \<open>incseq A\<close> by (auto dest: incseq_SucD simp: disjointed_mono)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   160
  finally show ?case .
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   161
qed simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   162
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   163
lemma (in ring_of_sets) additive_sum:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   164
  fixes A:: "'i \<Rightarrow> 'a set"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   165
  assumes f: "positive M f" and ad: "additive M f" and "finite S"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   166
      and A: "A`S \<subseteq> M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   167
      and disj: "disjoint_family_on A S"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   168
  shows  "(\<Sum>i\<in>S. f (A i)) = f (\<Union>i\<in>S. A i)"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   169
  using \<open>finite S\<close> disj A
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 51351
diff changeset
   170
proof induct
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   171
  case empty show ?case using f by (simp add: positive_def)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   172
next
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   173
  case (insert s S)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   174
  then have "A s \<inter> (\<Union>i\<in>S. A i) = {}"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   175
    by (auto simp: disjoint_family_on_def neq_iff)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   176
  moreover
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   177
  have "A s \<in> M" using insert by blast
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   178
  moreover have "(\<Union>i\<in>S. A i) \<in> M"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   179
    using insert \<open>finite S\<close> by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   180
  ultimately have "f (A s \<union> (\<Union>i\<in>S. A i)) = f (A s) + f(\<Union>i\<in>S. A i)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   181
    using ad UNION_in_sets A by (auto simp: additive_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   182
  with insert show ?case using ad disjoint_family_on_mono[of S "insert s S" A]
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   183
    by (auto simp: additive_def subset_insertI)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   184
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   185
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   186
lemma (in ring_of_sets) additive_increasing:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   187
  fixes f :: "'a set \<Rightarrow> ennreal"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   188
  assumes posf: "positive M f" and addf: "additive M f"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   189
  shows "increasing M f"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   190
proof (auto simp: increasing_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   191
  fix x y
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   192
  assume xy: "x \<in> M" "y \<in> M" "x \<subseteq> y"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   193
  then have "y - x \<in> M" by auto
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   194
  then have "f x + 0 \<le> f x + f (y-x)" by (intro add_left_mono zero_le)
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   195
  also have "\<dots> = f (x \<union> (y-x))"
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   196
    by (metis addf Diff_disjoint \<open>y - x \<in> M\<close> additiveD xy(1))
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   197
  also have "\<dots> = f y"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   198
    by (metis Un_Diff_cancel Un_absorb1 xy(3))
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   199
  finally show "f x \<le> f y" by simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   200
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   201
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 50002
diff changeset
   202
lemma (in ring_of_sets) subadditive:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   203
  fixes f :: "'a set \<Rightarrow> ennreal"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   204
  assumes f: "positive M f" "additive M f" and A: "A`S \<subseteq> M" and S: "finite S"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 50002
diff changeset
   205
  shows "f (\<Union>i\<in>S. A i) \<le> (\<Sum>i\<in>S. f (A i))"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   206
using S A
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 50002
diff changeset
   207
proof (induct S)
635d73673b5e regularity of measures, therefore:
immler
parents: 50002
diff changeset
   208
  case empty thus ?case using f by (auto simp: positive_def)
635d73673b5e regularity of measures, therefore:
immler
parents: 50002
diff changeset
   209
next
635d73673b5e regularity of measures, therefore:
immler
parents: 50002
diff changeset
   210
  case (insert x F)
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60580
diff changeset
   211
  hence in_M: "A x \<in> M" "(\<Union>i\<in>F. A i) \<in> M" "(\<Union>i\<in>F. A i) - A x \<in> M" using A by force+
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60580
diff changeset
   212
  have subs: "(\<Union>i\<in>F. A i) - A x \<subseteq> (\<Union>i\<in>F. A i)" by auto
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60580
diff changeset
   213
  have "(\<Union>i\<in>(insert x F). A i) = A x \<union> ((\<Union>i\<in>F. A i) - A x)" by auto
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60580
diff changeset
   214
  hence "f (\<Union>i\<in>(insert x F). A i) = f (A x \<union> ((\<Union>i\<in>F. A i) - A x))"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 50002
diff changeset
   215
    by simp
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60580
diff changeset
   216
  also have "\<dots> = f (A x) + f ((\<Union>i\<in>F. A i) - A x)"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 50002
diff changeset
   217
    using f(2) by (rule additiveD) (insert in_M, auto)
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60580
diff changeset
   218
  also have "\<dots> \<le> f (A x) + f (\<Union>i\<in>F. A i)"
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   219
    using additive_increasing[OF f] in_M subs 
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   220
    by (simp add: increasingD)
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   221
  also have "\<dots> \<le> f (A x) + (\<Sum>i\<in>F. f (A i))" 
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   222
    using insert by (auto intro: add_left_mono)
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   223
  finally show "f (\<Union>i\<in>(insert x F). A i) \<le> (\<Sum>i\<in>(insert x F). f (A i))"
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   224
    by (simp add: insert)
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 50002
diff changeset
   225
qed
635d73673b5e regularity of measures, therefore:
immler
parents: 50002
diff changeset
   226
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   227
lemma (in ring_of_sets) countably_additive_additive:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   228
  fixes f :: "'a set \<Rightarrow> ennreal"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   229
  assumes posf: "positive M f" and ca: "countably_additive M f"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   230
  shows "additive M f"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   231
proof (auto simp: additive_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   232
  fix x y
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   233
  assume x: "x \<in> M" and y: "y \<in> M" and "x \<inter> y = {}"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   234
  hence "disjoint_family (binaryset x y)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   235
    by (auto simp: disjoint_family_on_def binaryset_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   236
  hence "range (binaryset x y) \<subseteq> M \<longrightarrow>
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   237
         (\<Union>i. binaryset x y i) \<in> M \<longrightarrow>
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   238
         f (\<Union>i. binaryset x y i) = (\<Sum> n. f (binaryset x y n))"
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   239
    using ca by (simp add: countably_additive_def)
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   240
  hence "{x,y,{}} \<subseteq> M \<longrightarrow> x \<union> y \<in> M \<longrightarrow> f (x \<union> y) = (\<Sum>n. f (binaryset x y n))"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   241
    by (simp add: range_binaryset_eq UN_binaryset_eq)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   242
  thus "f (x \<union> y) = f x + f y" using posf x y
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   243
    by (auto simp: Un suminf_binaryset_eq positive_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   244
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   245
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   246
lemma (in algebra) increasing_additive_bound:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   247
  fixes A:: "nat \<Rightarrow> 'a set" and  f :: "'a set \<Rightarrow> ennreal"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   248
  assumes f: "positive M f" and ad: "additive M f"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   249
      and inc: "increasing M f"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   250
      and A: "range A \<subseteq> M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   251
      and disj: "disjoint_family A"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   252
  shows  "(\<Sum>i. f (A i)) \<le> f \<Omega>"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   253
proof (safe intro!: suminf_le_const)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   254
  fix N
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   255
  note disj_N = disjoint_family_on_mono[OF _ disj, of "{..<N}"]
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   256
  have "(\<Sum>i<N. f (A i)) = f (\<Union>i\<in>{..<N}. A i)"
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   257
    using A by (intro additive_sum [OF f ad]) (auto simp: disj_N)
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   258
  also have "\<dots> \<le> f \<Omega>" using space_closed A
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   259
    by (intro increasingD[OF inc] finite_UN) auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   260
  finally show "(\<Sum>i<N. f (A i)) \<le> f \<Omega>" by simp
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   261
qed (use f A in \<open>auto simp: positive_def\<close>)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   262
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   263
lemma (in ring_of_sets) countably_additiveI_finite:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   264
  fixes \<mu> :: "'a set \<Rightarrow> ennreal"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   265
  assumes "finite \<Omega>" "positive M \<mu>" "additive M \<mu>"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   266
  shows "countably_additive M \<mu>"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   267
proof (rule countably_additiveI)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   268
  fix F :: "nat \<Rightarrow> 'a set" assume F: "range F \<subseteq> M" "(\<Union>i. F i) \<in> M" and disj: "disjoint_family F"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   269
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   270
  have "\<forall>i. F i \<noteq> {} \<longrightarrow> (\<exists>x. x \<in> F i)" by auto
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   271
  then obtain f where f: "\<And>i. F i \<noteq> {} \<Longrightarrow> f i \<in> F i" by metis
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   272
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   273
  have finU: "finite (\<Union>i. F i)"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   274
    by (metis F(2) assms(1) infinite_super sets_into_space)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   275
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   276
  have F_subset: "{i. \<mu> (F i) \<noteq> 0} \<subseteq> {i. F i \<noteq> {}}"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   277
    by (auto simp: positiveD_empty[OF \<open>positive M \<mu>\<close>])
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   278
  moreover have fin_not_empty: "finite {i. F i \<noteq> {}}"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   279
  proof (rule finite_imageD)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   280
    from f have "f`{i. F i \<noteq> {}} \<subseteq> (\<Union>i. F i)" by auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   281
    then show "finite (f`{i. F i \<noteq> {}})"
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   282
      by (simp add: finU finite_subset)
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   283
    show inj_f: "inj_on f {i. F i \<noteq> {}}" 
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   284
      using f disj
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   285
      by (simp add: inj_on_def disjoint_family_on_def disjoint_iff) metis
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   286
  qed 
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   287
  ultimately have fin_not_0: "finite {i. \<mu> (F i) \<noteq> 0}"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   288
    by (rule finite_subset)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   289
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   290
  have disj_not_empty: "disjoint_family_on F {i. F i \<noteq> {}}"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   291
    using disj by (auto simp: disjoint_family_on_def)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   292
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   293
  from fin_not_0 have "(\<Sum>i. \<mu> (F i)) = (\<Sum>i | \<mu> (F i) \<noteq> 0. \<mu> (F i))"
47761
dfe747e72fa8 moved lemmas to appropriate places
hoelzl
parents: 47694
diff changeset
   294
    by (rule suminf_finite) auto
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   295
  also have "\<dots> = (\<Sum>i | F i \<noteq> {}. \<mu> (F i))"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
   296
    using fin_not_empty F_subset by (rule sum.mono_neutral_left) auto
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   297
  also have "\<dots> = \<mu> (\<Union>i\<in>{i. F i \<noteq> {}}. F i)"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   298
    using \<open>positive M \<mu>\<close> \<open>additive M \<mu>\<close> fin_not_empty disj_not_empty F by (intro additive_sum) auto
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   299
  also have "\<dots> = \<mu> (\<Union>i. F i)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   300
    by (rule arg_cong[where f=\<mu>]) auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   301
  finally show "(\<Sum>i. \<mu> (F i)) = \<mu> (\<Union>i. F i)" .
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   302
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   303
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   304
lemma (in ring_of_sets) countably_additive_iff_continuous_from_below:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   305
  fixes f :: "'a set \<Rightarrow> ennreal"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   306
  assumes f: "positive M f" "additive M f"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   307
  shows "countably_additive M f \<longleftrightarrow>
61969
e01015e49041 more symbols;
wenzelm
parents: 61880
diff changeset
   308
    (\<forall>A. range A \<subseteq> M \<longrightarrow> incseq A \<longrightarrow> (\<Union>i. A i) \<in> M \<longrightarrow> (\<lambda>i. f (A i)) \<longlonglongrightarrow> f (\<Union>i. A i))"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   309
  unfolding countably_additive_def
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   310
proof safe
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69286
diff changeset
   311
  assume count_sum: "\<forall>A. range A \<subseteq> M \<longrightarrow> disjoint_family A \<longrightarrow> \<Union>(A ` UNIV) \<in> M \<longrightarrow> (\<Sum>i. f (A i)) = f (\<Union>(A ` UNIV))"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   312
  fix A :: "nat \<Rightarrow> 'a set" assume A: "range A \<subseteq> M" "incseq A" "(\<Union>i. A i) \<in> M"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   313
  then have dA: "range (disjointed A) \<subseteq> M" by (auto simp: range_disjointed_sets)
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   314
  with count_sum[THEN spec, of "disjointed A"] A(3)
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   315
  have f_UN: "(\<Sum>i. f (disjointed A i)) = f (\<Union>i. A i)"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   316
    by (auto simp: UN_disjointed_eq disjoint_family_disjointed)
61969
e01015e49041 more symbols;
wenzelm
parents: 61880
diff changeset
   317
  moreover have "(\<lambda>n. (\<Sum>i<n. f (disjointed A i))) \<longlonglongrightarrow> (\<Sum>i. f (disjointed A i))"
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   318
    by (simp add: summable_LIMSEQ)
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   319
  from LIMSEQ_Suc[OF this]
61969
e01015e49041 more symbols;
wenzelm
parents: 61880
diff changeset
   320
  have "(\<lambda>n. (\<Sum>i\<le>n. f (disjointed A i))) \<longlonglongrightarrow> (\<Sum>i. f (disjointed A i))"
56193
c726ecfb22b6 cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents: 56154
diff changeset
   321
    unfolding lessThan_Suc_atMost .
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   322
  moreover have "\<And>n. (\<Sum>i\<le>n. f (disjointed A i)) = f (A n)"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   323
    using disjointed_additive[OF f A(1,2)] .
61969
e01015e49041 more symbols;
wenzelm
parents: 61880
diff changeset
   324
  ultimately show "(\<lambda>i. f (A i)) \<longlonglongrightarrow> f (\<Union>i. A i)" by simp
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   325
next
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   326
  assume cont[rule_format]: "\<forall>A. range A \<subseteq> M \<longrightarrow> incseq A \<longrightarrow> (\<Union>i. A i) \<in> M \<longrightarrow> (\<lambda>i. f (A i)) \<longlonglongrightarrow> f (\<Union>i. A i)"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   327
  fix A :: "nat \<Rightarrow> 'a set" assume A: "range A \<subseteq> M" "disjoint_family A" "(\<Union>i. A i) \<in> M"
57446
06e195515deb some lemmas about the indicator function; removed lemma sums_def2
hoelzl
parents: 57418
diff changeset
   328
  have *: "(\<Union>n. (\<Union>i<n. A i)) = (\<Union>i. A i)" by auto
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   329
  have "range (\<lambda>i. \<Union>i<i. A i) \<subseteq> M" "(\<Union>i. \<Union>i<i. A i) \<in> M"
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   330
    using A * by auto
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   331
  then have "(\<lambda>n. f (\<Union>i<n. A i)) \<longlonglongrightarrow> f (\<Union>i. A i)"
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   332
    unfolding *[symmetric] by (force intro!: cont incseq_SucI)+
57446
06e195515deb some lemmas about the indicator function; removed lemma sums_def2
hoelzl
parents: 57418
diff changeset
   333
  moreover have "\<And>n. f (\<Union>i<n. A i) = (\<Sum>i<n. f (A i))"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   334
    using A
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   335
    by (intro additive_sum[OF f, symmetric]) (auto intro: disjoint_family_on_mono)
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   336
  ultimately
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   337
  have "(\<lambda>i. f (A i)) sums f (\<Union>i. A i)"
57446
06e195515deb some lemmas about the indicator function; removed lemma sums_def2
hoelzl
parents: 57418
diff changeset
   338
    unfolding sums_def by simp
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   339
  then show "(\<Sum>i. f (A i)) = f (\<Union>i. A i)"
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   340
    by (metis sums_unique)
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   341
qed
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   342
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   343
lemma (in ring_of_sets) continuous_from_above_iff_empty_continuous:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   344
  fixes f :: "'a set \<Rightarrow> ennreal"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   345
  assumes f: "positive M f" "additive M f"
61969
e01015e49041 more symbols;
wenzelm
parents: 61880
diff changeset
   346
  shows "(\<forall>A. range A \<subseteq> M \<longrightarrow> decseq A \<longrightarrow> (\<Inter>i. A i) \<in> M \<longrightarrow> (\<forall>i. f (A i) \<noteq> \<infinity>) \<longrightarrow> (\<lambda>i. f (A i)) \<longlonglongrightarrow> f (\<Inter>i. A i))
e01015e49041 more symbols;
wenzelm
parents: 61880
diff changeset
   347
     \<longleftrightarrow> (\<forall>A. range A \<subseteq> M \<longrightarrow> decseq A \<longrightarrow> (\<Inter>i. A i) = {} \<longrightarrow> (\<forall>i. f (A i) \<noteq> \<infinity>) \<longrightarrow> (\<lambda>i. f (A i)) \<longlonglongrightarrow> 0)"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   348
proof safe
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   349
  assume cont[rule_format]: "(\<forall>A. range A \<subseteq> M \<longrightarrow> decseq A \<longrightarrow> (\<Inter>i. A i) \<in> M \<longrightarrow> (\<forall>i. f (A i) \<noteq> \<infinity>) \<longrightarrow> (\<lambda>i. f (A i)) \<longlonglongrightarrow> f (\<Inter>i. A i))"
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   350
  fix A :: "nat \<Rightarrow> 'a set" 
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   351
  assume A: "range A \<subseteq> M" "decseq A" "(\<Inter>i. A i) = {}" "\<forall>i. f (A i) \<noteq> \<infinity>"
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   352
  with cont[of A] show "(\<lambda>i. f (A i)) \<longlonglongrightarrow> 0"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   353
    using \<open>positive M f\<close>[unfolded positive_def] by auto
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   354
next
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   355
  assume cont[rule_format]: "\<forall>A. range A \<subseteq> M \<longrightarrow> decseq A \<longrightarrow> (\<Inter>i. A i) = {} \<longrightarrow> (\<forall>i. f (A i) \<noteq> \<infinity>) \<longrightarrow> (\<lambda>i. f (A i)) \<longlonglongrightarrow> 0"
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   356
  fix A :: "nat \<Rightarrow> 'a set" 
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   357
  assume A: "range A \<subseteq> M" "decseq A" "(\<Inter>i. A i) \<in> M" "\<forall>i. f (A i) \<noteq> \<infinity>"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   358
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   359
  have f_mono: "\<And>a b. a \<in> M \<Longrightarrow> b \<in> M \<Longrightarrow> a \<subseteq> b \<Longrightarrow> f a \<le> f b"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   360
    using additive_increasing[OF f] unfolding increasing_def by simp
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   361
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   362
  have decseq_fA: "decseq (\<lambda>i. f (A i))"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   363
    using A by (auto simp: decseq_def intro!: f_mono)
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   364
  have decseq: "decseq (\<lambda>i. A i - (\<Inter>i. A i))"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   365
    using A by (auto simp: decseq_def)
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   366
  then have decseq_f: "decseq (\<lambda>i. f (A i - (\<Inter>i. A i)))"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   367
    using A unfolding decseq_def by (auto intro!: f_mono Diff)
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   368
  have "f (\<Inter>x. A x) \<le> f (A 0)"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   369
    using A by (auto intro!: f_mono)
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   370
  then have f_Int_fin: "f (\<Inter>x. A x) \<noteq> \<infinity>"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   371
    using A by (auto simp: top_unique)
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   372
  have f_fin: "f (A i - (\<Inter>i. A i)) \<noteq> \<infinity>" for i
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   373
    using A by (metis Diff Diff_subset f_mono infinity_ennreal_def range_subsetD top_unique)
61969
e01015e49041 more symbols;
wenzelm
parents: 61880
diff changeset
   374
  have "(\<lambda>i. f (A i - (\<Inter>i. A i))) \<longlonglongrightarrow> 0"
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   375
  proof (intro cont[ OF _ decseq _ f_fin])
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   376
    show "range (\<lambda>i. A i - (\<Inter>i. A i)) \<subseteq> M" "(\<Inter>i. A i - (\<Inter>i. A i)) = {}"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   377
      using A by auto
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   378
  qed
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   379
  with INF_Lim decseq_f have "(INF n. f (A n - (\<Inter>i. A i))) = 0" by metis
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   380
  moreover have "(INF n. f (\<Inter>i. A i)) = f (\<Inter>i. A i)"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   381
    by auto
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   382
  ultimately have "(INF n. f (A n - (\<Inter>i. A i)) + f (\<Inter>i. A i)) = 0 + f (\<Inter>i. A i)"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   383
    using A(4) f_fin f_Int_fin
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   384
    using INF_ennreal_add_const by presburger
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   385
  moreover {
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   386
    fix n
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   387
    have "f (A n - (\<Inter>i. A i)) + f (\<Inter>i. A i) = f ((A n - (\<Inter>i. A i)) \<union> (\<Inter>i. A i))"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   388
      using A f(2)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   389
      by (metis (no_types) Diff Diff_disjoint add.commute additiveD range_subsetD sup_commute) 
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   390
    also have "(A n - (\<Inter>i. A i)) \<union> (\<Inter>i. A i) = A n"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   391
      by auto
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   392
    finally have "f (A n - (\<Inter>i. A i)) + f (\<Inter>i. A i) = f (A n)" . }
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   393
  ultimately have "(INF n. f (A n)) = f (\<Inter>i. A i)"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   394
    by simp
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51000
diff changeset
   395
  with LIMSEQ_INF[OF decseq_fA]
61969
e01015e49041 more symbols;
wenzelm
parents: 61880
diff changeset
   396
  show "(\<lambda>i. f (A i)) \<longlonglongrightarrow> f (\<Inter>i. A i)" by simp
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   397
qed
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   398
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   399
lemma (in ring_of_sets) empty_continuous_imp_continuous_from_below:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   400
  fixes f :: "'a set \<Rightarrow> ennreal"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   401
  assumes f: "positive M f" "additive M f" "\<forall>A\<in>M. f A \<noteq> \<infinity>"
61969
e01015e49041 more symbols;
wenzelm
parents: 61880
diff changeset
   402
  assumes cont: "\<forall>A. range A \<subseteq> M \<longrightarrow> decseq A \<longrightarrow> (\<Inter>i. A i) = {} \<longrightarrow> (\<lambda>i. f (A i)) \<longlonglongrightarrow> 0"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   403
  assumes A: "range A \<subseteq> M" "incseq A" "(\<Union>i. A i) \<in> M"
61969
e01015e49041 more symbols;
wenzelm
parents: 61880
diff changeset
   404
  shows "(\<lambda>i. f (A i)) \<longlonglongrightarrow> f (\<Union>i. A i)"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   405
proof -
61969
e01015e49041 more symbols;
wenzelm
parents: 61880
diff changeset
   406
  from A have "(\<lambda>i. f ((\<Union>i. A i) - A i)) \<longlonglongrightarrow> 0"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   407
    by (intro cont[rule_format]) (auto simp: decseq_def incseq_def)
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   408
  moreover
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   409
  { fix i
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   410
    have "f ((\<Union>i. A i) - A i \<union> A i) = f ((\<Union>i. A i) - A i) + f (A i)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   411
      using A by (intro f(2)[THEN additiveD]) auto
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   412
    also have "((\<Union>i. A i) - A i) \<union> A i = (\<Union>i. A i)"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   413
      by auto
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   414
    finally have "f ((\<Union>i. A i) - A i) = f (\<Union>i. A i) - f (A i)"
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   415
      using assms f by fastforce
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   416
  }
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   417
  moreover have "\<forall>\<^sub>F i in sequentially. f (A i) \<le> f (\<Union>i. A i)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   418
    using increasingD[OF additive_increasing[OF f(1, 2)], of "A _" "\<Union>i. A i"] A
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   419
    by (auto intro!: always_eventually simp: subset_eq)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   420
  ultimately show "(\<lambda>i. f (A i)) \<longlonglongrightarrow> f (\<Union>i. A i)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   421
    by (auto intro: ennreal_tendsto_const_minus)
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   422
qed
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   423
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   424
lemma (in ring_of_sets) empty_continuous_imp_countably_additive:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   425
  fixes f :: "'a set \<Rightarrow> ennreal"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   426
  assumes f: "positive M f" "additive M f" and fin: "\<forall>A\<in>M. f A \<noteq> \<infinity>"
61969
e01015e49041 more symbols;
wenzelm
parents: 61880
diff changeset
   427
  assumes cont: "\<And>A. range A \<subseteq> M \<Longrightarrow> decseq A \<Longrightarrow> (\<Inter>i. A i) = {} \<Longrightarrow> (\<lambda>i. f (A i)) \<longlonglongrightarrow> 0"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   428
  shows "countably_additive M f"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   429
  using countably_additive_iff_continuous_from_below[OF f]
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   430
  using empty_continuous_imp_continuous_from_below[OF f fin] cont
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   431
  by blast
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   432
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
   433
subsection\<^marker>\<open>tag unimportant\<close> \<open>Properties of \<^const>\<open>emeasure\<close>\<close>
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   434
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   435
lemma emeasure_positive: "positive (sets M) (emeasure M)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   436
  by (cases M) (auto simp: sets_def emeasure_def Abs_measure_inverse measure_space_def)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   437
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   438
lemma emeasure_empty[simp, intro]: "emeasure M {} = 0"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   439
  using emeasure_positive[of M] by (simp add: positive_def)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   440
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   441
lemma emeasure_single_in_space: "emeasure M {x} \<noteq> 0 \<Longrightarrow> x \<in> space M"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   442
  using emeasure_notin_sets[of "{x}" M] by (auto dest: sets.sets_into_space zero_less_iff_neq_zero[THEN iffD2])
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   443
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   444
lemma emeasure_countably_additive: "countably_additive (sets M) (emeasure M)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   445
  by (cases M) (auto simp: sets_def emeasure_def Abs_measure_inverse measure_space_def)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   446
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   447
lemma suminf_emeasure:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   448
  "range A \<subseteq> sets M \<Longrightarrow> disjoint_family A \<Longrightarrow> (\<Sum>i. emeasure M (A i)) = emeasure M (\<Union>i. A i)"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   449
  using sets.countable_UN[of A UNIV M] emeasure_countably_additive[of M]
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   450
  by (simp add: countably_additive_def)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   451
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
   452
lemma sums_emeasure:
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
   453
  "disjoint_family F \<Longrightarrow> (\<And>i. F i \<in> sets M) \<Longrightarrow> (\<lambda>i. emeasure M (F i)) sums emeasure M (\<Union>i. F i)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   454
  unfolding sums_iff by (intro conjI suminf_emeasure) auto
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
   455
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   456
lemma emeasure_additive: "additive (sets M) (emeasure M)"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   457
  by (metis sets.countably_additive_additive emeasure_positive emeasure_countably_additive)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   458
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   459
lemma plus_emeasure:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   460
  "a \<in> sets M \<Longrightarrow> b \<in> sets M \<Longrightarrow> a \<inter> b = {} \<Longrightarrow> emeasure M a + emeasure M b = emeasure M (a \<union> b)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   461
  using additiveD[OF emeasure_additive] ..
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   462
70723
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
   463
lemma emeasure_Un:
63968
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
   464
  "A \<in> sets M \<Longrightarrow> B \<in> sets M \<Longrightarrow> emeasure M (A \<union> B) = emeasure M A + emeasure M (B - A)"
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
   465
  using plus_emeasure[of A M "B - A"] by auto
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
   466
70723
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
   467
lemma emeasure_Un_Int:
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
   468
  assumes "A \<in> sets M" "B \<in> sets M"
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
   469
  shows "emeasure M A + emeasure M B = emeasure M (A \<union> B) + emeasure M (A \<inter> B)"
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
   470
proof -
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
   471
  have "A = (A-B) \<union> (A \<inter> B)" by auto
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
   472
  then have "emeasure M A = emeasure M (A-B) + emeasure M (A \<inter> B)"
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
   473
    by (metis Diff_Diff_Int Diff_disjoint assms plus_emeasure sets.Diff)
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
   474
  moreover have "A \<union> B = (A-B) \<union> B" by auto
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
   475
  then have "emeasure M (A \<union> B) = emeasure M (A-B) + emeasure M B"
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
   476
    by (metis Diff_disjoint Int_commute assms plus_emeasure sets.Diff)
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
   477
  ultimately show ?thesis by (metis add.assoc add.commute)
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
   478
qed
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70722
diff changeset
   479
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
   480
lemma sum_emeasure:
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   481
  "F`I \<subseteq> sets M \<Longrightarrow> disjoint_family_on F I \<Longrightarrow> finite I \<Longrightarrow>
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   482
    (\<Sum>i\<in>I. emeasure M (F i)) = emeasure M (\<Union>i\<in>I. F i)"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   483
  by (metis sets.additive_sum emeasure_positive emeasure_additive)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   484
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   485
lemma emeasure_mono:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   486
  "a \<subseteq> b \<Longrightarrow> b \<in> sets M \<Longrightarrow> emeasure M a \<le> emeasure M b"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   487
  by (metis zero_le sets.additive_increasing emeasure_additive emeasure_notin_sets emeasure_positive increasingD)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   488
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   489
lemma emeasure_space:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   490
  "emeasure M A \<le> emeasure M (space M)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   491
  by (metis emeasure_mono emeasure_notin_sets sets.sets_into_space sets.top zero_le)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   492
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   493
lemma emeasure_Diff:
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   494
  assumes \<infinity>: "emeasure M B \<noteq> \<infinity>"
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   495
  and "A \<in> sets M" "B \<in> sets M" and "B \<subseteq> A"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   496
shows "emeasure M (A - B) = emeasure M A - emeasure M B"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   497
proof -
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   498
  have "emeasure M B + emeasure M (A - B) = emeasure M (B \<union> (A-B))"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   499
    by (simp add: assms emeasure_Un)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   500
  also have "... = emeasure M A"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   501
    using Diff_partition \<open>B \<subseteq> A\<close> by fastforce
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   502
  finally show ?thesis
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   503
    by (metis \<infinity> ennreal_add_diff_cancel_left infinity_ennreal_def)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   504
qed
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   505
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   506
lemma emeasure_compl:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   507
  "s \<in> sets M \<Longrightarrow> emeasure M s \<noteq> \<infinity> \<Longrightarrow> emeasure M (space M - s) = emeasure M (space M) - emeasure M s"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   508
  by (simp add: emeasure_Diff sets.sets_into_space)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   509
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   510
lemma Lim_emeasure_incseq:
61969
e01015e49041 more symbols;
wenzelm
parents: 61880
diff changeset
   511
  "range A \<subseteq> sets M \<Longrightarrow> incseq A \<Longrightarrow> (\<lambda>i. (emeasure M (A i))) \<longlonglongrightarrow> emeasure M (\<Union>i. A i)"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   512
  using emeasure_countably_additive
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   513
  by (metis emeasure_additive emeasure_positive sets.countable_UN
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   514
      sets.countably_additive_iff_continuous_from_below)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   515
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   516
lemma incseq_emeasure:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   517
  assumes "range B \<subseteq> sets M" "incseq B"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   518
  shows "incseq (\<lambda>i. emeasure M (B i))"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   519
  using assms by (auto simp: incseq_def intro!: emeasure_mono)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   520
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   521
lemma SUP_emeasure_incseq:
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   522
  assumes A: "range A \<subseteq> sets M" "incseq A"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   523
  shows "(SUP n. emeasure M (A n)) = emeasure M (\<Union>i. A i)"
51000
c9adb50f74ad use order topology for extended reals
hoelzl
parents: 50419
diff changeset
   524
  using LIMSEQ_SUP[OF incseq_emeasure, OF A] Lim_emeasure_incseq[OF A]
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   525
  by (simp add: LIMSEQ_unique)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   526
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   527
lemma decseq_emeasure:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   528
  assumes "range B \<subseteq> sets M" "decseq B"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   529
  shows "decseq (\<lambda>i. emeasure M (B i))"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   530
  using assms by (auto simp: decseq_def intro!: emeasure_mono)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   531
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   532
lemma INF_emeasure_decseq:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   533
  assumes A: "range A \<subseteq> sets M" and "decseq A"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   534
  and finite: "\<And>i. emeasure M (A i) \<noteq> \<infinity>"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   535
  shows "(INF n. emeasure M (A n)) = emeasure M (\<Inter>i. A i)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   536
proof -
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   537
  have le_MI: "emeasure M (\<Inter>i. A i) \<le> emeasure M (A 0)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   538
    using A by (auto intro!: emeasure_mono)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   539
  hence *: "emeasure M (\<Inter>i. A i) \<noteq> \<infinity>" using finite[of 0] by (auto simp: top_unique)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   540
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   541
  have "emeasure M (A 0) - (INF n. emeasure M (A n)) = (SUP n. emeasure M (A 0) - emeasure M (A n))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   542
    by (simp add: ennreal_INF_const_minus)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   543
  also have "\<dots> = (SUP n. emeasure M (A 0 - A n))"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   544
    using A finite \<open>decseq A\<close>[unfolded decseq_def] by (subst emeasure_Diff) auto
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   545
  also have "\<dots> = emeasure M (\<Union>i. A 0 - A i)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   546
  proof (rule SUP_emeasure_incseq)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   547
    show "range (\<lambda>n. A 0 - A n) \<subseteq> sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   548
      using A by auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   549
    show "incseq (\<lambda>n. A 0 - A n)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   550
      using \<open>decseq A\<close> by (auto simp: incseq_def decseq_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   551
  qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   552
  also have "\<dots> = emeasure M (A 0) - emeasure M (\<Inter>i. A i)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   553
    using A finite * by (simp, subst emeasure_Diff) auto
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   554
  finally have "emeasure M (A 0) - (INF n. emeasure M (A n)) =
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   555
                emeasure M (A 0) - emeasure M (\<Inter> (range A))" .
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   556
  then show ?thesis
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   557
    by (metis Inf_lower ennreal_minus_cancel infinity_ennreal_def le_MI local.finite
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   558
        range_eqI)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   559
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   560
63940
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   561
lemma INF_emeasure_decseq':
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   562
  assumes A: "\<And>i. A i \<in> sets M" and "decseq A"
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   563
  and finite: "\<exists>i. emeasure M (A i) \<noteq> \<infinity>"
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   564
  shows "(INF n. emeasure M (A n)) = emeasure M (\<Inter>i. A i)"
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   565
proof -
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   566
  from finite obtain i where i: "emeasure M (A i) < \<infinity>"
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   567
    by (auto simp: less_top)
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   568
  have fin: "i \<le> j \<Longrightarrow> emeasure M (A j) < \<infinity>" for j
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   569
    by (rule le_less_trans[OF emeasure_mono i]) (auto intro!: decseqD[OF \<open>decseq A\<close>] A)
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   570
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   571
  have "(INF n. emeasure M (A n)) = (INF n. emeasure M (A (n + i)))"
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   572
  proof (rule INF_eq)
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   573
    show "\<exists>j\<in>UNIV. emeasure M (A (j + i)) \<le> emeasure M (A i')" for i'
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
   574
      by (meson A \<open>decseq A\<close> decseq_def emeasure_mono iso_tuple_UNIV_I nat_le_iff_add)
63940
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   575
  qed auto
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   576
  also have "\<dots> = emeasure M (INF n. (A (n + i)))"
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   577
    using A \<open>decseq A\<close> fin by (intro INF_emeasure_decseq) (auto simp: decseq_def less_top)
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   578
  also have "(INF n. (A (n + i))) = (INF n. A n)"
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   579
    by (meson INF_eq UNIV_I assms(2) decseqD le_add1)
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   580
  finally show ?thesis .
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   581
qed
0d82c4c94014 prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents: 63658
diff changeset
   582
61359
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   583
lemma emeasure_INT_decseq_subset:
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   584
  fixes F :: "nat \<Rightarrow> 'a set"
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   585
  assumes I: "I \<noteq> {}" and F: "\<And>i j. i \<in> I \<Longrightarrow> j \<in> I \<Longrightarrow> i \<le> j \<Longrightarrow> F j \<subseteq> F i"
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   586
  assumes F_sets[measurable]: "\<And>i. i \<in> I \<Longrightarrow> F i \<in> sets M"
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   587
    and fin: "\<And>i. i \<in> I \<Longrightarrow> emeasure M (F i) \<noteq> \<infinity>"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
   588
  shows "emeasure M (\<Inter>i\<in>I. F i) = (INF i\<in>I. emeasure M (F i))"
61359
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   589
proof cases
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   590
  assume "finite I"
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   591
  have "(\<Inter>i\<in>I. F i) = F (Max I)"
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   592
    using I \<open>finite I\<close> by (intro antisym INF_lower INF_greatest F) auto
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
   593
  moreover have "(INF i\<in>I. emeasure M (F i)) = emeasure M (F (Max I))"
61359
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   594
    using I \<open>finite I\<close> by (intro antisym INF_lower INF_greatest F emeasure_mono) auto
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   595
  ultimately show ?thesis
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   596
    by simp
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   597
next
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   598
  assume "infinite I"
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 62975
diff changeset
   599
  define L where "L n = (LEAST i. i \<in> I \<and> i \<ge> n)" for n
61359
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   600
  have L: "L n \<in> I \<and> n \<le> L n" for n
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   601
    unfolding L_def
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   602
  proof (rule LeastI_ex)
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   603
    show "\<exists>x. x \<in> I \<and> n \<le> x"
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   604
      using \<open>infinite I\<close> finite_subset[of I "{..< n}"]
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   605
      by (rule_tac ccontr) (auto simp: not_le)
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   606
  qed
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   607
  have L_eq[simp]: "i \<in> I \<Longrightarrow> L i = i" for i
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   608
    unfolding L_def by (intro Least_equality) auto
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   609
  have L_mono: "i \<le> j \<Longrightarrow> L i \<le> L j" for i j
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   610
    using L[of j] unfolding L_def by (intro Least_le) (auto simp: L_def)
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   611
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   612
  have "emeasure M (\<Inter>i. F (L i)) = (INF i. emeasure M (F (L i)))"
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   613
  proof (intro INF_emeasure_decseq[symmetric])
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   614
    show "decseq (\<lambda>i. F (L i))"
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   615
      using L by (intro antimonoI F L_mono) auto
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   616
  qed (use L fin in auto)
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
   617
  also have "\<dots> = (INF i\<in>I. emeasure M (F i))"
61359
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   618
  proof (intro antisym INF_greatest)
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   619
    show "i \<in> I \<Longrightarrow> (INF i. emeasure M (F (L i))) \<le> emeasure M (F i)" for i
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   620
      by (intro INF_lower2[of i]) auto
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   621
  qed (use L in \<open>auto intro: INF_lower\<close>)
61359
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   622
  also have "(\<Inter>i. F (L i)) = (\<Inter>i\<in>I. F i)"
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   623
  proof (intro antisym INF_greatest)
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   624
    show "i \<in> I \<Longrightarrow> (\<Inter>i. F (L i)) \<subseteq> F i" for i
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   625
      by (metis Inf_lower L_eq rangeI)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   626
  qed (use L in auto)
61359
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   627
  finally show ?thesis .
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   628
qed
e985b52c3eb3 cleanup projective limit of probability distributions; proved Ionescu-Tulcea; used it to prove infinite prob. distribution
hoelzl
parents: 61166
diff changeset
   629
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   630
lemma Lim_emeasure_decseq:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   631
  assumes A: "range A \<subseteq> sets M" "decseq A" and fin: "\<And>i. emeasure M (A i) \<noteq> \<infinity>"
61969
e01015e49041 more symbols;
wenzelm
parents: 61880
diff changeset
   632
  shows "(\<lambda>i. emeasure M (A i)) \<longlonglongrightarrow> emeasure M (\<Inter>i. A i)"
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51000
diff changeset
   633
  using LIMSEQ_INF[OF decseq_emeasure, OF A]
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   634
  using INF_emeasure_decseq[OF A fin] by simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   635
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
   636
lemma emeasure_lfp'[consumes 1, case_names cont measurable]:
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   637
  assumes "P M"
60172
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 60142
diff changeset
   638
  assumes cont: "sup_continuous F"
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   639
  assumes *: "\<And>M A. P M \<Longrightarrow> (\<And>N. P N \<Longrightarrow> Measurable.pred N A) \<Longrightarrow> Measurable.pred M (F A)"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   640
  shows "emeasure M {x\<in>space M. lfp F x} = (SUP i. emeasure M {x\<in>space M. (F ^^ i) (\<lambda>x. False) x})"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   641
proof -
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   642
  have "emeasure M {x\<in>space M. lfp F x} = emeasure M (\<Union>i. {x\<in>space M. (F ^^ i) (\<lambda>x. False) x})"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   643
    using sup_continuous_lfp[OF cont] by (auto simp: bot_fun_def intro!: arg_cong2[where f=emeasure])
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   644
  moreover { fix i from \<open>P M\<close> have "{x\<in>space M. (F ^^ i) (\<lambda>x. False) x} \<in> sets M"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   645
    by (induct i arbitrary: M) (auto simp: pred_def[symmetric] intro: *) }
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   646
  moreover have "incseq (\<lambda>i. {x\<in>space M. (F ^^ i) (\<lambda>x. False) x})"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   647
  proof (rule incseq_SucI)
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   648
    fix i
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   649
    have "(F ^^ i) (\<lambda>x. False) \<le> (F ^^ (Suc i)) (\<lambda>x. False)"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   650
    proof (induct i)
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   651
      case 0 show ?case by (simp add: le_fun_def)
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   652
    next
60172
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 60142
diff changeset
   653
      case Suc thus ?case using monoD[OF sup_continuous_mono[OF cont] Suc] by auto
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   654
    qed
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   655
    then show "{x \<in> space M. (F ^^ i) (\<lambda>x. False) x} \<subseteq> {x \<in> space M. (F ^^ Suc i) (\<lambda>x. False) x}"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   656
      by auto
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   657
  qed
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   658
  ultimately show ?thesis
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   659
    by (subst SUP_emeasure_incseq) auto
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   660
qed
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   661
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
   662
lemma emeasure_lfp:
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
   663
  assumes [simp]: "\<And>s. sets (M s) = sets N"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
   664
  assumes cont: "sup_continuous F" "sup_continuous f"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
   665
  assumes meas: "\<And>P. Measurable.pred N P \<Longrightarrow> Measurable.pred N (F P)"
60714
ff8aa76d6d1c stronger induction assumption in lfp_transfer and emeasure_lfp
hoelzl
parents: 60636
diff changeset
   666
  assumes iter: "\<And>P s. Measurable.pred N P \<Longrightarrow> P \<le> lfp F \<Longrightarrow> emeasure (M s) {x\<in>space N. F P x} = f (\<lambda>s. emeasure (M s) {x\<in>space N. P x}) s"
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
   667
  shows "emeasure (M s) {x\<in>space N. lfp F x} = lfp f s"
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
   668
proof (subst lfp_transfer_bounded[where \<alpha>="\<lambda>F s. emeasure (M s) {x\<in>space N. F x}" and f=F , symmetric])
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
   669
  fix C assume "incseq C" "\<And>i. Measurable.pred N (C i)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
   670
  then show "(\<lambda>s. emeasure (M s) {x \<in> space N. (SUP i. C i) x}) = (SUP i. (\<lambda>s. emeasure (M s) {x \<in> space N. C i x}))"
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
   671
    unfolding SUP_apply
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
   672
    by (subst SUP_emeasure_incseq) (auto simp: mono_def fun_eq_iff intro!: arg_cong2[where f=emeasure])
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   673
qed (auto simp: iter le_fun_def SUP_apply intro!: meas cont)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   674
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   675
lemma emeasure_subadditive_finite:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   676
  "finite I \<Longrightarrow> A ` I \<subseteq> sets M \<Longrightarrow> emeasure M (\<Union>i\<in>I. A i) \<le> (\<Sum>i\<in>I. emeasure M (A i))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   677
  by (rule sets.subadditive[OF emeasure_positive emeasure_additive]) auto
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   678
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   679
lemma emeasure_subadditive:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   680
  "A \<in> sets M \<Longrightarrow> B \<in> sets M \<Longrightarrow> emeasure M (A \<union> B) \<le> emeasure M A + emeasure M B"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   681
  using emeasure_subadditive_finite[of "{True, False}" "\<lambda>True \<Rightarrow> A | False \<Rightarrow> B" M] by simp
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   682
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   683
lemma emeasure_subadditive_countably:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   684
  assumes "range f \<subseteq> sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   685
  shows "emeasure M (\<Union>i. f i) \<le> (\<Sum>i. emeasure M (f i))"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   686
proof -
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   687
  have "emeasure M (\<Union>i. f i) = emeasure M (\<Union>i. disjointed f i)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   688
    unfolding UN_disjointed_eq ..
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   689
  also have "\<dots> = (\<Sum>i. emeasure M (disjointed f i))"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   690
    using sets.range_disjointed_sets[OF assms] suminf_emeasure[of "disjointed f"]
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   691
    by (simp add:  disjoint_family_disjointed comp_def)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   692
  also have "\<dots> \<le> (\<Sum>i. emeasure M (f i))"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   693
    using sets.range_disjointed_sets[OF assms] assms
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   694
    by (auto intro!: suminf_le emeasure_mono disjointed_subset)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   695
  finally show ?thesis .
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   696
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   697
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   698
lemma emeasure_insert:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   699
  assumes sets: "{x} \<in> sets M" "A \<in> sets M" and "x \<notin> A"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   700
  shows "emeasure M (insert x A) = emeasure M {x} + emeasure M A"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   701
proof -
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   702
  have "{x} \<inter> A = {}" using \<open>x \<notin> A\<close> by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   703
  from plus_emeasure[OF sets this] show ?thesis by simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   704
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   705
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
   706
lemma emeasure_insert_ne:
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
   707
  "A \<noteq> {} \<Longrightarrow> {x} \<in> sets M \<Longrightarrow> A \<in> sets M \<Longrightarrow> x \<notin> A \<Longrightarrow> emeasure M (insert x A) = emeasure M {x} + emeasure M A"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
   708
  by (rule emeasure_insert)
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
   709
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
   710
lemma emeasure_eq_sum_singleton:
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   711
  assumes "finite S" "\<And>x. x \<in> S \<Longrightarrow> {x} \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   712
  shows "emeasure M S = (\<Sum>x\<in>S. emeasure M {x})"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
   713
  using sum_emeasure[of "\<lambda>x. {x}" S M] assms
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   714
  by (auto simp: disjoint_family_on_def subset_eq)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   715
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
   716
lemma sum_emeasure_cover:
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   717
  assumes "finite S" and "A \<in> sets M" and br_in_M: "B ` S \<subseteq> sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   718
  assumes A: "A \<subseteq> (\<Union>i\<in>S. B i)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   719
  assumes disj: "disjoint_family_on B S"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   720
  shows "emeasure M A = (\<Sum>i\<in>S. emeasure M (A \<inter> (B i)))"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   721
proof -
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   722
  have "(\<Sum>i\<in>S. emeasure M (A \<inter> (B i))) = emeasure M (\<Union>i\<in>S. A \<inter> (B i))"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
   723
  proof (rule sum_emeasure)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   724
    show "disjoint_family_on (\<lambda>i. A \<inter> B i) S"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   725
      using \<open>disjoint_family_on B S\<close>
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   726
      unfolding disjoint_family_on_def by auto
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   727
  qed (use assms in auto)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   728
  also have "(\<Union>i\<in>S. A \<inter> (B i)) = A"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   729
    using A by auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   730
  finally show ?thesis by simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   731
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   732
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   733
lemma emeasure_eq_0:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   734
  "N \<in> sets M \<Longrightarrow> emeasure M N = 0 \<Longrightarrow> K \<subseteq> N \<Longrightarrow> emeasure M K = 0"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   735
  by (metis emeasure_mono order_eq_iff zero_le)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   736
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   737
lemma emeasure_UN_eq_0:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   738
  assumes "\<And>i::nat. emeasure M (N i) = 0" and "range N \<subseteq> sets M"
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60580
diff changeset
   739
  shows "emeasure M (\<Union>i. N i) = 0"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   740
proof -
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   741
  have "emeasure M (\<Union>i. N i) \<le> 0"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   742
    using emeasure_subadditive_countably[OF assms(2)] assms(1) by simp
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   743
  then show ?thesis
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   744
    by (auto intro: antisym zero_le)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   745
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   746
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   747
lemma measure_eqI_finite:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   748
  assumes [simp]: "sets M = Pow A" "sets N = Pow A" and "finite A"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   749
  assumes eq: "\<And>a. a \<in> A \<Longrightarrow> emeasure M {a} = emeasure N {a}"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   750
  shows "M = N"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   751
proof (rule measure_eqI)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   752
  fix X assume "X \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   753
  then have X: "X \<subseteq> A" by auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   754
  then have "emeasure M X = (\<Sum>a\<in>X. emeasure M {a})"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
   755
    using \<open>finite A\<close> by (subst emeasure_eq_sum_singleton) (auto dest: finite_subset)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   756
  also have "\<dots> = (\<Sum>a\<in>X. emeasure N {a})"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
   757
    using X eq by (auto intro!: sum.cong)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   758
  also have "\<dots> = emeasure N X"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
   759
    using X \<open>finite A\<close> by (subst emeasure_eq_sum_singleton) (auto dest: finite_subset)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   760
  finally show "emeasure M X = emeasure N X" .
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   761
qed simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   762
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   763
lemma measure_eqI_generator_eq:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   764
  fixes M N :: "'a measure" and E :: "'a set set" and A :: "nat \<Rightarrow> 'a set"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   765
  assumes "Int_stable E" "E \<subseteq> Pow \<Omega>"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   766
  and eq: "\<And>X. X \<in> E \<Longrightarrow> emeasure M X = emeasure N X"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   767
  and M: "sets M = sigma_sets \<Omega> E"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   768
  and N: "sets N = sigma_sets \<Omega> E"
49784
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49773
diff changeset
   769
  and A: "range A \<subseteq> E" "(\<Union>i. A i) = \<Omega>" "\<And>i. emeasure M (A i) \<noteq> \<infinity>"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   770
  shows "M = N"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   771
proof -
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   772
  let ?\<mu>  = "emeasure M" and ?\<nu> = "emeasure N"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   773
  interpret S: sigma_algebra \<Omega> "sigma_sets \<Omega> E" by (rule sigma_algebra_sigma_sets) fact
49789
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   774
  have "space M = \<Omega>"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   775
    using sets.top[of M] sets.space_closed[of M] S.top S.space_closed \<open>sets M = sigma_sets \<Omega> E\<close>
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   776
    by blast
49789
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   777
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   778
  have *: "emeasure M (F \<inter> D) = emeasure N (F \<inter> D)"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   779
    if "F \<in> E" and "?\<mu> F \<noteq> \<infinity>" and D: "D \<in> sets M" for F D
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   780
  proof -
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   781
    have [intro]: "F \<in> sigma_sets \<Omega> E"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   782
      using that by auto
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   783
    have "?\<nu> F \<noteq> \<infinity>" using \<open>?\<mu> F \<noteq> \<infinity>\<close> \<open>F \<in> E\<close> eq by simp
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   784
    from \<open>Int_stable E\<close> \<open>E \<subseteq> Pow \<Omega>\<close> D show ?thesis
49789
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   785
      unfolding M
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   786
    proof (induct rule: sigma_sets_induct_disjoint)
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   787
      case (basic A)
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   788
      then have "F \<inter> A \<in> E" using \<open>Int_stable E\<close> \<open>F \<in> E\<close> by (auto simp: Int_stable_def)
49789
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   789
      then show ?case using eq by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   790
    next
49789
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   791
      case empty then show ?case by simp
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   792
    next
49789
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   793
      case (compl A)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   794
      then have **: "F \<inter> (\<Omega> - A) = F - (F \<inter> A)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   795
        and [intro]: "F \<inter> A \<in> sigma_sets \<Omega> E"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   796
        using \<open>F \<in> E\<close> S.sets_into_space by (auto simp: M)
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   797
      have "?\<nu> (F \<inter> A) \<le> ?\<nu> F" by (auto intro!: emeasure_mono simp: M N)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   798
      then have "?\<nu> (F \<inter> A) \<noteq> \<infinity>" using \<open>?\<nu> F \<noteq> \<infinity>\<close> by (auto simp: top_unique)
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   799
      have "?\<mu> (F \<inter> A) \<le> ?\<mu> F" by (auto intro!: emeasure_mono simp: M N)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   800
      then have "?\<mu> (F \<inter> A) \<noteq> \<infinity>" using \<open>?\<mu> F \<noteq> \<infinity>\<close> by (auto simp: top_unique)
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   801
      then have "?\<mu> (F \<inter> (\<Omega> - A)) = ?\<mu> F - ?\<mu> (F \<inter> A)" unfolding **
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   802
        using \<open>F \<inter> A \<in> sigma_sets \<Omega> E\<close> by (auto intro!: emeasure_Diff simp: M N)
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   803
      also have "\<dots> = ?\<nu> F - ?\<nu> (F \<inter> A)" using eq \<open>F \<in> E\<close> compl by simp
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   804
      also have "\<dots> = ?\<nu> (F \<inter> (\<Omega> - A))" unfolding **
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   805
        using \<open>F \<inter> A \<in> sigma_sets \<Omega> E\<close> \<open>?\<nu> (F \<inter> A) \<noteq> \<infinity>\<close>
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   806
        by (auto intro!: emeasure_Diff[symmetric] simp: M N)
49789
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   807
      finally show ?case
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   808
        using \<open>space M = \<Omega>\<close> by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   809
    next
49789
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   810
      case (union A)
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   811
      then have "?\<mu> (\<Union>x. F \<inter> A x) = ?\<nu> (\<Union>x. F \<inter> A x)"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   812
        by (subst (1 2) suminf_emeasure[symmetric]) (auto simp: disjoint_family_on_def subset_eq M N)
49789
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   813
      with A show ?case
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   814
        by auto
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   815
    qed 
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   816
  qed
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   817
  show "M = N"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   818
  proof (rule measure_eqI)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   819
    show "sets M = sets N"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   820
      using M N by simp
49784
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49773
diff changeset
   821
    have [simp, intro]: "\<And>i. A i \<in> sets M"
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49773
diff changeset
   822
      using A(1) by (auto simp: subset_eq M)
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
   823
    fix F assume "F \<in> sets M"
49784
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49773
diff changeset
   824
    let ?D = "disjointed (\<lambda>i. F \<inter> A i)"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   825
    from \<open>space M = \<Omega>\<close> have F_eq: "F = (\<Union>i. ?D i)"
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   826
      using \<open>F \<in> sets M\<close>[THEN sets.sets_into_space] A(2)[symmetric] by (auto simp: UN_disjointed_eq)
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   827
    have DinM[simp]: "\<And>i. ?D i \<in> sets M"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   828
      using sets.range_disjointed_sets[of "\<lambda>i. F \<inter> A i" M] \<open>F \<in> sets M\<close>
49784
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49773
diff changeset
   829
      by (auto simp: subset_eq)
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49773
diff changeset
   830
    have "disjoint_family ?D"
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49773
diff changeset
   831
      by (auto simp: disjoint_family_disjointed)
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 50001
diff changeset
   832
    moreover
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 50001
diff changeset
   833
    have "(\<Sum>i. emeasure M (?D i)) = (\<Sum>i. emeasure N (?D i))"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 50001
diff changeset
   834
    proof (intro arg_cong[where f=suminf] ext)
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 50001
diff changeset
   835
      fix i
49784
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49773
diff changeset
   836
      have "A i \<inter> ?D i = ?D i"
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49773
diff changeset
   837
        by (auto simp: disjointed_def)
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   838
      with A show "emeasure M (?D i) = emeasure N (?D i)"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   839
        by (metis "*" DinM range_subsetD)
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 50001
diff changeset
   840
    qed
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 50001
diff changeset
   841
    ultimately show "emeasure M F = emeasure N F"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   842
      by (metis DinM F_eq \<open>sets M = sets N\<close> image_subset_iff suminf_emeasure)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   843
  qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   844
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   845
64008
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   846
lemma space_empty: "space M = {} \<Longrightarrow> M = count_space {}"
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   847
  by (rule measure_eqI) (simp_all add: space_empty_iff)
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   848
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   849
lemma measure_eqI_generator_eq_countable:
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   850
  fixes M N :: "'a measure" and E :: "'a set set" and A :: "'a set set"
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   851
  assumes E: "Int_stable E" "E \<subseteq> Pow \<Omega>" "\<And>X. X \<in> E \<Longrightarrow> emeasure M X = emeasure N X"
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   852
    and sets: "sets M = sigma_sets \<Omega> E" "sets N = sigma_sets \<Omega> E"
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   853
  and A: "A \<subseteq> E" "(\<Union>A) = \<Omega>" "countable A" "\<And>a. a \<in> A \<Longrightarrow> emeasure M a \<noteq> \<infinity>"
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   854
  shows "M = N"
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   855
proof cases
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   856
  assume "\<Omega> = {}"
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   857
  have *: "sigma_sets \<Omega> E = sets (sigma \<Omega> E)"
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   858
    using E(2) by simp
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   859
  obtain "space M = \<Omega>" "space N = \<Omega>"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   860
    by (simp add: "*" sets sets_eq_imp_space_eq space_measure_of_conv)
64008
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   861
  then show "M = N"
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   862
    unfolding \<open>\<Omega> = {}\<close> by (auto dest: space_empty)
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   863
next
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   864
  assume "\<Omega> \<noteq> {}" with \<open>\<Union>A = \<Omega>\<close> have "A \<noteq> {}" by auto
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   865
  from this \<open>countable A\<close> have rng: "range (from_nat_into A) = A"
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   866
    by (rule range_from_nat_into)
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   867
  show "M = N"
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   868
  proof (rule measure_eqI_generator_eq[OF E sets])
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   869
    show "range (from_nat_into A) \<subseteq> E"
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   870
      unfolding rng using \<open>A \<subseteq> E\<close> .
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   871
    show "(\<Union>i. from_nat_into A i) = \<Omega>"
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   872
      unfolding rng using \<open>\<Union>A = \<Omega>\<close> .
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   873
    show "emeasure M (from_nat_into A i) \<noteq> \<infinity>" for i
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   874
      using rng by (intro A) auto
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   875
  qed
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   876
qed
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
   877
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   878
lemma measure_of_of_measure: "measure_of (space M) (sets M) (emeasure M) = M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   879
proof (intro measure_eqI emeasure_measure_of_sigma)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   880
  show "sigma_algebra (space M) (sets M)" ..
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   881
  show "positive (sets M) (emeasure M)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   882
    by (simp add: positive_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   883
  show "countably_additive (sets M) (emeasure M)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   884
    by (simp add: emeasure_countably_additive)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   885
qed simp_all
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   886
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   887
subsection \<open>\<open>\<mu>\<close>-null sets\<close>
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   888
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
   889
definition\<^marker>\<open>tag important\<close> null_sets :: "'a measure \<Rightarrow> 'a set set" where
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   890
  "null_sets M = {N\<in>sets M. emeasure M N = 0}"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   891
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   892
lemma null_setsD1[dest]: "A \<in> null_sets M \<Longrightarrow> emeasure M A = 0"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   893
  by (simp add: null_sets_def)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   894
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   895
lemma null_setsD2[dest]: "A \<in> null_sets M \<Longrightarrow> A \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   896
  unfolding null_sets_def by simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   897
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   898
lemma null_setsI[intro]: "emeasure M A = 0 \<Longrightarrow> A \<in> sets M \<Longrightarrow> A \<in> null_sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   899
  unfolding null_sets_def by simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   900
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   901
interpretation null_sets: ring_of_sets "space M" "null_sets M" for M
47762
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47761
diff changeset
   902
proof (rule ring_of_setsI)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   903
  show "null_sets M \<subseteq> Pow (space M)"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   904
    using sets.sets_into_space by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   905
  show "{} \<in> null_sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   906
    by auto
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 51351
diff changeset
   907
  fix A B assume null_sets: "A \<in> null_sets M" "B \<in> null_sets M"
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 51351
diff changeset
   908
  then have sets: "A \<in> sets M" "B \<in> sets M"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   909
    by auto
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 51351
diff changeset
   910
  then have *: "emeasure M (A \<union> B) \<le> emeasure M A + emeasure M B"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   911
    "emeasure M (A - B) \<le> emeasure M A"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   912
    by (auto intro!: emeasure_subadditive emeasure_mono)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 51351
diff changeset
   913
  then have "emeasure M B = 0" "emeasure M A = 0"
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 51351
diff changeset
   914
    using null_sets by auto
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 51351
diff changeset
   915
  with sets * show "A - B \<in> null_sets M" "A \<union> B \<in> null_sets M"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   916
    by (auto intro!: antisym zero_le)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   917
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   918
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
   919
lemma UN_from_nat_into:
57275
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   920
  assumes I: "countable I" "I \<noteq> {}"
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   921
  shows "(\<Union>i\<in>I. N i) = (\<Union>i. N (from_nat_into I i))"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   922
  using assms  by (simp add: UN_extend_simps)
57275
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   923
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   924
lemma null_sets_UN':
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   925
  assumes "countable I"
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   926
  assumes "\<And>i. i \<in> I \<Longrightarrow> N i \<in> null_sets M"
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   927
  shows "(\<Union>i\<in>I. N i) \<in> null_sets M"
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   928
proof cases
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   929
  assume "I = {}" then show ?thesis by simp
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   930
next
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   931
  assume "I \<noteq> {}"
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   932
  show ?thesis
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   933
  proof (intro conjI CollectI null_setsI)
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   934
    show "(\<Union>i\<in>I. N i) \<in> sets M"
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   935
      using assms by (intro sets.countable_UN') auto
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   936
    have "emeasure M (\<Union>i\<in>I. N i) \<le> (\<Sum>n. emeasure M (N (from_nat_into I n)))"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   937
      unfolding UN_from_nat_into[OF \<open>countable I\<close> \<open>I \<noteq> {}\<close>]
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   938
      using assms \<open>I \<noteq> {}\<close> by (intro emeasure_subadditive_countably) (auto intro: from_nat_into)
57275
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   939
    also have "(\<lambda>n. emeasure M (N (from_nat_into I n))) = (\<lambda>_. 0)"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
   940
      using assms \<open>I \<noteq> {}\<close> by (auto intro: from_nat_into)
57275
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   941
    finally show "emeasure M (\<Union>i\<in>I. N i) = 0"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
   942
      by (intro antisym zero_le) simp
57275
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   943
  qed
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   944
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   945
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   946
lemma null_sets_UN[intro]:
57275
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   947
  "(\<And>i::'i::countable. N i \<in> null_sets M) \<Longrightarrow> (\<Union>i. N i) \<in> null_sets M"
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
   948
  by (rule null_sets_UN') auto
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   949
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   950
lemma null_set_Int1:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   951
  assumes "B \<in> null_sets M" "A \<in> sets M" shows "A \<inter> B \<in> null_sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   952
proof (intro CollectI conjI null_setsI)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   953
  show "emeasure M (A \<inter> B) = 0" using assms
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   954
    by (intro emeasure_eq_0[of B _ "A \<inter> B"]) auto
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   955
qed (use assms in auto)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   956
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   957
lemma null_set_Int2:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   958
  assumes "B \<in> null_sets M" "A \<in> sets M" shows "B \<inter> A \<in> null_sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   959
  using assms by (subst Int_commute) (rule null_set_Int1)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   960
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   961
lemma emeasure_Diff_null_set:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   962
  assumes "B \<in> null_sets M" "A \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   963
  shows "emeasure M (A - B) = emeasure M A"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   964
proof -
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   965
  have *: "A - B = (A - (A \<inter> B))" by auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   966
  have "A \<inter> B \<in> null_sets M" using assms by (rule null_set_Int1)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   967
  then show ?thesis
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   968
    unfolding * using assms
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   969
    by (subst emeasure_Diff) auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   970
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   971
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   972
lemma null_set_Diff:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   973
  assumes "B \<in> null_sets M" "A \<in> sets M" shows "B - A \<in> null_sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   974
proof (intro CollectI conjI null_setsI)
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   975
  show "emeasure M (B - A) = 0" 
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   976
    using assms by (intro emeasure_eq_0[of B _ "B - A"]) auto
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   977
qed (use assms in auto)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   978
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   979
lemma emeasure_Un_null_set:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   980
  assumes "A \<in> sets M" "B \<in> null_sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   981
  shows "emeasure M (A \<union> B) = emeasure M A"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   982
proof -
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   983
  have *: "A \<union> B = A \<union> (B - A)" by auto
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   984
  have "B - A \<in> null_sets M" using assms
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
   985
    using null_set_Diff by blast
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   986
  then show ?thesis
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   987
    unfolding * using assms
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   988
    by (subst plus_emeasure[symmetric]) auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   989
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
   990
70722
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70614
diff changeset
   991
lemma emeasure_Un':
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70614
diff changeset
   992
  assumes "A \<in> sets M" "B \<in> sets M" "A \<inter> B \<in> null_sets M"
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70614
diff changeset
   993
  shows   "emeasure M (A \<union> B) = emeasure M A + emeasure M B"
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70614
diff changeset
   994
proof -
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70614
diff changeset
   995
  have "A \<union> B = A \<union> (B - A \<inter> B)" by blast
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70614
diff changeset
   996
  also have "emeasure M \<dots> = emeasure M A + emeasure M (B - A \<inter> B)"
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70614
diff changeset
   997
    using assms by (subst plus_emeasure) auto
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70614
diff changeset
   998
  also have "emeasure M (B - A \<inter> B) = emeasure M B"
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70614
diff changeset
   999
    using assms by (intro emeasure_Diff_null_set) auto
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70614
diff changeset
  1000
  finally show ?thesis .
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70614
diff changeset
  1001
qed
ae2528273eeb A couple of new theorems, stolen from AFP entries
paulson <lp15@cam.ac.uk>
parents: 70614
diff changeset
  1002
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1003
subsection \<open>The almost everywhere filter (i.e.\ quantifier)\<close>
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1004
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  1005
definition\<^marker>\<open>tag important\<close> ae_filter :: "'a measure \<Rightarrow> 'a filter" where
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  1006
  "ae_filter M = (INF N\<in>null_sets M. principal (space M - N))"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1007
57276
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
  1008
abbreviation almost_everywhere :: "'a measure \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> bool" where
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1009
  "almost_everywhere M P \<equiv> eventually P (ae_filter M)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1010
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1011
syntax
81142
6ad2c917dd2e more inner-syntax markup;
wenzelm
parents: 80914
diff changeset
  1012
  "_almost_everywhere" :: "pttrn \<Rightarrow> 'a \<Rightarrow> bool \<Rightarrow> bool"
6ad2c917dd2e more inner-syntax markup;
wenzelm
parents: 80914
diff changeset
  1013
    (\<open>(\<open>open_block notation=\<open>binder AE\<close>\<close>AE _ in _. _)\<close> [0,0,10] 10)
80768
c7723cc15de8 more markup for syntax consts;
wenzelm
parents: 78093
diff changeset
  1014
syntax_consts
c7723cc15de8 more markup for syntax consts;
wenzelm
parents: 78093
diff changeset
  1015
  "_almost_everywhere" \<rightleftharpoons> almost_everywhere
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1016
translations
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1017
  "AE x in M. P" \<rightleftharpoons> "CONST almost_everywhere M (\<lambda>x. P)"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1018
63958
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1019
abbreviation
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1020
  "set_almost_everywhere A M P \<equiv> AE x in M. x \<in> A \<longrightarrow> P x"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1021
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1022
syntax
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1023
  "_set_almost_everywhere" :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'a \<Rightarrow> bool \<Rightarrow> bool"
81142
6ad2c917dd2e more inner-syntax markup;
wenzelm
parents: 80914
diff changeset
  1024
    (\<open>(\<open>open_block notation=\<open>binder AE\<close>\<close>AE _\<in>_ in _./ _)\<close> [0,0,0,10] 10)
80768
c7723cc15de8 more markup for syntax consts;
wenzelm
parents: 78093
diff changeset
  1025
syntax_consts
c7723cc15de8 more markup for syntax consts;
wenzelm
parents: 78093
diff changeset
  1026
  "_set_almost_everywhere" \<rightleftharpoons> set_almost_everywhere
63958
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1027
translations
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1028
  "AE x\<in>A in M. P" \<rightleftharpoons> "CONST set_almost_everywhere A M (\<lambda>x. P)"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1029
57276
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
  1030
lemma eventually_ae_filter: "eventually P (ae_filter M) \<longleftrightarrow> (\<exists>N\<in>null_sets M. {x \<in> space M. \<not> P x} \<subseteq> N)"
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
  1031
  unfolding ae_filter_def by (subst eventually_INF_base) (auto simp: eventually_principal subset_eq)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1032
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1033
lemma AE_I':
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1034
  "N \<in> null_sets M \<Longrightarrow> {x\<in>space M. \<not> P x} \<subseteq> N \<Longrightarrow> (AE x in M. P x)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1035
  unfolding eventually_ae_filter by auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1036
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1037
lemma AE_iff_null:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1038
  assumes "{x\<in>space M. \<not> P x} \<in> sets M" (is "?P \<in> sets M")
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1039
  shows "(AE x in M. P x) \<longleftrightarrow> {x\<in>space M. \<not> P x} \<in> null_sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1040
proof
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1041
  assume "AE x in M. P x" then obtain N where N: "N \<in> sets M" "?P \<subseteq> N" "emeasure M N = 0"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1042
    unfolding eventually_ae_filter by auto
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1043
  then have "emeasure M ?P \<le> emeasure M N" 
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1044
    using emeasure_mono by blast
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1045
  then have "emeasure M ?P = 0"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1046
    unfolding \<open>emeasure M N = 0\<close> by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1047
  then show "?P \<in> null_sets M" using assms by auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1048
next
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1049
  assume "?P \<in> null_sets M" with assms show "AE x in M. P x" by (auto intro: AE_I')
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1050
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1051
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1052
lemma AE_iff_null_sets:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1053
  "N \<in> sets M \<Longrightarrow> N \<in> null_sets M \<longleftrightarrow> (AE x in M. x \<notin> N)"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
  1054
  using Int_absorb1[OF sets.sets_into_space, of N M]
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1055
  by (subst AE_iff_null) (auto simp: Int_def[symmetric])
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1056
77179
6d2ca97a8f46 More of Manuel's material, and some changes
paulson <lp15@cam.ac.uk>
parents: 76835
diff changeset
  1057
lemma ae_filter_eq_bot_iff: "ae_filter M = bot \<longleftrightarrow> emeasure M (space M) = 0"
6d2ca97a8f46 More of Manuel's material, and some changes
paulson <lp15@cam.ac.uk>
parents: 76835
diff changeset
  1058
proof -
6d2ca97a8f46 More of Manuel's material, and some changes
paulson <lp15@cam.ac.uk>
parents: 76835
diff changeset
  1059
  have "ae_filter M = bot \<longleftrightarrow> (AE x in M. False)"
6d2ca97a8f46 More of Manuel's material, and some changes
paulson <lp15@cam.ac.uk>
parents: 76835
diff changeset
  1060
    using trivial_limit_def by blast
6d2ca97a8f46 More of Manuel's material, and some changes
paulson <lp15@cam.ac.uk>
parents: 76835
diff changeset
  1061
  also have "\<dots> \<longleftrightarrow> space M \<in> null_sets M"
6d2ca97a8f46 More of Manuel's material, and some changes
paulson <lp15@cam.ac.uk>
parents: 76835
diff changeset
  1062
    by (simp add: AE_iff_null_sets eventually_ae_filter)
6d2ca97a8f46 More of Manuel's material, and some changes
paulson <lp15@cam.ac.uk>
parents: 76835
diff changeset
  1063
  also have "\<dots> \<longleftrightarrow> emeasure M (space M) = 0"
6d2ca97a8f46 More of Manuel's material, and some changes
paulson <lp15@cam.ac.uk>
parents: 76835
diff changeset
  1064
    by auto
6d2ca97a8f46 More of Manuel's material, and some changes
paulson <lp15@cam.ac.uk>
parents: 76835
diff changeset
  1065
  finally show ?thesis .
6d2ca97a8f46 More of Manuel's material, and some changes
paulson <lp15@cam.ac.uk>
parents: 76835
diff changeset
  1066
qed
6d2ca97a8f46 More of Manuel's material, and some changes
paulson <lp15@cam.ac.uk>
parents: 76835
diff changeset
  1067
47761
dfe747e72fa8 moved lemmas to appropriate places
hoelzl
parents: 47694
diff changeset
  1068
lemma AE_not_in:
dfe747e72fa8 moved lemmas to appropriate places
hoelzl
parents: 47694
diff changeset
  1069
  "N \<in> null_sets M \<Longrightarrow> AE x in M. x \<notin> N"
dfe747e72fa8 moved lemmas to appropriate places
hoelzl
parents: 47694
diff changeset
  1070
  by (metis AE_iff_null_sets null_setsD2)
dfe747e72fa8 moved lemmas to appropriate places
hoelzl
parents: 47694
diff changeset
  1071
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1072
lemma AE_iff_measurable:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1073
  "N \<in> sets M \<Longrightarrow> {x\<in>space M. \<not> P x} = N \<Longrightarrow> (AE x in M. P x) \<longleftrightarrow> emeasure M N = 0"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1074
  using AE_iff_null[of _ P] by auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1075
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1076
lemma AE_E[consumes 1]:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1077
  assumes "AE x in M. P x"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1078
  obtains N where "{x \<in> space M. \<not> P x} \<subseteq> N" "emeasure M N = 0" "N \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1079
  using assms unfolding eventually_ae_filter by auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1080
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1081
lemma AE_E2:
77179
6d2ca97a8f46 More of Manuel's material, and some changes
paulson <lp15@cam.ac.uk>
parents: 76835
diff changeset
  1082
  assumes "AE x in M. P x"
6d2ca97a8f46 More of Manuel's material, and some changes
paulson <lp15@cam.ac.uk>
parents: 76835
diff changeset
  1083
  shows "emeasure M {x\<in>space M. \<not> P x} = 0"
6d2ca97a8f46 More of Manuel's material, and some changes
paulson <lp15@cam.ac.uk>
parents: 76835
diff changeset
  1084
  by (metis (mono_tags, lifting) AE_iff_null assms emeasure_notin_sets null_setsD1)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1085
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1086
lemma AE_E3:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1087
  assumes "AE x in M. P x"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1088
  obtains N where "\<And>x. x \<in> space M - N \<Longrightarrow> P x" "N \<in> null_sets M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1089
using assms unfolding eventually_ae_filter by auto
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1090
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1091
lemma AE_I:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1092
  assumes "{x \<in> space M. \<not> P x} \<subseteq> N" "emeasure M N = 0" "N \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1093
  shows "AE x in M. P x"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1094
  using assms unfolding eventually_ae_filter by auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1095
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1096
lemma AE_mp[elim!]:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1097
  assumes AE_P: "AE x in M. P x" and AE_imp: "AE x in M. P x \<longrightarrow> Q x"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1098
  shows "AE x in M. Q x"
77179
6d2ca97a8f46 More of Manuel's material, and some changes
paulson <lp15@cam.ac.uk>
parents: 76835
diff changeset
  1099
  using assms by (fact eventually_rev_mp)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1100
64911
f0e07600de47 isabelle update_cartouches -c -t;
wenzelm
parents: 64320
diff changeset
  1101
text \<open>The next lemma is convenient to combine with a lemma whose conclusion is of the
69566
c41954ee87cf more antiquotations -- less LaTeX macros;
wenzelm
parents: 69564
diff changeset
  1102
form \<open>AE x in M. P x = Q x\<close>: for such a lemma, there is no \<open>[symmetric]\<close> variant,
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
  1103
but using \<open>AE_symmetric[OF\<dots>]\<close> will replace it.\<close>
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1104
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1105
(* depricated replace by laws about eventually *)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1106
lemma
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1107
  shows AE_iffI: "AE x in M. P x \<Longrightarrow> AE x in M. P x \<longleftrightarrow> Q x \<Longrightarrow> AE x in M. Q x"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1108
    and AE_disjI1: "AE x in M. P x \<Longrightarrow> AE x in M. P x \<or> Q x"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1109
    and AE_disjI2: "AE x in M. Q x \<Longrightarrow> AE x in M. P x \<or> Q x"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1110
    and AE_conjI: "AE x in M. P x \<Longrightarrow> AE x in M. Q x \<Longrightarrow> AE x in M. P x \<and> Q x"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1111
    and AE_conj_iff[simp]: "(AE x in M. P x \<and> Q x) \<longleftrightarrow> (AE x in M. P x) \<and> (AE x in M. Q x)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1112
  by auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1113
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1114
lemma AE_symmetric:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1115
  assumes "AE x in M. P x = Q x"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1116
  shows "AE x in M. Q x = P x"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1117
  using assms by auto
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1118
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1119
lemma AE_impI:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1120
  "(P \<Longrightarrow> AE x in M. Q x) \<Longrightarrow> AE x in M. P \<longrightarrow> Q x"
70380
2b0dca68c3ee More analysis / measure theory material
paulson <lp15@cam.ac.uk>
parents: 70136
diff changeset
  1121
  by fastforce
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1122
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1123
lemma AE_measure:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1124
  assumes AE: "AE x in M. P x" and sets: "{x\<in>space M. P x} \<in> sets M" (is "?P \<in> sets M")
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1125
  shows "emeasure M {x\<in>space M. P x} = emeasure M (space M)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1126
proof -
74362
0135a0c77b64 tuned proofs --- avoid 'guess';
wenzelm
parents: 73536
diff changeset
  1127
  from AE_E[OF AE] obtain N
0135a0c77b64 tuned proofs --- avoid 'guess';
wenzelm
parents: 73536
diff changeset
  1128
    where N: "{x \<in> space M. \<not> P x} \<subseteq> N" "emeasure M N = 0" "N \<in> sets M"
0135a0c77b64 tuned proofs --- avoid 'guess';
wenzelm
parents: 73536
diff changeset
  1129
    by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1130
  with sets have "emeasure M (space M) \<le> emeasure M (?P \<union> N)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1131
    by (intro emeasure_mono) auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1132
  also have "\<dots> \<le> emeasure M ?P + emeasure M N"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1133
    using sets N by (intro emeasure_subadditive) auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1134
  also have "\<dots> = emeasure M ?P" using N by simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1135
  finally show "emeasure M ?P = emeasure M (space M)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1136
    using emeasure_space[of M "?P"] by auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1137
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1138
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1139
lemma AE_space: "AE x in M. x \<in> space M"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1140
  by (auto intro: AE_I[where N="{}"]) 
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1141
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1142
lemma AE_I2[simp, intro]:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1143
  "(\<And>x. x \<in> space M \<Longrightarrow> P x) \<Longrightarrow> AE x in M. P x"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1144
  using AE_space by force
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1145
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1146
lemma AE_Ball_mp:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1147
  "\<forall>x\<in>space M. P x \<Longrightarrow> AE x in M. P x \<longrightarrow> Q x \<Longrightarrow> AE x in M. Q x"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1148
  by auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1149
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1150
lemma AE_cong[cong]:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1151
  "(\<And>x. x \<in> space M \<Longrightarrow> P x \<longleftrightarrow> Q x) \<Longrightarrow> (AE x in M. P x) \<longleftrightarrow> (AE x in M. Q x)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1152
  by auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1153
69546
27dae626822b prefer naming convention from datatype package for strong congruence rules
haftmann
parents: 69541
diff changeset
  1154
lemma AE_cong_simp: "M = N \<Longrightarrow> (\<And>x. x \<in> space N =simp=> P x = Q x) \<Longrightarrow> (AE x in M. P x) \<longleftrightarrow> (AE x in N. Q x)"
64008
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
  1155
  by (auto simp: simp_implies_def)
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63968
diff changeset
  1156
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1157
lemma AE_all_countable:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1158
  "(AE x in M. \<forall>i. P i x) \<longleftrightarrow> (\<forall>i::'i::countable. AE x in M. P i x)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1159
proof
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1160
  assume "\<forall>i. AE x in M. P i x"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1161
  then obtain N where N: "\<And>i. N i \<in> null_sets M" "\<And>i. {x\<in>space M. \<not> P i x} \<subseteq> N i" 
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1162
    unfolding eventually_ae_filter by metis
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1163
  have "{x\<in>space M. \<not> (\<forall>i. P i x)} \<subseteq> (\<Union>i. {x\<in>space M. \<not> P i x})" by auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1164
  also have "\<dots> \<subseteq> (\<Union>i. N i)" using N by auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1165
  finally have "{x\<in>space M. \<not> (\<forall>i. P i x)} \<subseteq> (\<Union>i. N i)" .
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1166
  moreover from N have "(\<Union>i. N i) \<in> null_sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1167
    by (intro null_sets_UN) auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1168
  ultimately show "AE x in M. \<forall>i. P i x"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1169
    unfolding eventually_ae_filter by auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1170
qed auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1171
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  1172
lemma AE_ball_countable:
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1173
  assumes [intro]: "countable X"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1174
  shows "(AE x in M. \<forall>y\<in>X. P x y) \<longleftrightarrow> (\<forall>y\<in>X. AE x in M. P x y)"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1175
proof
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1176
  assume "\<forall>y\<in>X. AE x in M. P x y"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1177
  then obtain N where N: "\<And>y. y \<in> X \<Longrightarrow> N y \<in> null_sets M" "\<And>y. y \<in> X \<Longrightarrow> {x\<in>space M. \<not> P x y} \<subseteq> N y"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1178
    unfolding eventually_ae_filter by metis
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1179
  have "{x\<in>space M. \<not> (\<forall>y\<in>X. P x y)} \<subseteq> (\<Union>y\<in>X. {x\<in>space M. \<not> P x y})"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1180
    by auto
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1181
  also have "\<dots> \<subseteq> (\<Union>y\<in>X. N y)"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1182
    using N by auto
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1183
  finally have "{x\<in>space M. \<not> (\<forall>y\<in>X. P x y)} \<subseteq> (\<Union>y\<in>X. N y)" .
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1184
  moreover from N have "(\<Union>y\<in>X. N y) \<in> null_sets M"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1185
    by (intro null_sets_UN') auto
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1186
  ultimately show "AE x in M. \<forall>y\<in>X. P x y"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1187
    unfolding eventually_ae_filter by auto
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1188
qed auto
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1189
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1190
lemma AE_ball_countable':
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1191
  "(\<And>N. N \<in> I \<Longrightarrow> AE x in M. P N x) \<Longrightarrow> countable I \<Longrightarrow> AE x in M. \<forall>N \<in> I. P N x"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1192
  unfolding AE_ball_countable by simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1193
63959
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1194
lemma AE_pairwise: "countable F \<Longrightarrow> pairwise (\<lambda>A B. AE x in M. R x A B) F \<longleftrightarrow> (AE x in M. pairwise (R x) F)"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1195
  unfolding pairwise_alt by (simp add: AE_ball_countable)
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1196
57275
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
  1197
lemma AE_discrete_difference:
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
  1198
  assumes X: "countable X"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  1199
  assumes null: "\<And>x. x \<in> X \<Longrightarrow> emeasure M {x} = 0"
57275
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
  1200
  assumes sets: "\<And>x. x \<in> X \<Longrightarrow> {x} \<in> sets M"
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
  1201
  shows "AE x in M. x \<notin> X"
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
  1202
proof -
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
  1203
  have "(\<Union>x\<in>X. {x}) \<in> null_sets M"
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
  1204
    using assms by (intro null_sets_UN') auto
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
  1205
  from AE_not_in[OF this] show "AE x in M. x \<notin> X"
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
  1206
    by auto
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
  1207
qed
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57235
diff changeset
  1208
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1209
lemmas AE_finite_all = eventually_ball_finite_distrib
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1210
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1211
lemma AE_finite_allI:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1212
  assumes "finite S"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1213
  shows "(\<And>s. s \<in> S \<Longrightarrow> AE x in M. Q s x) \<Longrightarrow> AE x in M. \<forall>s\<in>S. Q s x"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1214
  by (simp add: AE_ball_countable' assms countable_finite)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1215
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1216
lemma emeasure_mono_AE:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1217
  assumes imp: "AE x in M. x \<in> A \<longrightarrow> x \<in> B"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1218
    and B: "B \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1219
  shows "emeasure M A \<le> emeasure M B"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1220
proof cases
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1221
  assume A: "A \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1222
  from imp obtain N where N: "{x\<in>space M. \<not> (x \<in> A \<longrightarrow> x \<in> B)} \<subseteq> N" "N \<in> null_sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1223
    by (auto simp: eventually_ae_filter)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1224
  have "emeasure M A = emeasure M (A - N)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1225
    using N A by (subst emeasure_Diff_null_set) auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1226
  also have "emeasure M (A - N) \<le> emeasure M (B - N)"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
  1227
    using N A B sets.sets_into_space by (auto intro!: emeasure_mono)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1228
  also have "emeasure M (B - N) = emeasure M B"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1229
    using N B by (subst emeasure_Diff_null_set) auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1230
  finally show ?thesis .
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1231
qed (simp add: emeasure_notin_sets)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1232
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1233
lemma emeasure_eq_AE:
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1234
  assumes "AE x in M. x \<in> A \<longleftrightarrow> x \<in> B" "A \<in> sets M" "B \<in> sets M"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1235
  shows "emeasure M A = emeasure M B"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1236
  using assms by (force intro!: antisym emeasure_mono_AE) 
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1237
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1238
lemma emeasure_Collect_eq_AE:
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1239
  "AE x in M. P x \<longleftrightarrow> Q x \<Longrightarrow> Measurable.pred M Q \<Longrightarrow> Measurable.pred M P \<Longrightarrow>
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1240
   emeasure M {x\<in>space M. P x} = emeasure M {x\<in>space M. Q x}"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1241
   by (intro emeasure_eq_AE) auto
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1242
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1243
lemma emeasure_eq_0_AE: "AE x in M. \<not> P x \<Longrightarrow> emeasure M {x\<in>space M. P x} = 0"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1244
  using AE_iff_measurable[OF _ refl, of M "\<lambda>x. \<not> P x"]
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1245
  by (cases "{x\<in>space M. P x} \<in> sets M") (simp_all add: emeasure_notin_sets)
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1246
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1247
lemma emeasure_0_AE:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1248
  assumes "emeasure M (space M) = 0"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1249
  shows "AE x in M. P x"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1250
using eventually_ae_filter assms by blast
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1251
60715
ee0afee54b1d add emeasure_add_AE
hoelzl
parents: 60714
diff changeset
  1252
lemma emeasure_add_AE:
ee0afee54b1d add emeasure_add_AE
hoelzl
parents: 60714
diff changeset
  1253
  assumes [measurable]: "A \<in> sets M" "B \<in> sets M" "C \<in> sets M"
ee0afee54b1d add emeasure_add_AE
hoelzl
parents: 60714
diff changeset
  1254
  assumes 1: "AE x in M. x \<in> C \<longleftrightarrow> x \<in> A \<or> x \<in> B"
ee0afee54b1d add emeasure_add_AE
hoelzl
parents: 60714
diff changeset
  1255
  assumes 2: "AE x in M. \<not> (x \<in> A \<and> x \<in> B)"
ee0afee54b1d add emeasure_add_AE
hoelzl
parents: 60714
diff changeset
  1256
  shows "emeasure M C = emeasure M A + emeasure M B"
ee0afee54b1d add emeasure_add_AE
hoelzl
parents: 60714
diff changeset
  1257
proof -
ee0afee54b1d add emeasure_add_AE
hoelzl
parents: 60714
diff changeset
  1258
  have "emeasure M C = emeasure M (A \<union> B)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1259
    by (rule emeasure_eq_AE) (use 1 in auto)
60715
ee0afee54b1d add emeasure_add_AE
hoelzl
parents: 60714
diff changeset
  1260
  also have "\<dots> = emeasure M A + emeasure M (B - A)"
ee0afee54b1d add emeasure_add_AE
hoelzl
parents: 60714
diff changeset
  1261
    by (subst plus_emeasure) auto
ee0afee54b1d add emeasure_add_AE
hoelzl
parents: 60714
diff changeset
  1262
  also have "emeasure M (B - A) = emeasure M B"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1263
    by (rule emeasure_eq_AE) (use 2 in auto)
60715
ee0afee54b1d add emeasure_add_AE
hoelzl
parents: 60714
diff changeset
  1264
  finally show ?thesis .
ee0afee54b1d add emeasure_add_AE
hoelzl
parents: 60714
diff changeset
  1265
qed
ee0afee54b1d add emeasure_add_AE
hoelzl
parents: 60714
diff changeset
  1266
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1267
subsection \<open>\<open>\<sigma>\<close>-finite Measures\<close>
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1268
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  1269
locale\<^marker>\<open>tag important\<close> sigma_finite_measure =
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1270
  fixes M :: "'a measure"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1271
  assumes sigma_finite_countable:
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1272
    "\<exists>A::'a set set. countable A \<and> A \<subseteq> sets M \<and> (\<Union>A) = space M \<and> (\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>)"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1273
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1274
lemma (in sigma_finite_measure) sigma_finite:
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1275
  obtains A :: "nat \<Rightarrow> 'a set"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1276
  where "range A \<subseteq> sets M" "(\<Union>i. A i) = space M" "\<And>i. emeasure M (A i) \<noteq> \<infinity>"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1277
proof -
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1278
  obtain A :: "'a set set" where
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1279
    [simp]: "countable A" and
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1280
    A: "A \<subseteq> sets M" "(\<Union>A) = space M" "\<And>a. a \<in> A \<Longrightarrow> emeasure M a \<noteq> \<infinity>"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1281
    using sigma_finite_countable by metis
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1282
  show thesis
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1283
  proof cases
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1284
    assume "A = {}" with \<open>(\<Union>A) = space M\<close> show thesis
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1285
      by (intro that[of "\<lambda>_. {}"]) auto
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1286
  next
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  1287
    assume "A \<noteq> {}"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1288
    show thesis
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1289
    proof
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1290
      show "range (from_nat_into A) \<subseteq> sets M"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1291
        using \<open>A \<noteq> {}\<close> A by auto
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1292
      have "(\<Union>i. from_nat_into A i) = \<Union>A"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1293
        using range_from_nat_into[OF \<open>A \<noteq> {}\<close> \<open>countable A\<close>] by auto
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1294
      with A show "(\<Union>i. from_nat_into A i) = space M"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1295
        by auto
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1296
    qed (intro A from_nat_into \<open>A \<noteq> {}\<close>)
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1297
  qed
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1298
qed
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1299
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1300
lemma (in sigma_finite_measure) sigma_finite_disjoint:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1301
  obtains A :: "nat \<Rightarrow> 'a set"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1302
  where "range A \<subseteq> sets M" "(\<Union>i. A i) = space M" "\<And>i. emeasure M (A i) \<noteq> \<infinity>" "disjoint_family A"
60580
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1303
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1304
  obtain A :: "nat \<Rightarrow> 'a set" where
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1305
    range: "range A \<subseteq> sets M" and
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1306
    space: "(\<Union>i. A i) = space M" and
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1307
    measure: "\<And>i. emeasure M (A i) \<noteq> \<infinity>"
62343
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 61969
diff changeset
  1308
    using sigma_finite by blast
60580
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1309
  show thesis
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1310
  proof (rule that[of "disjointed A"])
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1311
    show "range (disjointed A) \<subseteq> sets M"
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1312
      by (rule sets.range_disjointed_sets[OF range])
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1313
    show "(\<Union>i. disjointed A i) = space M" and "disjoint_family (disjointed A)"
60580
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1314
      using disjoint_family_disjointed UN_disjointed_eq[of A] space range
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1315
      by auto
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1316
    show "emeasure M (disjointed A i) \<noteq> \<infinity>" for i
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1317
      using range disjointed_subset[of A i] measure[of i]
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1318
      by (simp add: emeasure_mono neq_top_trans)
60580
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1319
  qed
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1320
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1321
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1322
lemma (in sigma_finite_measure) sigma_finite_incseq:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1323
  obtains A :: "nat \<Rightarrow> 'a set"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1324
  where "range A \<subseteq> sets M" "(\<Union>i. A i) = space M" "\<And>i. emeasure M (A i) \<noteq> \<infinity>" "incseq A"
60580
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1325
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1326
  obtain F :: "nat \<Rightarrow> 'a set" where
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1327
    F: "range F \<subseteq> sets M" "(\<Union>i. F i) = space M" "\<And>i. emeasure M (F i) \<noteq> \<infinity>"
62343
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 61969
diff changeset
  1328
    using sigma_finite by blast
60580
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1329
  show thesis
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1330
  proof (rule that[of "\<lambda>n. \<Union>i\<le>n. F i"])
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1331
    show "range (\<lambda>n. \<Union>i\<le>n. F i) \<subseteq> sets M"
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1332
      using F by (force simp: incseq_def)
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1333
    show "(\<Union>n. \<Union>i\<le>n. F i) = space M"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1334
      using F(2) by fastforce
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60580
diff changeset
  1335
    show "emeasure M (\<Union>i\<le>n. F i) \<noteq> \<infinity>" for n
60580
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1336
    proof -
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60580
diff changeset
  1337
      have "emeasure M (\<Union>i\<le>n. F i) \<le> (\<Sum>i\<le>n. emeasure M (F i))"
60580
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1338
        using F by (auto intro!: emeasure_subadditive_finite)
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1339
      also have "\<dots> < \<infinity>"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
  1340
        using F by (auto simp: sum_Pinfty less_top)
60580
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1341
      finally show ?thesis by simp
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1342
    qed
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1343
    show "incseq (\<lambda>n. \<Union>i\<le>n. F i)"
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1344
      by (force simp: incseq_def)
7e741e22d7fc tuned proofs;
wenzelm
parents: 60172
diff changeset
  1345
  qed
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1346
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1347
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1348
lemma (in sigma_finite_measure) approx_PInf_emeasure_with_finite:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1349
  fixes C::real
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1350
  assumes W_meas: "W \<in> sets M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1351
      and W_inf: "emeasure M W = \<infinity>"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1352
  obtains Z where "Z \<in> sets M" "Z \<subseteq> W" "emeasure M Z < \<infinity>" "emeasure M Z > C"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1353
proof -
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1354
  obtain A :: "nat \<Rightarrow> 'a set"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1355
    where A: "range A \<subseteq> sets M" "(\<Union>i. A i) = space M" "\<And>i. emeasure M (A i) \<noteq> \<infinity>" "incseq A"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1356
    using sigma_finite_incseq by blast
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1357
  define B where "B = (\<lambda>i. W \<inter> A i)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1358
  have B_meas: "\<And>i. B i \<in> sets M" 
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1359
    using W_meas \<open>range A \<subseteq> sets M\<close> B_def by blast
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1360
  have BsubW: "\<And>i. B i \<subseteq> W" 
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1361
    using B_def by blast
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1362
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1363
  have Bfinite: "emeasure M (B i) < \<infinity>" for i
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1364
  proof -
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1365
    have "emeasure M (B i) \<le> emeasure M (A i)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1366
      using A by (intro emeasure_mono) (auto simp: B_def)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1367
    also have "emeasure M (A i) < \<infinity>"
64911
f0e07600de47 isabelle update_cartouches -c -t;
wenzelm
parents: 64320
diff changeset
  1368
      using \<open>\<And>i. emeasure M (A i) \<noteq> \<infinity>\<close> by (simp add: less_top)
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1369
    finally show ?thesis .
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1370
  qed
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1371
64911
f0e07600de47 isabelle update_cartouches -c -t;
wenzelm
parents: 64320
diff changeset
  1372
  have "W = (\<Union>i. B i)" using B_def \<open>(\<Union>i. A i) = space M\<close> W_meas by auto
f0e07600de47 isabelle update_cartouches -c -t;
wenzelm
parents: 64320
diff changeset
  1373
  moreover have "incseq B" using B_def \<open>incseq A\<close> by (simp add: incseq_def subset_eq)
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1374
  ultimately have "(\<lambda>i. emeasure M (B i)) \<longlonglongrightarrow> emeasure M W" using W_meas B_meas
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1375
    by (simp add: B_meas Lim_emeasure_incseq image_subset_iff)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1376
  then have "(\<lambda>i. emeasure M (B i)) \<longlonglongrightarrow> \<infinity>" using W_inf by simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1377
  from order_tendstoD(1)[OF this, of C]
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1378
  obtain i where "emeasure M (B i) > C"
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1379
    by (auto simp: eventually_sequentially)
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1380
  then have "B i \<in> sets M" "B i \<subseteq> W" "emeasure M (B i) < \<infinity>" "emeasure M (B i) > C"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1381
    using B_meas BsubW Bfinite by auto
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1382
  then show ?thesis using that by blast
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1383
qed
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1384
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 69566
diff changeset
  1385
subsection \<open>Measure space induced by distribution of \<^const>\<open>measurable\<close>-functions\<close>
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1386
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  1387
definition\<^marker>\<open>tag important\<close> distr :: "'a measure \<Rightarrow> 'b measure \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'b measure" where
69564
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  1388
"distr M N f =
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  1389
  measure_of (space N) (sets N) (\<lambda>A. emeasure M (f -` A \<inter> space M))"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1390
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1391
lemma
59048
7dc8ac6f0895 add congruence solver to measurability prover
hoelzl
parents: 59011
diff changeset
  1392
  shows sets_distr[simp, measurable_cong]: "sets (distr M N f) = sets N"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1393
    and space_distr[simp]: "space (distr M N f) = space N"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1394
  by (auto simp: distr_def)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1395
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1396
lemma
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1397
  shows measurable_distr_eq1[simp]: "measurable (distr Mf Nf f) Mf' = measurable Nf Mf'"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1398
    and measurable_distr_eq2[simp]: "measurable Mg' (distr Mg Ng g) = measurable Mg' Ng"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1399
  by (auto simp: measurable_def)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1400
54417
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 53374
diff changeset
  1401
lemma distr_cong:
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 53374
diff changeset
  1402
  "M = K \<Longrightarrow> sets N = sets L \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> f x = g x) \<Longrightarrow> distr M N f = distr K L g"
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 53374
diff changeset
  1403
  using sets_eq_imp_space_eq[of N L] by (simp add: distr_def Int_def cong: rev_conj_cong)
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 53374
diff changeset
  1404
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1405
lemma emeasure_distr:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1406
  fixes f :: "'a \<Rightarrow> 'b"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1407
  assumes f: "f \<in> measurable M N" and A: "A \<in> sets N"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1408
  shows "emeasure (distr M N f) A = emeasure M (f -` A \<inter> space M)" (is "_ = ?\<mu> A")
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1409
  unfolding distr_def
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1410
proof (rule emeasure_measure_of_sigma)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1411
  show "positive (sets N) ?\<mu>"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1412
    by (auto simp: positive_def)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1413
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1414
  show "countably_additive (sets N) ?\<mu>"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1415
  proof (intro countably_additiveI)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1416
    fix A :: "nat \<Rightarrow> 'b set" assume "range A \<subseteq> sets N" "disjoint_family A"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1417
    then have A: "\<And>i. A i \<in> sets N" "(\<Union>i. A i) \<in> sets N" by auto
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1418
    then have *: "range (\<lambda>i. f -` (A i) \<inter> space M) \<subseteq> sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1419
      using f by (auto simp: measurable_def)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1420
    moreover have "(\<Union>i. f -`  A i \<inter> space M) \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1421
      using * by blast
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1422
    moreover have **: "disjoint_family (\<lambda>i. f -` A i \<inter> space M)"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1423
      using \<open>disjoint_family A\<close> by (auto simp: disjoint_family_on_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1424
    ultimately show "(\<Sum>i. ?\<mu> (A i)) = ?\<mu> (\<Union>i. A i)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1425
      using suminf_emeasure[OF _ **] A f
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1426
      by (auto simp: comp_def vimage_UN)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1427
  qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1428
  show "sigma_algebra (space N) (sets N)" ..
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1429
qed fact
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1430
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1431
lemma emeasure_Collect_distr:
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1432
  assumes X[measurable]: "X \<in> measurable M N" "Measurable.pred N P"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1433
  shows "emeasure (distr M N X) {x\<in>space N. P x} = emeasure M {x\<in>space M. P (X x)}"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1434
  by (subst emeasure_distr)
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1435
     (auto intro!: arg_cong2[where f=emeasure] X(1)[THEN measurable_space])
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1436
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1437
lemma emeasure_lfp2[consumes 1, case_names cont f measurable]:
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1438
  assumes "P M"
60172
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 60142
diff changeset
  1439
  assumes cont: "sup_continuous F"
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1440
  assumes f: "\<And>M. P M \<Longrightarrow> f \<in> measurable M' M"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1441
  assumes *: "\<And>M A. P M \<Longrightarrow> (\<And>N. P N \<Longrightarrow> Measurable.pred N A) \<Longrightarrow> Measurable.pred M (F A)"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1442
  shows "emeasure M' {x\<in>space M'. lfp F (f x)} = (SUP i. emeasure M' {x\<in>space M'. (F ^^ i) (\<lambda>x. False) (f x)})"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1443
proof (subst (1 2) emeasure_Collect_distr[symmetric, where X=f])
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1444
  show "f \<in> measurable M' M"  "f \<in> measurable M' M"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1445
    using f[OF \<open>P M\<close>] by auto
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1446
  show "Measurable.pred M ((F ^^ i) (\<lambda>x. False))" for i
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1447
    using \<open>P M\<close> by (induction i arbitrary: M) (auto intro!: *) 
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1448
  show "Measurable.pred M (lfp F)"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1449
    using \<open>P M\<close> cont * by (rule measurable_lfp_coinduct[of P])
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1450
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1451
  have "emeasure (distr M' M f) {x \<in> space (distr M' M f). lfp F x} =
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1452
    (SUP i. emeasure (distr M' M f) {x \<in> space (distr M' M f). (F ^^ i) (\<lambda>x. False) x})"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1453
    using \<open>P M\<close>
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
  1454
  proof (coinduction arbitrary: M rule: emeasure_lfp')
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1455
    case (measurable A N) then have "\<And>N. P N \<Longrightarrow> Measurable.pred (distr M' N f) A"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1456
      by metis
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1457
    then have "\<And>N. P N \<Longrightarrow> Measurable.pred N A"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1458
      by simp
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1459
    with \<open>P N\<close>[THEN *] show ?case
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1460
      by auto
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1461
  qed fact
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1462
  then show "emeasure (distr M' M f) {x \<in> space M. lfp F x} =
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1463
    (SUP i. emeasure (distr M' M f) {x \<in> space M. (F ^^ i) (\<lambda>x. False) x})"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1464
   by simp
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1465
qed
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1466
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  1467
lemma distr_id[simp]: "distr N N (\<lambda>x. x) = N"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  1468
  by (rule measure_eqI) (auto simp: emeasure_distr)
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  1469
64320
ba194424b895 HOL-Probability: move stopping time from AFP/Markov_Models
hoelzl
parents: 64283
diff changeset
  1470
lemma distr_id2: "sets M = sets N \<Longrightarrow> distr N M (\<lambda>x. x) = N"
ba194424b895 HOL-Probability: move stopping time from AFP/Markov_Models
hoelzl
parents: 64283
diff changeset
  1471
  by (rule measure_eqI) (auto simp: emeasure_distr)
ba194424b895 HOL-Probability: move stopping time from AFP/Markov_Models
hoelzl
parents: 64283
diff changeset
  1472
50001
382bd3173584 add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents: 49789
diff changeset
  1473
lemma measure_distr:
382bd3173584 add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents: 49789
diff changeset
  1474
  "f \<in> measurable M N \<Longrightarrow> S \<in> sets N \<Longrightarrow> measure (distr M N f) S = measure M (f -` S \<inter> space M)"
382bd3173584 add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents: 49789
diff changeset
  1475
  by (simp add: emeasure_distr measure_def)
382bd3173584 add syntax and a.e.-rules for (conditional) probability on predicates
hoelzl
parents: 49789
diff changeset
  1476
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1477
lemma distr_cong_AE:
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  1478
  assumes 1: "M = K" "sets N = sets L" and
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1479
    2: "(AE x in M. f x = g x)" and "f \<in> measurable M N" and "g \<in> measurable K L"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1480
  shows "distr M N f = distr K L g"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1481
proof (rule measure_eqI)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1482
  fix A assume "A \<in> sets (distr M N f)"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1483
  with assms show "emeasure (distr M N f) A = emeasure (distr K L g) A"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1484
    by (auto simp: emeasure_distr intro!: emeasure_eq_AE measurable_sets)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1485
qed (use 1 in simp)
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  1486
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1487
lemma AE_distrD:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1488
  assumes f: "f \<in> measurable M M'"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1489
    and AE: "AE x in distr M M' f. P x"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1490
  shows "AE x in M. P (f x)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1491
proof -
74362
0135a0c77b64 tuned proofs --- avoid 'guess';
wenzelm
parents: 73536
diff changeset
  1492
  from AE[THEN AE_E] obtain N
0135a0c77b64 tuned proofs --- avoid 'guess';
wenzelm
parents: 73536
diff changeset
  1493
    where "{x \<in> space (distr M M' f). \<not> P x} \<subseteq> N"
0135a0c77b64 tuned proofs --- avoid 'guess';
wenzelm
parents: 73536
diff changeset
  1494
      "emeasure (distr M M' f) N = 0"
0135a0c77b64 tuned proofs --- avoid 'guess';
wenzelm
parents: 73536
diff changeset
  1495
      "N \<in> sets (distr M M' f)"
0135a0c77b64 tuned proofs --- avoid 'guess';
wenzelm
parents: 73536
diff changeset
  1496
    by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1497
  with f show ?thesis
74362
0135a0c77b64 tuned proofs --- avoid 'guess';
wenzelm
parents: 73536
diff changeset
  1498
    by (simp add: eventually_ae_filter, intro bexI[of _ "f -` N \<inter> space M"])
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1499
       (auto simp: emeasure_distr measurable_def)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1500
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1501
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  1502
lemma AE_distr_iff:
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 50001
diff changeset
  1503
  assumes f[measurable]: "f \<in> measurable M N" and P[measurable]: "{x \<in> space N. P x} \<in> sets N"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  1504
  shows "(AE x in distr M N f. P x) \<longleftrightarrow> (AE x in M. P (f x))"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  1505
proof (subst (1 2) AE_iff_measurable[OF _ refl])
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 50001
diff changeset
  1506
  have "f -` {x\<in>space N. \<not> P x} \<inter> space M = {x \<in> space M. \<not> P (f x)}"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 50001
diff changeset
  1507
    using f[THEN measurable_space] by auto
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 50001
diff changeset
  1508
  then show "(emeasure (distr M N f) {x \<in> space (distr M N f). \<not> P x} = 0) =
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1509
             (emeasure M {x \<in> space M. \<not> P (f x)} = 0)"
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 50001
diff changeset
  1510
    by (simp add: emeasure_distr)
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 50001
diff changeset
  1511
qed auto
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  1512
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1513
lemma null_sets_distr_iff:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1514
  "f \<in> measurable M N \<Longrightarrow> A \<in> null_sets (distr M N f) \<longleftrightarrow> f -` A \<inter> space M \<in> null_sets M \<and> A \<in> sets N"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1515
  by (auto simp: null_sets_def emeasure_distr)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1516
68607
67bb59e49834 make theorem, corollary, and proposition %important for HOL-Analysis manual
immler
parents: 68532
diff changeset
  1517
proposition distr_distr:
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 50001
diff changeset
  1518
  "g \<in> measurable N L \<Longrightarrow> f \<in> measurable M N \<Longrightarrow> distr (distr M N f) L g = distr M L (g \<circ> f)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1519
  by (auto simp: emeasure_distr measurable_space
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1520
           intro!: arg_cong[where f="emeasure M"] measure_eqI)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1521
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  1522
subsection\<^marker>\<open>tag unimportant\<close> \<open>Real measure values\<close>
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1523
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1524
lemma ring_of_finite_sets: "ring_of_sets (space M) {A\<in>sets M. emeasure M A \<noteq> top}"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1525
proof -
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1526
 have False
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1527
    if "a \<in> sets M" and "emeasure M a \<noteq> top"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1528
      and "b \<in> sets M" and "emeasure M b \<noteq> top"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1529
      and "emeasure M (a - b) = top"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1530
    for a b
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1531
    using that
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1532
    by (metis emeasure_Un emeasure_Un_Int ennreal_add_eq_top)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1533
  then show ?thesis
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1534
    using emeasure_Un_Int
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1535
    by (fastforce intro!: sets.sets_into_space ring_of_setsI)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1536
qed
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1537
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1538
lemma measure_nonneg[simp]: "0 \<le> measure M A"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  1539
  unfolding measure_def by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1540
67982
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1541
lemma measure_nonneg' [simp]: "\<not> measure M A < 0"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1542
  using measure_nonneg not_le by blast
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1543
61880
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61808
diff changeset
  1544
lemma zero_less_measure_iff: "0 < measure M A \<longleftrightarrow> measure M A \<noteq> 0"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1545
  using measure_nonneg[of M A] by (auto simp: le_less)
61880
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61808
diff changeset
  1546
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1547
lemma measure_le_0_iff: "measure M X \<le> 0 \<longleftrightarrow> measure M X = 0"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1548
  using measure_nonneg[of M X] by linarith
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  1549
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1550
lemma measure_empty[simp]: "measure M {} = 0"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1551
  unfolding measure_def by (simp add: zero_ennreal.rep_eq)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1552
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1553
lemma emeasure_eq_ennreal_measure:
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1554
  "emeasure M A \<noteq> top \<Longrightarrow> emeasure M A = ennreal (measure M A)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1555
  by (cases "emeasure M A" rule: ennreal_cases) (auto simp: measure_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1556
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1557
lemma measure_zero_top: "emeasure M A = top \<Longrightarrow> measure M A = 0"
71633
07bec530f02e cleaned proofs
nipkow
parents: 70723
diff changeset
  1558
  by (simp add: measure_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1559
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1560
lemma measure_eq_emeasure_eq_ennreal: "0 \<le> x \<Longrightarrow> emeasure M A = ennreal x \<Longrightarrow> measure M A = x"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1561
  using emeasure_eq_ennreal_measure[of M A]
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1562
  by (cases "A \<in> M") (auto simp: measure_notin_sets emeasure_notin_sets)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1563
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1564
lemma enn2real_plus:"a < top \<Longrightarrow> b < top \<Longrightarrow> enn2real (a + b) = enn2real a + enn2real b"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  1565
  by (simp add: enn2real_def plus_ennreal.rep_eq real_of_ereal_add less_top
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1566
           del: real_of_ereal_enn2ereal)
61633
64e6d712af16 add lemmas
Andreas Lochbihler
parents: 61609
diff changeset
  1567
70380
2b0dca68c3ee More analysis / measure theory material
paulson <lp15@cam.ac.uk>
parents: 70136
diff changeset
  1568
lemma enn2real_sum:"(\<And>i. i \<in> I \<Longrightarrow> f i < top) \<Longrightarrow> enn2real (sum f I) = sum (enn2real \<circ> f) I"
2b0dca68c3ee More analysis / measure theory material
paulson <lp15@cam.ac.uk>
parents: 70136
diff changeset
  1569
  by (induction I rule: infinite_finite_induct) (auto simp: enn2real_plus)
2b0dca68c3ee More analysis / measure theory material
paulson <lp15@cam.ac.uk>
parents: 70136
diff changeset
  1570
63959
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1571
lemma measure_eq_AE:
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1572
  assumes iff: "AE x in M. x \<in> A \<longleftrightarrow> x \<in> B"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1573
  assumes A: "A \<in> sets M" and B: "B \<in> sets M"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1574
  shows "measure M A = measure M B"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1575
  using assms emeasure_eq_AE[OF assms] by (simp add: measure_def)
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1576
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1577
lemma measure_Union:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1578
  "emeasure M A \<noteq> \<infinity> \<Longrightarrow> emeasure M B \<noteq> \<infinity> \<Longrightarrow> A \<in> sets M \<Longrightarrow> B \<in> sets M \<Longrightarrow> A \<inter> B = {} \<Longrightarrow>
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1579
    measure M (A \<union> B) = measure M A + measure M B"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  1580
  by (simp add: measure_def plus_emeasure[symmetric] enn2real_plus less_top)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1581
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1582
lemma measure_finite_Union:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1583
  "finite S \<Longrightarrow> A`S \<subseteq> sets M \<Longrightarrow> disjoint_family_on A S \<Longrightarrow> (\<And>i. i \<in> S \<Longrightarrow> emeasure M (A i) \<noteq> \<infinity>) \<Longrightarrow>
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1584
    measure M (\<Union>i\<in>S. A i) = (\<Sum>i\<in>S. measure M (A i))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1585
  by (induction S rule: finite_induct)
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
  1586
     (auto simp: disjoint_family_on_insert measure_Union sum_emeasure[symmetric] sets.countable_UN'[OF countable_finite])
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1587
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1588
lemma measure_Diff:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1589
  assumes finite: "emeasure M A \<noteq> \<infinity>"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1590
  and measurable: "A \<in> sets M" "B \<in> sets M" "B \<subseteq> A"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1591
  shows "measure M (A - B) = measure M A - measure M B"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1592
proof -
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1593
  have "emeasure M (A - B) \<le> emeasure M A" "emeasure M B \<le> emeasure M A"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1594
    using measurable by (auto intro!: emeasure_mono)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1595
  hence "measure M ((A - B) \<union> B) = measure M (A - B) + measure M B"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1596
    using measurable finite by (rule_tac measure_Union) (auto simp: top_unique)
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  1597
  thus ?thesis using \<open>B \<subseteq> A\<close> by (auto simp: Un_absorb2)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1598
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1599
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1600
lemma measure_UNION:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1601
  assumes measurable: "range A \<subseteq> sets M" "disjoint_family A"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1602
  assumes finite: "emeasure M (\<Union>i. A i) \<noteq> \<infinity>"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1603
  shows "(\<lambda>i. measure M (A i)) sums (measure M (\<Union>i. A i))"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1604
proof -
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1605
  have \<section>: "(\<lambda>i. emeasure M (A i)) sums (emeasure M (\<Union>i. A i))"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1606
    unfolding suminf_emeasure[OF measurable, symmetric] by (simp add: summable_sums)
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1607
  then have "emeasure M (A i) = ennreal ((measure M (A i)))" for i
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1608
  by (metis assms(3) emeasure_eq_ennreal_measure ennreal_suminf_lessD
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1609
      infinity_ennreal_def less_top sums_unique)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1610
  with \<section> show ?thesis using finite emeasure_eq_ennreal_measure by fastforce
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1611
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1612
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1613
lemma measure_subadditive:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1614
  assumes measurable: "A \<in> sets M" "B \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1615
  and fin: "emeasure M A \<noteq> \<infinity>" "emeasure M B \<noteq> \<infinity>"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1616
  shows "measure M (A \<union> B) \<le> measure M A + measure M B"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1617
proof -
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1618
  have "emeasure M (A \<union> B) \<noteq> \<infinity>"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1619
    using emeasure_subadditive[OF measurable] fin by (auto simp: top_unique)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1620
  then show "(measure M (A \<union> B)) \<le> (measure M A) + (measure M B)"
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
  1621
    unfolding measure_def
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1622
    by (metis emeasure_subadditive[OF measurable] fin enn2real_mono enn2real_plus 
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
  1623
        ennreal_add_less_top infinity_ennreal_def less_top)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1624
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1625
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1626
lemma measure_subadditive_finite:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1627
  assumes A: "finite I" "A`I \<subseteq> sets M" and fin: "\<And>i. i \<in> I \<Longrightarrow> emeasure M (A i) \<noteq> \<infinity>"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1628
  shows "measure M (\<Union>i\<in>I. A i) \<le> (\<Sum>i\<in>I. measure M (A i))"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1629
proof -
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1630
  have *: "emeasure M (\<Union>i\<in>I. A i) \<noteq> top"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1631
      using emeasure_subadditive_finite[OF A] fin
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1632
      by (metis \<open>finite I\<close> ennreal_sum_eq_top infinity_ennreal_def neq_top_trans)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1633
  show ?thesis
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1634
    using emeasure_subadditive_finite[OF A] fin
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1635
    unfolding emeasure_eq_ennreal_measure[OF *]
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
  1636
    by (simp_all add: sum_nonneg emeasure_eq_ennreal_measure)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1637
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1638
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1639
lemma measure_subadditive_countably:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1640
  assumes A: "range A \<subseteq> sets M" and fin: "(\<Sum>i. emeasure M (A i)) \<noteq> \<infinity>"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1641
  shows "measure M (\<Union>i. A i) \<le> (\<Sum>i. measure M (A i))"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1642
proof -
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
  1643
  have **: "\<And>i. emeasure M (A i) \<noteq> top"
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
  1644
    using fin ennreal_suminf_lessD[of "\<lambda>i. emeasure M (A i)"] by (simp add: less_top)
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
  1645
  have ge0: "(\<Sum>i. Sigma_Algebra.measure M (A i)) \<ge> 0"
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
  1646
    using fin emeasure_eq_ennreal_measure[OF **]
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
  1647
    by (metis infinity_ennreal_def measure_nonneg suminf_cong suminf_nonneg summable_suminf_not_top)
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
  1648
  have "emeasure M (\<Union>i. A i) \<noteq> top"
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
  1649
    by (metis A emeasure_subadditive_countably fin infinity_ennreal_def neq_top_trans)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1650
  then have "ennreal (measure M (\<Union>i. A i)) = emeasure M (\<Union>i. A i)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1651
    by (rule emeasure_eq_ennreal_measure[symmetric])
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1652
  also have "\<dots> \<le> (\<Sum>i. emeasure M (A i))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1653
    using emeasure_subadditive_countably[OF A] .
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1654
  also have "\<dots> = ennreal (\<Sum>i. measure M (A i))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1655
    using fin unfolding emeasure_eq_ennreal_measure[OF **]
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1656
    by (metis infinity_ennreal_def measure_nonneg suminf_ennreal)
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1657
  finally show ?thesis
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
  1658
    using ge0 ennreal_le_iff by blast
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1659
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1660
63959
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1661
lemma measure_Un_null_set: "A \<in> sets M \<Longrightarrow> B \<in> null_sets M \<Longrightarrow> measure M (A \<union> B) = measure M A"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1662
  by (simp add: measure_def emeasure_Un_null_set)
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1663
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1664
lemma measure_Diff_null_set: "A \<in> sets M \<Longrightarrow> B \<in> null_sets M \<Longrightarrow> measure M (A - B) = measure M A"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1665
  by (simp add: measure_def emeasure_Diff_null_set)
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1666
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
  1667
lemma measure_eq_sum_singleton:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1668
  "finite S \<Longrightarrow> (\<And>x. x \<in> S \<Longrightarrow> {x} \<in> sets M) \<Longrightarrow> (\<And>x. x \<in> S \<Longrightarrow> emeasure M {x} \<noteq> \<infinity>) \<Longrightarrow>
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1669
    measure M S = (\<Sum>x\<in>S. measure M {x})"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
  1670
  using emeasure_eq_sum_singleton[of S M]
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
  1671
  by (intro measure_eq_emeasure_eq_ennreal) (auto simp: sum_nonneg emeasure_eq_ennreal_measure)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1672
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1673
lemma Lim_measure_incseq:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1674
  assumes A: "range A \<subseteq> sets M" "incseq A" and fin: "emeasure M (\<Union>i. A i) \<noteq> \<infinity>"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1675
  shows "(\<lambda>i. measure M (A i)) \<longlonglongrightarrow> measure M (\<Union>i. A i)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1676
proof (rule tendsto_ennrealD)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1677
  have "ennreal (measure M (\<Union>i. A i)) = emeasure M (\<Union>i. A i)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1678
    using fin by (auto simp: emeasure_eq_ennreal_measure)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1679
  moreover have "ennreal (measure M (A i)) = emeasure M (A i)" for i
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1680
    using assms emeasure_mono[of "A _" "\<Union>i. A i" M]
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1681
    by (intro emeasure_eq_ennreal_measure[symmetric]) (auto simp: less_top UN_upper intro: le_less_trans)
67982
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1682
  ultimately show "(\<lambda>x. ennreal (measure M (A x))) \<longlonglongrightarrow> ennreal (measure M (\<Union>i. A i))"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1683
    using A by (auto intro!: Lim_emeasure_incseq)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1684
qed auto
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1685
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1686
lemma Lim_measure_decseq:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1687
  assumes A: "range A \<subseteq> sets M" "decseq A" and fin: "\<And>i. emeasure M (A i) \<noteq> \<infinity>"
61969
e01015e49041 more symbols;
wenzelm
parents: 61880
diff changeset
  1688
  shows "(\<lambda>n. measure M (A n)) \<longlonglongrightarrow> measure M (\<Inter>i. A i)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1689
proof (rule tendsto_ennrealD)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1690
  have "ennreal (measure M (\<Inter>i. A i)) = emeasure M (\<Inter>i. A i)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1691
    using fin[of 0] A emeasure_mono[of "\<Inter>i. A i" "A 0" M]
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1692
    by (auto intro!: emeasure_eq_ennreal_measure[symmetric] simp: INT_lower less_top intro: le_less_trans)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1693
  moreover have "ennreal (measure M (A i)) = emeasure M (A i)" for i
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1694
    using A fin[of i] by (intro emeasure_eq_ennreal_measure[symmetric]) auto
67982
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1695
  ultimately show "(\<lambda>x. ennreal (measure M (A x))) \<longlonglongrightarrow> ennreal (measure M (\<Inter>i. A i))"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1696
    using fin A by (auto intro!: Lim_emeasure_decseq)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  1697
qed auto
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  1698
63958
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1699
subsection \<open>Set of measurable sets with finite measure\<close>
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1700
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  1701
definition\<^marker>\<open>tag important\<close> fmeasurable :: "'a measure \<Rightarrow> 'a set set" where
69564
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  1702
"fmeasurable M = {A\<in>sets M. emeasure M A < \<infinity>}"
63958
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1703
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1704
lemma fmeasurableD[dest, measurable_dest]: "A \<in> fmeasurable M \<Longrightarrow> A \<in> sets M"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1705
  by (auto simp: fmeasurable_def)
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1706
63959
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1707
lemma fmeasurableD2: "A \<in> fmeasurable M \<Longrightarrow> emeasure M A \<noteq> top"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1708
  by (auto simp: fmeasurable_def)
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1709
63958
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1710
lemma fmeasurableI: "A \<in> sets M \<Longrightarrow> emeasure M A < \<infinity> \<Longrightarrow> A \<in> fmeasurable M"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1711
  by (auto simp: fmeasurable_def)
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1712
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1713
lemma fmeasurableI_null_sets: "A \<in> null_sets M \<Longrightarrow> A \<in> fmeasurable M"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1714
  by (auto simp: fmeasurable_def)
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1715
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1716
lemma fmeasurableI2: "A \<in> fmeasurable M \<Longrightarrow> B \<subseteq> A \<Longrightarrow> B \<in> sets M \<Longrightarrow> B \<in> fmeasurable M"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1717
  using emeasure_mono[of B A M] by (auto simp: fmeasurable_def)
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1718
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1719
lemma measure_mono_fmeasurable:
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1720
  "A \<subseteq> B \<Longrightarrow> A \<in> sets M \<Longrightarrow> B \<in> fmeasurable M \<Longrightarrow> measure M A \<le> measure M B"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1721
  by (auto simp: measure_def fmeasurable_def intro!: emeasure_mono enn2real_mono)
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1722
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1723
lemma emeasure_eq_measure2: "A \<in> fmeasurable M \<Longrightarrow> emeasure M A = measure M A"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1724
  by (simp add: emeasure_eq_ennreal_measure fmeasurable_def less_top)
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1725
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1726
interpretation fmeasurable: ring_of_sets "space M" "fmeasurable M"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1727
proof (rule ring_of_setsI)
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1728
  show "fmeasurable M \<subseteq> Pow (space M)" "{} \<in> fmeasurable M"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1729
    by (auto simp: fmeasurable_def dest: sets.sets_into_space)
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1730
  fix a b assume *: "a \<in> fmeasurable M" "b \<in> fmeasurable M"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1731
  then have "emeasure M (a \<union> b) \<le> emeasure M a + emeasure M b"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1732
    by (intro emeasure_subadditive) auto
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1733
  also have "\<dots> < top"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1734
    using * by (auto simp: fmeasurable_def)
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1735
  finally show  "a \<union> b \<in> fmeasurable M"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1736
    using * by (auto intro: fmeasurableI)
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1737
  show "a - b \<in> fmeasurable M"
69286
nipkow
parents: 69260
diff changeset
  1738
    using emeasure_mono[of "a - b" a M] * by (auto simp: fmeasurable_def)
63958
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1739
qed
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1740
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  1741
subsection\<^marker>\<open>tag unimportant\<close>\<open>Measurable sets formed by unions and intersections\<close>
67989
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1742
63958
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1743
lemma fmeasurable_Diff: "A \<in> fmeasurable M \<Longrightarrow> B \<in> sets M \<Longrightarrow> A - B \<in> fmeasurable M"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1744
  using fmeasurableI2[of A M "A - B"] by auto
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1745
67673
c8caefb20564 lots of new material, ultimately related to measure theory
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
  1746
lemma fmeasurable_Int_fmeasurable:
c8caefb20564 lots of new material, ultimately related to measure theory
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
  1747
   "\<lbrakk>S \<in> fmeasurable M; T \<in> sets M\<rbrakk> \<Longrightarrow> (S \<inter> T) \<in> fmeasurable M"
c8caefb20564 lots of new material, ultimately related to measure theory
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
  1748
  by (meson fmeasurableD fmeasurableI2 inf_le1 sets.Int)
c8caefb20564 lots of new material, ultimately related to measure theory
paulson <lp15@cam.ac.uk>
parents: 67399
diff changeset
  1749
63958
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1750
lemma fmeasurable_UN:
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1751
  assumes "countable I" "\<And>i. i \<in> I \<Longrightarrow> F i \<subseteq> A" "\<And>i. i \<in> I \<Longrightarrow> F i \<in> sets M" "A \<in> fmeasurable M"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1752
  shows "(\<Union>i\<in>I. F i) \<in> fmeasurable M"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1753
proof (rule fmeasurableI2)
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1754
  show "A \<in> fmeasurable M" "(\<Union>i\<in>I. F i) \<subseteq> A" using assms by auto
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1755
  show "(\<Union>i\<in>I. F i) \<in> sets M"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1756
    using assms by (intro sets.countable_UN') auto
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1757
qed
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1758
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1759
lemma fmeasurable_INT:
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1760
  assumes "countable I" "i \<in> I" "\<And>i. i \<in> I \<Longrightarrow> F i \<in> sets M" "F i \<in> fmeasurable M"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1761
  shows "(\<Inter>i\<in>I. F i) \<in> fmeasurable M"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1762
proof (rule fmeasurableI2)
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1763
  show "F i \<in> fmeasurable M" "(\<Inter>i\<in>I. F i) \<subseteq> F i"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1764
    using assms by auto
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1765
  show "(\<Inter>i\<in>I. F i) \<in> sets M"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1766
    using assms by (intro sets.countable_INT') auto
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1767
qed
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  1768
67982
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1769
lemma measurable_measure_Diff:
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1770
  assumes "A \<in> fmeasurable M" "B \<in> sets M" "B \<subseteq> A"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1771
  shows "measure M (A - B) = measure M A - measure M B"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1772
  by (simp add: assms fmeasurableD fmeasurableD2 measure_Diff)
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1773
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1774
lemma measurable_Un_null_set:
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1775
  assumes "B \<in> null_sets M"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1776
  shows "(A \<union> B \<in> fmeasurable M \<and> A \<in> sets M) \<longleftrightarrow> A \<in> fmeasurable M"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1777
  using assms  by (fastforce simp: fmeasurable.Un fmeasurableI_null_sets intro: fmeasurableI2)
67982
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1778
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1779
lemma measurable_Diff_null_set:
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1780
  assumes "B \<in> null_sets M"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1781
  shows "(A - B) \<in> fmeasurable M \<and> A \<in> sets M \<longleftrightarrow> A \<in> fmeasurable M"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1782
  using assms
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1783
  by (metis Un_Diff_cancel2 fmeasurable.Diff fmeasurableD fmeasurableI_null_sets measurable_Un_null_set)
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1784
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1785
lemma fmeasurable_Diff_D:
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1786
    assumes m: "T - S \<in> fmeasurable M" "S \<in> fmeasurable M" and sub: "S \<subseteq> T"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1787
    shows "T \<in> fmeasurable M"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1788
proof -
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1789
  have "T = S \<union> (T - S)"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1790
    using assms by blast
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1791
  then show ?thesis
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1792
    by (metis m fmeasurable.Un)
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1793
qed
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1794
63959
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1795
lemma measure_Un2:
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1796
  "\<lbrakk>A \<in> fmeasurable M; B \<in> fmeasurable M\<rbrakk> \<Longrightarrow> measure M (A\<union>B) = measure M A + measure M (B - A)"
63959
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1797
  using measure_Union[of M A "B - A"] by (auto simp: fmeasurableD2 fmeasurable.Diff)
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1798
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1799
lemma measure_Un3:
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1800
  assumes "A \<in> fmeasurable M" "B \<in> fmeasurable M"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1801
  shows "measure M (A \<union> B) = measure M A + measure M B - measure M (A \<inter> B)"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1802
proof -
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1803
  have "measure M (A \<union> B) = measure M A + measure M (B - A)"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1804
    using assms by (rule measure_Un2)
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1805
  also have "B - A = B - (A \<inter> B)"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1806
    by auto
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1807
  also have "measure M (B - (A \<inter> B)) = measure M B - measure M (A \<inter> B)"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1808
    using assms by (intro measure_Diff) (auto simp: fmeasurable_def)
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1809
  finally show ?thesis
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1810
    by simp
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1811
qed
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1812
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1813
lemma measure_Un_AE:
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1814
  "AE x in M. x \<notin> A \<or> x \<notin> B \<Longrightarrow> A \<in> fmeasurable M \<Longrightarrow> B \<in> fmeasurable M \<Longrightarrow>
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1815
  measure M (A \<union> B) = measure M A + measure M B"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1816
  by (subst measure_Un2) (auto intro!: measure_eq_AE)
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1817
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1818
lemma measure_UNION_AE:
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1819
  assumes I: "finite I"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1820
  shows "(\<And>i. i \<in> I \<Longrightarrow> F i \<in> fmeasurable M) \<Longrightarrow> pairwise (\<lambda>i j. AE x in M. x \<notin> F i \<or> x \<notin> F j) I \<Longrightarrow>
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1821
    measure M (\<Union>i\<in>I. F i) = (\<Sum>i\<in>I. measure M (F i))"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1822
  unfolding AE_pairwise[OF countable_finite, OF I]
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1823
  using I
67982
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1824
proof (induction I rule: finite_induct)
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1825
  case (insert x I)
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69286
diff changeset
  1826
  have "measure M (F x \<union> \<Union>(F ` I)) = measure M (F x) + measure M (\<Union>(F ` I))"
67982
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1827
    by (rule measure_Un_AE) (use insert in \<open>auto simp: pairwise_insert\<close>)
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1828
    with insert show ?case
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1829
      by (simp add: pairwise_insert )
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1830
qed simp
63959
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1831
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1832
lemma measure_UNION':
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1833
  "finite I \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> F i \<in> fmeasurable M) \<Longrightarrow> pairwise (\<lambda>i j. disjnt (F i) (F j)) I \<Longrightarrow>
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1834
    measure M (\<Union>i\<in>I. F i) = (\<Sum>i\<in>I. measure M (F i))"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1835
  by (intro measure_UNION_AE) (auto simp: disjnt_def elim!: pairwise_mono intro!: always_eventually)
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1836
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1837
lemma measure_Union_AE:
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1838
  "finite F \<Longrightarrow> (\<And>S. S \<in> F \<Longrightarrow> S \<in> fmeasurable M) \<Longrightarrow> pairwise (\<lambda>S T. AE x in M. x \<notin> S \<or> x \<notin> T) F \<Longrightarrow>
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1839
    measure M (\<Union>F) = (\<Sum>S\<in>F. measure M S)"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1840
  using measure_UNION_AE[of F "\<lambda>x. x" M] by simp
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1841
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1842
lemma measure_Union':
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1843
  "finite F \<Longrightarrow> (\<And>S. S \<in> F \<Longrightarrow> S \<in> fmeasurable M) \<Longrightarrow> pairwise disjnt F \<Longrightarrow> measure M (\<Union>F) = (\<Sum>S\<in>F. measure M S)"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1844
  using measure_UNION'[of F "\<lambda>x. x" M] by simp
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1845
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1846
lemma measure_Un_le:
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1847
  assumes "A \<in> sets M" "B \<in> sets M" shows "measure M (A \<union> B) \<le> measure M A + measure M B"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1848
proof cases
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1849
  assume "A \<in> fmeasurable M \<and> B \<in> fmeasurable M"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1850
  with measure_subadditive[of A M B] assms show ?thesis
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1851
    by (auto simp: fmeasurableD2)
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1852
next
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1853
  assume "\<not> (A \<in> fmeasurable M \<and> B \<in> fmeasurable M)"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1854
  then have "A \<union> B \<notin> fmeasurable M"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1855
    using fmeasurableI2[of "A \<union> B" M A] fmeasurableI2[of "A \<union> B" M B] assms by auto
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1856
  with assms show ?thesis
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1857
    by (auto simp: fmeasurable_def measure_def less_top[symmetric])
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1858
qed
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1859
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1860
lemma measure_UNION_le:
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1861
  "finite I \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> F i \<in> sets M) \<Longrightarrow> measure M (\<Union>i\<in>I. F i) \<le> (\<Sum>i\<in>I. measure M (F i))"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1862
proof (induction I rule: finite_induct)
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1863
  case (insert i I)
71840
8ed78bb0b915 Tuned some proofs in HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71633
diff changeset
  1864
  then have "measure M (\<Union>i\<in>insert i I. F i) = measure M (F i \<union> \<Union> (F ` I))"
8ed78bb0b915 Tuned some proofs in HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71633
diff changeset
  1865
    by simp
8ed78bb0b915 Tuned some proofs in HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71633
diff changeset
  1866
  also from insert have "measure M (F i \<union> \<Union> (F ` I)) \<le> measure M (F i) + measure M (\<Union> (F ` I))"
8ed78bb0b915 Tuned some proofs in HOL-Analysis
Manuel Eberl <eberlm@in.tum.de>
parents: 71633
diff changeset
  1867
    by (intro measure_Un_le sets.finite_Union) auto
63959
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1868
  also have "measure M (\<Union>i\<in>I. F i) \<le> (\<Sum>i\<in>I. measure M (F i))"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1869
    using insert by auto
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1870
  finally show ?case
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1871
    using insert by simp
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1872
qed simp
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1873
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1874
lemma measure_Union_le:
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1875
  "finite F \<Longrightarrow> (\<And>S. S \<in> F \<Longrightarrow> S \<in> sets M) \<Longrightarrow> measure M (\<Union>F) \<le> (\<Sum>S\<in>F. measure M S)"
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1876
  using measure_UNION_le[of F "\<lambda>x. x" M] by simp
f77dca1abf1b HOL-Analysis: prove that a starlike set is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63958
diff changeset
  1877
67989
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1878
text\<open>Version for indexed union over a countable set\<close>
63968
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1879
lemma
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1880
  assumes "countable I" and I: "\<And>i. i \<in> I \<Longrightarrow> A i \<in> fmeasurable M"
67989
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1881
    and bound: "\<And>I'. I' \<subseteq> I \<Longrightarrow> finite I' \<Longrightarrow> measure M (\<Union>i\<in>I'. A i) \<le> B"
63968
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1882
  shows fmeasurable_UN_bound: "(\<Union>i\<in>I. A i) \<in> fmeasurable M" (is ?fm)
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1883
    and measure_UN_bound: "measure M (\<Union>i\<in>I. A i) \<le> B" (is ?m)
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1884
proof -
67989
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1885
  have "B \<ge> 0"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1886
    using bound by force
63968
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1887
  have "?fm \<and> ?m"
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1888
  proof cases
67989
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1889
    assume "I = {}"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1890
    with \<open>B \<ge> 0\<close> show ?thesis
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1891
      by simp
63968
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1892
  next
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1893
    assume "I \<noteq> {}"
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1894
    have "(\<Union>i\<in>I. A i) = (\<Union>i. (\<Union>n\<le>i. A (from_nat_into I n)))"
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1895
      by (subst range_from_nat_into[symmetric, OF \<open>I \<noteq> {}\<close> \<open>countable I\<close>]) auto
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1896
    then have "emeasure M (\<Union>i\<in>I. A i) = emeasure M (\<Union>i. (\<Union>n\<le>i. A (from_nat_into I n)))" by simp
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1897
    also have "\<dots> = (SUP i. emeasure M (\<Union>n\<le>i. A (from_nat_into I n)))"
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1898
      using I \<open>I \<noteq> {}\<close>[THEN from_nat_into] by (intro SUP_emeasure_incseq[symmetric]) (fastforce simp: incseq_Suc_iff)+
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1899
    also have "\<dots> \<le> B"
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1900
    proof (intro SUP_least)
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1901
      fix i :: nat
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1902
      have "emeasure M (\<Union>n\<le>i. A (from_nat_into I n)) = measure M (\<Union>n\<le>i. A (from_nat_into I n))"
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1903
        using I \<open>I \<noteq> {}\<close>[THEN from_nat_into] by (intro emeasure_eq_measure2 fmeasurable.finite_UN) auto
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1904
      also have "\<dots> = measure M (\<Union>n\<in>from_nat_into I ` {..i}. A n)"
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1905
        by simp
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1906
      also have "\<dots> \<le> B"
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1907
        by (intro ennreal_leI bound) (auto intro:  from_nat_into[OF \<open>I \<noteq> {}\<close>])
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1908
      finally show "emeasure M (\<Union>n\<le>i. A (from_nat_into I n)) \<le> ennreal B" .
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1909
    qed
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1910
    finally have *: "emeasure M (\<Union>i\<in>I. A i) \<le> B" .
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1911
    then have ?fm
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1912
      using I \<open>countable I\<close> by (intro fmeasurableI conjI) (auto simp: less_top[symmetric] top_unique)
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1913
    with * \<open>0\<le>B\<close> show ?thesis
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1914
      by (simp add: emeasure_eq_measure2)
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1915
  qed
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1916
  then show ?fm ?m by auto
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1917
qed
4359400adfe7 HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents: 63959
diff changeset
  1918
67989
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1919
text\<open>Version for big union of a countable set\<close>
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1920
lemma
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1921
  assumes "countable \<D>"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1922
    and meas: "\<And>D. D \<in> \<D> \<Longrightarrow> D \<in> fmeasurable M"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1923
    and bound:  "\<And>\<E>. \<lbrakk>\<E> \<subseteq> \<D>; finite \<E>\<rbrakk> \<Longrightarrow> measure M (\<Union>\<E>) \<le> B"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1924
 shows fmeasurable_Union_bound: "\<Union>\<D> \<in> fmeasurable M"  (is ?fm)
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1925
    and measure_Union_bound: "measure M (\<Union>\<D>) \<le> B"     (is ?m)
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1926
proof -
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1927
  have "B \<ge> 0"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1928
    using bound by force
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1929
  have "?fm \<and> ?m"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1930
  proof (cases "\<D> = {}")
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1931
    case True
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1932
    with \<open>B \<ge> 0\<close> show ?thesis
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1933
      by auto
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1934
  next
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1935
    case False
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1936
    then obtain D :: "nat \<Rightarrow> 'a set" where D: "\<D> = range D"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1937
      using \<open>countable \<D>\<close> uncountable_def by force
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1938
      have 1: "\<And>i. D i \<in> fmeasurable M"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1939
        by (simp add: D meas)
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1940
      have 2: "\<And>I'. finite I' \<Longrightarrow> measure M (\<Union>x\<in>I'. D x) \<le> B"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1941
        by (simp add: D bound image_subset_iff)
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1942
      show ?thesis
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1943
        unfolding D
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1944
        by (intro conjI fmeasurable_UN_bound [OF _ 1 2] measure_UN_bound [OF _ 1 2]) auto
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1945
    qed
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1946
    then show ?fm ?m by auto
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1947
qed
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1948
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1949
text\<open>Version for indexed union over the type of naturals\<close>
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1950
lemma
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1951
  fixes S :: "nat \<Rightarrow> 'a set"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1952
  assumes S: "\<And>i. S i \<in> fmeasurable M" and B: "\<And>n. measure M (\<Union>i\<le>n. S i) \<le> B"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1953
  shows fmeasurable_countable_Union: "(\<Union>i. S i) \<in> fmeasurable M"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1954
    and measure_countable_Union_le: "measure M (\<Union>i. S i) \<le> B"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1955
proof -
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1956
  have mB: "measure M (\<Union>i\<in>I. S i) \<le> B" if "finite I" for I
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1957
  proof -
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1958
    have "(\<Union>i\<in>I. S i) \<subseteq> (\<Union>i\<le>Max I. S i)"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1959
      using Max_ge that by force
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1960
    then have "measure M (\<Union>i\<in>I. S i) \<le> measure M (\<Union>i \<le> Max I. S i)"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1961
      by (rule measure_mono_fmeasurable) (use S in \<open>blast+\<close>)
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1962
    then show ?thesis
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1963
      using B order_trans by blast
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1964
  qed
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1965
  show "(\<Union>i. S i) \<in> fmeasurable M"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1966
    by (auto intro: fmeasurable_UN_bound [OF _ S mB])
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1967
  show "measure M (\<Union>n. S n) \<le> B"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1968
    by (auto intro: measure_UN_bound [OF _ S mB])
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1969
qed
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67982
diff changeset
  1970
67982
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1971
lemma measure_diff_le_measure_setdiff:
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1972
  assumes "S \<in> fmeasurable M" "T \<in> fmeasurable M"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1973
  shows "measure M S - measure M T \<le> measure M (S - T)"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1974
proof -
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1975
  have "measure M S \<le> measure M ((S - T) \<union> T)"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1976
    by (simp add: assms fmeasurable.Un fmeasurableD measure_mono_fmeasurable)
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1977
  also have "\<dots> \<le> measure M (S - T) + measure M T"
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1978
    using assms by (blast intro: measure_Un_le)
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1979
  finally show ?thesis
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1980
    by (simp add: algebra_simps)
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1981
qed
7643b005b29a various new results on measures, integrals, etc., and some simplified proofs
paulson <lp15@cam.ac.uk>
parents: 67962
diff changeset
  1982
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1983
lemma suminf_exist_split2:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1984
  fixes f :: "nat \<Rightarrow> 'a::real_normed_vector"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1985
  assumes "summable f"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1986
  shows "(\<lambda>n. (\<Sum>k. f(k+n))) \<longlonglongrightarrow> 0"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1987
by (subst lim_sequentially, auto simp: dist_norm suminf_exist_split[OF _ assms])
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1988
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1989
lemma emeasure_union_summable:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1990
  assumes [measurable]: "\<And>n. A n \<in> sets M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1991
    and "\<And>n. emeasure M (A n) < \<infinity>" "summable (\<lambda>n. measure M (A n))"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1992
  shows "emeasure M (\<Union>n. A n) < \<infinity>" "emeasure M (\<Union>n. A n) \<le> (\<Sum>n. measure M (A n))"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1993
proof -
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1994
  define B where "B = (\<lambda>N. (\<Union>n\<in>{..<N}. A n))"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  1995
  have [measurable]: "B N \<in> sets M" for N unfolding B_def by auto
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1996
  have "incseq B"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1997
    by (auto simp: SUP_subset_mono B_def incseq_def)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1998
  then have "(\<lambda>N. emeasure M (B N)) \<longlonglongrightarrow> emeasure M (\<Union>N. B N)"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  1999
    by (simp add: Lim_emeasure_incseq image_subset_iff)
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2000
  moreover have "emeasure M (B N) \<le> ennreal (\<Sum>n. measure M (A n))" for N
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2001
  proof -
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2002
    have *: "(\<Sum>n<N. measure M (A n)) \<le> (\<Sum>n. measure M (A n))"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2003
      using \<open>summable _\<close> measure_nonneg sum_le_suminf by blast
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2004
    have "emeasure M (B N) \<le> (\<Sum>n<N. emeasure M (A n))"
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2005
      unfolding B_def by (rule emeasure_subadditive_finite, auto)
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2006
    also have "\<dots> = (\<Sum>n<N. ennreal(measure M (A n)))"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2007
      using assms by (simp add: emeasure_eq_ennreal_measure less_top)
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2008
    also have "\<dots> = ennreal (\<Sum>n<N. measure M (A n))"
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2009
      by auto
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
  2010
    also have "\<dots> \<le> ennreal (\<Sum>n. measure M (A n))"
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2011
      using * by (auto simp: ennreal_leI)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2012
    finally show ?thesis by simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2013
  qed
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2014
  ultimately have "emeasure M (\<Union>N. B N) \<le> ennreal (\<Sum>n. measure M (A n))"
68532
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68484
diff changeset
  2015
    by (simp add: Lim_bounded)
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2016
  then show "emeasure M (\<Union>n. A n) \<le> (\<Sum>n. measure M (A n))"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2017
    unfolding B_def by (metis UN_UN_flatten UN_lessThan_UNIV)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2018
  then show "emeasure M (\<Union>n. A n) < \<infinity>"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2019
    by (auto simp: less_top[symmetric] top_unique)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2020
qed
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2021
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2022
lemma borel_cantelli_limsup1:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2023
  assumes [measurable]: "\<And>n. A n \<in> sets M"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2024
    and "\<And>n. emeasure M (A n) < \<infinity>" and sum: "summable (\<lambda>n. measure M (A n))"
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2025
  shows "limsup A \<in> null_sets M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2026
proof -
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2027
  have "emeasure M (limsup A) \<le> 0"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2028
  proof (rule LIMSEQ_le_const)
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2029
    have "(\<lambda>n. (\<Sum>k. measure M (A (k+n)))) \<longlonglongrightarrow> 0" by (rule suminf_exist_split2[OF sum])
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2030
    then show "(\<lambda>n. ennreal (\<Sum>k. measure M (A (k+n)))) \<longlonglongrightarrow> 0"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2031
      unfolding ennreal_0[symmetric] by (intro tendsto_ennrealI)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2032
    have "emeasure M (limsup A) \<le> (\<Sum>k. measure M (A (k+n)))" for n
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2033
    proof -
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2034
      have I: "(\<Union>k\<in>{n..}. A k) = (\<Union>k. A (k+n))" by (auto, metis le_add_diff_inverse2, fastforce)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2035
      have "emeasure M (limsup A) \<le> emeasure M (\<Union>k\<in>{n..}. A k)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2036
        by (rule emeasure_mono, auto simp: limsup_INF_SUP)
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
  2037
      also have "\<dots> = emeasure M (\<Union>k. A (k+n))"
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2038
        using I by auto
76822
25c0d4c0e110 More tidying
paulson <lp15@cam.ac.uk>
parents: 74598
diff changeset
  2039
      also have "\<dots> \<le> (\<Sum>k. measure M (A (k+n)))"
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2040
        apply (rule emeasure_union_summable)
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2041
        using assms summable_ignore_initial_segment[OF sum, of n] by auto
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2042
      finally show ?thesis by simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2043
    qed
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2044
    then show "\<exists>N. \<forall>n\<ge>N. emeasure M (limsup A) \<le> (\<Sum>k. measure M (A (k+n)))"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2045
      by auto
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2046
  qed
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2047
  then show ?thesis using assms(1) measurable_limsup by auto
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2048
qed
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2049
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2050
lemma borel_cantelli_AE1:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2051
  assumes [measurable]: "\<And>n. A n \<in> sets M"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2052
    and "\<And>n. emeasure M (A n) < \<infinity>" "summable (\<lambda>n. measure M (A n))"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2053
  shows "AE x in M. eventually (\<lambda>n. x \<in> space M - A n) sequentially"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2054
proof -
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2055
  have "AE x in M. x \<notin> limsup A"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2056
    using borel_cantelli_limsup1[OF assms] unfolding eventually_ae_filter by auto
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2057
  moreover have "\<forall>\<^sub>F n in sequentially. x \<notin> A n" if "x \<notin> limsup A" for x
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2058
    using that  by (auto simp: limsup_INF_SUP eventually_sequentially)
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2059
  ultimately show ?thesis by auto
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2060
qed
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64267
diff changeset
  2061
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 69566
diff changeset
  2062
subsection \<open>Measure spaces with \<^term>\<open>emeasure M (space M) < \<infinity>\<close>\<close>
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2063
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  2064
locale\<^marker>\<open>tag important\<close> finite_measure = sigma_finite_measure M for M +
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2065
  assumes finite_emeasure_space: "emeasure M (space M) \<noteq> top"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2066
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2067
lemma finite_measureI[Pure.intro!]:
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  2068
  "emeasure M (space M) \<noteq> \<infinity> \<Longrightarrow> finite_measure M"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57446
diff changeset
  2069
  proof qed (auto intro!: exI[of _ "{space M}"])
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2070
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2071
lemma (in finite_measure) emeasure_finite[simp, intro]: "emeasure M A \<noteq> top"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2072
  using finite_emeasure_space emeasure_space[of M A] by (auto simp: top_unique)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2073
63958
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  2074
lemma (in finite_measure) fmeasurable_eq_sets: "fmeasurable M = sets M"
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  2075
  by (auto simp: fmeasurable_def less_top[symmetric])
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  2076
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2077
lemma (in finite_measure) emeasure_eq_measure: "emeasure M A = ennreal (measure M A)"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2078
  by (intro emeasure_eq_ennreal_measure) simp
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2079
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2080
lemma (in finite_measure) emeasure_real: "\<exists>r. 0 \<le> r \<and> emeasure M A = ennreal r"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2081
  using emeasure_finite[of A] by (cases "emeasure M A" rule: ennreal_cases) auto
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2082
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2083
lemma (in finite_measure) bounded_measure: "measure M A \<le> measure M (space M)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2084
  using emeasure_space[of M A] emeasure_real[of A] emeasure_real[of "space M"] by (auto simp: measure_def)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2085
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2086
lemma (in finite_measure) finite_measure_Diff:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2087
  assumes sets: "A \<in> sets M" "B \<in> sets M" and "B \<subseteq> A"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2088
  shows "measure M (A - B) = measure M A - measure M B"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2089
  using measure_Diff[OF _ assms] by simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2090
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2091
lemma (in finite_measure) finite_measure_Union:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2092
  assumes sets: "A \<in> sets M" "B \<in> sets M" and "A \<inter> B = {}"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2093
  shows "measure M (A \<union> B) = measure M A + measure M B"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2094
  using measure_Union[OF _ _ assms] by simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2095
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2096
lemma (in finite_measure) finite_measure_finite_Union:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2097
  assumes measurable: "finite S" "A`S \<subseteq> sets M" "disjoint_family_on A S"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2098
  shows "measure M (\<Union>i\<in>S. A i) = (\<Sum>i\<in>S. measure M (A i))"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2099
  using measure_finite_Union[OF assms] by simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2100
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2101
lemma (in finite_measure) finite_measure_UNION:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2102
  assumes A: "range A \<subseteq> sets M" "disjoint_family A"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2103
  shows "(\<lambda>i. measure M (A i)) sums (measure M (\<Union>i. A i))"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2104
  using measure_UNION[OF A] by simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2105
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2106
lemma (in finite_measure) finite_measure_mono:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2107
  assumes "A \<subseteq> B" "B \<in> sets M" shows "measure M A \<le> measure M B"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2108
  using emeasure_mono[OF assms] emeasure_real[of A] emeasure_real[of B] by (auto simp: measure_def)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2109
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2110
lemma (in finite_measure) finite_measure_subadditive_finite:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2111
  assumes "finite I" "A`I \<subseteq> sets M" shows "measure M (\<Union>i\<in>I. A i) \<le> (\<Sum>i\<in>I. measure M (A i))"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2112
  using measure_subadditive_finite[OF assms] by simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2113
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2114
lemma (in finite_measure) finite_measure_subadditive_countably:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2115
  "range A \<subseteq> sets M \<Longrightarrow> summable (\<lambda>i. measure M (A i)) \<Longrightarrow> measure M (\<Union>i. A i) \<le> (\<Sum>i. measure M (A i))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2116
  by (rule measure_subadditive_countably)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2117
     (simp_all add: ennreal_suminf_neq_top emeasure_eq_measure)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2118
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
  2119
lemma (in finite_measure) finite_measure_eq_sum_singleton:
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2120
  assumes "finite S" and *: "\<And>x. x \<in> S \<Longrightarrow> {x} \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2121
  shows "measure M S = (\<Sum>x\<in>S. measure M {x})"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
  2122
  using measure_eq_sum_singleton[OF assms] by simp
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2123
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2124
lemma (in finite_measure) finite_Lim_measure_incseq:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2125
  assumes A: "range A \<subseteq> sets M" "incseq A"
61969
e01015e49041 more symbols;
wenzelm
parents: 61880
diff changeset
  2126
  shows "(\<lambda>i. measure M (A i)) \<longlonglongrightarrow> measure M (\<Union>i. A i)"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2127
  using Lim_measure_incseq[OF A] by simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2128
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2129
lemma (in finite_measure) finite_Lim_measure_decseq:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2130
  assumes A: "range A \<subseteq> sets M" "decseq A"
61969
e01015e49041 more symbols;
wenzelm
parents: 61880
diff changeset
  2131
  shows "(\<lambda>n. measure M (A n)) \<longlonglongrightarrow> measure M (\<Inter>i. A i)"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2132
  using Lim_measure_decseq[OF A] by simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2133
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2134
lemma (in finite_measure) finite_measure_compl:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2135
  assumes S: "S \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2136
  shows "measure M (space M - S) = measure M (space M) - measure M S"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
  2137
  using measure_Diff[OF _ sets.top S sets.sets_into_space] S by simp
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2138
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2139
lemma (in finite_measure) finite_measure_mono_AE:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2140
  assumes imp: "AE x in M. x \<in> A \<longrightarrow> x \<in> B" and B: "B \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2141
  shows "measure M A \<le> measure M B"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2142
  using assms emeasure_mono_AE[OF imp B]
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2143
  by (simp add: emeasure_eq_measure)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2144
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2145
lemma (in finite_measure) finite_measure_eq_AE:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2146
  assumes iff: "AE x in M. x \<in> A \<longleftrightarrow> x \<in> B"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2147
  assumes A: "A \<in> sets M" and B: "B \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2148
  shows "measure M A = measure M B"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2149
  using assms emeasure_eq_AE[OF assms] by (simp add: emeasure_eq_measure)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2150
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2151
lemma (in finite_measure) measure_increasing: "increasing M (measure M)"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2152
  by (auto intro!: finite_measure_mono simp: increasing_def)
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2153
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2154
lemma (in finite_measure) measure_zero_union:
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2155
  assumes "S \<in> sets M" "T \<in> sets M" "measure M T = 0"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2156
  shows "measure M (S \<union> T) = measure M S"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2157
using assms
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2158
proof -
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2159
  have "measure M (S \<union> T) \<le> measure M S"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2160
    by (metis add.right_neutral assms measure_Un_le)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2161
  moreover have "measure M (S \<union> T) \<ge> measure M S"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2162
    using assms by (blast intro: finite_measure_mono)
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2163
  ultimately show ?thesis by simp
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2164
qed
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2165
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2166
lemma (in finite_measure) measure_eq_compl:
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2167
  assumes "S \<in> sets M" "T \<in> sets M"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2168
  assumes "measure M (space M - S) = measure M (space M - T)"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2169
  shows "measure M S = measure M T"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2170
  using assms finite_measure_compl by auto
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2171
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2172
lemma (in finite_measure) measure_eq_bigunion_image:
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2173
  assumes "range f \<subseteq> sets M" "range g \<subseteq> sets M"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2174
  assumes "disjoint_family f" "disjoint_family g"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2175
  assumes "\<And> n :: nat. measure M (f n) = measure M (g n)"
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60580
diff changeset
  2176
  shows "measure M (\<Union>i. f i) = measure M (\<Union>i. g i)"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2177
using assms
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2178
proof -
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60580
diff changeset
  2179
  have a: "(\<lambda> i. measure M (f i)) sums (measure M (\<Union>i. f i))"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2180
    by (rule finite_measure_UNION[OF assms(1,3)])
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60580
diff changeset
  2181
  have b: "(\<lambda> i. measure M (g i)) sums (measure M (\<Union>i. g i))"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2182
    by (rule finite_measure_UNION[OF assms(2,4)])
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2183
  show ?thesis using sums_unique[OF b] sums_unique[OF a] assms by simp
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2184
qed
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2185
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2186
lemma (in finite_measure) measure_countably_zero:
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2187
  assumes "range c \<subseteq> sets M"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2188
  assumes "\<And> i. measure M (c i) = 0"
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60580
diff changeset
  2189
  shows "measure M (\<Union>i :: nat. c i) = 0"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2190
proof (rule antisym)
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60580
diff changeset
  2191
  show "measure M (\<Union>i :: nat. c i) \<le> 0"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2192
    using finite_measure_subadditive_countably[OF assms(1)] by (simp add: assms(2))
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2193
qed simp
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2194
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2195
lemma (in finite_measure) measure_space_inter:
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2196
  assumes events:"S \<in> sets M" "T \<in> sets M"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2197
  assumes "measure M T = measure M (space M)"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2198
  shows "measure M (S \<inter> T) = measure M S"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2199
proof -
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2200
  have "measure M ((space M - S) \<union> (space M - T)) = measure M (space M - S)"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2201
    using events assms finite_measure_compl[of "T"] by (auto intro!: measure_zero_union)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2202
  also have "(space M - S) \<union> (space M - T) = space M - (S \<inter> T)"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2203
    by blast
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2204
  finally show "measure M (S \<inter> T) = measure M S"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2205
    using events by (auto intro!: measure_eq_compl[of "S \<inter> T" S])
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2206
qed
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2207
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2208
lemma (in finite_measure) measure_equiprobable_finite_unions:
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2209
  assumes S: "finite S" "\<And>x. x \<in> S \<Longrightarrow> {x} \<in> sets M"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2210
  assumes "\<And> x y. \<lbrakk>x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> measure M {x} = measure M {y}"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2211
  shows "measure M S = real (card S) * measure M {SOME x. x \<in> S}"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2212
proof cases
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2213
  assume "S \<noteq> {}"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2214
  then have "\<exists> x. x \<in> S" by blast
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2215
  from someI_ex[OF this] assms
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2216
  have prob_some: "\<And> x. x \<in> S \<Longrightarrow> measure M {x} = measure M {SOME y. y \<in> S}" by blast
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2217
  have "measure M S = (\<Sum> x \<in> S. measure M {x})"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2218
    using finite_measure_eq_sum_singleton[OF S] by simp
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2219
  also have "\<dots> = (\<Sum> x \<in> S. measure M {SOME y. y \<in> S})" using prob_some by auto
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2220
  also have "\<dots> = real (card S) * measure M {(SOME x. x \<in> S)}"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
  2221
    using sum_constant assms by simp
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2222
  finally show ?thesis by simp
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2223
qed simp
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2224
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2225
lemma (in finite_measure) measure_real_sum_image_fn:
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2226
  assumes "e \<in> sets M"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2227
  assumes "\<And> x. x \<in> S \<Longrightarrow> e \<inter> f x \<in> sets M"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2228
  assumes "finite S"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2229
  assumes disjoint: "\<And> x y. \<lbrakk>x \<in> S ; y \<in> S ; x \<noteq> y\<rbrakk> \<Longrightarrow> f x \<inter> f y = {}"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2230
  assumes upper: "space M \<subseteq> (\<Union>i \<in> S. f i)"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2231
  shows "measure M e = (\<Sum> x \<in> S. measure M (e \<inter> f x))"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2232
proof -
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2233
  have "e \<subseteq> (\<Union>i\<in>S. f i)"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  2234
    using \<open>e \<in> sets M\<close> sets.sets_into_space upper by blast
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2235
  then have e: "e = (\<Union>i \<in> S. e \<inter> f i)"
62343
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 61969
diff changeset
  2236
    by auto
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2237
  hence "measure M e = measure M (\<Union>i \<in> S. e \<inter> f i)" by simp
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2238
  also have "\<dots> = (\<Sum> x \<in> S. measure M (e \<inter> f x))"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2239
  proof (rule finite_measure_finite_Union)
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2240
    show "finite S" by fact
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2241
    show "(\<lambda>i. e \<inter> f i)`S \<subseteq> sets M" using assms(2) by auto
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2242
    show "disjoint_family_on (\<lambda>i. e \<inter> f i) S"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2243
      using disjoint by (auto simp: disjoint_family_on_def)
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2244
  qed
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2245
  finally show ?thesis .
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2246
qed
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2247
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2248
lemma (in finite_measure) measure_exclude:
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2249
  assumes "A \<in> sets M" "B \<in> sets M"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2250
  assumes "measure M A = measure M (space M)" "A \<inter> B = {}"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2251
  shows "measure M B = 0"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50087
diff changeset
  2252
  using measure_space_inter[of B A] assms by (auto simp: ac_simps)
57235
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57137
diff changeset
  2253
lemma (in finite_measure) finite_measure_distr:
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  2254
  assumes f: "f \<in> measurable M M'"
57235
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57137
diff changeset
  2255
  shows "finite_measure (distr M M' f)"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57137
diff changeset
  2256
proof (rule finite_measureI)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57137
diff changeset
  2257
  have "f -` space M' \<inter> space M = space M" using f by (auto dest: measurable_space)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57137
diff changeset
  2258
  with f show "emeasure (distr M M' f) (space (distr M M' f)) \<noteq> \<infinity>" by (auto simp: emeasure_distr)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57137
diff changeset
  2259
qed
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57137
diff changeset
  2260
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
  2261
lemma emeasure_gfp[consumes 1, case_names cont measurable]:
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
  2262
  assumes sets[simp]: "\<And>s. sets (M s) = sets N"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
  2263
  assumes "\<And>s. finite_measure (M s)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
  2264
  assumes cont: "inf_continuous F" "inf_continuous f"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
  2265
  assumes meas: "\<And>P. Measurable.pred N P \<Longrightarrow> Measurable.pred N (F P)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
  2266
  assumes iter: "\<And>P s. Measurable.pred N P \<Longrightarrow> emeasure (M s) {x\<in>space N. F P x} = f (\<lambda>s. emeasure (M s) {x\<in>space N. P x}) s"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
  2267
  assumes bound: "\<And>P. f P \<le> f (\<lambda>s. emeasure (M s) (space (M s)))"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
  2268
  shows "emeasure (M s) {x\<in>space N. gfp F x} = gfp f s"
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2269
proof (subst gfp_transfer_bounded[where \<alpha>="\<lambda>F s. emeasure (M s) {x\<in>space N. F x}" and P="Measurable.pred N", symmetric])
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
  2270
  interpret finite_measure "M s" for s by fact
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
  2271
  fix C assume "decseq C" "\<And>i. Measurable.pred N (C i)"
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
  2272
  then show "(\<lambda>s. emeasure (M s) {x \<in> space N. (INF i. C i) x}) = (INF i. (\<lambda>s. emeasure (M s) {x \<in> space N. C i x}))"
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2273
    unfolding INF_apply
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
  2274
    by (subst INF_emeasure_decseq) (auto simp: antimono_def fun_eq_iff intro!: arg_cong2[where f=emeasure])
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
  2275
next
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
  2276
  show "f x \<le> (\<lambda>s. emeasure (M s) {x \<in> space N. F top x})" for x
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
  2277
    using bound[of x] sets_eq_imp_space_eq[OF sets] by (simp add: iter)
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2278
qed (auto simp: iter le_fun_def INF_apply[abs_def] intro!: meas cont)
60636
ee18efe9b246 add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents: 60585
diff changeset
  2279
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  2280
subsection\<^marker>\<open>tag unimportant\<close> \<open>Counting space\<close>
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2281
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2282
lemma strict_monoI_Suc:
78093
cec875dcc59e Finally, the abstract metric space development
paulson <lp15@cam.ac.uk>
parents: 77179
diff changeset
  2283
  assumes "(\<And>n. f n < f (Suc n))" shows "strict_mono f"
cec875dcc59e Finally, the abstract metric space development
paulson <lp15@cam.ac.uk>
parents: 77179
diff changeset
  2284
  by (simp add: assms strict_mono_Suc_iff)
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2285
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2286
lemma emeasure_count_space:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2287
  assumes "X \<subseteq> A" shows "emeasure (count_space A) X = (if finite X then of_nat (card X) else \<infinity>)"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2288
    (is "_ = ?M X")
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2289
  unfolding count_space_def
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2290
proof (rule emeasure_measure_of_sigma)
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  2291
  show "X \<in> Pow A" using \<open>X \<subseteq> A\<close> by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2292
  show "sigma_algebra A (Pow A)" by (rule sigma_algebra_Pow)
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2293
  show positive: "positive (Pow A) ?M"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2294
    by (auto simp: positive_def)
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2295
  have additive: "additive (Pow A) ?M"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2296
    by (auto simp: card_Un_disjoint additive_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2297
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2298
  interpret ring_of_sets A "Pow A"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2299
    by (rule ring_of_setsI) auto
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  2300
  show "countably_additive (Pow A) ?M"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2301
    unfolding countably_additive_iff_continuous_from_below[OF positive additive]
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2302
  proof safe
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2303
    fix F :: "nat \<Rightarrow> 'a set" assume "incseq F"
61969
e01015e49041 more symbols;
wenzelm
parents: 61880
diff changeset
  2304
    show "(\<lambda>i. ?M (F i)) \<longlonglongrightarrow> ?M (\<Union>i. F i)"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2305
    proof cases
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2306
      assume "\<exists>i. \<forall>j\<ge>i. F i = F j"
74362
0135a0c77b64 tuned proofs --- avoid 'guess';
wenzelm
parents: 73536
diff changeset
  2307
      then obtain i where i: "\<forall>j\<ge>i. F i = F j" ..
0135a0c77b64 tuned proofs --- avoid 'guess';
wenzelm
parents: 73536
diff changeset
  2308
      with \<open>incseq F\<close> have "F j \<subseteq> F i" for j
0135a0c77b64 tuned proofs --- avoid 'guess';
wenzelm
parents: 73536
diff changeset
  2309
        by (cases "i \<le> j") (auto simp: incseq_def)
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2310
      then have eq: "(\<Union>i. F i) = F i"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2311
        by auto
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2312
      with i show ?thesis
70532
fcf3b891ccb1 new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents: 70380
diff changeset
  2313
        by (auto intro!: Lim_transform_eventually[OF tendsto_const] eventually_sequentiallyI[where c=i])
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2314
    next
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2315
      assume "\<not> (\<exists>i. \<forall>j\<ge>i. F i = F j)"
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 51351
diff changeset
  2316
      then obtain f where f: "\<And>i. i \<le> f i" "\<And>i. F i \<noteq> F (f i)" by metis
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  2317
      then have "\<And>i. F i \<subseteq> F (f i)" using \<open>incseq F\<close> by (auto simp: incseq_def)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 51351
diff changeset
  2318
      with f have *: "\<And>i. F i \<subset> F (f i)" by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2319
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2320
      have "incseq (\<lambda>i. ?M (F i))"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  2321
        using \<open>incseq F\<close> unfolding incseq_def by (auto simp: card_mono dest: finite_subset)
61969
e01015e49041 more symbols;
wenzelm
parents: 61880
diff changeset
  2322
      then have "(\<lambda>i. ?M (F i)) \<longlonglongrightarrow> (SUP n. ?M (F n))"
51000
c9adb50f74ad use order topology for extended reals
hoelzl
parents: 50419
diff changeset
  2323
        by (rule LIMSEQ_SUP)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2324
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2325
      moreover have "(SUP n. ?M (F n)) = top"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2326
      proof (rule ennreal_SUP_eq_top)
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2327
        fix n :: nat show "\<exists>k::nat\<in>UNIV. of_nat n \<le> ?M (F k)"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2328
        proof (induct n)
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2329
          case (Suc n)
74362
0135a0c77b64 tuned proofs --- avoid 'guess';
wenzelm
parents: 73536
diff changeset
  2330
          then obtain k where "of_nat n \<le> ?M (F k)" ..
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2331
          moreover have "finite (F k) \<Longrightarrow> finite (F (f k)) \<Longrightarrow> card (F k) < card (F (f k))"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  2332
            using \<open>F k \<subset> F (f k)\<close> by (simp add: psubset_card_mono)
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2333
          moreover have "finite (F (f k)) \<Longrightarrow> finite (F k)"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  2334
            using \<open>k \<le> f k\<close> \<open>incseq F\<close> by (auto simp: incseq_def dest: finite_subset)
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2335
          ultimately show ?case
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2336
            by (auto intro!: exI[of _ "f k"] simp del: of_nat_Suc)
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2337
        qed auto
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2338
      qed
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2339
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2340
      moreover
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2341
      have "inj (\<lambda>n. F ((f ^^ n) 0))"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2342
        by (intro strict_mono_imp_inj_on strict_monoI_Suc) (simp add: *)
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2343
      then have 1: "infinite (range (\<lambda>i. F ((f ^^ i) 0)))"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2344
        by (rule range_inj_infinite)
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2345
      have "infinite (Pow (\<Union>i. F i))"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2346
        by (rule infinite_super[OF _ 1]) auto
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2347
      then have "infinite (\<Union>i. F i)"
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2348
        by auto
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2349
      ultimately show ?thesis
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2350
        by (metis (mono_tags, lifting) infinity_ennreal_def)
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  2351
    qed
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2352
  qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2353
qed
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2354
59011
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59000
diff changeset
  2355
lemma distr_bij_count_space:
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59000
diff changeset
  2356
  assumes f: "bij_betw f A B"
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59000
diff changeset
  2357
  shows "distr (count_space A) (count_space B) f = count_space B"
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59000
diff changeset
  2358
proof (rule measure_eqI)
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59000
diff changeset
  2359
  have f': "f \<in> measurable (count_space A) (count_space B)"
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59000
diff changeset
  2360
    using f unfolding Pi_def bij_betw_def by auto
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59000
diff changeset
  2361
  fix X assume "X \<in> sets (distr (count_space A) (count_space B) f)"
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59000
diff changeset
  2362
  then have X: "X \<in> sets (count_space B)" by auto
63540
f8652d0534fa tuned proofs -- avoid unstructured calculation;
wenzelm
parents: 63333
diff changeset
  2363
  moreover from X have "f -` X \<inter> A = the_inv_into A f ` X"
59011
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59000
diff changeset
  2364
    using f by (auto simp: bij_betw_def subset_image_iff image_iff the_inv_into_f_f intro: the_inv_into_f_f[symmetric])
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59000
diff changeset
  2365
  moreover have "inj_on (the_inv_into A f) B"
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59000
diff changeset
  2366
    using X f by (auto simp: bij_betw_def inj_on_the_inv_into)
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59000
diff changeset
  2367
  with X have "inj_on (the_inv_into A f) X"
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59000
diff changeset
  2368
    by (auto intro: subset_inj_on)
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59000
diff changeset
  2369
  ultimately show "emeasure (distr (count_space A) (count_space B) f) X = emeasure (count_space B) X"
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59000
diff changeset
  2370
    using f unfolding emeasure_distr[OF f' X]
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59000
diff changeset
  2371
    by (subst (1 2) emeasure_count_space) (auto simp: card_image dest: finite_imageD)
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59000
diff changeset
  2372
qed simp
4902a2fec434 add reindex rules for distr and nn_integral on count_space
hoelzl
parents: 59000
diff changeset
  2373
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2374
lemma emeasure_count_space_finite[simp]:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2375
  "X \<subseteq> A \<Longrightarrow> finite X \<Longrightarrow> emeasure (count_space A) X = of_nat (card X)"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2376
  using emeasure_count_space[of X A] by simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2377
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2378
lemma emeasure_count_space_infinite[simp]:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2379
  "X \<subseteq> A \<Longrightarrow> infinite X \<Longrightarrow> emeasure (count_space A) X = \<infinity>"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2380
  using emeasure_count_space[of X A] by simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2381
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2382
lemma measure_count_space: "measure (count_space A) X = (if X \<subseteq> A then of_nat (card X) else 0)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2383
  by (cases "finite X") 
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2384
     (auto simp: measure_notin_sets ennreal_of_nat_eq_real_of_nat
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2385
                 measure_zero_top measure_eq_emeasure_eq_ennreal)
58606
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
  2386
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2387
lemma emeasure_count_space_eq_0:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2388
  "emeasure (count_space A) X = 0 \<longleftrightarrow> (X \<subseteq> A \<longrightarrow> X = {})"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2389
proof cases
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2390
  assume X: "X \<subseteq> A"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2391
  then show ?thesis
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2392
  proof (intro iffI impI)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2393
    assume "emeasure (count_space A) X = 0"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2394
    with X show "X = {}"
62390
842917225d56 more canonical names
nipkow
parents: 62343
diff changeset
  2395
      by (subst (asm) emeasure_count_space) (auto split: if_split_asm)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2396
  qed simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2397
qed (simp add: emeasure_notin_sets)
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2398
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2399
lemma null_sets_count_space: "null_sets (count_space A) = { {} }"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2400
  unfolding null_sets_def by (auto simp: emeasure_count_space_eq_0)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2401
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2402
lemma AE_count_space: "(AE x in count_space A. P x) \<longleftrightarrow> (\<forall>x\<in>A. P x)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2403
  unfolding eventually_ae_filter by (auto simp: null_sets_count_space)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2404
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2405
lemma sigma_finite_measure_count_space_countable:
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2406
  assumes A: "countable A"
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2407
  shows "sigma_finite_measure (count_space A)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2408
  proof qed (use A in \<open>auto intro!: exI[of _ "(\<lambda>a. {a}) ` A"]\<close>)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2409
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2410
lemma sigma_finite_measure_count_space:
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2411
  fixes A :: "'a::countable set" shows "sigma_finite_measure (count_space A)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2412
  using countableI_type sigma_finite_measure_count_space_countable by blast
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2413
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2414
lemma finite_measure_count_space:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2415
  assumes [simp]: "finite A"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2416
  shows "finite_measure (count_space A)"
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2417
  by rule simp
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2418
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2419
lemma sigma_finite_measure_count_space_finite:
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2420
  assumes A: "finite A" shows "sigma_finite_measure (count_space A)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2421
  by (simp add: assms finite_measure.axioms(1) finite_measure_count_space)
47694
05663f75964c reworked Probability theory
hoelzl
parents:
diff changeset
  2422
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  2423
subsection\<^marker>\<open>tag unimportant\<close> \<open>Measure restricted to space\<close>
54417
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 53374
diff changeset
  2424
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 53374
diff changeset
  2425
lemma emeasure_restrict_space:
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2426
  assumes "\<Omega> \<inter> space M \<in> sets M" "A \<subseteq> \<Omega>"
54417
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 53374
diff changeset
  2427
  shows "emeasure (restrict_space M \<Omega>) A = emeasure M A"
63540
f8652d0534fa tuned proofs -- avoid unstructured calculation;
wenzelm
parents: 63333
diff changeset
  2428
proof (cases "A \<in> sets M")
f8652d0534fa tuned proofs -- avoid unstructured calculation;
wenzelm
parents: 63333
diff changeset
  2429
  case True
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2430
  show ?thesis
54417
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 53374
diff changeset
  2431
  proof (rule emeasure_measure_of[OF restrict_space_def])
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66453
diff changeset
  2432
    show "(\<inter>) \<Omega> ` sets M \<subseteq> Pow (\<Omega> \<inter> space M)" "A \<in> sets (restrict_space M \<Omega>)"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61634
diff changeset
  2433
      using \<open>A \<subseteq> \<Omega>\<close> \<open>A \<in> sets M\<close> sets.space_closed by (auto simp: sets_restrict_space)
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2434
    show "positive (sets (restrict_space M \<Omega>)) (emeasure M)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2435
      by (auto simp: positive_def)
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2436
    show "countably_additive (sets (restrict_space M \<Omega>)) (emeasure M)"
54417
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 53374
diff changeset
  2437
    proof (rule countably_additiveI)
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 53374
diff changeset
  2438
      fix A :: "nat \<Rightarrow> _" assume "range A \<subseteq> sets (restrict_space M \<Omega>)" "disjoint_family A"
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 53374
diff changeset
  2439
      with assms have "\<And>i. A i \<in> sets M" "\<And>i. A i \<subseteq> space M" "disjoint_family A"
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2440
        by (fastforce simp: sets_restrict_space_iff[OF assms(1)] image_subset_iff
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2441
                      dest: sets.sets_into_space)+
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2442
      then show "(\<Sum>i. emeasure M (A i)) = emeasure M (\<Union>i. A i)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2443
        by (simp add: image_subset_iff suminf_emeasure)
54417
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 53374
diff changeset
  2444
    qed
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 53374
diff changeset
  2445
  qed
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 53374
diff changeset
  2446
next
63540
f8652d0534fa tuned proofs -- avoid unstructured calculation;
wenzelm
parents: 63333
diff changeset
  2447
  case False
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2448
  with assms show ?thesis
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2449
    by (metis emeasure_notin_sets sets_restrict_space_iff)
54417
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 53374
diff changeset
  2450
qed
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 53374
diff changeset
  2451
57137
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2452
lemma measure_restrict_space:
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2453
  assumes "\<Omega> \<inter> space M \<in> sets M" "A \<subseteq> \<Omega>"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2454
  shows "measure (restrict_space M \<Omega>) A = measure M A"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2455
  using emeasure_restrict_space[OF assms] by (simp add: measure_def)
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2456
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2457
lemma AE_restrict_space_iff:
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2458
  assumes "\<Omega> \<inter> space M \<in> sets M"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2459
  shows "(AE x in restrict_space M \<Omega>. P x) \<longleftrightarrow> (AE x in M. x \<in> \<Omega> \<longrightarrow> P x)"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2460
proof -
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2461
  have ex_cong: "\<And>P Q f. (\<And>x. P x \<Longrightarrow> Q x) \<Longrightarrow> (\<And>x. Q x \<Longrightarrow> P (f x)) \<Longrightarrow> (\<exists>x. P x) \<longleftrightarrow> (\<exists>x. Q x)"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2462
    by auto
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2463
  have "emeasure M (\<Omega> \<inter> space M \<inter> X) = 0"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2464
    if "X \<in> sets M" "emeasure M X = 0" for X
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2465
    by (meson emeasure_eq_0 inf_le2 that)
57137
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2466
  with assms show ?thesis
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2467
    unfolding eventually_ae_filter
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2468
    by (auto simp: space_restrict_space null_sets_def sets_restrict_space_iff
57137
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2469
                       emeasure_restrict_space cong: conj_cong
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2470
             intro!: ex_cong[where f="\<lambda>X. (\<Omega> \<inter> space M) \<inter> X"])
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  2471
qed
57137
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2472
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2473
lemma restrict_restrict_space:
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2474
  assumes "A \<inter> space M \<in> sets M" "B \<inter> space M \<in> sets M"
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2475
  shows "restrict_space (restrict_space M A) B = restrict_space M (A \<inter> B)" (is "?l = ?r")
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2476
proof (rule measure_eqI[symmetric])
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2477
  show "sets ?r = sets ?l"
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2478
    unfolding sets_restrict_space image_comp by (intro image_cong) auto
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2479
next
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2480
  fix X assume "X \<in> sets (restrict_space M (A \<inter> B))"
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2481
  then obtain Y where "Y \<in> sets M" "X = Y \<inter> A \<inter> B"
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2482
    by (auto simp: sets_restrict_space)
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2483
  with assms sets.Int[OF assms] show "emeasure ?r X = emeasure ?l X"
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2484
    by (subst (1 2) emeasure_restrict_space)
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2485
       (auto simp: space_restrict_space sets_restrict_space_iff emeasure_restrict_space ac_simps)
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2486
qed
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2487
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2488
lemma restrict_count_space: "restrict_space (count_space B) A = count_space (A \<inter> B)"
54417
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 53374
diff changeset
  2489
proof (rule measure_eqI)
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2490
  show "sets (restrict_space (count_space B) A) = sets (count_space (A \<inter> B))"
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2491
    by (subst sets_restrict_space) auto
54417
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 53374
diff changeset
  2492
  moreover fix X assume "X \<in> sets (restrict_space (count_space B) A)"
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2493
  ultimately have "X \<subseteq> A \<inter> B" by auto
e7fd64f82876 add various lemmas
hoelzl
parents: 56994
diff changeset
  2494
  then show "emeasure (restrict_space (count_space B) A) X = emeasure (count_space (A \<inter> B)) X"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2495
    by (cases "finite X") (auto simp: emeasure_restrict_space)
54417
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 53374
diff changeset
  2496
qed
dbb8ecfe1337 add restrict_space measure
hoelzl
parents: 53374
diff changeset
  2497
60063
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2498
lemma sigma_finite_measure_restrict_space:
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2499
  assumes "sigma_finite_measure M"
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2500
  and A: "A \<in> sets M"
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2501
  shows "sigma_finite_measure (restrict_space M A)"
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2502
proof -
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2503
  interpret sigma_finite_measure M by fact
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2504
  from sigma_finite_countable obtain C
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2505
    where C: "countable C" "C \<subseteq> sets M" "(\<Union>C) = space M" "\<forall>a\<in>C. emeasure M a \<noteq> \<infinity>"
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2506
    by blast
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66453
diff changeset
  2507
  let ?C = "(\<inter>) A ` C"
60063
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2508
  from C have "countable ?C" "?C \<subseteq> sets (restrict_space M A)" "(\<Union>?C) = space (restrict_space M A)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2509
    by(auto simp: sets_restrict_space space_restrict_space)
60063
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2510
  moreover {
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2511
    fix a
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2512
    assume "a \<in> ?C"
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2513
    then obtain a' where "a = A \<inter> a'" "a' \<in> C" ..
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2514
    then have "emeasure (restrict_space M A) a \<le> emeasure M a'"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2515
      using A C by(auto simp: emeasure_restrict_space intro: emeasure_mono)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2516
    also have "\<dots> < \<infinity>" using C(4) \<open>a' \<in> C\<close> top.not_eq_extremum by auto
60063
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2517
    finally have "emeasure (restrict_space M A) a \<noteq> \<infinity>" by simp }
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2518
  ultimately show ?thesis
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2519
    by (meson sigma_finite_measure_def)
60063
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2520
qed
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2521
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2522
lemma finite_measure_restrict_space:
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2523
  assumes "finite_measure M"
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2524
  and A: "A \<in> sets M"
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2525
  shows "finite_measure (restrict_space M A)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2526
  by (simp add: assms emeasure_restrict_space finite_measure.emeasure_finite finite_measureI)
60063
81835db730e8 add lemmas about restrict_space
Andreas Lochbihler
parents: 59593
diff changeset
  2527
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  2528
lemma restrict_distr:
57137
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2529
  assumes [measurable]: "f \<in> measurable M N"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2530
  assumes [simp]: "\<Omega> \<inter> space N \<in> sets N" and restrict: "f \<in> space M \<rightarrow> \<Omega>"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2531
  shows "restrict_space (distr M N f) \<Omega> = distr M (restrict_space N \<Omega>) f"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2532
  (is "?l = ?r")
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2533
proof (rule measure_eqI)
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2534
  fix A assume "A \<in> sets (restrict_space (distr M N f) \<Omega>)"
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2535
  with restrict show "emeasure ?l A = emeasure ?r A"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2536
    by (simp add: emeasure_distr emeasure_restrict_space measurable_restrict_space2
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2537
        sets_restrict_space_iff)
57137
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2538
qed (simp add: sets_restrict_space)
f174712d0a84 better support for restrict_space
hoelzl
parents: 57025
diff changeset
  2539
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2540
lemma measure_eqI_restrict_generator:
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2541
  assumes E: "Int_stable E" "E \<subseteq> Pow \<Omega>" "\<And>X. X \<in> E \<Longrightarrow> emeasure M X = emeasure N X"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2542
  assumes sets_eq: "sets M = sets N" and \<Omega>: "\<Omega> \<in> sets M"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2543
  assumes "sets (restrict_space M \<Omega>) = sigma_sets \<Omega> E"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  2544
  assumes "sets (restrict_space N \<Omega>) = sigma_sets \<Omega> E"
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2545
  assumes ae: "AE x in M. x \<in> \<Omega>" "AE x in N. x \<in> \<Omega>"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2546
  assumes A: "countable A" "A \<noteq> {}" "A \<subseteq> E" "\<Union>A = \<Omega>" "\<And>a. a \<in> A \<Longrightarrow> emeasure M a \<noteq> \<infinity>"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2547
  shows "M = N"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2548
proof (rule measure_eqI)
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2549
  fix X assume X: "X \<in> sets M"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2550
  then have "emeasure M X = emeasure (restrict_space M \<Omega>) (X \<inter> \<Omega>)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2551
    using ae \<Omega> by (auto simp: emeasure_restrict_space intro!: emeasure_eq_AE)
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2552
  also have "restrict_space M \<Omega> = restrict_space N \<Omega>"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2553
  proof (rule measure_eqI_generator_eq)
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2554
    fix X assume "X \<in> E"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2555
    then show "emeasure (restrict_space M \<Omega>) X = emeasure (restrict_space N \<Omega>) X"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2556
      using \<Omega> E
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2557
      by (metis Pow_iff emeasure_restrict_space inf.orderE sets.sets_into_space sets_eq subsetD)
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2558
  next
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2559
    show "range (from_nat_into A) \<subseteq> E" "(\<Union>i. from_nat_into A i) = \<Omega>"
69546
27dae626822b prefer naming convention from datatype package for strong congruence rules
haftmann
parents: 69541
diff changeset
  2560
      using A by (auto cong del: SUP_cong_simp)
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2561
  next
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2562
    fix i
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2563
    have "emeasure (restrict_space M \<Omega>) (from_nat_into A i) = emeasure M (from_nat_into A i)"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2564
      using A \<Omega> by (subst emeasure_restrict_space)
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2565
                   (auto simp: sets_eq sets_eq[THEN sets_eq_imp_space_eq] intro: from_nat_into)
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2566
    with A show "emeasure (restrict_space M \<Omega>) (from_nat_into A i) \<noteq> \<infinity>"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2567
      by (auto intro: from_nat_into)
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2568
  qed fact+
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2569
  also have "emeasure (restrict_space N \<Omega>) (X \<inter> \<Omega>) = emeasure N X"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2570
    using X ae \<Omega> by (auto simp: emeasure_restrict_space sets_eq intro!: emeasure_eq_AE)
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2571
  finally show "emeasure M X = emeasure N X" .
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2572
qed fact
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
  2573
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  2574
subsection\<^marker>\<open>tag unimportant\<close> \<open>Null measure\<close>
59425
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59048
diff changeset
  2575
69564
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  2576
definition null_measure :: "'a measure \<Rightarrow> 'a measure" where
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  2577
"null_measure M = sigma (space M) (sets M)"
59425
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59048
diff changeset
  2578
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59048
diff changeset
  2579
lemma space_null_measure[simp]: "space (null_measure M) = space M"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59048
diff changeset
  2580
  by (simp add: null_measure_def)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59048
diff changeset
  2581
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61359
diff changeset
  2582
lemma sets_null_measure[simp, measurable_cong]: "sets (null_measure M) = sets M"
59425
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59048
diff changeset
  2583
  by (simp add: null_measure_def)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59048
diff changeset
  2584
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59048
diff changeset
  2585
lemma emeasure_null_measure[simp]: "emeasure (null_measure M) X = 0"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59048
diff changeset
  2586
  by (cases "X \<in> sets M", rule emeasure_measure_of)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59048
diff changeset
  2587
     (auto simp: positive_def countably_additive_def emeasure_notin_sets null_measure_def
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59048
diff changeset
  2588
           dest: sets.sets_into_space)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59048
diff changeset
  2589
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59048
diff changeset
  2590
lemma measure_null_measure[simp]: "measure (null_measure M) X = 0"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2591
  by (intro measure_eq_emeasure_eq_ennreal) auto
59425
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59048
diff changeset
  2592
61633
64e6d712af16 add lemmas
Andreas Lochbihler
parents: 61609
diff changeset
  2593
lemma null_measure_idem [simp]: "null_measure (null_measure M) = null_measure M"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2594
  by(rule measure_eqI) simp_all
61633
64e6d712af16 add lemmas
Andreas Lochbihler
parents: 61609
diff changeset
  2595
61634
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2596
subsection \<open>Scaling a measure\<close>
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2597
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  2598
definition\<^marker>\<open>tag important\<close> scale_measure :: "ennreal \<Rightarrow> 'a measure \<Rightarrow> 'a measure" where
69564
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  2599
"scale_measure r M = measure_of (space M) (sets M) (\<lambda>A. r * emeasure M A)"
61634
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2600
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2601
lemma space_scale_measure: "space (scale_measure r M) = space M"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2602
  by (simp add: scale_measure_def)
61634
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2603
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2604
lemma sets_scale_measure [simp, measurable_cong]: "sets (scale_measure r M) = sets M"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2605
  by (simp add: scale_measure_def)
61634
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2606
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2607
lemma emeasure_scale_measure [simp]:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2608
  "emeasure (scale_measure r M) A = r * emeasure M A"
61634
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2609
  (is "_ = ?\<mu> A")
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2610
proof(cases "A \<in> sets M")
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2611
  case True
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2612
  show ?thesis unfolding scale_measure_def
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2613
  proof(rule emeasure_measure_of_sigma)
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2614
    show "sigma_algebra (space M) (sets M)" ..
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2615
    show "positive (sets M) ?\<mu>" by (simp add: positive_def)
61634
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2616
    show "countably_additive (sets M) ?\<mu>"
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2617
    proof (rule countably_additiveI)
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2618
      fix A :: "nat \<Rightarrow> _"  assume *: "range A \<subseteq> sets M" "disjoint_family A"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2619
      have "(\<Sum>i. ?\<mu> (A i)) = r * (\<Sum>i. emeasure M (A i))"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2620
        by simp
61634
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2621
      also have "\<dots> = ?\<mu> (\<Union>i. A i)" using * by(simp add: suminf_emeasure)
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2622
      finally show "(\<Sum>i. ?\<mu> (A i)) = ?\<mu> (\<Union>i. A i)" .
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2623
    qed
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2624
  qed(fact True)
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2625
qed(simp add: emeasure_notin_sets)
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2626
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2627
lemma scale_measure_1 [simp]: "scale_measure 1 M = M"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2628
  by(rule measure_eqI) simp_all
61634
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2629
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2630
lemma scale_measure_0[simp]: "scale_measure 0 M = null_measure M"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2631
  by(rule measure_eqI) simp_all
61634
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2632
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2633
lemma measure_scale_measure [simp]: "0 \<le> r \<Longrightarrow> measure (scale_measure r M) A = r * measure M A"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2634
  using emeasure_scale_measure[of r M A]
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2635
    emeasure_eq_ennreal_measure[of M A]
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2636
    measure_eq_emeasure_eq_ennreal[of _ "scale_measure r M" A]
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2637
  by (cases "emeasure (scale_measure r M) A = top")
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2638
     (auto simp del: emeasure_scale_measure
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2639
           simp: ennreal_top_eq_mult_iff ennreal_mult_eq_top_iff measure_zero_top ennreal_mult[symmetric])
61634
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2640
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2641
lemma scale_scale_measure [simp]:
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2642
  "scale_measure r (scale_measure r' M) = scale_measure (r * r') M"
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2643
  by (rule measure_eqI) (simp_all add: max_def mult.assoc)
61634
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2644
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2645
lemma scale_null_measure [simp]: "scale_measure r (null_measure M) = null_measure M"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  2646
  by (rule measure_eqI) simp_all
61634
48e2de1b1df5 add various lemmas
Andreas Lochbihler
parents: 61633
diff changeset
  2647
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2648
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2649
subsection \<open>Complete lattice structure on measures\<close>
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2650
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2651
lemma (in finite_measure) finite_measure_Diff':
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2652
  "A \<in> sets M \<Longrightarrow> B \<in> sets M \<Longrightarrow> measure M (A - B) = measure M A - measure M (A \<inter> B)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2653
  using finite_measure_Diff[of A "A \<inter> B"] by (auto simp: Diff_Int)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2654
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2655
lemma (in finite_measure) finite_measure_Union':
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2656
  "A \<in> sets M \<Longrightarrow> B \<in> sets M \<Longrightarrow> measure M (A \<union> B) = measure M A + measure M (B - A)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2657
  using finite_measure_Union[of A "B - A"] by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2658
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2659
lemma finite_unsigned_Hahn_decomposition:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2660
  assumes "finite_measure M" "finite_measure N" and [simp]: "sets N = sets M"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2661
  shows "\<exists>Y\<in>sets M. (\<forall>X\<in>sets M. X \<subseteq> Y \<longrightarrow> N X \<le> M X) \<and> (\<forall>X\<in>sets M. X \<inter> Y = {} \<longrightarrow> M X \<le> N X)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2662
proof -
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2663
  interpret M: finite_measure M by fact
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2664
  interpret N: finite_measure N by fact
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2665
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2666
  define d where "d X = measure M X - measure N X" for X
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2667
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2668
  have [intro]: "bdd_above (d`sets M)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2669
    using sets.sets_into_space[of _ M]
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2670
    by (intro bdd_aboveI[where M="measure M (space M)"])
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2671
       (auto simp: d_def field_simps subset_eq intro!: add_increasing M.finite_measure_mono)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2672
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  2673
  define \<gamma> where "\<gamma> = (SUP X\<in>sets M. d X)"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2674
  have le_\<gamma>[intro]: "X \<in> sets M \<Longrightarrow> d X \<le> \<gamma>" for X
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2675
    by (auto simp: \<gamma>_def intro!: cSUP_upper)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2676
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2677
  have "\<exists>X\<in>sets M. \<gamma> - 1 / 2^n < d X" for n
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2678
    unfolding \<gamma>_def by (intro less_cSUP_iff[THEN iffD1]) auto
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2679
  then have "\<exists>f. \<forall>n. f n \<in> sets M \<and> d (f n) > \<gamma> - 1 / 2^n"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2680
    by metis
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2681
  then obtain E where [measurable]: "E n \<in> sets M" and E: "d (E n) > \<gamma> - 1 / 2^n" for n
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2682
    by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2683
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2684
  define F where "F m n = (if m \<le> n then \<Inter>i\<in>{m..n}. E i else space M)" for m n
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2685
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2686
  have [measurable]: "m \<le> n \<Longrightarrow> F m n \<in> sets M" for m n
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2687
    by (auto simp: F_def)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2688
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2689
  have 1: "\<gamma> - 2 / 2 ^ m + 1 / 2 ^ n \<le> d (F m n)" if "m \<le> n" for m n
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2690
    using that
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2691
  proof (induct rule: dec_induct)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2692
    case base with E[of m] show ?case
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2693
      by (simp add: F_def field_simps)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2694
  next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2695
    case (step i)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2696
    have F_Suc: "F m (Suc i) = F m i \<inter> E (Suc i)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2697
      using \<open>m \<le> i\<close> by (auto simp: F_def le_Suc_eq)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2698
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2699
    have "\<gamma> + (\<gamma> - 2 / 2^m + 1 / 2 ^ Suc i) \<le> (\<gamma> - 1 / 2^Suc i) + (\<gamma> - 2 / 2^m + 1 / 2^i)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2700
      by (simp add: field_simps)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2701
    also have "\<dots> \<le> d (E (Suc i)) + d (F m i)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2702
      using E[of "Suc i"] by (intro add_mono step) auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2703
    also have "\<dots> = d (E (Suc i)) + d (F m i - E (Suc i)) + d (F m (Suc i))"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2704
      using \<open>m \<le> i\<close> by (simp add: d_def field_simps F_Suc M.finite_measure_Diff' N.finite_measure_Diff')
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2705
    also have "\<dots> = d (E (Suc i) \<union> F m i) + d (F m (Suc i))"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2706
      using \<open>m \<le> i\<close> by (simp add: d_def field_simps M.finite_measure_Union' N.finite_measure_Union')
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2707
    also have "\<dots> \<le> \<gamma> + d (F m (Suc i))"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2708
      using \<open>m \<le> i\<close> by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2709
    finally show ?case
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2710
      by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2711
  qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2712
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2713
  define F' where "F' m = (\<Inter>i\<in>{m..}. E i)" for m
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2714
  have F'_eq: "F' m = (\<Inter>i. F m (i + m))" for m
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2715
    by (fastforce simp: le_iff_add[of m] F'_def F_def)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2716
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2717
  have [measurable]: "F' m \<in> sets M" for m
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2718
    by (auto simp: F'_def)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2719
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2720
  have \<gamma>_le: "\<gamma> - 0 \<le> d (\<Union>m. F' m)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2721
  proof (rule LIMSEQ_le)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2722
    show "(\<lambda>n. \<gamma> - 2 / 2 ^ n) \<longlonglongrightarrow> \<gamma> - 0"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2723
      by (intro tendsto_intros LIMSEQ_divide_realpow_zero) auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2724
    have "incseq F'"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2725
      by (auto simp: incseq_def F'_def)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2726
    then show "(\<lambda>m. d (F' m)) \<longlonglongrightarrow> d (\<Union>m. F' m)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2727
      unfolding d_def
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2728
      by (intro tendsto_diff M.finite_Lim_measure_incseq N.finite_Lim_measure_incseq) auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2729
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2730
    have "\<gamma> - 2 / 2 ^ m + 0 \<le> d (F' m)" for m
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2731
    proof (rule LIMSEQ_le)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2732
      have *: "decseq (\<lambda>n. F m (n + m))"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2733
        by (auto simp: decseq_def F_def)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2734
      show "(\<lambda>n. d (F m n)) \<longlonglongrightarrow> d (F' m)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2735
        unfolding d_def F'_eq
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2736
        by (rule LIMSEQ_offset[where k=m])
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2737
           (auto intro!: tendsto_diff M.finite_Lim_measure_decseq N.finite_Lim_measure_decseq *)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2738
      show "(\<lambda>n. \<gamma> - 2 / 2 ^ m + 1 / 2 ^ n) \<longlonglongrightarrow> \<gamma> - 2 / 2 ^ m + 0"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2739
        by (intro tendsto_add LIMSEQ_divide_realpow_zero tendsto_const) auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2740
      show "\<exists>N. \<forall>n\<ge>N. \<gamma> - 2 / 2 ^ m + 1 / 2 ^ n \<le> d (F m n)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2741
        using 1[of m] by (intro exI[of _ m]) auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2742
    qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2743
    then show "\<exists>N. \<forall>n\<ge>N. \<gamma> - 2 / 2 ^ n \<le> d (F' n)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2744
      by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2745
  qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2746
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2747
  show ?thesis
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2748
  proof (safe intro!: bexI[of _ "\<Union>m. F' m"])
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2749
    fix X assume [measurable]: "X \<in> sets M" and X: "X \<subseteq> (\<Union>m. F' m)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2750
    have "d (\<Union>m. F' m) - d X = d ((\<Union>m. F' m) - X)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2751
      using X by (auto simp: d_def M.finite_measure_Diff N.finite_measure_Diff)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2752
    also have "\<dots> \<le> \<gamma>"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2753
      by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2754
    finally have "0 \<le> d X"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2755
      using \<gamma>_le by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2756
    then show "emeasure N X \<le> emeasure M X"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2757
      by (auto simp: d_def M.emeasure_eq_measure N.emeasure_eq_measure)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2758
  next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2759
    fix X assume [measurable]: "X \<in> sets M" and X: "X \<inter> (\<Union>m. F' m) = {}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2760
    then have "d (\<Union>m. F' m) + d X = d (X \<union> (\<Union>m. F' m))"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2761
      by (auto simp: d_def M.finite_measure_Union N.finite_measure_Union)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2762
    also have "\<dots> \<le> \<gamma>"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2763
      by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2764
    finally have "d X \<le> 0"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2765
      using \<gamma>_le by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2766
    then show "emeasure M X \<le> emeasure N X"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2767
      by (auto simp: d_def M.emeasure_eq_measure N.emeasure_eq_measure)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2768
  qed auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2769
qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2770
68607
67bb59e49834 make theorem, corollary, and proposition %important for HOL-Analysis manual
immler
parents: 68532
diff changeset
  2771
proposition unsigned_Hahn_decomposition:
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2772
  assumes [simp]: "sets N = sets M" and [measurable]: "A \<in> sets M"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2773
    and [simp]: "emeasure M A \<noteq> top" "emeasure N A \<noteq> top"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2774
  shows "\<exists>Y\<in>sets M. Y \<subseteq> A \<and> (\<forall>X\<in>sets M. X \<subseteq> Y \<longrightarrow> N X \<le> M X) \<and> (\<forall>X\<in>sets M. X \<subseteq> A \<longrightarrow> X \<inter> Y = {} \<longrightarrow> M X \<le> N X)"
68607
67bb59e49834 make theorem, corollary, and proposition %important for HOL-Analysis manual
immler
parents: 68532
diff changeset
  2775
proof -
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2776
  have "\<exists>Y\<in>sets (restrict_space M A).
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2777
    (\<forall>X\<in>sets (restrict_space M A). X \<subseteq> Y \<longrightarrow> (restrict_space N A) X \<le> (restrict_space M A) X) \<and>
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2778
    (\<forall>X\<in>sets (restrict_space M A). X \<inter> Y = {} \<longrightarrow> (restrict_space M A) X \<le> (restrict_space N A) X)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2779
  proof (rule finite_unsigned_Hahn_decomposition)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2780
    show "finite_measure (restrict_space M A)" "finite_measure (restrict_space N A)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2781
      by (auto simp: space_restrict_space emeasure_restrict_space less_top intro!: finite_measureI)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2782
  qed (simp add: sets_restrict_space)
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2783
  with assms show ?thesis
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2784
    by (metis Int_subset_iff emeasure_restrict_space sets.Int_space_eq2 sets_restrict_space_iff space_restrict_space)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2785
qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2786
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  2787
text\<^marker>\<open>tag important\<close> \<open>
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 69566
diff changeset
  2788
  Define a lexicographical order on \<^type>\<open>measure\<close>, in the order space, sets and measure. The parts
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2789
  of the lexicographical order are point-wise ordered.
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2790
\<close>
60772
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  2791
68617
75129a73aca3 more economic tagging
nipkow
parents: 68607
diff changeset
  2792
instantiation measure :: (type) order_bot
60772
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  2793
begin
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  2794
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  2795
inductive less_eq_measure :: "'a measure \<Rightarrow> 'a measure \<Rightarrow> bool" where
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2796
  "space M \<subset> space N \<Longrightarrow> less_eq_measure M N"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2797
| "space M = space N \<Longrightarrow> sets M \<subset> sets N \<Longrightarrow> less_eq_measure M N"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2798
| "space M = space N \<Longrightarrow> sets M = sets N \<Longrightarrow> emeasure M \<le> emeasure N \<Longrightarrow> less_eq_measure M N"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2799
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2800
lemma le_measure_iff:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2801
  "M \<le> N \<longleftrightarrow> (if space M = space N then
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2802
    if sets M = sets N then emeasure M \<le> emeasure N else sets M \<subseteq> sets N else space M \<subseteq> space N)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2803
  by (auto elim: less_eq_measure.cases intro: less_eq_measure.intros)
60772
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  2804
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  2805
definition\<^marker>\<open>tag important\<close> less_measure :: "'a measure \<Rightarrow> 'a measure \<Rightarrow> bool" where
60772
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  2806
  "less_measure M N \<longleftrightarrow> (M \<le> N \<and> \<not> N \<le> M)"
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  2807
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  2808
definition\<^marker>\<open>tag important\<close> bot_measure :: "'a measure" where
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2809
  "bot_measure = sigma {} {}"
60772
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  2810
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  2811
lemma
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2812
  shows space_bot[simp]: "space bot = {}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2813
    and sets_bot[simp]: "sets bot = {{}}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2814
    and emeasure_bot[simp]: "emeasure bot X = 0"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2815
  by (auto simp: bot_measure_def sigma_sets_empty_eq emeasure_sigma)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2816
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2817
instance
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2818
proof standard
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2819
  show "bot \<le> a" for a :: "'a measure"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2820
    by (simp add: le_measure_iff bot_measure_def sigma_sets_empty_eq emeasure_sigma le_fun_def)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2821
qed (auto simp: le_measure_iff less_measure_def split: if_split_asm intro: measure_eqI)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2822
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2823
end
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2824
68607
67bb59e49834 make theorem, corollary, and proposition %important for HOL-Analysis manual
immler
parents: 68532
diff changeset
  2825
proposition le_measure: "sets M = sets N \<Longrightarrow> M \<le> N \<longleftrightarrow> (\<forall>A\<in>sets M. emeasure M A \<le> emeasure N A)"
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2826
  by (metis emeasure_neq_0_sets le_fun_def le_measure_iff order_class.order_eq_iff sets_eq_imp_space_eq)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2827
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  2828
definition\<^marker>\<open>tag important\<close> sup_measure' :: "'a measure \<Rightarrow> 'a measure \<Rightarrow> 'a measure" where
69564
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  2829
"sup_measure' A B =
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  2830
  measure_of (space A) (sets A)
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  2831
    (\<lambda>X. SUP Y\<in>sets A. emeasure A (X \<inter> Y) + emeasure B (X \<inter> - Y))"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2832
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2833
lemma assumes [simp]: "sets B = sets A"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2834
  shows space_sup_measure'[simp]: "space (sup_measure' A B) = space A"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2835
    and sets_sup_measure'[simp]: "sets (sup_measure' A B) = sets A"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2836
  using sets_eq_imp_space_eq[OF assms] by (simp_all add: sup_measure'_def)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2837
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2838
lemma emeasure_sup_measure':
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2839
  assumes sets_eq[simp]: "sets B = sets A" and [simp, intro]: "X \<in> sets A"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  2840
  shows "emeasure (sup_measure' A B) X = (SUP Y\<in>sets A. emeasure A (X \<inter> Y) + emeasure B (X \<inter> - Y))"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2841
    (is "_ = ?S X")
60772
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  2842
proof -
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2843
  note sets_eq_imp_space_eq[OF sets_eq, simp]
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2844
  show ?thesis
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2845
    using sup_measure'_def
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2846
  proof (rule emeasure_measure_of)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2847
    let ?d = "\<lambda>X Y. emeasure A (X \<inter> Y) + emeasure B (X \<inter> - Y)"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  2848
    show "countably_additive (sets (sup_measure' A B)) (\<lambda>X. SUP Y \<in> sets A. emeasure A (X \<inter> Y) + emeasure B (X \<inter> - Y))"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2849
    proof (rule countably_additiveI, goal_cases)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2850
      case (1 X)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2851
      then have [measurable]: "\<And>i. X i \<in> sets A" and "disjoint_family X"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2852
        by auto
69661
a03a63b81f44 tuned proofs
haftmann
parents: 69597
diff changeset
  2853
      have disjoint: "disjoint_family (\<lambda>i. X i \<inter> Y)" "disjoint_family (\<lambda>i. X i - Y)" for Y
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2854
        using "1"(2) disjoint_family_subset by fastforce+
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  2855
      have "(\<Sum>i. ?S (X i)) = (SUP Y\<in>sets A. \<Sum>i. ?d (X i) Y)"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2856
      proof (rule ennreal_suminf_SUP_eq_directed)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2857
        fix J :: "nat set" and a b assume "finite J" and [measurable]: "a \<in> sets A" "b \<in> sets A"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2858
        have "\<exists>c\<in>sets A. c \<subseteq> X i \<and> (\<forall>a\<in>sets A. ?d (X i) a \<le> ?d (X i) c)" for i
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2859
        proof cases
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2860
          assume "emeasure A (X i) = top \<or> emeasure B (X i) = top"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2861
          then show ?thesis
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2862
            by force
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2863
        next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2864
          assume finite: "\<not> (emeasure A (X i) = top \<or> emeasure B (X i) = top)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2865
          then have "\<exists>Y\<in>sets A. Y \<subseteq> X i \<and> (\<forall>C\<in>sets A. C \<subseteq> Y \<longrightarrow> B C \<le> A C) \<and> (\<forall>C\<in>sets A. C \<subseteq> X i \<longrightarrow> C \<inter> Y = {} \<longrightarrow> A C \<le> B C)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2866
            using unsigned_Hahn_decomposition[of B A "X i"] by simp
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2867
          then obtain Y where [measurable]: "Y \<in> sets A" and [simp]: "Y \<subseteq> X i"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2868
            and B_le_A: "\<And>C. C \<in> sets A \<Longrightarrow> C \<subseteq> Y \<Longrightarrow> B C \<le> A C"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2869
            and A_le_B: "\<And>C. C \<in> sets A \<Longrightarrow> C \<subseteq> X i \<Longrightarrow> C \<inter> Y = {} \<Longrightarrow> A C \<le> B C"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2870
            by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2871
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2872
          show ?thesis
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2873
          proof (intro bexI ballI conjI)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2874
            fix a assume [measurable]: "a \<in> sets A"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2875
            have *: "(X i \<inter> a \<inter> Y \<union> (X i \<inter> a - Y)) = X i \<inter> a" "(X i - a) \<inter> Y \<union> (X i - a - Y) = X i \<inter> - a"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2876
              for a Y by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2877
            then have "?d (X i) a =
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2878
              (A (X i \<inter> a \<inter> Y) + A (X i \<inter> a \<inter> - Y)) + (B (X i \<inter> - a \<inter> Y) + B (X i \<inter> - a \<inter> - Y))"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2879
              by (subst (1 2) plus_emeasure) (auto simp: Diff_eq[symmetric])
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2880
            also have "\<dots> \<le> (A (X i \<inter> a \<inter> Y) + B (X i \<inter> a \<inter> - Y)) + (A (X i \<inter> - a \<inter> Y) + B (X i \<inter> - a \<inter> - Y))"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2881
              by (intro add_mono order_refl B_le_A A_le_B) (auto simp: Diff_eq[symmetric])
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2882
            also have "\<dots> \<le> (A (X i \<inter> Y \<inter> a) + A (X i \<inter> Y \<inter> - a)) + (B (X i \<inter> - Y \<inter> a) + B (X i \<inter> - Y \<inter> - a))"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2883
              by (simp add: ac_simps)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2884
            also have "\<dots> \<le> A (X i \<inter> Y) + B (X i \<inter> - Y)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2885
              by (subst (1 2) plus_emeasure) (auto simp: Diff_eq[symmetric] *)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2886
            finally show "?d (X i) a \<le> ?d (X i) Y" .
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2887
          qed auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2888
        qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2889
        then obtain C where [measurable]: "C i \<in> sets A" and "C i \<subseteq> X i"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2890
          and C: "\<And>a. a \<in> sets A \<Longrightarrow> ?d (X i) a \<le> ?d (X i) (C i)" for i
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2891
          by metis
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2892
        have *: "X i \<inter> (\<Union>i. C i) = X i \<inter> C i" for i
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2893
          using \<open>disjoint_family X\<close> \<open>\<And>i. C i \<subseteq> X i\<close>
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2894
          by (simp add: disjoint_family_on_def disjoint_iff_not_equal set_eq_iff) (metis subsetD)
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2895
        then have **: "X i \<inter> - (\<Union>i. C i) = X i \<inter> - C i" for i by blast
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2896
        moreover have "(\<Union>i. C i) \<in> sets A"
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2897
          by fastforce
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2898
        ultimately show "\<exists>c\<in>sets A. \<forall>i\<in>J. ?d (X i) a \<le> ?d (X i) c \<and> ?d (X i) b \<le> ?d (X i) c"
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2899
          by (metis "*" C \<open>a \<in> sets A\<close> \<open>b \<in> sets A\<close>)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2900
      qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2901
      also have "\<dots> = ?S (\<Union>i. X i)"
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2902
      proof -
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2903
        have "\<And>Y. Y \<in> sets A \<Longrightarrow> (\<Sum>i. emeasure A (X i \<inter> Y) + emeasure B (X i \<inter> -Y)) 
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2904
                              = emeasure A (\<Union>i. X i \<inter> Y) + emeasure B (\<Union>i. X i \<inter> -Y)"
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2905
          using disjoint
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2906
          by (auto simp flip: suminf_add Diff_eq simp add: image_subset_iff suminf_emeasure)
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2907
        then show ?thesis by force
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  2908
      qed
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2909
      finally show "(\<Sum>i. ?S (X i)) = ?S (\<Union>i. X i)" .
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2910
    qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2911
  qed (auto dest: sets.sets_into_space simp: positive_def intro!: SUP_const)
60772
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  2912
qed
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  2913
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2914
lemma le_emeasure_sup_measure'1:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2915
  assumes "sets B = sets A" "X \<in> sets A" shows "emeasure A X \<le> emeasure (sup_measure' A B) X"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2916
  by (subst emeasure_sup_measure'[OF assms]) (auto intro!: SUP_upper2[of "X"] assms)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2917
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2918
lemma le_emeasure_sup_measure'2:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2919
  assumes "sets B = sets A" "X \<in> sets A" shows "emeasure B X \<le> emeasure (sup_measure' A B) X"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2920
  by (subst emeasure_sup_measure'[OF assms]) (auto intro!: SUP_upper2[of "{}"] assms)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2921
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2922
lemma emeasure_sup_measure'_le2:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2923
  assumes [simp]: "sets B = sets C" "sets A = sets C" and [measurable]: "X \<in> sets C"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2924
  assumes A: "\<And>Y. Y \<subseteq> X \<Longrightarrow> Y \<in> sets A \<Longrightarrow> emeasure A Y \<le> emeasure C Y"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2925
  assumes B: "\<And>Y. Y \<subseteq> X \<Longrightarrow> Y \<in> sets A \<Longrightarrow> emeasure B Y \<le> emeasure C Y"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2926
  shows "emeasure (sup_measure' A B) X \<le> emeasure C X"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2927
proof (subst emeasure_sup_measure')
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  2928
  show "(SUP Y\<in>sets A. emeasure A (X \<inter> Y) + emeasure B (X \<inter> - Y)) \<le> emeasure C X"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2929
    unfolding \<open>sets A = sets C\<close>
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2930
  proof (intro SUP_least)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2931
    fix Y assume [measurable]: "Y \<in> sets C"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2932
    have [simp]: "X \<inter> Y \<union> (X - Y) = X"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2933
      by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2934
    have "emeasure A (X \<inter> Y) + emeasure B (X \<inter> - Y) \<le> emeasure C (X \<inter> Y) + emeasure C (X \<inter> - Y)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2935
      by (intro add_mono A B) (auto simp: Diff_eq[symmetric])
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2936
    also have "\<dots> = emeasure C X"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2937
      by (subst plus_emeasure) (auto simp: Diff_eq[symmetric])
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2938
    finally show "emeasure A (X \<inter> Y) + emeasure B (X \<inter> - Y) \<le> emeasure C X" .
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2939
  qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2940
qed simp_all
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2941
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  2942
definition\<^marker>\<open>tag important\<close> sup_lexord :: "'a \<Rightarrow> 'a \<Rightarrow> ('a \<Rightarrow> 'b::order) \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> 'a" where
69564
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  2943
"sup_lexord A B k s c =
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  2944
  (if k A = k B then c else
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  2945
   if \<not> k A \<le> k B \<and> \<not> k B \<le> k A then s else
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  2946
   if k B \<le> k A then A else B)"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2947
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2948
lemma sup_lexord:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2949
  "(k A < k B \<Longrightarrow> P B) \<Longrightarrow> (k B < k A \<Longrightarrow> P A) \<Longrightarrow> (k A = k B \<Longrightarrow> P c) \<Longrightarrow>
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2950
    (\<not> k B \<le> k A \<Longrightarrow> \<not> k A \<le> k B \<Longrightarrow> P s) \<Longrightarrow> P (sup_lexord A B k s c)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2951
  by (auto simp: sup_lexord_def)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2952
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2953
lemmas le_sup_lexord = sup_lexord[where P="\<lambda>a. c \<le> a" for c]
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2954
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2955
lemma sup_lexord1: "k A = k B \<Longrightarrow> sup_lexord A B k s c = c"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2956
  by (simp add: sup_lexord_def)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2957
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2958
lemma sup_lexord_commute: "sup_lexord A B k s c = sup_lexord B A k s c"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2959
  by (auto simp: sup_lexord_def)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2960
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2961
lemma sigma_sets_le_sets_iff: "(sigma_sets (space x) \<A> \<subseteq> sets x) = (\<A> \<subseteq> sets x)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2962
  using sets.sigma_sets_subset[of \<A> x] by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2963
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2964
lemma sigma_le_iff: "\<A> \<subseteq> Pow \<Omega> \<Longrightarrow> sigma \<Omega> \<A> \<le> x \<longleftrightarrow> (\<Omega> \<subseteq> space x \<and> (space x = \<Omega> \<longrightarrow> \<A> \<subseteq> sets x))"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2965
  apply (simp add: le_measure_iff le_fun_def emeasure_sigma)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  2966
  by (metis order_refl sets_measure_of sigma_sets_le_sets_iff)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2967
68617
75129a73aca3 more economic tagging
nipkow
parents: 68607
diff changeset
  2968
instantiation measure :: (type) semilattice_sup
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2969
begin
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2970
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  2971
definition\<^marker>\<open>tag important\<close> sup_measure :: "'a measure \<Rightarrow> 'a measure \<Rightarrow> 'a measure" where
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2972
  "sup_measure A B =
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2973
    sup_lexord A B space (sigma (space A \<union> space B) {})
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2974
      (sup_lexord A B sets (sigma (space A) (sets A \<union> sets B)) (sup_measure' A B))"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2975
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2976
instance
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2977
proof
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2978
  fix x y z :: "'a measure"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2979
  show "x \<le> sup x y"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2980
    unfolding sup_measure_def
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2981
  proof (intro le_sup_lexord)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2982
    assume "space x = space y"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2983
    then have *: "sets x \<union> sets y \<subseteq> Pow (space x)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2984
      using sets.space_closed by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2985
    assume "\<not> sets y \<subseteq> sets x" "\<not> sets x \<subseteq> sets y"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2986
    then have "sets x \<subset> sets x \<union> sets y"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2987
      by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2988
    also have "\<dots> \<le> sigma (space x) (sets x \<union> sets y)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2989
      by (subst sets_measure_of[OF *]) (rule sigma_sets_superset_generator)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2990
    finally show "x \<le> sigma (space x) (sets x \<union> sets y)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2991
      by (simp add: space_measure_of[OF *] less_eq_measure.intros(2))
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2992
  next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2993
    assume "\<not> space y \<subseteq> space x" "\<not> space x \<subseteq> space y"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2994
    then show "x \<le> sigma (space x \<union> space y) {}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2995
      by (intro less_eq_measure.intros) auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2996
  next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2997
    assume "sets x = sets y" then show "x \<le> sup_measure' x y"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2998
      by (simp add: le_measure le_emeasure_sup_measure'1)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  2999
  qed (auto intro: less_eq_measure.intros)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3000
  show "y \<le> sup x y"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3001
    unfolding sup_measure_def
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3002
  proof (intro le_sup_lexord)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3003
    assume **: "space x = space y"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3004
    then have *: "sets x \<union> sets y \<subseteq> Pow (space y)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3005
      using sets.space_closed by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3006
    assume "\<not> sets y \<subseteq> sets x" "\<not> sets x \<subseteq> sets y"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3007
    then have "sets y \<subset> sets x \<union> sets y"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3008
      by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3009
    also have "\<dots> \<le> sigma (space y) (sets x \<union> sets y)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3010
      by (subst sets_measure_of[OF *]) (rule sigma_sets_superset_generator)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3011
    finally show "y \<le> sigma (space x) (sets x \<union> sets y)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3012
      by (simp add: ** space_measure_of[OF *] less_eq_measure.intros(2))
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3013
  next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3014
    assume "\<not> space y \<subseteq> space x" "\<not> space x \<subseteq> space y"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3015
    then show "y \<le> sigma (space x \<union> space y) {}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3016
      by (intro less_eq_measure.intros) auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3017
  next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3018
    assume "sets x = sets y" then show "y \<le> sup_measure' x y"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3019
      by (simp add: le_measure le_emeasure_sup_measure'2)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3020
  qed (auto intro: less_eq_measure.intros)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3021
  show "x \<le> y \<Longrightarrow> z \<le> y \<Longrightarrow> sup x z \<le> y"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3022
    unfolding sup_measure_def
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3023
  proof (intro sup_lexord[where P="\<lambda>x. x \<le> y"])
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3024
    assume "x \<le> y" "z \<le> y" and [simp]: "space x = space z" "sets x = sets z"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3025
    from \<open>x \<le> y\<close> show "sup_measure' x z \<le> y"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3026
    proof cases
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3027
      case 1 then show ?thesis
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3028
        by (intro less_eq_measure.intros(1)) simp
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3029
    next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3030
      case 2 then show ?thesis
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3031
        by (intro less_eq_measure.intros(2)) simp_all
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3032
    next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3033
      case 3 with \<open>z \<le> y\<close> \<open>x \<le> y\<close> show ?thesis
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3034
        by (auto simp: le_measure intro!: emeasure_sup_measure'_le2)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3035
    qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3036
  next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3037
    assume **: "x \<le> y" "z \<le> y" "space x = space z" "\<not> sets z \<subseteq> sets x" "\<not> sets x \<subseteq> sets z"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3038
    then have *: "sets x \<union> sets z \<subseteq> Pow (space x)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3039
      using sets.space_closed by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3040
    show "sigma (space x) (sets x \<union> sets z) \<le> y"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3041
      unfolding sigma_le_iff[OF *] using ** by (auto simp: le_measure_iff split: if_split_asm)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3042
  next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3043
    assume "x \<le> y" "z \<le> y" "\<not> space z \<subseteq> space x" "\<not> space x \<subseteq> space z"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3044
    then have "space x \<subseteq> space y" "space z \<subseteq> space y"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3045
      by (auto simp: le_measure_iff split: if_split_asm)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3046
    then show "sigma (space x \<union> space z) {} \<le> y"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3047
      by (simp add: sigma_le_iff)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3048
  qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3049
qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3050
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3051
end
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3052
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3053
lemma space_empty_eq_bot: "space a = {} \<longleftrightarrow> a = bot"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3054
  using space_empty[of a] by (auto intro!: measure_eqI)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3055
63657
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3056
lemma sets_eq_iff_bounded: "A \<le> B \<Longrightarrow> B \<le> C \<Longrightarrow> sets A = sets C \<Longrightarrow> sets B = sets A"
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3057
  by (auto dest: sets_eq_imp_space_eq simp add: le_measure_iff split: if_split_asm)
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3058
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3059
lemma sets_sup: "sets A = sets M \<Longrightarrow> sets B = sets M \<Longrightarrow> sets (sup A B) = sets M"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3060
  by (auto simp: sup_measure_def sup_lexord_def dest: sets_eq_imp_space_eq)
63657
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3061
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3062
lemma le_measureD1: "A \<le> B \<Longrightarrow> space A \<le> space B"
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3063
  by (auto simp: le_measure_iff split: if_split_asm)
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3064
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3065
lemma le_measureD2: "A \<le> B \<Longrightarrow> space A = space B \<Longrightarrow> sets A \<le> sets B"
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3066
  by (auto simp: le_measure_iff split: if_split_asm)
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3067
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3068
lemma le_measureD3: "A \<le> B \<Longrightarrow> sets A = sets B \<Longrightarrow> emeasure A X \<le> emeasure B X"
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3069
  by (auto simp: le_measure_iff le_fun_def dest: sets_eq_imp_space_eq split: if_split_asm)
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3070
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69286
diff changeset
  3071
lemma UN_space_closed: "\<Union>(sets ` S) \<subseteq> Pow (\<Union>(space ` S))"
63657
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3072
  using sets.space_closed by auto
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3073
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  3074
definition\<^marker>\<open>tag important\<close>
69564
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  3075
  Sup_lexord :: "('a \<Rightarrow> 'b::complete_lattice) \<Rightarrow> ('a set \<Rightarrow> 'a) \<Rightarrow> ('a set \<Rightarrow> 'a) \<Rightarrow> 'a set \<Rightarrow> 'a"
63657
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3076
where
69564
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  3077
  "Sup_lexord k c s A =
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  3078
  (let U = (SUP a\<in>A. k a)
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  3079
   in if \<exists>a\<in>A. k a = U then c {a\<in>A. k a = U} else s A)"
63657
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3080
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3081
lemma Sup_lexord:
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3082
  "(\<And>a S. a \<in> A \<Longrightarrow> k a = (SUP a\<in>A. k a) \<Longrightarrow> S = {a'\<in>A. k a' = k a} \<Longrightarrow> P (c S)) \<Longrightarrow> ((\<And>a. a \<in> A \<Longrightarrow> k a \<noteq> (SUP a\<in>A. k a)) \<Longrightarrow> P (s A)) \<Longrightarrow>
63657
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3083
    P (Sup_lexord k c s A)"
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3084
  by (auto simp: Sup_lexord_def Let_def)
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3085
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3086
lemma Sup_lexord1:
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3087
  assumes A: "A \<noteq> {}" and eq: "(\<And>a. a \<in> A \<Longrightarrow> k a = (\<Union>a\<in>A. k a))" and P: "P (c A)"
63657
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3088
  shows "P (Sup_lexord k c s A)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3089
proof -
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3090
  have "{a \<in> A. k a = \<Union>(k ` A)} = A" for a :: 'a
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3091
    by (metis (mono_tags, lifting) Collect_cong Collect_mem_eq eq)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3092
  then show ?thesis
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3093
    using A P by (auto simp: Sup_lexord_def Let_def)
63657
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3094
qed
3663157ee197 tuned order of declarations and proofs
haftmann
parents: 63627
diff changeset
  3095
68617
75129a73aca3 more economic tagging
nipkow
parents: 68607
diff changeset
  3096
instantiation measure :: (type) complete_lattice
63658
7faa9bf9860b epheremal interpretation keeps auxiliary definition localized
haftmann
parents: 63657
diff changeset
  3097
begin
7faa9bf9860b epheremal interpretation keeps auxiliary definition localized
haftmann
parents: 63657
diff changeset
  3098
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3099
interpretation sup_measure: comm_monoid_set sup "bot :: 'a measure"
63658
7faa9bf9860b epheremal interpretation keeps auxiliary definition localized
haftmann
parents: 63657
diff changeset
  3100
  by standard (auto intro!: antisym)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3101
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3102
lemma sup_measure_F_mono':
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3103
  "finite J \<Longrightarrow> finite I \<Longrightarrow> sup_measure.F id I \<le> sup_measure.F id (I \<union> J)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3104
proof (induction J rule: finite_induct)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3105
  case empty then show ?case
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3106
    by simp
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3107
next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3108
  case (insert i J)
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3109
  then show ?case
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3110
    by (metis finite.insertI sup.orderE sup_ge1 sup_ge2 sup_measure.union_diff2 sup_measure.union_inter)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3111
qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3112
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3113
lemma sup_measure_F_mono: "finite I \<Longrightarrow> J \<subseteq> I \<Longrightarrow> sup_measure.F id J \<le> sup_measure.F id I"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3114
  using sup_measure_F_mono'[of I J] by (auto simp: finite_subset Un_absorb1)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3115
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3116
lemma sets_sup_measure_F:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3117
  "finite I \<Longrightarrow> I \<noteq> {} \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> sets i = sets M) \<Longrightarrow> sets (sup_measure.F id I) = sets M"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3118
  by (induction I rule: finite_ne_induct) (simp_all add: sets_sup)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3119
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  3120
definition\<^marker>\<open>tag important\<close> Sup_measure' :: "'a measure set \<Rightarrow> 'a measure" where
69564
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  3121
"Sup_measure' M =
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  3122
  measure_of (\<Union>a\<in>M. space a) (\<Union>a\<in>M. sets a)
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3123
    (\<lambda>X. (SUP P\<in>{P. finite P \<and> P \<subseteq> M }. sup_measure.F id P X))"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3124
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3125
lemma space_Sup_measure'2: "space (Sup_measure' M) = (\<Union>m\<in>M. space m)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3126
  unfolding Sup_measure'_def by (intro space_measure_of[OF UN_space_closed])
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3127
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3128
lemma sets_Sup_measure'2: "sets (Sup_measure' M) = sigma_sets (\<Union>m\<in>M. space m) (\<Union>m\<in>M. sets m)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3129
  unfolding Sup_measure'_def by (intro sets_measure_of[OF UN_space_closed])
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3130
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3131
lemma sets_Sup_measure':
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3132
  assumes sets_eq[simp]: "\<And>m. m \<in> M \<Longrightarrow> sets m = sets A" and "M \<noteq> {}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3133
  shows "sets (Sup_measure' M) = sets A"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3134
  using sets_eq[THEN sets_eq_imp_space_eq, simp] \<open>M \<noteq> {}\<close> by (simp add: Sup_measure'_def)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3135
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3136
lemma space_Sup_measure':
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3137
  assumes sets_eq[simp]: "\<And>m. m \<in> M \<Longrightarrow> sets m = sets A" and "M \<noteq> {}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3138
  shows "space (Sup_measure' M) = space A"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3139
  using sets_eq[THEN sets_eq_imp_space_eq, simp] \<open>M \<noteq> {}\<close>
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3140
  by (simp add: Sup_measure'_def )
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3141
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3142
lemma emeasure_Sup_measure':
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3143
  assumes sets_eq[simp]: "\<And>m. m \<in> M \<Longrightarrow> sets m = sets A" and "X \<in> sets A" "M \<noteq> {}"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3144
  shows "emeasure (Sup_measure' M) X = (SUP P\<in>{P. finite P \<and> P \<subseteq> M}. sup_measure.F id P X)"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3145
    (is "_ = ?S X")
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3146
  using Sup_measure'_def
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3147
proof (rule emeasure_measure_of)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3148
  note sets_eq[THEN sets_eq_imp_space_eq, simp]
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3149
  have *: "sets (Sup_measure' M) = sets A" "space (Sup_measure' M) = space A"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3150
    using \<open>M \<noteq> {}\<close> by (simp_all add: Sup_measure'_def)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3151
  let ?\<mu> = "sup_measure.F id"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3152
  show "countably_additive (sets (Sup_measure' M)) ?S"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3153
  proof (rule countably_additiveI, goal_cases)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3154
    case (1 F)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3155
    then have **: "range F \<subseteq> sets A"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3156
      by (auto simp: *)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3157
    show "(\<Sum>i. ?S (F i)) = ?S (\<Union>i. F i)"
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  3158
    proof (subst ennreal_suminf_SUP_eq_directed)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3159
      fix i j and N :: "nat set" assume ij: "i \<in> {P. finite P \<and> P \<subseteq> M}" "j \<in> {P. finite P \<and> P \<subseteq> M}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3160
      have "(i \<noteq> {} \<longrightarrow> sets (?\<mu> i) = sets A) \<and> (j \<noteq> {} \<longrightarrow> sets (?\<mu> j) = sets A) \<and>
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3161
        (i \<noteq> {} \<or> j \<noteq> {} \<longrightarrow> sets (?\<mu> (i \<union> j)) = sets A)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3162
        using ij by (intro impI sets_sup_measure_F conjI) auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3163
      then have "?\<mu> j (F n) \<le> ?\<mu> (i \<union> j) (F n) \<and> ?\<mu> i (F n) \<le> ?\<mu> (i \<union> j) (F n)" for n
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3164
        using ij
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3165
        by (cases "i = {}"; cases "j = {}")
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3166
           (auto intro!: le_measureD3 sup_measure_F_mono simp: sets_sup_measure_F
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3167
                 simp del: id_apply)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3168
      with ij show "\<exists>k\<in>{P. finite P \<and> P \<subseteq> M}. \<forall>n\<in>N. ?\<mu> i (F n) \<le> ?\<mu> k (F n) \<and> ?\<mu> j (F n) \<le> ?\<mu> k (F n)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3169
        by (safe intro!: bexI[of _ "i \<union> j"]) auto
60772
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  3170
    next
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69286
diff changeset
  3171
      show "(SUP P \<in> {P. finite P \<and> P \<subseteq> M}. \<Sum>n. ?\<mu> P (F n)) = (SUP P \<in> {P. finite P \<and> P \<subseteq> M}. ?\<mu> P (\<Union>(F ` UNIV)))"
69661
a03a63b81f44 tuned proofs
haftmann
parents: 69597
diff changeset
  3172
      proof (intro arg_cong [of _ _ Sup] image_cong refl)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3173
        fix i assume i: "i \<in> {P. finite P \<and> P \<subseteq> M}"
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69286
diff changeset
  3174
        show "(\<Sum>n. ?\<mu> i (F n)) = ?\<mu> i (\<Union>(F ` UNIV))"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3175
        proof (cases "i = {}")
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3176
          case False 
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3177
          with i ** sets_eq show ?thesis
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3178
            by (smt (verit, best) "1"(2) Measure_Space.sets_sup_measure_F mem_Collect_eq subset_eq suminf_cong suminf_emeasure)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3179
        qed simp
60772
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  3180
      qed
62975
1d066f6ab25d Probability: move emeasure and nn_integral from ereal to ennreal
hoelzl
parents: 62390
diff changeset
  3181
    qed
60772
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  3182
  qed
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3183
  show "positive (sets (Sup_measure' M)) ?S"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3184
    by (auto simp: positive_def bot_ennreal[symmetric])
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3185
  show "X \<in> sets (Sup_measure' M)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3186
    using assms * by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3187
qed (rule UN_space_closed)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3188
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  3189
definition\<^marker>\<open>tag important\<close> Sup_measure :: "'a measure set \<Rightarrow> 'a measure" where
69564
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  3190
"Sup_measure =
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  3191
  Sup_lexord space
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  3192
    (Sup_lexord sets Sup_measure'
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  3193
      (\<lambda>U. sigma (\<Union>u\<in>U. space u) (\<Union>u\<in>U. sets u)))
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  3194
    (\<lambda>U. sigma (\<Union>u\<in>U. space u) {})"
a59f7d07bf17 tuned defs
nipkow
parents: 69546
diff changeset
  3195
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  3196
definition\<^marker>\<open>tag important\<close> Inf_measure :: "'a measure set \<Rightarrow> 'a measure" where
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3197
  "Inf_measure A = Sup {x. \<forall>a\<in>A. x \<le> a}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3198
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  3199
definition\<^marker>\<open>tag important\<close> inf_measure :: "'a measure \<Rightarrow> 'a measure \<Rightarrow> 'a measure" where
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3200
  "inf_measure a b = Inf {a, b}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3201
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  3202
definition\<^marker>\<open>tag important\<close> top_measure :: "'a measure" where
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3203
  "top_measure = Inf {}"
60772
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  3204
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  3205
instance
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  3206
proof
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3207
  note UN_space_closed [simp]
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3208
  show upper: "x \<le> Sup A" if x: "x \<in> A" for x :: "'a measure" and A
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3209
    unfolding Sup_measure_def
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3210
  proof (intro Sup_lexord[where P="\<lambda>y. x \<le> y"])
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3211
    assume "\<And>a. a \<in> A \<Longrightarrow> space a \<noteq> (\<Union>a\<in>A. space a)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3212
    from this[OF \<open>x \<in> A\<close>] \<open>x \<in> A\<close> show "x \<le> sigma (\<Union>a\<in>A. space a) {}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3213
      by (intro less_eq_measure.intros) auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3214
  next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3215
    fix a S assume "a \<in> A" and a: "space a = (\<Union>a\<in>A. space a)" and S: "S = {a' \<in> A. space a' = space a}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3216
      and neq: "\<And>aa. aa \<in> S \<Longrightarrow> sets aa \<noteq> (\<Union>a\<in>S. sets a)"
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69286
diff changeset
  3217
    have sp_a: "space a = (\<Union>(space ` S))"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3218
      using \<open>a\<in>A\<close> by (auto simp: S)
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69286
diff changeset
  3219
    show "x \<le> sigma (\<Union>(space ` S)) (\<Union>(sets ` S))"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3220
    proof cases
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3221
      assume [simp]: "space x = space a"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3222
      have "sets x \<subset> (\<Union>a\<in>S. sets a)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3223
        using \<open>x\<in>A\<close> neq[of x] by (auto simp: S)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3224
      also have "\<dots> \<subseteq> sigma_sets (\<Union>x\<in>S. space x) (\<Union>x\<in>S. sets x)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3225
        by (rule sigma_sets_superset_generator)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3226
      finally show ?thesis
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3227
        by (intro less_eq_measure.intros(2)) (simp_all add: sp_a)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3228
    next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3229
      assume "space x \<noteq> space a"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3230
      moreover have "space x \<le> space a"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3231
        unfolding a using \<open>x\<in>A\<close> by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3232
      ultimately show ?thesis
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3233
        by (intro less_eq_measure.intros) (simp add: less_le sp_a)
60772
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  3234
    qed
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  3235
  next
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3236
    fix a b S S' assume "a \<in> A" and a: "space a = (\<Union>a\<in>A. space a)" and S: "S = {a' \<in> A. space a' = space a}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3237
      and "b \<in> S" and b: "sets b = (\<Union>a\<in>S. sets a)" and S': "S' = {a' \<in> S. sets a' = sets b}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3238
    then have "S' \<noteq> {}" "space b = space a"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3239
      by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3240
    have sets_eq: "\<And>x. x \<in> S' \<Longrightarrow> sets x = sets b"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3241
      by (auto simp: S')
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3242
    note sets_eq[THEN sets_eq_imp_space_eq, simp]
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3243
    have *: "sets (Sup_measure' S') = sets b" "space (Sup_measure' S') = space b"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3244
      using \<open>S' \<noteq> {}\<close> by (simp_all add: Sup_measure'_def sets_eq)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3245
    show "x \<le> Sup_measure' S'"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3246
    proof cases
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3247
      assume "x \<in> S"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3248
      with \<open>b \<in> S\<close> have "space x = space b"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3249
        by (simp add: S)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3250
      show ?thesis
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3251
      proof cases
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3252
        assume "x \<in> S'"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3253
        show "x \<le> Sup_measure' S'"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3254
        proof (intro le_measure[THEN iffD2] ballI)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3255
          show "sets x = sets (Sup_measure' S')"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3256
            using \<open>x\<in>S'\<close> * by (simp add: S')
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3257
          fix X assume "X \<in> sets x"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3258
          show "emeasure x X \<le> emeasure (Sup_measure' S') X"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3259
          proof (subst emeasure_Sup_measure'[OF _ \<open>X \<in> sets x\<close>])
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3260
            show "emeasure x X \<le> (SUP P \<in> {P. finite P \<and> P \<subseteq> S'}. emeasure (sup_measure.F id P) X)"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3261
              using \<open>x\<in>S'\<close> by (intro SUP_upper2[where i="{x}"]) auto
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3262
          qed (use \<open>x\<in>S'\<close> S' in auto)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3263
        qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3264
      next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3265
        assume "x \<notin> S'"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3266
        then have "sets x \<noteq> sets b"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3267
          using \<open>x\<in>S\<close> by (auto simp: S')
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3268
        moreover have "sets x \<le> sets b"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3269
          using \<open>x\<in>S\<close> unfolding b by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3270
        ultimately show ?thesis
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3271
          using * \<open>x \<in> S\<close> by (simp add: le_measure_iff sets_le_imp_space_le)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3272
      qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3273
    next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3274
      assume "x \<notin> S"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3275
      with \<open>x\<in>A\<close> \<open>x \<notin> S\<close> \<open>space b = space a\<close> show ?thesis
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3276
        by (simp add: "*" S SUP_upper2 a le_measure_iff)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3277
    qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3278
  qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3279
  show least: "Sup A \<le> x" if x: "\<And>z. z \<in> A \<Longrightarrow> z \<le> x" for x :: "'a measure" and A
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3280
    unfolding Sup_measure_def
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3281
  proof (intro Sup_lexord[where P="\<lambda>y. y \<le> x"])
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3282
    assume "\<And>a. a \<in> A \<Longrightarrow> space a \<noteq> (\<Union>a\<in>A. space a)"
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69286
diff changeset
  3283
    show "sigma (\<Union>(space ` A)) {} \<le> x"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3284
      using x[THEN le_measureD1] by (subst sigma_le_iff) auto
60772
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  3285
  next
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3286
    fix a S assume "a \<in> A" "space a = (\<Union>a\<in>A. space a)" and S: "S = {a' \<in> A. space a' = space a}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3287
      "\<And>a. a \<in> S \<Longrightarrow> sets a \<noteq> (\<Union>a\<in>S. sets a)"
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69286
diff changeset
  3288
    have "\<Union>(space ` S) \<subseteq> space x"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3289
      using S le_measureD1[OF x] by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3290
    moreover
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69286
diff changeset
  3291
    have "\<Union>(space ` S) = space a"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3292
      using \<open>a\<in>A\<close> S by auto
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69286
diff changeset
  3293
    then have "space x = \<Union>(space ` S) \<Longrightarrow> \<Union>(sets ` S) \<subseteq> sets x"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3294
      using \<open>a \<in> A\<close> le_measureD2[OF x] by (auto simp: S)
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69286
diff changeset
  3295
    ultimately show "sigma (\<Union>(space ` S)) (\<Union>(sets ` S)) \<le> x"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3296
      by (subst sigma_le_iff) simp_all
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3297
  next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3298
    fix a b S S' assume "a \<in> A" and a: "space a = (\<Union>a\<in>A. space a)" and S: "S = {a' \<in> A. space a' = space a}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3299
      and "b \<in> S" and b: "sets b = (\<Union>a\<in>S. sets a)" and S': "S' = {a' \<in> S. sets a' = sets b}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3300
    then have "S' \<noteq> {}" "space b = space a"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3301
      by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3302
    have sets_eq: "\<And>x. x \<in> S' \<Longrightarrow> sets x = sets b"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3303
      by (auto simp: S')
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3304
    note sets_eq[THEN sets_eq_imp_space_eq, simp]
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3305
    have *: "sets (Sup_measure' S') = sets b" "space (Sup_measure' S') = space b"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3306
      using \<open>S' \<noteq> {}\<close> by (simp_all add: Sup_measure'_def sets_eq)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3307
    show "Sup_measure' S' \<le> x"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3308
    proof cases
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3309
      assume "space x = space a"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3310
      show ?thesis
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3311
      proof cases
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3312
        assume **: "sets x = sets b"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3313
        show ?thesis
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3314
        proof (intro le_measure[THEN iffD2] ballI)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3315
          show ***: "sets (Sup_measure' S') = sets x"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3316
            by (simp add: * **)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3317
          fix X assume "X \<in> sets (Sup_measure' S')"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3318
          show "emeasure (Sup_measure' S') X \<le> emeasure x X"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3319
            unfolding ***
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3320
          proof (subst emeasure_Sup_measure'[OF _ \<open>X \<in> sets (Sup_measure' S')\<close>])
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3321
            show "(SUP P \<in> {P. finite P \<and> P \<subseteq> S'}. emeasure (sup_measure.F id P) X) \<le> emeasure x X"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3322
            proof (safe intro!: SUP_least)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3323
              fix P assume P: "finite P" "P \<subseteq> S'"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3324
              show "emeasure (sup_measure.F id P) X \<le> emeasure x X"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3325
              proof cases
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3326
                assume "P = {}" then show ?thesis
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3327
                  by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3328
              next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3329
                assume "P \<noteq> {}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3330
                from P have "finite P" "P \<subseteq> A"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3331
                  unfolding S' S by (simp_all add: subset_eq)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3332
                then have "sup_measure.F id P \<le> x"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3333
                  by (induction P) (auto simp: x)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3334
                moreover have "sets (sup_measure.F id P) = sets x"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3335
                  using \<open>finite P\<close> \<open>P \<noteq> {}\<close> \<open>P \<subseteq> S'\<close> \<open>sets x = sets b\<close>
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3336
                  by (intro sets_sup_measure_F) (auto simp: S')
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3337
                ultimately show "emeasure (sup_measure.F id P) X \<le> emeasure x X"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3338
                  by (rule le_measureD3)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3339
              qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3340
            qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3341
            show "m \<in> S' \<Longrightarrow> sets m = sets (Sup_measure' S')" for m
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3342
              unfolding * by (simp add: S')
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3343
          qed fact
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3344
        qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3345
      next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3346
        assume "sets x \<noteq> sets b"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3347
        moreover have "sets b \<le> sets x"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3348
          unfolding b S using x[THEN le_measureD2] \<open>space x = space a\<close> by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3349
        ultimately show "Sup_measure' S' \<le> x"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3350
          using \<open>space x = space a\<close> \<open>b \<in> S\<close>
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3351
          by (intro less_eq_measure.intros(2)) (simp_all add: * S)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3352
      qed
60772
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  3353
    next
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3354
      assume "space x \<noteq> space a"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3355
      then have "space a < space x"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3356
        by (simp add: \<open>a \<in> A\<close> le_measureD1 psubsetI x)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3357
      then show "Sup_measure' S' \<le> x"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3358
        by (intro less_eq_measure.intros) (simp add: * \<open>space b = space a\<close>)
60772
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  3359
    qed
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  3360
  qed
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3361
  show "Sup {} = (bot::'a measure)" "Inf {} = (top::'a measure)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3362
    by (auto intro!: antisym least simp: top_measure_def)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3363
  show lower: "x \<in> A \<Longrightarrow> Inf A \<le> x" for x :: "'a measure" and A
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3364
    unfolding Inf_measure_def by (intro least) auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3365
  show greatest: "(\<And>z. z \<in> A \<Longrightarrow> x \<le> z) \<Longrightarrow> x \<le> Inf A" for x :: "'a measure" and A
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3366
    unfolding Inf_measure_def by (intro upper) auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3367
  show "inf x y \<le> x" "inf x y \<le> y" "x \<le> y \<Longrightarrow> x \<le> z \<Longrightarrow> x \<le> inf y z" for x y z :: "'a measure"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3368
    by (auto simp: inf_measure_def intro!: lower greatest)
60772
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  3369
qed
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3370
60772
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  3371
end
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  3372
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3373
lemma sets_SUP:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3374
  assumes "\<And>x. x \<in> I \<Longrightarrow> sets (M x) = sets N"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3375
  shows "I \<noteq> {} \<Longrightarrow> sets (SUP i\<in>I. M i) = sets N"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3376
  unfolding Sup_measure_def
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3377
  using assms assms[THEN sets_eq_imp_space_eq]
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3378
    sets_Sup_measure'[where A=N and M="M`I"]
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3379
  by (intro Sup_lexord1[where P="\<lambda>x. sets x = sets N"]) auto
61633
64e6d712af16 add lemmas
Andreas Lochbihler
parents: 61609
diff changeset
  3380
64e6d712af16 add lemmas
Andreas Lochbihler
parents: 61609
diff changeset
  3381
lemma emeasure_SUP:
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3382
  assumes sets: "\<And>i. i \<in> I \<Longrightarrow> sets (M i) = sets N" "X \<in> sets N" "I \<noteq> {}"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3383
  shows "emeasure (SUP i\<in>I. M i) X = (SUP J\<in>{J. J \<noteq> {} \<and> finite J \<and> J \<subseteq> I}. emeasure (SUP i\<in>J. M i) X)"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3384
proof -
63658
7faa9bf9860b epheremal interpretation keeps auxiliary definition localized
haftmann
parents: 63657
diff changeset
  3385
  interpret sup_measure: comm_monoid_set sup "bot :: 'b measure"
7faa9bf9860b epheremal interpretation keeps auxiliary definition localized
haftmann
parents: 63657
diff changeset
  3386
    by standard (auto intro!: antisym)
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3387
  have eq: "finite J \<Longrightarrow> sup_measure.F id J = (SUP i\<in>J. i)" for J :: "'b measure set"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3388
    by (induction J rule: finite_induct) auto
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3389
  have 1: "J \<noteq> {} \<Longrightarrow> J \<subseteq> I \<Longrightarrow> sets (SUP x\<in>J. M x) = sets N" for J
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3390
    by (intro sets_SUP sets) (auto )
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3391
  from \<open>I \<noteq> {}\<close> obtain i where "i\<in>I" by auto
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3392
  have "Sup_measure' (M`I) X = (SUP P\<in>{P. finite P \<and> P \<subseteq> M`I}. sup_measure.F id P X)"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3393
    using sets by (intro emeasure_Sup_measure') auto
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3394
  also have "Sup_measure' (M`I) = (SUP i\<in>I. M i)"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3395
    unfolding Sup_measure_def using \<open>I \<noteq> {}\<close> sets sets(1)[THEN sets_eq_imp_space_eq]
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3396
    by (intro Sup_lexord1[where P="\<lambda>x. _ = x"]) auto
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3397
  also have "(SUP P\<in>{P. finite P \<and> P \<subseteq> M`I}. sup_measure.F id P X) =
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3398
    (SUP J\<in>{J. J \<noteq> {} \<and> finite J \<and> J \<subseteq> I}. (SUP i\<in>J. M i) X)"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3399
  proof (intro SUP_eq)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3400
    fix J assume "J \<in> {P. finite P \<and> P \<subseteq> M`I}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3401
    then obtain J' where J': "J' \<subseteq> I" "finite J'" and J: "J = M`J'" and "finite J"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3402
      using finite_subset_image[of J M I] by auto
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3403
    show "\<exists>j\<in>{J. J \<noteq> {} \<and> finite J \<and> J \<subseteq> I}. sup_measure.F id J X \<le> (SUP i\<in>j. M i) X"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3404
    proof cases
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3405
      assume "J' = {}" with \<open>i \<in> I\<close> show ?thesis
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3406
        by (auto simp: J)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3407
    next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3408
      assume "J' \<noteq> {}" with J J' show ?thesis
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3409
        using eq by auto
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3410
    qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3411
  next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3412
    fix J assume J: "J \<in> {P. P \<noteq> {} \<and> finite P \<and> P \<subseteq> I}"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3413
    show "\<exists>J'\<in>{J. finite J \<and> J \<subseteq> M`I}. (SUP i\<in>J. M i) X \<le> sup_measure.F id J' X"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3414
      using J by (intro bexI[of _ "M`J"]) (auto simp: eq simp del: id_apply)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3415
  qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3416
  finally show ?thesis .
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3417
qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3418
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3419
lemma emeasure_SUP_chain:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3420
  assumes sets: "\<And>i. i \<in> A \<Longrightarrow> sets (M i) = sets N" "X \<in> sets N"
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66453
diff changeset
  3421
  assumes ch: "Complete_Partial_Order.chain (\<le>) (M ` A)" and "A \<noteq> {}"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3422
  shows "emeasure (SUP i\<in>A. M i) X = (SUP i\<in>A. emeasure (M i) X)"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3423
proof (subst emeasure_SUP[OF sets \<open>A \<noteq> {}\<close>])
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69286
diff changeset
  3424
  show "(SUP J\<in>{J. J \<noteq> {} \<and> finite J \<and> J \<subseteq> A}. emeasure (Sup (M ` J)) X) = (SUP i\<in>A. emeasure (M i) X)"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3425
  proof (rule SUP_eq)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3426
    fix J assume "J \<in> {J. J \<noteq> {} \<and> finite J \<and> J \<subseteq> A}"
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66453
diff changeset
  3427
    then have J: "Complete_Partial_Order.chain (\<le>) (M ` J)" "finite J" "J \<noteq> {}" and "J \<subseteq> A"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3428
      using ch[THEN chain_subset, of "M`J"] by auto
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3429
    with in_chain_finite[OF J(1)] obtain j where "j \<in> J" "(SUP j\<in>J. M j) = M j"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3430
      by auto
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69286
diff changeset
  3431
    with \<open>J \<subseteq> A\<close> show "\<exists>j\<in>A. emeasure (Sup (M ` J)) X \<le> emeasure (M j) X"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3432
      by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3433
  next
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69286
diff changeset
  3434
    fix j assume "j\<in>A" then show "\<exists>i\<in>{J. J \<noteq> {} \<and> finite J \<and> J \<subseteq> A}. emeasure (M j) X \<le> emeasure (Sup (M ` i)) X"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3435
      by (intro bexI[of _ "{j}"]) auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3436
  qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3437
qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3438
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69861
diff changeset
  3439
subsubsection\<^marker>\<open>tag unimportant\<close> \<open>Supremum of a set of \<open>\<sigma>\<close>-algebras\<close>
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3440
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3441
lemma space_Sup_eq_UN: "space (Sup M) = (\<Union>x\<in>M. space x)" (is "?L=?R")
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3442
proof
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3443
  show "?L \<subseteq> ?R"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3444
  proof -
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3445
    define A where "A \<equiv> {a \<in> M. space a = \<Union> (space ` M)}"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3446
    have "\<exists>x\<in>M. a \<in> space x"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3447
      if "a \<in> space (Sup_measure' {a \<in> A. sets a = \<Union> (sets ` A)})"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3448
      for a
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3449
      by (metis (no_types, lifting) A_def UN_E mem_Collect_eq space_Sup_measure'2 that)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3450
    then show ?thesis
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3451
      by (auto simp: A_def space_measure_of_conv Sup_measure_def Sup_lexord_def Let_def split: if_splits)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3452
  qed
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3453
qed (use Sup_upper le_measureD1 in fastforce)
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3454
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3455
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3456
lemma sets_Sup_eq:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3457
  assumes *: "\<And>m. m \<in> M \<Longrightarrow> space m = X" and "M \<noteq> {}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3458
  shows "sets (Sup M) = sigma_sets X (\<Union>x\<in>M. sets x)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3459
  unfolding Sup_measure_def
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3460
proof (rule Sup_lexord1 [OF \<open>M \<noteq> {}\<close>])
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3461
  show "sets (Sup_lexord sets Sup_measure' (\<lambda>U. sigma (\<Union> (space ` U)) (\<Union> (sets ` U))) M)
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3462
      = sigma_sets X (\<Union> (sets ` M))"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3463
  apply (rule Sup_lexord)
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3464
  apply (metis (mono_tags, lifting) "*" empty_iff mem_Collect_eq sets.sigma_sets_eq sets_Sup_measure')
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3465
  by (metis "*" SUP_eq_const UN_space_closed assms(2) sets_measure_of)
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3466
qed (use * in blast)
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3467
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3468
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3469
lemma in_sets_Sup: "(\<And>m. m \<in> M \<Longrightarrow> space m = X) \<Longrightarrow> m \<in> M \<Longrightarrow> A \<in> sets m \<Longrightarrow> A \<in> sets (Sup M)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3470
  by (subst sets_Sup_eq[where X=X]) auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3471
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3472
lemma Sup_lexord_rel:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3473
  assumes "\<And>i. i \<in> I \<Longrightarrow> k (A i) = k (B i)"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3474
    "R (c (A ` {a \<in> I. k (B a) = (SUP x\<in>I. k (B x))})) (c (B ` {a \<in> I. k (B a) = (SUP x\<in>I. k (B x))}))"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3475
    "R (s (A`I)) (s (B`I))"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3476
  shows "R (Sup_lexord k c s (A`I)) (Sup_lexord k c s (B`I))"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3477
proof -
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3478
  have "A ` {a \<in> I. k (B a) = (SUP x\<in>I. k (B x))} =  {a \<in> A ` I. k a = (SUP x\<in>I. k (B x))}"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3479
    using assms(1) by auto
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3480
  moreover have "B ` {a \<in> I. k (B a) = (SUP x\<in>I. k (B x))} =  {a \<in> B ` I. k a = (SUP x\<in>I. k (B x))}"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3481
    by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3482
  ultimately show ?thesis
69861
62e47f06d22c avoid context-sensitive simp rules whose context-free form (image_comp) is not simp by default
haftmann
parents: 69661
diff changeset
  3483
    using assms by (auto simp: Sup_lexord_def Let_def image_comp)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3484
qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3485
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3486
lemma sets_SUP_cong:
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3487
  assumes eq: "\<And>i. i \<in> I \<Longrightarrow> sets (M i) = sets (N i)" 
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3488
  shows "sets (SUP i\<in>I. M i) = sets (SUP i\<in>I. N i)"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3489
  unfolding Sup_measure_def
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3490
  using eq eq[THEN sets_eq_imp_space_eq]
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3491
  by (intro Sup_lexord_rel[where R="\<lambda>x y. sets x = sets y"], simp_all add: sets_Sup_measure'2)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3492
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3493
lemma sets_Sup_in_sets:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3494
  assumes "M \<noteq> {}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3495
  assumes "\<And>m. m \<in> M \<Longrightarrow> space m = space N"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3496
  assumes "\<And>m. m \<in> M \<Longrightarrow> sets m \<subseteq> sets N"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3497
  shows "sets (Sup M) \<subseteq> sets N"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3498
proof -
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69286
diff changeset
  3499
  have *: "\<Union>(space ` M) = space N"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3500
    using assms by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3501
  show ?thesis
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3502
    unfolding * using assms by (subst sets_Sup_eq[of M "space N"]) (auto intro!: sets.sigma_sets_subset)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3503
qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3504
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3505
lemma measurable_Sup1:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3506
  assumes m: "m \<in> M" and f: "f \<in> measurable m N"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3507
    and const_space: "\<And>m n. m \<in> M \<Longrightarrow> n \<in> M \<Longrightarrow> space m = space n"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3508
  shows "f \<in> measurable (Sup M) N"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3509
proof -
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3510
  have "space (Sup M) = space m"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3511
    using m by (auto simp: space_Sup_eq_UN dest: const_space)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3512
  then show ?thesis
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3513
    using m f unfolding measurable_def by (auto intro: in_sets_Sup[OF const_space])
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3514
qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3515
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3516
lemma measurable_Sup2:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3517
  assumes M: "M \<noteq> {}"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3518
  assumes f: "\<And>m. m \<in> M \<Longrightarrow> f \<in> measurable N m"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3519
    and const_space: "\<And>m n. m \<in> M \<Longrightarrow> n \<in> M \<Longrightarrow> space m = space n"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3520
  shows "f \<in> measurable N (Sup M)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3521
proof -
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3522
  from M obtain m where "m \<in> M" by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3523
  have space_eq: "\<And>n. n \<in> M \<Longrightarrow> space n = space m"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3524
    by (intro const_space \<open>m \<in> M\<close>)
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3525
  have eq: "sets (sigma (\<Union> (space ` M)) (\<Union> (sets ` M))) = sets (Sup M)"
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3526
    by (metis M SUP_eq_const UN_space_closed sets_Sup_eq sets_measure_of space_eq)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3527
  have "f \<in> measurable N (sigma (\<Union>m\<in>M. space m) (\<Union>m\<in>M. sets m))"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3528
  proof (rule measurable_measure_of)
69313
b021008c5397 removed legacy input syntax
haftmann
parents: 69286
diff changeset
  3529
    show "f \<in> space N \<rightarrow> \<Union>(space ` M)"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3530
      using measurable_space[OF f] M by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3531
  qed (auto intro: measurable_sets f dest: sets.sets_into_space)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3532
  also have "measurable N (sigma (\<Union>m\<in>M. space m) (\<Union>m\<in>M. sets m)) = measurable N (Sup M)"
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3533
    using eq measurable_cong_sets by blast
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3534
  finally show ?thesis .
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3535
qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3536
64320
ba194424b895 HOL-Probability: move stopping time from AFP/Markov_Models
hoelzl
parents: 64283
diff changeset
  3537
lemma measurable_SUP2:
ba194424b895 HOL-Probability: move stopping time from AFP/Markov_Models
hoelzl
parents: 64283
diff changeset
  3538
  "I \<noteq> {} \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> f \<in> measurable N (M i)) \<Longrightarrow>
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3539
    (\<And>i j. i \<in> I \<Longrightarrow> j \<in> I \<Longrightarrow> space (M i) = space (M j)) \<Longrightarrow> f \<in> measurable N (SUP i\<in>I. M i)"
64320
ba194424b895 HOL-Probability: move stopping time from AFP/Markov_Models
hoelzl
parents: 64283
diff changeset
  3540
  by (auto intro!: measurable_Sup2)
ba194424b895 HOL-Probability: move stopping time from AFP/Markov_Models
hoelzl
parents: 64283
diff changeset
  3541
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3542
lemma sets_Sup_sigma:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3543
  assumes [simp]: "M \<noteq> {}" and M: "\<And>m. m \<in> M \<Longrightarrow> m \<subseteq> Pow \<Omega>"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3544
  shows "sets (SUP m\<in>M. sigma \<Omega> m) = sets (sigma \<Omega> (\<Union>M))"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3545
proof -
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3546
  have "a \<in> sigma_sets \<Omega> (\<Union>M)"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3547
    if "a \<in> sigma_sets \<Omega> m" "m \<in> M" for a m
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3548
    using that by induction (auto intro: sigma_sets.intros) 
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3549
  then have "sigma_sets \<Omega> (\<Union> (sigma_sets \<Omega> ` M)) = sigma_sets \<Omega> (\<Union> M)"
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3550
    by (smt (verit, best) UN_iff Union_iff sigma_sets.Basic sigma_sets_eqI)
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3551
  then show "sets (SUP m\<in>M. sigma \<Omega> m) = sets (sigma \<Omega> (\<Union>M))"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3552
    by (subst sets_Sup_eq) (fastforce simp: M Union_least)+
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3553
qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3554
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3555
lemma Sup_sigma:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3556
  assumes [simp]: "M \<noteq> {}" and M: "\<And>m. m \<in> M \<Longrightarrow> m \<subseteq> Pow \<Omega>"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3557
  shows "(SUP m\<in>M. sigma \<Omega> m) = (sigma \<Omega> (\<Union>M))"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3558
proof (intro antisym SUP_least)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3559
  have *: "\<Union>M \<subseteq> Pow \<Omega>"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3560
    using M by auto
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3561
  show "sigma \<Omega> (\<Union>M) \<le> (SUP m\<in>M. sigma \<Omega> m)"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3562
  proof (intro less_eq_measure.intros(3))
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3563
    show "space (sigma \<Omega> (\<Union>M)) = space (SUP m\<in>M. sigma \<Omega> m)"
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3564
         "sets (sigma \<Omega> (\<Union>M)) = sets (SUP m\<in>M. sigma \<Omega> m)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3565
      by (auto simp: M sets_Sup_sigma sets_eq_imp_space_eq space_measure_of_conv)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3566
  qed (simp add: emeasure_sigma le_fun_def)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3567
  fix m assume "m \<in> M" then show "sigma \<Omega> m \<le> sigma \<Omega> (\<Union>M)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3568
    by (subst sigma_le_iff) (auto simp: M *)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3569
qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3570
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3571
lemma SUP_sigma_sigma:
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3572
  "M \<noteq> {} \<Longrightarrow> (\<And>m. m \<in> M \<Longrightarrow> f m \<subseteq> Pow \<Omega>) \<Longrightarrow> (SUP m\<in>M. sigma \<Omega> (f m)) = sigma \<Omega> (\<Union>m\<in>M. f m)"
69861
62e47f06d22c avoid context-sensitive simp rules whose context-free form (image_comp) is not simp by default
haftmann
parents: 69661
diff changeset
  3573
  using Sup_sigma[of "f`M" \<Omega>] by (auto simp: image_comp)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3574
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3575
lemma sets_vimage_Sup_eq:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3576
  assumes *: "M \<noteq> {}" "f \<in> X \<rightarrow> Y" "\<And>m. m \<in> M \<Longrightarrow> space m = Y"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3577
  shows "sets (vimage_algebra X f (Sup M)) = sets (SUP m \<in> M. vimage_algebra X f m)"
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3578
  (is "?L = ?R")
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3579
proof
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3580
  { fix m
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3581
    assume "m \<in> M"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3582
    then have "f \<in> vimage_algebra X f m \<rightarrow>\<^sub>M m"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3583
      by (simp add: assms measurable_vimage_algebra1)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3584
    then have "f \<in> Sup (vimage_algebra X f ` M) \<rightarrow>\<^sub>M m"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3585
      using \<open>m \<in> M\<close> by (force simp: intro: measurable_Sup1)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3586
  }
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3587
  then show "?L \<subseteq> ?R"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3588
    by (intro sets_image_in_sets measurable_Sup2) (simp_all add: space_Sup_eq_UN *)
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3589
  show "?R \<subseteq> ?L"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3590
    apply (intro sets_Sup_in_sets)
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3591
    apply (force simp: * space_Sup_eq_UN sets_vimage_algebra2 intro: in_sets_Sup)+
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3592
    done
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3593
qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3594
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3595
lemma restrict_space_eq_vimage_algebra':
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3596
  "sets (restrict_space M \<Omega>) = sets (vimage_algebra (\<Omega> \<inter> space M) (\<lambda>x. x) M)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3597
  by (metis Int_assoc image_cong inf_le2 restrict_space_eq_vimage_algebra
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3598
      sets.Int_space_eq1 sets_restrict_space)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3599
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3600
lemma sigma_le_sets:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3601
  assumes [simp]: "A \<subseteq> Pow X" shows "sets (sigma X A) \<subseteq> sets N \<longleftrightarrow> X \<in> sets N \<and> A \<subseteq> sets N"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3602
proof
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3603
  have "X \<in> sigma_sets X A" "A \<subseteq> sigma_sets X A"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3604
    by (auto intro: sigma_sets_top)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3605
  moreover assume "sets (sigma X A) \<subseteq> sets N"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3606
  ultimately show "X \<in> sets N \<and> A \<subseteq> sets N"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3607
    by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3608
next
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3609
  assume *: "X \<in> sets N \<and> A \<subseteq> sets N"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3610
  { fix Y assume "Y \<in> sigma_sets X A" from this * have "Y \<in> sets N"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3611
      by induction auto }
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3612
  then show "sets (sigma X A) \<subseteq> sets N"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3613
    by auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3614
qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3615
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3616
lemma measurable_iff_sets:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3617
  "f \<in> measurable M N \<longleftrightarrow> (f \<in> space M \<rightarrow> space N \<and> sets (vimage_algebra (space M) f N) \<subseteq> sets M)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3618
  (is "?L = ?R")
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3619
proof
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3620
  show "?L \<Longrightarrow> ?R"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3621
    by (simp add: measurable_space sets_image_in_sets)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3622
  show "?R \<Longrightarrow> ?L"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3623
    by (simp add: in_vimage_algebra measurable_def subset_eq)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3624
qed
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3625
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3626
lemma sets_vimage_algebra_space: "X \<in> sets (vimage_algebra X f M)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3627
  using sets.top[of "vimage_algebra X f M"] by simp
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3628
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3629
lemma measurable_mono:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3630
  assumes N: "sets N' \<le> sets N" "space N = space N'"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3631
  assumes M: "sets M \<le> sets M'" "space M = space M'"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3632
  shows "measurable M N \<subseteq> measurable M' N'"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3633
  unfolding measurable_def
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3634
proof safe
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3635
  fix f A 
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3636
  assume "f \<in> space M \<rightarrow> space N" "A \<in> sets N'" 
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3637
         "\<forall>y\<in>sets N. f -` y \<inter> space M \<in> sets M" 
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3638
  then show "f -` A \<inter> space M' \<in> sets M'"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3639
    using assms by (metis subset_eq)
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3640
qed (use N M in auto)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3641
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3642
lemma measurable_Sup_measurable:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3643
  assumes f: "f \<in> space N \<rightarrow> A"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3644
  shows "f \<in> measurable N (Sup {M. space M = A \<and> f \<in> measurable N M})"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3645
proof (rule measurable_Sup2)
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3646
  have "f \<in> N \<rightarrow>\<^sub>M sigma A {}"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3647
    by (meson empty_subsetI equals0D f measurable_measure_of)
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3648
  then show "{M. space M = A \<and> f \<in> measurable N M} \<noteq> {}"
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3649
    by fastforce
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3650
qed auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3651
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3652
lemma (in sigma_algebra) sigma_sets_subset':
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3653
  assumes a: "a \<subseteq> M" "\<Omega>' \<in> M"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3654
  shows "sigma_sets \<Omega>' a \<subseteq> M"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3655
proof
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3656
  show "x \<in> M" if x: "x \<in> sigma_sets \<Omega>' a" for x
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3657
    using x by (induct rule: sigma_sets.induct) (use a in auto)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3658
qed
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3659
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3660
lemma in_sets_SUP: "i \<in> I \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> space (M i) = Y) \<Longrightarrow> X \<in> sets (M i) \<Longrightarrow> X \<in> sets (SUP i\<in>I. M i)"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3661
  by (intro in_sets_Sup[where X=Y]) auto
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3662
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3663
lemma measurable_SUP1:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3664
  "i \<in> I \<Longrightarrow> f \<in> measurable (M i) N \<Longrightarrow> (\<And>m n. m \<in> I \<Longrightarrow> n \<in> I \<Longrightarrow> space (M m) = space (M n)) \<Longrightarrow>
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3665
    f \<in> measurable (SUP i\<in>I. M i) N"
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3666
  by (auto intro: measurable_Sup1)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3667
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3668
lemma sets_image_in_sets':
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3669
  assumes X: "X \<in> sets N"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3670
  assumes f: "\<And>A. A \<in> sets M \<Longrightarrow> f -` A \<inter> X \<in> sets N"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3671
  shows "sets (vimage_algebra X f M) \<subseteq> sets N"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3672
  unfolding sets_vimage_algebra
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3673
  by (rule sets.sigma_sets_subset') (auto intro!: measurable_sets X f)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3674
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3675
lemma mono_vimage_algebra:
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3676
  "sets M \<le> sets N \<Longrightarrow> sets (vimage_algebra X f M) \<subseteq> sets (vimage_algebra X f N)"
82538
4b132ea7d575 More tidying and some variable renaming
paulson <lp15@cam.ac.uk>
parents: 81142
diff changeset
  3677
  by (simp add: in_vimage_algebra sets_image_in_sets' sets_vimage_algebra_space subsetD)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3678
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3679
lemma mono_restrict_space: "sets M \<le> sets N \<Longrightarrow> sets (restrict_space M X) \<subseteq> sets (restrict_space N X)"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3680
  unfolding sets_restrict_space by (rule image_mono)
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3681
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3682
lemma sets_eq_bot: "sets M = {{}} \<longleftrightarrow> M = bot"
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3683
  by (metis measure_eqI emeasure_empty sets_bot singletonD)
63333
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3684
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3685
lemma sets_eq_bot2: "{{}} = sets M \<longleftrightarrow> M = bot"
158ab2239496 Probability: show that measures form a complete lattice
hoelzl
parents: 63040
diff changeset
  3686
  using sets_eq_bot[of M] by blast
61633
64e6d712af16 add lemmas
Andreas Lochbihler
parents: 61609
diff changeset
  3687
63626
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3688
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3689
lemma (in finite_measure) countable_support:
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3690
  "countable {x. measure M {x} \<noteq> 0}"
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3691
proof cases
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3692
  assume "measure M (space M) = 0"
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3693
  then show ?thesis 
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3694
    by (metis (mono_tags, lifting) bounded_measure measure_le_0_iff Collect_empty_eq countable_empty) 
63626
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3695
next
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3696
  let ?M = "measure M (space M)" and ?m = "\<lambda>x. measure M {x}"
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3697
  assume "?M \<noteq> 0"
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3698
  then have *: "{x. ?m x \<noteq> 0} = (\<Union>n. {x. ?M / Suc n < ?m x})"
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3699
    using reals_Archimedean[of "?m x / ?M" for x]
63958
02de4a58e210 HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
hoelzl
parents: 63940
diff changeset
  3700
    by (auto simp: field_simps not_le[symmetric] divide_le_0_iff measure_le_0_iff)
63626
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3701
  have **: "\<And>n. finite {x. ?M / Suc n < ?m x}"
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3702
  proof (rule ccontr)
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3703
    fix n assume "infinite {x. ?M / Suc n < ?m x}" (is "infinite ?X")
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3704
    then obtain X where "finite X" "card X = Suc (Suc n)" "X \<subseteq> ?X"
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3705
      by (metis infinite_arbitrarily_large)
76832
ab08604729a2 A further round of proof consolidation
paulson <lp15@cam.ac.uk>
parents: 76822
diff changeset
  3706
    then have *: "\<And>x. x \<in> X \<Longrightarrow> ?M / Suc n \<le> ?m x"
63626
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3707
      by auto
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3708
    { fix x assume "x \<in> X"
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3709
      from \<open>?M \<noteq> 0\<close> *[OF this] have "?m x \<noteq> 0" by (auto simp: field_simps measure_le_0_iff)
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3710
      then have "{x} \<in> sets M" by (auto dest: measure_notin_sets) }
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3711
    note singleton_sets = this
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3712
    have "?M < (\<Sum>x\<in>X. ?M / Suc n)"
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3713
      using \<open>?M \<noteq> 0\<close>
63658
7faa9bf9860b epheremal interpretation keeps auxiliary definition localized
haftmann
parents: 63657
diff changeset
  3714
      by (simp add: \<open>card X = Suc (Suc n)\<close> field_simps less_le)
63626
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3715
    also have "\<dots> \<le> (\<Sum>x\<in>X. ?m x)"
64267
b9a1486e79be setsum -> sum
nipkow
parents: 64008
diff changeset
  3716
      by (rule sum_mono) fact
63626
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3717
    also have "\<dots> = measure M (\<Union>x\<in>X. {x})"
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3718
      using singleton_sets \<open>finite X\<close>
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3719
      by (intro finite_measure_finite_Union[symmetric]) (auto simp: disjoint_family_on_def)
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3720
    finally have "?M < measure M (\<Union>x\<in>X. {x})" .
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3721
    moreover have "measure M (\<Union>x\<in>X. {x}) \<le> ?M"
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3722
      using singleton_sets[THEN sets.sets_into_space] by (intro finite_measure_mono) auto
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3723
    ultimately show False by simp
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3724
  qed
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3725
  show ?thesis
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3726
    unfolding * by (intro countable_UN countableI_type countable_finite[OF **])
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3727
qed
44ce6b524ff3 move measure theory from HOL-Probability to HOL-Multivariate_Analysis
hoelzl
parents: 63540
diff changeset
  3728
60772
a0cfa9050fa8 Measures form a CCPO
hoelzl
parents: 60727
diff changeset
  3729
end