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