src/HOL/Probability/Binary_Product_Measure.thy
author Andreas Lochbihler
Tue, 10 Feb 2015 12:17:22 +0100
changeset 59491 40f570f9a284
parent 59489 fd5d23cc0e97
child 60066 14efa7f4ee7b
permissions -rw-r--r--
add another lemma to split nn_integral over product count_space
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42146
5b52c6a9c627 split Product_Measure into Binary_Product_Measure and Finite_Product_Measure
hoelzl
parents: 42067
diff changeset
     1
(*  Title:      HOL/Probability/Binary_Product_Measure.thy
42067
66c8281349ec standardized headers
hoelzl
parents: 41981
diff changeset
     2
    Author:     Johannes Hölzl, TU München
66c8281349ec standardized headers
hoelzl
parents: 41981
diff changeset
     3
*)
66c8281349ec standardized headers
hoelzl
parents: 41981
diff changeset
     4
58876
1888e3cb8048 modernized header;
wenzelm
parents: 58606
diff changeset
     5
section {*Binary product measures*}
42067
66c8281349ec standardized headers
hoelzl
parents: 41981
diff changeset
     6
42146
5b52c6a9c627 split Product_Measure into Binary_Product_Measure and Finite_Product_Measure
hoelzl
parents: 42067
diff changeset
     7
theory Binary_Product_Measure
56993
e5366291d6aa introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents: 54863
diff changeset
     8
imports Nonnegative_Lebesgue_Integration
35833
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
     9
begin
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
    10
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
    11
lemma Pair_vimage_times[simp]: "Pair x -` (A \<times> B) = (if x \<in> A then B else {})"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
    12
  by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
    13
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
    14
lemma rev_Pair_vimage_times[simp]: "(\<lambda>x. (x, y)) -` (A \<times> B) = (if y \<in> B then A else {})"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
    15
  by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
    16
56994
8d5e5ec1cac3 fixed document generation for HOL-Probability
hoelzl
parents: 56993
diff changeset
    17
subsection "Binary products"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
    18
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
    19
definition pair_measure (infixr "\<Otimes>\<^sub>M" 80) where
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
    20
  "A \<Otimes>\<^sub>M B = measure_of (space A \<times> space B)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
    21
      {a \<times> b | a b. a \<in> sets A \<and> b \<in> sets B}
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
    22
      (\<lambda>X. \<integral>\<^sup>+x. (\<integral>\<^sup>+y. indicator X (x,y) \<partial>B) \<partial>A)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
    23
49789
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
    24
lemma pair_measure_closed: "{a \<times> b | a b. a \<in> sets A \<and> b \<in> sets B} \<subseteq> Pow (space A \<times> space B)"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
    25
  using sets.space_closed[of A] sets.space_closed[of B] by auto
49789
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
    26
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
    27
lemma space_pair_measure:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
    28
  "space (A \<Otimes>\<^sub>M B) = space A \<times> space B"
49789
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
    29
  unfolding pair_measure_def using pair_measure_closed[of A B]
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
    30
  by (rule space_measure_of)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
    31
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
    32
lemma SIGMA_Collect_eq: "(SIGMA x:space M. {y\<in>space N. P x y}) = {x\<in>space (M \<Otimes>\<^sub>M N). P (fst x) (snd x)}"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
    33
  by (auto simp: space_pair_measure)
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
    34
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
    35
lemma sets_pair_measure:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
    36
  "sets (A \<Otimes>\<^sub>M B) = sigma_sets (space A \<times> space B) {a \<times> b | a b. a \<in> sets A \<and> b \<in> sets B}"
49789
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
    37
  unfolding pair_measure_def using pair_measure_closed[of A B]
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
    38
  by (rule sets_measure_of)
41095
c335d880ff82 cleanup bijectivity btw. product spaces and pairs
hoelzl
parents: 41026
diff changeset
    39
58606
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
    40
lemma sets_pair_in_sets:
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
    41
  assumes N: "space A \<times> space B = space N"
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
    42
  assumes "\<And>a b. a \<in> sets A \<Longrightarrow> b \<in> sets B \<Longrightarrow> a \<times> b \<in> sets N"
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
    43
  shows "sets (A \<Otimes>\<^sub>M B) \<subseteq> sets N"
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
    44
  using assms by (auto intro!: sets.sigma_sets_subset simp: sets_pair_measure N)
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
    45
59048
7dc8ac6f0895 add congruence solver to measurability prover
hoelzl
parents: 59000
diff changeset
    46
lemma sets_pair_measure_cong[measurable_cong, cong]:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
    47
  "sets M1 = sets M1' \<Longrightarrow> sets M2 = sets M2' \<Longrightarrow> sets (M1 \<Otimes>\<^sub>M M2) = sets (M1' \<Otimes>\<^sub>M M2')"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
    48
  unfolding sets_pair_measure by (simp cong: sets_eq_imp_space_eq)
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
    49
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
    50
lemma pair_measureI[intro, simp, measurable]:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
    51
  "x \<in> sets A \<Longrightarrow> y \<in> sets B \<Longrightarrow> x \<times> y \<in> sets (A \<Otimes>\<^sub>M B)"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
    52
  by (auto simp: sets_pair_measure)
41095
c335d880ff82 cleanup bijectivity btw. product spaces and pairs
hoelzl
parents: 41026
diff changeset
    53
58606
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
    54
lemma sets_Pair: "{x} \<in> sets M1 \<Longrightarrow> {y} \<in> sets M2 \<Longrightarrow> {(x, y)} \<in> sets (M1 \<Otimes>\<^sub>M M2)"
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
    55
  using pair_measureI[of "{x}" M1 "{y}" M2] by simp
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
    56
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
    57
lemma measurable_pair_measureI:
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
    58
  assumes 1: "f \<in> space M \<rightarrow> space M1 \<times> space M2"
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
    59
  assumes 2: "\<And>A B. A \<in> sets M1 \<Longrightarrow> B \<in> sets M2 \<Longrightarrow> f -` (A \<times> B) \<inter> space M \<in> sets M"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
    60
  shows "f \<in> measurable M (M1 \<Otimes>\<^sub>M M2)"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
    61
  unfolding pair_measure_def using 1 2
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
    62
  by (intro measurable_measure_of) (auto dest: sets.sets_into_space)
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
    63
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
    64
lemma measurable_split_replace[measurable (raw)]:
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
    65
  "(\<lambda>x. f x (fst (g x)) (snd (g x))) \<in> measurable M N \<Longrightarrow> (\<lambda>x. split (f x) (g x)) \<in> measurable M N"
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
    66
  unfolding split_beta' .
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
    67
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
    68
lemma measurable_Pair[measurable (raw)]:
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
    69
  assumes f: "f \<in> measurable M M1" and g: "g \<in> measurable M M2"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
    70
  shows "(\<lambda>x. (f x, g x)) \<in> measurable M (M1 \<Otimes>\<^sub>M M2)"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
    71
proof (rule measurable_pair_measureI)
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
    72
  show "(\<lambda>x. (f x, g x)) \<in> space M \<rightarrow> space M1 \<times> space M2"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
    73
    using f g by (auto simp: measurable_def)
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
    74
  fix A B assume *: "A \<in> sets M1" "B \<in> sets M2"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
    75
  have "(\<lambda>x. (f x, g x)) -` (A \<times> B) \<inter> space M = (f -` A \<inter> space M) \<inter> (g -` B \<inter> space M)"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
    76
    by auto
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
    77
  also have "\<dots> \<in> sets M"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
    78
    by (rule sets.Int) (auto intro!: measurable_sets * f g)
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
    79
  finally show "(\<lambda>x. (f x, g x)) -` (A \<times> B) \<inter> space M \<in> sets M" .
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
    80
qed
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
    81
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
    82
lemma measurable_fst[intro!, simp, measurable]: "fst \<in> measurable (M1 \<Otimes>\<^sub>M M2) M1"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
    83
  by (auto simp: fst_vimage_eq_Times space_pair_measure sets.sets_into_space times_Int_times
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
    84
    measurable_def)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
    85
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
    86
