| author | wenzelm | 
| Wed, 29 Mar 2023 21:16:14 +0200 | |
| changeset 77750 | a8c52c99fa92 | 
| parent 74362 | 0135a0c77b64 | 
| child 78517 | 28c1f4f5335f | 
| permissions | -rw-r--r-- | 
| 42067 | 1  | 
(* Title: HOL/Probability/Information.thy  | 
2  | 
Author: Johannes Hölzl, TU München  | 
|
3  | 
Author: Armin Heller, TU München  | 
|
4  | 
*)  | 
|
5  | 
||
| 61808 | 6  | 
section \<open>Information theory\<close>  | 
| 42067 | 7  | 
|
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
8  | 
theory Information  | 
| 
41413
 
64cd30d6b0b8
explicit file specifications -- avoid secondary load path;
 
wenzelm 
parents: 
41095 
diff
changeset
 | 
9  | 
imports  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
10  | 
Independent_Family  | 
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
11  | 
begin  | 
| 
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
12  | 
|
| 39097 | 13  | 
lemma log_le: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> x \<le> y \<Longrightarrow> log a x \<le> log a y"  | 
14  | 
by (subst log_le_cancel_iff) auto  | 
|
15  | 
||
16  | 
lemma log_less: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> x < y \<Longrightarrow> log a x < log a y"  | 
|
17  | 
by (subst log_less_cancel_iff) auto  | 
|
18  | 
||
| 64267 | 19  | 
lemma sum_cartesian_product':  | 
20  | 
"(\<Sum>x\<in>A \<times> B. f x) = (\<Sum>x\<in>A. sum (\<lambda>y. f (x, y)) B)"  | 
|
21  | 
unfolding sum.cartesian_product by simp  | 
|
| 39097 | 22  | 
|
23  | 
lemma split_pairs:  | 
|
| 40859 | 24  | 
"((A, B) = X) \<longleftrightarrow> (fst X = A \<and> snd X = B)" and  | 
25  | 
"(X = (A, B)) \<longleftrightarrow> (fst X = A \<and> snd X = B)" by auto  | 
|
| 38656 | 26  | 
|
| 56994 | 27  | 
subsection "Information theory"  | 
| 38656 | 28  | 
|
| 40859 | 29  | 
locale information_space = prob_space +  | 
| 38656 | 30  | 
fixes b :: real assumes b_gt_1: "1 < b"  | 
31  | 
||
| 40859 | 32  | 
context information_space  | 
| 38656 | 33  | 
begin  | 
34  | 
||
| 69597 | 35  | 
text \<open>Introduce some simplification rules for logarithm of base \<^term>\<open>b\<close>.\<close>  | 
| 40859 | 36  | 
|
37  | 
lemma log_neg_const:  | 
|
38  | 
assumes "x \<le> 0"  | 
|
39  | 
shows "log b x = log b 0"  | 
|
| 36624 | 40  | 
proof -  | 
| 40859 | 41  | 
  { fix u :: real
 | 
42  | 
have "x \<le> 0" by fact  | 
|
43  | 
also have "0 < exp u"  | 
|
44  | 
using exp_gt_zero .  | 
|
45  | 
finally have "exp u \<noteq> x"  | 
|
46  | 
by auto }  | 
|
47  | 
then show "log b x = log b 0"  | 
|
| 
60017
 
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
 
paulson <lp15@cam.ac.uk> 
parents: 
58876 
diff
changeset
 | 
48  | 
by (simp add: log_def ln_real_def)  | 
| 38656 | 49  | 
qed  | 
50  | 
||
| 40859 | 51  | 
lemma log_mult_eq:  | 
52  | 
"log b (A * B) = (if 0 < A * B then log b \<bar>A\<bar> + log b \<bar>B\<bar> else log b 0)"  | 
|
53  | 
using log_mult[of b "\<bar>A\<bar>" "\<bar>B\<bar>"] b_gt_1 log_neg_const[of "A * B"]  | 
|
54  | 
by (auto simp: zero_less_mult_iff mult_le_0_iff)  | 
|
| 38656 | 55  | 
|
| 40859 | 56  | 
lemma log_inverse_eq:  | 
57  | 
"log b (inverse B) = (if 0 < B then - log b B else log b 0)"  | 
|
58  | 
using log_inverse[of b B] log_neg_const[of "inverse B"] b_gt_1 by simp  | 
|
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
59  | 
|
| 40859 | 60  | 
lemma log_divide_eq:  | 
61  | 
"log b (A / B) = (if 0 < A * B then log b \<bar>A\<bar> - log b \<bar>B\<bar> else log b 0)"  | 
|
62  | 
unfolding divide_inverse log_mult_eq log_inverse_eq abs_inverse  | 
|
63  | 
by (auto simp: zero_less_mult_iff mult_le_0_iff)  | 
|
| 38656 | 64  | 
|
| 40859 | 65  | 
lemmas log_simps = log_mult_eq log_inverse_eq log_divide_eq  | 
| 38656 | 66  | 
|
67  | 
end  | 
|
68  | 
||
| 39097 | 69  | 
subsection "Kullback$-$Leibler divergence"  | 
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
70  | 
|
| 61808 | 71  | 
text \<open>The Kullback$-$Leibler divergence is also known as relative entropy or  | 
72  | 
Kullback$-$Leibler distance.\<close>  | 
|
| 39097 | 73  | 
|
74  | 
definition  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
75  | 
"entropy_density b M N = log b \<circ> enn2real \<circ> RN_deriv M N"  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
76  | 
|
| 
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
77  | 
definition  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
78  | 
"KL_divergence b M N = integral\<^sup>L N (entropy_density b M N)"  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
79  | 
|
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
80  | 
lemma measurable_entropy_density[measurable]: "entropy_density b M N \<in> borel_measurable M"  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
81  | 
unfolding entropy_density_def by auto  | 
| 50003 | 82  | 
|
| 47694 | 83  | 
lemma (in sigma_finite_measure) KL_density:  | 
84  | 
fixes f :: "'a \<Rightarrow> real"  | 
|
85  | 
assumes "1 < b"  | 
|
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
86  | 
assumes f[measurable]: "f \<in> borel_measurable M" and nn: "AE x in M. 0 \<le> f x"  | 
| 47694 | 87  | 
shows "KL_divergence b M (density M f) = (\<integral>x. f x * log b (f x) \<partial>M)"  | 
88  | 
unfolding KL_divergence_def  | 
|
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
89  | 
proof (subst integral_real_density)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
90  | 
show [measurable]: "entropy_density b M (density M (\<lambda>x. ennreal (f x))) \<in> borel_measurable M"  | 
| 49776 | 91  | 
using f  | 
| 50003 | 92  | 
by (auto simp: comp_def entropy_density_def)  | 
| 47694 | 93  | 
have "density M (RN_deriv M (density M f)) = density M f"  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
94  | 
using f nn by (intro density_RN_deriv_density) auto  | 
| 47694 | 95  | 
then have eq: "AE x in M. RN_deriv M (density M f) x = f x"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
96  | 
using f nn by (intro density_unique) auto  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
97  | 
show "(\<integral>x. f x * entropy_density b M (density M (\<lambda>x. ennreal (f x))) x \<partial>M) = (\<integral>x. f x * log b (f x) \<partial>M)"  | 
| 47694 | 98  | 
apply (intro integral_cong_AE)  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
99  | 
apply measurable  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
100  | 
using eq nn  | 
| 47694 | 101  | 
apply eventually_elim  | 
102  | 
apply (auto simp: entropy_density_def)  | 
|
103  | 
done  | 
|
104  | 
qed fact+  | 
|
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
105  | 
|
| 47694 | 106  | 
lemma (in sigma_finite_measure) KL_density_density:  | 
107  | 
fixes f g :: "'a \<Rightarrow> real"  | 
|
108  | 
assumes "1 < b"  | 
|
109  | 
assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x"  | 
|
110  | 
assumes g: "g \<in> borel_measurable M" "AE x in M. 0 \<le> g x"  | 
|
111  | 
assumes ac: "AE x in M. f x = 0 \<longrightarrow> g x = 0"  | 
|
112  | 
shows "KL_divergence b (density M f) (density M g) = (\<integral>x. g x * log b (g x / f x) \<partial>M)"  | 
|
113  | 
proof -  | 
|
114  | 
interpret Mf: sigma_finite_measure "density M f"  | 
|
115  | 
using f by (subst sigma_finite_iff_density_finite) auto  | 
|
116  | 
have "KL_divergence b (density M f) (density M g) =  | 
|
117  | 
KL_divergence b (density M f) (density (density M f) (\<lambda>x. g x / f x))"  | 
|
118  | 
using f g ac by (subst density_density_divide) simp_all  | 
|
119  | 
also have "\<dots> = (\<integral>x. (g x / f x) * log b (g x / f x) \<partial>density M f)"  | 
|
| 61808 | 120  | 
using f g \<open>1 < b\<close> by (intro Mf.KL_density) (auto simp: AE_density)  | 
| 47694 | 121  | 
also have "\<dots> = (\<integral>x. g x * log b (g x / f x) \<partial>M)"  | 
| 61808 | 122  | 
using ac f g \<open>1 < b\<close> by (subst integral_density) (auto intro!: integral_cong_AE)  | 
| 47694 | 123  | 
finally show ?thesis .  | 
124  | 
qed  | 
|
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
125  | 
|
| 47694 | 126  | 
lemma (in information_space) KL_gt_0:  | 
127  | 
fixes D :: "'a \<Rightarrow> real"  | 
|
128  | 
assumes "prob_space (density M D)"  | 
|
129  | 
assumes D: "D \<in> borel_measurable M" "AE x in M. 0 \<le> D x"  | 
|
130  | 
assumes int: "integrable M (\<lambda>x. D x * log b (D x))"  | 
|
131  | 
assumes A: "density M D \<noteq> M"  | 
|
132  | 
shows "0 < KL_divergence b M (density M D)"  | 
|
133  | 
proof -  | 
|
134  | 
interpret N: prob_space "density M D" by fact  | 
|
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
135  | 
|
| 47694 | 136  | 
obtain A where "A \<in> sets M" "emeasure (density M D) A \<noteq> emeasure M A"  | 
| 61808 | 137  | 
using measure_eqI[of "density M D" M] \<open>density M D \<noteq> M\<close> by auto  | 
| 47694 | 138  | 
|
139  | 
  let ?D_set = "{x\<in>space M. D x \<noteq> 0}"
 | 
|
140  | 
have [simp, intro]: "?D_set \<in> sets M"  | 
|
141  | 
using D by auto  | 
|
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
142  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
143  | 
have D_neg: "(\<integral>\<^sup>+ x. ennreal (- D x) \<partial>M) = 0"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
144  | 
using D by (subst nn_integral_0_iff_AE) (auto simp: ennreal_neg)  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
145  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
146  | 
have "(\<integral>\<^sup>+ x. ennreal (D x) \<partial>M) = emeasure (density M D) (space M)"  | 
| 56996 | 147  | 
using D by (simp add: emeasure_density cong: nn_integral_cong)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
148  | 
then have D_pos: "(\<integral>\<^sup>+ x. ennreal (D x) \<partial>M) = 1"  | 
| 47694 | 149  | 
using N.emeasure_space_1 by simp  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
150  | 
|
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
151  | 
have "integrable M D"  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
152  | 
using D D_pos D_neg unfolding real_integrable_def real_lebesgue_integral_def by simp_all  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
153  | 
then have "integral\<^sup>L M D = 1"  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
154  | 
using D D_pos D_neg by (simp add: real_lebesgue_integral_def)  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
155  | 
|
| 47694 | 156  | 
have "0 \<le> 1 - measure M ?D_set"  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
157  | 
using prob_le_1 by (auto simp: field_simps)  | 
| 
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
158  | 
also have "\<dots> = (\<integral> x. D x - indicator ?D_set x \<partial>M)"  | 
| 61808 | 159  | 
using \<open>integrable M D\<close> \<open>integral\<^sup>L M D = 1\<close>  | 
| 47694 | 160  | 
by (simp add: emeasure_eq_measure)  | 
161  | 
also have "\<dots> < (\<integral> x. D x * (ln b * log b (D x)) \<partial>M)"  | 
|
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
162  | 
proof (rule integral_less_AE)  | 
| 
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
163  | 
show "integrable M (\<lambda>x. D x - indicator ?D_set x)"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
164  | 
using \<open>integrable M D\<close> by (auto simp: less_top[symmetric])  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
165  | 
next  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
166  | 
from integrable_mult_left(1)[OF int, of "ln b"]  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
167  | 
show "integrable M (\<lambda>x. D x * (ln b * log b (D x)))"  | 
| 47694 | 168  | 
by (simp add: ac_simps)  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
169  | 
next  | 
| 47694 | 170  | 
    show "emeasure M {x\<in>space M. D x \<noteq> 1 \<and> D x \<noteq> 0} \<noteq> 0"
 | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
171  | 
proof  | 
| 47694 | 172  | 
      assume eq_0: "emeasure M {x\<in>space M. D x \<noteq> 1 \<and> D x \<noteq> 0} = 0"
 | 
173  | 
then have disj: "AE x in M. D x = 1 \<or> D x = 0"  | 
|
| 
50244
 
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
 
immler 
parents: 
50003 
diff
changeset
 | 
174  | 
using D(1) by (auto intro!: AE_I[OF subset_refl] sets.sets_Collect)  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
175  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
176  | 
      have "emeasure M {x\<in>space M. D x = 1} = (\<integral>\<^sup>+ x. indicator {x\<in>space M. D x = 1} x \<partial>M)"
 | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
177  | 
using D(1) by auto  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
178  | 
also have "\<dots> = (\<integral>\<^sup>+ x. ennreal (D x) \<partial>M)"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
179  | 
using disj by (auto intro!: nn_integral_cong_AE simp: indicator_def one_ennreal_def)  | 
| 47694 | 180  | 
finally have "AE x in M. D x = 1"  | 
181  | 
using D D_pos by (intro AE_I_eq_1) auto  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
182  | 
then have "(\<integral>\<^sup>+x. indicator A x\<partial>M) = (\<integral>\<^sup>+x. ennreal (D x) * indicator A x\<partial>M)"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
183  | 
by (intro nn_integral_cong_AE) (auto simp: one_ennreal_def[symmetric])  | 
| 47694 | 184  | 
also have "\<dots> = density M D A"  | 
| 61808 | 185  | 
using \<open>A \<in> sets M\<close> D by (simp add: emeasure_density)  | 
186  | 
finally show False using \<open>A \<in> sets M\<close> \<open>emeasure (density M D) A \<noteq> emeasure M A\<close> by simp  | 
|
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
187  | 
qed  | 
| 
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
188  | 
    show "{x\<in>space M. D x \<noteq> 1 \<and> D x \<noteq> 0} \<in> sets M"
 | 
| 
50244
 
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
 
immler 
parents: 
50003 
diff
changeset
 | 
189  | 
using D(1) by (auto intro: sets.sets_Collect_conj)  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
190  | 
|
| 47694 | 191  | 
    show "AE t in M. t \<in> {x\<in>space M. D x \<noteq> 1 \<and> D x \<noteq> 0} \<longrightarrow>
 | 
192  | 
D t - indicator ?D_set t \<noteq> D t * (ln b * log b (D t))"  | 
|
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
193  | 
using D(2)  | 
| 47694 | 194  | 
proof (eventually_elim, safe)  | 
195  | 
fix t assume Dt: "t \<in> space M" "D t \<noteq> 1" "D t \<noteq> 0" "0 \<le> D t"  | 
|
196  | 
and eq: "D t - indicator ?D_set t = D t * (ln b * log b (D t))"  | 
|
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
197  | 
|
| 
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
198  | 
have "D t - 1 = D t - indicator ?D_set t"  | 
| 
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
199  | 
using Dt by simp  | 
| 
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
200  | 
also note eq  | 
| 47694 | 201  | 
also have "D t * (ln b * log b (D t)) = - D t * ln (1 / D t)"  | 
| 61808 | 202  | 
using b_gt_1 \<open>D t \<noteq> 0\<close> \<open>0 \<le> D t\<close>  | 
| 47694 | 203  | 
by (simp add: log_def ln_div less_le)  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
204  | 
finally have "ln (1 / D t) = 1 / D t - 1"  | 
| 61808 | 205  | 
using \<open>D t \<noteq> 0\<close> by (auto simp: field_simps)  | 
206  | 
from ln_eq_minus_one[OF _ this] \<open>D t \<noteq> 0\<close> \<open>0 \<le> D t\<close> \<open>D t \<noteq> 1\<close>  | 
|
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
207  | 
show False by auto  | 
| 
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
208  | 
qed  | 
| 
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
209  | 
|
| 47694 | 210  | 
show "AE t in M. D t - indicator ?D_set t \<le> D t * (ln b * log b (D t))"  | 
211  | 
using D(2) AE_space  | 
|
212  | 
proof eventually_elim  | 
|
213  | 
fix t assume "t \<in> space M" "0 \<le> D t"  | 
|
214  | 
show "D t - indicator ?D_set t \<le> D t * (ln b * log b (D t))"  | 
|
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
215  | 
proof cases  | 
| 
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
216  | 
assume asm: "D t \<noteq> 0"  | 
| 61808 | 217  | 
then have "0 < D t" using \<open>0 \<le> D t\<close> by auto  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
218  | 
then have "0 < 1 / D t" by auto  | 
| 
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
219  | 
have "D t - indicator ?D_set t \<le> - D t * (1 / D t - 1)"  | 
| 61808 | 220  | 
using asm \<open>t \<in> space M\<close> by (simp add: field_simps)  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
221  | 
also have "- D t * (1 / D t - 1) \<le> - D t * ln (1 / D t)"  | 
| 61808 | 222  | 
using ln_le_minus_one \<open>0 < 1 / D t\<close> by (intro mult_left_mono_neg) auto  | 
| 47694 | 223  | 
also have "\<dots> = D t * (ln b * log b (D t))"  | 
| 61808 | 224  | 
using \<open>0 < D t\<close> b_gt_1  | 
| 47694 | 225  | 
by (simp_all add: log_def ln_div)  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
226  | 
finally show ?thesis by simp  | 
| 
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
227  | 
qed simp  | 
| 
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
228  | 
qed  | 
| 
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
229  | 
qed  | 
| 47694 | 230  | 
also have "\<dots> = (\<integral> x. ln b * (D x * log b (D x)) \<partial>M)"  | 
231  | 
by (simp add: ac_simps)  | 
|
232  | 
also have "\<dots> = ln b * (\<integral> x. D x * log b (D x) \<partial>M)"  | 
|
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
233  | 
using int by simp  | 
| 47694 | 234  | 
finally show ?thesis  | 
235  | 
using b_gt_1 D by (subst KL_density) (auto simp: zero_less_mult_iff)  | 
|
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
236  | 
qed  | 
| 
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
237  | 
|
| 47694 | 238  | 
lemma (in sigma_finite_measure) KL_same_eq_0: "KL_divergence b M M = 0"  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
239  | 
proof -  | 
| 47694 | 240  | 
have "AE x in M. 1 = RN_deriv M M x"  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
241  | 
proof (rule RN_deriv_unique)  | 
| 47694 | 242  | 
show "density M (\<lambda>x. 1) = M"  | 
243  | 
apply (auto intro!: measure_eqI emeasure_density)  | 
|
244  | 
apply (subst emeasure_density)  | 
|
245  | 
apply auto  | 
|
246  | 
done  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
247  | 
qed auto  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
248  | 
then have "AE x in M. log b (enn2real (RN_deriv M M x)) = 0"  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
249  | 
by (elim AE_mp) simp  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
250  | 
from integral_cong_AE[OF _ _ this]  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
251  | 
have "integral\<^sup>L M (entropy_density b M M) = 0"  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
252  | 
by (simp add: entropy_density_def comp_def)  | 
| 47694 | 253  | 
then show "KL_divergence b M M = 0"  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
254  | 
unfolding KL_divergence_def  | 
| 47694 | 255  | 
by auto  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
256  | 
qed  | 
| 
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
257  | 
|
| 47694 | 258  | 
lemma (in information_space) KL_eq_0_iff_eq:  | 
259  | 
fixes D :: "'a \<Rightarrow> real"  | 
|
260  | 
assumes "prob_space (density M D)"  | 
|
261  | 
assumes D: "D \<in> borel_measurable M" "AE x in M. 0 \<le> D x"  | 
|
262  | 
assumes int: "integrable M (\<lambda>x. D x * log b (D x))"  | 
|
263  | 
shows "KL_divergence b M (density M D) = 0 \<longleftrightarrow> density M D = M"  | 
|
264  | 
using KL_same_eq_0[of b] KL_gt_0[OF assms]  | 
|
265  | 
by (auto simp: less_le)  | 
|
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
266  | 
|
| 47694 | 267  | 
lemma (in information_space) KL_eq_0_iff_eq_ac:  | 
268  | 
fixes D :: "'a \<Rightarrow> real"  | 
|
269  | 
assumes "prob_space N"  | 
|
270  | 
assumes ac: "absolutely_continuous M N" "sets N = sets M"  | 
|
271  | 
assumes int: "integrable N (entropy_density b M N)"  | 
|
272  | 
shows "KL_divergence b M N = 0 \<longleftrightarrow> N = M"  | 
|
| 
41833
 
563bea92b2c0
add lemma KL_divergence_vimage, mutual_information_generic
 
hoelzl 
parents: 
41689 
diff
changeset
 | 
273  | 
proof -  | 
| 47694 | 274  | 
interpret N: prob_space N by fact  | 
275  | 
have "finite_measure N" by unfold_locales  | 
|
| 74362 | 276  | 
from real_RN_deriv[OF this ac] obtain D  | 
277  | 
where D:  | 
|
278  | 
"random_variable borel D"  | 
|
279  | 
"AE x in M. RN_deriv M N x = ennreal (D x)"  | 
|
280  | 
"AE x in N. 0 < D x"  | 
|
281  | 
"\<And>x. 0 \<le> D x"  | 
|
282  | 
by this auto  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
283  | 
|
| 47694 | 284  | 
have "N = density M (RN_deriv M N)"  | 
285  | 
using ac by (rule density_RN_deriv[symmetric])  | 
|
286  | 
also have "\<dots> = density M D"  | 
|
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
287  | 
using D by (auto intro!: density_cong)  | 
| 47694 | 288  | 
finally have N: "N = density M D" .  | 
| 
41833
 
563bea92b2c0
add lemma KL_divergence_vimage, mutual_information_generic
 
hoelzl 
parents: 
41689 
diff
changeset
 | 
