src/HOL/Probability/Product_Measure.thy
author hoelzl
Tue, 16 Mar 2010 16:27:28 +0100
changeset 35833 7b7ae5aa396d
child 35977 30d42bfd0174
permissions -rw-r--r--
Added product measure space
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35833
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
     1
theory Product_Measure
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
     2
imports "~~/src/HOL/Probability/Lebesgue"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
     3
begin
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
     4
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
     5
definition
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
     6
  "prod_measure M M' = (\<lambda>a. measure_space.integral M (\<lambda>s0. measure M' ((\<lambda>s1. (s0, s1)) -` a)))"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
     7
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
     8
definition
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
     9
  "prod_measure_space M M' \<equiv>
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    10
    \<lparr> space = space M \<times> space M',
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    11
      sets = sets (sigma (space M \<times> space M') (prod_sets (sets M) (sets M'))),
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    12
      measure = prod_measure M M' \<rparr>"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    13
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    14
lemma prod_measure_times:
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    15
  assumes "measure_space M" and "measure_space M'" and a: "a \<in> sets M"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    16
  shows "prod_measure M M' (a \<times> a') = measure M a * measure M' a'"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    17
proof -
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    18
  interpret M: measure_space M by fact
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    19
  interpret M': measure_space M' by fact
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    20
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    21
  { fix \<omega>
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    22
    have "(\<lambda>\<omega>'. (\<omega>, \<omega>')) -` (a \<times> a') = (if \<omega> \<in> a then a' else {})"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    23
      by auto
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    24
    hence "measure M' ((\<lambda>\<omega>'. (\<omega>, \<omega>')) -` (a \<times> a')) =
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    25
      measure M' a' * indicator_fn a \<omega>"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    26
      unfolding indicator_fn_def by auto }
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    27
  note vimage_eq_indicator = this
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    28
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    29
  show ?thesis
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    30
    unfolding prod_measure_def vimage_eq_indicator
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    31
      M.integral_cmul_indicator(1)[OF `a \<in> sets M`]
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    32
    by simp
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    33
qed
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    34
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    35
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    36
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    37
lemma measure_space_finite_prod_measure:
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    38
  fixes M :: "('a, 'b) measure_space_scheme"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    39
    and M' :: "('c, 'd) measure_space_scheme"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    40
  assumes "measure_space M" and "measure_space M'"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    41
  and finM: "finite (space M)" "Pow (space M) = sets M"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    42
  and finM': "finite (space M')" "Pow (space M') = sets M'"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    43
  shows "measure_space (prod_measure_space M M')"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    44
proof (rule finite_additivity_sufficient)
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    45
  interpret M: measure_space M by fact
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    46
  interpret M': measure_space M' by fact
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    47
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    48
  have measure: "measure_space.measure (prod_measure_space M M') = prod_measure M M'"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    49
    unfolding prod_measure_space_def by simp
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    50
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    51
  have prod_sets: "prod_sets (sets M) (sets M') \<subseteq> Pow (space M \<times> space M')"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    52
    using M.sets_into_space M'.sets_into_space unfolding prod_sets_def by auto
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    53
  show sigma: "sigma_algebra (prod_measure_space M M')" unfolding prod_measure_space_def
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    54
    by (rule sigma_algebra_sigma_sets[where a="prod_sets (sets M) (sets M')"])
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    55
       (simp_all add: sigma_def prod_sets)
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    56
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    57
  then interpret sa: sigma_algebra "prod_measure_space M M'" .
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    58
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    59
  { fix x y assume "y \<in> sets (prod_measure_space M M')" and "x \<in> space M"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    60
    hence "y \<subseteq> space M \<times> space M'"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    61
      using sa.sets_into_space unfolding prod_measure_space_def by simp
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    62
    hence "Pair x -` y \<in> sets M'"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    63
      using `x \<in> space M` unfolding finM'(2)[symmetric] by auto }
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    64
  note Pair_in_sets = this
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    65
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    66
  show "additive (prod_measure_space M M') (measure (prod_measure_space M M'))"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    67
    unfolding measure additive_def
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    68
  proof safe
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    69
    fix x y assume x: "x \<in> sets (prod_measure_space M M')" and y: "y \<in> sets (prod_measure_space M M')"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    70
      and disj_x_y: "x \<inter> y = {}"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    71
    { fix z have "Pair z -` x \<inter> Pair z -` y = {}" using disj_x_y by auto }
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    72
    note Pair_disj = this
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    73
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    74
    from M'.measure_additive[OF Pair_in_sets[OF x] Pair_in_sets[OF y] Pair_disj, symmetric]
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    75
    show "prod_measure M M' (x \<union> y) = prod_measure M M' x + prod_measure M M' y"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    76
      unfolding prod_measure_def
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    77
      apply (subst (1 2 3) M.integral_finite_singleton[OF finM])
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    78
      by (simp_all add: setsum_addf[symmetric] field_simps)
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    79
  qed
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    80
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    81
  show "finite (space (prod_measure_space M M'))"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    82
    unfolding prod_measure_space_def using finM finM' by simp
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    83
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    84
  have singletonM: "\<And>x. x \<in> space M \<Longrightarrow> {x} \<in> sets M"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    85
    unfolding finM(2)[symmetric] by simp
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    86
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    87
  show "positive (prod_measure_space M M') (measure (prod_measure_space M M'))"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    88
    unfolding positive_def
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    89
  proof (safe, simp add: M.integral_zero prod_measure_space_def prod_measure_def)
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    90
    fix Q assume "Q \<in> sets (prod_measure_space M M')"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    91
    from Pair_in_sets[OF this]
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    92
    show "0 \<le> measure (prod_measure_space M M') Q"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    93
      unfolding prod_measure_space_def prod_measure_def
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    94
      apply (subst M.integral_finite_singleton[OF finM])
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    95
      using M.positive M'.positive singletonM
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    96
      by (auto intro!: setsum_nonneg mult_nonneg_nonneg)
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    97
  qed
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    98
qed
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    99
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   100
lemma measure_space_finite_prod_measure_alterantive:
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   101
  assumes "measure_space M" and "measure_space M'"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   102
  and finM: "finite (space M)" "Pow (space M) = sets M"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   103
  and finM': "finite (space M')" "Pow (space M') = sets M'"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   104
  shows "measure_space \<lparr> space = space M \<times> space M',
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   105
                         sets = Pow (space M \<times> space M'),
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   106
		         measure = prod_measure M M' \<rparr>"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   107
  (is "measure_space ?space")
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   108
proof (rule finite_additivity_sufficient)
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   109
  interpret M: measure_space M by fact
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   110
  interpret M': measure_space M' by fact
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   111
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   112
  show "sigma_algebra ?space"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   113
    using sigma_algebra.sigma_algebra_extend[where M="\<lparr> space = space M \<times> space M', sets = Pow (space M \<times> space M') \<rparr>"]
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   114
    by (auto intro!: sigma_algebra_Pow)
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   115
  then interpret sa: sigma_algebra ?space .
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   116
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   117
  have measure: "measure_space.measure (prod_measure_space M M') = prod_measure M M'"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   118
    unfolding prod_measure_space_def by simp
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   119
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   120
  { fix x y assume "y \<in> sets ?space" and "x \<in> space M"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   121
    hence "y \<subseteq> space M \<times> space M'"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   122
      using sa.sets_into_space by simp
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   123
    hence "Pair x -` y \<in> sets M'"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   124
      using `x \<in> space M` unfolding finM'(2)[symmetric] by auto }
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   125
  note Pair_in_sets = this
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   126
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   127
  show "additive ?space (measure ?space)"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   128
    unfolding measure additive_def
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   129
  proof safe
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   130
    fix x y assume x: "x \<in> sets ?space" and y: "y \<in> sets ?space"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   131
      and disj_x_y: "x \<inter> y = {}"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   132
    { fix z have "Pair z -` x \<inter> Pair z -` y = {}" using disj_x_y by auto }
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   133
    note Pair_disj = this
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   134
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   135
    from M'.measure_additive[OF Pair_in_sets[OF x] Pair_in_sets[OF y] Pair_disj, symmetric]
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   136
    show "measure ?space (x \<union> y) = measure ?space x + measure ?space y"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   137
      apply (simp add: prod_measure_def)
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   138
      apply (subst (1 2 3) M.integral_finite_singleton[OF finM])
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   139
      by (simp_all add: setsum_addf[symmetric] field_simps)
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   140
  qed
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   141
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   142
  show "finite (space ?space)" using finM finM' by simp
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   143
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   144
  have singletonM: "\<And>x. x \<in> space M \<Longrightarrow> {x} \<in> sets M"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   145
    unfolding finM(2)[symmetric] by simp
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   146
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   147
  show "positive ?space (measure ?space)"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   148
    unfolding positive_def
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   149
  proof (safe, simp add: M.integral_zero prod_measure_def)
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   150
    fix Q assume "Q \<in> sets ?space"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   151
    from Pair_in_sets[OF this]
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   152
    show "0 \<le> measure ?space Q"
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   153
      unfolding prod_measure_space_def prod_measure_def
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   154
      apply (subst M.integral_finite_singleton[OF finM])
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   155
      using M.positive M'.positive singletonM
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   156
      by (auto intro!: setsum_nonneg mult_nonneg_nonneg)
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   157
  qed
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   158
qed
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   159
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   160
end