lemma measurable_snd[intro!, simp, measurable]: "snd \<in> measurable (M1 \<Otimes>\<^sub>M M2) M2"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
    87
  by (auto simp: snd_vimage_eq_Times space_pair_measure sets.sets_into_space times_Int_times
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
    88
    measurable_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
    89
59353
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
    90
lemma measurable_Pair_compose_split[measurable_dest]:
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
    91
  assumes f: "split f \<in> measurable (M1 \<Otimes>\<^sub>M M2) N"
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
    92
  assumes g: "g \<in> measurable M M1" and h: "h \<in> measurable M M2"
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
    93
  shows "(\<lambda>x. f (g x) (h x)) \<in> measurable M N"
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
    94
  using measurable_compose[OF measurable_Pair f, OF g h] by simp
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
    95
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
    96
lemma measurable_Pair1_compose[measurable_dest]:
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
    97
  assumes f: "(\<lambda>x. (f x, g x)) \<in> measurable M (M1 \<Otimes>\<^sub>M M2)"
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
    98
  assumes [measurable]: "h \<in> measurable N M"
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
    99
  shows "(\<lambda>x. f (h x)) \<in> measurable N M1"
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
   100
  using measurable_compose[OF f measurable_fst] by simp
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
   101
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
   102
lemma measurable_Pair2_compose[measurable_dest]:
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
   103
  assumes f: "(\<lambda>x. (f x, g x)) \<in> measurable M (M1 \<Otimes>\<^sub>M M2)"
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
   104
  assumes [measurable]: "h \<in> measurable N M"
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
   105
  shows "(\<lambda>x. g (h x)) \<in> measurable N M2"
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
   106
  using measurable_compose[OF f measurable_snd] by simp
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
   107
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
   108
lemma measurable_pair:
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
   109
  assumes "(fst \<circ> f) \<in> measurable M M1" "(snd \<circ> f) \<in> measurable M M2"
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
   110
  shows "f \<in> measurable M (M1 \<Otimes>\<^sub>M M2)"
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
   111
  using measurable_Pair[OF assms] by simp
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
   112
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   113
lemma 
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   114
  assumes f[measurable]: "f \<in> measurable M (N \<Otimes>\<^sub>M P)" 
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   115
  shows measurable_fst': "(\<lambda>x. fst (f x)) \<in> measurable M N"
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   116
    and measurable_snd': "(\<lambda>x. snd (f x)) \<in> measurable M P"
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   117
  by simp_all
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   118
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   119
lemma
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   120
  assumes f[measurable]: "f \<in> measurable M N"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   121
  shows measurable_fst'': "(\<lambda>x. f (fst x)) \<in> measurable (M \<Otimes>\<^sub>M P) N"
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   122
    and measurable_snd'': "(\<lambda>x. f (snd x)) \<in> measurable (P \<Otimes>\<^sub>M M) N"
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   123
  by simp_all
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   124
58606
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
   125
lemma sets_pair_eq_sets_fst_snd:
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
   126
  "sets (A \<Otimes>\<^sub>M B) = sets (Sup_sigma {vimage_algebra (space A \<times> space B) fst A, vimage_algebra (space A \<times> space B) snd B})"
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
   127
    (is "?P = sets (Sup_sigma {?fst, ?snd})")
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
   128
proof -
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
   129
  { fix a b assume ab: "a \<in> sets A" "b \<in> sets B"
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
   130
    then have "a \<times> b = (fst -` a \<inter> (space A \<times> space B)) \<inter> (snd -` b \<inter> (space A \<times> space B))"
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
   131
      by (auto dest: sets.sets_into_space)
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
   132
    also have "\<dots> \<in> sets (Sup_sigma {?fst, ?snd})"
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
   133
      using ab by (auto intro: in_Sup_sigma in_vimage_algebra)
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
   134
    finally have "a \<times> b \<in> sets (Sup_sigma {?fst, ?snd})" . }
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
   135
  moreover have "sets ?fst \<subseteq> sets (A \<Otimes>\<^sub>M B)"
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
   136
    by (rule sets_image_in_sets) (auto simp: space_pair_measure[symmetric])
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
   137
  moreover have "sets ?snd \<subseteq> sets (A \<Otimes>\<^sub>M B)"  
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
   138
    by (rule sets_image_in_sets) (auto simp: space_pair_measure)
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
   139
  ultimately show ?thesis
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
   140
    by (intro antisym[of "sets A" for A] sets_Sup_in_sets sets_pair_in_sets )
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
   141
       (auto simp add: space_Sup_sigma space_pair_measure)
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
   142
qed
9c66f7c541fb add Giry monad
hoelzl
parents: 57447
diff changeset
   143
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   144
lemma measurable_pair_iff:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   145
  "f \<in> measurable M (M1 \<Otimes>\<^sub>M M2) \<longleftrightarrow> (fst \<circ> f) \<in> measurable M M1 \<and> (snd \<circ> f) \<in> measurable M M2"
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   146
  by (auto intro: measurable_pair[of f M M1 M2]) 
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   147
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   148
lemma measurable_split_conv:
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   149
  "(\<lambda>(x, y). f x y) \<in> measurable A B \<longleftrightarrow> (\<lambda>x. f (fst x) (snd x)) \<in> measurable A B"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   150
  by (intro arg_cong2[where f="op \<in>"]) auto
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   151
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   152
lemma measurable_pair_swap': "(\<lambda>(x,y). (y, x)) \<in> measurable (M1 \<Otimes>\<^sub>M M2) (M2 \<Otimes>\<^sub>M M1)"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   153
  by (auto intro!: measurable_Pair simp: measurable_split_conv)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   154
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   155
lemma measurable_pair_swap:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   156
  assumes f: "f \<in> measurable (M1 \<Otimes>\<^sub>M M2) M" shows "(\<lambda>(x,y). f (y, x)) \<in> measurable (M2 \<Otimes>\<^sub>M M1) M"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   157
  using measurable_comp[OF measurable_Pair f] by (auto simp: measurable_split_conv comp_def)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   158
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   159
lemma measurable_pair_swap_iff:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   160
  "f \<in> measurable (M2 \<Otimes>\<^sub>M M1) M \<longleftrightarrow> (\<lambda>(x,y). f (y,x)) \<in> measurable (M1 \<Otimes>\<^sub>M M2) M"
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   161
  by (auto dest: measurable_pair_swap)
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   162
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   163
lemma measurable_Pair1': "x \<in> space M1 \<Longrightarrow> Pair x \<in> measurable M2 (M1 \<Otimes>\<^sub>M M2)"
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   164
  by simp
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   165
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   166
lemma sets_Pair1[measurable (raw)]:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   167
  assumes A: "A \<in> sets (M1 \<Otimes>\<^sub>M M2)" shows "Pair x -` A \<in> sets M2"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   168
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   169
  have "Pair x -` A = (if x \<in> space M1 then Pair x -` A \<inter> space M2 else {})"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   170
    using A[THEN sets.sets_into_space] by (auto simp: space_pair_measure)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   171
  also have "\<dots> \<in> sets M2"
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   172
    using A by (auto simp add: measurable_Pair1' intro!: measurable_sets split: split_if_asm)
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   173
  finally show ?thesis .
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   174
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   175
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   176
lemma measurable_Pair2': "y \<in> space M2 \<Longrightarrow> (\<lambda>x. (x, y)) \<in> measurable M1 (M1 \<Otimes>\<^sub>M M2)"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   177
  by (auto intro!: measurable_Pair)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   178
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   179
lemma sets_Pair2: assumes A: "A \<in> sets (M1 \<Otimes>\<^sub>M M2)" shows "(\<lambda>x. (x, y)) -` A \<in> sets M1"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   180
proof -
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   181
  have "(\<lambda>x. (x, y)) -` A = (if y \<in> space M2 then (\<lambda>x. (x, y)) -` A \<inter> space M1 else {})"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   182
    using A[THEN sets.sets_into_space] by (auto simp: space_pair_measure)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   183
  also have "\<dots> \<in> sets M1"
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   184
    using A by (auto simp add: measurable_Pair2' intro!: measurable_sets split: split_if_asm)
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   185
  finally show ?thesis .
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   186
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   187
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   188
lemma measurable_Pair2:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   189
  assumes f: "f \<in> measurable (M1 \<Otimes>\<^sub>M M2) M" and x: "x \<in> space M1"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   190
  shows "(\<lambda>y. f (x, y)) \<in> measurable M2 M"
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   191
  using measurable_comp[OF measurable_Pair1' f, OF x]
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   192
  by (simp add: comp_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   193
  
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   194
lemma measurable_Pair1:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   195
  assumes f: "f \<in> measurable (M1 \<Otimes>\<^sub>M M2) M" and y: "y \<in> space M2"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   196
  shows "(\<lambda>x. f (x, y)) \<in> measurable M1 M"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   197
  using measurable_comp[OF measurable_Pair2' f, OF y]
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   198
  by (simp add: comp_def)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   199
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   200
lemma Int_stable_pair_measure_generator: "Int_stable {a \<times> b | a b. a \<in> sets A \<and> b \<in> sets B}"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   201
  unfolding Int_stable_def
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   202
  by safe (auto simp add: times_Int_times)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   203
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   204
lemma disjoint_family_vimageI: "disjoint_family F \<Longrightarrow> disjoint_family (\<lambda>i. f -` F i)"
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   205
  by (auto simp: disjoint_family_on_def)
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   206
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   207
lemma (in finite_measure) finite_measure_cut_measurable:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   208
  assumes [measurable]: "Q \<in> sets (N \<Otimes>\<^sub>M M)"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   209
  shows "(\<lambda>x. emeasure M (Pair x -` Q)) \<in> borel_measurable N"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   210
    (is "?s Q \<in> _")
49789
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   211
  using Int_stable_pair_measure_generator pair_measure_closed assms
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   212
  unfolding sets_pair_measure
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   213
proof (induct rule: sigma_sets_induct_disjoint)
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   214
  case (compl A)
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   215
  with sets.sets_into_space have "\<And>x. emeasure M (Pair x -` ((space N \<times> space M) - A)) =
49789
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   216
      (if x \<in> space N then emeasure M (space M) - ?s A x else 0)"
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   217
    unfolding sets_pair_measure[symmetric]
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   218
    by (auto intro!: emeasure_compl simp: vimage_Diff sets_Pair1)
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   219
  with compl sets.top show ?case
49789
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   220
    by (auto intro!: measurable_If simp: space_pair_measure)
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   221
next
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   222
  case (union F)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
   223
  then have "\<And>x. emeasure M (Pair x -` (\<Union>i. F i)) = (\<Sum>i. ?s (F i) x)"
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   224
    by (simp add: suminf_emeasure disjoint_family_vimageI subset_eq vimage_UN sets_pair_measure[symmetric])
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
   225
  with union show ?case
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   226
    unfolding sets_pair_measure[symmetric] by simp
49789
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49784
diff changeset
   227
qed (auto simp add: if_distrib Int_def[symmetric] intro!: measurable_If)
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   228
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   229
lemma (in sigma_finite_measure) measurable_emeasure_Pair:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   230
  assumes Q: "Q \<in> sets (N \<Otimes>\<^sub>M M)" shows "(\<lambda>x. emeasure M (Pair x -` Q)) \<in> borel_measurable N" (is "?s Q \<in> _")
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   231
proof -
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   232
  from sigma_finite_disjoint guess F . note F = this
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   233
  then have F_sets: "\<And>i. F i \<in> sets M" by auto
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   234
  let ?C = "\<lambda>x i. F i \<inter> Pair x -` Q"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   235
  { fix i
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   236
    have [simp]: "space N \<times> F i \<inter> space N \<times> space M = space N \<times> F i"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   237
      using F sets.sets_into_space by auto
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   238
    let ?R = "density M (indicator (F i))"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   239
    have "finite_measure ?R"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   240
      using F by (intro finite_measureI) (auto simp: emeasure_restricted subset_eq)
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   241
    then have "(\<lambda>x. emeasure ?R (Pair x -` (space N \<times> space ?R \<inter> Q))) \<in> borel_measurable N"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   242
     by (rule finite_measure.finite_measure_cut_measurable) (auto intro: Q)
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   243
    moreover have "\<And>x. emeasure ?R (Pair x -` (space N \<times> space ?R \<inter> Q))
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   244
        = emeasure M (F i \<inter> Pair x -` (space N \<times> space ?R \<inter> Q))"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   245
      using Q F_sets by (intro emeasure_restricted) (auto intro: sets_Pair1)
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   246
    moreover have "\<And>x. F i \<inter> Pair x -` (space N \<times> space ?R \<inter> Q) = ?C x i"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   247
      using sets.sets_into_space[OF Q] by (auto simp: space_pair_measure)
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   248
    ultimately have "(\<lambda>x. emeasure M (?C x i)) \<in> borel_measurable N"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   249
      by simp }
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   250
  moreover
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   251
  { fix x
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   252
    have "(\<Sum>i. emeasure M (?C x i)) = emeasure M (\<Union>i. ?C x i)"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   253
    proof (intro suminf_emeasure)
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   254
      show "range (?C x) \<subseteq> sets M"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   255
        using F `Q \<in> sets (N \<Otimes>\<^sub>M M)` by (auto intro!: sets_Pair1)
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   256
      have "disjoint_family F" using F by auto
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   257
      show "disjoint_family (?C x)"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   258
        by (rule disjoint_family_on_bisimulation[OF `disjoint_family F`]) auto
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   259
    qed
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   260
    also have "(\<Union>i. ?C x i) = Pair x -` Q"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   261
      using F sets.sets_into_space[OF `Q \<in> sets (N \<Otimes>\<^sub>M M)`]
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   262
      by (auto simp: space_pair_measure)
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   263
    finally have "emeasure M (Pair x -` Q) = (\<Sum>i. emeasure M (?C x i))"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   264
      by simp }
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   265
  ultimately show ?thesis using `Q \<in> sets (N \<Otimes>\<^sub>M M)` F_sets
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   266
    by auto
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   267
qed
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   268
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   269
lemma (in sigma_finite_measure) measurable_emeasure[measurable (raw)]:
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   270
  assumes space: "\<And>x. x \<in> space N \<Longrightarrow> A x \<subseteq> space M"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   271
  assumes A: "{x\<in>space (N \<Otimes>\<^sub>M M). snd x \<in> A (fst x)} \<in> sets (N \<Otimes>\<^sub>M M)"
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   272
  shows "(\<lambda>x. emeasure M (A x)) \<in> borel_measurable N"
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   273
proof -
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   274
  from space have "\<And>x. x \<in> space N \<Longrightarrow> Pair x -` {x \<in> space (N \<Otimes>\<^sub>M M). snd x \<in> A (fst x)} = A x"
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   275
    by (auto simp: space_pair_measure)
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   276
  with measurable_emeasure_Pair[OF A] show ?thesis
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   277
    by (auto cong: measurable_cong)
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   278
qed
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   279
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   280
lemma (in sigma_finite_measure) emeasure_pair_measure:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   281
  assumes "X \<in> sets (N \<Otimes>\<^sub>M M)"
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   282
  shows "emeasure (N \<Otimes>\<^sub>M M) X = (\<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator X (x, y) \<partial>M \<partial>N)" (is "_ = ?\<mu> X")
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   283
proof (rule emeasure_measure_of[OF pair_measure_def])
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   284
  show "positive (sets (N \<Otimes>\<^sub>M M)) ?\<mu>"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   285
    by (auto simp: positive_def nn_integral_nonneg)
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   286
  have eq[simp]: "\<And>A x y. indicator A (x, y) = indicator (Pair x -` A) y"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   287
    by (auto simp: indicator_def)
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   288
  show "countably_additive (sets (N \<Otimes>\<^sub>M M)) ?\<mu>"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   289
  proof (rule countably_additiveI)
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   290
    fix F :: "nat \<Rightarrow> ('b \<times> 'a) set" assume F: "range F \<subseteq> sets (N \<Otimes>\<^sub>M M)" "disjoint_family F"
59353
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
   291
    from F have *: "\<And>i. F i \<in> sets (N \<Otimes>\<^sub>M M)" by auto
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   292
    moreover have "\<And>x. disjoint_family (\<lambda>i. Pair x -` F i)"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   293
      by (intro disjoint_family_on_bisimulation[OF F(2)]) auto
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   294
    moreover have "\<And>x. range (\<lambda>i. Pair x -` F i) \<subseteq> sets M"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   295
      using F by (auto simp: sets_Pair1)
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   296
    ultimately show "(\<Sum>n. ?\<mu> (F n)) = ?\<mu> (\<Union>i. F i)"
59353
f0707dc3d9aa measurability prover: removed app splitting, replaced by more powerful destruction rules
hoelzl
parents: 59088
diff changeset
   297
      by (auto simp add: nn_integral_suminf[symmetric] vimage_UN suminf_emeasure emeasure_nonneg
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   298
               intro!: nn_integral_cong nn_integral_indicator[symmetric])
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   299
  qed
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   300
  show "{a \<times> b |a b. a \<in> sets N \<and> b \<in> sets M} \<subseteq> Pow (space N \<times> space M)"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   301
    using sets.space_closed[of N] sets.space_closed[of M] by auto
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   302
qed fact
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   303
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   304
lemma (in sigma_finite_measure) emeasure_pair_measure_alt:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   305
  assumes X: "X \<in> sets (N \<Otimes>\<^sub>M M)"
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   306
  shows "emeasure (N  \<Otimes>\<^sub>M M) X = (\<integral>\<^sup>+x. emeasure M (Pair x -` X) \<partial>N)"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   307
proof -
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   308
  have [simp]: "\<And>x y. indicator X (x, y) = indicator (Pair x -` X) y"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   309
    by (auto simp: indicator_def)
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   310
  show ?thesis
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   311
    using X by (auto intro!: nn_integral_cong simp: emeasure_pair_measure sets_Pair1)
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   312
qed
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   313
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   314
lemma (in sigma_finite_measure) emeasure_pair_measure_Times:
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   315
  assumes A: "A \<in> sets N" and B: "B \<in> sets M"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   316
  shows "emeasure (N \<Otimes>\<^sub>M M) (A \<times> B) = emeasure N A * emeasure M B"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   317
proof -
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   318
  have "emeasure (N \<Otimes>\<^sub>M M) (A \<times> B) = (\<integral>\<^sup>+x. emeasure M B * indicator A x \<partial>N)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   319
    using A B by (auto intro!: nn_integral_cong simp: emeasure_pair_measure_alt)
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   320
  also have "\<dots> = emeasure M B * emeasure N A"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   321
    using A by (simp add: emeasure_nonneg nn_integral_cmult_indicator)
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   322
  finally show ?thesis
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   323
    by (simp add: ac_simps)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   324
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   325
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   326
subsection {* Binary products of $\sigma$-finite emeasure spaces *}
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   327
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   328
locale pair_sigma_finite = M1: sigma_finite_measure M1 + M2: sigma_finite_measure M2
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   329
  for M1 :: "'a measure" and M2 :: "'b measure"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   330
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   331
lemma (in pair_sigma_finite) measurable_emeasure_Pair1:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   332
  "Q \<in> sets (M1 \<Otimes>\<^sub>M M2) \<Longrightarrow> (\<lambda>x. emeasure M2 (Pair x -` Q)) \<in> borel_measurable M1"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   333
  using M2.measurable_emeasure_Pair .
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   334
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   335
lemma (in pair_sigma_finite) measurable_emeasure_Pair2:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   336
  assumes Q: "Q \<in> sets (M1 \<Otimes>\<^sub>M M2)" shows "(\<lambda>y. emeasure M1 ((\<lambda>x. (x, y)) -` Q)) \<in> borel_measurable M2"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   337
proof -
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   338
  have "(\<lambda>(x, y). (y, x)) -` Q \<inter> space (M2 \<Otimes>\<^sub>M M1) \<in> sets (M2 \<Otimes>\<^sub>M M1)"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   339
    using Q measurable_pair_swap' by (auto intro: measurable_sets)
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   340
  note M1.measurable_emeasure_Pair[OF this]
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   341
  moreover have "\<And>y. Pair y -` ((\<lambda>(x, y). (y, x)) -` Q \<inter> space (M2 \<Otimes>\<^sub>M M1)) = (\<lambda>x. (x, y)) -` Q"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   342
    using Q[THEN sets.sets_into_space] by (auto simp: space_pair_measure)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   343
  ultimately show ?thesis by simp
39088
ca17017c10e6 Measurable on product space is equiv. to measurable components
hoelzl
parents: 39082
diff changeset
   344
qed
ca17017c10e6 Measurable on product space is equiv. to measurable components
hoelzl
parents: 39082
diff changeset
   345
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   346
lemma (in pair_sigma_finite) sigma_finite_up_in_pair_measure_generator:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   347
  defines "E \<equiv> {A \<times> B | A B. A \<in> sets M1 \<and> B \<in> sets M2}"
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   348
  shows "\<exists>F::nat \<Rightarrow> ('a \<times> 'b) set. range F \<subseteq> E \<and> incseq F \<and> (\<Union>i. F i) = space M1 \<times> space M2 \<and>
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   349
    (\<forall>i. emeasure (M1 \<Otimes>\<^sub>M M2) (F i) \<noteq> \<infinity>)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   350
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   351
  from M1.sigma_finite_incseq guess F1 . note F1 = this
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   352
  from M2.sigma_finite_incseq guess F2 . note F2 = this
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   353
  from F1 F2 have space: "space M1 = (\<Union>i. F1 i)" "space M2 = (\<Union>i. F2 i)" by auto
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   354
  let ?F = "\<lambda>i. F1 i \<times> F2 i"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   355
  show ?thesis
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   356
  proof (intro exI[of _ ?F] conjI allI)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   357
    show "range ?F \<subseteq> E" using F1 F2 by (auto simp: E_def) (metis range_subsetD)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   358
  next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   359
    have "space M1 \<times> space M2 \<subseteq> (\<Union>i. ?F i)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   360
    proof (intro subsetI)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   361
      fix x assume "x \<in> space M1 \<times> space M2"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   362
      then obtain i j where "fst x \<in> F1 i" "snd x \<in> F2 j"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   363
        by (auto simp: space)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   364
      then have "fst x \<in> F1 (max i j)" "snd x \<in> F2 (max j i)"
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   365
        using `incseq F1` `incseq F2` unfolding incseq_def
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   366
        by (force split: split_max)+
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   367
      then have "(fst x, snd x) \<in> F1 (max i j) \<times> F2 (max i j)"
54863
82acc20ded73 prefer more canonical names for lemmas on min/max
haftmann
parents: 53374
diff changeset
   368
        by (intro SigmaI) (auto simp add: max.commute)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   369
      then show "x \<in> (\<Union>i. ?F i)" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   370
    qed
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   371
    then show "(\<Union>i. ?F i) = space M1 \<times> space M2"
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   372
      using space by (auto simp: space)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   373
  next
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   374
    fix i show "incseq (\<lambda>i. F1 i \<times> F2 i)"
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41831
diff changeset
   375
      using `incseq F1` `incseq F2` unfolding incseq_Suc_iff by auto
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   376
  next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   377
    fix i
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   378
    from F1 F2 have "F1 i \<in> sets M1" "F2 i \<in> sets M2" by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   379
    with F1 F2 emeasure_nonneg[of M1 "F1 i"] emeasure_nonneg[of M2 "F2 i"]
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   380
    show "emeasure (M1 \<Otimes>\<^sub>M M2) (F1 i \<times> F2 i) \<noteq> \<infinity>"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   381
      by (auto simp add: emeasure_pair_measure_Times)
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   382
  qed
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   383
qed
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   384
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   385
sublocale pair_sigma_finite \<subseteq> P: sigma_finite_measure "M1 \<Otimes>\<^sub>M M2"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   386
proof
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57235
diff changeset
   387
  from M1.sigma_finite_countable guess F1 ..
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57235
diff changeset
   388
  moreover from M2.sigma_finite_countable guess F2 ..
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57235
diff changeset
   389
  ultimately show
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57235
diff changeset
   390
    "\<exists>A. countable A \<and> A \<subseteq> sets (M1 \<Otimes>\<^sub>M M2) \<and> \<Union>A = space (M1 \<Otimes>\<^sub>M M2) \<and> (\<forall>a\<in>A. emeasure (M1 \<Otimes>\<^sub>M M2) a \<noteq> \<infinity>)"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57235
diff changeset
   391
    by (intro exI[of _ "(\<lambda>(a, b). a \<times> b) ` (F1 \<times> F2)"] conjI)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57235
diff changeset
   392
       (auto simp: M2.emeasure_pair_measure_Times space_pair_measure set_eq_iff subset_eq
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57235
diff changeset
   393
             dest: sets.sets_into_space)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   394
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   395
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   396
lemma sigma_finite_pair_measure:
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   397
  assumes A: "sigma_finite_measure A" and B: "sigma_finite_measure B"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   398
  shows "sigma_finite_measure (A \<Otimes>\<^sub>M B)"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   399
proof -
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   400
  interpret A: sigma_finite_measure A by fact
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   401
  interpret B: sigma_finite_measure B by fact
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   402
  interpret AB: pair_sigma_finite A  B ..
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   403
  show ?thesis ..
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   404
qed
39088
ca17017c10e6 Measurable on product space is equiv. to measurable components
hoelzl
parents: 39082
diff changeset
   405
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   406
lemma sets_pair_swap:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   407
  assumes "A \<in> sets (M1 \<Otimes>\<^sub>M M2)"
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   408
  shows "(\<lambda>(x, y). (y, x)) -` A \<inter> space (M2 \<Otimes>\<^sub>M M1) \<in> sets (M2 \<Otimes>\<^sub>M M1)"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   409
  using measurable_pair_swap' assms by (rule measurable_sets)
41661
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41659
diff changeset
   410
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   411
lemma (in pair_sigma_finite) distr_pair_swap:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   412
  "M1 \<Otimes>\<^sub>M M2 = distr (M2 \<Otimes>\<^sub>M M1) (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x, y). (y, x))" (is "?P = ?D")
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   413
proof -
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   414
  from sigma_finite_up_in_pair_measure_generator guess F :: "nat \<Rightarrow> ('a \<times> 'b) set" .. note F = this
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   415
  let ?E = "{a \<times> b |a b. a \<in> sets M1 \<and> b \<in> sets M2}"
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   416
  show ?thesis
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   417
  proof (rule measure_eqI_generator_eq[OF Int_stable_pair_measure_generator[of M1 M2]])
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   418
    show "?E \<subseteq> Pow (space ?P)"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   419
      using sets.space_closed[of M1] sets.space_closed[of M2] by (auto simp: space_pair_measure)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   420
    show "sets ?P = sigma_sets (space ?P) ?E"
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   421
      by (simp add: sets_pair_measure space_pair_measure)
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   422
    then show "sets ?D = sigma_sets (space ?P) ?E"
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   423
      by simp
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   424
  next
49784
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49776
diff changeset
   425
    show "range F \<subseteq> ?E" "(\<Union>i. F i) = space ?P" "\<And>i. emeasure ?P (F i) \<noteq> \<infinity>"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   426
      using F by (auto simp: space_pair_measure)
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   427
  next
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   428
    fix X assume "X \<in> ?E"
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   429
    then obtain A B where X[simp]: "X = A \<times> B" and A: "A \<in> sets M1" and B: "B \<in> sets M2" by auto
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   430
    have "(\<lambda>(y, x). (x, y)) -` X \<inter> space (M2 \<Otimes>\<^sub>M M1) = B \<times> A"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   431
      using sets.sets_into_space[OF A] sets.sets_into_space[OF B] by (auto simp: space_pair_measure)
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   432
    with A B show "emeasure (M1 \<Otimes>\<^sub>M M2) X = emeasure ?D X"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   433
      by (simp add: M2.emeasure_pair_measure_Times M1.emeasure_pair_measure_Times emeasure_distr
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   434
                    measurable_pair_swap' ac_simps)
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   435
  qed
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   436
qed
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   437
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   438
lemma (in pair_sigma_finite) emeasure_pair_measure_alt2:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   439
  assumes A: "A \<in> sets (M1 \<Otimes>\<^sub>M M2)"
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   440
  shows "emeasure (M1 \<Otimes>\<^sub>M M2) A = (\<integral>\<^sup>+y. emeasure M1 ((\<lambda>x. (x, y)) -` A) \<partial>M2)"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   441
    (is "_ = ?\<nu> A")
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   442
proof -
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   443
  have [simp]: "\<And>y. (Pair y -` ((\<lambda>(x, y). (y, x)) -` A \<inter> space (M2 \<Otimes>\<^sub>M M1))) = (\<lambda>x. (x, y)) -` A"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   444
    using sets.sets_into_space[OF A] by (auto simp: space_pair_measure)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   445
  show ?thesis using A
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   446
    by (subst distr_pair_swap)
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   447
       (simp_all del: vimage_Int add: measurable_sets[OF measurable_pair_swap']
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   448
                 M1.emeasure_pair_measure_alt emeasure_distr[OF measurable_pair_swap' A])
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   449
qed
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   450
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   451
lemma (in pair_sigma_finite) AE_pair:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   452
  assumes "AE x in (M1 \<Otimes>\<^sub>M M2). Q x"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   453
  shows "AE x in M1. (AE y in M2. Q (x, y))"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   454
proof -
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   455
  obtain N where N: "N \<in> sets (M1 \<Otimes>\<^sub>M M2)" "emeasure (M1 \<Otimes>\<^sub>M M2) N = 0" "{x\<in>space (M1 \<Otimes>\<^sub>M M2). \<not> Q x} \<subseteq> N"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   456
    using assms unfolding eventually_ae_filter by auto
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   457
  show ?thesis
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   458
  proof (rule AE_I)
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   459
    from N measurable_emeasure_Pair1[OF `N \<in> sets (M1 \<Otimes>\<^sub>M M2)`]
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   460
    show "emeasure M1 {x\<in>space M1. emeasure M2 (Pair x -` N) \<noteq> 0} = 0"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   461
      by (auto simp: M2.emeasure_pair_measure_alt nn_integral_0_iff emeasure_nonneg)
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   462
    show "{x \<in> space M1. emeasure M2 (Pair x -` N) \<noteq> 0} \<in> sets M1"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   463
      by (intro borel_measurable_ereal_neq_const measurable_emeasure_Pair1 N)
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   464
    { fix x assume "x \<in> space M1" "emeasure M2 (Pair x -` N) = 0"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   465
      have "AE y in M2. Q (x, y)"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   466
      proof (rule AE_I)
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   467
        show "emeasure M2 (Pair x -` N) = 0" by fact
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   468
        show "Pair x -` N \<in> sets M2" using N(1) by (rule sets_Pair1)
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   469
        show "{y \<in> space M2. \<not> Q (x, y)} \<subseteq> Pair x -` N"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   470
          using N `x \<in> space M1` unfolding space_pair_measure by auto
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   471
      qed }
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   472
    then show "{x \<in> space M1. \<not> (AE y in M2. Q (x, y))} \<subseteq> {x \<in> space M1. emeasure M2 (Pair x -` N) \<noteq> 0}"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   473
      by auto
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   474
  qed
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   475
qed
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   476
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   477
lemma (in pair_sigma_finite) AE_pair_measure:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   478
  assumes "{x\<in>space (M1 \<Otimes>\<^sub>M M2). P x} \<in> sets (M1 \<Otimes>\<^sub>M M2)"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   479
  assumes ae: "AE x in M1. AE y in M2. P (x, y)"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   480
  shows "AE x in M1 \<Otimes>\<^sub>M M2. P x"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   481
proof (subst AE_iff_measurable[OF _ refl])
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   482
  show "{x\<in>space (M1 \<Otimes>\<^sub>M M2). \<not> P x} \<in> sets (M1 \<Otimes>\<^sub>M M2)"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   483
    by (rule sets.sets_Collect) fact
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   484
  then have "emeasure (M1 \<Otimes>\<^sub>M M2) {x \<in> space (M1 \<Otimes>\<^sub>M M2). \<not> P x} =
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   485
      (\<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator {x \<in> space (M1 \<Otimes>\<^sub>M M2). \<not> P x} (x, y) \<partial>M2 \<partial>M1)"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   486
    by (simp add: M2.emeasure_pair_measure)
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   487
  also have "\<dots> = (\<integral>\<^sup>+ x. \<integral>\<^sup>+ y. 0 \<partial>M2 \<partial>M1)"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   488
    using ae
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   489
    apply (safe intro!: nn_integral_cong_AE)
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   490
    apply (intro AE_I2)
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   491
    apply (safe intro!: nn_integral_cong_AE)
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   492
    apply auto
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   493
    done
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   494
  finally show "emeasure (M1 \<Otimes>\<^sub>M M2) {x \<in> space (M1 \<Otimes>\<^sub>M M2). \<not> P x} = 0" by simp
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   495
qed
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   496
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   497
lemma (in pair_sigma_finite) AE_pair_iff:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   498
  "{x\<in>space (M1 \<Otimes>\<^sub>M M2). P (fst x) (snd x)} \<in> sets (M1 \<Otimes>\<^sub>M M2) \<Longrightarrow>
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   499
    (AE x in M1. AE y in M2. P x y) \<longleftrightarrow> (AE x in (M1 \<Otimes>\<^sub>M M2). P (fst x) (snd x))"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   500
  using AE_pair[of "\<lambda>x. P (fst x) (snd x)"] AE_pair_measure[of "\<lambda>x. P (fst x) (snd x)"] by auto
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   501
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   502
lemma (in pair_sigma_finite) AE_commute:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   503
  assumes P: "{x\<in>space (M1 \<Otimes>\<^sub>M M2). P (fst x) (snd x)} \<in> sets (M1 \<Otimes>\<^sub>M M2)"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   504
  shows "(AE x in M1. AE y in M2. P x y) \<longleftrightarrow> (AE y in M2. AE x in M1. P x y)"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   505
proof -
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   506
  interpret Q: pair_sigma_finite M2 M1 ..
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   507
  have [simp]: "\<And>x. (fst (case x of (x, y) \<Rightarrow> (y, x))) = snd x" "\<And>x. (snd (case x of (x, y) \<Rightarrow> (y, x))) = fst x"
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   508
    by auto
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   509
  have "{x \<in> space (M2 \<Otimes>\<^sub>M M1). P (snd x) (fst x)} =
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   510
    (\<lambda>(x, y). (y, x)) -` {x \<in> space (M1 \<Otimes>\<^sub>M M2). P (fst x) (snd x)} \<inter> space (M2 \<Otimes>\<^sub>M M1)"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   511
    by (auto simp: space_pair_measure)
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   512
  also have "\<dots> \<in> sets (M2 \<Otimes>\<^sub>M M1)"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   513
    by (intro sets_pair_swap P)
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   514
  finally show ?thesis
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   515
    apply (subst AE_pair_iff[OF P])
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   516
    apply (subst distr_pair_swap)
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   517
    apply (subst AE_distr_iff[OF measurable_pair_swap' P])
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   518
    apply (subst Q.AE_pair_iff)
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   519
    apply simp_all
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   520
    done
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   521
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   522
56994
8d5e5ec1cac3 fixed document generation for HOL-Probability
hoelzl
parents: 56993
diff changeset
   523
subsection "Fubinis theorem"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   524
49800
a6678da5692c induction prove for positive_integral_fst
hoelzl
parents: 49789
diff changeset
   525
lemma measurable_compose_Pair1:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   526
  "x \<in> space M1 \<Longrightarrow> g \<in> measurable (M1 \<Otimes>\<^sub>M M2) L \<Longrightarrow> (\<lambda>y. g (x, y)) \<in> measurable M2 L"
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   527
  by simp
49800
a6678da5692c induction prove for positive_integral_fst
hoelzl
parents: 49789
diff changeset
   528
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   529
lemma (in sigma_finite_measure) borel_measurable_nn_integral_fst':
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   530
  assumes f: "f \<in> borel_measurable (M1 \<Otimes>\<^sub>M M)" "\<And>x. 0 \<le> f x"
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   531
  shows "(\<lambda>x. \<integral>\<^sup>+ y. f (x, y) \<partial>M) \<in> borel_measurable M1"
49800
a6678da5692c induction prove for positive_integral_fst
hoelzl
parents: 49789
diff changeset
   532
using f proof induct
a6678da5692c induction prove for positive_integral_fst
hoelzl
parents: 49789
diff changeset
   533
  case (cong u v)
49999
dfb63b9b8908 for the product measure it is enough if only one measure is sigma-finite
hoelzl
parents: 49825
diff changeset
   534
  then have "\<And>w x. w \<in> space M1 \<Longrightarrow> x \<in> space M \<Longrightarrow> u (w, x) = v (w, x)"
49800
a6678da5692c induction prove for positive_integral_fst
hoelzl
parents: 49789
diff changeset
   535
    by (auto simp: space_pair_measure)
a6678da5692c induction prove for positive_integral_fst
hoelzl
parents: 49789
diff changeset
   536
  show ?case
a6678da5692c induction prove for positive_integral_fst
hoelzl
parents: 49789
diff changeset
   537
    apply (subst measurable_cong)
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   538
    apply (rule nn_integral_cong)
49800
a6678da5692c induction prove for positive_integral_fst
hoelzl
parents: 49789
diff changeset
   539
    apply fact+
a6678da5692c induction prove for positive_integral_fst
hoelzl
parents: 49789
diff changeset
   540
    done
a6678da5692c induction prove for positive_integral_fst
hoelzl
parents: 49789
diff changeset
   541
next
a6678da5692c induction prove for positive_integral_fst
hoelzl
parents: 49789
diff changeset
   542
  case (set Q)
a6678da5692c induction prove for positive_integral_fst
hoelzl
parents: 49789
diff changeset
   543
  have [simp]: "\<And>x y. indicator Q (x, y) = indicator (Pair x -` Q) y"
a6678da5692c induction prove for positive_integral_fst
hoelzl
parents: 49789
diff changeset
   544
    by (auto simp: indicator_def)
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   545
  have "\<And>x. x \<in> space M1 \<Longrightarrow> emeasure M (Pair x -` Q) = \<integral>\<^sup>+ y. indicator Q (x, y) \<partial>M"
49800
a6678da5692c induction prove for positive_integral_fst
hoelzl
parents: 49789
diff changeset
   546
    by (simp add: sets_Pair1[OF set])
49999
dfb63b9b8908 for the product measure it is enough if only one measure is sigma-finite
hoelzl
parents: 49825
diff changeset
   547
  from this measurable_emeasure_Pair[OF set] show ?case
49800
a6678da5692c induction prove for positive_integral_fst
hoelzl
parents: 49789
diff changeset
   548
    by (rule measurable_cong[THEN iffD1])
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   549
qed (simp_all add: nn_integral_add nn_integral_cmult measurable_compose_Pair1
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   550
                   nn_integral_monotone_convergence_SUP incseq_def le_fun_def
49800
a6678da5692c induction prove for positive_integral_fst
hoelzl
parents: 49789
diff changeset
   551
              cong: measurable_cong)
a6678da5692c induction prove for positive_integral_fst
hoelzl
parents: 49789
diff changeset
   552
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   553
lemma (in sigma_finite_measure) nn_integral_fst':
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   554
  assumes f: "f \<in> borel_measurable (M1 \<Otimes>\<^sub>M M)" "\<And>x. 0 \<le> f x"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   555
  shows "(\<integral>\<^sup>+ x. \<integral>\<^sup>+ y. f (x, y) \<partial>M \<partial>M1) = integral\<^sup>N (M1 \<Otimes>\<^sub>M M) f" (is "?I f = _")
49800
a6678da5692c induction prove for positive_integral_fst
hoelzl
parents: 49789
diff changeset
   556
using f proof induct
a6678da5692c induction prove for positive_integral_fst
hoelzl
parents: 49789
diff changeset
   557
  case (cong u v)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
   558
  then have "?I u = ?I v"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   559
    by (intro nn_integral_cong) (auto simp: space_pair_measure)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53015
diff changeset
   560
  with cong show ?case
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   561
    by (simp cong: nn_integral_cong)
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   562
qed (simp_all add: emeasure_pair_measure nn_integral_cmult nn_integral_add
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   563
                   nn_integral_monotone_convergence_SUP
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   564
                   measurable_compose_Pair1 nn_integral_nonneg
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   565
                   borel_measurable_nn_integral_fst' nn_integral_mono incseq_def le_fun_def
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   566
              cong: nn_integral_cong)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   567
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   568
lemma (in sigma_finite_measure) nn_integral_fst:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   569
  assumes f: "f \<in> borel_measurable (M1 \<Otimes>\<^sub>M M)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   570
  shows "(\<integral>\<^sup>+ x. (\<integral>\<^sup>+ y. f (x, y) \<partial>M) \<partial>M1) = integral\<^sup>N (M1 \<Otimes>\<^sub>M M) f"
49800
a6678da5692c induction prove for positive_integral_fst
hoelzl
parents: 49789
diff changeset
   571
  using f
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   572
    borel_measurable_nn_integral_fst'[of "\<lambda>x. max 0 (f x)"]
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   573
    nn_integral_fst'[of "\<lambda>x. max 0 (f x)"]
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   574
  unfolding nn_integral_max_0 by auto
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   575
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   576
lemma (in sigma_finite_measure) borel_measurable_nn_integral[measurable (raw)]:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   577
  "split f \<in> borel_measurable (N \<Otimes>\<^sub>M M) \<Longrightarrow> (\<lambda>x. \<integral>\<^sup>+ y. f x y \<partial>M) \<in> borel_measurable N"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   578
  using borel_measurable_nn_integral_fst'[of "\<lambda>x. max 0 (split f x)" N]
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   579
  by (simp add: nn_integral_max_0)
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   580
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   581
lemma (in pair_sigma_finite) nn_integral_snd:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   582
  assumes f: "f \<in> borel_measurable (M1 \<Otimes>\<^sub>M M2)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   583
  shows "(\<integral>\<^sup>+ y. (\<integral>\<^sup>+ x. f (x, y) \<partial>M1) \<partial>M2) = integral\<^sup>N (M1 \<Otimes>\<^sub>M M2) f"
41661
baf1964bc468 use pre-image measure, instead of image
hoelzl
parents: 41659
diff changeset
   584
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   585
  note measurable_pair_swap[OF f]
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   586
  from M1.nn_integral_fst[OF this]
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   587
  have "(\<integral>\<^sup>+ y. (\<integral>\<^sup>+ x. f (x, y) \<partial>M1) \<partial>M2) = (\<integral>\<^sup>+ (x, y). f (y, x) \<partial>(M2 \<Otimes>\<^sub>M M1))"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   588
    by simp
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   589
  also have "(\<integral>\<^sup>+ (x, y). f (y, x) \<partial>(M2 \<Otimes>\<^sub>M M1)) = integral\<^sup>N (M1 \<Otimes>\<^sub>M M2) f"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   590
    by (subst distr_pair_swap)
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   591
       (auto simp: nn_integral_distr[OF measurable_pair_swap' f] intro!: nn_integral_cong)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   592
  finally show ?thesis .
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   593
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   594
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   595
lemma (in pair_sigma_finite) Fubini:
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   596
  assumes f: "f \<in> borel_measurable (M1 \<Otimes>\<^sub>M M2)"
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   597
  shows "(\<integral>\<^sup>+ y. (\<integral>\<^sup>+ x. f (x, y) \<partial>M1) \<partial>M2) = (\<integral>\<^sup>+ x. (\<integral>\<^sup>+ y. f (x, y) \<partial>M2) \<partial>M1)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   598
  unfolding nn_integral_snd[OF assms] M2.nn_integral_fst[OF assms] ..
41026
bea75746dc9d folding on arbitrary Lebesgue integrable functions
hoelzl
parents: 41023
diff changeset
   599
57235
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
   600
lemma (in pair_sigma_finite) Fubini':
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
   601
  assumes f: "split f \<in> borel_measurable (M1 \<Otimes>\<^sub>M M2)"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
   602
  shows "(\<integral>\<^sup>+ y. (\<integral>\<^sup>+ x. f x y \<partial>M1) \<partial>M2) = (\<integral>\<^sup>+ x. (\<integral>\<^sup>+ y. f x y \<partial>M2) \<partial>M1)"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
   603
  using Fubini[OF f] by simp
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
   604
56994
8d5e5ec1cac3 fixed document generation for HOL-Probability
hoelzl
parents: 56993
diff changeset
   605
subsection {* Products on counting spaces, densities and distributions *}
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   606
59088
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   607
lemma sigma_prod:
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   608
  assumes X_cover: "\<exists>E\<subseteq>A. countable E \<and> X = \<Union>E" and A: "A \<subseteq> Pow X"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   609
  assumes Y_cover: "\<exists>E\<subseteq>B. countable E \<and> Y = \<Union>E" and B: "B \<subseteq> Pow Y"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   610
  shows "sigma X A \<Otimes>\<^sub>M sigma Y B = sigma (X \<times> Y) {a \<times> b | a b. a \<in> A \<and> b \<in> B}"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   611
    (is "?P = ?S")
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   612
proof (rule measure_eqI)
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   613
  have [simp]: "snd \<in> X \<times> Y \<rightarrow> Y" "fst \<in> X \<times> Y \<rightarrow> X"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   614
    by auto
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   615
  let ?XY = "{{fst -` a \<inter> X \<times> Y | a. a \<in> A}, {snd -` b \<inter> X \<times> Y | b. b \<in> B}}"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   616
  have "sets ?P = 
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   617
    sets (\<Squnion>\<^sub>\<sigma> xy\<in>?XY. sigma (X \<times> Y) xy)"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   618
    by (simp add: vimage_algebra_sigma sets_pair_eq_sets_fst_snd A B)
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   619
  also have "\<dots> = sets (sigma (X \<times> Y) (\<Union>?XY))"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   620
    by (intro Sup_sigma_sigma arg_cong[where f=sets]) auto
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   621
  also have "\<dots> = sets ?S"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   622
  proof (intro arg_cong[where f=sets] sigma_eqI sigma_sets_eqI) 
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   623
    show "\<Union>?XY \<subseteq> Pow (X \<times> Y)" "{a \<times> b |a b. a \<in> A \<and> b \<in> B} \<subseteq> Pow (X \<times> Y)"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   624
      using A B by auto
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   625
  next
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   626
    interpret XY: sigma_algebra "X \<times> Y" "sigma_sets (X \<times> Y) {a \<times> b |a b. a \<in> A \<and> b \<in> B}"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   627
      using A B by (intro sigma_algebra_sigma_sets) auto
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   628
    fix Z assume "Z \<in> \<Union>?XY"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   629
    then show "Z \<in> sigma_sets (X \<times> Y) {a \<times> b |a b. a \<in> A \<and> b \<in> B}"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   630
    proof safe
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   631
      fix a assume "a \<in> A"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   632
      from Y_cover obtain E where E: "E \<subseteq> B" "countable E" and "Y = \<Union>E"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   633
        by auto
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   634
      with `a \<in> A` A have eq: "fst -` a \<inter> X \<times> Y = (\<Union>e\<in>E. a \<times> e)"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   635
        by auto
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   636
      show "fst -` a \<inter> X \<times> Y \<in> sigma_sets (X \<times> Y) {a \<times> b |a b. a \<in> A \<and> b \<in> B}"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   637
        using `a \<in> A` E unfolding eq by (auto intro!: XY.countable_UN')
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   638
    next
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   639
      fix b assume "b \<in> B"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   640
      from X_cover obtain E where E: "E \<subseteq> A" "countable E" and "X = \<Union>E"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   641
        by auto
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   642
      with `b \<in> B` B have eq: "snd -` b \<inter> X \<times> Y = (\<Union>e\<in>E. e \<times> b)"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   643
        by auto
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   644
      show "snd -` b \<inter> X \<times> Y \<in> sigma_sets (X \<times> Y) {a \<times> b |a b. a \<in> A \<and> b \<in> B}"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   645
        using `b \<in> B` E unfolding eq by (auto intro!: XY.countable_UN')
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   646
    qed
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   647
  next
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   648
    fix Z assume "Z \<in> {a \<times> b |a b. a \<in> A \<and> b \<in> B}"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   649
    then obtain a b where "Z = a \<times> b" and ab: "a \<in> A" "b \<in> B"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   650
      by auto
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   651
    then have Z: "Z = (fst -` a \<inter> X \<times> Y) \<inter> (snd -` b \<inter> X \<times> Y)"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   652
      using A B by auto
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   653
    interpret XY: sigma_algebra "X \<times> Y" "sigma_sets (X \<times> Y) (\<Union>?XY)"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   654
      by (intro sigma_algebra_sigma_sets) auto
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   655
    show "Z \<in> sigma_sets (X \<times> Y) (\<Union>?XY)"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   656
      unfolding Z by (rule XY.Int) (blast intro: ab)+
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   657
  qed
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   658
  finally show "sets ?P = sets ?S" .
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   659
next
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   660
  interpret finite_measure "sigma X A" for X A
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   661
    proof qed (simp add: emeasure_sigma)
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   662
  fix A assume "A \<in> sets ?P" then show "emeasure ?P A = emeasure ?S A"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   663
    by (simp add: emeasure_pair_measure_alt emeasure_sigma)
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   664
qed
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   665
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41661
diff changeset
   666
lemma sigma_sets_pair_measure_generator_finite:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 36649
diff changeset
   667
  assumes "finite A" and "finite B"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   668
  shows "sigma_sets (A \<times> B) { a \<times> b | a b. a \<subseteq> A \<and> b \<subseteq> B} = Pow (A \<times> B)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   669
  (is "sigma_sets ?prod ?sets = _")
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 36649
diff changeset
   670
proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 36649
diff changeset
   671
  have fin: "finite (A \<times> B)" using assms by (rule finite_cartesian_product)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 36649
diff changeset
   672
  fix x assume subset: "x \<subseteq> A \<times> B"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 36649
diff changeset
   673
  hence "finite x" using fin by (rule finite_subset)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   674
  from this subset show "x \<in> sigma_sets ?prod ?sets"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 36649
diff changeset
   675
  proof (induct x)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 36649
diff changeset
   676
    case empty show ?case by (rule sigma_sets.Empty)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 36649
diff changeset
   677
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 36649
diff changeset
   678
    case (insert a x)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   679
    hence "{a} \<in> sigma_sets ?prod ?sets" by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 36649
diff changeset
   680
    moreover have "x \<in> sigma_sets ?prod ?sets" using insert by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 36649
diff changeset
   681
    ultimately show ?case unfolding insert_is_Un[of a x] by (rule sigma_sets_Un)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 36649
diff changeset
   682
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 36649
diff changeset
   683
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 36649
diff changeset
   684
  fix x a b
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   685
  assume "x \<in> sigma_sets ?prod ?sets" and "(a, b) \<in> x"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 36649
diff changeset
   686
  from sigma_sets_into_sp[OF _ this(1)] this(2)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   687
  show "a \<in> A" and "b \<in> B" by auto
35833
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   688
qed
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   689
59088
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   690
lemma borel_prod:
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   691
  "(borel \<Otimes>\<^sub>M borel) = (borel :: ('a::second_countable_topology \<times> 'b::second_countable_topology) measure)"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   692
  (is "?P = ?B")
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   693
proof -
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   694
  have "?B = sigma UNIV {A \<times> B | A B. open A \<and> open B}"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   695
    by (rule second_countable_borel_measurable[OF open_prod_generated])
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   696
  also have "\<dots> = ?P"
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   697
    unfolding borel_def
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   698
    by (subst sigma_prod) (auto intro!: exI[of _ "{UNIV}"])
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   699
  finally show ?thesis ..
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   700
qed
ff2bd4a14ddb generalized (borel_)measurable_SUP/INF/lfp/gfp; tuned proofs for sigma-closure of product spaces
hoelzl
parents: 59048
diff changeset
   701
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   702
lemma pair_measure_count_space:
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   703
  assumes A: "finite A" and B: "finite B"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   704
  shows "count_space A \<Otimes>\<^sub>M count_space B = count_space (A \<times> B)" (is "?P = ?C")
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   705
proof (rule measure_eqI)
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   706
  interpret A: finite_measure "count_space A" by (rule finite_measure_count_space) fact
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   707
  interpret B: finite_measure "count_space B" by (rule finite_measure_count_space) fact
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   708
  interpret P: pair_sigma_finite "count_space A" "count_space B" by default
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   709
  show eq: "sets ?P = sets ?C"
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   710
    by (simp add: sets_pair_measure sigma_sets_pair_measure_generator_finite A B)
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   711
  fix X assume X: "X \<in> sets ?P"
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   712
  with eq have X_subset: "X \<subseteq> A \<times> B" by simp
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   713
  with A B have fin_Pair: "\<And>x. finite (Pair x -` X)"
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   714
    by (intro finite_subset[OF _ B]) auto
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   715
  have fin_X: "finite X" using X_subset by (rule finite_subset) (auto simp: A B)
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   716
  show "emeasure ?P X = emeasure ?C X"
49776
199d1d5bb17e tuned product measurability
hoelzl
parents: 47694
diff changeset
   717
    apply (subst B.emeasure_pair_measure_alt[OF X])
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   718
    apply (subst emeasure_count_space)
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   719
    using X_subset apply auto []
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   720
    apply (simp add: fin_Pair emeasure_count_space X_subset fin_X)
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   721
    apply (subst nn_integral_count_space)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   722
    using A apply simp
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   723
    apply (simp del: real_of_nat_setsum add: real_of_nat_setsum[symmetric])
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   724
    apply (subst card_gt_0_iff)
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   725
    apply (simp add: fin_Pair)
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   726
    apply (subst card_SigmaI[symmetric])
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   727
    using A apply simp
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   728
    using fin_Pair apply simp
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   729
    using X_subset apply (auto intro!: arg_cong[where f=card])
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   730
    done
45777
c36637603821 remove unnecessary sublocale instantiations in HOL-Probability (for clarity and speedup); remove Infinite_Product_Measure.product_prob_space which was a duplicate of Probability_Measure.product_prob_space
hoelzl
parents: 44890
diff changeset
   731
qed
35833
7b7ae5aa396d Added product measure space
hoelzl
parents:
diff changeset
   732
59426
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   733
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   734
lemma emeasure_prod_count_space:
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   735
  assumes A: "A \<in> sets (count_space UNIV \<Otimes>\<^sub>M M)" (is "A \<in> sets (?A \<Otimes>\<^sub>M ?B)")
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   736
  shows "emeasure (?A \<Otimes>\<^sub>M ?B) A = (\<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator A (x, y) \<partial>?B \<partial>?A)"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   737
  by (rule emeasure_measure_of[OF pair_measure_def])
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   738
     (auto simp: countably_additive_def positive_def suminf_indicator nn_integral_nonneg A
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   739
                 nn_integral_suminf[symmetric] dest: sets.sets_into_space)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   740
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   741
lemma emeasure_prod_count_space_single[simp]: "emeasure (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) {x} = 1"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   742
proof -
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   743
  have [simp]: "\<And>a b x y. indicator {(a, b)} (x, y) = (indicator {a} x * indicator {b} y::ereal)"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   744
    by (auto split: split_indicator)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   745
  show ?thesis
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   746
    by (cases x)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   747
       (auto simp: emeasure_prod_count_space nn_integral_cmult sets_Pair nn_integral_max_0 one_ereal_def[symmetric])
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   748
qed
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   749
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   750
lemma emeasure_count_space_prod_eq:
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   751
  fixes A :: "('a \<times> 'b) set"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   752
  assumes A: "A \<in> sets (count_space UNIV \<Otimes>\<^sub>M count_space UNIV)" (is "A \<in> sets (?A \<Otimes>\<^sub>M ?B)")
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   753
  shows "emeasure (?A \<Otimes>\<^sub>M ?B) A = emeasure (count_space UNIV) A"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   754
proof -
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   755
  { fix A :: "('a \<times> 'b) set" assume "countable A"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   756
    then have "emeasure (?A \<Otimes>\<^sub>M ?B) (\<Union>a\<in>A. {a}) = (\<integral>\<^sup>+a. emeasure (?A \<Otimes>\<^sub>M ?B) {a} \<partial>count_space A)"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   757
      by (intro emeasure_UN_countable) (auto simp: sets_Pair disjoint_family_on_def)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   758
    also have "\<dots> = (\<integral>\<^sup>+a. indicator A a \<partial>count_space UNIV)"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   759
      by (subst nn_integral_count_space_indicator) auto
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   760
    finally have "emeasure (?A \<Otimes>\<^sub>M ?B) A = emeasure (count_space UNIV) A"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   761
      by simp }
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   762
  note * = this
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   763
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   764
  show ?thesis
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   765
  proof cases
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   766
    assume "finite A" then show ?thesis
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   767
      by (intro * countable_finite)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   768
  next
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   769
    assume "infinite A"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   770
    then obtain C where "countable C" and "infinite C" and "C \<subseteq> A"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   771
      by (auto dest: infinite_countable_subset')
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   772
    with A have "emeasure (?A \<Otimes>\<^sub>M ?B) C \<le> emeasure (?A \<Otimes>\<^sub>M ?B) A"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   773
      by (intro emeasure_mono) auto
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   774
    also have "emeasure (?A \<Otimes>\<^sub>M ?B) C = emeasure (count_space UNIV) C"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   775
      using `countable C` by (rule *)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   776
    finally show ?thesis
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   777
      using `infinite C` `infinite A` by simp
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   778
  qed
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   779
qed
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   780
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   781
lemma nn_intergal_count_space_prod_eq':
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   782
  assumes [simp]: "\<And>x. 0 \<le> f x"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   783
  shows "nn_integral (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = nn_integral (count_space UNIV) f"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   784
    (is "nn_integral ?P f = _")
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   785
proof cases
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   786
  assume cntbl: "countable {x. f x \<noteq> 0}"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   787
  have [simp]: "\<And>x. ereal (real (card ({x} \<inter> {x. f x \<noteq> 0}))) = indicator {x. f x \<noteq> 0} x"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   788
    by (auto split: split_indicator)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   789
  have [measurable]: "\<And>y. (\<lambda>x. indicator {y} x) \<in> borel_measurable ?P"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   790
    by (rule measurable_discrete_difference[of "\<lambda>x. 0" _ borel "{y}" "\<lambda>x. indicator {y} x" for y])
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   791
       (auto intro: sets_Pair)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   792
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   793
  have "(\<integral>\<^sup>+x. f x \<partial>?P) = (\<integral>\<^sup>+x. \<integral>\<^sup>+x'. f x * indicator {x} x' \<partial>count_space {x. f x \<noteq> 0} \<partial>?P)"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   794
    by (auto simp add: nn_integral_cmult nn_integral_indicator' intro!: nn_integral_cong split: split_indicator)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   795
  also have "\<dots> = (\<integral>\<^sup>+x. \<integral>\<^sup>+x'. f x' * indicator {x'} x \<partial>count_space {x. f x \<noteq> 0} \<partial>?P)"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   796
    by (auto intro!: nn_integral_cong split: split_indicator)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   797
  also have "\<dots> = (\<integral>\<^sup>+x'. \<integral>\<^sup>+x. f x' * indicator {x'} x \<partial>?P \<partial>count_space {x. f x \<noteq> 0})"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   798
    by (intro nn_integral_count_space_nn_integral cntbl) auto
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   799
  also have "\<dots> = (\<integral>\<^sup>+x'. f x' \<partial>count_space {x. f x \<noteq> 0})"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   800
    by (intro nn_integral_cong) (auto simp: nn_integral_cmult sets_Pair)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   801
  finally show ?thesis
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   802
    by (auto simp add: nn_integral_count_space_indicator intro!: nn_integral_cong split: split_indicator)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   803
next
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   804
  { fix x assume "f x \<noteq> 0"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   805
    with `0 \<le> f x` have "(\<exists>r. 0 < r \<and> f x = ereal r) \<or> f x = \<infinity>"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   806
      by (cases "f x") (auto simp: less_le)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   807
    then have "\<exists>n. ereal (1 / real (Suc n)) \<le> f x"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   808
      by (auto elim!: nat_approx_posE intro!: less_imp_le) }
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   809
  note * = this
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   810
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   811
  assume cntbl: "uncountable {x. f x \<noteq> 0}"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   812
  also have "{x. f x \<noteq> 0} = (\<Union>n. {x. 1/Suc n \<le> f x})"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   813
    using * by auto
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   814
  finally obtain n where "infinite {x. 1/Suc n \<le> f x}"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   815
    by (meson countableI_type countable_UN uncountable_infinite)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   816
  then obtain C where C: "C \<subseteq> {x. 1/Suc n \<le> f x}" and "countable C" "infinite C"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   817
    by (metis infinite_countable_subset')
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   818
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   819
  have [measurable]: "C \<in> sets ?P"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   820
    using sets.countable[OF _ `countable C`, of ?P] by (auto simp: sets_Pair)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   821
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   822
  have "(\<integral>\<^sup>+x. ereal (1/Suc n) * indicator C x \<partial>?P) \<le> nn_integral ?P f"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   823
    using C by (intro nn_integral_mono) (auto split: split_indicator simp: zero_ereal_def[symmetric])
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   824
  moreover have "(\<integral>\<^sup>+x. ereal (1/Suc n) * indicator C x \<partial>?P) = \<infinity>"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   825
    using `infinite C` by (simp add: nn_integral_cmult emeasure_count_space_prod_eq)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   826
  moreover have "(\<integral>\<^sup>+x. ereal (1/Suc n) * indicator C x \<partial>count_space UNIV) \<le> nn_integral (count_space UNIV) f"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   827
    using C by (intro nn_integral_mono) (auto split: split_indicator simp: zero_ereal_def[symmetric])
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   828
  moreover have "(\<integral>\<^sup>+x. ereal (1/Suc n) * indicator C x \<partial>count_space UNIV) = \<infinity>"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   829
    using `infinite C` by (simp add: nn_integral_cmult)
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   830
  ultimately show ?thesis
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   831
    by simp
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   832
qed
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   833
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   834
lemma nn_intergal_count_space_prod_eq:
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   835
  "nn_integral (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = nn_integral (count_space UNIV) f"
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   836
  by (subst (1 2) nn_integral_max_0[symmetric]) (auto intro!: nn_intergal_count_space_prod_eq')
6fca83e88417 integral of the product of count spaces equals the integral of the count space of the product type
hoelzl
parents: 59353
diff changeset
   837
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   838
lemma pair_measure_density:
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   839
  assumes f: "f \<in> borel_measurable M1" "AE x in M1. 0 \<le> f x"
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   840
  assumes g: "g \<in> borel_measurable M2" "AE x in M2. 0 \<le> g x"
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   841
  assumes "sigma_finite_measure M2" "sigma_finite_measure (density M2 g)"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   842
  shows "density M1 f \<Otimes>\<^sub>M density M2 g = density (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x,y). f x * g y)" (is "?L = ?R")
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   843
proof (rule measure_eqI)
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   844
  interpret M2: sigma_finite_measure M2 by fact
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   845
  interpret D2: sigma_finite_measure "density M2 g" by fact
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   846
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   847
  fix A assume A: "A \<in> sets ?L"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   848
  with f g have "(\<integral>\<^sup>+ x. f x * \<integral>\<^sup>+ y. g y * indicator A (x, y) \<partial>M2 \<partial>M1) =
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   849
    (\<integral>\<^sup>+ x. \<integral>\<^sup>+ y. f x * g y * indicator A (x, y) \<partial>M2 \<partial>M1)"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   850
    by (intro nn_integral_cong_AE)
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   851
       (auto simp add: nn_integral_cmult[symmetric] ac_simps)
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   852
  with A f g show "emeasure ?L A = emeasure ?R A"
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   853
    by (simp add: D2.emeasure_pair_measure emeasure_density nn_integral_density
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   854
                  M2.nn_integral_fst[symmetric]
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   855
             cong: nn_integral_cong)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   856
qed simp
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   857
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   858
lemma sigma_finite_measure_distr:
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   859
  assumes "sigma_finite_measure (distr M N f)" and f: "f \<in> measurable M N"
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   860
  shows "sigma_finite_measure M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
   861
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   862
  interpret sigma_finite_measure "distr M N f" by fact
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57235
diff changeset
   863
  from sigma_finite_countable guess A .. note A = this
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   864
  show ?thesis
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57235
diff changeset
   865
  proof
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57235
diff changeset
   866
    show "\<exists>A. 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: 57235
diff changeset
   867
      using A f
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57235
diff changeset
   868
      by (intro exI[of _ "(\<lambda>a. f -` a \<inter> space M) ` A"])
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57235
diff changeset
   869
         (auto simp: emeasure_distr set_eq_iff subset_eq intro: measurable_space)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   870
  qed
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 36649
diff changeset
   871
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 36649
diff changeset
   872
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   873
lemma pair_measure_distr:
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   874
  assumes f: "f \<in> measurable M S" and g: "g \<in> measurable N T"
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   875
  assumes "sigma_finite_measure (distr N T g)"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   876
  shows "distr M S f \<Otimes>\<^sub>M distr N T g = distr (M \<Otimes>\<^sub>M N) (S \<Otimes>\<^sub>M T) (\<lambda>(x, y). (f x, g y))" (is "?P = ?D")
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   877
proof (rule measure_eqI)
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   878
  interpret T: sigma_finite_measure "distr N T g" by fact
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   879
  interpret N: sigma_finite_measure N by (rule sigma_finite_measure_distr) fact+
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   880
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46898
diff changeset
   881
  fix A assume A: "A \<in> sets ?P"
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   882
  with f g show "emeasure ?P A = emeasure ?D A"
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   883
    by (auto simp add: N.emeasure_pair_measure_alt space_pair_measure emeasure_distr
56996
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   884
                       T.emeasure_pair_measure_alt nn_integral_distr
891e992e510f renamed positive_integral to nn_integral
hoelzl
parents: 56994
diff changeset
   885
             intro!: nn_integral_cong arg_cong[where f="emeasure N"])
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
   886
qed simp
39097
943c7b348524 Moved lemmas to appropriate locations
hoelzl
parents: 39096
diff changeset
   887
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   888
lemma pair_measure_eqI:
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   889
  assumes "sigma_finite_measure M1" "sigma_finite_measure M2"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   890
  assumes sets: "sets (M1 \<Otimes>\<^sub>M M2) = sets M"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   891
  assumes emeasure: "\<And>A B. A \<in> sets M1 \<Longrightarrow> B \<in> sets M2 \<Longrightarrow> emeasure M1 A * emeasure M2 B = emeasure M (A \<times> B)"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   892
  shows "M1 \<Otimes>\<^sub>M M2 = M"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   893
proof -
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   894
  interpret M1: sigma_finite_measure M1 by fact
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   895
  interpret M2: sigma_finite_measure M2 by fact
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   896
  interpret pair_sigma_finite M1 M2 by default
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   897
  from sigma_finite_up_in_pair_measure_generator guess F :: "nat \<Rightarrow> ('a \<times> 'b) set" .. note F = this
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   898
  let ?E = "{a \<times> b |a b. a \<in> sets M1 \<and> b \<in> sets M2}"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 50244
diff changeset
   899
  let ?P = "M1 \<Otimes>\<^sub>M M2"
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   900
  show ?thesis
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   901
  proof (rule measure_eqI_generator_eq[OF Int_stable_pair_measure_generator[of M1 M2]])
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   902
    show "?E \<subseteq> Pow (space ?P)"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50104
diff changeset
   903
      using sets.space_closed[of M1] sets.space_closed[of M2] by (auto simp: space_pair_measure)
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   904
    show "sets ?P = sigma_sets (space ?P) ?E"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   905
      by (simp add: sets_pair_measure space_pair_measure)
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   906
    then show "sets M = sigma_sets (space ?P) ?E"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   907
      using sets[symmetric] by simp
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   908
  next
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   909
    show "range F \<subseteq> ?E" "(\<Union>i. F i) = space ?P" "\<And>i. emeasure ?P (F i) \<noteq> \<infinity>"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   910
      using F by (auto simp: space_pair_measure)
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   911
  next
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   912
    fix X assume "X \<in> ?E"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   913
    then obtain A B where X[simp]: "X = A \<times> B" and A: "A \<in> sets M1" and B: "B \<in> sets M2" by auto
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   914
    then have "emeasure ?P X = emeasure M1 A * emeasure M2 B"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   915
       by (simp add: M2.emeasure_pair_measure_Times)
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   916
    also have "\<dots> = emeasure M (A \<times> B)"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   917
      using A B emeasure by auto
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   918
    finally show "emeasure ?P X = emeasure M X"
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   919
      by simp
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   920
  qed
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   921
qed
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   922
  
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   923
lemma sets_pair_countable:
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   924
  assumes "countable S1" "countable S2"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   925
  assumes M: "sets M = Pow S1" and N: "sets N = Pow S2"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   926
  shows "sets (M \<Otimes>\<^sub>M N) = Pow (S1 \<times> S2)"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   927
proof auto
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   928
  fix x a b assume x: "x \<in> sets (M \<Otimes>\<^sub>M N)" "(a, b) \<in> x"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   929
  from sets.sets_into_space[OF x(1)] x(2)
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   930
    sets_eq_imp_space_eq[of N "count_space S2"] sets_eq_imp_space_eq[of M "count_space S1"] M N
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   931
  show "a \<in> S1" "b \<in> S2"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   932
    by (auto simp: space_pair_measure)
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   933
next
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   934
  fix X assume X: "X \<subseteq> S1 \<times> S2"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   935
  then have "countable X"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   936
    by (metis countable_subset `countable S1` `countable S2` countable_SIGMA)
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   937
  have "X = (\<Union>(a, b)\<in>X. {a} \<times> {b})" by auto
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   938
  also have "\<dots> \<in> sets (M \<Otimes>\<^sub>M N)"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   939
    using X
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   940
    by (safe intro!: sets.countable_UN' `countable X` subsetI pair_measureI) (auto simp: M N)
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   941
  finally show "X \<in> sets (M \<Otimes>\<^sub>M N)" .
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   942
qed
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   943
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   944
lemma pair_measure_countable:
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   945
  assumes "countable S1" "countable S2"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   946
  shows "count_space S1 \<Otimes>\<^sub>M count_space S2 = count_space (S1 \<times> S2)"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   947
proof (rule pair_measure_eqI)
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   948
  show "sigma_finite_measure (count_space S1)" "sigma_finite_measure (count_space S2)"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   949
    using assms by (auto intro!: sigma_finite_measure_count_space_countable)
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   950
  show "sets (count_space S1 \<Otimes>\<^sub>M count_space S2) = sets (count_space (S1 \<times> S2))"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   951
    by (subst sets_pair_countable[OF assms]) auto
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   952
next
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   953
  fix A B assume "A \<in> sets (count_space S1)" "B \<in> sets (count_space S2)"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   954
  then show "emeasure (count_space S1) A * emeasure (count_space S2) B = 
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   955
    emeasure (count_space (S1 \<times> S2)) (A \<times> B)"
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   956
    by (subst (1 2 3) emeasure_count_space) (auto simp: finite_cartesian_product_iff)
e7fd64f82876 add various lemmas
hoelzl
parents: 56996
diff changeset
   957
qed
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50003
diff changeset
   958
59489
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   959
lemma nn_integral_fst_count_space':
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   960
  assumes nonneg: "\<And>xy. 0 \<le> f xy"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   961
  shows "(\<integral>\<^sup>+ x. \<integral>\<^sup>+ y. f (x, y) \<partial>count_space UNIV \<partial>count_space UNIV) = integral\<^sup>N (count_space UNIV) f"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   962
  (is "?lhs = ?rhs")
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   963
proof(cases)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   964
  assume *: "countable {xy. f xy \<noteq> 0}"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   965
  let ?A = "fst ` {xy. f xy \<noteq> 0}"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   966
  let ?B = "snd ` {xy. f xy \<noteq> 0}"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   967
  from * have [simp]: "countable ?A" "countable ?B" by(rule countable_image)+
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   968
  from nonneg have f_neq_0: "\<And>xy. f xy \<noteq> 0 \<longleftrightarrow> f xy > 0"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   969
    by(auto simp add: order.order_iff_strict)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   970
  have "?lhs = (\<integral>\<^sup>+ x. \<integral>\<^sup>+ y. f (x, y) \<partial>count_space UNIV \<partial>count_space ?A)"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   971
    by(rule nn_integral_count_space_eq)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   972
      (auto simp add: f_neq_0 nn_integral_0_iff_AE AE_count_space not_le intro: rev_image_eqI)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   973
  also have "\<dots> = (\<integral>\<^sup>+ x. \<integral>\<^sup>+ y. f (x, y) \<partial>count_space ?B \<partial>count_space ?A)"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   974
    by(intro nn_integral_count_space_eq nn_integral_cong)(auto intro: rev_image_eqI)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   975
  also have "\<dots> = (\<integral>\<^sup>+ xy. f xy \<partial>count_space (?A \<times> ?B))"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   976
    by(subst sigma_finite_measure.nn_integral_fst)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   977
      (simp_all add: sigma_finite_measure_count_space_countable pair_measure_countable)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   978
  also have "\<dots> = ?rhs"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   979
    by(rule nn_integral_count_space_eq)(auto intro: rev_image_eqI)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   980
  finally show ?thesis .
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   981
next
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   982
  { fix xy assume "f xy \<noteq> 0"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   983
    with `0 \<le> f xy` have "(\<exists>r. 0 < r \<and> f xy = ereal r) \<or> f xy = \<infinity>"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   984
      by (cases "f xy") (auto simp: less_le)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   985
    then have "\<exists>n. ereal (1 / real (Suc n)) \<le> f xy"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   986
      by (auto elim!: nat_approx_posE intro!: less_imp_le) }
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   987
  note * = this
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   988
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   989
  assume cntbl: "uncountable {xy. f xy \<noteq> 0}"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   990
  also have "{xy. f xy \<noteq> 0} = (\<Union>n. {xy. 1/Suc n \<le> f xy})"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   991
    using * by auto
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   992
  finally obtain n where "infinite {xy. 1/Suc n \<le> f xy}"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   993
    by (meson countableI_type countable_UN uncountable_infinite)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   994
  then obtain C where C: "C \<subseteq> {xy. 1/Suc n \<le> f xy}" and "countable C" "infinite C"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   995
    by (metis infinite_countable_subset')
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   996
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   997
  have "\<infinity> = (\<integral>\<^sup>+ xy. ereal (1 / Suc n) * indicator C xy \<partial>count_space UNIV)"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   998
    using \<open>infinite C\<close> by(simp add: nn_integral_cmult)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
   999
  also have "\<dots> \<le> ?rhs" using C
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1000
    by(intro nn_integral_mono)(auto split: split_indicator simp add: nonneg)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1001
  finally have "?rhs = \<infinity>" by simp
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1002
  moreover have "?lhs = \<infinity>"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1003
  proof(cases "finite (fst ` C)")
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1004
    case True
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1005
    then obtain x C' where x: "x \<in> fst ` C" 
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1006
      and C': "C' = fst -` {x} \<inter> C"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1007
      and "infinite C'"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1008
      using \<open>infinite C\<close> by(auto elim!: inf_img_fin_domE')
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1009
    from x C C' have **: "C' \<subseteq> {xy. 1 / Suc n \<le> f xy}" by auto
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1010
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1011
    from C' \<open>infinite C'\<close> have "infinite (snd ` C')"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1012
      by(auto dest!: finite_imageD simp add: inj_on_def)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1013
    then have "\<infinity> = (\<integral>\<^sup>+ y. ereal (1 / Suc n) * indicator (snd ` C') y \<partial>count_space UNIV)"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1014
      by(simp add: nn_integral_cmult)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1015
    also have "\<dots> = (\<integral>\<^sup>+ y. ereal (1 / Suc n) * indicator C' (x, y) \<partial>count_space UNIV)"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1016
      by(rule nn_integral_cong)(force split: split_indicator intro: rev_image_eqI simp add: C')
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1017
    also have "\<dots> = (\<integral>\<^sup>+ x'. (\<integral>\<^sup>+ y. ereal (1 / Suc n) * indicator C' (x, y) \<partial>count_space UNIV) * indicator {x} x' \<partial>count_space UNIV)"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1018
      by(simp add: one_ereal_def[symmetric] nn_integral_nonneg nn_integral_cmult_indicator)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1019
    also have "\<dots> \<le> (\<integral>\<^sup>+ x. \<integral>\<^sup>+ y. ereal (1 / Suc n) * indicator C' (x, y) \<partial>count_space UNIV \<partial>count_space UNIV)"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1020
      by(rule nn_integral_mono)(simp split: split_indicator add: nn_integral_nonneg)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1021
    also have "\<dots> \<le> ?lhs" using **
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1022
      by(intro nn_integral_mono)(auto split: split_indicator simp add: nonneg)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1023
    finally show ?thesis by simp
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1024
  next
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1025
    case False
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1026
    def C' \<equiv> "fst ` C"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1027
    have "\<infinity> = \<integral>\<^sup>+ x. ereal (1 / Suc n) * indicator C' x \<partial>count_space UNIV"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1028
      using C'_def False by(simp add: nn_integral_cmult)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1029
    also have "\<dots> = \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. ereal (1 / Suc n) * indicator C' x * indicator {SOME y. (x, y) \<in> C} y \<partial>count_space UNIV \<partial>count_space UNIV"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1030
      by(auto simp add: one_ereal_def[symmetric] nn_integral_cmult_indicator intro: nn_integral_cong)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1031
    also have "\<dots> \<le> \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. ereal (1 / Suc n) * indicator C (x, y) \<partial>count_space UNIV \<partial>count_space UNIV"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1032
      by(intro nn_integral_mono)(auto simp add: C'_def split: split_indicator intro: someI)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1033
    also have "\<dots> \<le> ?lhs" using C
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1034
      by(intro nn_integral_mono)(auto split: split_indicator simp add: nonneg)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1035
    finally show ?thesis by simp
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1036
  qed
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1037
  ultimately show ?thesis by simp
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1038
qed
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1039
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1040
lemma nn_integral_fst_count_space:
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1041
  "(\<integral>\<^sup>+ x. \<integral>\<^sup>+ y. f (x, y) \<partial>count_space UNIV \<partial>count_space UNIV) = integral\<^sup>N (count_space UNIV) f"
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1042
by(subst (2 3) nn_integral_max_0[symmetric])(rule nn_integral_fst_count_space', simp)
fd5d23cc0e97 nn_integral can be split over arbitrary product count_spaces
Andreas Lochbihler
parents: 59426
diff changeset
  1043
59491
40f570f9a284 add another lemma to split nn_integral over product count_space
Andreas Lochbihler
parents: 59489
diff changeset
  1044
lemma nn_integral_snd_count_space:
40f570f9a284 add another lemma to split nn_integral over product count_space
Andreas Lochbihler
parents: 59489
diff changeset
  1045
  "(\<integral>\<^sup>+ y. \<integral>\<^sup>+ x. f (x, y) \<partial>count_space UNIV \<partial>count_space UNIV) = integral\<^sup>N (count_space UNIV) f"
40f570f9a284 add another lemma to split nn_integral over product count_space
Andreas Lochbihler
parents: 59489
diff changeset
  1046
  (is "?lhs = ?rhs")
40f570f9a284 add another lemma to split nn_integral over product count_space
Andreas Lochbihler
parents: 59489
diff changeset
  1047
proof -
40f570f9a284 add another lemma to split nn_integral over product count_space
Andreas Lochbihler
parents: 59489
diff changeset
  1048
  have "?lhs = (\<integral>\<^sup>+ y. \<integral>\<^sup>+ x. (\<lambda>(y, x). f (x, y)) (y, x) \<partial>count_space UNIV \<partial>count_space UNIV)"
40f570f9a284 add another lemma to split nn_integral over product count_space
Andreas Lochbihler
parents: 59489
diff changeset
  1049
    by(simp)
40f570f9a284 add another lemma to split nn_integral over product count_space
Andreas Lochbihler
parents: 59489
diff changeset
  1050
  also have "\<dots> = \<integral>\<^sup>+ yx. (\<lambda>(y, x). f (x, y)) yx \<partial>count_space UNIV"
40f570f9a284 add another lemma to split nn_integral over product count_space
Andreas Lochbihler
parents: 59489
diff changeset
  1051
    by(rule nn_integral_fst_count_space)
40f570f9a284 add another lemma to split nn_integral over product count_space
Andreas Lochbihler
parents: 59489
diff changeset
  1052
  also have "\<dots> = \<integral>\<^sup>+ xy. f xy \<partial>count_space ((\<lambda>(x, y). (y, x)) ` UNIV)"
40f570f9a284 add another lemma to split nn_integral over product count_space
Andreas Lochbihler
parents: 59489
diff changeset
  1053
    by(subst nn_integral_bij_count_space[OF inj_on_imp_bij_betw, symmetric])
40f570f9a284 add another lemma to split nn_integral over product count_space
Andreas Lochbihler
parents: 59489
diff changeset
  1054
      (simp_all add: inj_on_def split_def)
40f570f9a284 add another lemma to split nn_integral over product count_space
Andreas Lochbihler
parents: 59489
diff changeset
  1055
  also have "\<dots> = ?rhs" by(rule nn_integral_count_space_eq) auto
40f570f9a284 add another lemma to split nn_integral over product count_space
Andreas Lochbihler
parents: 59489
diff changeset
  1056
  finally show ?thesis .
40f570f9a284 add another lemma to split nn_integral over product count_space
Andreas Lochbihler
parents: 59489
diff changeset
  1057
qed
40f570f9a284 add another lemma to split nn_integral over product count_space
Andreas Lochbihler
parents: 59489
diff changeset
  1058
57235
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1059
subsection {* Product of Borel spaces *}
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1060
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1061
lemma borel_Times:
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1062
  fixes A :: "'a::topological_space set" and B :: "'b::topological_space set"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1063
  assumes A: "A \<in> sets borel" and B: "B \<in> sets borel"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1064
  shows "A \<times> B \<in> sets borel"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1065
proof -
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1066
  have "A \<times> B = (A\<times>UNIV) \<inter> (UNIV \<times> B)"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1067
    by auto
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1068
  moreover
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1069
  { have "A \<in> sigma_sets UNIV {S. open S}" using A by (simp add: sets_borel)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1070
    then have "A\<times>UNIV \<in> sets borel"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1071
    proof (induct A)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1072
      case (Basic S) then show ?case
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1073
        by (auto intro!: borel_open open_Times)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1074
    next
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1075
      case (Compl A)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1076
      moreover have *: "(UNIV - A) \<times> UNIV = UNIV - (A \<times> UNIV)"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1077
        by auto
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1078
      ultimately show ?case
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1079
        unfolding * by auto
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1080
    next
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1081
      case (Union A)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1082
      moreover have *: "(UNION UNIV A) \<times> UNIV = UNION UNIV (\<lambda>i. A i \<times> UNIV)"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1083
        by auto
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1084
      ultimately show ?case
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1085
        unfolding * by auto
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1086
    qed simp }
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1087
  moreover
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1088
  { have "B \<in> sigma_sets UNIV {S. open S}" using B by (simp add: sets_borel)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1089
    then have "UNIV\<times>B \<in> sets borel"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1090
    proof (induct B)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1091
      case (Basic S) then show ?case
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1092
        by (auto intro!: borel_open open_Times)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1093
    next
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1094
      case (Compl B)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1095
      moreover have *: "UNIV \<times> (UNIV - B) = UNIV - (UNIV \<times> B)"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1096
        by auto
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1097
      ultimately show ?case
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1098
        unfolding * by auto
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1099
    next
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1100
      case (Union B)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1101
      moreover have *: "UNIV \<times> (UNION UNIV B) = UNION UNIV (\<lambda>i. UNIV \<times> B i)"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1102
        by auto
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1103
      ultimately show ?case
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1104
        unfolding * by auto
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1105
    qed simp }
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1106
  ultimately show ?thesis
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1107
    by auto
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1108
qed
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1109
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1110
lemma finite_measure_pair_measure:
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1111
  assumes "finite_measure M" "finite_measure N"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1112
  shows "finite_measure (N  \<Otimes>\<^sub>M M)"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1113
proof (rule finite_measureI)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1114
  interpret M: finite_measure M by fact
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1115
  interpret N: finite_measure N by fact
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1116
  show "emeasure (N  \<Otimes>\<^sub>M M) (space (N  \<Otimes>\<^sub>M M)) \<noteq> \<infinity>"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1117
    by (auto simp: space_pair_measure M.emeasure_pair_measure_Times)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1118
qed
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 57025
diff changeset
  1119
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 39098
diff changeset
  1120
end