289  | 
|
| 47694 | 290  | 
from absolutely_continuous_AE[OF ac(2,1) D(2)] D b_gt_1 ac measurable_entropy_density  | 
291  | 
have "integrable N (\<lambda>x. log b (D x))"  | 
|
292  | 
by (intro integrable_cong_AE[THEN iffD2, OF _ _ _ int])  | 
|
293  | 
(auto simp: N entropy_density_def)  | 
|
294  | 
with D b_gt_1 have "integrable M (\<lambda>x. D x * log b (D x))"  | 
|
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
295  | 
by (subst integrable_real_density[symmetric]) (auto simp: N[symmetric] comp_def)  | 
| 61808 | 296  | 
with \<open>prob_space N\<close> D show ?thesis  | 
| 47694 | 297  | 
unfolding N  | 
298  | 
by (intro KL_eq_0_iff_eq) auto  | 
|
| 
41833
 
563bea92b2c0
add lemma KL_divergence_vimage, mutual_information_generic
 
hoelzl 
parents: 
41689 
diff
changeset
 | 
299  | 
qed  | 
| 
 
563bea92b2c0
add lemma KL_divergence_vimage, mutual_information_generic
 
hoelzl 
parents: 
41689 
diff
changeset
 | 
300  | 
|
| 47694 | 301  | 
lemma (in information_space) KL_nonneg:  | 
302  | 
assumes "prob_space (density M D)"  | 
|
303  | 
assumes D: "D \<in> borel_measurable M" "AE x in M. 0 \<le> D x"  | 
|
304  | 
assumes int: "integrable M (\<lambda>x. D x * log b (D x))"  | 
|
305  | 
shows "0 \<le> KL_divergence b M (density M D)"  | 
|
306  | 
using KL_gt_0[OF assms] by (cases "density M D = M") (auto simp: KL_same_eq_0)  | 
|
| 40859 | 307  | 
|
| 47694 | 308  | 
lemma (in sigma_finite_measure) KL_density_density_nonneg:  | 
309  | 
fixes f g :: "'a \<Rightarrow> real"  | 
|
310  | 
assumes "1 < b"  | 
|
311  | 
assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x" "prob_space (density M f)"  | 
|
312  | 
assumes g: "g \<in> borel_measurable M" "AE x in M. 0 \<le> g x" "prob_space (density M g)"  | 
|
313  | 
assumes ac: "AE x in M. f x = 0 \<longrightarrow> g x = 0"  | 
|
314  | 
assumes int: "integrable M (\<lambda>x. g x * log b (g x / f x))"  | 
|
315  | 
shows "0 \<le> KL_divergence b (density M f) (density M g)"  | 
|
316  | 
proof -  | 
|
317  | 
interpret Mf: prob_space "density M f" by fact  | 
|
| 61169 | 318  | 
interpret Mf: information_space "density M f" b by standard fact  | 
| 47694 | 319  | 
have eq: "density (density M f) (\<lambda>x. g x / f x) = density M g" (is "?DD = _")  | 
320  | 
using f g ac by (subst density_density_divide) simp_all  | 
|
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
321  | 
|
| 47694 | 322  | 
have "0 \<le> KL_divergence b (density M f) (density (density M f) (\<lambda>x. g x / f x))"  | 
323  | 
proof (rule Mf.KL_nonneg)  | 
|
324  | 
show "prob_space ?DD" unfolding eq by fact  | 
|
325  | 
from f g show "(\<lambda>x. g x / f x) \<in> borel_measurable (density M f)"  | 
|
326  | 
by auto  | 
|
327  | 
show "AE x in density M f. 0 \<le> g x / f x"  | 
|
| 
56571
 
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
 
hoelzl 
parents: 
56544 
diff
changeset
 | 
328  | 
using f g by (auto simp: AE_density)  | 
| 47694 | 329  | 
show "integrable (density M f) (\<lambda>x. g x / f x * log b (g x / f x))"  | 
| 61808 | 330  | 
using \<open>1 < b\<close> f g ac  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
331  | 
by (subst integrable_density)  | 
| 47694 | 332  | 
(auto intro!: integrable_cong_AE[THEN iffD2, OF _ _ _ int] measurable_If)  | 
333  | 
qed  | 
|
334  | 
also have "\<dots> = KL_divergence b (density M f) (density M g)"  | 
|
335  | 
using f g ac by (subst density_density_divide) simp_all  | 
|
336  | 
finally show ?thesis .  | 
|
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
337  | 
qed  | 
| 
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
338  | 
|
| 61808 | 339  | 
subsection \<open>Finite Entropy\<close>  | 
| 49803 | 340  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
341  | 
definition (in information_space) finite_entropy :: "'b measure \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('b \<Rightarrow> real) \<Rightarrow> bool"
 | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
342  | 
where  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
343  | 
"finite_entropy S X f \<longleftrightarrow>  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
344  | 
distributed M S X f \<and>  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
345  | 
integrable S (\<lambda>x. f x * log b (f x)) \<and>  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
346  | 
(\<forall>x\<in>space S. 0 \<le> f x)"  | 
| 49803 | 347  | 
|
348  | 
lemma (in information_space) finite_entropy_simple_function:  | 
|
349  | 
assumes X: "simple_function M X"  | 
|
350  | 
  shows "finite_entropy (count_space (X`space M)) X (\<lambda>a. measure M {x \<in> space M. X x = a})"
 | 
|
351  | 
unfolding finite_entropy_def  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
352  | 
proof safe  | 
| 49803 | 353  | 
have [simp]: "finite (X ` space M)"  | 
354  | 
using X by (auto simp: simple_function_def)  | 
|
355  | 
then show "integrable (count_space (X ` space M))  | 
|
356  | 
     (\<lambda>x. prob {xa \<in> space M. X xa = x} * log b (prob {xa \<in> space M. X xa = x}))"
 | 
|
357  | 
by (rule integrable_count_space)  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
358  | 
  have d: "distributed M (count_space (X ` space M)) X (\<lambda>x. ennreal (if x \<in> X`space M then prob {xa \<in> space M. X xa = x} else 0))"
 | 
| 49803 | 359  | 
by (rule distributed_simple_function_superset[OF X]) (auto intro!: arg_cong[where f=prob])  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
360  | 
  show "distributed M (count_space (X ` space M)) X (\<lambda>x. ennreal (prob {xa \<in> space M. X xa = x}))"
 | 
| 49803 | 361  | 
by (rule distributed_cong_density[THEN iffD1, OF _ _ _ d]) auto  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
362  | 
qed (rule measure_nonneg)  | 
| 49803 | 363  | 
|
364  | 
lemma ac_fst:  | 
|
365  | 
assumes "sigma_finite_measure T"  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
366  | 
shows "absolutely_continuous S (distr (S \<Otimes>\<^sub>M T) S fst)"  | 
| 49803 | 367  | 
proof -  | 
368  | 
interpret sigma_finite_measure T by fact  | 
|
| 
53374
 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 
wenzelm 
parents: 
53015 
diff
changeset
 | 
369  | 
  { fix A assume A: "A \<in> sets S" "emeasure S A = 0"
 | 
| 
 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 
wenzelm 
parents: 
53015 
diff
changeset
 | 
370  | 
then have "fst -` A \<inter> space (S \<Otimes>\<^sub>M T) = A \<times> space T"  | 
| 
50244
 
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
 
immler 
parents: 
50003 
diff
changeset
 | 
371  | 
by (auto simp: space_pair_measure dest!: sets.sets_into_space)  | 
| 
53374
 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 
wenzelm 
parents: 
53015 
diff
changeset
 | 
372  | 
with A have "emeasure (S \<Otimes>\<^sub>M T) (fst -` A \<inter> space (S \<Otimes>\<^sub>M T)) = 0"  | 
| 49803 | 373  | 
by (simp add: emeasure_pair_measure_Times) }  | 
374  | 
then show ?thesis  | 
|
375  | 
unfolding absolutely_continuous_def  | 
|
376  | 
apply (auto simp: null_sets_distr_iff)  | 
|
377  | 
apply (auto simp: null_sets_def intro!: measurable_sets)  | 
|
378  | 
done  | 
|
379  | 
qed  | 
|
380  | 
||
381  | 
lemma ac_snd:  | 
|
382  | 
assumes "sigma_finite_measure T"  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
383  | 
shows "absolutely_continuous T (distr (S \<Otimes>\<^sub>M T) T snd)"  | 
| 49803 | 384  | 
proof -  | 
385  | 
interpret sigma_finite_measure T by fact  | 
|
| 
53374
 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 
wenzelm 
parents: 
53015 
diff
changeset
 | 
386  | 
  { fix A assume A: "A \<in> sets T" "emeasure T A = 0"
 | 
| 
 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 
wenzelm 
parents: 
53015 
diff
changeset
 | 
387  | 
then have "snd -` A \<inter> space (S \<Otimes>\<^sub>M T) = space S \<times> A"  | 
| 
50244
 
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
 
immler 
parents: 
50003 
diff
changeset
 | 
388  | 
by (auto simp: space_pair_measure dest!: sets.sets_into_space)  | 
| 
53374
 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 
wenzelm 
parents: 
53015 
diff
changeset
 | 
389  | 
with A have "emeasure (S \<Otimes>\<^sub>M T) (snd -` A \<inter> space (S \<Otimes>\<^sub>M T)) = 0"  | 
| 49803 | 390  | 
by (simp add: emeasure_pair_measure_Times) }  | 
391  | 
then show ?thesis  | 
|
392  | 
unfolding absolutely_continuous_def  | 
|
393  | 
apply (auto simp: null_sets_distr_iff)  | 
|
394  | 
apply (auto simp: null_sets_def intro!: measurable_sets)  | 
|
395  | 
done  | 
|
396  | 
qed  | 
|
397  | 
||
398  | 
lemma (in information_space) finite_entropy_integrable:  | 
|
399  | 
"finite_entropy S X Px \<Longrightarrow> integrable S (\<lambda>x. Px x * log b (Px x))"  | 
|
400  | 
unfolding finite_entropy_def by auto  | 
|
401  | 
||
402  | 
lemma (in information_space) finite_entropy_distributed:  | 
|
403  | 
"finite_entropy S X Px \<Longrightarrow> distributed M S X Px"  | 
|
404  | 
unfolding finite_entropy_def by auto  | 
|
405  | 
||
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
406  | 
lemma (in information_space) finite_entropy_nn:  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
407  | 
"finite_entropy S X Px \<Longrightarrow> x \<in> space S \<Longrightarrow> 0 \<le> Px x"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
408  | 
by (auto simp: finite_entropy_def)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
409  | 
|
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
410  | 
lemma (in information_space) finite_entropy_measurable:  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
411  | 
"finite_entropy S X Px \<Longrightarrow> Px \<in> S \<rightarrow>\<^sub>M borel"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
412  | 
using distributed_real_measurable[of S Px M X]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
413  | 
finite_entropy_nn[of S X Px] finite_entropy_distributed[of S X Px] by auto  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
414  | 
|
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
415  | 
lemma (in information_space) subdensity_finite_entropy:  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
416  | 
fixes g :: "'b \<Rightarrow> real" and f :: "'c \<Rightarrow> real"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
417  | 
assumes T: "T \<in> measurable P Q"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
418  | 
assumes f: "finite_entropy P X f"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
419  | 
assumes g: "finite_entropy Q Y g"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
420  | 
assumes Y: "Y = T \<circ> X"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
421  | 
shows "AE x in P. g (T x) = 0 \<longrightarrow> f x = 0"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
422  | 
using subdensity[OF T, of M X "\<lambda>x. ennreal (f x)" Y "\<lambda>x. ennreal (g x)"]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
423  | 
finite_entropy_distributed[OF f] finite_entropy_distributed[OF g]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
424  | 
finite_entropy_nn[OF f] finite_entropy_nn[OF g]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
425  | 
assms  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
426  | 
by auto  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
427  | 
|
| 49803 | 428  | 
lemma (in information_space) finite_entropy_integrable_transform:  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
429  | 
"finite_entropy S X Px \<Longrightarrow> distributed M T Y Py \<Longrightarrow> (\<And>x. x \<in> space T \<Longrightarrow> 0 \<le> Py x) \<Longrightarrow>  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
430  | 
X = (\<lambda>x. f (Y x)) \<Longrightarrow> f \<in> measurable T S \<Longrightarrow> integrable T (\<lambda>x. Py x * log b (Px (f x)))"  | 
| 49803 | 431  | 
using distributed_transform_integrable[of M T Y Py S X Px f "\<lambda>x. log b (Px x)"]  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
432  | 
using distributed_real_measurable[of S Px M X]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
433  | 
by (auto simp: finite_entropy_def)  | 
| 49803 | 434  | 
|
| 61808 | 435  | 
subsection \<open>Mutual Information\<close>  | 
| 39097 | 436  | 
|
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
437  | 
definition (in prob_space)  | 
| 38656 | 438  | 
"mutual_information b S T X Y =  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
439  | 
KL_divergence b (distr M S X \<Otimes>\<^sub>M distr M T Y) (distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)))"  | 
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
440  | 
|
| 47694 | 441  | 
lemma (in information_space) mutual_information_indep_vars:  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
442  | 
fixes S T X Y  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
443  | 
defines "P \<equiv> distr M S X \<Otimes>\<^sub>M distr M T Y"  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
444  | 
defines "Q \<equiv> distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))"  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
445  | 
shows "indep_var S X T Y \<longleftrightarrow>  | 
| 
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
446  | 
(random_variable S X \<and> random_variable T Y \<and>  | 
| 47694 | 447  | 
absolutely_continuous P Q \<and> integrable Q (entropy_density b P Q) \<and>  | 
448  | 
mutual_information b S T X Y = 0)"  | 
|
449  | 
unfolding indep_var_distribution_eq  | 
|
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
450  | 
proof safe  | 
| 50003 | 451  | 
assume rv[measurable]: "random_variable S X" "random_variable T Y"  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
452  | 
|
| 47694 | 453  | 
interpret X: prob_space "distr M S X"  | 
454  | 
by (rule prob_space_distr) fact  | 
|
455  | 
interpret Y: prob_space "distr M T Y"  | 
|
456  | 
by (rule prob_space_distr) fact  | 
|
| 61169 | 457  | 
interpret XY: pair_prob_space "distr M S X" "distr M T Y" by standard  | 
458  | 
interpret P: information_space P b unfolding P_def by standard (rule b_gt_1)  | 
|
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
459  | 
|
| 47694 | 460  | 
interpret Q: prob_space Q unfolding Q_def  | 
| 50003 | 461  | 
by (rule prob_space_distr) simp  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
462  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
463  | 
  { assume "distr M S X \<Otimes>\<^sub>M distr M T Y = distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))"
 | 
| 47694 | 464  | 
then have [simp]: "Q = P" unfolding Q_def P_def by simp  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
465  | 
|
| 47694 | 466  | 
show ac: "absolutely_continuous P Q" by (simp add: absolutely_continuous_def)  | 
467  | 
then have ed: "entropy_density b P Q \<in> borel_measurable P"  | 
|
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
468  | 
by simp  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
469  | 
|
| 47694 | 470  | 
have "AE x in P. 1 = RN_deriv P Q x"  | 
471  | 
proof (rule P.RN_deriv_unique)  | 
|
472  | 
show "density P (\<lambda>x. 1) = Q"  | 
|
| 61808 | 473  | 
unfolding \<open>Q = P\<close> by (intro measure_eqI) (auto simp: emeasure_density)  | 
| 47694 | 474  | 
qed auto  | 
475  | 
then have ae_0: "AE x in P. entropy_density b P Q x = 0"  | 
|
476  | 
by eventually_elim (auto simp: entropy_density_def)  | 
|
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
477  | 
then have "integrable P (entropy_density b P Q) \<longleftrightarrow> integrable Q (\<lambda>x. 0::real)"  | 
| 61808 | 478  | 
using ed unfolding \<open>Q = P\<close> by (intro integrable_cong_AE) auto  | 
| 47694 | 479  | 
then show "integrable Q (entropy_density b P Q)" by simp  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
480  | 
|
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
481  | 
from ae_0 have "mutual_information b S T X Y = (\<integral>x. 0 \<partial>P)"  | 
| 61808 | 482  | 
unfolding mutual_information_def KL_divergence_def P_def[symmetric] Q_def[symmetric] \<open>Q = P\<close>  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
483  | 
by (intro integral_cong_AE) auto  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
484  | 
then show "mutual_information b S T X Y = 0"  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
485  | 
by simp }  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
486  | 
|
| 47694 | 487  | 
  { assume ac: "absolutely_continuous P Q"
 | 
488  | 
assume int: "integrable Q (entropy_density b P Q)"  | 
|
489  | 
assume I_eq_0: "mutual_information b S T X Y = 0"  | 
|
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
490  | 
|
| 47694 | 491  | 
have eq: "Q = P"  | 
492  | 
proof (rule P.KL_eq_0_iff_eq_ac[THEN iffD1])  | 
|
493  | 
show "prob_space Q" by unfold_locales  | 
|
494  | 
show "absolutely_continuous P Q" by fact  | 
|
495  | 
show "integrable Q (entropy_density b P Q)" by fact  | 
|
496  | 
show "sets Q = sets P" by (simp add: P_def Q_def sets_pair_measure)  | 
|
497  | 
show "KL_divergence b P Q = 0"  | 
|
498  | 
using I_eq_0 unfolding mutual_information_def by (simp add: P_def Q_def)  | 
|
499  | 
qed  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
500  | 
then show "distr M S X \<Otimes>\<^sub>M distr M T Y = distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))"  | 
| 47694 | 501  | 
unfolding P_def Q_def .. }  | 
| 
43340
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
502  | 
qed  | 
| 
 
60e181c4eae4
lemma: independence is equal to mutual information = 0
 
hoelzl 
parents: 
42148 
diff
changeset
 | 
503  | 
|
| 40859 | 504  | 
abbreviation (in information_space)  | 
505  | 
  mutual_information_Pow ("\<I>'(_ ; _')") where
 | 
|
| 47694 | 506  | 
"\<I>(X ; Y) \<equiv> mutual_information b (count_space (X`space M)) (count_space (Y`space M)) X Y"  | 
| 
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
 | 
