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