import InfoTheory.Problems.EssentialAverageMutualInformation
import InfoTheory.Known
import InfoTheory.Bridge
/-!
# Certificate for `InfoTheory.Problems.EssentialAverageMutualInformation`
The frozen statement conjectures `essentialAvgMI N M = (M - 1)/(N - 1)` for all `2 ≤ M ≤ N`,
where `essentialAvgMI N M` is Abu-Mostafa's `a(N, M)`: the infimum, over joint pmfs `P` on
`Fin N × Fin M` with `I(S; C) > 0`, of `max_f I(f(S); C) / I(S; C)` with `f : Fin N → Fin M`.
## Certified (about exactly these objects)
* `mutualInfo_map_fst_le`, `quantizedInfo_le`, `quantizedInfo_nonneg` — data processing:
`0 ≤ I(f(S); C) ≤ I(S; C)`.
* `exists_quantizedInfo_eq_iSup`, `iSup_quantizedInfo_le` — **the `iSup` is a genuine maximum**
over the finite nonempty set of maps `Fin N → Fin M` (`M ≥ 1`), and it is `≤ I(S; C)`.
* `bestQuantizerRatio_nonneg`, `bestQuantizerRatio_le_one` — every admissible ratio lies in
`[0, 1]`.
* `diagLaw_mutualInfo_pos`, `ratioSet_nonempty`, `ratioSet_subset_Icc`, `ratioSet_bddBelow`,
`essentialAvgMI_mem_Icc` — **no junk value**: for `N, M ≥ 2` the defining set is nonempty
(witness: `S = C` uniform on `{0, 1}`) and contained in `[0, 1]`, so `0 ≤ a(N, M) ≤ 1`.
* `bestQuantizerRatio_eq_one_of_le`, `essentialAvgMI_eq_one_of_le`, `statement_diag` —
`a(N, M) = 1` whenever `2 ≤ N ≤ M` (an injective `f` loses nothing); in particular the
diagonal instances `N = M` of `Statement` hold.
* `erasureLaw`, `erasure_mutualInfo`, `erasure_quantizedInfo_le`, `erasure_iSup`,
`erasure_bestQuantizerRatio` — the erasure family `P_a` on `Fin 3 × Fin 2` (rows
`(a, 0)`, `(1/2 - a, 1/2 - a)`, `(0, a)`): `I(S; C) = 2a`, and the best of all eight maps
`Fin 3 → Fin 2` keeps exactly `g(a) = 1/2 + η(1 - a) - η(1/2 - a)`.
* `abuMostafaLaw_pmf`, `abuMostafaLaw_mutualInfo`, `abuMostafaLaw_bestQuantizerRatio`,
`abuMostafaLaw_quantizedInfo_lt`, `essentialAvgMI_three_two_lt_one` — **Abu-Mostafa's
example** (`a = 1/3`): `I(S; C) = 2/3`, every binary `f` loses information, and the best
ratio is `(3/4) log₂ 3 - 1/2 ≈ 0.689`; hence `a(3, 2) < 1`.
* `erasureGain_le`, `erasure_bestQuantizerRatio_le`, `essentialAvgMI_three_two_le_half` —
`bestQuantizerRatio P_a ≤ 1/2 + a / ln 2`, so `a(3, 2) ≤ 1/2` (the `N = 3` case of the upper
bound `(M - 1)/(N - 1)`).
* `rowEnt_smul`, `rowEnt_superadd`, `rowEnt_cone`, `rowEnt_key` — for binary `C`, the row
weight `G(u, v) = η(u) + η(v) - η(u + v)` is `1`-homogeneous and superadditive, and
`G(a + b) + G(b + c) ≤ G(a + b + c) + G(b)` when the rows are in slope order.
* `exists_two_quantizers`, `half_le_bestQuantizerRatio`, `half_le_essentialAvgMI_three_two`
— `I(S; C) ≤ I_a + I_c` for the quantizers isolating the two extreme rows, so the best binary
quantizer keeps half of `I(S; C)`: `a(3, 2) ≥ 1/2`.
* `essentialAvgMI_three_two`, `statement_three_two` — **`a(3, 2) = 1/2`**, the instance
`N = 3`, `M = 2` of `Statement`.
## Not certified
* `a(N, 2) = 1/(N - 1)` for `N ≥ 4` (the threshold-sum inequality
`I(S; C) ≤ ∑_j I(f_j(S); C)` over the `N - 1` threshold quantizers; proved on the problem
page, not formalized).
* The upper bound `a(N, M) ≤ (M - 1)/(N - 1)` for `N ≥ 4` (geometric weak-dependence
construction; a sketch with numerics on the problem page).
* The lower bound `a(N, M) ≥ (M - 1)/N` of Bhatt–Nazer–Ordentlich–Polyanskiy (2021, Prop. 1).
* Every case with `M ≥ 3` and `N > M` (open); the smallest is `a(4, 3) ∈ [1/2, 2/3]`.
-/
open scoped BigOperators
namespace InfoTheory.Known.Certificates.EssentialAverageMutualInformation
open InfoTheory InfoTheory.Bridge
open InfoTheory.Problems.EssentialAverageMutualInformation
section General
variable {α β γ : Type*} [Fintype α] [Fintype β] [Fintype γ]
/-- Pushing a pmf forward along a map that fixes every point does nothing. -/
theorem map_eq_self (P : ProbDist α) (h : α → α) (hh : ∀ x, h x = x) : P.map h = P := by
classical
have hfun : h = id := funext hh
subst hfun
cases P with
| mk pmf h0 h1 =>
simp only [ProbDist.map, ProbDist.mk.injEq]
funext b
simp [Finset.sum_ite_eq']
/-- **Data processing on the first coordinate**: `I(g(S); C) ≤ I(S; C)`. -/
theorem mutualInfo_map_fst_le (P : ProbDist (α × β)) (g : α → γ) :
mutualInfo (P.map (fun ab => (g ab.1, ab.2))) ≤ mutualInfo P := by
have h1 : P.map (fun ab => (g ab.1, ab.2)) =
((P.map Prod.swap).map (Prod.map id g)).map Prod.swap := by
rw [map_comp_eq, map_comp_eq]; rfl
rw [h1, mutualInfo_swap]
calc mutualInfo ((P.map Prod.swap).map (Prod.map id g)) ≤ mutualInfo (P.map Prod.swap) :=
mutualInfo_map_right_le _ g
_ = mutualInfo P := mutualInfo_swap P
/-- A map with a left inverse keeps all the information: `I(e(S); C) = I(S; C)`. -/
theorem mutualInfo_map_fst_eq_of_leftInverse (P : ProbDist (α × β)) (e : α → γ) (r : γ → α)
(hre : ∀ x, r (e x) = x) :
mutualInfo (P.map (fun ab => (e ab.1, ab.2))) = mutualInfo P := by
refine le_antisymm (mutualInfo_map_fst_le P e) ?_
have h := mutualInfo_map_fst_le (P.map (fun ab => (e ab.1, ab.2))) r
rwa [map_comp_eq, map_eq_self P _ (fun x => by simp [hre])] at h
end General
/-! ### The ratio lies in `[0, 1]`; the `iSup` is a genuine maximum -/
section Range
variable {N M : ℕ}
theorem quantizedInfo_nonneg (P : ProbDist (Fin N × Fin M)) (f : Fin N → Fin M) :
0 ≤ quantizedInfo P f :=
mutualInfo_nonneg _
/-- Data processing: `I(f(S); C) ≤ I(S; C)`. -/
theorem quantizedInfo_le (P : ProbDist (Fin N × Fin M)) (f : Fin N → Fin M) :
quantizedInfo P f ≤ mutualInfo P :=
mutualInfo_map_fst_le P f
theorem bddAbove_range_quantizedInfo (P : ProbDist (Fin N × Fin M)) :
BddAbove (Set.range (quantizedInfo P)) :=
(Set.finite_range _).bddAbove
/-- The `iSup` in `bestQuantizerRatio` is attained: it is the maximum over the finite set of
maps `Fin N → Fin M` (nonempty since `M ≥ 1`). -/
theorem exists_quantizedInfo_eq_iSup (hM : 0 < M) (P : ProbDist (Fin N × Fin M)) :
∃ f : Fin N → Fin M, quantizedInfo P f = ⨆ g : Fin N → Fin M, quantizedInfo P g := by
have : Nonempty (Fin N → Fin M) := ⟨fun _ => ⟨0, hM⟩⟩
obtain ⟨f, hf⟩ := Finite.exists_max (quantizedInfo P)
exact ⟨f, le_antisymm (le_ciSup (bddAbove_range_quantizedInfo P) f) (ciSup_le hf)⟩
theorem iSup_quantizedInfo_nonneg (hM : 0 < M) (P : ProbDist (Fin N × Fin M)) :
0 ≤ ⨆ f : Fin N → Fin M, quantizedInfo P f :=
(quantizedInfo_nonneg P (fun _ => ⟨0, hM⟩)).trans
(le_ciSup (bddAbove_range_quantizedInfo P) _)
theorem iSup_quantizedInfo_le (hM : 0 < M) (P : ProbDist (Fin N × Fin M)) :
(⨆ f : Fin N → Fin M, quantizedInfo P f) ≤ mutualInfo P := by
have : Nonempty (Fin N → Fin M) := ⟨fun _ => ⟨0, hM⟩⟩
exact ciSup_le (quantizedInfo_le P)
theorem bestQuantizerRatio_nonneg (hM : 0 < M) (P : ProbDist (Fin N × Fin M)) :
0 ≤ bestQuantizerRatio P :=
div_nonneg (iSup_quantizedInfo_nonneg hM P) (mutualInfo_nonneg P)
/-- `a(N, M) ≤ 1` pointwise: every ratio is at most `1` (data processing). -/
theorem bestQuantizerRatio_le_one (hM : 0 < M) (P : ProbDist (Fin N × Fin M))
(hI : 0 < mutualInfo P) : bestQuantizerRatio P ≤ 1 :=
(div_le_one hI).2 (iSup_quantizedInfo_le hM P)
end Range
/-! ### A witness with positive information; `a(N, M)` is a genuine infimum in `[0, 1]` -/
section Witness
variable {N M : ℕ}
/-- `S = C` uniform on `{0, 1}`, embedded in `Fin N × Fin M`; `I(S; C) = 1 > 0`. -/
noncomputable def diagLaw (hN : 2 ≤ N) (hM : 2 ≤ M) : ProbDist (Fin N × Fin M) :=
(ProbDist.uniform : ProbDist (Fin 2)).map (fun b => (Fin.castLE hN b, Fin.castLE hM b))
theorem diagLaw_pmf_zero_zero (hN : 2 ≤ N) (hM : 2 ≤ M) :
(diagLaw hN hM).pmf (Fin.castLE hN 0, Fin.castLE hM 0) = 1 / 2 := by
simp [diagLaw, ProbDist.map, ProbDist.uniform, Fin.sum_univ_two, Fin.ext_iff]
theorem diagLaw_pmf_one_one (hN : 2 ≤ N) (hM : 2 ≤ M) :
(diagLaw hN hM).pmf (Fin.castLE hN 1, Fin.castLE hM 1) = 1 / 2 := by
simp [diagLaw, ProbDist.map, ProbDist.uniform, Fin.sum_univ_two, Fin.ext_iff]
theorem diagLaw_pmf_zero_one (hN : 2 ≤ N) (hM : 2 ≤ M) :
(diagLaw hN hM).pmf (Fin.castLE hN 0, Fin.castLE hM 1) = 0 := by
simp [diagLaw, ProbDist.map, ProbDist.uniform, Fin.sum_univ_two, Fin.ext_iff]
theorem diagLaw_mutualInfo_pos (hN : 2 ≤ N) (hM : 2 ≤ M) : 0 < mutualInfo (diagLaw hN hM) := by
rcases (mutualInfo_nonneg (diagLaw hN hM)).lt_or_eq with h | h
· exact h
· exfalso
set P := diagLaw hN hM
have hind := congrArg (fun Q : ProbDist (Fin N × Fin M) => Q.pmf
(Fin.castLE hN 0, Fin.castLE hM 1)) ((mutualInfo_eq_zero_iff_indep P).1 h.symm)
have hf : P.pmf (Fin.castLE hN 0, Fin.castLE hM 0) ≤ P.fst.pmf (Fin.castLE hN 0) :=
Finset.single_le_sum (f := fun c => P.pmf (Fin.castLE hN 0, c))
(fun c _ => P.nonneg _) (Finset.mem_univ _)
have hs : P.pmf (Fin.castLE hN 1, Fin.castLE hM 1) ≤ P.snd.pmf (Fin.castLE hM 1) :=
Finset.single_le_sum (f := fun s => P.pmf (s, Fin.castLE hM 1))
(fun s _ => P.nonneg _) (Finset.mem_univ _)
change P.pmf _ = P.fst.pmf (Fin.castLE hN 0) * P.snd.pmf (Fin.castLE hM 1) at hind
rw [diagLaw_pmf_zero_one] at hind
rw [diagLaw_pmf_zero_zero] at hf
rw [diagLaw_pmf_one_one] at hs
nlinarith
end Witness
section Infimum
variable {N M : ℕ}
/-- The set whose infimum is `a(N, M)` is nonempty for `N, M ≥ 2`. -/
theorem ratioSet_nonempty (hN : 2 ≤ N) (hM : 2 ≤ M) :
{r : ℝ | ∃ P : ProbDist (Fin N × Fin M), 0 < mutualInfo P ∧
r = bestQuantizerRatio P}.Nonempty :=
⟨_, diagLaw hN hM, diagLaw_mutualInfo_pos hN hM, rfl⟩
/-- Every ratio in the defining set lies in `[0, 1]`. -/
theorem ratioSet_subset_Icc (hM : 0 < M) :
{r : ℝ | ∃ P : ProbDist (Fin N × Fin M), 0 < mutualInfo P ∧ r = bestQuantizerRatio P} ⊆
Set.Icc 0 1 := by
rintro r ⟨P, hI, rfl⟩
exact ⟨bestQuantizerRatio_nonneg hM P, bestQuantizerRatio_le_one hM P hI⟩
theorem ratioSet_bddBelow (hM : 0 < M) :
BddBelow {r : ℝ | ∃ P : ProbDist (Fin N × Fin M), 0 < mutualInfo P ∧
r = bestQuantizerRatio P} :=
⟨0, fun _ hr => (ratioSet_subset_Icc hM hr).1⟩
/-- `a(N, M)` is a lower bound for the ratio of every admissible `P`. -/
theorem essentialAvgMI_le_bestQuantizerRatio (hM : 0 < M) (P : ProbDist (Fin N × Fin M))
(hI : 0 < mutualInfo P) : essentialAvgMI N M ≤ bestQuantizerRatio P :=
csInf_le (ratioSet_bddBelow hM) ⟨P, hI, rfl⟩
/-- **No junk value:** `0 ≤ a(N, M) ≤ 1` for `N, M ≥ 2`. -/
theorem essentialAvgMI_mem_Icc (hN : 2 ≤ N) (hM : 2 ≤ M) :
essentialAvgMI N M ∈ Set.Icc (0 : ℝ) 1 := by
have hM0 : 0 < M := by omega
refine ⟨le_csInf (ratioSet_nonempty hN hM) fun r hr => (ratioSet_subset_Icc hM0 hr).1, ?_⟩
obtain ⟨r, hr⟩ := ratioSet_nonempty hN hM
exact (csInf_le (ratioSet_bddBelow hM0) hr).trans (ratioSet_subset_Icc hM0 hr).2
/-- If `N ≤ M`, an injective `f` keeps everything: every ratio equals `1`. -/
theorem bestQuantizerRatio_eq_one_of_le (hNM : N ≤ M) (hN : 0 < N) (P : ProbDist (Fin N × Fin M))
(hI : 0 < mutualInfo P) : bestQuantizerRatio P = 1 := by
have hM : 0 < M := lt_of_lt_of_le hN hNM
let r : Fin M → Fin N := fun y => if h : y.val < N then ⟨y.val, h⟩ else ⟨0, hN⟩
have hre : ∀ x, r (Fin.castLE hNM x) = x := fun x => by
simp [r]
rw [bestQuantizerRatio, div_eq_one_iff_eq hI.ne']
refine le_antisymm (iSup_quantizedInfo_le hM P) ?_
refine le_trans (le_of_eq ?_) (le_ciSup (bddAbove_range_quantizedInfo P) (Fin.castLE hNM))
exact (mutualInfo_map_fst_eq_of_leftInverse P (Fin.castLE hNM) r hre).symm
/-- `a(N, M) = 1` whenever `2 ≤ N ≤ M`. -/
theorem essentialAvgMI_eq_one_of_le (hN : 2 ≤ N) (hNM : N ≤ M) : essentialAvgMI N M = 1 := by
have hM : 2 ≤ M := hN.trans hNM
have hset : {r : ℝ | ∃ P : ProbDist (Fin N × Fin M), 0 < mutualInfo P ∧
r = bestQuantizerRatio P} = {1} := by
ext r
constructor
· rintro ⟨P, hI, rfl⟩
exact bestQuantizerRatio_eq_one_of_le hNM (by omega) P hI
· rintro rfl
exact ⟨diagLaw hN hM, diagLaw_mutualInfo_pos hN hM,
(bestQuantizerRatio_eq_one_of_le hNM (by omega) _ (diagLaw_mutualInfo_pos hN hM)).symm⟩
rw [essentialAvgMI, hset, csInf_singleton]
/-- The diagonal instance `N = M` of `Statement` holds: `a(M, M) = (M - 1)/(M - 1) = 1`. -/
theorem statement_diag (M : ℕ) (hM : 2 ≤ M) :
essentialAvgMI M M = ((M : ℝ) - 1) / ((M : ℝ) - 1) := by
have h2 : (2 : ℝ) ≤ M := by exact_mod_cast hM
rw [essentialAvgMI_eq_one_of_le hM le_rfl, div_self (by linarith)]
end Infimum
/-! ### The erasure family on `Fin 3 × Fin 2` -/
section Erasure
/-- The erasure law `P_a` on `Fin 3 × Fin 2` (rows `s`, columns `c`):
`S = 0` (probability `a`) reveals `C = 0`, `S = 2` (probability `a`) reveals `C = 1`, and
`S = 1` (probability `1 - 2a`) leaves `C` a fair coin. At `a = 1/3` this is Abu-Mostafa's
example. -/
noncomputable def erasureLaw (a : ℝ) (h0 : 0 ≤ a) (h1 : a ≤ 1 / 2) : ProbDist (Fin 3 × Fin 2) where
pmf := fun sc => ![![a, 0], ![1 / 2 - a, 1 / 2 - a], ![0, a]] sc.1 sc.2
nonneg := by
rintro ⟨s, c⟩
fin_cases s <;> fin_cases c <;> simp <;> linarith
sum_one := by
simp [Fintype.sum_prod_type, Fin.sum_univ_three, Fin.sum_univ_two]
ring
/-- The information kept by the best binary quantizer of `P_a`:
`g(a) = 1/2 + η(1 - a) - η(1/2 - a)` with `η(x) = -x log₂ x`. -/
noncomputable def erasureGain (a : ℝ) : ℝ := 1 / 2 + negPLogP (1 - a) - negPLogP (1 / 2 - a)
theorem negPLogP_zero' : negPLogP 0 = 0 := by simp [negPLogP]
theorem negPLogP_one' : negPLogP 1 = 0 := by simp [negPLogP, log2]
theorem negPLogP_half' : negPLogP (1 / 2) = 1 / 2 := by
have h2 : Real.log 2 ≠ 0 := by positivity
simp only [negPLogP, log2, show ¬ ((1 / 2 : ℝ) ≤ 0) by norm_num, ↓reduceIte]
rw [one_div, Real.log_inv]
field_simp
/-- `η(p/2) = p/2 + η(p)/2`. -/
theorem negPLogP_div_two {p : ℝ} (hp : 0 ≤ p) : negPLogP (p / 2) = p / 2 + negPLogP p / 2 := by
rw [show p / 2 = p * (1 / 2) by ring, negPLogP_mul hp (by norm_num), negPLogP_half']
ring
/-- Mutual information of a pmf on `Fin 2 × Fin 2` in terms of its four cells. -/
theorem mutualInfo_fin_two_fin_two (Q : ProbDist (Fin 2 × Fin 2)) :
mutualInfo Q =
negPLogP (Q.pmf (0, 0) + Q.pmf (0, 1)) + negPLogP (Q.pmf (1, 0) + Q.pmf (1, 1)) +
negPLogP (Q.pmf (0, 0) + Q.pmf (1, 0)) + negPLogP (Q.pmf (0, 1) + Q.pmf (1, 1)) -
(negPLogP (Q.pmf (0, 0)) + negPLogP (Q.pmf (0, 1)) + negPLogP (Q.pmf (1, 0)) +
negPLogP (Q.pmf (1, 1))) := by
simp only [mutualInfo, shannonEntropy, ProbDist.fst, ProbDist.snd, Fintype.sum_prod_type,
Fin.sum_univ_two]
ring
/-- `I(S; C) = 2a` for the erasure law. -/
theorem erasure_mutualInfo (a : ℝ) (h0 : 0 ≤ a) (h1 : a ≤ 1 / 2) :
mutualInfo (erasureLaw a h0 h1) = 2 * a := by
have F4 := negPLogP_div_two (p := 1 - 2 * a) (by linarith)
have F1 := negPLogP_half'
have F0 := negPLogP_zero'
simp only [mutualInfo, shannonEntropy, ProbDist.fst, ProbDist.snd, Fintype.sum_prod_type,
Fin.sum_univ_two, Fin.sum_univ_three, erasureLaw]
simp
ring_nf at F4 F1 F0 ⊢
linarith
/-- The binary quantizer `f = (0, 1, 1)` (isolate `S = 0`) keeps `g(a)`. -/
theorem erasure_quantizedInfo_best (a : ℝ) (h0 : 0 ≤ a) (h1 : a ≤ 1 / 2) :
quantizedInfo (erasureLaw a h0 h1) ![0, 1, 1] = erasureGain a := by
have F1 := negPLogP_half'
have F0 := negPLogP_zero'
rw [quantizedInfo, mutualInfo_fin_two_fin_two]
simp [ProbDist.map, erasureLaw, Fintype.sum_prod_type, Fin.sum_univ_three, Fin.sum_univ_two,
erasureGain]
ring_nf at F1 F0 ⊢
linarith
theorem erasureGain_nonneg (a : ℝ) (h0 : 0 ≤ a) (h1 : a ≤ 1 / 2) : 0 ≤ erasureGain a := by
rw [← erasure_quantizedInfo_best a h0 h1]
exact quantizedInfo_nonneg _ _
/-- No binary quantizer of `P_a` keeps more than `g(a)` (all eight maps `Fin 3 → Fin 2`). -/
theorem erasure_quantizedInfo_le (a : ℝ) (h0 : 0 ≤ a) (h1 : a ≤ 1 / 2) (f : Fin 3 → Fin 2) :
quantizedInfo (erasureLaw a h0 h1) f ≤ erasureGain a := by
have hf : f = ![f 0, f 1, f 2] := by
funext i; fin_cases i <;> rfl
have hg := erasureGain_nonneg a h0 h1
have F1 := negPLogP_half'
have F0 := negPLogP_zero'
have F3 := negPLogP_one'
have F4 := negPLogP_div_two (p := 1 - 2 * a) (by linarith)
have F5 := negPLogP_div_two (p := 2 * a) (by linarith)
rw [hf]
generalize f 0 = x, f 1 = y, f 2 = z
unfold erasureGain at hg ⊢
rw [quantizedInfo, mutualInfo_fin_two_fin_two]
fin_cases x <;> fin_cases y <;> fin_cases z <;>
simp [ProbDist.map, erasureLaw, Fintype.sum_prod_type, Fin.sum_univ_three,
Fin.sum_univ_two] <;>
ring_nf at F0 F1 F3 F4 F5 hg ⊢ <;> linarith
/-- The best binary quantizer of `P_a` keeps exactly `g(a)`. -/
theorem erasure_iSup (a : ℝ) (h0 : 0 ≤ a) (h1 : a ≤ 1 / 2) :
(⨆ f : Fin 3 → Fin 2, quantizedInfo (erasureLaw a h0 h1) f) = erasureGain a :=
le_antisymm (ciSup_le (erasure_quantizedInfo_le a h0 h1))
(le_ciSup_of_le (bddAbove_range_quantizedInfo _) ![0, 1, 1]
(erasure_quantizedInfo_best a h0 h1).ge)
theorem erasure_bestQuantizerRatio (a : ℝ) (h0 : 0 ≤ a) (h1 : a ≤ 1 / 2) :
bestQuantizerRatio (erasureLaw a h0 h1) = erasureGain a / (2 * a) := by
rw [bestQuantizerRatio, erasure_iSup, erasure_mutualInfo]
end Erasure
/-! ### Abu-Mostafa's example: every binary `f` loses information, so `a(3, 2) < 1` -/
section AbuMostafa
/-- Abu-Mostafa's `3 × 2` example (§3.17): rows `s = 0, 1, 2` are `(1/3, 0)`, `(1/6, 1/6)`,
`(0, 1/3)`. It is the erasure law at `a = 1/3`. -/
noncomputable def abuMostafaLaw : ProbDist (Fin 3 × Fin 2) :=
erasureLaw (1 / 3) (by norm_num) (by norm_num)
theorem abuMostafaLaw_pmf (s : Fin 3) (c : Fin 2) :
abuMostafaLaw.pmf (s, c) = ![![1 / 3, 0], ![1 / 6, 1 / 6], ![0, 1 / 3]] s c := by
fin_cases s <;> fin_cases c <;> simp [abuMostafaLaw, erasureLaw] <;> norm_num
/-- `I(S; C) = 2/3` bit. -/
theorem abuMostafaLaw_mutualInfo : mutualInfo abuMostafaLaw = 2 / 3 := by
rw [abuMostafaLaw, erasure_mutualInfo]
norm_num
theorem log2_three_lt_two : log2 3 < 2 := by
have hL : 0 < Real.log 2 := Real.log_pos one_lt_two
have h34 : Real.log 3 < Real.log 4 := Real.log_lt_log (by norm_num) (by norm_num)
have h4 : Real.log 4 = 2 * Real.log 2 := by
rw [show (4 : ℝ) = 2 ^ 2 by norm_num, Real.log_pow]
norm_num
unfold log2
rw [div_lt_iff₀ hL]
linarith
/-- The best binary quantizer keeps `(1/2) log₂ 3 - 1/3 ≈ 0.459` of the `2/3` bit, so the ratio
is `(3/4) log₂ 3 - 1/2 ≈ 0.689`. -/
theorem abuMostafaLaw_bestQuantizerRatio :
bestQuantizerRatio abuMostafaLaw = 3 / 4 * log2 3 - 1 / 2 := by
have hl2 : Real.log 2 ≠ 0 := (Real.log_pos one_lt_two).ne'
have e1 : negPLogP (1 - 1 / 3) = 2 / 3 * (log2 3 - 1) := by
rw [show (1 : ℝ) - 1 / 3 = 2 / 3 by norm_num]
simp only [negPLogP, log2, show ¬ ((2 / 3 : ℝ) ≤ 0) by norm_num, ↓reduceIte]
rw [Real.log_div (by norm_num) (by norm_num)]
field_simp
ring
have e2 : negPLogP (1 / 2 - 1 / 3) = 1 / 6 * (1 + log2 3) := by
rw [show (1 : ℝ) / 2 - 1 / 3 = 1 / 6 by norm_num]
simp only [negPLogP, log2, show ¬ ((1 / 6 : ℝ) ≤ 0) by norm_num, ↓reduceIte]
rw [one_div, Real.log_inv, show (6 : ℝ) = 2 * 3 by norm_num,
Real.log_mul (by norm_num) (by norm_num)]
field_simp
rw [abuMostafaLaw, erasure_bestQuantizerRatio, erasureGain, e1, e2]
ring
/-- Abu-Mostafa's claim: for his example every map `f : {0,1,2} → {0,1}` makes
`I(f(S); C) < I(S; C)`. -/
theorem abuMostafaLaw_quantizedInfo_lt (f : Fin 3 → Fin 2) :
quantizedInfo abuMostafaLaw f < mutualInfo abuMostafaLaw := by
have h := erasure_quantizedInfo_le (1 / 3) (by norm_num) (by norm_num) f
have hr := abuMostafaLaw_bestQuantizerRatio
rw [abuMostafaLaw, erasure_bestQuantizerRatio] at hr
rw [abuMostafaLaw_mutualInfo]
have hg : erasureGain (1 / 3) = 2 / 3 * (3 / 4 * log2 3 - 1 / 2) := by
rw [← hr]; field_simp
have := log2_three_lt_two
change quantizedInfo (erasureLaw (1 / 3) _ _) f < 2 / 3
linarith
theorem abuMostafaLaw_ratio_lt_one : bestQuantizerRatio abuMostafaLaw < 1 := by
rw [abuMostafaLaw_bestQuantizerRatio]
linarith [log2_three_lt_two]
/-- **`a(3, 2) < 1`** (Abu-Mostafa 1987). -/
theorem essentialAvgMI_three_two_lt_one : essentialAvgMI 3 2 < 1 :=
(essentialAvgMI_le_bestQuantizerRatio (by norm_num) _
(by rw [abuMostafaLaw_mutualInfo]; norm_num)).trans_lt abuMostafaLaw_ratio_lt_one
end AbuMostafa
/-! ### The upper bound `a(3, 2) ≤ 1/2 = (M - 1)/(N - 1)` (erasure family, `a → 0`) -/
section UpperBound
/-- `g(a) ≤ a + 2a² / ln 2` for `0 < a < 1/2`. -/
theorem erasureGain_le {a : ℝ} (ha : 0 < a) (ha2 : a < 1 / 2) :
erasureGain a ≤ a + 2 * a ^ 2 / Real.log 2 := by
have hL : 0 < Real.log 2 := Real.log_pos one_lt_two
have hp1 : 0 < 1 - a := by linarith
have hp2 : 0 < 1 - 2 * a := by linarith
have e1 : negPLogP (1 - a) = -(1 - a) * (Real.log (1 - a) / Real.log 2) := by
simp only [negPLogP, log2, show ¬ (1 - a ≤ 0) by linarith, ↓reduceIte]
have e2 : negPLogP (1 / 2 - a) =
-(1 / 2 - a) * ((Real.log (1 - 2 * a) - Real.log 2) / Real.log 2) := by
simp only [negPLogP, log2, show ¬ (1 / 2 - a ≤ 0) by linarith, ↓reduceIte]
rw [show (1 / 2 - a) = (1 - 2 * a) / 2 by ring, Real.log_div hp2.ne' two_ne_zero]
have key : erasureGain a =
a + (-(1 - a) * Real.log (1 - a) + (1 / 2 - a) * Real.log (1 - 2 * a)) / Real.log 2 := by
unfold erasureGain
rw [e1, e2]
field_simp
ring
have b1 : -(1 - a) * Real.log (1 - a) ≤ a := by
have h := Real.one_sub_inv_le_log_of_pos hp1
have hm := mul_le_mul_of_nonneg_left h hp1.le
have : (1 - a) * (1 - (1 - a)⁻¹) = (1 - a) - 1 := by
field_simp
linarith
have b2 : (1 / 2 - a) * Real.log (1 - 2 * a) ≤ (1 / 2 - a) * (-2 * a) := by
have := Real.log_le_sub_one_of_pos hp2
exact mul_le_mul_of_nonneg_left (by linarith) (by linarith)
rw [key, add_le_add_iff_left]
exact div_le_div_of_nonneg_right (by nlinarith) hL.le
/-- `bestQuantizerRatio P_a ≤ 1/2 + a / ln 2` for `0 < a < 1/2`. -/
theorem erasure_bestQuantizerRatio_le {a : ℝ} (ha : 0 < a) (ha2 : a < 1 / 2) :
bestQuantizerRatio (erasureLaw a ha.le ha2.le) ≤ 1 / 2 + a / Real.log 2 := by
have hL : 0 < Real.log 2 := Real.log_pos one_lt_two
rw [erasure_bestQuantizerRatio, div_le_iff₀ (by positivity)]
have h := erasureGain_le ha ha2
have : (1 / 2 + a / Real.log 2) * (2 * a) = a + 2 * a ^ 2 / Real.log 2 := by
field_simp
linarith
/-- **`a(3, 2) ≤ 1/2`**: the erasure laws `P_a` with `a → 0` keep at most `1/2 + a / ln 2` of the
information under every binary quantizer. This is the `N = 3` case of the upper bound
`a(N, M) ≤ (M - 1)/(N - 1)`, i.e. the conjectured value is not beaten from above. -/
theorem essentialAvgMI_three_two_le_half : essentialAvgMI 3 2 ≤ 1 / 2 := by
have hL : 0 < Real.log 2 := Real.log_pos one_lt_two
refine le_of_forall_pos_lt_add fun ε hε => ?_
set a := min (1 / 4 : ℝ) (ε * Real.log 2 / 2) with ha_def
have ha : 0 < a := lt_min (by norm_num) (by positivity)
have ha2 : a < 1 / 2 := (min_le_left _ _).trans_lt (by norm_num)
have hle : a ≤ ε * Real.log 2 / 2 := min_le_right _ _
have hI : 0 < mutualInfo (erasureLaw a ha.le ha2.le) := by
rw [erasure_mutualInfo]; linarith
have hdiv : a / Real.log 2 ≤ ε / 2 := by
rw [div_le_iff₀ hL]; linarith
calc essentialAvgMI 3 2 ≤ bestQuantizerRatio (erasureLaw a ha.le ha2.le) :=
essentialAvgMI_le_bestQuantizerRatio (by norm_num) _ hI
_ ≤ 1 / 2 + a / Real.log 2 := erasure_bestQuantizerRatio_le ha ha2
_ < 1 / 2 + ε := by linarith
/-- Consequently `a(3, 2) < 0.6`, well below Abu-Mostafa's example (`≈ 0.689`). -/
theorem essentialAvgMI_three_two_lt : essentialAvgMI 3 2 < 3 / 5 :=
essentialAvgMI_three_two_le_half.trans_lt (by norm_num)
end UpperBound
/-! ### The lower bound `a(3, 2) ≥ 1/2`, hence `a(3, 2) = 1/2`
For binary `C` write each row of the joint pmf as a vector `r_s = (p(s,0), p(s,1))` and let
`G(u, v) = η(u) + η(v) - η(u + v) = (u + v) h(v/(u + v))`. Then `I(S; C) = G(T) - ∑_s G(r_s)`
with `T = ∑_s r_s`, and the quantizer isolating `a` keeps `G(T) - G(r_a) - G(T - r_a)`.
`G` is `1`-homogeneous and superadditive (data processing), so it is concave along cones. If
the rows are ordered by slope, `r_a ≼ r_b ≼ r_c`, then `r_b` and `T` lie in the cone spanned by
`r_a + r_b` and `r_b + r_c` with complementary coefficients, which gives
`G(r_a + r_b) + G(r_b + r_c) ≤ G(T) + G(r_b)`, i.e. `I(S; C) ≤ I_a + I_c`. -/
section LowerBound
/-- `G(u, v) = η(u) + η(v) - η(u + v)`, the conditional-entropy weight `(u + v) h(v/(u + v))` of a
row `(u, v)`. -/
noncomputable def rowEnt (u v : ℝ) : ℝ := negPLogP u + negPLogP v - negPLogP (u + v)
theorem rowEnt_zero : rowEnt 0 0 = 0 := by simp [rowEnt, negPLogP_zero']
/-- `G` is positively `1`-homogeneous. -/
theorem rowEnt_smul {t u v : ℝ} (ht : 0 ≤ t) (hu : 0 ≤ u) (hv : 0 ≤ v) :
rowEnt (t * u) (t * v) = t * rowEnt u v := by
unfold rowEnt
rw [show t * u + t * v = t * (u + v) by ring, negPLogP_mul ht hu, negPLogP_mul ht hv,
negPLogP_mul ht (add_nonneg hu hv)]
ring
/-- Mutual information on `Fin 2 × Fin 2` in terms of `G`. -/
theorem mutualInfo_fin_two_fin_two_rowEnt (Q : ProbDist (Fin 2 × Fin 2)) :
mutualInfo Q = rowEnt (Q.pmf (0, 0) + Q.pmf (1, 0)) (Q.pmf (0, 1) + Q.pmf (1, 1)) -
rowEnt (Q.pmf (0, 0)) (Q.pmf (0, 1)) - rowEnt (Q.pmf (1, 0)) (Q.pmf (1, 1)) := by
have hs : Q.pmf (0, 0) + Q.pmf (1, 0) + (Q.pmf (0, 1) + Q.pmf (1, 1)) = 1 := by
have h := Q.sum_one
simp only [Fintype.sum_prod_type, Fin.sum_univ_two] at h
linarith
rw [mutualInfo_fin_two_fin_two]
unfold rowEnt
rw [hs, negPLogP_one']
ring
/-- `G` is superadditive: merging two rows cannot decrease `H(C | ·)` (data processing). -/
theorem rowEnt_superadd {u₁ v₁ u₂ v₂ : ℝ} (hu₁ : 0 ≤ u₁) (hv₁ : 0 ≤ v₁) (hu₂ : 0 ≤ u₂)
(hv₂ : 0 ≤ v₂) : rowEnt u₁ v₁ + rowEnt u₂ v₂ ≤ rowEnt (u₁ + u₂) (v₁ + v₂) := by
set S := u₁ + v₁ + u₂ + v₂ with hS
rcases (show 0 ≤ S by positivity).lt_or_eq with hpos | hzero
· let Q : ProbDist (Fin 2 × Fin 2) :=
{ pmf := fun yc => ![![u₁ / S, v₁ / S], ![u₂ / S, v₂ / S]] yc.1 yc.2
nonneg := by
rintro ⟨y, c⟩
fin_cases y <;> fin_cases c <;> simp <;> positivity
sum_one := by
simp only [Fintype.sum_prod_type, Fin.sum_univ_two]
simp
field_simp
linarith }
have hI := mutualInfo_nonneg Q
rw [mutualInfo_fin_two_fin_two_rowEnt] at hI
simp only [Q] at hI
simp at hI
have e1 : rowEnt u₁ v₁ = S * rowEnt (u₁ / S) (v₁ / S) := by
rw [← rowEnt_smul hpos.le (by positivity) (by positivity)]
congr 1 <;> field_simp
have e2 : rowEnt u₂ v₂ = S * rowEnt (u₂ / S) (v₂ / S) := by
rw [← rowEnt_smul hpos.le (by positivity) (by positivity)]
congr 1 <;> field_simp
have e3 : rowEnt (u₁ + u₂) (v₁ + v₂) = S * rowEnt (u₁ / S + u₂ / S) (v₁ / S + v₂ / S) := by
rw [← rowEnt_smul hpos.le (by positivity) (by positivity)]
congr 1 <;> field_simp
rw [e1, e2, e3]
nlinarith
· have h1 : u₁ = 0 := by linarith
have h2 : v₁ = 0 := by linarith
have h3 : u₂ = 0 := by linarith
have h4 : v₂ = 0 := by linarith
subst h1 h2 h3 h4
simp [rowEnt_zero]
/-- Concavity of `G` along cones: `α G(X) + β G(Y) ≤ G(α X + β Y)` for `α, β ≥ 0`. -/
theorem rowEnt_cone {α β x₀ x₁ y₀ y₁ : ℝ} (hα : 0 ≤ α) (hβ : 0 ≤ β) (hx₀ : 0 ≤ x₀)
(hx₁ : 0 ≤ x₁) (hy₀ : 0 ≤ y₀) (hy₁ : 0 ≤ y₁) :
α * rowEnt x₀ x₁ + β * rowEnt y₀ y₁ ≤ rowEnt (α * x₀ + β * y₀) (α * x₁ + β * y₁) := by
rw [← rowEnt_smul hα hx₀ hx₁, ← rowEnt_smul hβ hy₀ hy₁]
exact rowEnt_superadd (by positivity) (by positivity) (by positivity) (by positivity)
/-- **Key inequality.** For rows `a, b, c` in the closed positive quadrant with
`det(a, b) ≥ 0` and `det(b, c) ≥ 0` (slopes ordered `a ≼ b ≼ c`):
`G(a + b) + G(b + c) ≤ G(a + b + c) + G(b)`. -/
theorem rowEnt_key {a₀ a₁ b₀ b₁ c₀ c₁ : ℝ} (ha₀ : 0 ≤ a₀) (ha₁ : 0 ≤ a₁) (hb₀ : 0 ≤ b₀)
(hb₁ : 0 ≤ b₁) (hc₀ : 0 ≤ c₀) (hc₁ : 0 ≤ c₁) (hab : 0 ≤ a₀ * b₁ - a₁ * b₀)
(hbc : 0 ≤ b₀ * c₁ - b₁ * c₀) :
rowEnt (a₀ + b₀) (a₁ + b₁) + rowEnt (b₀ + c₀) (b₁ + c₁) ≤
rowEnt (a₀ + b₀ + c₀) (a₁ + b₁ + c₁) + rowEnt b₀ b₁ := by
set dab := a₀ * b₁ - a₁ * b₀
set dbc := b₀ * c₁ - b₁ * c₀
set dac := a₀ * c₁ - a₁ * c₀
rcases (show 0 ≤ b₀ + b₁ by positivity).lt_or_eq with hsb | hsb
· -- `det(a, c) ≥ 0` follows from the Plücker identity on coordinate sums
have hpl : dac * (b₀ + b₁) = dbc * (a₀ + a₁) + dab * (c₀ + c₁) := by
simp only [dab, dbc, dac]; ring
have hac : 0 ≤ dac := by
by_contra h
push Not at h
have : dac * (b₀ + b₁) < 0 := mul_neg_of_neg_of_pos h hsb
nlinarith [mul_nonneg hbc (add_nonneg ha₀ ha₁), mul_nonneg hab (add_nonneg hc₀ hc₁)]
set D := dab + dac + dbc with hD
rcases (show 0 ≤ D by positivity).lt_or_eq with hDpos | hD0
· -- `b = α (a + b) + β (b + c)` and `a + b + c = (1 - α)(a + b) + (1 - β)(b + c)`
set α := dbc / D
set β := dab / D
have hα : 0 ≤ α := div_nonneg hbc hDpos.le
have hβ : 0 ≤ β := div_nonneg hab hDpos.le
have hα' : 0 ≤ 1 - α := by
rw [sub_nonneg, div_le_one hDpos]; linarith
have hβ' : 0 ≤ 1 - β := by
rw [sub_nonneg, div_le_one hDpos]; linarith
have hb0 : b₀ = α * (a₀ + b₀) + β * (b₀ + c₀) := by
simp only [α, β]; field_simp; simp only [D, dab, dbc, dac]; ring
have hb1 : b₁ = α * (a₁ + b₁) + β * (b₁ + c₁) := by
simp only [α, β]; field_simp; simp only [D, dab, dbc, dac]; ring
have hT0 : a₀ + b₀ + c₀ = (1 - α) * (a₀ + b₀) + (1 - β) * (b₀ + c₀) := by
linear_combination (-1 : ℝ) * hb0
have hT1 : a₁ + b₁ + c₁ = (1 - α) * (a₁ + b₁) + (1 - β) * (b₁ + c₁) := by
linear_combination (-1 : ℝ) * hb1
have h1 := rowEnt_cone (x₀ := a₀ + b₀) (x₁ := a₁ + b₁) (y₀ := b₀ + c₀) (y₁ := b₁ + c₁)
hα hβ (by positivity) (by positivity) (by positivity) (by positivity)
have h2 := rowEnt_cone (x₀ := a₀ + b₀) (x₁ := a₁ + b₁) (y₀ := b₀ + c₀) (y₁ := b₁ + c₁)
hα' hβ' (by positivity) (by positivity) (by positivity) (by positivity)
rw [← hb0, ← hb1] at h1
rw [← hT0, ← hT1] at h2
linarith
· -- all three determinants vanish: every row is a multiple of `b`
have hab0 : dab = 0 := by linarith
have hbc0 : dbc = 0 := by linarith
set sb := b₀ + b₁
have hsb' : sb ≠ 0 := hsb.ne'
have hmul : ∀ {x₀ x₁ : ℝ}, x₀ * b₁ - x₁ * b₀ = 0 →
x₀ = (x₀ + x₁) / sb * b₀ ∧ x₁ = (x₀ + x₁) / sb * b₁ := by
intro x₀ x₁ hx
constructor
· rw [div_mul_eq_mul_div, eq_div_iff hsb']
simp only [sb]
linear_combination hx
· rw [div_mul_eq_mul_div, eq_div_iff hsb']
simp only [sb]
linear_combination (-1 : ℝ) * hx
have hc : c₀ * b₁ - c₁ * b₀ = 0 := by simp only [dbc] at hbc0; linarith
obtain ⟨ea₀, ea₁⟩ := hmul (show a₀ * b₁ - a₁ * b₀ = 0 from hab0)
obtain ⟨ec₀, ec₁⟩ := hmul hc
set ta := (a₀ + a₁) / sb
set tc := (c₀ + c₁) / sb
have hta : 0 ≤ ta := by positivity
have htc : 0 ≤ tc := by positivity
have k1 : rowEnt (a₀ + b₀) (a₁ + b₁) = (ta + 1) * rowEnt b₀ b₁ := by
rw [← rowEnt_smul (by positivity) hb₀ hb₁]; congr 1 <;> linarith
have k2 : rowEnt (b₀ + c₀) (b₁ + c₁) = (1 + tc) * rowEnt b₀ b₁ := by
rw [← rowEnt_smul (by positivity) hb₀ hb₁]; congr 1 <;> linarith
have k3 : rowEnt (a₀ + b₀ + c₀) (a₁ + b₁ + c₁) = (ta + 1 + tc) * rowEnt b₀ b₁ := by
rw [← rowEnt_smul (by positivity) hb₀ hb₁]; congr 1 <;> linarith
rw [k1, k2, k3]
linarith
· -- `b = 0`: plain superadditivity
have h0 : b₀ = 0 := by linarith
have h1 : b₁ = 0 := by linarith
subst h0 h1
simp only [add_zero, zero_add, rowEnt_zero]
exact rowEnt_superadd ha₀ ha₁ hc₀ hc₁
/-- `rowEnt_key` with the sums named, for rewriting-free use. -/
theorem rowEnt_key' {a₀ a₁ b₀ b₁ c₀ c₁ X₀ X₁ Y₀ Y₁ T₀ T₁ : ℝ} (ha₀ : 0 ≤ a₀) (ha₁ : 0 ≤ a₁)
(hb₀ : 0 ≤ b₀) (hb₁ : 0 ≤ b₁) (hc₀ : 0 ≤ c₀) (hc₁ : 0 ≤ c₁)
(hab : 0 ≤ a₀ * b₁ - a₁ * b₀) (hbc : 0 ≤ b₀ * c₁ - b₁ * c₀)
(hX₀ : X₀ = a₀ + b₀) (hX₁ : X₁ = a₁ + b₁) (hY₀ : Y₀ = b₀ + c₀) (hY₁ : Y₁ = b₁ + c₁)
(hT₀ : T₀ = a₀ + b₀ + c₀) (hT₁ : T₁ = a₁ + b₁ + c₁) :
rowEnt X₀ X₁ + rowEnt Y₀ Y₁ ≤ rowEnt T₀ T₁ + rowEnt b₀ b₁ := by
subst hX₀ hX₁ hY₀ hY₁ hT₀ hT₁
exact rowEnt_key ha₀ ha₁ hb₀ hb₁ hc₀ hc₁ hab hbc
section FinThree
variable (P : ProbDist (Fin 3 × Fin 2))
theorem sum_fin_three_two :
P.pmf (0, 0) + P.pmf (1, 0) + P.pmf (2, 0) + (P.pmf (0, 1) + P.pmf (1, 1) + P.pmf (2, 1)) =
1 := by
have h := P.sum_one
simp only [Fintype.sum_prod_type, Fin.sum_univ_three, Fin.sum_univ_two] at h
linarith
/-- `I(S; C) = G(T) - G(r₀) - G(r₁) - G(r₂)`. -/
theorem mutualInfo_fin_three_two :
mutualInfo P =
rowEnt (P.pmf (0, 0) + P.pmf (1, 0) + P.pmf (2, 0))
(P.pmf (0, 1) + P.pmf (1, 1) + P.pmf (2, 1)) -
rowEnt (P.pmf (0, 0)) (P.pmf (0, 1)) - rowEnt (P.pmf (1, 0)) (P.pmf (1, 1)) -
rowEnt (P.pmf (2, 0)) (P.pmf (2, 1)) := by
have hs := sum_fin_three_two P
simp only [mutualInfo, shannonEntropy, ProbDist.fst, ProbDist.snd, Fintype.sum_prod_type,
Fin.sum_univ_two, Fin.sum_univ_three]
unfold rowEnt
rw [hs, negPLogP_one']
ring
/-- Isolating `S = 0`: `I = G(T) - G(r₀) - G(r₁ + r₂)`. -/
theorem quantizedInfo_iso0 :
quantizedInfo P ![0, 1, 1] =
rowEnt (P.pmf (0, 0) + P.pmf (1, 0) + P.pmf (2, 0))
(P.pmf (0, 1) + P.pmf (1, 1) + P.pmf (2, 1)) -
rowEnt (P.pmf (0, 0)) (P.pmf (0, 1)) -
rowEnt (P.pmf (1, 0) + P.pmf (2, 0)) (P.pmf (1, 1) + P.pmf (2, 1)) := by
rw [quantizedInfo, mutualInfo_fin_two_fin_two_rowEnt]
simp [ProbDist.map, Fintype.sum_prod_type, Fin.sum_univ_three, Fin.sum_univ_two]
ring_nf
/-- Isolating `S = 1`: `I = G(T) - G(r₁) - G(r₀ + r₂)`. -/
theorem quantizedInfo_iso1 :
quantizedInfo P ![1, 0, 1] =
rowEnt (P.pmf (0, 0) + P.pmf (1, 0) + P.pmf (2, 0))
(P.pmf (0, 1) + P.pmf (1, 1) + P.pmf (2, 1)) -
rowEnt (P.pmf (1, 0)) (P.pmf (1, 1)) -
rowEnt (P.pmf (0, 0) + P.pmf (2, 0)) (P.pmf (0, 1) + P.pmf (2, 1)) := by
rw [quantizedInfo, mutualInfo_fin_two_fin_two_rowEnt]
simp [ProbDist.map, Fintype.sum_prod_type, Fin.sum_univ_three, Fin.sum_univ_two]
ring_nf
/-- Isolating `S = 2`: `I = G(T) - G(r₂) - G(r₀ + r₁)`. -/
theorem quantizedInfo_iso2 :
quantizedInfo P ![1, 1, 0] =
rowEnt (P.pmf (0, 0) + P.pmf (1, 0) + P.pmf (2, 0))
(P.pmf (0, 1) + P.pmf (1, 1) + P.pmf (2, 1)) -
rowEnt (P.pmf (2, 0)) (P.pmf (2, 1)) -
rowEnt (P.pmf (0, 0) + P.pmf (1, 0)) (P.pmf (0, 1) + P.pmf (1, 1)) := by
rw [quantizedInfo, mutualInfo_fin_two_fin_two_rowEnt]
simp [ProbDist.map, Fintype.sum_prod_type, Fin.sum_univ_three, Fin.sum_univ_two]
ring_nf
/-- **`I(S; C) ≤ I_a + I_c`** for the two quantizers isolating the extreme rows (in slope
order). This is the `N = 3` case of `I(S;C) ≤ ∑_j I(f_j(S); C)` over threshold quantizers. -/
theorem exists_two_quantizers :
∃ f g : Fin 3 → Fin 2, mutualInfo P ≤ quantizedInfo P f + quantizedInfo P g := by
have n00 := P.nonneg (0, 0); have n01 := P.nonneg (0, 1)
have n10 := P.nonneg (1, 0); have n11 := P.nonneg (1, 1)
have n20 := P.nonneg (2, 0); have n21 := P.nonneg (2, 1)
have hI := mutualInfo_fin_three_two P
have q0 := quantizedInfo_iso0 P
have q1 := quantizedInfo_iso1 P
have q2 := quantizedInfo_iso2 P
rcases le_or_gt 0 (P.pmf (0, 0) * P.pmf (1, 1) - P.pmf (0, 1) * P.pmf (1, 0)) with d01 | d01 <;>
rcases le_or_gt 0 (P.pmf (1, 0) * P.pmf (2, 1) - P.pmf (1, 1) * P.pmf (2, 0)) with d12 | d12
· -- order 0 ≼ 1 ≼ 2
have k := rowEnt_key'
(X₀ := P.pmf (0, 0) + P.pmf (1, 0)) (X₁ := P.pmf (0, 1) + P.pmf (1, 1))
(Y₀ := P.pmf (1, 0) + P.pmf (2, 0)) (Y₁ := P.pmf (1, 1) + P.pmf (2, 1))
(T₀ := P.pmf (0, 0) + P.pmf (1, 0) + P.pmf (2, 0))
(T₁ := P.pmf (0, 1) + P.pmf (1, 1) + P.pmf (2, 1))
n00 n01 n10 n11 n20 n21 d01 d12
(by ring) (by ring) (by ring) (by ring) (by ring) (by ring)
exact ⟨![0, 1, 1], ![1, 1, 0], by linarith⟩
· rcases le_or_gt 0 (P.pmf (0, 0) * P.pmf (2, 1) - P.pmf (0, 1) * P.pmf (2, 0)) with d02 | d02
· -- order 0 ≼ 2 ≼ 1
have k := rowEnt_key'
(X₀ := P.pmf (0, 0) + P.pmf (2, 0)) (X₁ := P.pmf (0, 1) + P.pmf (2, 1))
(Y₀ := P.pmf (1, 0) + P.pmf (2, 0)) (Y₁ := P.pmf (1, 1) + P.pmf (2, 1))
(T₀ := P.pmf (0, 0) + P.pmf (1, 0) + P.pmf (2, 0))
(T₁ := P.pmf (0, 1) + P.pmf (1, 1) + P.pmf (2, 1))
n00 n01 n20 n21 n10 n11 d02 (by linarith)
(by ring) (by ring) (by ring) (by ring) (by ring) (by ring)
exact ⟨![0, 1, 1], ![1, 0, 1], by linarith⟩
· -- order 2 ≼ 0 ≼ 1
have k := rowEnt_key'
(X₀ := P.pmf (0, 0) + P.pmf (2, 0)) (X₁ := P.pmf (0, 1) + P.pmf (2, 1))
(Y₀ := P.pmf (0, 0) + P.pmf (1, 0)) (Y₁ := P.pmf (0, 1) + P.pmf (1, 1))
(T₀ := P.pmf (0, 0) + P.pmf (1, 0) + P.pmf (2, 0))
(T₁ := P.pmf (0, 1) + P.pmf (1, 1) + P.pmf (2, 1))
n20 n21 n00 n01 n10 n11 (by linarith) d01
(by ring) (by ring) (by ring) (by ring) (by ring) (by ring)
exact ⟨![1, 1, 0], ![1, 0, 1], by linarith⟩
· rcases le_or_gt 0 (P.pmf (0, 0) * P.pmf (2, 1) - P.pmf (0, 1) * P.pmf (2, 0)) with d02 | d02
· -- order 1 ≼ 0 ≼ 2
have k := rowEnt_key'
(X₀ := P.pmf (0, 0) + P.pmf (1, 0)) (X₁ := P.pmf (0, 1) + P.pmf (1, 1))
(Y₀ := P.pmf (0, 0) + P.pmf (2, 0)) (Y₁ := P.pmf (0, 1) + P.pmf (2, 1))
(T₀ := P.pmf (0, 0) + P.pmf (1, 0) + P.pmf (2, 0))
(T₁ := P.pmf (0, 1) + P.pmf (1, 1) + P.pmf (2, 1))
n10 n11 n00 n01 n20 n21 (by linarith) d02
(by ring) (by ring) (by ring) (by ring) (by ring) (by ring)
exact ⟨![1, 0, 1], ![1, 1, 0], by linarith⟩
· -- order 1 ≼ 2 ≼ 0
have k := rowEnt_key'
(X₀ := P.pmf (1, 0) + P.pmf (2, 0)) (X₁ := P.pmf (1, 1) + P.pmf (2, 1))
(Y₀ := P.pmf (0, 0) + P.pmf (2, 0)) (Y₁ := P.pmf (0, 1) + P.pmf (2, 1))
(T₀ := P.pmf (0, 0) + P.pmf (1, 0) + P.pmf (2, 0))
(T₁ := P.pmf (0, 1) + P.pmf (1, 1) + P.pmf (2, 1))
n10 n11 n20 n21 n00 n01 d12 (by linarith)
(by ring) (by ring) (by ring) (by ring) (by ring) (by ring)
exact ⟨![1, 0, 1], ![0, 1, 1], by linarith⟩
· -- order 2 ≼ 1 ≼ 0
have k := rowEnt_key'
(X₀ := P.pmf (1, 0) + P.pmf (2, 0)) (X₁ := P.pmf (1, 1) + P.pmf (2, 1))
(Y₀ := P.pmf (0, 0) + P.pmf (1, 0)) (Y₁ := P.pmf (0, 1) + P.pmf (1, 1))
(T₀ := P.pmf (0, 0) + P.pmf (1, 0) + P.pmf (2, 0))
(T₁ := P.pmf (0, 1) + P.pmf (1, 1) + P.pmf (2, 1))
n20 n21 n10 n11 n00 n01 (by linarith) (by linarith)
(by ring) (by ring) (by ring) (by ring) (by ring) (by ring)
exact ⟨![1, 1, 0], ![0, 1, 1], by linarith⟩
/-- The best binary quantizer keeps at least half of `I(S; C)`. -/
theorem mutualInfo_le_two_mul_iSup :
mutualInfo P ≤ 2 * ⨆ f : Fin 3 → Fin 2, quantizedInfo P f := by
obtain ⟨f, g, h⟩ := exists_two_quantizers P
have hf := le_ciSup (bddAbove_range_quantizedInfo P) f
have hg := le_ciSup (bddAbove_range_quantizedInfo P) g
linarith
theorem half_le_bestQuantizerRatio (hI : 0 < mutualInfo P) : 1 / 2 ≤ bestQuantizerRatio P := by
rw [bestQuantizerRatio, le_div_iff₀ hI]
linarith [mutualInfo_le_two_mul_iSup P]
end FinThree
/-- **`a(3, 2) ≥ 1/2`.** -/
theorem half_le_essentialAvgMI_three_two : 1 / 2 ≤ essentialAvgMI 3 2 :=
le_csInf (ratioSet_nonempty (by norm_num) le_rfl) (by
rintro r ⟨P, hI, rfl⟩
exact half_le_bestQuantizerRatio P hI)
/-- **`a(3, 2) = 1/2`**: Abu-Mostafa's own case is settled. -/
theorem essentialAvgMI_three_two : essentialAvgMI 3 2 = 1 / 2 :=
le_antisymm essentialAvgMI_three_two_le_half half_le_essentialAvgMI_three_two
/-- The instance `N = 3`, `M = 2` of `Statement` holds. -/
theorem statement_three_two :
essentialAvgMI 3 2 = (((2 : ℕ) : ℝ) - 1) / (((3 : ℕ) : ℝ) - 1) := by
rw [essentialAvgMI_three_two]
norm_num
end LowerBound
end InfoTheory.Known.Certificates.EssentialAverageMutualInformation