507  | 
|
| 47694 | 508  | 
lemma (in information_space)  | 
509  | 
fixes Pxy :: "'b \<times> 'c \<Rightarrow> real" and Px :: "'b \<Rightarrow> real" and Py :: "'c \<Rightarrow> real"  | 
|
| 49803 | 510  | 
assumes S: "sigma_finite_measure S" and T: "sigma_finite_measure T"  | 
511  | 
assumes Fx: "finite_entropy S X Px" and Fy: "finite_entropy T Y Py"  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
512  | 
assumes Fxy: "finite_entropy (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) Pxy"  | 
| 49803 | 513  | 
defines "f \<equiv> \<lambda>x. Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x)))"  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
514  | 
shows mutual_information_distr': "mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f" (is "?M = ?R")  | 
| 49803 | 515  | 
and mutual_information_nonneg': "0 \<le> mutual_information b S T X Y"  | 
516  | 
proof -  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
517  | 
have Px: "distributed M S X Px" and Px_nn: "\<And>x. x \<in> space S \<Longrightarrow> 0 \<le> Px x"  | 
| 49803 | 518  | 
using Fx by (auto simp: finite_entropy_def)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
519  | 
have Py: "distributed M T Y Py" and Py_nn: "\<And>x. x \<in> space T \<Longrightarrow> 0 \<le> Py x"  | 
| 49803 | 520  | 
using Fy by (auto simp: finite_entropy_def)  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
521  | 
have Pxy: "distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) Pxy"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
522  | 
and Pxy_nn: "\<And>x. x \<in> space (S \<Otimes>\<^sub>M T) \<Longrightarrow> 0 \<le> Pxy x"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
523  | 
"\<And>x y. x \<in> space S \<Longrightarrow> y \<in> space T \<Longrightarrow> 0 \<le> Pxy (x, y)"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
524  | 
using Fxy by (auto simp: finite_entropy_def space_pair_measure)  | 
| 49803 | 525  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
526  | 
have [measurable]: "Px \<in> S \<rightarrow>\<^sub>M borel"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
527  | 
using Px Px_nn by (intro distributed_real_measurable)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
528  | 
have [measurable]: "Py \<in> T \<rightarrow>\<^sub>M borel"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
529  | 
using Py Py_nn by (intro distributed_real_measurable)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
530  | 
have measurable_Pxy[measurable]: "Pxy \<in> (S \<Otimes>\<^sub>M T) \<rightarrow>\<^sub>M borel"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
531  | 
using Pxy Pxy_nn by (intro distributed_real_measurable) (auto simp: space_pair_measure)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
532  | 
|
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
533  | 
have X[measurable]: "random_variable S X"  | 
| 50003 | 534  | 
using Px by auto  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
535  | 
have Y[measurable]: "random_variable T Y"  | 
| 50003 | 536  | 
using Py by auto  | 
| 49803 | 537  | 
interpret S: sigma_finite_measure S by fact  | 
538  | 
interpret T: sigma_finite_measure T by fact  | 
|
539  | 
interpret ST: pair_sigma_finite S T ..  | 
|
540  | 
interpret X: prob_space "distr M S X" using X by (rule prob_space_distr)  | 
|
541  | 
interpret Y: prob_space "distr M T Y" using Y by (rule prob_space_distr)  | 
|
542  | 
interpret XY: pair_prob_space "distr M S X" "distr M T Y" ..  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
543  | 
let ?P = "S \<Otimes>\<^sub>M T"  | 
| 49803 | 544  | 
let ?D = "distr M ?P (\<lambda>x. (X x, Y x))"  | 
545  | 
||
546  | 
  { fix A assume "A \<in> sets S"
 | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
547  | 
with X[THEN measurable_space] Y[THEN measurable_space]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
548  | 
have "emeasure (distr M S X) A = emeasure ?D (A \<times> space T)"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
549  | 
by (auto simp: emeasure_distr intro!: arg_cong[where f="emeasure M"]) }  | 
| 49803 | 550  | 
note marginal_eq1 = this  | 
551  | 
  { fix A assume "A \<in> sets T"
 | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
552  | 
with X[THEN measurable_space] Y[THEN measurable_space]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
553  | 
have "emeasure (distr M T Y) A = emeasure ?D (space S \<times> A)"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
554  | 
by (auto simp: emeasure_distr intro!: arg_cong[where f="emeasure M"]) }  | 
| 49803 | 555  | 
note marginal_eq2 = this  | 
556  | 
||
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
557  | 
have distr_eq: "distr M S X \<Otimes>\<^sub>M distr M T Y = density ?P (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
558  | 
unfolding Px(1)[THEN distributed_distr_eq_density] Py(1)[THEN distributed_distr_eq_density]  | 
| 49803 | 559  | 
proof (subst pair_measure_density)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
560  | 
show "(\<lambda>x. ennreal (Px x)) \<in> borel_measurable S" "(\<lambda>y. ennreal (Py y)) \<in> borel_measurable T"  | 
| 49803 | 561  | 
using Px Py by (auto simp: distributed_def)  | 
562  | 
show "sigma_finite_measure (density T Py)" unfolding Py(1)[THEN distributed_distr_eq_density, symmetric] ..  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
563  | 
show "density (S \<Otimes>\<^sub>M T) (\<lambda>(x, y). ennreal (Px x) * ennreal (Py y)) =  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
564  | 
density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
565  | 
using Px_nn Py_nn by (auto intro!: density_cong simp: distributed_def ennreal_mult space_pair_measure)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
566  | 
qed fact  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
567  | 
|
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
568  | 
have M: "?M = KL_divergence b (density ?P (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))) (density ?P (\<lambda>x. ennreal (Pxy x)))"  | 
| 49803 | 569  | 
unfolding mutual_information_def distr_eq Pxy(1)[THEN distributed_distr_eq_density] ..  | 
570  | 
||
571  | 
from Px Py have f: "(\<lambda>x. Px (fst x) * Py (snd x)) \<in> borel_measurable ?P"  | 
|
572  | 
by (intro borel_measurable_times) (auto intro: distributed_real_measurable measurable_fst'' measurable_snd'')  | 
|
573  | 
have PxPy_nonneg: "AE x in ?P. 0 \<le> Px (fst x) * Py (snd x)"  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
574  | 
using Px_nn Py_nn by (auto simp: space_pair_measure)  | 
| 49803 | 575  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
576  | 
have A: "(AE x in ?P. Px (fst x) = 0 \<longrightarrow> Pxy x = 0)"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
577  | 
by (rule subdensity_real[OF measurable_fst Pxy Px]) (insert Px_nn Pxy_nn, auto simp: space_pair_measure)  | 
| 49803 | 578  | 
moreover  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
579  | 
have B: "(AE x in ?P. Py (snd x) = 0 \<longrightarrow> Pxy x = 0)"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
580  | 
by (rule subdensity_real[OF measurable_snd Pxy Py]) (insert Py_nn Pxy_nn, auto simp: space_pair_measure)  | 
| 49803 | 581  | 
ultimately have ac: "AE x in ?P. Px (fst x) * Py (snd x) = 0 \<longrightarrow> Pxy x = 0"  | 
582  | 
by eventually_elim auto  | 
|
583  | 
||
584  | 
show "?M = ?R"  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
585  | 
unfolding M f_def using Pxy_nn Px_nn Py_nn  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
586  | 
by (intro ST.KL_density_density b_gt_1 f PxPy_nonneg ac) (auto simp: space_pair_measure)  | 
| 49803 | 587  | 
|
588  | 
have X: "X = fst \<circ> (\<lambda>x. (X x, Y x))" and Y: "Y = snd \<circ> (\<lambda>x. (X x, Y x))"  | 
|
589  | 
by auto  | 
|
590  | 
||
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
591  | 
have "integrable (S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Pxy x) - Pxy x * log b (Px (fst x)) - Pxy x * log b (Py (snd x)))"  | 
| 49803 | 592  | 
using finite_entropy_integrable[OF Fxy]  | 
593  | 
using finite_entropy_integrable_transform[OF Fx Pxy, of fst]  | 
|
594  | 
using finite_entropy_integrable_transform[OF Fy Pxy, of snd]  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
595  | 
by (simp add: Pxy_nn)  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
596  | 
moreover have "f \<in> borel_measurable (S \<Otimes>\<^sub>M T)"  | 
| 49803 | 597  | 
unfolding f_def using Px Py Pxy  | 
598  | 
by (auto intro: distributed_real_measurable measurable_fst'' measurable_snd''  | 
|
599  | 
intro!: borel_measurable_times borel_measurable_log borel_measurable_divide)  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
600  | 
ultimately have int: "integrable (S \<Otimes>\<^sub>M T) f"  | 
| 49803 | 601  | 
apply (rule integrable_cong_AE_imp)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
602  | 
using A B AE_space  | 
| 49803 | 603  | 
by eventually_elim  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
604  | 
(auto simp: f_def log_divide_eq log_mult_eq field_simps space_pair_measure Px_nn Py_nn Pxy_nn  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
605  | 
less_le)  | 
| 49803 | 606  | 
|
607  | 
show "0 \<le> ?M" unfolding M  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
608  | 
proof (intro ST.KL_density_density_nonneg)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
609  | 
show "prob_space (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Pxy x))) "  | 
| 49803 | 610  | 
unfolding distributed_distr_eq_density[OF Pxy, symmetric]  | 
611  | 
using distributed_measurable[OF Pxy] by (rule prob_space_distr)  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
612  | 
show "prob_space (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x))))"  | 
| 49803 | 613  | 
unfolding distr_eq[symmetric] by unfold_locales  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
614  | 
show "integrable (S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x))))"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
615  | 
using int unfolding f_def .  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
616  | 
qed (insert ac, auto simp: b_gt_1 Px_nn Py_nn Pxy_nn space_pair_measure)  | 
| 49803 | 617  | 
qed  | 
618  | 
||
619  | 
lemma (in information_space)  | 
|
620  | 
fixes Pxy :: "'b \<times> 'c \<Rightarrow> real" and Px :: "'b \<Rightarrow> real" and Py :: "'c \<Rightarrow> real"  | 
|
| 47694 | 621  | 
assumes "sigma_finite_measure S" "sigma_finite_measure T"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
622  | 
assumes Px: "distributed M S X Px" and Px_nn: "\<And>x. x \<in> space S \<Longrightarrow> 0 \<le> Px x"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
623  | 
and Py: "distributed M T Y Py" and Py_nn: "\<And>y. y \<in> space T \<Longrightarrow> 0 \<le> Py y"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
624  | 
and Pxy: "distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) Pxy"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
625  | 
and Pxy_nn: "\<And>x y. x \<in> space S \<Longrightarrow> y \<in> space T \<Longrightarrow> 0 \<le> Pxy (x, y)"  | 
| 47694 | 626  | 
defines "f \<equiv> \<lambda>x. Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x)))"  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
627  | 
shows mutual_information_distr: "mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f" (is "?M = ?R")  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
628  | 
and mutual_information_nonneg: "integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y"  | 
| 40859 | 629  | 
proof -  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
630  | 
have X[measurable]: "random_variable S X"  | 
| 47694 | 631  | 
using Px by (auto simp: distributed_def)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
632  | 
have Y[measurable]: "random_variable T Y"  | 
| 47694 | 633  | 
using Py by (auto simp: distributed_def)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
634  | 
have [measurable]: "Px \<in> S \<rightarrow>\<^sub>M borel"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
635  | 
using Px Px_nn by (intro distributed_real_measurable)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
636  | 
have [measurable]: "Py \<in> T \<rightarrow>\<^sub>M borel"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
637  | 
using Py Py_nn by (intro distributed_real_measurable)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
638  | 
have measurable_Pxy[measurable]: "Pxy \<in> (S \<Otimes>\<^sub>M T) \<rightarrow>\<^sub>M borel"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
639  | 
using Pxy Pxy_nn by (intro distributed_real_measurable) (auto simp: space_pair_measure)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
640  | 
|
| 47694 | 641  | 
interpret S: sigma_finite_measure S by fact  | 
642  | 
interpret T: sigma_finite_measure T by fact  | 
|
643  | 
interpret ST: pair_sigma_finite S T ..  | 
|
644  | 
interpret X: prob_space "distr M S X" using X by (rule prob_space_distr)  | 
|
645  | 
interpret Y: prob_space "distr M T Y" using Y by (rule prob_space_distr)  | 
|
646  | 
interpret XY: pair_prob_space "distr M S X" "distr M T Y" ..  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
647  | 
let ?P = "S \<Otimes>\<^sub>M T"  | 
| 47694 | 648  | 
let ?D = "distr M ?P (\<lambda>x. (X x, Y x))"  | 
649  | 
||
650  | 
  { fix A assume "A \<in> sets S"
 | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
651  | 
with X[THEN measurable_space] Y[THEN measurable_space]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
652  | 
have "emeasure (distr M S X) A = emeasure ?D (A \<times> space T)"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
653  | 
by (auto simp: emeasure_distr intro!: arg_cong[where f="emeasure M"]) }  | 
| 47694 | 654  | 
note marginal_eq1 = this  | 
655  | 
  { fix A assume "A \<in> sets T"
 | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
656  | 
with X[THEN measurable_space] Y[THEN measurable_space]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
657  | 
have "emeasure (distr M T Y) A = emeasure ?D (space S \<times> A)"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
658  | 
by (auto simp: emeasure_distr intro!: arg_cong[where f="emeasure M"]) }  | 
| 47694 | 659  | 
note marginal_eq2 = this  | 
660  | 
||
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
661  | 
have distr_eq: "distr M S X \<Otimes>\<^sub>M distr M T Y = density ?P (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
662  | 
unfolding Px(1)[THEN distributed_distr_eq_density] Py(1)[THEN distributed_distr_eq_density]  | 
| 47694 | 663  | 
proof (subst pair_measure_density)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
664  | 
show "(\<lambda>x. ennreal (Px x)) \<in> borel_measurable S" "(\<lambda>y. ennreal (Py y)) \<in> borel_measurable T"  | 
| 47694 | 665  | 
using Px Py by (auto simp: distributed_def)  | 
666  | 
show "sigma_finite_measure (density T Py)" unfolding Py(1)[THEN distributed_distr_eq_density, symmetric] ..  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
667  | 
show "density (S \<Otimes>\<^sub>M T) (\<lambda>(x, y). ennreal (Px x) * ennreal (Py y)) =  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
668  | 
density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
669  | 
using Px_nn Py_nn by (auto intro!: density_cong simp: distributed_def ennreal_mult space_pair_measure)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
670  | 
qed fact  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
671  | 
|
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
672  | 
have M: "?M = KL_divergence b (density ?P (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))) (density ?P (\<lambda>x. ennreal (Pxy x)))"  | 
| 47694 | 673  | 
unfolding mutual_information_def distr_eq Pxy(1)[THEN distributed_distr_eq_density] ..  | 
674  | 
||
675  | 
from Px Py have f: "(\<lambda>x. Px (fst x) * Py (snd x)) \<in> borel_measurable ?P"  | 
|
676  | 
by (intro borel_measurable_times) (auto intro: distributed_real_measurable measurable_fst'' measurable_snd'')  | 
|
677  | 
have PxPy_nonneg: "AE x in ?P. 0 \<le> Px (fst x) * Py (snd x)"  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
678  | 
using Px_nn Py_nn by (auto simp: space_pair_measure)  | 
| 47694 | 679  | 
|
680  | 
have "(AE x in ?P. Px (fst x) = 0 \<longrightarrow> Pxy x = 0)"  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
681  | 
by (rule subdensity_real[OF measurable_fst Pxy Px]) (insert Px_nn Pxy_nn, auto simp: space_pair_measure)  | 
| 47694 | 682  | 
moreover  | 
683  | 
have "(AE x in ?P. Py (snd x) = 0 \<longrightarrow> Pxy x = 0)"  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
684  | 
by (rule subdensity_real[OF measurable_snd Pxy Py]) (insert Py_nn Pxy_nn, auto simp: space_pair_measure)  | 
| 47694 | 685  | 
ultimately have ac: "AE x in ?P. Px (fst x) * Py (snd x) = 0 \<longrightarrow> Pxy x = 0"  | 
686  | 
by eventually_elim auto  | 
|
687  | 
||
688  | 
show "?M = ?R"  | 
|
689  | 
unfolding M f_def  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
690  | 
using b_gt_1 f PxPy_nonneg ac Pxy_nn  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
691  | 
by (intro ST.KL_density_density) (auto simp: space_pair_measure)  | 
| 47694 | 692  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
693  | 
assume int: "integrable (S \<Otimes>\<^sub>M T) f"  | 
| 47694 | 694  | 
show "0 \<le> ?M" unfolding M  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
695  | 
proof (intro ST.KL_density_density_nonneg)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
696  | 
show "prob_space (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Pxy x))) "  | 
| 47694 | 697  | 
unfolding distributed_distr_eq_density[OF Pxy, symmetric]  | 
698  | 
using distributed_measurable[OF Pxy] by (rule prob_space_distr)  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
699  | 
show "prob_space (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x))))"  | 
| 47694 | 700  | 
unfolding distr_eq[symmetric] by unfold_locales  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
701  | 
show "integrable (S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x))))"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
702  | 
using int unfolding f_def .  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
703  | 
qed (insert ac, auto simp: b_gt_1 Px_nn Py_nn Pxy_nn space_pair_measure)  | 
| 40859 | 704  | 
qed  | 
705  | 
||
706  | 
lemma (in information_space)  | 
|
| 47694 | 707  | 
fixes Pxy :: "'b \<times> 'c \<Rightarrow> real" and Px :: "'b \<Rightarrow> real" and Py :: "'c \<Rightarrow> real"  | 
708  | 
assumes "sigma_finite_measure S" "sigma_finite_measure T"  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
709  | 
assumes Px[measurable]: "distributed M S X Px" and Px_nn: "\<And>x. x \<in> space S \<Longrightarrow> 0 \<le> Px x"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
710  | 
and Py[measurable]: "distributed M T Y Py" and Py_nn: "\<And>x. x \<in> space T \<Longrightarrow> 0 \<le> Py x"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
711  | 
and Pxy[measurable]: "distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) Pxy"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
712  | 
and Pxy_nn: "\<And>x. x \<in> space (S \<Otimes>\<^sub>M T) \<Longrightarrow> 0 \<le> Pxy x"  | 
| 47694 | 713  | 
assumes ae: "AE x in S. AE y in T. Pxy (x, y) = Px x * Py y"  | 
714  | 
shows mutual_information_eq_0: "mutual_information b S T X Y = 0"  | 
|
| 36624 | 715  | 
proof -  | 
| 47694 | 716  | 
interpret S: sigma_finite_measure S by fact  | 
717  | 
interpret T: sigma_finite_measure T by fact  | 
|
718  | 
interpret ST: pair_sigma_finite S T ..  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
719  | 
note  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
720  | 
distributed_real_measurable[OF Px_nn Px, measurable]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
721  | 
distributed_real_measurable[OF Py_nn Py, measurable]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
722  | 
distributed_real_measurable[OF Pxy_nn Pxy, measurable]  | 
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
723  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
724  | 
have "AE x in S \<Otimes>\<^sub>M T. Px (fst x) = 0 \<longrightarrow> Pxy x = 0"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
725  | 
by (rule subdensity_real[OF measurable_fst Pxy Px]) (auto simp: Px_nn Pxy_nn space_pair_measure)  | 
| 47694 | 726  | 
moreover  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
727  | 
have "AE x in S \<Otimes>\<^sub>M T. Py (snd x) = 0 \<longrightarrow> Pxy x = 0"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
728  | 
by (rule subdensity_real[OF measurable_snd Pxy Py]) (auto simp: Py_nn Pxy_nn space_pair_measure)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
729  | 
moreover  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
730  | 
have "AE x in S \<Otimes>\<^sub>M T. Pxy x = Px (fst x) * Py (snd x)"  | 
| 47694 | 731  | 
by (intro ST.AE_pair_measure) (auto simp: ae intro!: measurable_snd'' measurable_fst'')  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
732  | 
ultimately have "AE x in S \<Otimes>\<^sub>M T. Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x))) = 0"  | 
| 47694 | 733  | 
by eventually_elim simp  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
734  | 
then have "(\<integral>x. Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x))) \<partial>(S \<Otimes>\<^sub>M T)) = (\<integral>x. 0 \<partial>(S \<Otimes>\<^sub>M T))"  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
735  | 
by (intro integral_cong_AE) auto  | 
| 47694 | 736  | 
then show ?thesis  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
737  | 
by (subst mutual_information_distr[OF assms(1-8)]) (auto simp add: space_pair_measure)  | 
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
738  | 
qed  | 
| 
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
739  | 
|
| 47694 | 740  | 
lemma (in information_space) mutual_information_simple_distributed:  | 
741  | 
assumes X: "simple_distributed M X Px" and Y: "simple_distributed M Y Py"  | 
|
742  | 
assumes XY: "simple_distributed M (\<lambda>x. (X x, Y x)) Pxy"  | 
|
743  | 
shows "\<I>(X ; Y) = (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x))`space M. Pxy (x, y) * log b (Pxy (x, y) / (Px x * Py y)))"  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
744  | 
proof (subst mutual_information_distr[OF _ _ simple_distributed[OF X] _ simple_distributed[OF Y] _ simple_distributed_joint[OF XY]])  | 
| 47694 | 745  | 
note fin = simple_distributed_joint_finite[OF XY, simp]  | 
746  | 
show "sigma_finite_measure (count_space (X ` space M))"  | 
|
747  | 
by (simp add: sigma_finite_measure_count_space_finite)  | 
|
748  | 
show "sigma_finite_measure (count_space (Y ` space M))"  | 
|
749  | 
by (simp add: sigma_finite_measure_count_space_finite)  | 
|
750  | 
let ?Pxy = "\<lambda>x. (if x \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy x else 0)"  | 
|
751  | 
let ?f = "\<lambda>x. ?Pxy x * log b (?Pxy x / (Px (fst x) * Py (snd x)))"  | 
|
752  | 
have "\<And>x. ?f x = (if x \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x))) else 0)"  | 
|
753  | 
by auto  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
754  | 
with fin show "(\<integral> x. ?f x \<partial>(count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M))) =  | 
| 47694 | 755  | 
(\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / (Px x * Py y)))"  | 
| 64267 | 756  | 
by (auto simp add: pair_measure_count_space lebesgue_integral_count_space_finite sum.If_cases split_beta'  | 
757  | 
intro!: sum.cong)  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
758  | 
qed (insert X Y XY, auto simp: simple_distributed_def)  | 
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
759  | 
|
| 47694 | 760  | 
lemma (in information_space)  | 
761  | 
fixes Pxy :: "'b \<times> 'c \<Rightarrow> real" and Px :: "'b \<Rightarrow> real" and Py :: "'c \<Rightarrow> real"  | 
|
762  | 
assumes Px: "simple_distributed M X Px" and Py: "simple_distributed M Y Py"  | 
|
763  | 
assumes Pxy: "simple_distributed M (\<lambda>x. (X x, Y x)) Pxy"  | 
|
764  | 
assumes ae: "\<forall>x\<in>space M. Pxy (X x, Y x) = Px (X x) * Py (Y x)"  | 
|
765  | 
shows mutual_information_eq_0_simple: "\<I>(X ; Y) = 0"  | 
|
766  | 
proof (subst mutual_information_simple_distributed[OF Px Py Pxy])  | 
|
767  | 
have "(\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / (Px x * Py y))) =  | 
|
768  | 
(\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. 0)"  | 
|
| 64267 | 769  | 
by (intro sum.cong) (auto simp: ae)  | 
| 47694 | 770  | 
then show "(\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M.  | 
771  | 
Pxy (x, y) * log b (Pxy (x, y) / (Px x * Py y))) = 0" by simp  | 
|
772  | 
qed  | 
|
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
773  | 
|
| 61808 | 774  | 
subsection \<open>Entropy\<close>  | 
| 39097 | 775  | 
|
| 47694 | 776  | 
definition (in prob_space) entropy :: "real \<Rightarrow> 'b measure \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> real" where
 | 
777  | 
"entropy b S X = - KL_divergence b S (distr M S X)"  | 
|
778  | 
||
| 40859 | 779  | 
abbreviation (in information_space)  | 
780  | 
  entropy_Pow ("\<H>'(_')") where
 | 
|
| 47694 | 781  | 
"\<H>(X) \<equiv> entropy b (count_space (X`space M)) X"  | 
| 
41981
 
cdf7693bbe08
reworked Probability theory: measures are not type restricted to positive extended reals
 
hoelzl 
parents: 
41833 
diff
changeset
 | 
782  | 
|
| 49791 | 783  | 
lemma (in prob_space) distributed_RN_deriv:  | 
784  | 
assumes X: "distributed M S X Px"  | 
|
785  | 
shows "AE x in S. RN_deriv S (density S Px) x = Px x"  | 
|
786  | 
proof -  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
787  | 
note D = distributed_measurable[OF X] distributed_borel_measurable[OF X]  | 
| 49791 | 788  | 
interpret X: prob_space "distr M S X"  | 
789  | 
using D(1) by (rule prob_space_distr)  | 
|
790  | 
||
| 61169 | 791  | 
have sf: "sigma_finite_measure (distr M S X)" by standard  | 
| 49791 | 792  | 
show ?thesis  | 
793  | 
using D  | 
|
794  | 
apply (subst eq_commute)  | 
|
795  | 
apply (intro RN_deriv_unique_sigma_finite)  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
796  | 
apply (auto simp: distributed_distr_eq_density[symmetric, OF X] sf)  | 
| 49791 | 797  | 
done  | 
798  | 
qed  | 
|
799  | 
||
| 
49788
 
3c10763f5cb4
show and use distributed_swap and distributed_jointI
 
hoelzl 
parents: 
49787 
diff
changeset
 | 
800  | 
lemma (in information_space)  | 
| 47694 | 801  | 
fixes X :: "'a \<Rightarrow> 'b"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
802  | 
assumes X[measurable]: "distributed M MX X f" and nn: "\<And>x. x \<in> space MX \<Longrightarrow> 0 \<le> f x"  | 
| 
49788
 
3c10763f5cb4
show and use distributed_swap and distributed_jointI
 
hoelzl 
parents: 
49787 
diff
changeset
 | 
803  | 
shows entropy_distr: "entropy b MX X = - (\<integral>x. f x * log b (f x) \<partial>MX)" (is ?eq)  | 
| 
 
3c10763f5cb4
show and use distributed_swap and distributed_jointI
 
hoelzl 
parents: 
49787 
diff
changeset
 | 
804  | 
proof -  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
805  | 
note D = distributed_measurable[OF X] distributed_borel_measurable[OF X]  | 
| 49791 | 806  | 
note ae = distributed_RN_deriv[OF X]  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
807  | 
note distributed_real_measurable[OF nn X, measurable]  | 
| 
49788
 
3c10763f5cb4
show and use distributed_swap and distributed_jointI
 
hoelzl 
parents: 
49787 
diff
changeset
 | 
