Skip to content

Commit eeb9d63

Browse files
committed
getting started on mutual_information_le. Several dependent type issues
1 parent e133c28 commit eeb9d63

File tree

3 files changed

+90
-16
lines changed

3 files changed

+90
-16
lines changed

PFR/BoundingMutual.lean

Lines changed: 85 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Mathlib.Algebra.BigOperators.Group.Multiset.Defs
12
import PFR.MultiTauFunctional
23

34

@@ -15,6 +16,34 @@ import PFR.MultiTauFunctional
1516
universe u
1617
open MeasureTheory ProbabilityTheory
1718

19+
20+
theorem Fin.cast_surjective {k l:ℕ} (h: k = l) : Function.Surjective (Fin.cast h) :=
21+
(rightInverse_cast h).surjective -- or `(finCongr h).surjective`
22+
23+
theorem Fin.cast_bijective {k l:ℕ} (h: k = l) : Function.Bijective (Fin.cast h) :=
24+
⟨ cast_injective h, cast_surjective h ⟩ -- or `(finCongr h).bijective`
25+
26+
lemma multiDist_of_cast {m m' : ℕ} (h : m' = m) {Ω : Fin m → Type*}
27+
(hΩ : ∀ i, MeasureSpace (Ω i)) (hΩprob : ∀ i, IsProbabilityMeasure (hΩ i).volume)
28+
{G: Type*} [MeasureableFinGroup G] (X : ∀ i, (Ω i) → G) :
29+
D[fun i ↦ X (i.cast h); fun i ↦ hΩ (i.cast h)] = D[X ; hΩ] := by
30+
unfold multiDist
31+
congr 1
32+
. apply IdentDistrib.entropy_congr
33+
exact {
34+
aemeasurable_fst := by fun_prop
35+
aemeasurable_snd := by fun_prop
36+
map_eq := by
37+
have : (fun (x: Fin m' → G) ↦ ∑ i, x i) = (fun (x: Fin m → G) ↦ ∑ i, x i) ∘ (fun (x: Fin m' → G) ↦ x ∘ (Fin.cast h.symm)) := by
38+
ext x; simp; symm; apply Function.Bijective.sum_comp (Fin.cast_bijective h.symm)
39+
rw [this, ←MeasureTheory.Measure.map_map] <;> try fun_prop
40+
congr
41+
convert MeasureTheory.Measure.pi_map_piCongrLeft (finCongr h) (fun i ↦ Measure.map (X i) ℙ)
42+
}
43+
congr 1
44+
. rw [h]
45+
convert Finset.sum_bijective _ (Fin.cast_bijective h) ?_ ?_ using 1 <;> simp
46+
1847
-- Spelling here is *very* janky. Feel free to respell
1948
/-- Suppose that $X_{i,j}$, $1 \leq i,j \leq m$, are jointly independent $G$-valued random variables, such that for each $j = 1,\dots,m$, the random variables $(X_{i,j})_{i = 1}^m$
2049
coincide in distribution with some permutation of $X_{[m]}$.
@@ -26,16 +55,18 @@ $$ {\mathcal I} := \bbI[ \bigl(\sum_{i=1}^m X_{i,j}\bigr)_{j =1}^{m}
2655
Then ${\mathcal I} \leq 4 m^2 \eta k.$
2756
-/
2857
lemma mutual_information_le {G Ωₒ : Type u} [MeasureableFinGroup G] [MeasureSpace Ωₒ]
29-
(p : multiRefPackage G Ωₒ) (Ω : Type u) [hΩ : MeasureSpace Ω] (X : ∀ i, Ω → G)
30-
(h_indep : iIndepFun X)
31-
(h_min : multiTauMinimizes p (fun _ ↦ Ω) (fun _ ↦ hΩ) X) (Ω' : Type*) [hΩ': MeasureSpace Ω']
58+
{p : multiRefPackage G Ωₒ} {Ω : Type u} [hΩ : MeasureSpace Ω] [IsProbabilityMeasure hΩ.volume]
59+
{X : ∀ i, Ω → G} (hX : ∀ i, Measurable (X i)) (h_indep : iIndepFun X)
60+
(h_min : multiTauMinimizes p (fun _ ↦ Ω) (fun _ ↦ hΩ) X) {Ω' : Type*} [hΩ': MeasureSpace Ω']
3261
[IsProbabilityMeasure hΩ'.volume]
33-
(X' : Fin p.m × Fin p.m → Ω' → G) (h_indep': iIndepFun X')
62+
{X' : Fin p.m × Fin p.m → Ω' → G} (hX' : ∀ i j, Measurable (X' (i, j)))
63+
(h_indep': iIndepFun X')
3464
(hperm : ∀ j, ∃ e : Fin p.m ≃ Fin p.m, IdentDistrib (fun ω ↦ (fun i ↦ X' (i, j) ω))
3565
(fun ω ↦ (fun i ↦ X (e i) ω))) :
3666
I[ fun ω ↦ ( fun j ↦ ∑ i, X' (i, j) ω) : fun ω ↦ ( fun i ↦ ∑ j, X' (i, j) ω) |
3767
fun ω ↦ ∑ i, ∑ j, X' (i, j) ω ] ≤ 2 * p.m * (2*p.m + 1) * p.η * D[ X; (fun _ ↦ hΩ)] := by
3868
have hm := p.hm
69+
have hη := p.hη
3970
set I₀ := I[ fun ω ↦ ( fun j ↦ ∑ i, X' (i, j) ω) : fun ω ↦ ( fun i ↦ ∑ j, X' (i, j) ω) |
4071
fun ω ↦ ∑ i, ∑ j, X' (i, j) ω ]
4172
set k := D[X ; fun x ↦ hΩ]
@@ -46,13 +77,53 @@ lemma mutual_information_le {G Ωₒ : Type u} [MeasureableFinGroup G] [MeasureS
4677
set S : Fin p.m → Fin p.m → Ω' → G := fun i j ↦ ∑ k ∈ .Ici j, X' (i, k)
4778
set A : Fin p.m → ℝ := fun j ↦ D[ column j; fun _ ↦ hΩ']
4879
- D[ column j | fun i ↦ S i j; fun _ ↦ hΩ']
49-
set B : ℝ := D[ column last; fun _ ↦ hΩ'] - D[ fun j ω ↦ ∑ i, X' (i, j) ω; fun _ ↦ hΩ']
80+
set B : ℝ := D[ column last; fun _ ↦ hΩ'] - D[ fun i ω ↦ ∑ j, X' (i, j) ω; fun _ ↦ hΩ']
5081

5182
have h1 : I₀ ≤ ∑ j ∈ .Iio last, A j + B := by
52-
sorry
83+
set m := p.m - 1
84+
have hm' : m+1 = p.m := by omega
85+
let X'' : Fin (m+1) × Fin (m+1) → Ω' → G := fun (i,j) ↦ X' (i.cast hm', j.cast hm')
86+
convert cor_multiDist_chainRule _ X'' (by fun_prop) _ using 1 <;> try infer_instance
87+
. simp [I₀]
88+
let ι : (Fin (m+1) → G) → (Fin p.m → G) := fun f ↦ f ∘ (Fin.cast hm'.symm)
89+
have hι : Function.Injective ι := by
90+
intro f g h; ext i; replace h := congrFun h (i.cast hm'); simpa [ι] using h
91+
observe hid : Function.Injective (id: G → G)
92+
convert condMutualInfo_of_inj' _ _ _ _ hι hι hid using 2 <;> try infer_instance
93+
all_goals try fun_prop
94+
. ext ω j; simp [ι, X'']; symm
95+
apply Function.Bijective.sum_comp (Fin.cast_bijective hm') (fun i ↦ X' (i, j) ω)
96+
. ext ω i; simp [ι, X'']; symm
97+
apply Function.Bijective.sum_comp (Fin.cast_bijective hm') (fun j ↦ X' (i, j) ω)
98+
. ext ω
99+
rw [←Multiset.sum_eq_foldr, ←Finset.sum_eq_multiset_sum, ←Finset.sum_product']
100+
simp; apply Function.Bijective.sum_comp ⟨ _, _ ⟩ (fun x ↦ X' x ω)
101+
. intro ⟨ i, j ⟩ ⟨ i', j' ⟩ h; simpa using h
102+
intro ⟨ i, j ⟩; use ⟨ i.cast hm'.symm, j.cast hm'.symm ⟩; simp
103+
simp_rw [←Multiset.sum_eq_foldr, ←Finset.sum_eq_multiset_sum]
104+
fun_prop
105+
. rw [add_sub_assoc]; congr 1
106+
. convert Finset.sum_image (g := fun j:Fin m ↦ j.castSucc.cast hm')
107+
(f := A) (s := Finset.univ) _ using 2 with _ _ n _
108+
. ext ⟨ n, hn ⟩; simp [last]; constructor
109+
. intro h; use ⟨ n, by omega ⟩; simp
110+
rintro ⟨ ⟨ n', hn' ⟩, h ⟩; simp at h; omega
111+
. simp [A, X'', column, S]; congr 1
112+
. convert multiDist_of_cast hm' (fun _ ↦ hΩ') inferInstance _ with i
113+
rfl
114+
sorry
115+
simp
116+
simp [B, column, X'']; congr 1
117+
. symm; convert multiDist_of_cast hm' (fun _ ↦ hΩ') inferInstance _ with i
118+
rfl
119+
symm; convert multiDist_of_cast hm' (fun _ ↦ hΩ') inferInstance _ with i
120+
ext ω; simp
121+
apply Function.Bijective.sum_comp (Fin.cast_bijective hm') (fun j ↦ X' (Fin.cast hm' i, j) ω)
122+
apply ProbabilityTheory.iIndepFun.precomp _ h_indep'
123+
intro ⟨ i, j ⟩ ⟨ i', j' ⟩ h; simpa using h
53124

54125
have h2 {j : Fin p.m} (hj: j ∈ Finset.Iio last)
55-
: A j ≤ p.η * ∑ i, d[ X' (i,j) # X' (i,j) | S i j ] := by
126+
: A j ≤ p.η * (k + ∑ i, d[ X' (i,j) # X' (i,j) | S i j ]) := by
56127
sorry
57128

58129
have h3 : B ≤ p.η * ∑ i, d[ X' (i, last) # V i ] := by
@@ -73,7 +144,7 @@ lemma mutual_information_le {G Ωₒ : Type u} [MeasureableFinGroup G] [MeasureS
73144
+ (H[V i] - H[X' (i, last)]) / 2 := by
74145
sorry
75146

76-
have h7 : I₀/p.η ≤ p.m * ∑ i, d[X i # X i] + ∑ i, H[V i] - ∑ i, H[X i] := by
147+
have h7 : I₀/p.η ≤ p.m * k + p.m * ∑ i, d[X i # X i] + ∑ i, H[V i] - ∑ i, H[X i] := by
77148
sorry
78149

79150
have h8 (i: Fin p.m) : H[V i] ≤ H[ ∑ j, X j] + ∑ j, d[X' (i,j) # X' (i,j)] := by
@@ -82,9 +153,12 @@ lemma mutual_information_le {G Ωₒ : Type u} [MeasureableFinGroup G] [MeasureS
82153
have h9 : ∑ i, H[V i] - ∑ i, H[X i] ≤ p.m * ∑ i, d[X i # X i] + p.m * k := by
83154
sorry
84155

85-
have h10 : I₀/p.η ≤ 2 * p.m * ∑ i, d[X i # X i] + p.m * k := by linarith
156+
have h10 : I₀/p.η ≤ 2 * p.m * ∑ i, d[X i # X i] + 2 * p.m * k := by linarith
86157

87158
have h11 : ∑ i, d[X i # X i] ≤ 2 * p.m * k := by
88-
sorry
159+
convert multidist_ruzsa_II hm _ _ _ hX _ <;> try infer_instance
89160

90-
sorry
161+
calc
162+
_ ≤ p.η * (2 * p.m * ∑ i, d[X i # X i] + 2 * p.m * k) := by rwa [←div_le_iff₀' (by positivity)]
163+
_ ≤ p.η * (2 * p.m * (2 * p.m * k) + 2 * p.m * k) := by gcongr
164+
_ = _ := by ring

PFR/TorsionEndgame.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ lemma mutual_information_le_t_12 : I[Z1 : Z2 | W] ≤ 2 * p.m * (2 * p.m + 1) *
6464
have hm := p.hm
6565
let zero : Fin p.m := ⟨ 0, by linarith [hm]⟩
6666
have hindep_j (j: Fin p.m) : iIndepFun (fun i ↦ Y (i, j)) := indep_yj h_mes h_indep j
67-
have := mutual_information_le p Ω' (fun i ω ↦ Y (i,zero) ω) (hindep_j zero) ?_ Ω' Y h_indep ?_
67+
have := mutual_information_le (by fun_prop) (hindep_j zero) ?_ h_mes h_indep ?_
6868
. have k_eq : k = D[fun i ω ↦ Y (i, zero) ω ; fun x ↦ hΩ'] := by
6969
apply multiDist_copy; intro i; exact (hident i zero).symm
7070
rw [←k_eq, condMutualInfo_comm] at this
@@ -106,7 +106,7 @@ lemma mutual_information_le_t_23 : I[Z2 : Z3 | W] ≤ 2 * p.m * (2 * p.m + 1) *
106106
convert iIndepFun.finsets_comp S _ hX'_indep (by fun_prop) φ (by fun_prop) with i ω
107107
rw [Finset.pairwiseDisjoint_iff]; rintro _ _ _ _ ⟨ ⟨ _, _ ⟩, hij ⟩
108108
simp [S] at hij; cc
109-
have := mutual_information_le p Ω' (fun i ω ↦ Y (i,zero) ω) (indep_yj h_mes h_indep zero) ?_ Ω' X' hX'_indep ?_
109+
have := mutual_information_le (by fun_prop) (indep_yj h_mes h_indep zero) ?_ (by fun_prop) hX'_indep ?_
110110
. have k_eq : k = D[fun i ω ↦ Y (i, zero) ω ; fun x ↦ hΩ'] := by
111111
apply multiDist_copy; intro i; exact (hident i zero).symm
112112
rw [←k_eq] at this
@@ -158,7 +158,7 @@ lemma mutual_information_le_t_21 : I[Z1 : Z3 | W] ≤ 2 * p.m * (2 * p.m + 1) *
158158
rw [Finset.pairwiseDisjoint_iff]; rintro _ _ _ _ ⟨ ⟨ _, _ ⟩, hij ⟩
159159
simp [S] at hij; cc
160160
have hindep_yj (j: Fin p.m) : iIndepFun (fun i ↦ Y (i, j)) := indep_yj h_mes h_indep j
161-
have := mutual_information_le p Ω' (fun i ω ↦ Y (i,zero) ω) (hindep_yj zero) ?_ Ω' X' hX'_indep ?_
161+
have := mutual_information_le (by fun_prop) (hindep_yj zero) ?_ (by fun_prop) hX'_indep ?_
162162
. have k_eq : k = D[fun i ω ↦ Y (i, zero) ω ; fun x ↦ hΩ'] := by
163163
apply multiDist_copy; intro i; exact (hident i zero).symm
164164
rw [←k_eq,condMutualInfo_comm] at this

blueprint/src/chapter/torsion.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ \section{Bounding the mutual information}
517517
Let $\sigma = \sigma_j \colon I \to I$ be a permutation such that $X_{i,j} = X_{\sigma(i)}$, and write $X'_i := X_{i,j}$ and $Y_i := X_{i,j} + \cdots + X_{i,m}$.
518518
By \Cref{cond-multidist-lower-II}, we have
519519
\begin{align}
520-
A_j & \leq \eta \sum_{i = 1}^{m} d[X_{i,j}; X_{i, j}|X_{i, j} + \cdots + X_{i,m}].\label{54a}
520+
A_j & \leq \eta (k+\sum_{i = 1}^{m} d[X_{i,j}; X_{i, j}|X_{i, j} + \cdots + X_{i,m}]).\label{54a}
521521
\end{align}
522522
We similarly consider $B$. By \Cref{multidist-perm} applied to the $m$-th column,
523523
\[
@@ -554,7 +554,7 @@ \section{Bounding the mutual information}
554554
Combining~\eqref{441},~\eqref{54a} and~\eqref{55a} with~\eqref{eq:distbnd1} and~\eqref{eq:distbnd2} (the latter two summed over $i$), we get
555555
\begin{align}
556556
\nonumber
557-
\frac1{\eta} {\mathcal I} &\leq \sum_{i,j=1}^m d[X_{i,j};X_{i,j}] + \sum_{i=1}^m (\bbH[V_i] - \bbH[X_{i,m}]) \\
557+
\frac1{\eta} {\mathcal I} &\leq mk + \sum_{i,j=1}^m d[X_{i,j};X_{i,j}] + \sum_{i=1}^m (\bbH[V_i] - \bbH[X_{i,m}]) \\
558558
&= m \sum_{i=1}^m d[X_i; X_i] + \sum_{i=1}^m \bbH[V_i] - \sum_{i=1}^m \bbH[X_i].
559559
\label{eq:distbnd3}
560560
\end{align}

0 commit comments

Comments
 (0)