808  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
809  | 
have ae_eq: "AE x in distr M MX X. log b (enn2real (RN_deriv MX (distr M MX X) x)) =  | 
| 49785 | 810  | 
log b (f x)"  | 
811  | 
unfolding distributed_distr_eq_density[OF X]  | 
|
812  | 
apply (subst AE_density)  | 
|
813  | 
using D apply simp  | 
|
814  | 
using ae apply eventually_elim  | 
|
815  | 
apply auto  | 
|
816  | 
done  | 
|
| 
49788
 
3c10763f5cb4
show and use distributed_swap and distributed_jointI
 
hoelzl 
parents: 
49787 
diff
changeset
 | 
817  | 
|
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
818  | 
have int_eq: "(\<integral> x. f x * log b (f x) \<partial>MX) = (\<integral> x. log b (f x) \<partial>distr M MX X)"  | 
| 49785 | 819  | 
unfolding distributed_distr_eq_density[OF X]  | 
820  | 
using D  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
821  | 
by (subst integral_density) (auto simp: nn)  | 
| 
49788
 
3c10763f5cb4
show and use distributed_swap and distributed_jointI
 
hoelzl 
parents: 
49787 
diff
changeset
 | 
822  | 
|
| 
 
3c10763f5cb4
show and use distributed_swap and distributed_jointI
 
hoelzl 
parents: 
49787 
diff
changeset
 | 
823  | 
show ?eq  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
824  | 
unfolding entropy_def KL_divergence_def entropy_density_def comp_def int_eq neg_equal_iff_equal  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
825  | 
using ae_eq by (intro integral_cong_AE) (auto simp: nn)  | 
| 49786 | 826  | 
qed  | 
827  | 
||
828  | 
lemma (in information_space) entropy_le:  | 
|
829  | 
fixes Px :: "'b \<Rightarrow> real" and MX :: "'b measure"  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
830  | 
assumes X[measurable]: "distributed M MX X Px" and Px_nn[simp]: "\<And>x. x \<in> space MX \<Longrightarrow> 0 \<le> Px x"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
831  | 
  and fin: "emeasure MX {x \<in> space MX. Px x \<noteq> 0} \<noteq> top"
 | 
| 49786 | 832  | 
and int: "integrable MX (\<lambda>x. - Px x * log b (Px x))"  | 
833  | 
  shows "entropy b MX X \<le> log b (measure MX {x \<in> space MX. Px x \<noteq> 0})"
 | 
|
834  | 
proof -  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
835  | 
note Px = distributed_borel_measurable[OF X]  | 
| 49786 | 836  | 
interpret X: prob_space "distr M MX X"  | 
837  | 
using distributed_measurable[OF X] by (rule prob_space_distr)  | 
|
838  | 
||
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
839  | 
  have " - log b (measure MX {x \<in> space MX. Px x \<noteq> 0}) =
 | 
| 49786 | 840  | 
    - log b (\<integral> x. indicator {x \<in> space MX. Px x \<noteq> 0} x \<partial>MX)"
 | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
841  | 
using Px Px_nn fin by (auto simp: measure_def)  | 
| 49786 | 842  | 
  also have "- log b (\<integral> x. indicator {x \<in> space MX. Px x \<noteq> 0} x \<partial>MX) = - log b (\<integral> x. 1 / Px x \<partial>distr M MX X)"
 | 
| 
67982
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
64267 
diff
changeset
 | 
843  | 
proof -  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
64267 
diff
changeset
 | 
844  | 
    have "integral\<^sup>L MX (indicator {x \<in> space MX. Px x \<noteq> 0}) = LINT x|MX. Px x *\<^sub>R (1 / Px x)"
 | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
64267 
diff
changeset
 | 
845  | 
by (rule Bochner_Integration.integral_cong) auto  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
64267 
diff
changeset
 | 
846  | 
also have "... = LINT x|density MX (\<lambda>x. ennreal (Px x)). 1 / Px x"  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
64267 
diff
changeset
 | 
847  | 
by (rule integral_density [symmetric]) (use Px Px_nn in auto)  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
64267 
diff
changeset
 | 
848  | 
finally show ?thesis  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
64267 
diff
changeset
 | 
849  | 
unfolding distributed_distr_eq_density[OF X] by simp  | 
| 
 
7643b005b29a
various new results on measures, integrals, etc., and some simplified proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
64267 
diff
changeset
 | 
850  | 
qed  | 
| 49786 | 851  | 
also have "\<dots> \<le> (\<integral> x. - log b (1 / Px x) \<partial>distr M MX X)"  | 
852  | 
  proof (rule X.jensens_inequality[of "\<lambda>x. 1 / Px x" "{0<..}" 0 1 "\<lambda>x. - log b x"])
 | 
|
853  | 
    show "AE x in distr M MX X. 1 / Px x \<in> {0<..}"
 | 
|
854  | 
unfolding distributed_distr_eq_density[OF X]  | 
|
855  | 
using Px by (auto simp: AE_density)  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
856  | 
    have [simp]: "\<And>x. x \<in> space MX \<Longrightarrow> ennreal (if Px x = 0 then 0 else 1) = indicator {x \<in> space MX. Px x \<noteq> 0} x"
 | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
857  | 
by (auto simp: one_ennreal_def)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
858  | 
have "(\<integral>\<^sup>+ x. ennreal (- (if Px x = 0 then 0 else 1)) \<partial>MX) = (\<integral>\<^sup>+ x. 0 \<partial>MX)"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
859  | 
by (intro nn_integral_cong) (auto simp: ennreal_neg)  | 
| 49786 | 860  | 
then show "integrable (distr M MX X) (\<lambda>x. 1 / Px x)"  | 
861  | 
unfolding distributed_distr_eq_density[OF X] using Px  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
862  | 
by (auto simp: nn_integral_density real_integrable_def fin ennreal_neg ennreal_mult[symmetric]  | 
| 56996 | 863  | 
cong: nn_integral_cong)  | 
| 49786 | 864  | 
have "integrable MX (\<lambda>x. Px x * log b (1 / Px x)) =  | 
865  | 
integrable MX (\<lambda>x. - Px x * log b (Px x))"  | 
|
866  | 
using Px  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
867  | 
by (intro integrable_cong_AE) (auto simp: log_divide_eq less_le)  | 
| 49786 | 868  | 
then show "integrable (distr M MX X) (\<lambda>x. - log b (1 / Px x))"  | 
869  | 
unfolding distributed_distr_eq_density[OF X]  | 
|
870  | 
using Px int  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
871  | 
by (subst integrable_real_density) auto  | 
| 49786 | 872  | 
qed (auto simp: minus_log_convex[OF b_gt_1])  | 
873  | 
also have "\<dots> = (\<integral> x. log b (Px x) \<partial>distr M MX X)"  | 
|
874  | 
unfolding distributed_distr_eq_density[OF X] using Px  | 
|
875  | 
by (intro integral_cong_AE) (auto simp: AE_density log_divide_eq)  | 
|
876  | 
also have "\<dots> = - entropy b MX X"  | 
|
877  | 
unfolding distributed_distr_eq_density[OF X] using Px  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
878  | 
by (subst entropy_distr[OF X]) (auto simp: integral_density)  | 
| 49786 | 879  | 
finally show ?thesis  | 
880  | 
by simp  | 
|
881  | 
qed  | 
|
882  | 
||
883  | 
lemma (in information_space) entropy_le_space:  | 
|
884  | 
fixes Px :: "'b \<Rightarrow> real" and MX :: "'b measure"  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
885  | 
assumes X: "distributed M MX X Px" and Px_nn[simp]: "\<And>x. x \<in> space MX \<Longrightarrow> 0 \<le> Px x"  | 
| 49786 | 886  | 
and fin: "finite_measure MX"  | 
887  | 
and int: "integrable MX (\<lambda>x. - Px x * log b (Px x))"  | 
|
888  | 
shows "entropy b MX X \<le> log b (measure MX (space MX))"  | 
|
889  | 
proof -  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
890  | 
note Px = distributed_borel_measurable[OF X]  | 
| 49786 | 891  | 
interpret finite_measure MX by fact  | 
892  | 
  have "entropy b MX X \<le> log b (measure MX {x \<in> space MX. Px x \<noteq> 0})"
 | 
|
893  | 
using int X by (intro entropy_le) auto  | 
|
894  | 
also have "\<dots> \<le> log b (measure MX (space MX))"  | 
|
895  | 
using Px distributed_imp_emeasure_nonzero[OF X]  | 
|
896  | 
by (intro log_le)  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
897  | 
(auto intro!: finite_measure_mono b_gt_1 less_le[THEN iffD2]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
898  | 
simp: emeasure_eq_measure cong: conj_cong)  | 
| 49786 | 899  | 
finally show ?thesis .  | 
900  | 
qed  | 
|
901  | 
||
| 47694 | 902  | 
lemma (in information_space) entropy_uniform:  | 
| 49785 | 903  | 
assumes X: "distributed M MX X (\<lambda>x. indicator A x / measure MX A)" (is "distributed _ _ _ ?f")  | 
| 47694 | 904  | 
shows "entropy b MX X = log b (measure MX A)"  | 
| 49785 | 905  | 
proof (subst entropy_distr[OF X])  | 
906  | 
have [simp]: "emeasure MX A \<noteq> \<infinity>"  | 
|
907  | 
using uniform_distributed_params[OF X] by (auto simp add: measure_def)  | 
|
908  | 
have eq: "(\<integral> x. indicator A x / measure MX A * log b (indicator A x / measure MX A) \<partial>MX) =  | 
|
909  | 
(\<integral> x. (- log b (measure MX A) / measure MX A) * indicator A x \<partial>MX)"  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
910  | 
using uniform_distributed_params[OF X]  | 
| 
63886
 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 
hoelzl 
parents: 
63626 
diff
changeset
 | 
911  | 
by (intro Bochner_Integration.integral_cong) (auto split: split_indicator simp: log_divide_eq zero_less_measure_iff)  | 
| 49785 | 912  | 
show "- (\<integral> x. indicator A x / measure MX A * log b (indicator A x / measure MX A) \<partial>MX) =  | 
913  | 
log b (measure MX A)"  | 
|
914  | 
unfolding eq using uniform_distributed_params[OF X]  | 
|
| 
63886
 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 
hoelzl 
parents: 
63626 
diff
changeset
 | 
915  | 
by (subst Bochner_Integration.integral_mult_right) (auto simp: measure_def less_top[symmetric] intro!: integrable_real_indicator)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
916  | 
qed simp  | 
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
917  | 
|
| 47694 | 918  | 
lemma (in information_space) entropy_simple_distributed:  | 
| 49786 | 919  | 
"simple_distributed M X f \<Longrightarrow> \<H>(X) = - (\<Sum>x\<in>X`space M. f x * log b (f x))"  | 
920  | 
by (subst entropy_distr[OF simple_distributed])  | 
|
921  | 
(auto simp add: lebesgue_integral_count_space_finite)  | 
|
| 39097 | 922  | 
|
| 40859 | 923  | 
lemma (in information_space) entropy_le_card_not_0:  | 
| 47694 | 924  | 
assumes X: "simple_distributed M X f"  | 
925  | 
  shows "\<H>(X) \<le> log b (card (X ` space M \<inter> {x. f x \<noteq> 0}))"
 | 
|
| 39097 | 926  | 
proof -  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
927  | 
let ?X = "count_space (X`space M)"  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
928  | 
  have "\<H>(X) \<le> log b (measure ?X {x \<in> space ?X. f x \<noteq> 0})"
 | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
929  | 
by (rule entropy_le[OF simple_distributed[OF X]])  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
930  | 
(insert X, auto simp: simple_distributed_finite[OF X] subset_eq integrable_count_space emeasure_count_space)  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
931  | 
  also have "measure ?X {x \<in> space ?X. f x \<noteq> 0} = card (X ` space M \<inter> {x. f x \<noteq> 0})"
 | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
932  | 
by (simp_all add: simple_distributed_finite[OF X] subset_eq emeasure_count_space measure_def Int_def)  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
933  | 
finally show ?thesis .  | 
| 39097 | 934  | 
qed  | 
935  | 
||
| 40859 | 936  | 
lemma (in information_space) entropy_le_card:  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
937  | 
assumes X: "simple_distributed M X f"  | 
| 40859 | 938  | 
shows "\<H>(X) \<le> log b (real (card (X ` space M)))"  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
939  | 
proof -  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
940  | 
let ?X = "count_space (X`space M)"  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
941  | 
have "\<H>(X) \<le> log b (measure ?X (space ?X))"  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
942  | 
by (rule entropy_le_space[OF simple_distributed[OF X]])  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
943  | 
(insert X, auto simp: simple_distributed_finite[OF X] subset_eq integrable_count_space emeasure_count_space finite_measure_count_space)  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
944  | 
also have "measure ?X (space ?X) = card (X ` space M)"  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
945  | 
by (simp_all add: simple_distributed_finite[OF X] subset_eq emeasure_count_space measure_def)  | 
| 39097 | 946  | 
finally show ?thesis .  | 
947  | 
qed  | 
|
948  | 
||
| 61808 | 949  | 
subsection \<open>Conditional Mutual Information\<close>  | 
| 39097 | 950  | 
|
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
951  | 
definition (in prob_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
 | 
952  | 
"conditional_mutual_information b MX MY MZ X Y Z \<equiv>  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
953  | 
mutual_information b MX (MY \<Otimes>\<^sub>M MZ) X (\<lambda>x. (Y x, Z x)) -  | 
| 
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
 | 
954  | 
mutual_information b MX MZ X Z"  | 
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
955  | 
|
| 40859 | 956  | 
abbreviation (in information_space)  | 
957  | 
  conditional_mutual_information_Pow ("\<I>'( _ ; _ | _ ')") where
 | 
|
| 36624 | 958  | 
"\<I>(X ; Y | Z) \<equiv> conditional_mutual_information b  | 
| 47694 | 959  | 
(count_space (X ` space M)) (count_space (Y ` space M)) (count_space (Z ` space M)) X Y Z"  | 
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
960  | 
|
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
961  | 
lemma (in information_space)  | 
| 47694 | 962  | 
assumes S: "sigma_finite_measure S" and T: "sigma_finite_measure T" and P: "sigma_finite_measure P"  | 
| 50003 | 963  | 
assumes Px[measurable]: "distributed M S X Px"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
964  | 
and Px_nn[simp]: "\<And>x. x \<in> space S \<Longrightarrow> 0 \<le> Px x"  | 
| 50003 | 965  | 
assumes Pz[measurable]: "distributed M P Z Pz"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
966  | 
and Pz_nn[simp]: "\<And>z. z \<in> space P \<Longrightarrow> 0 \<le> Pz z"  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
967  | 
assumes Pyz[measurable]: "distributed M (T \<Otimes>\<^sub>M P) (\<lambda>x. (Y x, Z x)) Pyz"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
968  | 
and Pyz_nn[simp]: "\<And>y z. y \<in> space T \<Longrightarrow> z \<in> space P \<Longrightarrow> 0 \<le> Pyz (y, z)"  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
969  | 
assumes Pxz[measurable]: "distributed M (S \<Otimes>\<^sub>M P) (\<lambda>x. (X x, Z x)) Pxz"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
970  | 
and Pxz_nn[simp]: "\<And>x z. x \<in> space S \<Longrightarrow> z \<in> space P \<Longrightarrow> 0 \<le> Pxz (x, z)"  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
971  | 
assumes Pxyz[measurable]: "distributed M (S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P) (\<lambda>x. (X x, Y x, Z x)) Pxyz"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
972  | 
and Pxyz_nn[simp]: "\<And>x y z. x \<in> space S \<Longrightarrow> y \<in> space T \<Longrightarrow> z \<in> space P \<Longrightarrow> 0 \<le> Pxyz (x, y, z)"  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
973  | 
assumes I1: "integrable (S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P) (\<lambda>(x, y, z). Pxyz (x, y, z) * log b (Pxyz (x, y, z) / (Px x * Pyz (y, z))))"  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
974  | 
assumes I2: "integrable (S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P) (\<lambda>(x, y, z). Pxyz (x, y, z) * log b (Pxz (x, z) / (Px x * Pz z)))"  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
975  | 
shows conditional_mutual_information_generic_eq: "conditional_mutual_information b S T P X Y Z  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
976  | 
= (\<integral>(x, y, z). Pxyz (x, y, z) * log b (Pxyz (x, y, z) / (Pxz (x, z) * (Pyz (y,z) / Pz z))) \<partial>(S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P))" (is "?eq")  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
977  | 
and conditional_mutual_information_generic_nonneg: "0 \<le> conditional_mutual_information b S T P X Y Z" (is "?nonneg")  | 
| 40859 | 978  | 
proof -  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
979  | 
have [measurable]: "Px \<in> S \<rightarrow>\<^sub>M borel"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
980  | 
using Px Px_nn by (intro distributed_real_measurable)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
981  | 
have [measurable]: "Pz \<in> P \<rightarrow>\<^sub>M borel"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
982  | 
using Pz Pz_nn by (intro distributed_real_measurable)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
983  | 
have measurable_Pyz[measurable]: "Pyz \<in> (T \<Otimes>\<^sub>M P) \<rightarrow>\<^sub>M borel"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
984  | 
using Pyz Pyz_nn by (intro distributed_real_measurable) (auto simp: space_pair_measure)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
985  | 
have measurable_Pxz[measurable]: "Pxz \<in> (S \<Otimes>\<^sub>M P) \<rightarrow>\<^sub>M borel"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
986  | 
using Pxz Pxz_nn by (intro distributed_real_measurable) (auto simp: space_pair_measure)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
987  | 
have measurable_Pxyz[measurable]: "Pxyz \<in> (S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P) \<rightarrow>\<^sub>M borel"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
988  | 
using Pxyz Pxyz_nn by (intro distributed_real_measurable) (auto simp: space_pair_measure)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
989  | 
|
| 47694 | 990  | 
interpret S: sigma_finite_measure S by fact  | 
991  | 
interpret T: sigma_finite_measure T by fact  | 
|
992  | 
interpret P: sigma_finite_measure P by fact  | 
|
993  | 
interpret TP: pair_sigma_finite T P ..  | 
|
994  | 
interpret SP: pair_sigma_finite S P ..  | 
|
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
995  | 
interpret ST: pair_sigma_finite S T ..  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
996  | 
interpret SPT: pair_sigma_finite "S \<Otimes>\<^sub>M P" T ..  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
997  | 
interpret STP: pair_sigma_finite S "T \<Otimes>\<^sub>M P" ..  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
998  | 
interpret TPS: pair_sigma_finite "T \<Otimes>\<^sub>M P" S ..  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
999  | 
have TP: "sigma_finite_measure (T \<Otimes>\<^sub>M P)" ..  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1000  | 
have SP: "sigma_finite_measure (S \<Otimes>\<^sub>M P)" ..  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1001  | 
have YZ: "random_variable (T \<Otimes>\<^sub>M P) (\<lambda>x. (Y x, Z x))"  | 
| 47694 | 1002  | 
using Pyz by (simp add: distributed_measurable)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1003  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1004  | 
from Pxz Pxyz have distr_eq: "distr M (S \<Otimes>\<^sub>M P) (\<lambda>x. (X x, Z x)) =  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1005  | 
distr (distr M (S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P) (\<lambda>x. (X x, Y x, Z x))) (S \<Otimes>\<^sub>M P) (\<lambda>(x, y, z). (x, z))"  | 
| 50003 | 1006  | 
by (simp add: comp_def distr_distr)  | 
| 40859 | 1007  | 
|
| 47694 | 1008  | 
have "mutual_information b S P X Z =  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1009  | 
(\<integral>x. Pxz x * log b (Pxz x / (Px (fst x) * Pz (snd x))) \<partial>(S \<Otimes>\<^sub>M P))"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1010  | 
by (rule mutual_information_distr[OF S P Px Px_nn Pz Pz_nn Pxz Pxz_nn])  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1011  | 
also have "\<dots> = (\<integral>(x,y,z). Pxyz (x,y,z) * log b (Pxz (x,z) / (Px x * Pz z)) \<partial>(S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P))"  | 
| 47694 | 1012  | 
using b_gt_1 Pxz Px Pz  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1013  | 
by (subst distributed_transform_integral[OF Pxyz _ Pxz _, where T="\<lambda>(x, y, z). (x, z)"])  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1014  | 
(auto simp: split_beta' space_pair_measure)  | 
| 47694 | 1015  | 
finally have mi_eq:  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1016  | 
"mutual_information b S P X Z = (\<integral>(x,y,z). Pxyz (x,y,z) * log b (Pxz (x,z) / (Px x * Pz z)) \<partial>(S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P))" .  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1017  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1018  | 
have ae1: "AE x in S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P. Px (fst x) = 0 \<longrightarrow> Pxyz x = 0"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1019  | 
by (intro subdensity_real[of fst, OF _ Pxyz Px]) (auto simp: space_pair_measure)  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1020  | 
moreover have ae2: "AE x in S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P. Pz (snd (snd x)) = 0 \<longrightarrow> Pxyz x = 0"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1021  | 
by (intro subdensity_real[of "\<lambda>x. snd (snd x)", OF _ Pxyz Pz]) (auto simp: space_pair_measure)  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1022  | 
moreover have ae3: "AE x in S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P. Pxz (fst x, snd (snd x)) = 0 \<longrightarrow> Pxyz x = 0"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1023  | 
by (intro subdensity_real[of "\<lambda>x. (fst x, snd (snd x))", OF _ Pxyz Pxz]) (auto simp: space_pair_measure)  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1024  | 
moreover have ae4: "AE x in S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P. Pyz (snd x) = 0 \<longrightarrow> Pxyz x = 0"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1025  | 
by (intro subdensity_real[of snd, OF _ Pxyz Pyz]) (auto simp: space_pair_measure)  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1026  | 
ultimately have ae: "AE x in S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P.  | 
| 47694 | 1027  | 
Pxyz x * log b (Pxyz x / (Px (fst x) * Pyz (snd x))) -  | 
1028  | 
Pxyz x * log b (Pxz (fst x, snd (snd x)) / (Px (fst x) * Pz (snd (snd x)))) =  | 
|
1029  | 
Pxyz x * log b (Pxyz x * Pz (snd (snd x)) / (Pxz (fst x, snd (snd x)) * Pyz (snd x))) "  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1030  | 
using AE_space  | 
| 47694 | 1031  | 
proof eventually_elim  | 
| 60580 | 1032  | 
case (elim x)  | 
| 47694 | 1033  | 
show ?case  | 
| 40859 | 1034  | 
proof cases  | 
| 47694 | 1035  | 
assume "Pxyz x \<noteq> 0"  | 
| 60580 | 1036  | 
with elim have "0 < Px (fst x)" "0 < Pz (snd (snd x))" "0 < Pxz (fst x, snd (snd x))"  | 
1037  | 
"0 < Pyz (snd x)" "0 < Pxyz x"  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1038  | 
by (auto simp: space_pair_measure less_le)  | 
| 47694 | 1039  | 
then show ?thesis  | 
| 56544 | 1040  | 
using b_gt_1 by (simp add: log_simps less_imp_le field_simps)  | 
| 40859 | 1041  | 
qed simp  | 
1042  | 
qed  | 
|
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1043  | 
with I1 I2 show ?eq  | 
| 40859 | 1044  | 
unfolding conditional_mutual_information_def  | 
| 47694 | 1045  | 
apply (subst mi_eq)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1046  | 
apply (subst mutual_information_distr[OF S TP Px Px_nn Pyz _ Pxyz])  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1047  | 
apply (auto simp: space_pair_measure)  | 
| 
63886
 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 
hoelzl 
parents: 
63626 
diff
changeset
 | 
1048  | 
apply (subst Bochner_Integration.integral_diff[symmetric])  | 
| 
 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 
hoelzl 
parents: 
63626 
diff
changeset
 | 
1049  | 
apply (auto intro!: integral_cong_AE simp: split_beta' simp del: Bochner_Integration.integral_diff)  | 
| 47694 | 1050  | 
done  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1051  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1052  | 
let ?P = "density (S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P) Pxyz"  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1053  | 
interpret P: prob_space ?P  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1054  | 
unfolding distributed_distr_eq_density[OF Pxyz, symmetric]  | 
| 50003 | 1055  | 
by (rule prob_space_distr) simp  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1056  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1057  | 
let ?Q = "density (T \<Otimes>\<^sub>M P) Pyz"  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1058  | 
interpret Q: prob_space ?Q  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1059  | 
unfolding distributed_distr_eq_density[OF Pyz, symmetric]  | 
| 50003 | 1060  | 
by (rule prob_space_distr) simp  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1061  | 
|
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1062  | 
let ?f = "\<lambda>(x, y, z). Pxz (x, z) * (Pyz (y, z) / Pz z) / Pxyz (x, y, z)"  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1063  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1064  | 
from subdensity_real[of snd, OF _ Pyz Pz _ AE_I2 AE_I2]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1065  | 
have aeX1: "AE x in T \<Otimes>\<^sub>M P. Pz (snd x) = 0 \<longrightarrow> Pyz x = 0"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1066  | 
by (auto simp: comp_def space_pair_measure)  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1067  | 
have aeX2: "AE x in T \<Otimes>\<^sub>M P. 0 \<le> Pz (snd x)"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1068  | 
using Pz by (intro TP.AE_pair_measure) (auto simp: comp_def)  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1069  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1070  | 
have aeX3: "AE y in T \<Otimes>\<^sub>M P. (\<integral>\<^sup>+ x. ennreal (Pxz (x, snd y)) \<partial>S) = ennreal (Pz (snd y))"  | 
| 
49788
 
3c10763f5cb4
show and use distributed_swap and distributed_jointI
 
hoelzl 
parents: 
49787 
diff
changeset
 | 
1071  | 
using Pz distributed_marginal_eq_joint2[OF P S Pz Pxz]  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1072  | 
by (intro TP.AE_pair_measure) auto  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1073  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1074  | 
have "(\<integral>\<^sup>+ x. ?f x \<partial>?P) \<le> (\<integral>\<^sup>+ (x, y, z). Pxz (x, z) * (Pyz (y, z) / Pz z) \<partial>(S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P))"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1075  | 
by (subst nn_integral_density)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1076  | 
(auto intro!: nn_integral_mono simp: space_pair_measure ennreal_mult[symmetric])  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1077  | 
also have "\<dots> = (\<integral>\<^sup>+(y, z). (\<integral>\<^sup>+ x. ennreal (Pxz (x, z)) * ennreal (Pyz (y, z) / Pz z) \<partial>S) \<partial>(T \<Otimes>\<^sub>M P))"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1078  | 
by (subst STP.nn_integral_snd[symmetric])  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1079  | 
(auto simp add: split_beta' ennreal_mult[symmetric] space_pair_measure intro!: nn_integral_cong)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1080  | 
also have "\<dots> = (\<integral>\<^sup>+x. ennreal (Pyz x) * 1 \<partial>T \<Otimes>\<^sub>M P)"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1081  | 
apply (rule nn_integral_cong_AE)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1082  | 
using aeX1 aeX2 aeX3 AE_space  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1083  | 
apply eventually_elim  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1084  | 
proof (case_tac x, simp add: space_pair_measure)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1085  | 
fix a b assume "Pz b = 0 \<longrightarrow> Pyz (a, b) = 0" "a \<in> space T \<and> b \<in> space P"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1086  | 
"(\<integral>\<^sup>+ x. ennreal (Pxz (x, b)) \<partial>S) = ennreal (Pz b)"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1087  | 
then show "(\<integral>\<^sup>+ x. ennreal (Pxz (x, b)) * ennreal (Pyz (a, b) / Pz b) \<partial>S) = ennreal (Pyz (a, b))"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1088  | 
by (subst nn_integral_multc) (auto split: prod.split simp: ennreal_mult[symmetric])  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1089  | 
qed  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1090  | 
also have "\<dots> = 1"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1091  | 
using Q.emeasure_space_1 distributed_distr_eq_density[OF Pyz]  | 
| 56996 | 1092  | 
by (subst nn_integral_density[symmetric]) auto  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1093  | 
finally have le1: "(\<integral>\<^sup>+ x. ?f x \<partial>?P) \<le> 1" .  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1094  | 
also have "\<dots> < \<infinity>" by simp  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1095  | 
finally have fin: "(\<integral>\<^sup>+ x. ?f x \<partial>?P) \<noteq> \<infinity>" by simp  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1096  | 
|
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1097  | 
have pos: "(\<integral>\<^sup>+x. ?f x \<partial>?P) \<noteq> 0"  | 
| 56996 | 1098  | 
apply (subst nn_integral_density)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1099  | 
apply (simp_all add: split_beta')  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1100  | 
proof  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1101  | 
let ?g = "\<lambda>x. ennreal (Pxyz x) * (Pxz (fst x, snd (snd x)) * Pyz (snd x) / (Pz (snd (snd x)) * Pxyz x))"  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1102  | 
assume "(\<integral>\<^sup>+x. ?g x \<partial>(S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P)) = 0"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1103  | 
then have "AE x in S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P. ?g x = 0"  | 
| 56996 | 1104  | 
by (intro nn_integral_0_iff_AE[THEN iffD1]) auto  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1105  | 
then have "AE x in S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P. Pxyz x = 0"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1106  | 
using ae1 ae2 ae3 ae4 AE_space  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1107  | 
by eventually_elim (auto split: if_split_asm simp: mult_le_0_iff divide_le_0_iff space_pair_measure)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1108  | 
then have "(\<integral>\<^sup>+ x. ennreal (Pxyz x) \<partial>S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P) = 0"  | 
| 56996 | 1109  | 
by (subst nn_integral_cong_AE[of _ "\<lambda>x. 0"]) auto  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1110  | 
with P.emeasure_space_1 show False  | 
| 56996 | 1111  | 
by (subst (asm) emeasure_density) (auto cong: nn_integral_cong)  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1112  | 
qed  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1113  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1114  | 
have neg: "(\<integral>\<^sup>+ x. - ?f x \<partial>?P) = 0"  | 
| 56996 | 1115  | 
apply (rule nn_integral_0_iff_AE[THEN iffD2])  | 
| 50003 | 1116  | 
apply simp  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1117  | 
apply (subst AE_density)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1118  | 
apply (auto simp: space_pair_measure ennreal_neg)  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1119  | 
done  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1120  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1121  | 
have I3: "integrable (S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P) (\<lambda>(x, y, z). Pxyz (x, y, z) * log b (Pxyz (x, y, z) / (Pxz (x, z) * (Pyz (y,z) / Pz z))))"  | 
| 
63886
 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 
hoelzl 
parents: 
63626 
diff
changeset
 | 
1122  | 
apply (rule integrable_cong_AE[THEN iffD1, OF _ _ _ Bochner_Integration.integrable_diff[OF I1 I2]])  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1123  | 
using ae  | 
| 50003 | 1124  | 
apply (auto simp: split_beta')  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1125  | 
done  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1126  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1127  | 
have "- log b 1 \<le> - log b (integral\<^sup>L ?P ?f)"  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1128  | 
proof (intro le_imp_neg_le log_le[OF b_gt_1])  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1129  | 
have If: "integrable ?P ?f"  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1130  | 
unfolding real_integrable_def  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1131  | 
proof (intro conjI)  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1132  | 
from neg show "(\<integral>\<^sup>+ x. - ?f x \<partial>?P) \<noteq> \<infinity>"  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1133  | 
by simp  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1134  | 
from fin show "(\<integral>\<^sup>+ x. ?f x \<partial>?P) \<noteq> \<infinity>"  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1135  | 
by simp  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1136  | 
qed simp  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1137  | 
then have "(\<integral>\<^sup>+ x. ?f x \<partial>?P) = (\<integral>x. ?f x \<partial>?P)"  | 
| 56996 | 1138  | 
apply (rule nn_integral_eq_integral)  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1139  | 
apply (subst AE_density)  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1140  | 
apply simp  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1141  | 
apply (auto simp: space_pair_measure ennreal_neg)  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1142  | 
done  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1143  | 
with pos le1  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1144  | 
show "0 < (\<integral>x. ?f x \<partial>?P)" "(\<integral>x. ?f x \<partial>?P) \<le> 1"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1145  | 
by (simp_all add: one_ennreal.rep_eq zero_less_iff_neq_zero[symmetric])  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1146  | 
qed  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1147  | 
also have "- log b (integral\<^sup>L ?P ?f) \<le> (\<integral> x. - log b (?f x) \<partial>?P)"  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1148  | 
  proof (rule P.jensens_inequality[where a=0 and b=1 and I="{0<..}"])
 | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1149  | 
    show "AE x in ?P. ?f x \<in> {0<..}"
 | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1150  | 
unfolding AE_density[OF distributed_borel_measurable[OF Pxyz]]  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1151  | 
using ae1 ae2 ae3 ae4 AE_space  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1152  | 
by eventually_elim (auto simp: space_pair_measure less_le)  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1153  | 
show "integrable ?P ?f"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1154  | 
unfolding real_integrable_def  | 
| 50003 | 1155  | 
using fin neg by (auto simp: split_beta')  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1156  | 
show "integrable ?P (\<lambda>x. - log b (?f x))"  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1157  | 
apply (subst integrable_real_density)  | 
| 50003 | 1158  | 
apply simp  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1159  | 
apply (auto simp: space_pair_measure) []  | 
| 50003 | 1160  | 
apply simp  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1161  | 
apply (rule integrable_cong_AE[THEN iffD1, OF _ _ _ I3])  | 
| 50003 | 1162  | 
apply simp  | 
1163  | 
apply simp  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1164  | 
using ae1 ae2 ae3 ae4 AE_space  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1165  | 
apply eventually_elim  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1166  | 
apply (auto simp: log_divide_eq log_mult_eq zero_le_mult_iff zero_less_mult_iff zero_less_divide_iff field_simps  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1167  | 
less_le space_pair_measure)  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1168  | 
done  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1169  | 
qed (auto simp: b_gt_1 minus_log_convex)  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1170  | 
also have "\<dots> = conditional_mutual_information b S T P X Y Z"  | 
| 61808 | 1171  | 
unfolding \<open>?eq\<close>  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1172  | 
apply (subst integral_real_density)  | 
| 50003 | 1173  | 
apply simp  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1174  | 
apply (auto simp: space_pair_measure) []  | 
| 50003 | 1175  | 
apply simp  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1176  | 
apply (intro integral_cong_AE)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1177  | 
using ae1 ae2 ae3 ae4  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1178  | 
apply (auto simp: log_divide_eq zero_less_mult_iff zero_less_divide_iff field_simps  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1179  | 
space_pair_measure less_le)  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1180  | 
done  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1181  | 
finally show ?nonneg  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1182  | 
by simp  | 
| 40859 | 1183  | 
qed  | 
1184  | 
||
| 49803 | 1185  | 
lemma (in information_space)  | 
1186  | 
fixes Px :: "_ \<Rightarrow> real"  | 
|
1187  | 
assumes S: "sigma_finite_measure S" and T: "sigma_finite_measure T" and P: "sigma_finite_measure P"  | 
|
1188  | 
assumes Fx: "finite_entropy S X Px"  | 
|
1189  | 
assumes Fz: "finite_entropy P Z Pz"  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1190  | 
assumes Fyz: "finite_entropy (T \<Otimes>\<^sub>M P) (\<lambda>x. (Y x, Z x)) Pyz"  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1191  | 
assumes Fxz: "finite_entropy (S \<Otimes>\<^sub>M P) (\<lambda>x. (X x, Z x)) Pxz"  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1192  | 
assumes Fxyz: "finite_entropy (S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P) (\<lambda>x. (X x, Y x, Z x)) Pxyz"  | 
| 49803 | 1193  | 
shows conditional_mutual_information_generic_eq': "conditional_mutual_information b S T P X Y Z  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1194  | 
= (\<integral>(x, y, z). Pxyz (x, y, z) * log b (Pxyz (x, y, z) / (Pxz (x, z) * (Pyz (y,z) / Pz z))) \<partial>(S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P))" (is "?eq")  | 
| 49803 | 1195  | 
and conditional_mutual_information_generic_nonneg': "0 \<le> conditional_mutual_information b S T P X Y Z" (is "?nonneg")  | 
1196  | 
proof -  | 
|
| 50003 | 1197  | 
note Px = Fx[THEN finite_entropy_distributed, measurable]  | 
1198  | 
note Pz = Fz[THEN finite_entropy_distributed, measurable]  | 
|
1199  | 
note Pyz = Fyz[THEN finite_entropy_distributed, measurable]  | 
|
1200  | 
note Pxz = Fxz[THEN finite_entropy_distributed, measurable]  | 
|
1201  | 
note Pxyz = Fxyz[THEN finite_entropy_distributed, measurable]  | 
|
| 49803 | 1202  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1203  | 
note Px_nn = Fx[THEN finite_entropy_nn]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1204  | 
note Pz_nn = Fz[THEN finite_entropy_nn]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1205  | 
note Pyz_nn = Fyz[THEN finite_entropy_nn]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1206  | 
note Pxz_nn = Fxz[THEN finite_entropy_nn]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1207  | 
note Pxyz_nn = Fxyz[THEN finite_entropy_nn]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1208  | 
|
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1209  | 
note Px' = Fx[THEN finite_entropy_measurable, measurable]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1210  | 
note Pz' = Fz[THEN finite_entropy_measurable, measurable]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1211  | 
note Pyz' = Fyz[THEN finite_entropy_measurable, measurable]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1212  | 
note Pxz' = Fxz[THEN finite_entropy_measurable, measurable]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1213  | 
note Pxyz' = Fxyz[THEN finite_entropy_measurable, measurable]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1214  | 
|
| 49803 | 1215  | 
interpret S: sigma_finite_measure S by fact  | 
1216  | 
interpret T: sigma_finite_measure T by fact  | 
|
1217  | 
interpret P: sigma_finite_measure P by fact  | 
|
1218  | 
interpret TP: pair_sigma_finite T P ..  | 
|
1219  | 
interpret SP: pair_sigma_finite S P ..  | 
|
1220  | 
interpret ST: pair_sigma_finite S T ..  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1221  | 
interpret SPT: pair_sigma_finite "S \<Otimes>\<^sub>M P" T ..  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1222  | 
interpret STP: pair_sigma_finite S "T \<Otimes>\<^sub>M P" ..  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1223  | 
interpret TPS: pair_sigma_finite "T \<Otimes>\<^sub>M P" S ..  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1224  | 
have TP: "sigma_finite_measure (T \<Otimes>\<^sub>M P)" ..  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1225  | 
have SP: "sigma_finite_measure (S \<Otimes>\<^sub>M P)" ..  | 
| 49803 | 1226  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1227  | 
from Pxz Pxyz have distr_eq: "distr M (S \<Otimes>\<^sub>M P) (\<lambda>x. (X x, Z x)) =  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1228  | 
distr (distr M (S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P) (\<lambda>x. (X x, Y x, Z x))) (S \<Otimes>\<^sub>M P) (\<lambda>(x, y, z). (x, z))"  | 
| 50003 | 1229  | 
by (simp add: distr_distr comp_def)  | 
| 49803 | 1230  | 
|
1231  | 
have "mutual_information b S P X Z =  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1232  | 
(\<integral>x. Pxz x * log b (Pxz x / (Px (fst x) * Pz (snd x))) \<partial>(S \<Otimes>\<^sub>M P))"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1233  | 
using Px Px_nn Pz Pz_nn Pxz Pxz_nn  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1234  | 
by (rule mutual_information_distr[OF S P]) (auto simp: space_pair_measure)  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1235  | 
also have "\<dots> = (\<integral>(x,y,z). Pxyz (x,y,z) * log b (Pxz (x,z) / (Px x * Pz z)) \<partial>(S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P))"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1236  | 
using b_gt_1 Pxz Pxz_nn Pxyz Pxyz_nn  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1237  | 
by (subst distributed_transform_integral[OF Pxyz _ Pxz, where T="\<lambda>(x, y, z). (x, z)"])  | 
| 50003 | 1238  | 
(auto simp: split_beta')  | 
| 49803 | 1239  | 
finally have mi_eq:  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1240  | 
"mutual_information b S P X Z = (\<integral>(x,y,z). Pxyz (x,y,z) * log b (Pxz (x,z) / (Px x * Pz z)) \<partial>(S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P))" .  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1241  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1242  | 
have ae1: "AE x in S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P. Px (fst x) = 0 \<longrightarrow> Pxyz x = 0"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1243  | 
by (intro subdensity_finite_entropy[of fst, OF _ Fxyz Fx]) auto  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1244  | 
moreover have ae2: "AE x in S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P. Pz (snd (snd x)) = 0 \<longrightarrow> Pxyz x = 0"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1245  | 
by (intro subdensity_finite_entropy[of "\<lambda>x. snd (snd x)", OF _ Fxyz Fz]) auto  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1246  | 
moreover have ae3: "AE x in S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P. Pxz (fst x, snd (snd x)) = 0 \<longrightarrow> Pxyz x = 0"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1247  | 
by (intro subdensity_finite_entropy[of "\<lambda>x. (fst x, snd (snd x))", OF _ Fxyz Fxz]) auto  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1248  | 
moreover have ae4: "AE x in S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P. Pyz (snd x) = 0 \<longrightarrow> Pxyz x = 0"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1249  | 
by (intro subdensity_finite_entropy[of snd, OF _ Fxyz Fyz]) auto  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1250  | 
ultimately have ae: "AE x in S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P.  | 
| 49803 | 1251  | 
Pxyz x * log b (Pxyz x / (Px (fst x) * Pyz (snd x))) -  | 
1252  | 
Pxyz x * log b (Pxz (fst x, snd (snd x)) / (Px (fst x) * Pz (snd (snd x)))) =  | 
|
1253  | 
Pxyz x * log b (Pxyz x * Pz (snd (snd x)) / (Pxz (fst x, snd (snd x)) * Pyz (snd x))) "  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1254  | 
using AE_space  | 
| 49803 | 1255  | 
proof eventually_elim  | 
| 60580 | 1256  | 
case (elim x)  | 
| 49803 | 1257  | 
show ?case  | 
1258  | 
proof cases  | 
|
1259  | 
assume "Pxyz x \<noteq> 0"  | 
|
| 60580 | 1260  | 
with elim have "0 < Px (fst x)" "0 < Pz (snd (snd x))" "0 < Pxz (fst x, snd (snd x))"  | 
1261  | 
"0 < Pyz (snd x)" "0 < Pxyz x"  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1262  | 
using Px_nn Pz_nn Pxz_nn Pyz_nn Pxyz_nn  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1263  | 
by (auto simp: space_pair_measure less_le)  | 
| 49803 | 1264  | 
then show ?thesis  | 
| 56544 | 1265  | 
using b_gt_1 by (simp add: log_simps less_imp_le field_simps)  | 
| 49803 | 1266  | 
qed simp  | 
1267  | 
qed  | 
|
1268  | 
||
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1269  | 
have "integrable (S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P)  | 
| 49803 | 1270  | 
(\<lambda>x. Pxyz x * log b (Pxyz x) - Pxyz x * log b (Px (fst x)) - Pxyz x * log b (Pyz (snd x)))"  | 
1271  | 
using finite_entropy_integrable[OF Fxyz]  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1272  | 
using finite_entropy_integrable_transform[OF Fx Pxyz Pxyz_nn, of fst]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1273  | 
using finite_entropy_integrable_transform[OF Fyz Pxyz Pxyz_nn, of snd]  | 
| 49803 | 1274  | 
by simp  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1275  | 
moreover have "(\<lambda>(x, y, z). Pxyz (x, y, z) * log b (Pxyz (x, y, z) / (Px x * Pyz (y, z)))) \<in> borel_measurable (S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P)"  | 
| 50003 | 1276  | 
using Pxyz Px Pyz by simp  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1277  | 
ultimately have I1: "integrable (S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P) (\<lambda>(x, y, z). Pxyz (x, y, z) * log b (Pxyz (x, y, z) / (Px x * Pyz (y, z))))"  | 
| 49803 | 1278  | 
apply (rule integrable_cong_AE_imp)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1279  | 
using ae1 ae4 AE_space  | 
| 49803 | 1280  | 
by eventually_elim  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1281  | 
(insert Px_nn Pyz_nn Pxyz_nn,  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1282  | 
auto simp: log_divide_eq log_mult_eq field_simps zero_less_mult_iff space_pair_measure less_le)  | 
| 49803 | 1283  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1284  | 
have "integrable (S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P)  | 
| 49803 | 1285  | 
(\<lambda>x. Pxyz x * log b (Pxz (fst x, snd (snd x))) - Pxyz x * log b (Px (fst x)) - Pxyz x * log b (Pz (snd (snd x))))"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1286  | 
using finite_entropy_integrable_transform[OF Fxz Pxyz Pxyz_nn, of "\<lambda>x. (fst x, snd (snd x))"]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1287  | 
using finite_entropy_integrable_transform[OF Fx Pxyz Pxyz_nn, of fst]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1288  | 
using finite_entropy_integrable_transform[OF Fz Pxyz Pxyz_nn, of "snd \<circ> snd"]  | 
| 50003 | 1289  | 
by simp  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1290  | 
moreover have "(\<lambda>(x, y, z). Pxyz (x, y, z) * log b (Pxz (x, z) / (Px x * Pz z))) \<in> borel_measurable (S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P)"  | 
| 49803 | 1291  | 
using Pxyz Px Pz  | 
| 50003 | 1292  | 
by auto  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1293  | 
ultimately have I2: "integrable (S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P) (\<lambda>(x, y, z). Pxyz (x, y, z) * log b (Pxz (x, z) / (Px x * Pz z)))"  | 
| 49803 | 1294  | 
apply (rule integrable_cong_AE_imp)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1295  | 
using ae1 ae2 ae3 ae4 AE_space  | 
| 49803 | 1296  | 
by eventually_elim  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1297  | 
(insert Px_nn Pz_nn Pxz_nn Pyz_nn Pxyz_nn,  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1298  | 
auto simp: log_divide_eq log_mult_eq field_simps zero_less_mult_iff less_le space_pair_measure)  | 
| 49803 | 1299  | 
|
1300  | 
from ae I1 I2 show ?eq  | 
|
1301  | 
unfolding conditional_mutual_information_def  | 
|
1302  | 
apply (subst mi_eq)  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1303  | 
apply (subst mutual_information_distr[OF S TP Px Px_nn Pyz Pyz_nn Pxyz Pxyz_nn])  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1304  | 
apply simp  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1305  | 
apply simp  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1306  | 
apply (simp add: space_pair_measure)  | 
| 
63886
 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 
hoelzl 
parents: 
63626 
diff
changeset
 | 
1307  | 
apply (subst Bochner_Integration.integral_diff[symmetric])  | 
| 
 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 
hoelzl 
parents: 
63626 
diff
changeset
 | 
1308  | 
apply (auto intro!: integral_cong_AE simp: split_beta' simp del: Bochner_Integration.integral_diff)  | 
| 49803 | 1309  | 
done  | 
1310  | 
||
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1311  | 
let ?P = "density (S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P) Pxyz"  | 
| 49803 | 1312  | 
interpret P: prob_space ?P  | 
| 50003 | 1313  | 
unfolding distributed_distr_eq_density[OF Pxyz, symmetric] by (rule prob_space_distr) simp  | 
| 49803 | 1314  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1315  | 
let ?Q = "density (T \<Otimes>\<^sub>M P) Pyz"  | 
| 49803 | 1316  | 
interpret Q: prob_space ?Q  | 
| 50003 | 1317  | 
unfolding distributed_distr_eq_density[OF Pyz, symmetric] by (rule prob_space_distr) simp  | 
| 49803 | 1318  | 
|
1319  | 
let ?f = "\<lambda>(x, y, z). Pxz (x, z) * (Pyz (y, z) / Pz z) / Pxyz (x, y, z)"  | 
|
1320  | 
||
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1321  | 
from subdensity_finite_entropy[of snd, OF _ Fyz Fz]  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1322  | 
have aeX1: "AE x in T \<Otimes>\<^sub>M P. Pz (snd x) = 0 \<longrightarrow> Pyz x = 0" by (auto simp: comp_def)  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1323  | 
have aeX2: "AE x in T \<Otimes>\<^sub>M P. 0 \<le> Pz (snd x)"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1324  | 
using Pz by (intro TP.AE_pair_measure) (auto intro: Pz_nn)  | 
| 49803 | 1325  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1326  | 
have aeX3: "AE y in T \<Otimes>\<^sub>M P. (\<integral>\<^sup>+ x. ennreal (Pxz (x, snd y)) \<partial>S) = ennreal (Pz (snd y))"  | 
| 49803 | 1327  | 
using Pz distributed_marginal_eq_joint2[OF P S Pz Pxz]  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1328  | 
by (intro TP.AE_pair_measure) (auto )  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1329  | 
have "(\<integral>\<^sup>+ x. ?f x \<partial>?P) \<le> (\<integral>\<^sup>+ (x, y, z). Pxz (x, z) * (Pyz (y, z) / Pz z) \<partial>(S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P))"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1330  | 
using Px_nn Pz_nn Pxz_nn Pyz_nn Pxyz_nn  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1331  | 
by (subst nn_integral_density)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1332  | 
(auto intro!: nn_integral_mono simp: space_pair_measure ennreal_mult[symmetric])  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1333  | 
also have "\<dots> = (\<integral>\<^sup>+(y, z). \<integral>\<^sup>+ x. ennreal (Pxz (x, z)) * ennreal (Pyz (y, z) / Pz z) \<partial>S \<partial>T \<Otimes>\<^sub>M P)"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1334  | 
using Px_nn Pz_nn Pxz_nn Pyz_nn Pxyz_nn  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1335  | 
by (subst STP.nn_integral_snd[symmetric])  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1336  | 
(auto simp add: split_beta' ennreal_mult[symmetric] space_pair_measure intro!: nn_integral_cong)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1337  | 
also have "\<dots> = (\<integral>\<^sup>+x. ennreal (Pyz x) * 1 \<partial>T \<Otimes>\<^sub>M P)"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1338  | 
apply (rule nn_integral_cong_AE)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1339  | 
using aeX1 aeX2 aeX3 AE_space  | 
| 49803 | 1340  | 
apply eventually_elim  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1341  | 
proof (case_tac x, simp add: space_pair_measure)  | 
| 49803 | 1342  | 
fix a b assume "Pz b = 0 \<longrightarrow> Pyz (a, b) = 0" "0 \<le> Pz b" "a \<in> space T \<and> b \<in> space P"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1343  | 
"(\<integral>\<^sup>+ x. ennreal (Pxz (x, b)) \<partial>S) = ennreal (Pz b)"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1344  | 
then show "(\<integral>\<^sup>+ x. ennreal (Pxz (x, b)) * ennreal (Pyz (a, b) / Pz b) \<partial>S) = ennreal (Pyz (a, b))"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1345  | 
using Pyz_nn[of "(a,b)"]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1346  | 
by (subst nn_integral_multc) (auto simp: space_pair_measure ennreal_mult[symmetric])  | 
| 49803 | 1347  | 
qed  | 
1348  | 
also have "\<dots> = 1"  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1349  | 
using Q.emeasure_space_1 Pyz_nn distributed_distr_eq_density[OF Pyz]  | 
| 56996 | 1350  | 
by (subst nn_integral_density[symmetric]) auto  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1351  | 
finally have le1: "(\<integral>\<^sup>+ x. ?f x \<partial>?P) \<le> 1" .  | 
| 49803 | 1352  | 
also have "\<dots> < \<infinity>" by simp  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1353  | 
finally have fin: "(\<integral>\<^sup>+ x. ?f x \<partial>?P) \<noteq> \<infinity>" by simp  | 
| 49803 | 1354  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1355  | 
have "(\<integral>\<^sup>+ x. ?f x \<partial>?P) \<noteq> 0"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1356  | 
using Pxyz_nn  | 
| 56996 | 1357  | 
apply (subst nn_integral_density)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1358  | 
apply (simp_all add: split_beta' ennreal_mult'[symmetric] cong: nn_integral_cong)  | 
| 49803 | 1359  | 
proof  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1360  | 
let ?g = "\<lambda>x. ennreal (if Pxyz x = 0 then 0 else Pxz (fst x, snd (snd x)) * Pyz (snd x) / Pz (snd (snd x)))"  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1361  | 
assume "(\<integral>\<^sup>+ x. ?g x \<partial>(S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P)) = 0"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1362  | 
then have "AE x in S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P. ?g x = 0"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1363  | 
by (intro nn_integral_0_iff_AE[THEN iffD1]) auto  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1364  | 
then have "AE x in S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P. Pxyz x = 0"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1365  | 
using ae1 ae2 ae3 ae4 AE_space  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1366  | 
by eventually_elim  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1367  | 
(insert Px_nn Pz_nn Pxz_nn Pyz_nn,  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1368  | 
auto split: if_split_asm simp: mult_le_0_iff divide_le_0_iff space_pair_measure)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1369  | 
then have "(\<integral>\<^sup>+ x. ennreal (Pxyz x) \<partial>S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P) = 0"  | 
| 56996 | 1370  | 
by (subst nn_integral_cong_AE[of _ "\<lambda>x. 0"]) auto  | 
| 49803 | 1371  | 
with P.emeasure_space_1 show False  | 
| 56996 | 1372  | 
by (subst (asm) emeasure_density) (auto cong: nn_integral_cong)  | 
| 49803 | 1373  | 
qed  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1374  | 
then have pos: "0 < (\<integral>\<^sup>+ x. ?f x \<partial>?P)"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1375  | 
by (simp add: zero_less_iff_neq_zero)  | 
| 49803 | 1376  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1377  | 
have neg: "(\<integral>\<^sup>+ x. - ?f x \<partial>?P) = 0"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1378  | 
using Pz_nn Pxz_nn Pyz_nn Pxyz_nn  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1379  | 
by (intro nn_integral_0_iff_AE[THEN iffD2])  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1380  | 
(auto simp: split_beta' AE_density space_pair_measure intro!: AE_I2 ennreal_neg)  | 
| 49803 | 1381  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1382  | 
have I3: "integrable (S \<Otimes>\<^sub>M T \<Otimes>\<^sub>M P) (\<lambda>(x, y, z). Pxyz (x, y, z) * log b (Pxyz (x, y, z) / (Pxz (x, z) * (Pyz (y,z) / Pz z))))"  | 
| 
63886
 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 
hoelzl 
parents: 
63626 
diff
changeset
 | 
1383  | 
apply (rule integrable_cong_AE[THEN iffD1, OF _ _ _ Bochner_Integration.integrable_diff[OF I1 I2]])  | 
| 49803 | 1384  | 
using ae  | 
| 50003 | 1385  | 
apply (auto simp: split_beta')  | 
| 49803 | 1386  | 
done  | 
1387  | 
||
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1388  | 
have "- log b 1 \<le> - log b (integral\<^sup>L ?P ?f)"  | 
| 49803 | 1389  | 
proof (intro le_imp_neg_le log_le[OF b_gt_1])  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1390  | 
have If: "integrable ?P ?f"  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1391  | 
unfolding real_integrable_def  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1392  | 
proof (intro conjI)  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1393  | 
from neg show "(\<integral>\<^sup>+ x. - ?f x \<partial>?P) \<noteq> \<infinity>"  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1394  | 
by simp  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1395  | 
from fin show "(\<integral>\<^sup>+ x. ?f x \<partial>?P) \<noteq> \<infinity>"  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1396  | 
by simp  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1397  | 
qed simp  | 
| 
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1398  | 
then have "(\<integral>\<^sup>+ x. ?f x \<partial>?P) = (\<integral>x. ?f x \<partial>?P)"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1399  | 
using Pz_nn Pxz_nn Pyz_nn Pxyz_nn  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1400  | 
by (intro nn_integral_eq_integral)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1401  | 
(auto simp: AE_density space_pair_measure)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1402  | 
with pos le1  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1403  | 
show "0 < (\<integral>x. ?f x \<partial>?P)" "(\<integral>x. ?f x \<partial>?P) \<le> 1"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1404  | 
by (simp_all add: )  | 
| 49803 | 1405  | 
qed  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1406  | 
also have "- log b (integral\<^sup>L ?P ?f) \<le> (\<integral> x. - log b (?f x) \<partial>?P)"  | 
| 49803 | 1407  | 
  proof (rule P.jensens_inequality[where a=0 and b=1 and I="{0<..}"])
 | 
1408  | 
    show "AE x in ?P. ?f x \<in> {0<..}"
 | 
|
1409  | 
unfolding AE_density[OF distributed_borel_measurable[OF Pxyz]]  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1410  | 
using ae1 ae2 ae3 ae4 AE_space  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1411  | 
by eventually_elim (insert Pxyz_nn Pyz_nn Pz_nn Pxz_nn, auto simp: space_pair_measure less_le)  | 
| 49803 | 1412  | 
show "integrable ?P ?f"  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1413  | 
unfolding real_integrable_def  | 
| 50003 | 1414  | 
using fin neg by (auto simp: split_beta')  | 
| 49803 | 1415  | 
show "integrable ?P (\<lambda>x. - log b (?f x))"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1416  | 
using Pz_nn Pxz_nn Pyz_nn Pxyz_nn  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1417  | 
apply (subst integrable_real_density)  | 
| 50003 | 1418  | 
apply simp  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1419  | 
apply simp  | 
| 50003 | 1420  | 
apply simp  | 
| 49803 | 1421  | 
apply (rule integrable_cong_AE[THEN iffD1, OF _ _ _ I3])  | 
| 50003 | 1422  | 
apply simp  | 
1423  | 
apply simp  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1424  | 
using ae1 ae2 ae3 ae4 AE_space  | 
| 49803 | 1425  | 
apply eventually_elim  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1426  | 
apply (auto simp: log_divide_eq log_mult_eq zero_le_mult_iff zero_less_mult_iff  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1427  | 
zero_less_divide_iff field_simps space_pair_measure less_le)  | 
| 49803 | 1428  | 
done  | 
1429  | 
qed (auto simp: b_gt_1 minus_log_convex)  | 
|
1430  | 
also have "\<dots> = conditional_mutual_information b S T P X Y Z"  | 
|
| 61808 | 1431  | 
unfolding \<open>?eq\<close>  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1432  | 
using Pz_nn Pxz_nn Pyz_nn Pxyz_nn  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1433  | 
apply (subst integral_real_density)  | 
| 50003 | 1434  | 
apply simp  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1435  | 
apply simp  | 
| 50003 | 1436  | 
apply simp  | 
| 49803 | 1437  | 
apply (intro integral_cong_AE)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1438  | 
using ae1 ae2 ae3 ae4 AE_space  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1439  | 
apply (auto simp: log_divide_eq zero_less_mult_iff zero_less_divide_iff  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1440  | 
field_simps space_pair_measure less_le)  | 
| 49803 | 1441  | 
done  | 
1442  | 
finally show ?nonneg  | 
|
1443  | 
by simp  | 
|
1444  | 
qed  | 
|
1445  | 
||
| 40859 | 1446  | 
lemma (in information_space) conditional_mutual_information_eq:  | 
| 47694 | 1447  | 
assumes Pz: "simple_distributed M Z Pz"  | 
1448  | 
assumes Pyz: "simple_distributed M (\<lambda>x. (Y x, Z x)) Pyz"  | 
|
1449  | 
assumes Pxz: "simple_distributed M (\<lambda>x. (X x, Z x)) Pxz"  | 
|
1450  | 
assumes Pxyz: "simple_distributed M (\<lambda>x. (X x, Y x, Z x)) Pxyz"  | 
|
1451  | 
shows "\<I>(X ; Y | Z) =  | 
|
1452  | 
(\<Sum>(x, y, z)\<in>(\<lambda>x. (X x, Y x, Z x))`space M. Pxyz (x, y, z) * log b (Pxyz (x, y, z) / (Pxz (x, z) * (Pyz (y,z) / Pz z))))"  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1453  | 
proof (subst conditional_mutual_information_generic_eq[OF _ _ _ _ _  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1454  | 
simple_distributed[OF Pz] _ simple_distributed_joint[OF Pyz] _ simple_distributed_joint[OF Pxz] _  | 
| 47694 | 1455  | 
simple_distributed_joint2[OF Pxyz]])  | 
1456  | 
note simple_distributed_joint2_finite[OF Pxyz, simp]  | 
|
1457  | 
show "sigma_finite_measure (count_space (X ` space M))"  | 
|
1458  | 
by (simp add: sigma_finite_measure_count_space_finite)  | 
|
1459  | 
show "sigma_finite_measure (count_space (Y ` space M))"  | 
|
1460  | 
by (simp add: sigma_finite_measure_count_space_finite)  | 
|
1461  | 
show "sigma_finite_measure (count_space (Z ` space M))"  | 
|
1462  | 
by (simp add: sigma_finite_measure_count_space_finite)  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1463  | 
have "count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M) \<Otimes>\<^sub>M count_space (Z ` space M) =  | 
| 47694 | 1464  | 
count_space (X`space M \<times> Y`space M \<times> Z`space M)"  | 
1465  | 
(is "?P = ?C")  | 
|
1466  | 
by (simp add: pair_measure_count_space)  | 
|
| 40859 | 1467  | 
|
| 47694 | 1468  | 
  let ?Px = "\<lambda>x. measure M (X -` {x} \<inter> space M)"
 | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1469  | 
have "(\<lambda>x. (X x, Z x)) \<in> measurable M (count_space (X ` space M) \<Otimes>\<^sub>M count_space (Z ` space M))"  | 
| 47694 | 1470  | 
using simple_distributed_joint[OF Pxz] by (rule distributed_measurable)  | 
1471  | 
from measurable_comp[OF this measurable_fst]  | 
|
1472  | 
have "random_variable (count_space (X ` space M)) X"  | 
|
1473  | 
by (simp add: comp_def)  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1474  | 
then have "simple_function M X"  | 
| 
50002
 
ce0d316b5b44
add measurability prover; add support for Borel sets
 
hoelzl 
parents: 
49999 
diff
changeset
 | 
1475  | 
unfolding simple_function_def by (auto simp: measurable_count_space_eq2)  | 
| 47694 | 1476  | 
then have "simple_distributed M X ?Px"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1477  | 
by (rule simple_distributedI) (auto simp: measure_nonneg)  | 
| 47694 | 1478  | 
then show "distributed M (count_space (X ` space M)) X ?Px"  | 
1479  | 
by (rule simple_distributed)  | 
|
1480  | 
||
1481  | 
let ?f = "(\<lambda>x. if x \<in> (\<lambda>x. (X x, Y x, Z x)) ` space M then Pxyz x else 0)"  | 
|
1482  | 
let ?g = "(\<lambda>x. if x \<in> (\<lambda>x. (Y x, Z x)) ` space M then Pyz x else 0)"  | 
|
1483  | 
let ?h = "(\<lambda>x. if x \<in> (\<lambda>x. (X x, Z x)) ` space M then Pxz x else 0)"  | 
|
1484  | 
show  | 
|
1485  | 
"integrable ?P (\<lambda>(x, y, z). ?f (x, y, z) * log b (?f (x, y, z) / (?Px x * ?g (y, z))))"  | 
|
1486  | 
"integrable ?P (\<lambda>(x, y, z). ?f (x, y, z) * log b (?h (x, z) / (?Px x * Pz z)))"  | 
|
1487  | 
by (auto intro!: integrable_count_space simp: pair_measure_count_space)  | 
|
1488  | 
let ?i = "\<lambda>x y z. ?f (x, y, z) * log b (?f (x, y, z) / (?h (x, z) * (?g (y, z) / Pz z)))"  | 
|
1489  | 
let ?j = "\<lambda>x y z. Pxyz (x, y, z) * log b (Pxyz (x, y, z) / (Pxz (x, z) * (Pyz (y,z) / Pz z)))"  | 
|
1490  | 
have "(\<lambda>(x, y, z). ?i x y z) = (\<lambda>x. if x \<in> (\<lambda>x. (X x, Y x, Z x)) ` space M then ?j (fst x) (fst (snd x)) (snd (snd x)) else 0)"  | 
|
1491  | 
by (auto intro!: ext)  | 
|
1492  | 
then show "(\<integral> (x, y, z). ?i x y z \<partial>?P) = (\<Sum>(x, y, z)\<in>(\<lambda>x. (X x, Y x, Z x)) ` space M. ?j x y z)"  | 
|
| 64267 | 1493  | 
by (auto intro!: sum.cong simp add: \<open>?P = ?C\<close> lebesgue_integral_count_space_finite simple_distributed_finite sum.If_cases split_beta')  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1494  | 
qed (insert Pz Pyz Pxz Pxyz, auto intro: measure_nonneg)  | 
| 36624 | 1495  | 
|
| 47694 | 1496  | 
lemma (in information_space) conditional_mutual_information_nonneg:  | 
1497  | 
assumes X: "simple_function M X" and Y: "simple_function M Y" and Z: "simple_function M Z"  | 
|
1498  | 
shows "0 \<le> \<I>(X ; Y | Z)"  | 
|
1499  | 
proof -  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1500  | 
have [simp]: "count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M) \<Otimes>\<^sub>M count_space (Z ` space M) =  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1501  | 
count_space (X`space M \<times> Y`space M \<times> Z`space M)"  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1502  | 
by (simp add: pair_measure_count_space X Y Z simple_functionD)  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1503  | 
note sf = sigma_finite_measure_count_space_finite[OF simple_functionD(1)]  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1504  | 
note sd = simple_distributedI[OF _ _ refl]  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1505  | 
note sp = simple_function_Pair  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1506  | 
show ?thesis  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1507  | 
apply (rule conditional_mutual_information_generic_nonneg[OF sf[OF X] sf[OF Y] sf[OF Z]])  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1508  | 
apply (rule simple_distributed[OF sd[OF X]])  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1509  | 
apply simp  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1510  | 
apply simp  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1511  | 
apply (rule simple_distributed[OF sd[OF Z]])  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1512  | 
apply simp  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1513  | 
apply simp  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1514  | 
apply (rule simple_distributed_joint[OF sd[OF sp[OF Y Z]]])  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1515  | 
apply simp  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1516  | 
apply simp  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1517  | 
apply (rule simple_distributed_joint[OF sd[OF sp[OF X Z]]])  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1518  | 
apply simp  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1519  | 
apply simp  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1520  | 
apply (rule simple_distributed_joint2[OF sd[OF sp[OF X sp[OF Y Z]]]])  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1521  | 
apply simp  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1522  | 
apply simp  | 
| 
49787
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1523  | 
apply (auto intro!: integrable_count_space simp: X Y Z simple_functionD)  | 
| 
 
d8de705b48d4
rule to show that conditional mutual information is non-negative in the continuous case
 
hoelzl 
parents: 
49786 
diff
changeset
 | 
1524  | 
done  | 
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
1525  | 
qed  | 
| 
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
1526  | 
|
| 61808 | 1527  | 
subsection \<open>Conditional Entropy\<close>  | 
| 39097 | 1528  | 
|
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
1529  | 
definition (in prob_space)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1530  | 
"conditional_entropy b S T X Y = - (\<integral>(x, y). log b (enn2real (RN_deriv (S \<Otimes>\<^sub>M T) (distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))) (x, y)) /  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1531  | 
enn2real (RN_deriv T (distr M T Y) y)) \<partial>distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)))"  | 
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
1532  | 
|
| 40859 | 1533  | 
abbreviation (in information_space)  | 
1534  | 
  conditional_entropy_Pow ("\<H>'(_ | _')") where
 | 
|
| 47694 | 1535  | 
"\<H>(X | Y) \<equiv> conditional_entropy b (count_space (X`space M)) (count_space (Y`space M)) X Y"  | 
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
1536  | 
|
| 49791 | 1537  | 
lemma (in information_space) conditional_entropy_generic_eq:  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1538  | 
fixes Pxy :: "_ \<Rightarrow> real" and Py :: "'c \<Rightarrow> real"  | 
| 49791 | 1539  | 
assumes S: "sigma_finite_measure S" and T: "sigma_finite_measure T"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1540  | 
assumes Py[measurable]: "distributed M T Y Py" and Py_nn[simp]: "\<And>x. x \<in> space T \<Longrightarrow> 0 \<le> Py x"  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1541  | 
assumes Pxy[measurable]: "distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) Pxy"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1542  | 
and Pxy_nn[simp]: "\<And>x y. x \<in> space S \<Longrightarrow> y \<in> space T \<Longrightarrow> 0 \<le> Pxy (x, y)"  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1543  | 
shows "conditional_entropy b S T X Y = - (\<integral>(x, y). Pxy (x, y) * log b (Pxy (x, y) / Py y) \<partial>(S \<Otimes>\<^sub>M T))"  | 
| 49791 | 1544  | 
proof -  | 
1545  | 
interpret S: sigma_finite_measure S by fact  | 
|
1546  | 
interpret T: sigma_finite_measure T by fact  | 
|
1547  | 
interpret ST: pair_sigma_finite S T ..  | 
|
1548  | 
||
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1549  | 
have [measurable]: "Py \<in> T \<rightarrow>\<^sub>M borel"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1550  | 
using Py Py_nn by (intro distributed_real_measurable)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1551  | 
have measurable_Pxy[measurable]: "Pxy \<in> (S \<Otimes>\<^sub>M T) \<rightarrow>\<^sub>M borel"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1552  | 
using Pxy Pxy_nn by (intro distributed_real_measurable) (auto simp: space_pair_measure)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1553  | 
|
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1554  | 
have "AE x in density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Pxy x)). Pxy x = enn2real (RN_deriv (S \<Otimes>\<^sub>M T) (distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))) x)"  | 
| 49791 | 1555  | 
unfolding AE_density[OF distributed_borel_measurable, OF Pxy]  | 
1556  | 
unfolding distributed_distr_eq_density[OF Pxy]  | 
|
1557  | 
using distributed_RN_deriv[OF Pxy]  | 
|
1558  | 
by auto  | 
|
1559  | 
moreover  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1560  | 
have "AE x in density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Pxy x)). Py (snd x) = enn2real (RN_deriv T (distr M T Y) (snd x))"  | 
| 49791 | 1561  | 
unfolding AE_density[OF distributed_borel_measurable, OF Pxy]  | 
1562  | 
unfolding distributed_distr_eq_density[OF Py]  | 
|
1563  | 
apply (rule ST.AE_pair_measure)  | 
|
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1564  | 
apply auto  | 
| 49791 | 1565  | 
using distributed_RN_deriv[OF Py]  | 
1566  | 
apply auto  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1567  | 
done  | 
| 49791 | 1568  | 
ultimately  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1569  | 
have "conditional_entropy b S T X Y = - (\<integral>x. Pxy x * log b (Pxy x / Py (snd x)) \<partial>(S \<Otimes>\<^sub>M T))"  | 
| 49791 | 1570  | 
unfolding conditional_entropy_def neg_equal_iff_equal  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1571  | 
apply (subst integral_real_density[symmetric])  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1572  | 
apply (auto simp: distributed_distr_eq_density[OF Pxy] space_pair_measure  | 
| 49791 | 1573  | 
intro!: integral_cong_AE)  | 
1574  | 
done  | 
|
1575  | 
then show ?thesis by (simp add: split_beta')  | 
|
1576  | 
qed  | 
|
1577  | 
||
1578  | 
lemma (in information_space) conditional_entropy_eq_entropy:  | 
|
| 47694 | 1579  | 
fixes Px :: "'b \<Rightarrow> real" and Py :: "'c \<Rightarrow> real"  | 
1580  | 
assumes S: "sigma_finite_measure S" and T: "sigma_finite_measure T"  | 
|
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1581  | 
assumes Py[measurable]: "distributed M T Y Py"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1582  | 
and Py_nn[simp]: "\<And>x. x \<in> space T \<Longrightarrow> 0 \<le> Py x"  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1583  | 
assumes Pxy[measurable]: "distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) Pxy"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1584  | 
and Pxy_nn[simp]: "\<And>x y. x \<in> space S \<Longrightarrow> y \<in> space T \<Longrightarrow> 0 \<le> Pxy (x, y)"  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1585  | 
assumes I1: "integrable (S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Pxy x))"  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1586  | 
assumes I2: "integrable (S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Py (snd x)))"  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1587  | 
shows "conditional_entropy b S T X Y = entropy b (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) - entropy b T Y"  | 
| 40859 | 1588  | 
proof -  | 
| 47694 | 1589  | 
interpret S: sigma_finite_measure S by fact  | 
1590  | 
interpret T: sigma_finite_measure T by fact  | 
|
1591  | 
interpret ST: pair_sigma_finite S T ..  | 
|
1592  | 
||
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1593  | 
have [measurable]: "Py \<in> T \<rightarrow>\<^sub>M borel"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1594  | 
using Py Py_nn by (intro distributed_real_measurable)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1595  | 
have measurable_Pxy[measurable]: "Pxy \<in> (S \<Otimes>\<^sub>M T) \<rightarrow>\<^sub>M borel"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1596  | 
using Pxy Pxy_nn by (intro distributed_real_measurable) (auto simp: space_pair_measure)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1597  | 
|
| 47694 | 1598  | 
have "entropy b T Y = - (\<integral>y. Py y * log b (Py y) \<partial>T)"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1599  | 
by (rule entropy_distr[OF Py Py_nn])  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1600  | 
also have "\<dots> = - (\<integral>(x,y). Pxy (x,y) * log b (Py y) \<partial>(S \<Otimes>\<^sub>M T))"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1601  | 
using b_gt_1  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1602  | 
by (subst distributed_transform_integral[OF Pxy _ Py, where T=snd])  | 
| 
63886
 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 
hoelzl 
parents: 
63626 
diff
changeset
 | 
1603  | 
(auto intro!: Bochner_Integration.integral_cong simp: space_pair_measure)  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1604  | 
finally have e_eq: "entropy b T Y = - (\<integral>(x,y). Pxy (x,y) * log b (Py y) \<partial>(S \<Otimes>\<^sub>M T))" .  | 
| 49791 | 1605  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1606  | 
have **: "\<And>x. x \<in> space (S \<Otimes>\<^sub>M T) \<Longrightarrow> 0 \<le> Pxy x"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1607  | 
by (auto simp: space_pair_measure)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1608  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1609  | 
have ae2: "AE x in S \<Otimes>\<^sub>M T. Py (snd x) = 0 \<longrightarrow> Pxy x = 0"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1610  | 
by (intro subdensity_real[of snd, OF _ Pxy Py])  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1611  | 
(auto intro: measurable_Pair simp: space_pair_measure)  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1612  | 
moreover have ae4: "AE x in S \<Otimes>\<^sub>M T. 0 \<le> Py (snd x)"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1613  | 
using Py by (intro ST.AE_pair_measure) (auto simp: comp_def intro!: measurable_snd'')  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1614  | 
ultimately have "AE x in S \<Otimes>\<^sub>M T. 0 \<le> Pxy x \<and> 0 \<le> Py (snd x) \<and>  | 
| 
49790
 
6b9b9ebba47d
remove unneeded assumption from conditional_entropy_generic_eq
 
hoelzl 
parents: 
49788 
diff
changeset
 | 
1615  | 
(Pxy x = 0 \<or> (Pxy x \<noteq> 0 \<longrightarrow> 0 < Pxy x \<and> 0 < Py (snd x)))"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1616  | 
using AE_space by eventually_elim (auto simp: space_pair_measure less_le)  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1617  | 
then have ae: "AE x in S \<Otimes>\<^sub>M T.  | 
| 47694 | 1618  | 
Pxy x * log b (Pxy x) - Pxy x * log b (Py (snd x)) = Pxy x * log b (Pxy x / Py (snd x))"  | 
| 56544 | 1619  | 
by eventually_elim (auto simp: log_simps field_simps b_gt_1)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1620  | 
have "conditional_entropy b S T X Y =  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1621  | 
- (\<integral>x. Pxy x * log b (Pxy x) - Pxy x * log b (Py (snd x)) \<partial>(S \<Otimes>\<^sub>M T))"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1622  | 
unfolding conditional_entropy_generic_eq[OF S T Py Py_nn Pxy Pxy_nn, simplified] neg_equal_iff_equal  | 
| 49791 | 1623  | 
apply (intro integral_cong_AE)  | 
1624  | 
using ae  | 
|
1625  | 
apply auto  | 
|
| 47694 | 1626  | 
done  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1627  | 
also have "\<dots> = - (\<integral>x. Pxy x * log b (Pxy x) \<partial>(S \<Otimes>\<^sub>M T)) - - (\<integral>x. Pxy x * log b (Py (snd x)) \<partial>(S \<Otimes>\<^sub>M T))"  | 
| 
63886
 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 
hoelzl 
parents: 
63626 
diff
changeset
 | 
1628  | 
by (simp add: Bochner_Integration.integral_diff[OF I1 I2])  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1629  | 
finally show ?thesis  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1630  | 
using conditional_entropy_generic_eq[OF S T Py Py_nn Pxy Pxy_nn, simplified]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1631  | 
entropy_distr[OF Pxy **, simplified] e_eq  | 
| 49791 | 1632  | 
by (simp add: split_beta')  | 
1633  | 
qed  | 
|
1634  | 
||
1635  | 
lemma (in information_space) conditional_entropy_eq_entropy_simple:  | 
|
1636  | 
assumes X: "simple_function M X" and Y: "simple_function M Y"  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1637  | 
shows "\<H>(X | Y) = entropy b (count_space (X`space M) \<Otimes>\<^sub>M count_space (Y`space M)) (\<lambda>x. (X x, Y x)) - \<H>(Y)"  | 
| 49791 | 1638  | 
proof -  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1639  | 
have "count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M) = count_space (X`space M \<times> Y`space M)"  | 
| 49791 | 1640  | 
(is "?P = ?C") using X Y by (simp add: simple_functionD pair_measure_count_space)  | 
1641  | 
show ?thesis  | 
|
1642  | 
by (rule conditional_entropy_eq_entropy sigma_finite_measure_count_space_finite  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1643  | 
simple_functionD X Y simple_distributed simple_distributedI[OF _ _ refl]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1644  | 
simple_distributed_joint simple_function_Pair integrable_count_space measure_nonneg)+  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1645  | 
(auto simp: \<open>?P = ?C\<close> measure_nonneg intro!: integrable_count_space simple_functionD X Y)  | 
| 39097 | 1646  | 
qed  | 
1647  | 
||
| 40859 | 1648  | 
lemma (in information_space) conditional_entropy_eq:  | 
| 
49792
 
43f49922811d
remove unnecessary assumption from conditional_entropy_eq
 
hoelzl 
parents: 
49791 
diff
changeset
 | 
1649  | 
assumes Y: "simple_distributed M Y Py"  | 
| 47694 | 1650  | 
assumes XY: "simple_distributed M (\<lambda>x. (X x, Y x)) Pxy"  | 
1651  | 
shows "\<H>(X | Y) = - (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / Py y))"  | 
|
1652  | 
proof (subst conditional_entropy_generic_eq[OF _ _  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1653  | 
simple_distributed[OF Y] _ simple_distributed_joint[OF XY]])  | 
| 
49792
 
43f49922811d
remove unnecessary assumption from conditional_entropy_eq
 
hoelzl 
parents: 
49791 
diff
changeset
 | 
1654  | 
have "finite ((\<lambda>x. (X x, Y x))`space M)"  | 
| 
 
43f49922811d
remove unnecessary assumption from conditional_entropy_eq
 
hoelzl 
parents: 
49791 
diff
changeset
 | 
1655  | 
using XY unfolding simple_distributed_def by auto  | 
| 
 
43f49922811d
remove unnecessary assumption from conditional_entropy_eq
 
hoelzl 
parents: 
49791 
diff
changeset
 | 
1656  | 
from finite_imageI[OF this, of fst]  | 
| 
 
43f49922811d
remove unnecessary assumption from conditional_entropy_eq
 
hoelzl 
parents: 
49791 
diff
changeset
 | 
1657  | 
have [simp]: "finite (X`space M)"  | 
| 
56154
 
f0a927235162
more complete set of lemmas wrt. image and composition
 
haftmann 
parents: 
53374 
diff
changeset
 | 
1658  | 
by (simp add: image_comp comp_def)  | 
| 47694 | 1659  | 
note Y[THEN simple_distributed_finite, simp]  | 
1660  | 
show "sigma_finite_measure (count_space (X ` space M))"  | 
|
1661  | 
by (simp add: sigma_finite_measure_count_space_finite)  | 
|
1662  | 
show "sigma_finite_measure (count_space (Y ` space M))"  | 
|
1663  | 
by (simp add: sigma_finite_measure_count_space_finite)  | 
|
1664  | 
let ?f = "(\<lambda>x. if x \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy x else 0)"  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1665  | 
have "count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M) = count_space (X`space M \<times> Y`space M)"  | 
| 47694 | 1666  | 
(is "?P = ?C")  | 
| 
49792
 
43f49922811d
remove unnecessary assumption from conditional_entropy_eq
 
hoelzl 
parents: 
49791 
diff
changeset
 | 
1667  | 
using Y by (simp add: simple_distributed_finite pair_measure_count_space)  | 
| 47694 | 1668  | 
have eq: "(\<lambda>(x, y). ?f (x, y) * log b (?f (x, y) / Py y)) =  | 
1669  | 
(\<lambda>x. if x \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy x * log b (Pxy x / Py (snd x)) else 0)"  | 
|
1670  | 
by auto  | 
|
| 
49792
 
43f49922811d
remove unnecessary assumption from conditional_entropy_eq
 
hoelzl 
parents: 
49791 
diff
changeset
 | 
1671  | 
from Y show "- (\<integral> (x, y). ?f (x, y) * log b (?f (x, y) / Py y) \<partial>?P) =  | 
| 47694 | 1672  | 
- (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / Py y))"  | 
| 64267 | 1673  | 
by (auto intro!: sum.cong simp add: \<open>?P = ?C\<close> lebesgue_integral_count_space_finite simple_distributed_finite eq sum.If_cases split_beta')  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1674  | 
qed (insert Y XY, auto)  | 
| 39097 | 1675  | 
|
| 47694 | 1676  | 
lemma (in information_space) conditional_mutual_information_eq_conditional_entropy:  | 
| 
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
 | 
1677  | 
assumes X: "simple_function M X" and Y: "simple_function M Y"  | 
| 47694 | 1678  | 
shows "\<I>(X ; X | Y) = \<H>(X | Y)"  | 
1679  | 
proof -  | 
|
| 63040 | 1680  | 
  define Py where "Py x = (if x \<in> Y`space M then measure M (Y -` {x} \<inter> space M) else 0)" for x
 | 
1681  | 
define Pxy where "Pxy x =  | 
|
1682  | 
      (if x \<in> (\<lambda>x. (X x, Y x))`space M then measure M ((\<lambda>x. (X x, Y x)) -` {x} \<inter> space M) else 0)"
 | 
|
1683  | 
for x  | 
|
1684  | 
define Pxxy where "Pxxy x =  | 
|
1685  | 
      (if x \<in> (\<lambda>x. (X x, X x, Y x))`space M then measure M ((\<lambda>x. (X x, X x, Y x)) -` {x} \<inter> space M)
 | 
|
1686  | 
else 0)"  | 
|
1687  | 
for x  | 
|
| 47694 | 1688  | 
let ?M = "X`space M \<times> X`space M \<times> Y`space M"  | 
| 39097 | 1689  | 
|
| 47694 | 1690  | 
note XY = simple_function_Pair[OF X Y]  | 
1691  | 
note XXY = simple_function_Pair[OF X XY]  | 
|
1692  | 
have Py: "simple_distributed M Y Py"  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1693  | 
using Y by (rule simple_distributedI) (auto simp: Py_def measure_nonneg)  | 
| 47694 | 1694  | 
have Pxy: "simple_distributed M (\<lambda>x. (X x, Y x)) Pxy"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1695  | 
using XY by (rule simple_distributedI) (auto simp: Pxy_def measure_nonneg)  | 
| 47694 | 1696  | 
have Pxxy: "simple_distributed M (\<lambda>x. (X x, X x, Y x)) Pxxy"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1697  | 
using XXY by (rule simple_distributedI) (auto simp: Pxxy_def measure_nonneg)  | 
| 47694 | 1698  | 
have eq: "(\<lambda>x. (X x, X x, Y x)) ` space M = (\<lambda>(x, y). (x, x, y)) ` (\<lambda>x. (X x, Y x)) ` space M"  | 
1699  | 
by auto  | 
|
1700  | 
have inj: "\<And>A. inj_on (\<lambda>(x, y). (x, x, y)) A"  | 
|
1701  | 
by (auto simp: inj_on_def)  | 
|
1702  | 
have Pxxy_eq: "\<And>x y. Pxxy (x, x, y) = Pxy (x, y)"  | 
|
1703  | 
by (auto simp: Pxxy_def Pxy_def intro!: arg_cong[where f=prob])  | 
|
1704  | 
have "AE x in count_space ((\<lambda>x. (X x, Y x))`space M). Py (snd x) = 0 \<longrightarrow> Pxy x = 0"  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1705  | 
using Py Pxy  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1706  | 
by (intro subdensity_real[of snd, OF _ Pxy[THEN simple_distributed] Py[THEN simple_distributed]])  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1707  | 
(auto intro: measurable_Pair simp: AE_count_space)  | 
| 47694 | 1708  | 
then show ?thesis  | 
1709  | 
apply (subst conditional_mutual_information_eq[OF Py Pxy Pxy Pxxy])  | 
|
| 
49792
 
43f49922811d
remove unnecessary assumption from conditional_entropy_eq
 
hoelzl 
parents: 
49791 
diff
changeset
 | 
1710  | 
apply (subst conditional_entropy_eq[OF Py Pxy])  | 
| 64267 | 1711  | 
apply (auto intro!: sum.cong simp: Pxxy_eq sum_negf[symmetric] eq sum.reindex[OF inj]  | 
| 47694 | 1712  | 
log_simps zero_less_mult_iff zero_le_mult_iff field_simps mult_less_0_iff AE_count_space)  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1713  | 
using Py[THEN simple_distributed] Pxy[THEN simple_distributed]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1714  | 
apply (auto simp add: not_le AE_count_space less_le antisym  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1715  | 
simple_distributed_nonneg[OF Py] simple_distributed_nonneg[OF Pxy])  | 
| 47694 | 1716  | 
done  | 
1717  | 
qed  | 
|
1718  | 
||
1719  | 
lemma (in information_space) conditional_entropy_nonneg:  | 
|
1720  | 
assumes X: "simple_function M X" and Y: "simple_function M Y" shows "0 \<le> \<H>(X | Y)"  | 
|
1721  | 
using conditional_mutual_information_eq_conditional_entropy[OF X Y] conditional_mutual_information_nonneg[OF X X Y]  | 
|
1722  | 
by simp  | 
|
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
1723  | 
|
| 61808 | 1724  | 
subsection \<open>Equalities\<close>  | 
| 39097 | 1725  | 
|
| 47694 | 1726  | 
lemma (in information_space) mutual_information_eq_entropy_conditional_entropy_distr:  | 
1727  | 
  fixes Px :: "'b \<Rightarrow> real" and Py :: "'c \<Rightarrow> real" and Pxy :: "('b \<times> 'c) \<Rightarrow> real"
 | 
|
1728  | 
assumes S: "sigma_finite_measure S" and T: "sigma_finite_measure T"  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1729  | 
assumes Px[measurable]: "distributed M S X Px"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1730  | 
and Px_nn[simp]: "\<And>x. x \<in> space S \<Longrightarrow> 0 \<le> Px x"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1731  | 
and Py[measurable]: "distributed M T Y Py"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1732  | 
and Py_nn[simp]: "\<And>x. x \<in> space T \<Longrightarrow> 0 \<le> Py x"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1733  | 
and Pxy[measurable]: "distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) Pxy"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1734  | 
and Pxy_nn[simp]: "\<And>x y. x \<in> space S \<Longrightarrow> y \<in> space T \<Longrightarrow> 0 \<le> Pxy (x, y)"  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1735  | 
assumes Ix: "integrable(S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Px (fst x)))"  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1736  | 
assumes Iy: "integrable(S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Py (snd x)))"  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1737  | 
assumes Ixy: "integrable(S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Pxy x))"  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1738  | 
shows "mutual_information b S T X Y = entropy b S X + entropy b T Y - entropy b (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))"  | 
| 40859 | 1739  | 
proof -  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1740  | 
have [measurable]: "Px \<in> S \<rightarrow>\<^sub>M borel"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1741  | 
using Px Px_nn by (intro distributed_real_measurable)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1742  | 
have [measurable]: "Py \<in> T \<rightarrow>\<^sub>M borel"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1743  | 
using Py Py_nn by (intro distributed_real_measurable)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1744  | 
have measurable_Pxy[measurable]: "Pxy \<in> (S \<Otimes>\<^sub>M T) \<rightarrow>\<^sub>M borel"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1745  | 
using Pxy Pxy_nn by (intro distributed_real_measurable) (auto simp: space_pair_measure)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1746  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1747  | 
have X: "entropy b S X = - (\<integral>x. Pxy x * log b (Px (fst x)) \<partial>(S \<Otimes>\<^sub>M T))"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1748  | 
using b_gt_1  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1749  | 
apply (subst entropy_distr[OF Px Px_nn], simp)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1750  | 
apply (subst distributed_transform_integral[OF Pxy _ Px, where T=fst])  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1751  | 
apply (auto intro!: integral_cong simp: space_pair_measure)  | 
| 47694 | 1752  | 
done  | 
1753  | 
||
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1754  | 
have Y: "entropy b T Y = - (\<integral>x. Pxy x * log b (Py (snd x)) \<partial>(S \<Otimes>\<^sub>M T))"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1755  | 
using b_gt_1  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1756  | 
apply (subst entropy_distr[OF Py Py_nn], simp)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1757  | 
apply (subst distributed_transform_integral[OF Pxy _ Py, where T=snd])  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1758  | 
apply (auto intro!: integral_cong simp: space_pair_measure)  | 
| 47694 | 1759  | 
done  | 
1760  | 
||
1761  | 
interpret S: sigma_finite_measure S by fact  | 
|
1762  | 
interpret T: sigma_finite_measure T by fact  | 
|
1763  | 
interpret ST: pair_sigma_finite S T ..  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1764  | 
have ST: "sigma_finite_measure (S \<Otimes>\<^sub>M T)" ..  | 
| 47694 | 1765  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1766  | 
have XY: "entropy b (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) = - (\<integral>x. Pxy x * log b (Pxy x) \<partial>(S \<Otimes>\<^sub>M T))"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1767  | 
by (subst entropy_distr[OF Pxy]) (auto intro!: integral_cong simp: space_pair_measure)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1768  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1769  | 
have "AE x in S \<Otimes>\<^sub>M T. Px (fst x) = 0 \<longrightarrow> Pxy x = 0"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1770  | 
by (intro subdensity_real[of fst, OF _ Pxy Px]) (auto intro: measurable_Pair simp: space_pair_measure)  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1771  | 
moreover have "AE x in S \<Otimes>\<^sub>M T. Py (snd x) = 0 \<longrightarrow> Pxy x = 0"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1772  | 
by (intro subdensity_real[of snd, OF _ Pxy Py]) (auto intro: measurable_Pair simp: space_pair_measure)  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1773  | 
moreover have "AE x in S \<Otimes>\<^sub>M T. 0 \<le> Px (fst x)"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1774  | 
using Px by (intro ST.AE_pair_measure) (auto simp: comp_def intro!: measurable_fst'')  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1775  | 
moreover have "AE x in S \<Otimes>\<^sub>M T. 0 \<le> Py (snd x)"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1776  | 
using Py by (intro ST.AE_pair_measure) (auto simp: comp_def intro!: measurable_snd'')  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1777  | 
ultimately have "AE x in S \<Otimes>\<^sub>M T. Pxy x * log b (Pxy x) - Pxy x * log b (Px (fst x)) - Pxy x * log b (Py (snd x)) =  | 
| 47694 | 1778  | 
Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x)))"  | 
1779  | 
(is "AE x in _. ?f x = ?g x")  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1780  | 
using AE_space  | 
| 47694 | 1781  | 
proof eventually_elim  | 
| 60580 | 1782  | 
case (elim x)  | 
| 47694 | 1783  | 
show ?case  | 
1784  | 
proof cases  | 
|
1785  | 
assume "Pxy x \<noteq> 0"  | 
|
| 60580 | 1786  | 
with elim have "0 < Px (fst x)" "0 < Py (snd x)" "0 < Pxy x"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1787  | 
by (auto simp: space_pair_measure less_le)  | 
| 47694 | 1788  | 
then show ?thesis  | 
| 56544 | 1789  | 
using b_gt_1 by (simp add: log_simps less_imp_le field_simps)  | 
| 47694 | 1790  | 
qed simp  | 
1791  | 
qed  | 
|
1792  | 
||
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1793  | 
have "entropy b S X + entropy b T Y - entropy b (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) = integral\<^sup>L (S \<Otimes>\<^sub>M T) ?f"  | 
| 47694 | 1794  | 
unfolding X Y XY  | 
| 
63886
 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 
hoelzl 
parents: 
63626 
diff
changeset
 | 
1795  | 
apply (subst Bochner_Integration.integral_diff)  | 
| 
 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 
hoelzl 
parents: 
63626 
diff
changeset
 | 
1796  | 
apply (intro Bochner_Integration.integrable_diff Ixy Ix Iy)+  | 
| 
 
685fb01256af
move Henstock-Kurzweil integration after Lebesgue_Measure; replace content by abbreviation measure lborel
 
hoelzl 
parents: 
63626 
diff
changeset
 | 
1797  | 
apply (subst Bochner_Integration.integral_diff)  | 
| 
56993
 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 
hoelzl 
parents: 
56571 
diff
changeset
 | 
1798  | 
apply (intro Ixy Ix Iy)+  | 
| 47694 | 1799  | 
apply (simp add: field_simps)  | 
1800  | 
done  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1801  | 
also have "\<dots> = integral\<^sup>L (S \<Otimes>\<^sub>M T) ?g"  | 
| 61808 | 1802  | 
using \<open>AE x in _. ?f x = ?g x\<close> by (intro integral_cong_AE) auto  | 
| 47694 | 1803  | 
also have "\<dots> = mutual_information b S T X Y"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1804  | 
by (rule mutual_information_distr[OF S T Px _ Py _ Pxy _ , symmetric])  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1805  | 
(auto simp: space_pair_measure)  | 
| 47694 | 1806  | 
finally show ?thesis ..  | 
1807  | 
qed  | 
|
1808  | 
||
| 
49802
 
dd8dffaf84b9
continuous version of mutual_information_eq_entropy_conditional_entropy
 
hoelzl 
parents: 
49792 
diff
changeset
 | 
1809  | 
lemma (in information_space) mutual_information_eq_entropy_conditional_entropy':  | 
| 
 
dd8dffaf84b9
continuous version of mutual_information_eq_entropy_conditional_entropy
 
hoelzl 
parents: 
49792 
diff
changeset
 | 
1810  | 
  fixes Px :: "'b \<Rightarrow> real" and Py :: "'c \<Rightarrow> real" and Pxy :: "('b \<times> 'c) \<Rightarrow> real"
 | 
| 
 
dd8dffaf84b9
continuous version of mutual_information_eq_entropy_conditional_entropy
 
hoelzl 
parents: 
49792 
diff
changeset
 | 
1811  | 
assumes S: "sigma_finite_measure S" and T: "sigma_finite_measure T"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1812  | 
assumes Px: "distributed M S X Px" "\<And>x. x \<in> space S \<Longrightarrow> 0 \<le> Px x"  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1813  | 
and Py: "distributed M T Y Py" "\<And>x. x \<in> space T \<Longrightarrow> 0 \<le> Py x"  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1814  | 
assumes Pxy: "distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) Pxy"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1815  | 
"\<And>x. x \<in> space (S \<Otimes>\<^sub>M T) \<Longrightarrow> 0 \<le> Pxy x"  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1816  | 
assumes Ix: "integrable(S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Px (fst x)))"  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1817  | 
assumes Iy: "integrable(S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Py (snd x)))"  | 
| 
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1818  | 
assumes Ixy: "integrable(S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Pxy x))"  | 
| 
49802
 
dd8dffaf84b9
continuous version of mutual_information_eq_entropy_conditional_entropy
 
hoelzl 
parents: 
49792 
diff
changeset
 | 
1819  | 
shows "mutual_information b S T X Y = entropy b S X - conditional_entropy b S T X Y"  | 
| 
 
dd8dffaf84b9
continuous version of mutual_information_eq_entropy_conditional_entropy
 
hoelzl 
parents: 
49792 
diff
changeset
 | 
1820  | 
using  | 
| 
 
dd8dffaf84b9
continuous version of mutual_information_eq_entropy_conditional_entropy
 
hoelzl 
parents: 
49792 
diff
changeset
 | 
1821  | 
mutual_information_eq_entropy_conditional_entropy_distr[OF S T Px Py Pxy Ix Iy Ixy]  | 
| 
 
dd8dffaf84b9
continuous version of mutual_information_eq_entropy_conditional_entropy
 
hoelzl 
parents: 
49792 
diff
changeset
 | 
1822  | 
conditional_entropy_eq_entropy[OF S T Py Pxy Ixy Iy]  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1823  | 
by (simp add: space_pair_measure)  | 
| 
49802
 
dd8dffaf84b9
continuous version of mutual_information_eq_entropy_conditional_entropy
 
hoelzl 
parents: 
49792 
diff
changeset
 | 
1824  | 
|
| 47694 | 1825  | 
lemma (in information_space) mutual_information_eq_entropy_conditional_entropy:  | 
1826  | 
assumes sf_X: "simple_function M X" and sf_Y: "simple_function M Y"  | 
|
1827  | 
shows "\<I>(X ; Y) = \<H>(X) - \<H>(X | Y)"  | 
|
1828  | 
proof -  | 
|
1829  | 
  have X: "simple_distributed M X (\<lambda>x. measure M (X -` {x} \<inter> space M))"
 | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1830  | 
using sf_X by (rule simple_distributedI) (auto simp: measure_nonneg)  | 
| 47694 | 1831  | 
  have Y: "simple_distributed M Y (\<lambda>x. measure M (Y -` {x} \<inter> space M))"
 | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1832  | 
using sf_Y by (rule simple_distributedI) (auto simp: measure_nonneg)  | 
| 47694 | 1833  | 
have sf_XY: "simple_function M (\<lambda>x. (X x, Y x))"  | 
1834  | 
using sf_X sf_Y by (rule simple_function_Pair)  | 
|
1835  | 
  then have XY: "simple_distributed M (\<lambda>x. (X x, Y x)) (\<lambda>x. measure M ((\<lambda>x. (X x, Y x)) -` {x} \<inter> space M))"
 | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1836  | 
by (rule simple_distributedI) (auto simp: measure_nonneg)  | 
| 47694 | 1837  | 
from simple_distributed_joint_finite[OF this, simp]  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1838  | 
have eq: "count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M) = count_space (X ` space M \<times> Y ` space M)"  | 
| 47694 | 1839  | 
by (simp add: pair_measure_count_space)  | 
1840  | 
||
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1841  | 
have "\<I>(X ; Y) = \<H>(X) + \<H>(Y) - entropy b (count_space (X`space M) \<Otimes>\<^sub>M count_space (Y`space M)) (\<lambda>x. (X x, Y x))"  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1842  | 
using sigma_finite_measure_count_space_finite  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1843  | 
sigma_finite_measure_count_space_finite  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1844  | 
simple_distributed[OF X] measure_nonneg simple_distributed[OF Y] measure_nonneg simple_distributed_joint[OF XY]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1845  | 
by (rule mutual_information_eq_entropy_conditional_entropy_distr)  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1846  | 
(auto simp: eq integrable_count_space measure_nonneg)  | 
| 47694 | 1847  | 
then show ?thesis  | 
| 49791 | 1848  | 
unfolding conditional_entropy_eq_entropy_simple[OF sf_X sf_Y] by simp  | 
| 47694 | 1849  | 
qed  | 
1850  | 
||
1851  | 
lemma (in information_space) mutual_information_nonneg_simple:  | 
|
1852  | 
assumes sf_X: "simple_function M X" and sf_Y: "simple_function M Y"  | 
|
1853  | 
shows "0 \<le> \<I>(X ; Y)"  | 
|
1854  | 
proof -  | 
|
1855  | 
  have X: "simple_distributed M X (\<lambda>x. measure M (X -` {x} \<inter> space M))"
 | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1856  | 
using sf_X by (rule simple_distributedI) (auto simp: measure_nonneg)  | 
| 47694 | 1857  | 
  have Y: "simple_distributed M Y (\<lambda>x. measure M (Y -` {x} \<inter> space M))"
 | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1858  | 
using sf_Y by (rule simple_distributedI) (auto simp: measure_nonneg)  | 
| 47694 | 1859  | 
|
1860  | 
have sf_XY: "simple_function M (\<lambda>x. (X x, Y x))"  | 
|
1861  | 
using sf_X sf_Y by (rule simple_function_Pair)  | 
|
1862  | 
  then have XY: "simple_distributed M (\<lambda>x. (X x, Y x)) (\<lambda>x. measure M ((\<lambda>x. (X x, Y x)) -` {x} \<inter> space M))"
 | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1863  | 
by (rule simple_distributedI) (auto simp: measure_nonneg)  | 
| 47694 | 1864  | 
|
1865  | 
from simple_distributed_joint_finite[OF this, simp]  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1866  | 
have eq: "count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M) = count_space (X ` space M \<times> Y ` space M)"  | 
| 47694 | 1867  | 
by (simp add: pair_measure_count_space)  | 
1868  | 
||
| 40859 | 1869  | 
show ?thesis  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1870  | 
by (rule mutual_information_nonneg[OF _ _ simple_distributed[OF X] _ simple_distributed[OF Y] _ simple_distributed_joint[OF XY]])  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1871  | 
(simp_all add: eq integrable_count_space sigma_finite_measure_count_space_finite measure_nonneg)  | 
| 40859 | 1872  | 
qed  | 
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
1873  | 
|
| 40859 | 1874  | 
lemma (in information_space) conditional_entropy_less_eq_entropy:  | 
| 
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
 | 
1875  | 
assumes X: "simple_function M X" and Z: "simple_function M Z"  | 
| 40859 | 1876  | 
shows "\<H>(X | Z) \<le> \<H>(X)"  | 
| 36624 | 1877  | 
proof -  | 
| 47694 | 1878  | 
have "0 \<le> \<I>(X ; Z)" using X Z by (rule mutual_information_nonneg_simple)  | 
1879  | 
also have "\<I>(X ; Z) = \<H>(X) - \<H>(X | Z)" using mutual_information_eq_entropy_conditional_entropy[OF assms] .  | 
|
1880  | 
finally show ?thesis by auto  | 
|
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
1881  | 
qed  | 
| 
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
1882  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1883  | 
lemma (in information_space)  | 
| 49803 | 1884  | 
  fixes Px :: "'b \<Rightarrow> real" and Py :: "'c \<Rightarrow> real" and Pxy :: "('b \<times> 'c) \<Rightarrow> real"
 | 
1885  | 
assumes S: "sigma_finite_measure S" and T: "sigma_finite_measure T"  | 
|
1886  | 
assumes Px: "finite_entropy S X Px" and Py: "finite_entropy T Y Py"  | 
|
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1887  | 
assumes Pxy: "finite_entropy (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) Pxy"  | 
| 49803 | 1888  | 
shows "conditional_entropy b S T X Y \<le> entropy b S X"  | 
1889  | 
proof -  | 
|
1890  | 
||
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1891  | 
have "0 \<le> mutual_information b S T X Y"  | 
| 49803 | 1892  | 
by (rule mutual_information_nonneg') fact+  | 
1893  | 
also have "\<dots> = entropy b S X - conditional_entropy b S T X Y"  | 
|
1894  | 
apply (rule mutual_information_eq_entropy_conditional_entropy')  | 
|
1895  | 
using assms  | 
|
1896  | 
by (auto intro!: finite_entropy_integrable finite_entropy_distributed  | 
|
1897  | 
finite_entropy_integrable_transform[OF Px]  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1898  | 
finite_entropy_integrable_transform[OF Py]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1899  | 
intro: finite_entropy_nn)  | 
| 49803 | 1900  | 
finally show ?thesis by auto  | 
1901  | 
qed  | 
|
1902  | 
||
| 40859 | 1903  | 
lemma (in information_space) entropy_chain_rule:  | 
| 
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
 | 
1904  | 
assumes X: "simple_function M X" and Y: "simple_function M Y"  | 
| 40859 | 1905  | 
shows "\<H>(\<lambda>x. (X x, Y x)) = \<H>(X) + \<H>(Y|X)"  | 
1906  | 
proof -  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1907  | 
note XY = simple_distributedI[OF simple_function_Pair[OF X Y] measure_nonneg refl]  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1908  | 
note YX = simple_distributedI[OF simple_function_Pair[OF Y X] measure_nonneg refl]  | 
| 47694 | 1909  | 
note simple_distributed_joint_finite[OF this, simp]  | 
1910  | 
  let ?f = "\<lambda>x. prob ((\<lambda>x. (X x, Y x)) -` {x} \<inter> space M)"
 | 
|
1911  | 
  let ?g = "\<lambda>x. prob ((\<lambda>x. (Y x, X x)) -` {x} \<inter> space M)"
 | 
|
1912  | 
  let ?h = "\<lambda>x. if x \<in> (\<lambda>x. (Y x, X x)) ` space M then prob ((\<lambda>x. (Y x, X x)) -` {x} \<inter> space M) else 0"
 | 
|
1913  | 
have "\<H>(\<lambda>x. (X x, Y x)) = - (\<Sum>x\<in>(\<lambda>x. (X x, Y x)) ` space M. ?f x * log b (?f x))"  | 
|
1914  | 
using XY by (rule entropy_simple_distributed)  | 
|
1915  | 
also have "\<dots> = - (\<Sum>x\<in>(\<lambda>(x, y). (y, x)) ` (\<lambda>x. (X x, Y x)) ` space M. ?g x * log b (?g x))"  | 
|
| 64267 | 1916  | 
by (subst (2) sum.reindex) (auto simp: inj_on_def intro!: sum.cong arg_cong[where f="\<lambda>A. prob A * log b (prob A)"])  | 
| 47694 | 1917  | 
also have "\<dots> = - (\<Sum>x\<in>(\<lambda>x. (Y x, X x)) ` space M. ?h x * log b (?h x))"  | 
| 64267 | 1918  | 
by (auto intro!: sum.cong)  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1919  | 
also have "\<dots> = entropy b (count_space (Y ` space M) \<Otimes>\<^sub>M count_space (X ` space M)) (\<lambda>x. (Y x, X x))"  | 
| 49786 | 1920  | 
by (subst entropy_distr[OF simple_distributed_joint[OF YX]])  | 
| 47694 | 1921  | 
(auto simp: pair_measure_count_space sigma_finite_measure_count_space_finite lebesgue_integral_count_space_finite  | 
| 69654 | 1922  | 
cong del: sum.cong_simp intro!: sum.mono_neutral_left measure_nonneg)  | 
| 
53015
 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 
wenzelm 
parents: 
50419 
diff
changeset
 | 
1923  | 
finally have "\<H>(\<lambda>x. (X x, Y x)) = entropy b (count_space (Y ` space M) \<Otimes>\<^sub>M count_space (X ` space M)) (\<lambda>x. (Y x, X x))" .  | 
| 47694 | 1924  | 
then show ?thesis  | 
| 49791 | 1925  | 
unfolding conditional_entropy_eq_entropy_simple[OF Y X] by simp  | 
| 36624 | 1926  | 
qed  | 
1927  | 
||
| 40859 | 1928  | 
lemma (in information_space) entropy_partition:  | 
| 47694 | 1929  | 
assumes X: "simple_function M X"  | 
1930  | 
shows "\<H>(X) = \<H>(f \<circ> X) + \<H>(X|f \<circ> X)"  | 
|
| 36624 | 1931  | 
proof -  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1932  | 
note fX = simple_function_compose[OF X, of f]  | 
| 47694 | 1933  | 
have eq: "(\<lambda>x. ((f \<circ> X) x, X x)) ` space M = (\<lambda>x. (f x, x)) ` X ` space M" by auto  | 
1934  | 
have inj: "\<And>A. inj_on (\<lambda>x. (f x, x)) A"  | 
|
1935  | 
by (auto simp: inj_on_def)  | 
|
1936  | 
show ?thesis  | 
|
1937  | 
apply (subst entropy_chain_rule[symmetric, OF fX X])  | 
|
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1938  | 
apply (subst entropy_simple_distributed[OF simple_distributedI[OF simple_function_Pair[OF fX X] measure_nonneg refl]])  | 
| 
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1939  | 
apply (subst entropy_simple_distributed[OF simple_distributedI[OF X measure_nonneg refl]])  | 
| 47694 | 1940  | 
unfolding eq  | 
| 64267 | 1941  | 
apply (subst sum.reindex[OF inj])  | 
1942  | 
apply (auto intro!: sum.cong arg_cong[where f="\<lambda>A. prob A * log b (prob A)"])  | 
|
| 47694 | 1943  | 
done  | 
| 36624 | 1944  | 
qed  | 
1945  | 
||
| 40859 | 1946  | 
corollary (in information_space) entropy_data_processing:  | 
| 
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
 | 
1947  | 
assumes X: "simple_function M X" shows "\<H>(f \<circ> X) \<le> \<H>(X)"  | 
| 40859 | 1948  | 
proof -  | 
| 47694 | 1949  | 
note fX = simple_function_compose[OF X, of f]  | 
1950  | 
from X have "\<H>(X) = \<H>(f\<circ>X) + \<H>(X|f\<circ>X)" by (rule entropy_partition)  | 
|
| 40859 | 1951  | 
then show "\<H>(f \<circ> X) \<le> \<H>(X)"  | 
| 69661 | 1952  | 
by (simp only: conditional_entropy_nonneg [OF X fX] le_add_same_cancel1)  | 
| 40859 | 1953  | 
qed  | 
| 36624 | 1954  | 
|
| 40859 | 1955  | 
corollary (in information_space) entropy_of_inj:  | 
| 
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
 | 
1956  | 
assumes X: "simple_function M X" and inj: "inj_on f (X`space M)"  | 
| 36624 | 1957  | 
shows "\<H>(f \<circ> X) = \<H>(X)"  | 
1958  | 
proof (rule antisym)  | 
|
| 40859 | 1959  | 
show "\<H>(f \<circ> X) \<le> \<H>(X)" using entropy_data_processing[OF X] .  | 
| 36624 | 1960  | 
next  | 
| 
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
 | 
1961  | 
have sf: "simple_function M (f \<circ> X)"  | 
| 40859 | 1962  | 
using X by auto  | 
| 36624 | 1963  | 
have "\<H>(X) = \<H>(the_inv_into (X`space M) f \<circ> (f \<circ> X))"  | 
| 47694 | 1964  | 
unfolding o_assoc  | 
| 
62975
 
1d066f6ab25d
Probability: move emeasure and nn_integral from ereal to ennreal
 
hoelzl 
parents: 
62390 
diff
changeset
 | 
1965  | 
apply (subst entropy_simple_distributed[OF simple_distributedI[OF X measure_nonneg refl]])  | 
| 47694 | 1966  | 
    apply (subst entropy_simple_distributed[OF simple_distributedI[OF simple_function_compose[OF X]], where f="\<lambda>x. prob (X -` {x} \<inter> space M)"])
 | 
| 64267 | 1967  | 
apply (auto intro!: sum.cong arg_cong[where f=prob] image_eqI simp: the_inv_into_f_f[OF inj] comp_def measure_nonneg)  | 
| 47694 | 1968  | 
done  | 
| 36624 | 1969  | 
also have "... \<le> \<H>(f \<circ> X)"  | 
| 40859 | 1970  | 
using entropy_data_processing[OF sf] .  | 
| 36624 | 1971  | 
finally show "\<H>(X) \<le> \<H>(f \<circ> X)" .  | 
1972  | 
qed  | 
|
1973  | 
||
| 
36080
 
0d9affa4e73c
Added Information theory and Example: dining cryptographers
 
hoelzl 
parents:  
diff
changeset
 | 
1974  | 
end  |