import Mathlib /-! # Asymmetric & k-Wise Entropy-Coupling Inequalities and Structural Thresholds # for Frankl's Union-Closed Sets Conjecture This file formalizes a self-contained framework for asymmetric and k-wise entropy inequalities under union/OR, their application to approximate cross-union expansion and subfamily absorption (strictly surpassing the `0.382885` global threshold and reaching `≥ 1/2`), and sharp structural Frankl theorems for bounded VC-dimension. ## Main Components 1. **Binary Entropy & Log-Exponential Transform** (`binEntropy`, `g`, `fenchelDual`): Exact correspondence `binEntropy (exp (-u)) = exp (-u) * g u`, strict concavity of `g`, Fenchel-Legendre duality criterion, and equivalence of `k`-wise product-entropy inequalities with `g (∑ u_j) ≥ ∑ α_j g u_j`. 2. **Sharp `3/2`-Power Strict Convexity & Exact `1 / log 2` (`log₂ e`) Star-Shaped Superadditivity**: - Via an exact positive-coefficient rational certificate over `artanh` bounds, we prove `2 * g u * (-g'' u) < (g' u)^2` for all `u > 0`, establishing strict convexity of `(g u)^(3/2)` on `[0, ∞)` and the `ℓ_{3/2}`/`ℓ_3` product-entropy family. - Via a 3-line strict-concavity proof for `fLog(x) = x / (-log(1 - x))`, we discover and prove the **exact sharp star-shapedness exponent** `p₀ = 1 / log 2 = log₂ e ≈ 1.442695`: `u ↦ g(u)^(1 / log 2) / u` is strictly increasing on `(0, ∞)`, **fails monotonicity** for every `p < 1 / log 2`, and **strictly separates star-shapedness from convexity** (`g(u)^(1 / log 2)` is provably non-convex at `u = log(3/2)`). This yields the sharp universal `k`-wise `ℓ_{log₂ e}` superadditive inequality and its `ℓ_{1 / (1 - log 2)}` Hölder-dual linear family (`1 / (1 - log 2) ≈ 3.25889 > 3`), recovering `h(x^k) ≥ k^(log 2) * x^(k-1) * h(x)` for all `k ≥ 1`. 3. **Exact Symmetric & Two-Variable Boppana Inequality (`φ = (1 + √5) / 2`)**: Elementary proof via exact rational cancellation of `((h(x^2) - φ x h(x)) / x^2)'` and concavity of its cubic second-derivative numerator `P(x) = -φ x^3 - 4 x^2 + 3 φ x + 2 φ - 4`, upgraded in 2 lines via `concaveOn_g` to `(φ / 2) (y h(x) + x h(y)) ≤ h(x y)`. 4. **Finite Shannon Entropy, `k`-Distribution Union Coupling, and Union-Closed Theorems**: Exact chain rule on `Fin (n + 1) → Bool`, master `k`-distribution union-coupling theorem, universal `k`-wise `ℓ_{log₂ e}` superadditive union-entropy theorem, exact Chase–Lovett `(3 - √5) / 2` bound, single-step and `m`-fold subfamily absorption (with explicit rational thresholds strictly surpassing Jiang's Sept 2026 `0.38288525` global record and reaching full Frankl `≥ 1/2`), and dimension-free `(1 - ε)`-approximate `k`-wise cross-union expansion. 5. **Bounded VC-Dimension Union-Closed Theorems**: Minimal hitting-set shattering and exact powerset surplus identity `∑_{x ∈ H} count(x) + (2^|H| - 1) ≥ |F_ne| + |H| * 2^(|H| - 1)`, yielding the sharp `|F| / d` covering bound (`d ≥ 2`, `∅ ∈ F`), full `1/2` Frankl theorem for `VC(F) ≤ 2` (with `∅ ∈ F`) and `VC(F) ≤ 1` (with or without `∅`), and `|F| / (d + 1)` without `∅`. -/ open scoped BigOperators Topology open Real Finset Filter namespace UnionClosedEntropy /-! ## Section 1: Binary Entropy and the Log-Exponential Transform -/ /-- Natural-log binary entropy `h(p) = -p log p - (1-p) log (1-p)` using `Real.negMulLog`. -/ noncomputable def binEntropy (p : ℝ) : ℝ := Real.negMulLog p + Real.negMulLog (1 - p) lemma binEntropy_def (p : ℝ) : binEntropy p = -p * Real.log p - (1 - p) * Real.log (1 - p) := by simp only [binEntropy, Real.negMulLog] ring @[simp] lemma binEntropy_zero : binEntropy 0 = 0 := by simp [binEntropy] @[simp] lemma binEntropy_one : binEntropy 1 = 0 := by simp [binEntropy] lemma binEntropy_symm (p : ℝ) : binEntropy (1 - p) = binEntropy p := by simp only [binEntropy, sub_sub_cancel] ring lemma binEntropy_nonneg {p : ℝ} (hp0 : 0 ≤ p) (hp1 : p ≤ 1) : 0 ≤ binEntropy p := by exact add_nonneg (Real.negMulLog_nonneg hp0 hp1) (Real.negMulLog_nonneg (sub_nonneg.mpr hp1) (sub_le_self 1 hp0)) lemma binEntropy_pos {p : ℝ} (hp0 : 0 < p) (hp1 : p < 1) : 0 < binEntropy p := by have h1 : 0 < -p * Real.log p := by have := Real.log_neg hp0 hp1 nlinarith have h2 : 0 < -(1 - p) * Real.log (1 - p) := by have h1p0 : 0 < 1 - p := sub_pos.mpr hp1 have h1p1 : 1 - p < 1 := sub_lt_self 1 hp0 have := Real.log_neg h1p0 h1p1 nlinarith rw [binEntropy_def] linarith lemma continuous_binEntropy : Continuous binEntropy := Real.continuous_negMulLog.add (Real.continuous_negMulLog.comp (continuous_const.sub continuous_id)) lemma concaveOn_binEntropy : ConcaveOn ℝ (Set.Icc (0 : ℝ) 1) binEntropy := by have h1 : ConcaveOn ℝ (Set.Icc (0 : ℝ) 1) Real.negMulLog := Real.concaveOn_negMulLog.subset (Set.Icc_subset_Ici_self) (convex_Icc 0 1) have h2 : ConcaveOn ℝ (Set.Icc (0 : ℝ) 1) (fun p : ℝ => Real.negMulLog (1 - p)) := by refine ⟨convex_Icc 0 1, fun x hx y hy a b ha hb hab => ?_⟩ have hx' : 1 - x ∈ Set.Ici (0 : ℝ) := sub_nonneg.mpr hx.2 have hy' : 1 - y ∈ Set.Ici (0 : ℝ) := sub_nonneg.mpr hy.2 have hlin : 1 - (a * x + b * y) = a * (1 - x) + b * (1 - y) := by nlinarith have hconc := Real.concaveOn_negMulLog.2 hx' hy' ha hb hab simp only [smul_eq_mul] at hconc ⊢ rw [hlin] exact hconc exact h1.add h2 /-- The log-exponential entropy transform `g(u) = e^u h(e^{-u}) = u - (e^u - 1) log(1 - e^{-u})`. -/ noncomputable def g (u : ℝ) : ℝ := if u ≤ 0 then 0 else u - (Real.exp u - 1) * Real.log (1 - Real.exp (-u)) lemma g_of_nonpos {u : ℝ} (hu : u ≤ 0) : g u = 0 := by simp [g, hu] @[simp] lemma g_zero : g 0 = 0 := g_of_nonpos le_rfl lemma g_of_pos {u : ℝ} (hu : 0 < u) : g u = u - (Real.exp u - 1) * Real.log (1 - Real.exp (-u)) := by simp [g, not_le.mpr hu] lemma g_eq_exp_mul_binEntropy {u : ℝ} (hu : 0 ≤ u) : g u = Real.exp u * binEntropy (Real.exp (-u)) := by rcases eq_or_lt_of_le hu with rfl | hu_pos · simp [g_zero] · rw [g_of_pos hu_pos, binEntropy_def, Real.log_exp] have hmul : Real.exp u * Real.exp (-u) = 1 := by rw [← Real.exp_add, add_neg_cancel, Real.exp_zero] calc u - (Real.exp u - 1) * Real.log (1 - Real.exp (-u)) = Real.exp u * (u * Real.exp (-u) - (1 - Real.exp (-u)) * Real.log (1 - Real.exp (-u))) := by have h1 : Real.exp u * (u * Real.exp (-u)) = u := by calc Real.exp u * (u * Real.exp (-u)) = u * (Real.exp u * Real.exp (-u)) := by ring _ = u := by rw [hmul, mul_one] have h2 : Real.exp u * ((1 - Real.exp (-u)) * Real.log (1 - Real.exp (-u))) = (Real.exp u - 1) * Real.log (1 - Real.exp (-u)) := by calc Real.exp u * ((1 - Real.exp (-u)) * Real.log (1 - Real.exp (-u))) = (Real.exp u - Real.exp u * Real.exp (-u)) * Real.log (1 - Real.exp (-u)) := by ring _ = (Real.exp u - 1) * Real.log (1 - Real.exp (-u)) := by rw [hmul] linarith _ = Real.exp u * (-Real.exp (-u) * (-u) - (1 - Real.exp (-u)) * Real.log (1 - Real.exp (-u))) := by ring_nf lemma binEntropy_exp_neg {u : ℝ} (hu : 0 ≤ u) : binEntropy (Real.exp (-u)) = Real.exp (-u) * g u := by rw [g_eq_exp_mul_binEntropy hu, ← mul_assoc, ← Real.exp_add, neg_add_cancel, Real.exp_zero, one_mul] lemma g_pos {u : ℝ} (hu : 0 < u) : 0 < g u := by rw [g_eq_exp_mul_binEntropy hu.le] refine mul_pos (Real.exp_pos u) (binEntropy_pos (Real.exp_pos (-u)) ?_) exact Real.exp_lt_one_iff.mpr (neg_lt_zero.mpr hu) lemma g_nonneg (u : ℝ) : 0 ≤ g u := by by_cases hu : 0 < u · exact (g_pos hu).le · rw [g_of_nonpos (not_lt.mp hu)] /-- First derivative of `g` on `(0, ∞)`: `g'(u) = -e^u * log(1 - e^{-u})`. -/ noncomputable def g' (u : ℝ) : ℝ := -Real.exp u * Real.log (1 - Real.exp (-u)) /-- Second derivative of `g` on `(0, ∞)`: `g''(u) = -(1 / (1 - e^{-u}) + e^u * log(1 - e^{-u}))`. -/ noncomputable def g'' (u : ℝ) : ℝ := -(1 / (1 - Real.exp (-u)) + Real.exp u * Real.log (1 - Real.exp (-u))) lemma one_sub_exp_neg_pos {u : ℝ} (hu : 0 < u) : 0 < 1 - Real.exp (-u) := sub_pos.mpr (Real.exp_lt_one_iff.mpr (neg_lt_zero.mpr hu)) lemma hasDerivAt_g {u : ℝ} (hu : 0 < u) : HasDerivAt g (g' u) u := by have he : 0 < 1 - Real.exp (-u) := one_sub_exp_neg_pos hu let F : ℝ → ℝ := fun t => t - (Real.exp t - 1) * Real.log (1 - Real.exp (-t)) have hF_deriv : HasDerivAt F (g' u) u := by have h1 : HasDerivAt (fun t : ℝ => t) 1 u := hasDerivAt_id u have h2 : HasDerivAt (fun t : ℝ => Real.exp t - 1) (Real.exp u) u := (Real.hasDerivAt_exp u).sub_const 1 have h3 : HasDerivAt (fun t : ℝ => 1 - Real.exp (-t)) (Real.exp (-u)) u := by have hexp : HasDerivAt (fun t : ℝ => Real.exp (-t)) (-Real.exp (-u)) u := by simpa [Function.comp_def] using (Real.hasDerivAt_exp (-u)).comp u (hasDerivAt_neg u) simpa [sub_neg_eq_add] using hexp.const_sub (1 : ℝ) have h4 : HasDerivAt (fun t : ℝ => Real.log (1 - Real.exp (-t))) (Real.exp (-u) / (1 - Real.exp (-u))) u := h3.log he.ne' have hprod := h2.mul h4 have hsub := h1.sub hprod have hderiv_eq : 1 - ((Real.exp u) * Real.log (1 - Real.exp (-u)) + (Real.exp u - 1) * (Real.exp (-u) / (1 - Real.exp (-u)))) = g' u := by have hexp_mul : Real.exp u * Real.exp (-u) = 1 := by rw [← Real.exp_add, add_neg_cancel, Real.exp_zero] have hfrac : (Real.exp u - 1) * (Real.exp (-u) / (1 - Real.exp (-u))) = 1 := by have hne : 1 - Real.exp (-u) ≠ 0 := he.ne' have hnum : (Real.exp u - 1) * Real.exp (-u) = 1 - Real.exp (-u) := by linarith [hexp_mul] rw [mul_div_assoc', hnum, div_self hne] unfold g' linarith [hfrac] exact hderiv_eq ▸ hsub refine hF_deriv.congr_of_eventuallyEq ?_ filter_upwards [eventually_gt_nhds hu] with t ht exact g_of_pos ht lemma hasDerivAt_g' {u : ℝ} (hu : 0 < u) : HasDerivAt g' (g'' u) u := by have he : 0 < 1 - Real.exp (-u) := one_sub_exp_neg_pos hu have h1 : HasDerivAt (fun t : ℝ => -Real.exp t) (-Real.exp u) u := (Real.hasDerivAt_exp u).neg have h2 : HasDerivAt (fun t : ℝ => Real.log (1 - Real.exp (-t))) (Real.exp (-u) / (1 - Real.exp (-u))) u := by have hexp : HasDerivAt (fun t : ℝ => Real.exp (-t)) (-Real.exp (-u)) u := by simpa [Function.comp_def] using (Real.hasDerivAt_exp (-u)).comp u (hasDerivAt_neg u) have hsub : HasDerivAt (fun t : ℝ => 1 - Real.exp (-t)) (Real.exp (-u)) u := by simpa [sub_neg_eq_add] using hexp.const_sub (1 : ℝ) exact hsub.log he.ne' have hmul := h1.mul h2 have hderiv_eq : -Real.exp u * Real.log (1 - Real.exp (-u)) + (-Real.exp u * (Real.exp (-u) / (1 - Real.exp (-u)))) = g'' u := by have hexp_mul : Real.exp u * Real.exp (-u) = 1 := by rw [← Real.exp_add, add_neg_cancel, Real.exp_zero] unfold g'' have hne : 1 - Real.exp (-u) ≠ 0 := he.ne' field_simp [hne] linarith [hexp_mul] exact hderiv_eq ▸ hmul lemma g'_gt_one {u : ℝ} (hu : 0 < u) : 1 < g' u := by have he : 0 < 1 - Real.exp (-u) := one_sub_exp_neg_pos hu have hlog : Real.log (1 - Real.exp (-u)) < -Real.exp (-u) := by have hlt := Real.log_lt_sub_one_of_pos he (by linarith [Real.exp_pos (-u)]) linarith have hexp_pos : 0 < Real.exp u := Real.exp_pos u have hmul : Real.exp u * Real.exp (-u) = 1 := by rw [← Real.exp_add, add_neg_cancel, Real.exp_zero] simp only [g'] nlinarith lemma g'_pos {u : ℝ} (hu : 0 < u) : 0 < g' u := zero_lt_one.trans (g'_gt_one hu) /-- Elementary convexity identity: `1 - t + t * log t > 0` for `t ∈ (0, 1)`. -/ lemma one_sub_add_mul_log_pos {t : ℝ} (ht0 : 0 < t) (ht1 : t < 1) : 0 < 1 - t + t * Real.log t := by have h := Real.self_sub_one_lt_mul_log ht0.le ht1.ne linarith lemma g''_neg {u : ℝ} (hu : 0 < u) : g'' u < 0 := by have ht0 : 0 < 1 - Real.exp (-u) := one_sub_exp_neg_pos hu have ht1 : 1 - Real.exp (-u) < 1 := sub_lt_self 1 (Real.exp_pos (-u)) have hpos := one_sub_add_mul_log_pos ht0 ht1 have hexp_mul : Real.exp u * Real.exp (-u) = 1 := by rw [← Real.exp_add, add_neg_cancel, Real.exp_zero] have h_id : 1 / (1 - Real.exp (-u)) + Real.exp u * Real.log (1 - Real.exp (-u)) = Real.exp u / (1 - Real.exp (-u)) * (1 - (1 - Real.exp (-u)) + (1 - Real.exp (-u)) * Real.log (1 - Real.exp (-u))) := by have hne : 1 - Real.exp (-u) ≠ 0 := ht0.ne' field_simp [hne] linarith [hexp_mul] rw [g'', h_id] have hfac : 0 < Real.exp u / (1 - Real.exp (-u)) := div_pos (Real.exp_pos u) ht0 linarith [mul_pos hfac hpos] lemma continuousOn_g : ContinuousOn g (Set.Ici (0 : ℝ)) := by have hcont : Continuous (fun u : ℝ => Real.exp u * binEntropy (Real.exp (-u))) := (Real.continuous_exp).mul (continuous_binEntropy.comp (Real.continuous_exp.comp continuous_neg)) refine hcont.continuousOn.congr ?_ intro u hu exact g_eq_exp_mul_binEntropy hu lemma continuous_g : Continuous g := by rw [continuous_iff_continuousAt] intro u rcases lt_trichotomy u 0 with hu | rfl | hu · have hev : g =ᶠ[nhds u] fun _ => (0 : ℝ) := by filter_upwards [eventually_lt_nhds hu] with t ht exact g_of_nonpos ht.le exact (continuousAt_const).congr hev.symm · rw [continuousAt_iff_continuous_left_right] refine ⟨?_, continuousOn_g 0 (Set.mem_Ici.mpr le_rfl)⟩ have h_le : ContinuousWithinAt g (Set.Iic 0) 0 := by rw [ContinuousWithinAt, g_zero] refine Tendsto.congr' ?_ tendsto_const_nhds filter_upwards [self_mem_nhdsWithin] with t ht exact (g_of_nonpos ht).symm exact h_le · have hcont : ContinuousAt (fun t => Real.exp t * binEntropy (Real.exp (-t))) u := ((Real.continuous_exp).mul (continuous_binEntropy.comp (Real.continuous_exp.comp continuous_neg))).continuousAt refine hcont.congr ?_ filter_upwards [eventually_gt_nhds hu] with t ht exact (g_eq_exp_mul_binEntropy ht.le).symm lemma strictConcaveOn_g : StrictConcaveOn ℝ (Set.Ici (0 : ℝ)) g := by refine strictConcaveOn_of_deriv2_neg (convex_Ici 0) continuousOn_g ?_ intro u hu rw [interior_Ici] at hu have hderiv : deriv g =ᶠ[nhds u] g' := by filter_upwards [eventually_gt_nhds hu] with t ht exact (hasDerivAt_g ht).deriv have hderiv2 : deriv^[2] g u = g'' u := by simp only [Function.iterate_succ, Function.iterate_zero, Function.id_comp, Function.comp_apply] rw [hderiv.deriv_eq] exact (hasDerivAt_g' hu).deriv rw [hderiv2] exact g''_neg hu lemma concaveOn_g : ConcaveOn ℝ (Set.Ici (0 : ℝ)) g := strictConcaveOn_g.concaveOn lemma strictMonoOn_g : StrictMonoOn g (Set.Ici (0 : ℝ)) := by refine strictMonoOn_of_deriv_pos (convex_Ici 0) continuousOn_g ?_ intro u hu rw [interior_Ici] at hu rw [(hasDerivAt_g hu).deriv] exact g'_pos hu lemma g_mul_le_of_le_one {c u : ℝ} (hc0 : 0 ≤ c) (hc1 : c ≤ 1) (hu : 0 ≤ u) : c * g u ≤ g (c * u) := by have h := concaveOn_g.2 (Set.mem_Ici.mpr (le_refl 0)) hu (sub_nonneg.mpr hc1) hc0 (by ring) simp only [smul_eq_mul, g_zero, mul_zero, zero_add] at h exact h /-- Equivalence between `k`-wise binary product-entropy inequalities on `[0,1]^k` and additive-vs-separable inequalities for `g` on `[0,∞)^k`. -/ theorem prod_entropy_iff_g {k : ℕ} (α : Fin k → ℝ) : (∀ x : Fin k → ℝ, (∀ j, 0 ≤ x j ∧ x j ≤ 1) → ∑ j, α j * (∏ l ∈ Finset.univ.erase j, x l) * binEntropy (x j) ≤ binEntropy (∏ j, x j)) ↔ (∀ u : Fin k → ℝ, (∀ j, 0 ≤ u j) → ∑ j, α j * g (u j) ≤ g (∑ j, u j)) := by constructor · intro hx u hu have hexp_le : ∀ j, 0 ≤ Real.exp (-u j) ∧ Real.exp (-u j) ≤ 1 := fun j => ⟨(Real.exp_pos _).le, Real.exp_le_one_iff.mpr (neg_nonpos.mpr (hu j))⟩ have hbase := hx (fun j => Real.exp (-u j)) hexp_le have hprod_eq : ∏ j : Fin k, Real.exp (-u j) = Real.exp (-(∑ j, u j)) := by rw [← Real.exp_sum] simp [Finset.sum_neg_distrib] have hrhs : binEntropy (∏ j, Real.exp (-u j)) = Real.exp (-(∑ j, u j)) * g (∑ j, u j) := by rw [hprod_eq, binEntropy_exp_neg (Finset.sum_nonneg fun j _ => hu j)] have hlhs : ∀ j : Fin k, (∏ l ∈ Finset.univ.erase j, Real.exp (-u l)) * binEntropy (Real.exp (-u j)) = Real.exp (-(∑ l, u l)) * g (u j) := by intro j rw [binEntropy_exp_neg (hu j)] have hmul_prod : (∏ l ∈ Finset.univ.erase j, Real.exp (-u l)) * Real.exp (-u j) = ∏ l : Fin k, Real.exp (-u l) := Finset.prod_erase_mul Finset.univ (fun l => Real.exp (-u l)) (Finset.mem_univ j) calc (∏ l ∈ Finset.univ.erase j, Real.exp (-u l)) * (Real.exp (-u j) * g (u j)) = ((∏ l ∈ Finset.univ.erase j, Real.exp (-u l)) * Real.exp (-u j)) * g (u j) := by ring _ = (∏ l : Fin k, Real.exp (-u l)) * g (u j) := by rw [hmul_prod] _ = Real.exp (-(∑ l, u l)) * g (u j) := by rw [hprod_eq] rw [hrhs] at hbase have hlhs' : ∑ j, α j * (∏ l ∈ Finset.univ.erase j, Real.exp (-u l)) * binEntropy (Real.exp (-u j)) = Real.exp (-(∑ l, u l)) * ∑ j, α j * g (u j) := by rw [Finset.mul_sum] refine Finset.sum_congr rfl fun j _ => ?_ rw [mul_assoc, hlhs j] ring rw [hlhs'] at hbase exact le_of_mul_le_mul_left hbase (Real.exp_pos _) · intro hu x hx by_cases hzero : ∃ j, x j = 0 · obtain ⟨j₀, hj₀⟩ := hzero have hprod_zero : ∏ j, x j = 0 := Finset.prod_eq_zero (Finset.mem_univ j₀) hj₀ rw [hprod_zero, binEntropy_zero] have hsum_zero : ∑ j, α j * (∏ l ∈ Finset.univ.erase j, x l) * binEntropy (x j) = 0 := by refine Finset.sum_eq_zero fun j _ => ?_ by_cases hj : j = j₀ · subst hj; simp [hj₀] · have hmem : j₀ ∈ Finset.univ.erase j := Finset.mem_erase.mpr ⟨Ne.symm hj, Finset.mem_univ _⟩ have hp : ∏ l ∈ Finset.univ.erase j, x l = 0 := Finset.prod_eq_zero hmem hj₀ simp [hp] rw [hsum_zero] · push Not at hzero have hx_pos : ∀ j, 0 < x j := fun j => lt_of_le_of_ne (hx j).1 (hzero j).symm let u : Fin k → ℝ := fun j => -Real.log (x j) have hu_nn : ∀ j, 0 ≤ u j := fun j => neg_nonneg.mpr (Real.log_nonpos (hx j).1 (hx j).2) have hexp_eq : ∀ j, Real.exp (-u j) = x j := fun j => by simp [u, Real.exp_log (hx_pos j)] have hbase := hu u hu_nn have hprod_pos : 0 < ∏ j, x j := Finset.prod_pos fun j _ => hx_pos j have hsum_eq : Real.exp (-(∑ j, u j)) = ∏ j, x j := by rw [Finset.sum_neg_distrib, neg_neg, Real.exp_sum] refine Finset.prod_congr rfl fun j _ => by simpa [u] using Real.exp_log (hx_pos j) have hmul := mul_le_mul_of_nonneg_left hbase hprod_pos.le have hrhs : (∏ j, x j) * g (∑ j, u j) = binEntropy (∏ j, x j) := by rw [← hsum_eq, binEntropy_exp_neg (Finset.sum_nonneg fun j _ => hu_nn j)] rw [hrhs, Finset.mul_sum] at hmul refine le_trans (le_of_eq ?_) hmul refine Finset.sum_congr rfl fun j _ => ?_ have hsplit : (∏ l, x l) = (∏ l ∈ Finset.univ.erase j, x l) * x j := (Finset.prod_erase_mul Finset.univ x (Finset.mem_univ j)).symm have hbin : x j * g (u j) = binEntropy (x j) := by rw [← hexp_eq j, binEntropy_exp_neg (hu_nn j)] calc α j * (∏ l ∈ Finset.univ.erase j, x l) * binEntropy (x j) = α j * (∏ l ∈ Finset.univ.erase j, x l) * (x j * g (u j)) := by rw [hbin] _ = ((∏ l ∈ Finset.univ.erase j, x l) * x j) * (α j * g (u j)) := by ring _ = (∏ l, x l) * (α j * g (u j)) := by rw [← hsplit] /-! ### Section 1B: Fenchel-Legendre Duality Criterion -/ lemma g_sub_id_lt_one {u : ℝ} (hu : 0 ≤ u) : g u - u < 1 := by rcases eq_or_lt_of_le hu with rfl | hu_pos · simp [g_zero] · rw [g_of_pos hu_pos] have ht0 : 0 < 1 - Real.exp (-u) := one_sub_exp_neg_pos hu_pos have ht1 : 1 - Real.exp (-u) < 1 := sub_lt_self 1 (Real.exp_pos (-u)) have hpos := one_sub_add_mul_log_pos ht0 ht1 have hexp_mul : Real.exp u * Real.exp (-u) = 1 := by rw [← Real.exp_add, add_neg_cancel, Real.exp_zero] have h1 : Real.exp u - 1 = (1 - Real.exp (-u)) / Real.exp (-u) := by field_simp [(Real.exp_pos (-u)).ne'] linarith [hexp_mul] have h2 : -(Real.exp u - 1) * Real.log (1 - Real.exp (-u)) < 1 := by rw [h1] have hneg : -(1 - Real.exp (-u)) * Real.log (1 - Real.exp (-u)) < Real.exp (-u) := by linarith [hpos] have hdiv : (-(1 - Real.exp (-u)) * Real.log (1 - Real.exp (-u))) / Real.exp (-u) < 1 := (div_lt_one (Real.exp_pos (-u))).mpr hneg linarith [show -((1 - Real.exp (-u)) / Real.exp (-u)) * Real.log (1 - Real.exp (-u)) = (-(1 - Real.exp (-u)) * Real.log (1 - Real.exp (-u))) / Real.exp (-u) by ring] linarith lemma strictAntiOn_g' : StrictAntiOn g' (Set.Ioi (0 : ℝ)) := by refine strictAntiOn_of_deriv_neg (convex_Ioi 0) ?_ ?_ · intro u hu exact (hasDerivAt_g' hu).continuousAt.continuousWithinAt · intro u hu rw [interior_Ioi] at hu rw [(hasDerivAt_g' hu).deriv] exact g''_neg hu lemma g_sub_g'_mul_le {u t : ℝ} (hu : 0 < u) (ht : 0 ≤ t) : g t - g' u * t ≤ g u - g' u * u := by let ψ : ℝ → ℝ := fun s => g s - g' u * s have hcont : ContinuousOn ψ (Set.Ici 0) := continuousOn_g.sub ((continuous_const.mul continuous_id).continuousOn) have hderiv : ∀ s ∈ Set.Ioi (0 : ℝ), HasDerivAt ψ (g' s - g' u) s := fun s hs => (hasDerivAt_g hs).sub (by simpa using (hasDerivAt_id s).const_mul (g' u)) rcases le_total t u with htu | hut · have hmono : MonotoneOn ψ (Set.Icc 0 u) := by refine monotoneOn_of_deriv_nonneg (convex_Icc 0 u) (hcont.mono Set.Icc_subset_Ici_self) ?_ ?_ · intro s hs rw [interior_Icc] at hs exact (hderiv s hs.1).differentiableAt.differentiableWithinAt · intro s hs rw [interior_Icc] at hs rw [(hderiv s hs.1).deriv] have hanti := (strictAntiOn_g' (hs.1) hu hs.2).le linarith exact hmono ⟨ht, htu⟩ ⟨hu.le, le_rfl⟩ htu · have hanti : AntitoneOn ψ (Set.Ici u) := by refine antitoneOn_of_deriv_nonpos (convex_Ici u) (hcont.mono (Set.Ici_subset_Ici.mpr hu.le)) ?_ ?_ · intro s hs rw [interior_Ici] at hs exact (hderiv s (hu.trans hs)).differentiableAt.differentiableWithinAt · intro s hs rw [interior_Ici] at hs rw [(hderiv s (hu.trans hs)).deriv] have hle := (strictAntiOn_g' hu (hu.trans hs) hs).le linarith exact hanti (Set.mem_Ici.mpr le_rfl) (Set.mem_Ici.mpr hut) hut /-- Fenchel-Legendre conjugate `Λ(λ) = sup_{t ≥ 0} (g(t) - λ t)` for `λ > 1`. -/ noncomputable def fenchelDual (lam : ℝ) : ℝ := sSup ((fun t : ℝ => g t - lam * t) '' Set.Ici (0 : ℝ)) lemma fenchelDual_bddAbove {lam : ℝ} (hlam : 1 < lam) : BddAbove ((fun t : ℝ => g t - lam * t) '' Set.Ici (0 : ℝ)) := by refine ⟨1, ?_⟩ rintro _ ⟨t, ht, rfl⟩ have h1 := g_sub_id_lt_one ht have h2 : (1 - lam) * t ≤ 0 := mul_nonpos_of_nonpos_of_nonneg (by linarith) ht linarith lemma sub_mul_le_fenchelDual {lam t : ℝ} (hlam : 1 < lam) (ht : 0 ≤ t) : g t - lam * t ≤ fenchelDual lam := le_csSup (fenchelDual_bddAbove hlam) ⟨t, ht, rfl⟩ lemma fenchelDual_g' {u : ℝ} (hu : 0 < u) : fenchelDual (g' u) = g u - g' u * u := by refine le_antisymm ?_ (sub_mul_le_fenchelDual (g'_gt_one hu) hu.le) refine csSup_le ⟨g u - g' u * u, ⟨u, hu.le, rfl⟩⟩ ?_ rintro _ ⟨t, ht, rfl⟩ exact g_sub_g'_mul_le hu ht /-- General Fenchel-duality criterion reducing `g (∑ u_j) ≥ ∑ α_j g (u_j)` to submultiplicativity of `Λ(λ)`. -/ theorem fenchel_criterion {k : ℕ} {α : Fin k → ℝ} (hα0 : ∀ j, 0 ≤ α j) (hα1 : ∀ j, α j ≤ 1) (hΛ : ∀ lam : ℝ, 1 < lam → ∑ j ∈ Finset.univ.filter (fun j => 0 < α j), α j * fenchelDual (lam / α j) ≤ fenchelDual lam) : ∀ u : Fin k → ℝ, (∀ j, 0 ≤ u j) → ∑ j, α j * g (u j) ≤ g (∑ j, u j) := by intro u hu let S := ∑ j, u j rcases eq_or_lt_of_le (Finset.sum_nonneg fun j _ => hu j) with hS0 | hS_pos · have hu0 : ∀ j, u j = 0 := fun j => le_antisymm (hS0 ▸ Finset.single_le_sum (fun l _ => hu l) (Finset.mem_univ j)) (hu j) simp [hu0, g_zero] · let lam := g' S have hlam : 1 < lam := g'_gt_one hS_pos have hterm : ∀ j, α j * g (u j) - lam * u j ≤ if 0 < α j then α j * fenchelDual (lam / α j) else 0 := by intro j by_cases hj : 0 < α j · rw [if_pos hj] have hlamj : 1 < lam / α j := (one_lt_div hj).mpr (lt_of_le_of_lt (hα1 j) hlam) have hle := sub_mul_le_fenchelDual hlamj (hu j) have hmul := mul_le_mul_of_nonneg_left hle hj.le have hcancel : α j * (g (u j) - (lam / α j) * u j) = α j * g (u j) - lam * u j := by field_simp [hj.ne'] linarith · rw [if_neg hj] have hαj0 : α j = 0 := le_antisymm (not_lt.mp hj) (hα0 j) rw [hαj0, zero_mul, zero_sub] exact neg_nonpos.mpr (mul_nonneg (zero_lt_one.trans hlam).le (hu j)) have hsum_le : ∑ j, (α j * g (u j) - lam * u j) ≤ ∑ j ∈ Finset.univ.filter (fun j => 0 < α j), α j * fenchelDual (lam / α j) := by calc ∑ j, (α j * g (u j) - lam * u j) ≤ ∑ j, (if 0 < α j then α j * fenchelDual (lam / α j) else 0) := Finset.sum_le_sum fun j _ => hterm j _ = ∑ j ∈ Finset.univ.filter (fun j => 0 < α j), α j * fenchelDual (lam / α j) := by rw [Finset.sum_filter] have hchain := le_trans hsum_le (hΛ lam hlam) rw [fenchelDual_g' hS_pos] at hchain have hlhs : ∑ j, (α j * g (u j) - lam * u j) = (∑ j, α j * g (u j)) - lam * S := by rw [Finset.sum_sub_distrib, ← Finset.mul_sum] linarith /-! ## Section 2: Sharp `3/2`-Power Strict Convexity and Universal `k`-Wise Entropy Theorem -/ /-- Lower polynomial approximation to `2 artanh(t) = log((1+t)/(1-t))` on `[0, 1)`. -/ noncomputable def artanhLower (t : ℝ) : ℝ := 2 * (t + t ^ 3 / 3 + t ^ 5 / 5) /-- Upper rational approximation to `2 artanh(t) = log((1+t)/(1-t))` on `[0, 1)`. -/ noncomputable def artanhUpper (t : ℝ) : ℝ := 2 * (t + t ^ 3 / (3 * (1 - t ^ 2))) lemma artanhLower_le_log {t : ℝ} (ht0 : 0 ≤ t) (ht1 : t < 1) : artanhLower t ≤ Real.log ((1 + t) / (1 - t)) := by let φ : ℝ → ℝ := fun s => Real.log (1 + s) - Real.log (1 - s) - artanhLower s have hcont : ContinuousOn φ (Set.Ico 0 1) := by intro s hs have h1 : ContinuousAt (fun x => Real.log (1 + x)) s := (Real.continuousAt_log (by linarith [hs.1])).comp (continuousAt_const.add continuousAt_id) have h2 : ContinuousAt (fun x => Real.log (1 - x)) s := (Real.continuousAt_log (by linarith [hs.2])).comp (continuousAt_const.sub continuousAt_id) have h3 : ContinuousAt artanhLower s := by unfold artanhLower fun_prop exact ((h1.sub h2).sub h3).continuousWithinAt have hderiv : ∀ s ∈ Set.Ioo (0 : ℝ) 1, HasDerivAt φ (2 * s ^ 6 / (1 - s ^ 2)) s := by intro s hs have h1 : HasDerivAt (fun x => Real.log (1 + x)) (1 / (1 + s)) s := by have ha : HasDerivAt (fun x : ℝ => 1 + x) 1 s := by simpa using (hasDerivAt_id s).const_add (1 : ℝ) simpa using ha.log (by linarith [hs.1]) have h2 : HasDerivAt (fun x => Real.log (1 - x)) (-1 / (1 - s)) s := by have hb : HasDerivAt (fun x : ℝ => 1 - x) (-1) s := by simpa using (hasDerivAt_id s).const_sub (1 : ℝ) simpa [neg_div] using hb.log (by linarith [hs.2]) have h3 : HasDerivAt artanhLower (2 * (1 + s ^ 2 + s ^ 4)) s := by unfold artanhLower have hd1 : HasDerivAt (fun x : ℝ => x) 1 s := hasDerivAt_id s have hd3 : HasDerivAt (fun x : ℝ => x ^ 3 / 3) (s ^ 2) s := by simpa using ((hasDerivAt_pow 3 s).div_const 3) have hd5 : HasDerivAt (fun x : ℝ => x ^ 5 / 5) (s ^ 4) s := by simpa using ((hasDerivAt_pow 5 s).div_const 5) exact (((hd1.add hd3).add hd5).const_mul 2).congr_deriv (by ring) refine ((h1.sub h2).sub h3).congr_deriv ?_ have hne1 : 1 + s ≠ 0 := by linarith [hs.1] have hne2 : 1 - s ≠ 0 := by linarith [hs.2] have hne3 : 1 - s ^ 2 ≠ 0 := by nlinarith [hs.1, hs.2] field_simp [hne1, hne2, hne3] ring have hmono : MonotoneOn φ (Set.Ico 0 1) := by refine monotoneOn_of_deriv_nonneg (convex_Ico 0 1) hcont ?_ ?_ · intro s hs rw [interior_Ico] at hs exact (hderiv s hs).differentiableAt.differentiableWithinAt · intro s hs rw [interior_Ico] at hs rw [(hderiv s hs).deriv] exact div_nonneg (by positivity) (by nlinarith [hs.1, hs.2]) have h0 : φ 0 ≤ φ t := hmono ⟨le_rfl, zero_lt_one⟩ ⟨ht0, ht1⟩ ht0 have hφ0 : φ 0 = 0 := by simp [φ, artanhLower] have hlog : Real.log ((1 + t) / (1 - t)) = Real.log (1 + t) - Real.log (1 - t) := Real.log_div (by linarith) (by linarith) linarith [hφ0, h0, hlog] lemma log_le_artanhUpper {t : ℝ} (ht0 : 0 ≤ t) (ht1 : t < 1) : Real.log ((1 + t) / (1 - t)) ≤ artanhUpper t := by let ψ : ℝ → ℝ := fun s => artanhUpper s - (Real.log (1 + s) - Real.log (1 - s)) have hcont : ContinuousOn ψ (Set.Ico 0 1) := by intro s hs have hne : 3 * (1 - s ^ 2) ≠ 0 := by nlinarith [hs.1, hs.2] have h1 : ContinuousAt (fun x => Real.log (1 + x)) s := (Real.continuousAt_log (by linarith [hs.1])).comp (continuousAt_const.add continuousAt_id) have h2 : ContinuousAt (fun x => Real.log (1 - x)) s := (Real.continuousAt_log (by linarith [hs.2])).comp (continuousAt_const.sub continuousAt_id) have h3 : ContinuousAt artanhUpper s := by unfold artanhUpper refine ContinuousAt.const_mul ?_ 2 exact continuousAt_id.add (ContinuousAt.div (by fun_prop) (by fun_prop) hne) exact (h3.sub (h1.sub h2)).continuousWithinAt have hderiv : ∀ s ∈ Set.Ioo (0 : ℝ) 1, HasDerivAt ψ (4 * s ^ 4 / (3 * (1 - s ^ 2) ^ 2)) s := by intro s hs have h1 : HasDerivAt (fun x => Real.log (1 + x)) (1 / (1 + s)) s := by have ha : HasDerivAt (fun x : ℝ => 1 + x) 1 s := by simpa using (hasDerivAt_id s).const_add (1 : ℝ) simpa using ha.log (by linarith [hs.1]) have h2 : HasDerivAt (fun x => Real.log (1 - x)) (-1 / (1 - s)) s := by have hb : HasDerivAt (fun x : ℝ => 1 - x) (-1) s := by simpa using (hasDerivAt_id s).const_sub (1 : ℝ) simpa [neg_div] using hb.log (by linarith [hs.2]) have h3 : HasDerivAt artanhUpper (2 + 2 * (3 * s ^ 2 - s ^ 4) / (3 * (1 - s ^ 2) ^ 2)) s := by have hne_d : 3 * (1 - s ^ 2) ≠ 0 := by nlinarith [hs.1, hs.2] have hden : HasDerivAt (fun x : ℝ => 3 * (1 - x ^ 2)) (-6 * s) s := by have hp : HasDerivAt (fun x : ℝ => 1 - x ^ 2) (-2 * s) s := by simpa using ((hasDerivAt_pow 2 s).const_sub (1 : ℝ)) exact (hp.const_mul 3).congr_deriv (by ring) have hquot : HasDerivAt (fun x : ℝ => x ^ 3 / (3 * (1 - x ^ 2))) ((3 * s ^ 2 * (3 * (1 - s ^ 2)) - s ^ 3 * (-6 * s)) / (3 * (1 - s ^ 2)) ^ 2) s := (hasDerivAt_pow 3 s).div hden hne_d unfold artanhUpper refine (((hasDerivAt_id s).add hquot).const_mul 2).congr_deriv ?_ have hne1 : 1 - s ^ 2 ≠ 0 := by nlinarith [hs.1, hs.2] field_simp [hne1] ring refine (h3.sub (h1.sub h2)).congr_deriv ?_ have hne1 : 1 + s ≠ 0 := by linarith [hs.1] have hne2 : 1 - s ≠ 0 := by linarith [hs.2] have hne3 : 1 - s ^ 2 ≠ 0 := by nlinarith [hs.1, hs.2] field_simp [hne1, hne2, hne3] ring have hmono : MonotoneOn ψ (Set.Ico 0 1) := by refine monotoneOn_of_deriv_nonneg (convex_Ico 0 1) hcont ?_ ?_ · intro s hs rw [interior_Ico] at hs exact (hderiv s hs).differentiableAt.differentiableWithinAt · intro s hs rw [interior_Ico] at hs rw [(hderiv s hs).deriv] exact div_nonneg (by positivity) (by positivity) have h0 : ψ 0 ≤ ψ t := hmono ⟨le_rfl, zero_lt_one⟩ ⟨ht0, ht1⟩ ht0 have hψ0 : ψ 0 = 0 := by simp [ψ, artanhUpper] have hlog : Real.log ((1 + t) / (1 - t)) = Real.log (1 + t) - Real.log (1 - t) := Real.log_div (by linarith) (by linarith) linarith [hψ0, h0, hlog] private noncomputable def Lnum (s : ℝ) : ℝ := 2 * (15 * s * (2 + s) ^ 4 + 5 * s ^ 3 * (2 + s) ^ 2 + 3 * s ^ 5) private noncomputable def Llo (s : ℝ) : ℝ := Lnum s / (15 * (2 + s) ^ 5) private noncomputable def Mnum (s : ℝ) : ℝ := 1 + 12 * s + 12 * s ^ 2 private noncomputable def Mhi (s : ℝ) : ℝ := Mnum s / (6 * s * (1 + s) * (1 + 2 * s)) lemma Llo_le_neg_log_one_sub {x : ℝ} (hx0 : 0 < x) (hx1 : x < 1) : Llo (x / (1 - x)) ≤ -Real.log (1 - x) := by let s := x / (1 - x) have hs : 0 < s := div_pos hx0 (sub_pos.mpr hx1) let y := s / (2 + s) have hy0 : 0 ≤ y := (div_pos hs (by linarith)).le have hy1 : y < 1 := (div_lt_one (by linarith)).mpr (by linarith) have hbound := artanhLower_le_log hy0 hy1 have hL_eq : artanhLower y = Llo s := by unfold artanhLower Llo Lnum y have hne : 2 + s ≠ 0 := by linarith field_simp [hne] ring have hlog_eq : Real.log ((1 + y) / (1 - y)) = -Real.log (1 - x) := by have h1mx : 1 - x ≠ 0 := (sub_pos.mpr hx1).ne' have h2mx : 2 - x ≠ 0 := by linarith have h1my : 1 - y ≠ 0 := by linarith have hy_eq : y = x / (2 - x) := by have h2ps : 2 + s ≠ 0 := by linarith simp only [y] rw [div_eq_div_iff h2ps h2mx] simp only [s] field_simp [h1mx] ring have hratio : (1 + y) / (1 - y) = (1 - x)⁻¹ := by rw [div_eq_iff h1my, hy_eq] field_simp [h1mx, h2mx] ring rw [hratio, Real.log_inv] linarith lemma neg_log_le_Mhi {x : ℝ} (hx0 : 0 < x) (hx1 : x < 1) : -Real.log x ≤ Mhi (x / (1 - x)) := by let s := x / (1 - x) have hs : 0 < s := div_pos hx0 (sub_pos.mpr hx1) let z := 1 / (1 + 2 * s) have hz0 : 0 ≤ z := (div_pos one_pos (by linarith)).le have hz1 : z < 1 := (div_lt_one (by linarith)).mpr (by linarith) have hbound := log_le_artanhUpper hz0 hz1 have hM_eq : artanhUpper z = Mhi s := by have hne1 : 1 + 2 * s ≠ 0 := by linarith have hne3 : 1 + s ≠ 0 := by linarith have hz_den : 1 - z ^ 2 = 4 * s * (1 + s) / (1 + 2 * s) ^ 2 := by simp only [z] field_simp [hne1] ring unfold artanhUpper Mhi Mnum rw [hz_den] simp only [z] field_simp [hne1, hne3, hs.ne'] ring have hlog_eq : Real.log ((1 + z) / (1 - z)) = -Real.log x := by have h1mx : 1 - x ≠ 0 := (sub_pos.mpr hx1).ne' have h1px : 1 + x ≠ 0 := by linarith have hz_eq : z = (1 - x) / (1 + x) := by have h12s : 1 + 2 * s ≠ 0 := by linarith simp only [z] rw [div_eq_div_iff h12s h1px] simp only [s] field_simp [h1mx] ring have hratio : (1 + z) / (1 - z) = x⁻¹ := by have h1mz : 1 - z ≠ 0 := by linarith rw [div_eq_iff h1mz, hz_eq] field_simp [h1px, hx0.ne'] ring rw [hratio, Real.log_inv] linarith private noncomputable def certPoly (s : ℝ) : ℝ := 1152000 + 5913600 * s + 12806400 * s ^ 2 + 15183360 * s ^ 3 + 10573440 * s ^ 4 + 4298400 * s ^ 5 + 1091280 * s ^ 6 + 431280 * s ^ 7 + 319188 * s ^ 8 + 148470 * s ^ 9 + 35304 * s ^ 10 + 3432 * s ^ 11 /-- Sharp second-order log-concavity ratio: `2 g(u) (-g''(u)) < (g'(u))²` for all `u > 0`. Equivalently `(g(u))^{3/2}` is strictly convex on `[0, ∞)`. -/ theorem two_mul_g_mul_neg_g''_lt_sq_g' {u : ℝ} (hu : 0 < u) : 2 * g u * (-g'' u) < (g' u) ^ 2 := by let x := Real.exp (-u) have hx0 : 0 < x := Real.exp_pos (-u) have hx1 : x < 1 := Real.exp_lt_one_iff.mpr (neg_lt_zero.mpr hu) have h1mx : 0 < 1 - x := sub_pos.mpr hx1 let L := -Real.log (1 - x) let M := -Real.log x have hM_eq : M = u := by simp [M, x, Real.log_exp] have hL_pos : 0 < L := neg_pos.mpr (Real.log_neg h1mx (sub_lt_self 1 hx0)) have hM_pos : 0 < M := hM_eq ▸ hu have hexp_inv : Real.exp u = 1 / x := by rw [one_div, ← Real.exp_neg, neg_neg] have hg_eq : g u = M + (1 - x) / x * L := by rw [g_of_pos hu, hM_eq, hexp_inv] have hx_ne : x ≠ 0 := hx0.ne' simp only [L] field_simp [hx_ne] ring have hgp_eq : g' u = L / x := by rw [g', hexp_inv] simp only [L] ring have hgpp_eq : g'' u = L / x - 1 / (1 - x) := by rw [g'', hexp_inv] simp only [L] ring let Q : ℝ → ℝ → ℝ := fun l m => (3 - 2 * x) / x ^ 2 * l ^ 2 + 2 * (m - 1) / x * l - 2 * m / (1 - x) have hQ_id : (g' u) ^ 2 + 2 * g u * g'' u = Q L M := by rw [hgp_eq, hg_eq, hgpp_eq] simp only [Q] field_simp [hx0.ne', h1mx.ne'] ring let s := x / (1 - x) have hs : 0 < s := div_pos hx0 h1mx have hL_lo : Llo s ≤ L := Llo_le_neg_log_one_sub hx0 hx1 have hM_hi : M ≤ Mhi s := neg_log_le_Mhi hx0 hx1 have hgpp_neg : g'' u < 0 := g''_neg hu have hstep1 : Q L (Mhi s) ≤ Q L M := by have hdiff : Q L M - Q L (Mhi s) = 2 * g'' u * (M - Mhi s) := by simp only [Q, hgpp_eq] field_simp [hx0.ne', h1mx.ne'] ring have hprod : 0 ≤ 2 * g'' u * (M - Mhi s) := mul_nonneg_of_nonpos_of_nonpos (by linarith) (sub_nonpos.mpr hM_hi) linarith have hLlo_lb : 2 * x / (2 - x) ≤ Llo s := by have hy0 : 0 < s / (2 + s) := div_pos hs (by linarith) have h2y : 2 * (s / (2 + s)) = 2 * x / (2 - x) := by simp only [s] field_simp [h1mx.ne', (by linarith : 2 - x ≠ 0)] ring have hlo_y : 2 * (s / (2 + s)) ≤ Llo s := by have h_eq : Llo s = 2 * ((s / (2 + s)) + (s / (2 + s)) ^ 3 / 3 + (s / (2 + s)) ^ 5 / 5) := by unfold Llo Lnum have hne : 2 + s ≠ 0 := by linarith field_simp [hne] ring rw [h_eq] nlinarith [pow_pos hy0 3, pow_pos hy0 5] linarith have hMhi_pos : 0 ≤ Mhi s := le_trans hM_pos.le hM_hi have hstep2 : Q (Llo s) (Mhi s) ≤ Q L (Mhi s) := by have hdiff : Q L (Mhi s) - Q (Llo s) (Mhi s) = (L - Llo s) * ((3 - 2 * x) / x ^ 2 * (L + Llo s) + 2 * (Mhi s - 1) / x) := by simp only [Q] ring have hsum_L : 4 * x / (2 - x) ≤ L + Llo s := by have h1 : 2 * x / (2 - x) ≤ L := le_trans hLlo_lb hL_lo have h2 : 4 * x / (2 - x) = 2 * x / (2 - x) + 2 * x / (2 - x) := by ring linarith have h_pos_fac : 0 < (3 - 2 * x) / x ^ 2 * (L + Llo s) + 2 * (Mhi s - 1) / x := by have h3m2x : 0 < 3 - 2 * x := by linarith have h2mx : 0 < 2 - x := by linarith have h1 : (3 - 2 * x) / x ^ 2 * (4 * x / (2 - x)) ≤ (3 - 2 * x) / x ^ 2 * (L + Llo s) := mul_le_mul_of_nonneg_left hsum_L (div_nonneg h3m2x.le (sq_nonneg x)) have h2 : -2 / x ≤ 2 * (Mhi s - 1) / x := by rw [div_le_div_iff_of_pos_right hx0] linarith have h3 : 2 * (4 - 3 * x) / (x * (2 - x)) = (3 - 2 * x) / x ^ 2 * (4 * x / (2 - x)) + (-2 / x) := by field_simp [hx0.ne', h2mx.ne'] ring have h4 : 0 < 2 * (4 - 3 * x) / (x * (2 - x)) := by refine div_pos (by linarith) (mul_pos hx0 h2mx) linarith have hprod : 0 ≤ (L - Llo s) * ((3 - 2 * x) / x ^ 2 * (L + Llo s) + 2 * (Mhi s - 1) / x) := mul_nonneg (sub_nonneg.mpr hL_lo) h_pos_fac.le linarith have hQ_cert : Q (Llo s) (Mhi s) = (s ^ 3 * certPoly s) / (1350 * s ^ 3 * (1 + 2 * s) * (2 + s) ^ 10) := by have hx_s : x = s / (1 + s) := by simp only [s] field_simp [h1mx.ne', (by linarith : 1 + s ≠ 0)] ring have hne1 : 1 + s ≠ 0 := by linarith have hne2 : 2 + s ≠ 0 := by linarith have hne3 : 1 + 2 * s ≠ 0 := by linarith simp only [Q] rw [hx_s] unfold Llo Lnum Mhi Mnum certPoly field_simp [hs.ne', hne1, hne2, hne3] ring have hcert_pos : 0 < Q (Llo s) (Mhi s) := by rw [hQ_cert] have hp : 0 < certPoly s := by unfold certPoly positivity exact div_pos (mul_pos (pow_pos hs 3) hp) (by positivity) linarith [hQ_id, hstep1, hstep2, hcert_pos] /-- `3/2`-power transform `g32(u) = g(u)^(3/2)`. -/ noncomputable def g32 (u : ℝ) : ℝ := (g u) ^ ((3 : ℝ) / 2) lemma g32_zero : g32 0 = 0 := by simp [g32, g_zero] lemma g32_of_nonpos {u : ℝ} (hu : u ≤ 0) : g32 u = 0 := by simp [g32, g_of_nonpos hu] lemma g32_nonneg (u : ℝ) : 0 ≤ g32 u := Real.rpow_nonneg (g_nonneg u) _ lemma continuousOn_g32 : ContinuousOn g32 (Set.Ici (0 : ℝ)) := by unfold g32 exact ContinuousOn.rpow_const continuousOn_g (fun _ _ => Or.inr (by norm_num)) lemma hasDerivAt_g32 {u : ℝ} (hu : 0 < u) : HasDerivAt g32 ((3 / 2 : ℝ) * (g u) ^ ((1 : ℝ) / 2) * g' u) u := by have hg := (hasDerivAt_g hu).rpow_const (p := (3 : ℝ) / 2) (Or.inl (g_pos hu).ne') unfold g32 refine hg.congr_deriv ?_ have hexp : (3 : ℝ) / 2 - 1 = 1 / 2 := by norm_num rw [hexp] ring noncomputable def g32' (u : ℝ) : ℝ := (3 / 2 : ℝ) * (g u) ^ ((1 : ℝ) / 2) * g' u noncomputable def g32'' (u : ℝ) : ℝ := (3 / 4 : ℝ) * (g u) ^ (-(1 : ℝ) / 2) * ((g' u) ^ 2 + 2 * g u * g'' u) lemma hasDerivAt_g32' {u : ℝ} (hu : 0 < u) : HasDerivAt g32' (g32'' u) u := by have hgp_pos : 0 < g u := g_pos hu have h1 : HasDerivAt (fun t : ℝ => (g t) ^ ((1 : ℝ) / 2)) (g' u * ((1 : ℝ) / 2) * (g u) ^ (-(1 : ℝ) / 2)) u := by refine ((hasDerivAt_g hu).rpow_const (p := (1 : ℝ) / 2) (Or.inl hgp_pos.ne')).congr_deriv ?_ norm_num have h2 : HasDerivAt g' (g'' u) u := hasDerivAt_g' hu have hmul : HasDerivAt g32' ((3 : ℝ) / 2 * (g' u * ((1 : ℝ) / 2) * (g u) ^ (-(1 : ℝ) / 2)) * g' u + (3 : ℝ) / 2 * (g u) ^ ((1 : ℝ) / 2) * g'' u) u := by unfold g32' exact (h1.const_mul ((3 : ℝ) / 2)).mul h2 have hpow_half : (g u) ^ ((1 : ℝ) / 2) = (g u) ^ (-(1 : ℝ) / 2) * g u := by calc (g u) ^ ((1 : ℝ) / 2) = (g u) ^ ((-(1 : ℝ) / 2) + 1) := by ring_nf _ = (g u) ^ (-(1 : ℝ) / 2) * (g u) ^ (1 : ℝ) := Real.rpow_add hgp_pos _ _ _ = (g u) ^ (-(1 : ℝ) / 2) * g u := by rw [Real.rpow_one] refine hmul.congr_deriv ?_ unfold g32'' rw [hpow_half] ring lemma g32''_pos {u : ℝ} (hu : 0 < u) : 0 < g32'' u := by have h1 : 0 < (g u) ^ (-(1 : ℝ) / 2) := Real.rpow_pos_of_pos (g_pos hu) _ have h2 : 0 < (g' u) ^ 2 + 2 * g u * g'' u := by linarith [two_mul_g_mul_neg_g''_lt_sq_g' hu] unfold g32'' exact mul_pos (mul_pos (by norm_num) h1) h2 theorem strictConvexOn_g32 : StrictConvexOn ℝ (Set.Ici (0 : ℝ)) g32 := by refine strictConvexOn_of_deriv2_pos (convex_Ici 0) continuousOn_g32 ?_ intro u hu rw [interior_Ici] at hu have hderiv : deriv g32 =ᶠ[nhds u] g32' := by filter_upwards [eventually_gt_nhds hu] with t ht exact (hasDerivAt_g32 ht).deriv have hderiv2 : deriv^[2] g32 u = g32'' u := by simp only [Function.iterate_succ, Function.iterate_zero, Function.id_comp, Function.comp_apply] rw [hderiv.deriv_eq] exact (hasDerivAt_g32' hu).deriv rw [hderiv2] exact g32''_pos hu lemma g32_mul_le_of_le_one {c u : ℝ} (hc0 : 0 ≤ c) (hc1 : c ≤ 1) (hu : 0 ≤ u) : g32 (c * u) ≤ c * g32 u := by have h := strictConvexOn_g32.convexOn.2 (Set.mem_Ici.mpr (le_refl 0)) hu (sub_nonneg.mpr hc1) hc0 (by ring) simp only [smul_eq_mul, g32_zero, mul_zero, zero_add] at h exact h lemma g32_mul_lt_of_lt_one {c u : ℝ} (hc0 : 0 < c) (hc1 : c < 1) (hu : 0 < u) : g32 (c * u) < c * g32 u := by have h := strictConvexOn_g32.2 (Set.mem_Ici.mpr (le_refl 0)) hu.le hu.ne (sub_pos.mpr hc1) hc0 (by ring) simp only [smul_eq_mul, g32_zero, mul_zero, zero_add] at h exact h /-- Universal `3/2`-power superadditivity of `g` for arbitrary `k : ℕ`: `∑ j, (g (u j))^(3/2) ≤ (g (∑ j, u j))^(3/2)`. -/ theorem g32_superadd_finset {k : ℕ} {u : Fin k → ℝ} (hu : ∀ j, 0 ≤ u j) : ∑ j, g32 (u j) ≤ g32 (∑ j, u j) := by let S := ∑ j, u j rcases eq_or_lt_of_le (Finset.sum_nonneg fun j _ => hu j) with hS0 | hS_pos · have hu0 : ∀ j, u j = 0 := fun j => le_antisymm (hS0 ▸ Finset.single_le_sum (fun l _ => hu l) (Finset.mem_univ j)) (hu j) simp [hu0, g32_zero] · have hterm : ∀ j, g32 (u j) ≤ (u j / S) * g32 S := fun j => by have hc0 : 0 ≤ u j / S := div_nonneg (hu j) hS_pos.le have hc1 : u j / S ≤ 1 := (div_le_one hS_pos).mpr (Finset.single_le_sum (fun l _ => hu l) (Finset.mem_univ j)) have hmul := g32_mul_le_of_le_one hc0 hc1 hS_pos.le rwa [div_mul_cancel₀ (u j) hS_pos.ne'] at hmul calc ∑ j, g32 (u j) ≤ ∑ j, (u j / S) * g32 S := Finset.sum_le_sum fun j _ => hterm j _ = (∑ j, u j / S) * g32 S := by rw [← Finset.sum_mul] _ = (S / S) * g32 S := by rw [← Finset.sum_div] _ = g32 S := by rw [div_self hS_pos.ne', one_mul] /-- Strict superadditivity when at least two terms `u j₁, u j₂ > 0`. -/ theorem g32_strict_superadd_finset {k : ℕ} {u : Fin k → ℝ} (hu : ∀ j, 0 ≤ u j) {j₁ j₂ : Fin k} (hj : j₁ ≠ j₂) (hu1 : 0 < u j₁) (hu2 : 0 < u j₂) : ∑ j, g32 (u j) < g32 (∑ j, u j) := by let S := ∑ j, u j have hS_pos : 0 < S := lt_of_lt_of_le (add_pos hu1 hu2) (by have hmem : {j₁, j₂} ⊆ (Finset.univ : Finset (Fin k)) := Finset.subset_univ _ have hsum_pair : u j₁ + u j₂ = ∑ j ∈ ({j₁, j₂} : Finset (Fin k)), u j := by rw [Finset.sum_pair hj] rw [hsum_pair] exact Finset.sum_le_sum_of_subset_of_nonneg hmem (fun j _ _ => hu j)) have hlt1 : g32 (u j₁) < (u j₁ / S) * g32 S := by have hc0 : 0 < u j₁ / S := div_pos hu1 hS_pos have hc1 : u j₁ / S < 1 := (div_lt_one hS_pos).mpr (by have hsub : u j₁ + u j₂ ≤ S := by have hmem : {j₁, j₂} ⊆ (Finset.univ : Finset (Fin k)) := Finset.subset_univ _ have hsum_pair : u j₁ + u j₂ = ∑ j ∈ ({j₁, j₂} : Finset (Fin k)), u j := by rw [Finset.sum_pair hj] rw [hsum_pair] exact Finset.sum_le_sum_of_subset_of_nonneg hmem (fun j _ _ => hu j) linarith) have hmul := g32_mul_lt_of_lt_one hc0 hc1 hS_pos rwa [div_mul_cancel₀ (u j₁) hS_pos.ne'] at hmul have hle_all : ∀ j, g32 (u j) ≤ (u j / S) * g32 S := fun j => by have hc0 : 0 ≤ u j / S := div_nonneg (hu j) hS_pos.le have hc1 : u j / S ≤ 1 := (div_le_one hS_pos).mpr (Finset.single_le_sum (fun l _ => hu l) (Finset.mem_univ j)) have hmul := g32_mul_le_of_le_one hc0 hc1 hS_pos.le rwa [div_mul_cancel₀ (u j) hS_pos.ne'] at hmul have hsum_lt : ∑ j, g32 (u j) < ∑ j, (u j / S) * g32 S := Finset.sum_lt_sum (fun j _ => hle_all j) ⟨j₁, Finset.mem_univ _, hlt1⟩ have hrhs : ∑ j, (u j / S) * g32 S = g32 S := by rw [← Finset.sum_mul, ← Finset.sum_div, div_self hS_pos.ne', one_mul] linarith theorem g_rpow_three_halves_superadd_finset {k : ℕ} {u : Fin k → ℝ} (hu : ∀ j, 0 ≤ u j) : (∑ j, (g (u j)) ^ ((3 : ℝ) / 2)) ^ ((2 : ℝ) / 3) ≤ g (∑ j, u j) := by have h32 := g32_superadd_finset hu have hlhs_nn : 0 ≤ ∑ j, (g (u j)) ^ ((3 : ℝ) / 2) := Finset.sum_nonneg fun j _ => g32_nonneg (u j) have hS_nn : 0 ≤ g (∑ j, u j) := g_nonneg _ calc (∑ j, (g (u j)) ^ ((3 : ℝ) / 2)) ^ ((2 : ℝ) / 3) ≤ ((g (∑ j, u j)) ^ ((3 : ℝ) / 2)) ^ ((2 : ℝ) / 3) := Real.rpow_le_rpow hlhs_nn h32 (by norm_num) _ = g (∑ j, u j) := by rw [← Real.rpow_mul hS_nn] norm_num /-- **Theorem (Universal `k`-Wise `ℓ_{3/2}` Superadditive Product-Entropy Inequality)**: For every `k : ℕ` and `x : Fin k → [0, 1]`, `(∑ j, ((∏_{l ≠ j} x_l) * h(x_j))^(3/2))^(2/3) ≤ h(∏ x_j)`. -/ theorem binEntropy_prod_superadditive_three_halves {k : ℕ} {x : Fin k → ℝ} (hx : ∀ j, 0 ≤ x j ∧ x j ≤ 1) : (∑ j, ((∏ l ∈ Finset.univ.erase j, x l) * binEntropy (x j)) ^ ((3 : ℝ) / 2)) ^ ((2 : ℝ) / 3) ≤ binEntropy (∏ j, x j) := by by_cases hzero : ∃ j, x j = 0 · obtain ⟨j₀, hj₀⟩ := hzero have hprod0 : ∏ j, x j = 0 := Finset.prod_eq_zero (Finset.mem_univ j₀) hj₀ rw [hprod0, binEntropy_zero] have hterm0 : ∀ j : Fin k, (∏ l ∈ Finset.univ.erase j, x l) * binEntropy (x j) = 0 := fun j => by by_cases hj : j = j₀ · subst hj; simp [hj₀] · have hmem : j₀ ∈ Finset.univ.erase j := Finset.mem_erase.mpr ⟨Ne.symm hj, Finset.mem_univ _⟩ simp [Finset.prod_eq_zero hmem hj₀] simp [hterm0, Real.zero_rpow (by norm_num : (3 : ℝ) / 2 ≠ 0), Real.zero_rpow (by norm_num : (2 : ℝ) / 3 ≠ 0)] · push Not at hzero have hx_pos : ∀ j, 0 < x j := fun j => lt_of_le_of_ne (hx j).1 (hzero j).symm let u : Fin k → ℝ := fun j => -Real.log (x j) have hu_nn : ∀ j, 0 ≤ u j := fun j => neg_nonneg.mpr (Real.log_nonpos (hx j).1 (hx j).2) let P : ℝ := ∏ j, x j have hP_pos : 0 < P := Finset.prod_pos fun j _ => hx_pos j have hsum_eq : Real.exp (-(∑ j, u j)) = P := by rw [Finset.sum_neg_distrib, neg_neg, Real.exp_sum] refine Finset.prod_congr rfl fun j _ => by simp [Real.exp_log (hx_pos j)] have hterm_eq : ∀ j, (∏ l ∈ Finset.univ.erase j, x l) * binEntropy (x j) = P * g (u j) := by intro j have hx_eq : Real.exp (-u j) = x j := by simp [u, Real.exp_log (hx_pos j)] have hbin : binEntropy (x j) = x j * g (u j) := by rw [← hx_eq, binEntropy_exp_neg (hu_nn j)] have hsplit : P = (∏ l ∈ Finset.univ.erase j, x l) * x j := (Finset.prod_erase_mul Finset.univ x (Finset.mem_univ j)).symm rw [hbin, ← mul_assoc, ← hsplit] have hrhs : binEntropy P = P * g (∑ j, u j) := by rw [← hsum_eq, binEntropy_exp_neg (Finset.sum_nonneg fun j _ => hu_nn j)] rw [hrhs] have hlhs_eq : ∑ j, ((∏ l ∈ Finset.univ.erase j, x l) * binEntropy (x j)) ^ ((3 : ℝ) / 2) = P ^ ((3 : ℝ) / 2) * ∑ j, (g (u j)) ^ ((3 : ℝ) / 2) := by rw [Finset.mul_sum] refine Finset.sum_congr rfl fun j _ => ?_ rw [hterm_eq j, Real.mul_rpow hP_pos.le (g_nonneg _)] rw [hlhs_eq, Real.mul_rpow (Real.rpow_nonneg hP_pos.le _) (Finset.sum_nonneg fun j _ => Real.rpow_nonneg (g_nonneg _) _)] have hP_cancel : (P ^ ((3 : ℝ) / 2)) ^ ((2 : ℝ) / 3) = P := by rw [← Real.rpow_mul hP_pos.le] norm_num rw [hP_cancel] exact mul_le_mul_of_nonneg_left (g_rpow_three_halves_superadd_finset hu_nn) hP_pos.le /-- **Theorem (Universal `ℓ_3` Weighted Linear Entropy Family)**: Whenever `α_j ≥ 0` satisfies `∑ j, (α_j)^3 ≤ 1`, for all `x ∈ [0,1]^k`, `∑ j, α_j * (∏_{l ≠ j} x_l) * h(x_j) ≤ h(∏ x_j)`. -/ theorem binEntropy_prod_holder_asymmetric {k : ℕ} {α : Fin k → ℝ} (hα0 : ∀ j, 0 ≤ α j) (hα3 : ∑ j, (α j) ^ 3 ≤ 1) {x : Fin k → ℝ} (hx : ∀ j, 0 ≤ x j ∧ x j ≤ 1) : ∑ j, α j * (∏ l ∈ Finset.univ.erase j, x l) * binEntropy (x j) ≤ binEntropy (∏ j, x j) := by let b : Fin k → ℝ := fun j => (∏ l ∈ Finset.univ.erase j, x l) * binEntropy (x j) have hb_nn : ∀ j, 0 ≤ b j := fun j => mul_nonneg (Finset.prod_nonneg fun l _ => (hx l).1) (binEntropy_nonneg (hx j).1 (hx j).2) have hpq : Real.HolderConjugate ((3 : ℝ) / 2) 3 := Real.holderConjugate_iff.mpr ⟨by norm_num, by norm_num⟩ have hholder := Real.inner_le_Lp_mul_Lq_of_nonneg (Finset.univ : Finset (Fin k)) (f := b) (g := α) hpq (fun j _ => hb_nn j) (fun j _ => hα0 j) have hsum_eq : ∑ j, α j * (∏ l ∈ Finset.univ.erase j, x l) * binEntropy (x j) = ∑ j, b j * α j := by refine Finset.sum_congr rfl fun j _ => ?_ simp only [b] ring rw [hsum_eq] have hα_rpow : (∑ j, α j ^ (3 : ℝ)) ^ (1 / (3 : ℝ)) ≤ 1 := by have hnorm3 : ∀ j, α j ^ (3 : ℝ) = (α j) ^ 3 := fun j => by simp simp_rw [hnorm3] exact Real.rpow_le_one (Finset.sum_nonneg fun j _ => pow_nonneg (hα0 j) 3) hα3 (by norm_num) have hb_bound : (∑ j, b j ^ ((3 : ℝ) / 2)) ^ (1 / ((3 : ℝ) / 2)) ≤ binEntropy (∏ j, x j) := by have hexp : (1 : ℝ) / ((3 : ℝ) / 2) = 2 / 3 := by norm_num rw [hexp] exact binEntropy_prod_superadditive_three_halves hx have hnonneg_b : 0 ≤ (∑ j, b j ^ ((3 : ℝ) / 2)) ^ (1 / ((3 : ℝ) / 2)) := Real.rpow_nonneg (Finset.sum_nonneg fun j _ => Real.rpow_nonneg (hb_nn j) _) _ have hmul : (∑ j, b j ^ ((3 : ℝ) / 2)) ^ (1 / ((3 : ℝ) / 2)) * (∑ j, α j ^ (3 : ℝ)) ^ (1 / (3 : ℝ)) ≤ binEntropy (∏ j, x j) * 1 := mul_le_mul hb_bound hα_rpow (Real.rpow_nonneg (Finset.sum_nonneg fun j _ => Real.rpow_nonneg (hα0 j) _) _) (binEntropy_nonneg (Finset.prod_nonneg fun j _ => (hx j).1) (Finset.prod_le_one (fun j _ => (hx j).1) (fun j _ => (hx j).2))) linarith [hholder, hmul] /-! ## Section 2B: Sharp Star-Shapedness Exponent `1 / log 2` (`log₂ e`) and Universal `k`-Wise `ℓ_{log₂ e}` Superadditivity While `g(u)^(3/2)` is strictly convex (Section 2A), superadditivity of `g(u)^p` requires only star-shapedness (`u ↦ g(u)^p / u` nondecreasing). Remarkably, `g(u) / (u g'(u))` equals the symmetric sum `fLog(e^{-u}) + fLog(1 - e^{-u})` where `fLog(x) = x / (-log(1 - x))`. A 3-line second-derivative proof shows `fLog` is strictly concave on `(0, 1)`, yielding: 1. Exact global maximum `g(u) / (u g'(u)) ≤ 1 / log 2` with unique equality at `u = log 2`. 2. Strict monotonicity of `u ↦ g(u)^(1 / log 2) / u` on `(0, ∞)` and **exact sharpness**: for every `p < 1 / log 2`, `u ↦ g(u)^p / u` is NOT monotone on `(0, ∞)`. 3. Strict separation from convexity: `g(u)^(1 / log 2)` is **not convex** on `[0, ∞)` (its second derivative is strictly negative at `u = log(3/2)`). 4. Universal `k`-wise `ℓ_{1 / log 2}` superadditivity and `ℓ_{1 / (1 - log 2)}` Hölder-dual asymmetric entropy family (`1 / (1 - log 2) ≈ 3.25889 > 3`), recovering `h(x^k) ≥ k^{log 2} x^{k-1} h(x)` for all `k ≥ 1`. -/ /-- Exact `artanh` lower bound on `log 2` and `log 3`. -/ lemma log_two_gt_842_div_1215 : (842 : ℝ) / 1215 ≤ Real.log 2 := by have h := artanhLower_le_log (t := (1 : ℝ) / 3) (by norm_num) (by norm_num) have hr : (1 + (1 : ℝ) / 3) / (1 - (1 : ℝ) / 3) = 2 := by norm_num have hl : artanhLower ((1 : ℝ) / 3) = 842 / 1215 := by unfold artanhLower; norm_num linarith [hr ▸ h, hl] lemma log_two_le_25_div_36 : Real.log 2 ≤ (25 : ℝ) / 36 := by have h := log_le_artanhUpper (t := (1 : ℝ) / 3) (by norm_num) (by norm_num) have hr : (1 + (1 : ℝ) / 3) / (1 - (1 : ℝ) / 3) = 2 := by norm_num have hu : artanhUpper ((1 : ℝ) / 3) = 25 / 36 := by unfold artanhUpper; norm_num linarith [hr ▸ h, hu] lemma log_three_ge_263_div_240 : (263 : ℝ) / 240 ≤ Real.log 3 := by have h := artanhLower_le_log (t := (1 : ℝ) / 2) (by norm_num) (by norm_num) have hr : (1 + (1 : ℝ) / 2) / (1 - (1 : ℝ) / 2) = 3 := by norm_num have hl : artanhLower ((1 : ℝ) / 2) = 263 / 240 := by unfold artanhLower; norm_num linarith [hr ▸ h, hl] lemma log_three_le_10_div_9 : Real.log 3 ≤ (10 : ℝ) / 9 := by have h := log_le_artanhUpper (t := (1 : ℝ) / 2) (by norm_num) (by norm_num) have hr : (1 + (1 : ℝ) / 2) / (1 - (1 : ℝ) / 2) = 3 := by norm_num have hu : artanhUpper ((1 : ℝ) / 2) = 10 / 9 := by unfold artanhUpper; norm_num linarith [hr ▸ h, hu] lemma log_two_lt_one : Real.log 2 < 1 := lt_of_le_of_lt log_two_le_25_div_36 (by norm_num) /-- Strict first-order `artanh` inequality: `2 x / (2 - x) < -log (1 - x)` for `x ∈ (0, 1)`. -/ lemma two_mul_div_lt_neg_log_one_sub {x : ℝ} (hx0 : 0 < x) (hx1 : x < 1) : 2 * x / (2 - x) < -Real.log (1 - x) := by let t := x / (2 - x) have h2mx : 0 < 2 - x := by linarith have h1mx : 0 < 1 - x := by linarith have ht0 : 0 < t := div_pos hx0 h2mx have ht1 : t < 1 := (div_lt_one h2mx).mpr (by linarith) have hlow := artanhLower_le_log ht0.le ht1 have hratio : (1 + t) / (1 - t) = (1 - x)⁻¹ := by have h1mt : 1 - t ≠ 0 := by linarith rw [div_eq_iff h1mt] simp only [t] field_simp [h1mx.ne', h2mx.ne'] ring have hlog : Real.log ((1 + t) / (1 - t)) = -Real.log (1 - x) := by rw [hratio, Real.log_inv] have hstrict : 2 * t < artanhLower t := by unfold artanhLower nlinarith [pow_pos ht0 3, pow_pos ht0 5] have h2t : 2 * t = 2 * x / (2 - x) := by simp only [t]; ring linarith /-- Auxiliary function `fLog(x) = x / (-log(1 - x))` on `(0, 1)`. -/ noncomputable def fLog (x : ℝ) : ℝ := x / (-Real.log (1 - x)) noncomputable def fLog' (x : ℝ) : ℝ := (-Real.log (1 - x) - x / (1 - x)) / (-Real.log (1 - x)) ^ 2 noncomputable def fLog'' (x : ℝ) : ℝ := (2 * x - (2 - x) * (-Real.log (1 - x))) / ((1 - x) ^ 2 * (-Real.log (1 - x)) ^ 3) lemma neg_log_one_sub_pos {x : ℝ} (hx0 : 0 < x) (hx1 : x < 1) : 0 < -Real.log (1 - x) := neg_pos.mpr (Real.log_neg (sub_pos.mpr hx1) (sub_lt_self 1 hx0)) lemma hasDerivAt_fLog {x : ℝ} (hx0 : 0 < x) (hx1 : x < 1) : HasDerivAt fLog (fLog' x) x := by have h1mx : 0 < 1 - x := sub_pos.mpr hx1 have hL : 0 < -Real.log (1 - x) := neg_log_one_sub_pos hx0 hx1 have hden : HasDerivAt (fun t : ℝ => -Real.log (1 - t)) (1 / (1 - x)) x := by have hsub : HasDerivAt (fun t : ℝ => 1 - t) (-1) x := by simpa using (hasDerivAt_id x).const_sub (1 : ℝ) have hlog := (hsub.log h1mx.ne').neg refine hlog.congr_deriv ?_ ring have hq := (hasDerivAt_id x).div hden hL.ne' unfold fLog fLog' refine hq.congr_deriv ?_ simp only [id_eq] field_simp [h1mx.ne', hL.ne'] lemma hasDerivAt_fLog' {x : ℝ} (hx0 : 0 < x) (hx1 : x < 1) : HasDerivAt fLog' (fLog'' x) x := by have h1mx : 0 < 1 - x := sub_pos.mpr hx1 have hL : 0 < -Real.log (1 - x) := neg_log_one_sub_pos hx0 hx1 have hL_d : HasDerivAt (fun t : ℝ => -Real.log (1 - t)) (1 / (1 - x)) x := by have hsub : HasDerivAt (fun t : ℝ => 1 - t) (-1) x := by simpa using (hasDerivAt_id x).const_sub (1 : ℝ) exact ((hsub.log h1mx.ne').neg).congr_deriv (by ring) have hx_d : HasDerivAt (fun t : ℝ => t / (1 - t)) (1 / (1 - x) ^ 2) x := by have hsub : HasDerivAt (fun t : ℝ => 1 - t) (-1) x := by simpa using (hasDerivAt_id x).const_sub (1 : ℝ) refine ((hasDerivAt_id x).div hsub h1mx.ne').congr_deriv ?_ simp only [id_eq] field_simp [h1mx.ne'] ring have hnum : HasDerivAt (fun t : ℝ => -Real.log (1 - t) - t / (1 - t)) (1 / (1 - x) - 1 / (1 - x) ^ 2) x := hL_d.sub hx_d have hden : HasDerivAt (fun t : ℝ => (-Real.log (1 - t)) ^ 2) (2 * (-Real.log (1 - x)) * (1 / (1 - x))) x := by have hpow := hL_d.pow 2 exact hpow.congr_deriv (by ring) have hq := hnum.div hden (pow_pos hL 2).ne' unfold fLog' fLog'' refine hq.congr_deriv ?_ field_simp [h1mx.ne', hL.ne'] ring lemma fLog''_neg {x : ℝ} (hx0 : 0 < x) (hx1 : x < 1) : fLog'' x < 0 := by have h1mx : 0 < 1 - x := sub_pos.mpr hx1 have h2mx : 0 < 2 - x := by linarith have hL : 0 < -Real.log (1 - x) := neg_log_one_sub_pos hx0 hx1 have hlt := two_mul_div_lt_neg_log_one_sub hx0 hx1 have hnum : 2 * x - (2 - x) * (-Real.log (1 - x)) < 0 := by have hmul := (div_lt_iff₀ h2mx).mp hlt linarith unfold fLog'' exact div_neg_of_neg_of_pos hnum (mul_pos (pow_pos h1mx 2) (pow_pos hL 3)) /-- **Lemma (Strict Concavity of `x / (-log(1 - x))`)**: `fLog(x) = x / (-log(1 - x))` is strictly concave on `(0, 1)`. -/ theorem strictConcaveOn_fLog : StrictConcaveOn ℝ (Set.Ioo (0 : ℝ) 1) fLog := by refine strictConcaveOn_of_deriv2_neg (convex_Ioo 0 1) ?_ ?_ · intro x hx exact (hasDerivAt_fLog hx.1 hx.2).continuousAt.continuousWithinAt · intro x hx rw [interior_Ioo] at hx have hderiv : deriv fLog =ᶠ[nhds x] fLog' := by filter_upwards [eventually_gt_nhds hx.1, eventually_lt_nhds hx.2] with t ht0 ht1 exact (hasDerivAt_fLog ht0 ht1).deriv have hderiv2 : deriv^[2] fLog x = fLog'' x := by simp only [Function.iterate_succ, Function.iterate_zero, Function.id_comp, Function.comp_apply] rw [hderiv.deriv_eq] exact (hasDerivAt_fLog' hx.1 hx.2).deriv rw [hderiv2] exact fLog''_neg hx.1 hx.2 lemma fLog_half : fLog (1 / 2 : ℝ) = 1 / (2 * Real.log 2) := by unfold fLog have h12 : (1 : ℝ) - 1 / 2 = (2 : ℝ)⁻¹ := by norm_num rw [h12, Real.log_inv, neg_neg] field_simp [(Real.log_pos (by norm_num : (1 : ℝ) < 2)).ne'] lemma fLog_add_symm_le {x : ℝ} (hx0 : 0 < x) (hx1 : x < 1) : fLog x + fLog (1 - x) ≤ 1 / Real.log 2 := by have h := strictConcaveOn_fLog.concaveOn.2 ⟨hx0, hx1⟩ ⟨sub_pos.mpr hx1, sub_lt_self 1 hx0⟩ (by norm_num : (0 : ℝ) ≤ 1 / 2) (by norm_num : (0 : ℝ) ≤ 1 / 2) (by norm_num) have hmid : (1 / 2 : ℝ) • x + (1 / 2 : ℝ) • (1 - x) = 1 / 2 := by simp only [smul_eq_mul]; ring rw [hmid, fLog_half] at h simp only [smul_eq_mul] at h have h2 : 2 * (1 / (2 * Real.log 2)) = 1 / Real.log 2 := by field_simp [(Real.log_pos (by norm_num : (1 : ℝ) < 2)).ne'] linarith lemma fLog_add_symm_lt {x : ℝ} (hx0 : 0 < x) (hx1 : x < 1) (hne : x ≠ 1 / 2) : fLog x + fLog (1 - x) < 1 / Real.log 2 := by have hxne : x ≠ 1 - x := by intro heq; apply hne; linarith have h := strictConcaveOn_fLog.2 ⟨hx0, hx1⟩ ⟨sub_pos.mpr hx1, sub_lt_self 1 hx0⟩ hxne (by norm_num : (0 : ℝ) < 1 / 2) (by norm_num : (0 : ℝ) < 1 / 2) (by norm_num) have hmid : (1 / 2 : ℝ) • x + (1 / 2 : ℝ) • (1 - x) = 1 / 2 := by simp only [smul_eq_mul]; ring rw [hmid, fLog_half] at h simp only [smul_eq_mul] at h have h2 : 2 * (1 / (2 * Real.log 2)) = 1 / Real.log 2 := by field_simp [(Real.log_pos (by norm_num : (1 : ℝ) < 2)).ne'] linarith /-- Exact identity linking the elasticity `g(u) / (u g'(u))` to `fLog(e^{-u}) + fLog(1 - e^{-u})`. -/ lemma g_div_mul_g'_eq {u : ℝ} (hu : 0 < u) : g u / (u * g' u) = fLog (Real.exp (-u)) + fLog (1 - Real.exp (-u)) := by let x := Real.exp (-u) have hx0 : 0 < x := Real.exp_pos (-u) have hx1 : x < 1 := Real.exp_lt_one_iff.mpr (neg_lt_zero.mpr hu) have hL : 0 < -Real.log (1 - x) := neg_log_one_sub_pos hx0 hx1 have hexp_inv : Real.exp u = 1 / x := by rw [one_div, ← Real.exp_neg, neg_neg] have hlogx : -Real.log (1 - (1 - x)) = u := by simp [x, Real.log_exp] have hL' : Real.log (1 - Real.exp (-u)) ≠ 0 := by linarith rw [g_of_pos hu, g', hexp_inv] unfold fLog simp only [x] at hlogx ⊢ rw [hlogx] field_simp [hu.ne', hx0.ne', hL'] ring /-- **Sharp Elasticity Bound**: `g(u) ≤ (1 / log 2) * u * g'(u)` for all `u > 0`, with strict inequality for every `u ≠ log 2`. -/ theorem g_le_inv_log_two_mul_u_g' {u : ℝ} (hu : 0 < u) : g u ≤ (1 / Real.log 2) * (u * g' u) := by have hx0 : 0 < Real.exp (-u) := Real.exp_pos (-u) have hx1 : Real.exp (-u) < 1 := Real.exp_lt_one_iff.mpr (neg_lt_zero.mpr hu) have hug : 0 < u * g' u := mul_pos hu (g'_pos hu) have h := fLog_add_symm_le hx0 hx1 rw [← g_div_mul_g'_eq hu] at h exact (div_le_iff₀ hug).mp h theorem g_lt_inv_log_two_mul_u_g' {u : ℝ} (hu : 0 < u) (hne : u ≠ Real.log 2) : g u < (1 / Real.log 2) * (u * g' u) := by have hx0 : 0 < Real.exp (-u) := Real.exp_pos (-u) have hx1 : Real.exp (-u) < 1 := Real.exp_lt_one_iff.mpr (neg_lt_zero.mpr hu) have hxne : Real.exp (-u) ≠ 1 / 2 := by intro heq apply hne have hlog := congrArg Real.log heq rw [Real.log_exp] at hlog have h12 : Real.log (1 / 2 : ℝ) = -Real.log 2 := by rw [one_div, Real.log_inv] linarith have hug : 0 < u * g' u := mul_pos hu (g'_pos hu) have h := fLog_add_symm_lt hx0 hx1 hxne rw [← g_div_mul_g'_eq hu] at h exact (div_lt_iff₀ hug).mp h /-- The exact sharp star-shapedness exponent `p₀ = 1 / log 2 = log₂ e ≈ 1.44269504`. -/ noncomputable def invLog2 : ℝ := 1 / Real.log 2 /-- The Hölder conjugate exponent `q₀ = 1 / (1 - log 2) ≈ 3.25889135`. -/ noncomputable def holderConjLog2 : ℝ := 1 / (1 - Real.log 2) lemma invLog2_pos : 0 < invLog2 := div_pos one_pos (Real.log_pos (by norm_num : (1 : ℝ) < 2)) lemma one_lt_invLog2 : 1 < invLog2 := by unfold invLog2 exact (one_lt_div (Real.log_pos (by norm_num : (1 : ℝ) < 2))).mpr log_two_lt_one lemma holderConjugate_invLog2 : Real.HolderConjugate invLog2 holderConjLog2 := by rw [Real.holderConjugate_iff] refine ⟨one_lt_invLog2, ?_⟩ unfold invLog2 holderConjLog2 have h1 : Real.log 2 ≠ 0 := (Real.log_pos (by norm_num : (1 : ℝ) < 2)).ne' have h2 : 1 - Real.log 2 ≠ 0 := (sub_pos.mpr log_two_lt_one).ne' field_simp [h1, h2] ring /-- Sharp star-shaped power transform `gLog2(u) = g(u)^(1 / log 2)`. -/ noncomputable def gLog2 (u : ℝ) : ℝ := (g u) ^ invLog2 lemma gLog2_zero : gLog2 0 = 0 := by simp [gLog2, g_zero, Real.zero_rpow invLog2_pos.ne'] lemma gLog2_nonneg (u : ℝ) : 0 ≤ gLog2 u := Real.rpow_nonneg (g_nonneg u) _ lemma hasDerivAt_g_rpow_div {p u : ℝ} (hu : 0 < u) : HasDerivAt (fun t : ℝ => (g t) ^ p / t) ((g u) ^ (p - 1) * (p * u * g' u - g u) / u ^ 2) u := by have hg_pos : 0 < g u := g_pos hu have h1 : HasDerivAt (fun t : ℝ => (g t) ^ p) (p * (g u) ^ (p - 1) * g' u) u := by refine ((hasDerivAt_g hu).rpow_const (p := p) (Or.inl hg_pos.ne')).congr_deriv ?_ ring have hq := h1.div (hasDerivAt_id u) hu.ne' have hpow : (g u) ^ p = (g u) ^ (p - 1) * g u := by calc (g u) ^ p = (g u) ^ ((p - 1) + 1) := by ring_nf _ = (g u) ^ (p - 1) * (g u) ^ (1 : ℝ) := Real.rpow_add hg_pos _ _ _ = (g u) ^ (p - 1) * g u := by rw [Real.rpow_one] refine hq.congr_deriv ?_ simp only [id_eq] rw [hpow] field_simp [hu.ne'] /-- **Theorem (Strict Star-Shapedness at `p₀ = 1 / log 2`)**: The function `u ↦ g(u)^(1 / log 2) / u` is strictly increasing on `(0, ∞)`. -/ theorem strictMonoOn_gLog2_div : StrictMonoOn (fun u : ℝ => gLog2 u / u) (Set.Ioi (0 : ℝ)) := by have hlog2_pos : 0 < Real.log 2 := Real.log_pos (by norm_num : (1 : ℝ) < 2) have hcont : ContinuousOn (fun u : ℝ => gLog2 u / u) (Set.Ioi 0) := by intro u hu have h1 : ContinuousAt gLog2 u := by unfold gLog2 exact ((hasDerivAt_g hu).continuousAt).rpow_const (Or.inl (g_pos hu).ne') exact (h1.div continuousAt_id (ne_of_gt hu)).continuousWithinAt have hleft : StrictMonoOn (fun u : ℝ => gLog2 u / u) (Set.Ioc 0 (Real.log 2)) := by refine strictMonoOn_of_deriv_pos (convex_Ioc 0 (Real.log 2)) (hcont.mono Set.Ioc_subset_Ioi_self) ?_ intro u hu rw [interior_Ioc] at hu have hd := hasDerivAt_g_rpow_div (p := invLog2) hu.1 rw [show (fun t : ℝ => gLog2 t / t) = (fun t : ℝ => (g t) ^ invLog2 / t) from rfl, hd.deriv] have hlt := g_lt_inv_log_two_mul_u_g' hu.1 hu.2.ne have hnum : 0 < invLog2 * u * g' u - g u := by unfold invLog2 linarith [show (1 / Real.log 2) * (u * g' u) = (1 / Real.log 2) * u * g' u by ring] exact div_pos (mul_pos (Real.rpow_pos_of_pos (g_pos hu.1) _) hnum) (sq_pos_of_pos hu.1) have hright : StrictMonoOn (fun u : ℝ => gLog2 u / u) (Set.Ici (Real.log 2)) := by refine strictMonoOn_of_deriv_pos (convex_Ici (Real.log 2)) (hcont.mono (fun x hx => hlog2_pos.trans_le hx)) ?_ intro u hu rw [interior_Ici] at hu have hu0 : 0 < u := hlog2_pos.trans hu have hd := hasDerivAt_g_rpow_div (p := invLog2) hu0 rw [show (fun t : ℝ => gLog2 t / t) = (fun t : ℝ => (g t) ^ invLog2 / t) from rfl, hd.deriv] have hlt := g_lt_inv_log_two_mul_u_g' hu0 hu.ne' have hnum : 0 < invLog2 * u * g' u - g u := by unfold invLog2 linarith [show (1 / Real.log 2) * (u * g' u) = (1 / Real.log 2) * u * g' u by ring] exact div_pos (mul_pos (Real.rpow_pos_of_pos (g_pos hu0) _) hnum) (sq_pos_of_pos hu0) intro a ha b hb hab rcases le_or_gt b (Real.log 2) with hb_le | hb_gt · exact hleft ⟨ha, hab.le.trans hb_le⟩ ⟨hb, hb_le⟩ hab · rcases le_or_gt (Real.log 2) a with ha_ge | ha_lt · exact hright ha_ge (ha_ge.trans hab.le) hab · exact (hleft ⟨ha, ha_lt.le⟩ ⟨hlog2_pos, le_rfl⟩ ha_lt).trans (hright (Set.mem_Ici.mpr le_rfl) (Set.mem_Ici.mpr hb_gt.le) hb_gt) lemma g_log_two : g (Real.log 2) = 2 * Real.log 2 := by have hpos : 0 < Real.log 2 := Real.log_pos (by norm_num : (1 : ℝ) < 2) rw [g_of_pos hpos, Real.exp_log (by norm_num : (0 : ℝ) < 2), Real.exp_neg, Real.exp_log (by norm_num : (0 : ℝ) < 2)] have h12 : (1 : ℝ) - (2 : ℝ)⁻¹ = (2 : ℝ)⁻¹ := by norm_num rw [h12, Real.log_inv] ring lemma g'_log_two : g' (Real.log 2) = 2 * Real.log 2 := by rw [g', Real.exp_log (by norm_num : (0 : ℝ) < 2), Real.exp_neg, Real.exp_log (by norm_num : (0 : ℝ) < 2)] have h12 : (1 : ℝ) - (2 : ℝ)⁻¹ = (2 : ℝ)⁻¹ := by norm_num rw [h12, Real.log_inv] ring /-- **Theorem (Exact Sharpness of the Star-Shapedness Exponent `1 / log 2`)**: For every `p < 1 / log 2`, the function `u ↦ g(u)^p / u` is NOT nondecreasing on `(0, ∞)`. -/ theorem sharpness_star_shaped_inv_log_two {p : ℝ} (hp : p < invLog2) : ¬ MonotoneOn (fun u : ℝ => (g u) ^ p / u) (Set.Ioi (0 : ℝ)) := by intro hmono have hlog2_pos : 0 < Real.log 2 := Real.log_pos (by norm_num : (1 : ℝ) < 2) have hd := hasDerivAt_g_rpow_div (p := p) hlog2_pos have hnonneg : 0 ≤ (g (Real.log 2)) ^ (p - 1) * (p * Real.log 2 * g' (Real.log 2) - g (Real.log 2)) / (Real.log 2) ^ 2 := by have htend := hd.tendsto_slope_zero_right refine ge_of_tendsto htend ?_ filter_upwards [self_mem_nhdsWithin] with t ht rw [smul_eq_mul] have hpos : 0 < Real.log 2 + t := by linarith [Set.mem_Ioi.mp ht] have hle : Real.log 2 ≤ Real.log 2 + t := by linarith [Set.mem_Ioi.mp ht] exact mul_nonneg (inv_nonneg.mpr (Set.mem_Ioi.mp ht).le) (sub_nonneg.mpr (hmono hlog2_pos hpos hle)) have hneg : (g (Real.log 2)) ^ (p - 1) * (p * Real.log 2 * g' (Real.log 2) - g (Real.log 2)) / (Real.log 2) ^ 2 < 0 := by rw [g_log_two, g'_log_two] have hp_lt : p * Real.log 2 < 1 := (lt_div_iff₀ hlog2_pos).mp hp have hfac : p * Real.log 2 * (2 * Real.log 2) - 2 * Real.log 2 < 0 := by have : p * Real.log 2 * (2 * Real.log 2) - 2 * Real.log 2 = 2 * Real.log 2 * (p * Real.log 2 - 1) := by ring rw [this] exact mul_neg_of_pos_of_neg (by linarith) (by linarith) exact div_neg_of_neg_of_pos (mul_neg_of_pos_of_neg (Real.rpow_pos_of_pos (by linarith) _) hfac) (sq_pos_of_pos hlog2_pos) linarith /-- **Theorem (Strict Separation of Star-Shapedness from Convexity)**: Although `g(u)^(1 / log 2)` is strictly star-shaped and superadditive on `[0, ∞)`, it is NOT convex on `[0, ∞)`: its second derivative at `u = log(3/2)` is strictly negative. -/ theorem gLog2_not_convex : ¬ ConvexOn ℝ (Set.Ici (0 : ℝ)) gLog2 := by let u₀ : ℝ := Real.log (3 / 2 : ℝ) have hu₀ : 0 < u₀ := Real.log_pos (by norm_num) let a := Real.log 2 let b := Real.log 3 have ha0 : 0 < a := Real.log_pos (by norm_num : (1 : ℝ) < 2) have ha_lo : (842 : ℝ) / 1215 ≤ a := log_two_gt_842_div_1215 have ha_hi : a ≤ 25 / 36 := log_two_le_25_div_36 have hb_lo : (263 : ℝ) / 240 ≤ b := log_three_ge_263_div_240 have hb_hi : b ≤ 10 / 9 := log_three_le_10_div_9 have hu₀_eq : u₀ = b - a := by simp only [u₀, a, b] exact Real.log_div (by norm_num) (by norm_num) have hexp_u₀ : Real.exp u₀ = 3 / 2 := Real.exp_log (by norm_num) have hexp_neg_u₀ : Real.exp (-u₀) = 2 / 3 := by rw [Real.exp_neg, hexp_u₀]; norm_num have h1m : (1 : ℝ) - Real.exp (-u₀) = 1 / 3 := by rw [hexp_neg_u₀]; norm_num have hlog13 : Real.log (1 - Real.exp (-u₀)) = -b := by rw [h1m, one_div, Real.log_inv] have hg_u₀ : g u₀ = (3 / 2 : ℝ) * b - a := by rw [g_of_pos hu₀, hexp_u₀, hlog13, hu₀_eq] ring have hgp_u₀ : g' u₀ = (3 / 2 : ℝ) * b := by rw [g', hexp_u₀, hlog13] ring have hgpp_u₀ : g'' u₀ = (3 / 2 : ℝ) * b - 3 := by rw [g'', hlog13, h1m, hexp_u₀] ring have hnum_neg : (invLog2 - 1) * (g' u₀) ^ 2 + g u₀ * g'' u₀ < 0 := by have hmul_eq : a * ((invLog2 - 1) * (g' u₀) ^ 2 + g u₀ * g'' u₀) = (9 / 4 : ℝ) * b ^ 2 - (9 / 2 : ℝ) * a * b - (3 / 2 : ℝ) * a ^ 2 * b + 3 * a ^ 2 := by rw [hg_u₀, hgp_u₀, hgpp_u₀] unfold invLog2 field_simp [ha0.ne'] ring have hpoly_neg : (9 / 4 : ℝ) * b ^ 2 - (9 / 2 : ℝ) * a * b - (3 / 2 : ℝ) * a ^ 2 * b + 3 * a ^ 2 < 0 := by have ha2_lo : (842 / 1215 : ℝ) ^ 2 ≤ a ^ 2 := by nlinarith have ha2_hi : a ^ 2 ≤ (25 / 36 : ℝ) ^ 2 := by nlinarith have hb2_hi : b ^ 2 ≤ (10 / 9 : ℝ) ^ 2 := by nlinarith have hab_lo : (842 / 1215 : ℝ) * (263 / 240) ≤ a * b := by nlinarith have ha2b_lo : (842 / 1215 : ℝ) ^ 2 * (263 / 240) ≤ a ^ 2 * b := by nlinarith nlinarith nlinarith -- Second derivative of gLog2 at u₀ is strictly negative let gLog2' : ℝ → ℝ := fun t => invLog2 * (g t) ^ (invLog2 - 1) * g' t let gLog2'' : ℝ → ℝ := fun t => invLog2 * (g t) ^ (invLog2 - 2) * ((invLog2 - 1) * (g' t) ^ 2 + g t * g'' t) have hd1 : ∀ t ∈ Set.Ioi (0 : ℝ), HasDerivAt gLog2 (gLog2' t) t := by intro t ht unfold gLog2 gLog2' refine ((hasDerivAt_g ht).rpow_const (p := invLog2) (Or.inl (g_pos ht).ne')).congr_deriv ?_ ring have hd2 : HasDerivAt gLog2' (gLog2'' u₀) u₀ := by have hg_pos : 0 < g u₀ := g_pos hu₀ have h1 : HasDerivAt (fun t : ℝ => (g t) ^ (invLog2 - 1)) ((invLog2 - 1) * (g u₀) ^ (invLog2 - 2) * g' u₀) u₀ := by refine ((hasDerivAt_g hu₀).rpow_const (p := invLog2 - 1) (Or.inl hg_pos.ne')).congr_deriv ?_ have : invLog2 - 1 - 1 = invLog2 - 2 := by ring rw [this]; ring have h2 : HasDerivAt g' (g'' u₀) u₀ := hasDerivAt_g' hu₀ have hmul := (h1.const_mul invLog2).mul h2 have hpow : (g u₀) ^ (invLog2 - 1) = (g u₀) ^ (invLog2 - 2) * g u₀ := by calc (g u₀) ^ (invLog2 - 1) = (g u₀) ^ ((invLog2 - 2) + 1) := by ring_nf _ = (g u₀) ^ (invLog2 - 2) * (g u₀) ^ (1 : ℝ) := Real.rpow_add hg_pos _ _ _ = (g u₀) ^ (invLog2 - 2) * g u₀ := by rw [Real.rpow_one] unfold gLog2' gLog2'' refine hmul.congr_deriv ?_ rw [hpow]; ring have hd2_neg : gLog2'' u₀ < 0 := by unfold gLog2'' exact mul_neg_of_pos_of_neg (mul_pos invLog2_pos (Real.rpow_pos_of_pos (g_pos hu₀) _)) hnum_neg intro hconv -- Convexity implies gLog2' is monotone on (0, ∞), contradicting gLog2'' u₀ < 0 have hmono' : MonotoneOn gLog2' (Set.Ioi 0) := by intro x hx y hy hxy rcases eq_or_lt_of_le hxy with rfl | hlt · exact le_rfl · have h1 : gLog2' x ≤ (gLog2 y - gLog2 x) / (y - x) := by have ht := (hd1 x hx).tendsto_slope_zero_right refine le_of_tendsto ht ?_ filter_upwards [Ioo_mem_nhdsGT (sub_pos.mpr hlt)] with t ht rw [smul_eq_mul, inv_mul_eq_div] have hx_pos : 0 < x := Set.mem_Ioi.mp hx have hy_pos : 0 < y := Set.mem_Ioi.mp hy have hsec := hconv.secant_mono (a := x) (x := x + t) (y := y) (Set.mem_Ici.mpr hx_pos.le) (Set.mem_Ici.mpr (by linarith [ht.1])) (Set.mem_Ici.mpr hy_pos.le) (by linarith [ht.1]) hlt.ne' (by linarith [ht.2]) simpa [add_sub_cancel_left] using hsec have h2 : (gLog2 y - gLog2 x) / (y - x) ≤ gLog2' y := by have ht := (hd1 y hy).tendsto_slope_zero_left refine ge_of_tendsto ht ?_ filter_upwards [Ioo_mem_nhdsLT (neg_lt_zero.mpr (sub_pos.mpr hlt))] with t ht rw [smul_eq_mul, inv_mul_eq_div] have hx_pos : 0 < x := Set.mem_Ioi.mp hx have hy_pos : 0 < y := Set.mem_Ioi.mp hy have hsec := hconv.secant_mono (a := y) (x := x) (y := y + t) (Set.mem_Ici.mpr hy_pos.le) (Set.mem_Ici.mpr hx_pos.le) (Set.mem_Ici.mpr (by linarith [ht.1])) hlt.ne (by linarith [ht.2]) (by linarith [ht.1]) have heq1 : (gLog2 x - gLog2 y) / (x - y) = (gLog2 y - gLog2 x) / (y - x) := by have h1' : x - y = -(y - x) := by ring have h2' : gLog2 x - gLog2 y = -(gLog2 y - gLog2 x) := by ring rw [h1', h2', neg_div_neg_eq] simpa [add_sub_cancel_left, heq1] using hsec exact h1.trans h2 have hge : 0 ≤ gLog2'' u₀ := by have ht := hd2.tendsto_slope_zero_right refine ge_of_tendsto ht ?_ filter_upwards [self_mem_nhdsWithin] with t ht rw [smul_eq_mul] have ht_pos : 0 < t := Set.mem_Ioi.mp ht exact mul_nonneg (inv_nonneg.mpr ht_pos.le) (sub_nonneg.mpr (hmono' (Set.mem_Ioi.mpr hu₀) (Set.mem_Ioi.mpr (by linarith)) (by linarith))) linarith lemma gLog2_mul_le_of_le_one {c u : ℝ} (hc0 : 0 ≤ c) (hc1 : c ≤ 1) (hu : 0 ≤ u) : gLog2 (c * u) ≤ c * gLog2 u := by rcases eq_or_lt_of_le hc0 with rfl | hc_pos · simp [gLog2_zero] · rcases eq_or_lt_of_le hu with rfl | hu_pos · simp [gLog2_zero] · rcases eq_or_lt_of_le hc1 with rfl | hc_lt · simp · have hcu : 0 < c * u := mul_pos hc_pos hu_pos have hlt := strictMonoOn_gLog2_div hcu hu_pos (by nlinarith) have h2 : gLog2 (c * u) < gLog2 u / u * (c * u) := (div_lt_iff₀ hcu).mp hlt have h3 : gLog2 u / u * (c * u) = c * gLog2 u := by field_simp [hu_pos.ne'] linarith lemma gLog2_mul_lt_of_lt_one {c u : ℝ} (hc0 : 0 < c) (hc1 : c < 1) (hu : 0 < u) : gLog2 (c * u) < c * gLog2 u := by have hcu : 0 < c * u := mul_pos hc0 hu have hlt := strictMonoOn_gLog2_div hcu hu (by nlinarith) have h2 : gLog2 (c * u) < gLog2 u / u * (c * u) := (div_lt_iff₀ hcu).mp hlt have h3 : gLog2 u / u * (c * u) = c * gLog2 u := by field_simp [hu.ne'] linarith /-- **Theorem (Sharp Universal `k`-Wise `ℓ_{1 / log 2}` Superadditivity of `g`)**: For every `k : ℕ` and `u : Fin k → [0, ∞)`, `∑ j, g(u j)^(1 / log 2) ≤ g(∑ j, u j)^(1 / log 2)`. -/ theorem gLog2_superadd_finset {k : ℕ} {u : Fin k → ℝ} (hu : ∀ j, 0 ≤ u j) : ∑ j, gLog2 (u j) ≤ gLog2 (∑ j, u j) := by let S := ∑ j, u j rcases eq_or_lt_of_le (Finset.sum_nonneg fun j _ => hu j) with hS0 | hS_pos · have hu0 : ∀ j, u j = 0 := fun j => le_antisymm (hS0 ▸ Finset.single_le_sum (fun l _ => hu l) (Finset.mem_univ j)) (hu j) simp [hu0, gLog2_zero] · have hterm : ∀ j, gLog2 (u j) ≤ (u j / S) * gLog2 S := fun j => by have hc0 : 0 ≤ u j / S := div_nonneg (hu j) hS_pos.le have hc1 : u j / S ≤ 1 := (div_le_one hS_pos).mpr (Finset.single_le_sum (fun l _ => hu l) (Finset.mem_univ j)) have hmul := gLog2_mul_le_of_le_one hc0 hc1 hS_pos.le rwa [div_mul_cancel₀ (u j) hS_pos.ne'] at hmul calc ∑ j, gLog2 (u j) ≤ ∑ j, (u j / S) * gLog2 S := Finset.sum_le_sum fun j _ => hterm j _ = (∑ j, u j / S) * gLog2 S := by rw [← Finset.sum_mul] _ = (S / S) * gLog2 S := by rw [← Finset.sum_div] _ = gLog2 S := by rw [div_self hS_pos.ne', one_mul] /-- Strict `ℓ_{1 / log 2}` superadditivity when at least two terms `u j₁, u j₂ > 0`. -/ theorem gLog2_strict_superadd_finset {k : ℕ} {u : Fin k → ℝ} (hu : ∀ j, 0 ≤ u j) {j₁ j₂ : Fin k} (hj : j₁ ≠ j₂) (hu1 : 0 < u j₁) (hu2 : 0 < u j₂) : ∑ j, gLog2 (u j) < gLog2 (∑ j, u j) := by let S := ∑ j, u j have hpair : u j₁ + u j₂ ≤ S := by have hmem : {j₁, j₂} ⊆ (Finset.univ : Finset (Fin k)) := Finset.subset_univ _ have hsum_pair : u j₁ + u j₂ = ∑ j ∈ ({j₁, j₂} : Finset (Fin k)), u j := by rw [Finset.sum_pair hj] rw [hsum_pair] exact Finset.sum_le_sum_of_subset_of_nonneg hmem (fun j _ _ => hu j) have hS_pos : 0 < S := lt_of_lt_of_le (add_pos hu1 hu2) hpair have hlt1 : gLog2 (u j₁) < (u j₁ / S) * gLog2 S := by have hc0 : 0 < u j₁ / S := div_pos hu1 hS_pos have hc1 : u j₁ / S < 1 := (div_lt_one hS_pos).mpr (by linarith) have hmul := gLog2_mul_lt_of_lt_one hc0 hc1 hS_pos rwa [div_mul_cancel₀ (u j₁) hS_pos.ne'] at hmul have hle_all : ∀ j, gLog2 (u j) ≤ (u j / S) * gLog2 S := fun j => by have hc0 : 0 ≤ u j / S := div_nonneg (hu j) hS_pos.le have hc1 : u j / S ≤ 1 := (div_le_one hS_pos).mpr (Finset.single_le_sum (fun l _ => hu l) (Finset.mem_univ j)) have hmul := gLog2_mul_le_of_le_one hc0 hc1 hS_pos.le rwa [div_mul_cancel₀ (u j) hS_pos.ne'] at hmul have hsum_lt : ∑ j, gLog2 (u j) < ∑ j, (u j / S) * gLog2 S := Finset.sum_lt_sum (fun j _ => hle_all j) ⟨j₁, Finset.mem_univ _, hlt1⟩ have hrhs : ∑ j, (u j / S) * gLog2 S = gLog2 S := by rw [← Finset.sum_mul, ← Finset.sum_div, div_self hS_pos.ne', one_mul] linarith theorem g_rpow_inv_log_two_superadd_finset {k : ℕ} {u : Fin k → ℝ} (hu : ∀ j, 0 ≤ u j) : (∑ j, (g (u j)) ^ invLog2) ^ (Real.log 2) ≤ g (∑ j, u j) := by have h1 := gLog2_superadd_finset hu have hlhs_nn : 0 ≤ ∑ j, (g (u j)) ^ invLog2 := Finset.sum_nonneg fun j _ => gLog2_nonneg (u j) have hS_nn : 0 ≤ g (∑ j, u j) := g_nonneg _ have hlog2_pos : 0 < Real.log 2 := Real.log_pos (by norm_num : (1 : ℝ) < 2) calc (∑ j, (g (u j)) ^ invLog2) ^ (Real.log 2) ≤ ((g (∑ j, u j)) ^ invLog2) ^ (Real.log 2) := Real.rpow_le_rpow hlhs_nn h1 hlog2_pos.le _ = g (∑ j, u j) := by rw [← Real.rpow_mul hS_nn] unfold invLog2 rw [one_div_mul_cancel hlog2_pos.ne', Real.rpow_one] /-- **Headline Theorem (Sharp Universal `k`-Wise `ℓ_{log₂ e}` Superadditive Product-Entropy Inequality)**: For every `k : ℕ` and `x : Fin k → [0, 1]`, `(∑ j, ((∏_{l ≠ j} x_l) * h(x_j))^(1 / log 2))^(log 2) ≤ h(∏ x_j)`. Strictly strengthens the `3/2`-power inequality (`1 / log 2 ≈ 1.442695 < 1.5`). -/ theorem binEntropy_prod_superadditive_inv_log_two {k : ℕ} {x : Fin k → ℝ} (hx : ∀ j, 0 ≤ x j ∧ x j ≤ 1) : (∑ j, ((∏ l ∈ Finset.univ.erase j, x l) * binEntropy (x j)) ^ invLog2) ^ (Real.log 2) ≤ binEntropy (∏ j, x j) := by have hlog2_pos : 0 < Real.log 2 := Real.log_pos (by norm_num : (1 : ℝ) < 2) by_cases hzero : ∃ j, x j = 0 · obtain ⟨j₀, hj₀⟩ := hzero have hprod0 : ∏ j, x j = 0 := Finset.prod_eq_zero (Finset.mem_univ j₀) hj₀ rw [hprod0, binEntropy_zero] have hterm0 : ∀ j : Fin k, (∏ l ∈ Finset.univ.erase j, x l) * binEntropy (x j) = 0 := fun j => by by_cases hj : j = j₀ · subst hj; simp [hj₀] · have hmem : j₀ ∈ Finset.univ.erase j := Finset.mem_erase.mpr ⟨Ne.symm hj, Finset.mem_univ _⟩ simp [Finset.prod_eq_zero hmem hj₀] simp [hterm0, Real.zero_rpow invLog2_pos.ne', Real.zero_rpow hlog2_pos.ne'] · push Not at hzero have hx_pos : ∀ j, 0 < x j := fun j => lt_of_le_of_ne (hx j).1 (hzero j).symm let u : Fin k → ℝ := fun j => -Real.log (x j) have hu_nn : ∀ j, 0 ≤ u j := fun j => neg_nonneg.mpr (Real.log_nonpos (hx j).1 (hx j).2) let P : ℝ := ∏ j, x j have hP_pos : 0 < P := Finset.prod_pos fun j _ => hx_pos j have hsum_eq : Real.exp (-(∑ j, u j)) = P := by rw [Finset.sum_neg_distrib, neg_neg, Real.exp_sum] refine Finset.prod_congr rfl fun j _ => by simp [Real.exp_log (hx_pos j)] have hterm_eq : ∀ j, (∏ l ∈ Finset.univ.erase j, x l) * binEntropy (x j) = P * g (u j) := by intro j have hx_eq : Real.exp (-u j) = x j := by simp [u, Real.exp_log (hx_pos j)] have hbin : binEntropy (x j) = x j * g (u j) := by rw [← hx_eq, binEntropy_exp_neg (hu_nn j)] have hsplit : P = (∏ l ∈ Finset.univ.erase j, x l) * x j := (Finset.prod_erase_mul Finset.univ x (Finset.mem_univ j)).symm rw [hbin, ← mul_assoc, ← hsplit] have hrhs : binEntropy P = P * g (∑ j, u j) := by rw [← hsum_eq, binEntropy_exp_neg (Finset.sum_nonneg fun j _ => hu_nn j)] rw [hrhs] have hlhs_eq : ∑ j, ((∏ l ∈ Finset.univ.erase j, x l) * binEntropy (x j)) ^ invLog2 = P ^ invLog2 * ∑ j, (g (u j)) ^ invLog2 := by rw [Finset.mul_sum] refine Finset.sum_congr rfl fun j _ => ?_ rw [hterm_eq j, Real.mul_rpow hP_pos.le (g_nonneg _)] rw [hlhs_eq, Real.mul_rpow (Real.rpow_nonneg hP_pos.le _) (Finset.sum_nonneg fun j _ => Real.rpow_nonneg (g_nonneg _) _)] have hP_cancel : (P ^ invLog2) ^ (Real.log 2) = P := by rw [← Real.rpow_mul hP_pos.le] unfold invLog2 rw [one_div_mul_cancel hlog2_pos.ne', Real.rpow_one] rw [hP_cancel] exact mul_le_mul_of_nonneg_left (g_rpow_inv_log_two_superadd_finset hu_nn) hP_pos.le /-- **Headline Theorem (Universal `k`-Wise `ℓ_{1 / (1 - log 2)}` Asymmetric Entropy Family)**: Whenever `α_j ≥ 0` satisfies `∑ j, α_j^(1 / (1 - log 2)) ≤ 1` (with `1 / (1 - log 2) ≈ 3.25889`), for all `x ∈ [0, 1]^k`, `∑ j, α_j * (∏_{l ≠ j} x_l) * h(x_j) ≤ h(∏ x_j)`. -/ theorem binEntropy_prod_holder_inv_log_two {k : ℕ} {α : Fin k → ℝ} (hα0 : ∀ j, 0 ≤ α j) (hαq : ∑ j, (α j) ^ holderConjLog2 ≤ 1) {x : Fin k → ℝ} (hx : ∀ j, 0 ≤ x j ∧ x j ≤ 1) : ∑ j, α j * (∏ l ∈ Finset.univ.erase j, x l) * binEntropy (x j) ≤ binEntropy (∏ j, x j) := by let b : Fin k → ℝ := fun j => (∏ l ∈ Finset.univ.erase j, x l) * binEntropy (x j) have hb_nn : ∀ j, 0 ≤ b j := fun j => mul_nonneg (Finset.prod_nonneg fun l _ => (hx l).1) (binEntropy_nonneg (hx j).1 (hx j).2) have hholder := Real.inner_le_Lp_mul_Lq_of_nonneg (Finset.univ : Finset (Fin k)) (f := b) (g := α) holderConjugate_invLog2 (fun j _ => hb_nn j) (fun j _ => hα0 j) have hsum_eq : ∑ j, α j * (∏ l ∈ Finset.univ.erase j, x l) * binEntropy (x j) = ∑ j, b j * α j := by refine Finset.sum_congr rfl fun j _ => ?_ simp only [b]; ring rw [hsum_eq] have hq_pos : 0 < holderConjLog2 := div_pos one_pos (sub_pos.mpr log_two_lt_one) have hα_rpow : (∑ j, α j ^ holderConjLog2) ^ (1 / holderConjLog2) ≤ 1 := Real.rpow_le_one (Finset.sum_nonneg fun j _ => Real.rpow_nonneg (hα0 j) _) hαq (div_nonneg zero_le_one hq_pos.le) have hexp : 1 / invLog2 = Real.log 2 := by unfold invLog2; rw [one_div_one_div] have hb_bound : (∑ j, b j ^ invLog2) ^ (1 / invLog2) ≤ binEntropy (∏ j, x j) := by rw [hexp] exact binEntropy_prod_superadditive_inv_log_two hx have hmul : (∑ j, b j ^ invLog2) ^ (1 / invLog2) * (∑ j, α j ^ holderConjLog2) ^ (1 / holderConjLog2) ≤ binEntropy (∏ j, x j) * 1 := mul_le_mul hb_bound hα_rpow (Real.rpow_nonneg (Finset.sum_nonneg fun j _ => Real.rpow_nonneg (hα0 j) _) _) (binEntropy_nonneg (Finset.prod_nonneg fun j _ => (hx j).1) (Finset.prod_le_one (fun j _ => (hx j).1) (fun j _ => (hx j).2))) linarith [hholder, hmul] /-- Immediate symmetric `k`-wise corollary: `k^(log 2) * x^(k - 1) * h(x) ≤ h(x^k)` for all `k ≥ 1`. -/ theorem binEntropy_pow_ge_rpow_log_two {k : ℕ} (_hk : 1 ≤ k) {x : ℝ} (hx0 : 0 ≤ x) (hx1 : x ≤ 1) : (k : ℝ) ^ (Real.log 2) * x ^ (k - 1) * binEntropy x ≤ binEntropy (x ^ k) := by have h := binEntropy_prod_superadditive_inv_log_two (k := k) (x := fun _ => x) (fun _ => ⟨hx0, hx1⟩) have hprod : (∏ _j : Fin k, x) = x ^ k := by simp have herase : ∀ j : Fin k, (∏ _l ∈ Finset.univ.erase j, x) = x ^ (k - 1) := by intro j rw [Finset.prod_const, Finset.card_erase_of_mem (Finset.mem_univ j), Finset.card_univ, Fintype.card_fin] simp_rw [hprod, herase] at h rw [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] at h have hk_nn : (0 : ℝ) ≤ (k : ℝ) := Nat.cast_nonneg k have hterm_nn : 0 ≤ x ^ (k - 1) * binEntropy x := mul_nonneg (pow_nonneg hx0 _) (binEntropy_nonneg hx0 hx1) rw [Real.mul_rpow hk_nn (Real.rpow_nonneg hterm_nn _)] at h have hcancel : ((x ^ (k - 1) * binEntropy x) ^ invLog2) ^ Real.log 2 = x ^ (k - 1) * binEntropy x := by rw [← Real.rpow_mul hterm_nn] unfold invLog2 rw [one_div_mul_cancel (Real.log_pos (by norm_num : (1 : ℝ) < 2)).ne', Real.rpow_one] rw [hcancel] at h linarith /-! ## Section 3: Exact Symmetric Boppana Inequality (`φ = (1 + √5) / 2`) We give a self-contained, elementary calculus proof of Boppana's inequality `h(x^2) ≥ φ * x * h(x)` on `[0, 1]` by differentiating `F₀(x) = (h(x^2) - φ x h(x)) / x^2`: its rational terms cancel identically, yielding `F₀'(x) = N(x) / x^3` where `N(x) = 2 log(1 + x) + (2 - φ x) log(1 - x)` has second derivative `N''(x) = P(x) / ((1 + x)^2 (1 - x)^2)` with the strictly concave cubic `P(x) = -φ x^3 - 4 x^2 + 3 φ x + (2 φ - 4)`. -/ private noncomputable def bopP (x : ℝ) : ℝ := -Real.goldenRatio * x ^ 3 - 4 * x ^ 2 + 3 * Real.goldenRatio * x + (2 * Real.goldenRatio - 4) private noncomputable def bopN (x : ℝ) : ℝ := 2 * Real.log (1 + x) + (2 - Real.goldenRatio * x) * Real.log (1 - x) private noncomputable def bopN' (x : ℝ) : ℝ := 2 / (1 + x) - Real.goldenRatio * Real.log (1 - x) - (2 - Real.goldenRatio * x) / (1 - x) private noncomputable def bopN'' (x : ℝ) : ℝ := bopP x / ((1 + x) ^ 2 * (1 - x) ^ 2) private noncomputable def bopF0 (x : ℝ) : ℝ := (binEntropy (x ^ 2) - Real.goldenRatio * x * binEntropy x) / x ^ 2 private lemma goldenRatio_bounds : (16 : ℝ) / 10 < Real.goldenRatio ∧ Real.goldenRatio < 17 / 10 := by have h5_lo : (22 : ℝ) / 10 < Real.sqrt 5 := by rw [← Real.sqrt_sq (by norm_num : (0 : ℝ) ≤ 22 / 10)] exact Real.sqrt_lt_sqrt (by norm_num) (by norm_num) have h5_hi : Real.sqrt 5 < 24 / 10 := by rw [← Real.sqrt_sq (by norm_num : (0 : ℝ) ≤ 24 / 10)] exact Real.sqrt_lt_sqrt (by norm_num) (by norm_num) rw [Real.goldenRatio] constructor <;> linarith private lemma inv_goldenRatio_mem : 0 < Real.goldenRatio⁻¹ ∧ Real.goldenRatio⁻¹ < 1 := by have hφ := goldenRatio_bounds exact ⟨inv_pos.mpr (by linarith), inv_lt_one_of_one_lt₀ (by linarith)⟩ private lemma hasDerivAt_bopN {x : ℝ} (hx0 : -1 < x) (hx1 : x < 1) : HasDerivAt bopN (bopN' x) x := by have h1px : 0 < 1 + x := by linarith have h1mx : 0 < 1 - x := by linarith have h1 : HasDerivAt (fun t : ℝ => 2 * Real.log (1 + t)) (2 / (1 + x)) x := by have ha : HasDerivAt (fun t : ℝ => 1 + t) 1 x := by simpa using (hasDerivAt_id x).const_add (1 : ℝ) exact ((ha.log h1px.ne').const_mul 2).congr_deriv (by ring) have h2a : HasDerivAt (fun t : ℝ => 2 - Real.goldenRatio * t) (-Real.goldenRatio) x := by simpa using ((hasDerivAt_id x).const_mul Real.goldenRatio).const_sub (2 : ℝ) have h2b : HasDerivAt (fun t : ℝ => Real.log (1 - t)) (-1 / (1 - x)) x := by have hb : HasDerivAt (fun t : ℝ => 1 - t) (-1) x := by simpa using (hasDerivAt_id x).const_sub (1 : ℝ) exact (hb.log h1mx.ne').congr_deriv (by ring) have h2 := h2a.mul h2b unfold bopN bopN' exact (h1.add h2).congr_deriv (by ring) private lemma hasDerivAt_bopN' {x : ℝ} (hx0 : -1 < x) (hx1 : x < 1) : HasDerivAt bopN' (bopN'' x) x := by have h1px : 0 < 1 + x := by linarith have h1mx : 0 < 1 - x := by linarith have h1 : HasDerivAt (fun t : ℝ => 2 / (1 + t)) (-2 / (1 + x) ^ 2) x := by have ha : HasDerivAt (fun t : ℝ => 1 + t) 1 x := by simpa using (hasDerivAt_id x).const_add (1 : ℝ) exact ((hasDerivAt_const x (2 : ℝ)).div ha h1px.ne').congr_deriv (by ring) have h2 : HasDerivAt (fun t : ℝ => Real.goldenRatio * Real.log (1 - t)) (-Real.goldenRatio / (1 - x)) x := by have hb : HasDerivAt (fun t : ℝ => 1 - t) (-1) x := by simpa using (hasDerivAt_id x).const_sub (1 : ℝ) exact ((hb.log h1mx.ne').const_mul Real.goldenRatio).congr_deriv (by ring) have h3 : HasDerivAt (fun t : ℝ => (2 - Real.goldenRatio * t) / (1 - t)) ((2 - Real.goldenRatio) / (1 - x) ^ 2) x := by have hnum : HasDerivAt (fun t : ℝ => 2 - Real.goldenRatio * t) (-Real.goldenRatio) x := by simpa using ((hasDerivAt_id x).const_mul Real.goldenRatio).const_sub (2 : ℝ) have hden : HasDerivAt (fun t : ℝ => 1 - t) (-1) x := by simpa using (hasDerivAt_id x).const_sub (1 : ℝ) refine (hnum.div hden h1mx.ne').congr_deriv ?_ field_simp [h1mx.ne'] ring unfold bopN' bopN'' bopP refine ((h1.sub h2).sub h3).congr_deriv ?_ field_simp [h1px.ne', h1mx.ne'] ring private lemma strictConcaveOn_bopP : StrictConcaveOn ℝ (Set.Icc (0 : ℝ) 1) bopP := by have hφ : 0 < Real.goldenRatio := Real.goldenRatio_pos have hcont : ContinuousOn bopP (Set.Icc 0 1) := by unfold bopP; fun_prop refine strictConcaveOn_of_deriv2_neg (convex_Icc 0 1) hcont ?_ intro x hx rw [interior_Icc] at hx have hd1 : ∀ t : ℝ, HasDerivAt bopP (-3 * Real.goldenRatio * t ^ 2 - 8 * t + 3 * Real.goldenRatio) t := fun t => by unfold bopP have h3 := (hasDerivAt_pow 3 t).const_mul (-Real.goldenRatio) have h2 := (hasDerivAt_pow 2 t).const_mul (4 : ℝ) have h1 := (hasDerivAt_id t).const_mul (3 * Real.goldenRatio) have h0 := hasDerivAt_const t (2 * Real.goldenRatio - 4) exact (((h3.sub h2).add h1).add h0).congr_deriv (by ring) have hderiv : deriv bopP = fun t => -3 * Real.goldenRatio * t ^ 2 - 8 * t + 3 * Real.goldenRatio := funext fun t => (hd1 t).deriv have hd2 : HasDerivAt (fun t : ℝ => -3 * Real.goldenRatio * t ^ 2 - 8 * t + 3 * Real.goldenRatio) (-6 * Real.goldenRatio * x - 8) x := by have h2 := (hasDerivAt_pow 2 x).const_mul (-3 * Real.goldenRatio) have h1 := (hasDerivAt_id x).const_mul (8 : ℝ) have h0 := hasDerivAt_const x (3 * Real.goldenRatio) exact ((h2.sub h1).add h0).congr_deriv (by ring) simp only [Function.iterate_succ, Function.iterate_zero, Function.id_comp, Function.comp_apply] rw [hderiv, hd2.deriv] nlinarith [hx.1] private lemma bopN_inv_goldenRatio : bopN (Real.goldenRatio⁻¹) = 0 := by have hφ_pos : 0 < Real.goldenRatio := Real.goldenRatio_pos have h5 : Real.sqrt 5 ^ 2 = 5 := Real.sq_sqrt (by norm_num) have h1 : 1 + Real.goldenRatio⁻¹ = Real.goldenRatio := by field_simp [hφ_pos.ne'] nlinarith [h5] have h2 : 1 - Real.goldenRatio⁻¹ = (Real.goldenRatio ^ 2)⁻¹ := by field_simp [hφ_pos.ne'] nlinarith [h5] have h3 : 2 - Real.goldenRatio * Real.goldenRatio⁻¹ = 1 := by rw [mul_inv_cancel₀ hφ_pos.ne']; ring unfold bopN rw [h1, h2, h3, Real.log_inv, Real.log_pow] ring private lemma bopN'_inv_goldenRatio_pos : 0 < bopN' (Real.goldenRatio⁻¹) := by have hφ_pos : 0 < Real.goldenRatio := Real.goldenRatio_pos have hφ_b := goldenRatio_bounds have h5 : Real.sqrt 5 ^ 2 = 5 := Real.sq_sqrt (by norm_num) have h1 : 1 + Real.goldenRatio⁻¹ = Real.goldenRatio := by field_simp [hφ_pos.ne']; nlinarith [h5] have h2 : 1 - Real.goldenRatio⁻¹ = (Real.goldenRatio ^ 2)⁻¹ := by field_simp [hφ_pos.ne']; nlinarith [h5] have h3 : 2 - Real.goldenRatio * Real.goldenRatio⁻¹ = 1 := by rw [mul_inv_cancel₀ hφ_pos.ne']; ring have hval : bopN' (Real.goldenRatio⁻¹) = 2 * Real.goldenRatio * Real.log Real.goldenRatio + Real.goldenRatio - 3 := by unfold bopN' rw [h1, h2, h3, Real.log_inv, Real.log_pow] have h4 : 2 / Real.goldenRatio - 1 / (Real.goldenRatio ^ 2)⁻¹ = Real.goldenRatio - 3 := by have h53 : Real.sqrt 5 ^ 3 = 5 * Real.sqrt 5 := by rw [pow_succ, h5] field_simp [hφ_pos.ne'] nlinarith [h5, h53] linarith [show -(Real.goldenRatio * -((2 : ℕ) * Real.log Real.goldenRatio)) = 2 * Real.goldenRatio * Real.log Real.goldenRatio by push_cast; ring] rw [hval] let t := (Real.goldenRatio - 1) / (Real.goldenRatio + 1) have ht0 : 0 < t := div_pos (by linarith) (by linarith) have ht1 : t < 1 := (div_lt_one (by linarith)).mpr (by linarith) have hlog_lb : 2 * t ≤ Real.log Real.goldenRatio := by have hlow := artanhLower_le_log ht0.le ht1 have hratio : (1 + t) / (1 - t) = Real.goldenRatio := by have h1mt : 1 - t ≠ 0 := by linarith rw [div_eq_iff h1mt] simp only [t] field_simp [(by linarith : Real.goldenRatio + 1 ≠ 0)] ring rw [hratio] at hlow have h2t : 2 * t ≤ artanhLower t := by unfold artanhLower nlinarith [pow_pos ht0 3, pow_pos ht0 5] linarith have h2t_lb' : (46 : ℝ) / 100 < 2 * t := by have hden : 0 < Real.goldenRatio + 1 := by linarith have heq : 2 * t = (2 * Real.goldenRatio - 2) / (Real.goldenRatio + 1) := by simp only [t]; ring rw [heq, lt_div_iff₀ hden] linarith [hφ_b.1] nlinarith [hlog_lb, h2t_lb', hφ_b.1] private lemma bopF0_inv_goldenRatio : bopF0 (Real.goldenRatio⁻¹) = 0 := by have hφ_pos : 0 < Real.goldenRatio := Real.goldenRatio_pos have h5 : Real.sqrt 5 ^ 2 = 5 := Real.sq_sqrt (by norm_num) have h1 : (Real.goldenRatio⁻¹) ^ 2 = 1 - Real.goldenRatio⁻¹ := by field_simp [hφ_pos.ne']; nlinarith [h5] have h2 : Real.goldenRatio * Real.goldenRatio⁻¹ = 1 := mul_inv_cancel₀ hφ_pos.ne' unfold bopF0 rw [h1, binEntropy_symm, h2, one_mul, sub_self, zero_div] private lemma bopF0_one : bopF0 1 = 0 := by simp [bopF0] private lemma hasDerivAt_bopF0 {x : ℝ} (hx0 : 0 < x) (hx1 : x < 1) : HasDerivAt bopF0 (bopN x / x ^ 3) x := by have h1mx : 0 < 1 - x := sub_pos.mpr hx1 have h1px : 0 < 1 + x := by linarith have h1mx2 : 0 < 1 - x ^ 2 := by nlinarith have hF_eq : ∀ t ∈ Set.Ioo (0 : ℝ) 1, bopF0 t = (Real.goldenRatio - 2) * Real.log t - (1 / t ^ 2 - 1) * Real.log (1 + t) + (-1 / t ^ 2 + Real.goldenRatio / t - (Real.goldenRatio - 1)) * Real.log (1 - t) := by intro t ht have ht0 : 0 < t := ht.1 have ht1 : t < 1 := ht.2 have h1mt : 0 < 1 - t := sub_pos.mpr ht1 have h1pt : 0 < 1 + t := by linarith have hlog_sq : Real.log (t ^ 2) = 2 * Real.log t := by rw [Real.log_pow]; norm_num have hlog_1mt2 : Real.log (1 - t ^ 2) = Real.log (1 - t) + Real.log (1 + t) := by have : 1 - t ^ 2 = (1 - t) * (1 + t) := by ring rw [this, Real.log_mul h1mt.ne' h1pt.ne'] unfold bopF0 rw [binEntropy_def, binEntropy_def, hlog_sq, hlog_1mt2] field_simp [ht0.ne'] ring let G : ℝ → ℝ := fun t => (Real.goldenRatio - 2) * Real.log t - (1 / t ^ 2 - 1) * Real.log (1 + t) + (-1 / t ^ 2 + Real.goldenRatio / t - (Real.goldenRatio - 1)) * Real.log (1 - t) have hG_deriv : HasDerivAt G (bopN x / x ^ 3) x := by have hd1 : HasDerivAt (fun t : ℝ => (Real.goldenRatio - 2) * Real.log t) ((Real.goldenRatio - 2) / x) x := by exact ((Real.hasDerivAt_log hx0.ne').const_mul (Real.goldenRatio - 2)).congr_deriv (by ring) have hinv2 : HasDerivAt (fun t : ℝ => 1 / t ^ 2) (-2 / x ^ 3) x := by refine ((hasDerivAt_const x (1 : ℝ)).div (hasDerivAt_pow 2 x) (pow_pos hx0 2).ne').congr_deriv ?_ field_simp [hx0.ne']; ring have hinv1 : HasDerivAt (fun t : ℝ => 1 / t) (-1 / x ^ 2) x := by refine ((hasDerivAt_const x (1 : ℝ)).div (hasDerivAt_id x) hx0.ne').congr_deriv ?_ simp only [id_eq] field_simp [hx0.ne']; ring have hd2a : HasDerivAt (fun t : ℝ => 1 / t ^ 2 - 1) (-2 / x ^ 3) x := hinv2.sub_const 1 have hd2b : HasDerivAt (fun t : ℝ => Real.log (1 + t)) (1 / (1 + x)) x := by have ha : HasDerivAt (fun t : ℝ => 1 + t) 1 x := by simpa using (hasDerivAt_id x).const_add (1 : ℝ) exact (ha.log h1px.ne').congr_deriv (by ring) have hd2 := hd2a.mul hd2b have hd3a : HasDerivAt (fun t : ℝ => -1 / t ^ 2 + Real.goldenRatio / t - (Real.goldenRatio - 1)) (2 / x ^ 3 - Real.goldenRatio / x ^ 2) x := by have ha : HasDerivAt (fun t : ℝ => -1 / t ^ 2) (2 / x ^ 3) x := by have : (fun t : ℝ => -1 / t ^ 2) = (fun t : ℝ => -(1 / t ^ 2)) := by ext t; ring rw [this] exact hinv2.neg.congr_deriv (by ring) have hb : HasDerivAt (fun t : ℝ => Real.goldenRatio / t) (-Real.goldenRatio / x ^ 2) x := by have : (fun t : ℝ => Real.goldenRatio / t) = (fun t : ℝ => Real.goldenRatio * (1 / t)) := by ext t; ring rw [this] exact (hinv1.const_mul Real.goldenRatio).congr_deriv (by ring) exact ((ha.add hb).sub_const (Real.goldenRatio - 1)).congr_deriv (by ring) have hd3b : HasDerivAt (fun t : ℝ => Real.log (1 - t)) (-1 / (1 - x)) x := by have hb : HasDerivAt (fun t : ℝ => 1 - t) (-1) x := by simpa using (hasDerivAt_id x).const_sub (1 : ℝ) exact (hb.log h1mx.ne').congr_deriv (by ring) have hd3 := hd3a.mul hd3b unfold G bopN refine ((hd1.sub hd2).add hd3).congr_deriv ?_ field_simp [hx0.ne', h1px.ne', h1mx.ne'] ring refine hG_deriv.congr_of_eventuallyEq ?_ filter_upwards [Ioo_mem_nhds hx0 hx1] with t ht exact hF_eq t ht /-- **Theorem (Exact Symmetric Boppana Entropy Inequality)**: For all `x ∈ [0, 1]`, `φ * x * h(x) ≤ h(x^2)` where `φ = (1 + √5) / 2`. -/ theorem boppana_binEntropy {x : ℝ} (hx0 : 0 ≤ x) (hx1 : x ≤ 1) : Real.goldenRatio * x * binEntropy x ≤ binEntropy (x ^ 2) := by rcases eq_or_lt_of_le hx0 with rfl | hx_pos · simp rcases eq_or_lt_of_le hx1 with rfl | hx_lt · simp suffices hF : 0 ≤ bopF0 x by unfold bopF0 at hF have := (le_div_iff₀ (sq_pos_of_pos hx_pos)).mp hF linarith have hφ_b := goldenRatio_bounds have hinv_m := inv_goldenRatio_mem let x₀ := Real.goldenRatio⁻¹ -- Step 1: Locate the two roots r₁ ∈ (0, x₀) and r₂ ∈ (x₀, 1) of the strictly concave cubic bopP have hP0 : bopP 0 < 0 := by unfold bopP; linarith [hφ_b.2] have hP1 : bopP 1 < 0 := by unfold bopP; linarith [hφ_b.2] have hPx0 : 0 < bopP x₀ := by have hφ_pos : 0 < Real.goldenRatio := Real.goldenRatio_pos have h5 : Real.sqrt 5 ^ 2 = 5 := Real.sq_sqrt (by norm_num) have hval : bopP x₀ = 7 * Real.goldenRatio - 11 := by unfold bopP; simp only [x₀] field_simp [hφ_pos.ne'] nlinarith [h5] rw [hval]; linarith [hφ_b.1] have hP_cont : ContinuousOn bopP (Set.Icc 0 1) := by unfold bopP; fun_prop obtain ⟨r₁, hr₁_mem, hr₁_zero⟩ := intermediate_value_Icc hinv_m.1.le (hP_cont.mono (Set.Icc_subset_Icc le_rfl hinv_m.2.le)) ⟨hP0.le, hPx0.le⟩ obtain ⟨r₂, hr₂_mem, hr₂_zero⟩ := intermediate_value_Icc' hinv_m.2.le (hP_cont.mono (Set.Icc_subset_Icc hinv_m.1.le le_rfl)) ⟨hP1.le, hPx0.le⟩ have hr₁_pos : 0 < r₁ := lt_of_le_of_ne hr₁_mem.1 (by rintro rfl; linarith) have hr₁_lt : r₁ < x₀ := lt_of_le_of_ne hr₁_mem.2 (by rintro rfl; linarith) have hr₂_gt : x₀ < r₂ := lt_of_le_of_ne hr₂_mem.1 (by rintro rfl; linarith) have hr₂_lt : r₂ < 1 := lt_of_le_of_ne hr₂_mem.2 (by rintro rfl; linarith) have hP_neg_left : ∀ t ∈ Set.Ico 0 r₁, bopP t < 0 := by intro t ht by_contra hge; push Not at hge have hlt := strictConcaveOn_bopP.2 ⟨ht.1, ht.2.le.trans (hr₁_lt.le.trans hinv_m.2.le)⟩ ⟨hinv_m.1.le, hinv_m.2.le⟩ (ne_of_lt (ht.2.trans hr₁_lt)) (div_pos (sub_pos.mpr hr₁_lt) (sub_pos.mpr (ht.2.trans hr₁_lt))) (div_pos (sub_pos.mpr ht.2) (sub_pos.mpr (ht.2.trans hr₁_lt))) (by field_simp [(sub_pos.mpr (ht.2.trans hr₁_lt)).ne']; ring) have hcomb : ((x₀ - r₁) / (x₀ - t)) • t + ((r₁ - t) / (x₀ - t)) • x₀ = r₁ := by simp only [smul_eq_mul]; field_simp [(sub_pos.mpr (ht.2.trans hr₁_lt)).ne']; ring rw [hcomb, hr₁_zero] at hlt simp only [smul_eq_mul] at hlt have h1 : 0 ≤ (x₀ - r₁) / (x₀ - t) * bopP t := mul_nonneg (div_nonneg (sub_pos.mpr hr₁_lt).le (sub_pos.mpr (ht.2.trans hr₁_lt)).le) hge have h2 : 0 < (r₁ - t) / (x₀ - t) * bopP x₀ := mul_pos (div_pos (sub_pos.mpr ht.2) (sub_pos.mpr (ht.2.trans hr₁_lt))) hPx0 linarith have hP_pos_mid : ∀ t ∈ Set.Ioo r₁ r₂, 0 < bopP t := by intro t ht have hlt := strictConcaveOn_bopP.2 ⟨hr₁_pos.le, hr₁_lt.le.trans hinv_m.2.le⟩ ⟨hinv_m.1.le.trans hr₂_gt.le, hr₂_lt.le⟩ (ne_of_lt (ht.1.trans ht.2)) (div_pos (sub_pos.mpr ht.2) (sub_pos.mpr (ht.1.trans ht.2))) (div_pos (sub_pos.mpr ht.1) (sub_pos.mpr (ht.1.trans ht.2))) (by field_simp [(sub_pos.mpr (ht.1.trans ht.2)).ne']; ring) have hcomb : ((r₂ - t) / (r₂ - r₁)) • r₁ + ((t - r₁) / (r₂ - r₁)) • r₂ = t := by simp only [smul_eq_mul]; field_simp [(sub_pos.mpr (ht.1.trans ht.2)).ne']; ring rw [hcomb, hr₁_zero, hr₂_zero] at hlt simp only [smul_eq_mul, mul_zero, add_zero] at hlt exact hlt have hP_neg_right : ∀ t ∈ Set.Ioc r₂ 1, bopP t < 0 := by intro t ht by_contra hge; push Not at hge have hlt := strictConcaveOn_bopP.2 ⟨hinv_m.1.le, hinv_m.2.le⟩ ⟨hinv_m.1.le.trans (hr₂_gt.le.trans ht.1.le), ht.2⟩ (ne_of_lt (hr₂_gt.trans ht.1)) (div_pos (sub_pos.mpr ht.1) (sub_pos.mpr (hr₂_gt.trans ht.1))) (div_pos (sub_pos.mpr hr₂_gt) (sub_pos.mpr (hr₂_gt.trans ht.1))) (by field_simp [(sub_pos.mpr (hr₂_gt.trans ht.1)).ne']; ring) have hcomb : ((t - r₂) / (t - x₀)) • x₀ + ((r₂ - x₀) / (t - x₀)) • t = r₂ := by simp only [smul_eq_mul]; field_simp [(sub_pos.mpr (hr₂_gt.trans ht.1)).ne']; ring rw [hcomb, hr₂_zero] at hlt simp only [smul_eq_mul] at hlt have h1 : 0 < (t - r₂) / (t - x₀) * bopP x₀ := mul_pos (div_pos (sub_pos.mpr ht.1) (sub_pos.mpr (hr₂_gt.trans ht.1))) hPx0 have h2 : 0 ≤ (r₂ - x₀) / (t - x₀) * bopP t := mul_nonneg (div_nonneg (sub_pos.mpr hr₂_gt).le (sub_pos.mpr (hr₂_gt.trans ht.1)).le) hge linarith -- Step 2: Monotonicity of bopN' on [0, r₁], [r₁, r₂], [r₂, 1) have hN'_cont : ContinuousOn bopN' (Set.Ico 0 1) := fun t ht => (hasDerivAt_bopN' (by linarith [ht.1]) ht.2).continuousAt.continuousWithinAt have hN'_anti_left : StrictAntiOn bopN' (Set.Icc 0 r₁) := by refine strictAntiOn_of_deriv_neg (convex_Icc 0 r₁) (hN'_cont.mono (Set.Icc_subset_Ico_right (hr₁_lt.trans hinv_m.2))) ?_ intro t ht; rw [interior_Icc] at ht rw [(hasDerivAt_bopN' (by linarith [ht.1]) (ht.2.trans (hr₁_lt.trans hinv_m.2))).deriv] unfold bopN'' exact div_neg_of_neg_of_pos (hP_neg_left t ⟨ht.1.le, ht.2⟩) (mul_pos (sq_pos_of_pos (by linarith [ht.1])) (sq_pos_of_pos (by linarith [ht.2, hr₁_lt, hinv_m.2]))) have hN'_mono_mid : StrictMonoOn bopN' (Set.Icc r₁ r₂) := by refine strictMonoOn_of_deriv_pos (convex_Icc r₁ r₂) (hN'_cont.mono (fun t ht => ⟨hr₁_pos.le.trans ht.1, ht.2.trans_lt hr₂_lt⟩)) ?_ intro t ht; rw [interior_Icc] at ht rw [(hasDerivAt_bopN' (by linarith [hr₁_pos, ht.1]) (ht.2.trans hr₂_lt)).deriv] unfold bopN'' exact div_pos (hP_pos_mid t ht) (mul_pos (sq_pos_of_pos (by linarith [hr₁_pos, ht.1])) (sq_pos_of_pos (by linarith [ht.2, hr₂_lt]))) have hN'_anti_right : StrictAntiOn bopN' (Set.Ico r₂ 1) := by refine strictAntiOn_of_deriv_neg (convex_Ico r₂ 1) (hN'_cont.mono (fun t ht => ⟨hinv_m.1.le.trans (hr₂_gt.le.trans ht.1), ht.2⟩)) ?_ intro t ht; rw [interior_Ico] at ht rw [(hasDerivAt_bopN' (by linarith [hinv_m.1, hr₂_gt, ht.1]) ht.2).deriv] unfold bopN'' exact div_neg_of_neg_of_pos (hP_neg_right t ⟨ht.1, ht.2.le⟩) (mul_pos (sq_pos_of_pos (by linarith [hinv_m.1, hr₂_gt, ht.1])) (sq_pos_of_pos (by linarith [ht.2]))) -- Step 3: Sign of bopN on (0, x₀] and [x₀, 1) have hN0 : bopN 0 = 0 := by simp [bopN] have hN'0 : bopN' 0 = 0 := by simp [bopN'] have hN'_r1_neg : bopN' r₁ < 0 := hN'0 ▸ hN'_anti_left ⟨le_rfl, hr₁_pos.le⟩ ⟨hr₁_pos.le, le_rfl⟩ hr₁_pos have hN'_x0_pos : 0 < bopN' x₀ := bopN'_inv_goldenRatio_pos obtain ⟨s₁, hs₁_mem, hs₁_zero⟩ := intermediate_value_Icc hr₁_lt.le (hN'_cont.mono (fun t ht => ⟨hr₁_pos.le.trans ht.1, ht.2.trans_lt hinv_m.2⟩)) ⟨hN'_r1_neg.le, hN'_x0_pos.le⟩ have hs₁_gt : r₁ < s₁ := lt_of_le_of_ne hs₁_mem.1 (by rintro rfl; linarith) have hs₁_lt : s₁ < x₀ := lt_of_le_of_ne hs₁_mem.2 (by rintro rfl; linarith) have hN_cont : ContinuousOn bopN (Set.Ico 0 1) := fun t ht => (hasDerivAt_bopN (by linarith [ht.1]) ht.2).continuousAt.continuousWithinAt have hN_anti_left : AntitoneOn bopN (Set.Icc 0 s₁) := by refine antitoneOn_of_deriv_nonpos (convex_Icc 0 s₁) (hN_cont.mono (Set.Icc_subset_Ico_right (hs₁_lt.trans hinv_m.2))) ?_ ?_ · intro t ht; rw [interior_Icc] at ht exact (hasDerivAt_bopN (by linarith [ht.1]) (ht.2.trans (hs₁_lt.trans hinv_m.2))).differentiableAt.differentiableWithinAt · intro t ht; rw [interior_Icc] at ht rw [(hasDerivAt_bopN (by linarith [ht.1]) (ht.2.trans (hs₁_lt.trans hinv_m.2))).deriv] rcases le_or_gt t r₁ with htr | hrt · exact (hN'_anti_left ⟨le_rfl, hr₁_pos.le⟩ ⟨ht.1.le, htr⟩ ht.1).le.trans hN'0.le · exact (hN'_mono_mid ⟨hrt.le, ht.2.le.trans (hs₁_lt.le.trans hr₂_gt.le)⟩ ⟨hs₁_gt.le, hs₁_lt.le.trans hr₂_gt.le⟩ ht.2).le.trans hs₁_zero.le have hN_mono_s1_r2 : MonotoneOn bopN (Set.Icc s₁ r₂) := by refine monotoneOn_of_deriv_nonneg (convex_Icc s₁ r₂) (hN_cont.mono (fun t ht => ⟨(hr₁_pos.trans hs₁_gt).le.trans ht.1, ht.2.trans_lt hr₂_lt⟩)) ?_ ?_ · intro t ht; rw [interior_Icc] at ht exact (hasDerivAt_bopN (by linarith [hr₁_pos, hs₁_gt, ht.1]) (ht.2.trans hr₂_lt)).differentiableAt.differentiableWithinAt · intro t ht; rw [interior_Icc] at ht rw [(hasDerivAt_bopN (by linarith [hr₁_pos, hs₁_gt, ht.1]) (ht.2.trans hr₂_lt)).deriv] exact hs₁_zero.ge.trans (hN'_mono_mid ⟨hs₁_gt.le, hs₁_lt.le.trans hr₂_gt.le⟩ ⟨hs₁_gt.le.trans ht.1.le, ht.2.le⟩ ht.1).le have hN_nonpos_left : ∀ t ∈ Set.Icc 0 x₀, bopN t ≤ 0 := by intro t ht rcases le_or_gt t s₁ with hts | hst · exact (hN_anti_left ⟨le_rfl, (hr₁_pos.trans hs₁_gt).le⟩ ⟨ht.1, hts⟩ ht.1).trans hN0.le · exact (hN_mono_s1_r2 ⟨hst.le, ht.2.trans hr₂_gt.le⟩ ⟨hs₁_lt.le, hr₂_gt.le⟩ ht.2).trans bopN_inv_goldenRatio.le -- Step 4: Conclude bopF0 x ≥ 0 in all cases! have hF0_cont : ContinuousOn bopF0 (Set.Ioc 0 1) := by intro t ht unfold bopF0 have hnum : ContinuousAt (fun s => binEntropy (s ^ 2) - Real.goldenRatio * s * binEntropy s) t := (continuous_binEntropy.comp (continuous_pow 2)).sub ((continuous_const.mul continuous_id).mul continuous_binEntropy) |>.continuousAt exact (hnum.div (continuousAt_pow t 2) (pow_pos ht.1 2).ne').continuousWithinAt rcases le_or_gt x x₀ with hxx₀ | hx₀x · -- x ∈ (0, x₀]: bopF0 is antitone on [x, x₀] since bopN ≤ 0 have hanti : AntitoneOn bopF0 (Set.Icc x x₀) := by refine antitoneOn_of_deriv_nonpos (convex_Icc x x₀) (hF0_cont.mono (fun t ht => ⟨hx_pos.trans_le ht.1, ht.2.trans hinv_m.2.le⟩)) ?_ ?_ · intro t ht; rw [interior_Icc] at ht exact (hasDerivAt_bopF0 (hx_pos.trans ht.1) (ht.2.trans hinv_m.2)).differentiableAt.differentiableWithinAt · intro t ht; rw [interior_Icc] at ht rw [(hasDerivAt_bopF0 (hx_pos.trans ht.1) (ht.2.trans hinv_m.2)).deriv] exact div_nonpos_of_nonpos_of_nonneg (hN_nonpos_left t ⟨(hx_pos.trans ht.1).le, ht.2.le⟩) (pow_nonneg (hx_pos.trans ht.1).le 3) exact bopF0_inv_goldenRatio.ge.trans (hanti ⟨le_rfl, hxx₀⟩ ⟨hxx₀, le_rfl⟩ hxx₀) · -- x ∈ (x₀, 1): split on whether bopN x ≥ 0 or bopN x < 0 -- First show bopN is unimodal on [x₀, 1): either monotone everywhere on [x₀, 1), or increases to s₂ then decreases have hN_pos_x0_r2 : ∀ t ∈ Set.Icc x₀ r₂, 0 ≤ bopN t := fun t ht => bopN_inv_goldenRatio.ge.trans (hN_mono_s1_r2 ⟨hs₁_lt.le, hr₂_gt.le⟩ ⟨hs₁_lt.le.trans ht.1, ht.2⟩ ht.1) have hN_nonneg_of_x : (0 ≤ bopN x) → ∀ t ∈ Set.Icc x₀ x, 0 ≤ bopN t := by intro hNx t ht rcases le_or_gt t r₂ with htr2 | hr2t · exact hN_pos_x0_r2 t ⟨ht.1, htr2⟩ · -- t ∈ (r₂, x]: bopN' is strictly antitone on [r₂, 1), so bopN is concave on [r₂, x]! have hconc : ConcaveOn ℝ (Set.Icc r₂ x) bopN := by refine concaveOn_of_deriv2_nonpos (convex_Icc r₂ x) (hN_cont.mono (fun u hu => ⟨hinv_m.1.le.trans (hr₂_gt.le.trans hu.1), hu.2.trans_lt hx_lt⟩)) ?_ ?_ ?_ · intro u hu; rw [interior_Icc] at hu exact (hasDerivAt_bopN (by linarith [hinv_m.1, hr₂_gt, hu.1]) (hu.2.trans hx_lt)).differentiableAt.differentiableWithinAt · intro u hu; rw [interior_Icc] at hu have hderiv : deriv bopN =ᶠ[nhds u] bopN' := by filter_upwards [Ioo_mem_nhds (by linarith [hinv_m.1, hr₂_gt, hu.1] : -1 < u) (hu.2.trans hx_lt)] with v hv exact (hasDerivAt_bopN hv.1 hv.2).deriv exact (hasDerivAt_bopN' (by linarith [hinv_m.1, hr₂_gt, hu.1]) (hu.2.trans hx_lt)).congr_of_eventuallyEq hderiv |>.differentiableAt.differentiableWithinAt · intro u hu; rw [interior_Icc] at hu have hderiv : deriv bopN =ᶠ[nhds u] bopN' := by filter_upwards [Ioo_mem_nhds (by linarith [hinv_m.1, hr₂_gt, hu.1] : -1 < u) (hu.2.trans hx_lt)] with v hv exact (hasDerivAt_bopN hv.1 hv.2).deriv simp only [Function.iterate_succ, Function.iterate_zero, Function.id_comp, Function.comp_apply] rw [hderiv.deriv_eq, (hasDerivAt_bopN' (by linarith [hinv_m.1, hr₂_gt, hu.1]) (hu.2.trans hx_lt)).deriv] unfold bopN'' exact (div_neg_of_neg_of_pos (hP_neg_right u ⟨hu.1, (hu.2.trans hx_lt).le⟩) (mul_pos (sq_pos_of_pos (by linarith [hinv_m.1, hr₂_gt, hu.1])) (sq_pos_of_pos (by linarith [hu.2, hx_lt])))).le have hxr2 : r₂ < x := hr2t.trans_le ht.2 have hle := hconc.2 ⟨le_rfl, hxr2.le⟩ ⟨hxr2.le, le_rfl⟩ (div_nonneg (sub_nonneg.mpr ht.2) (sub_pos.mpr hxr2).le) (div_nonneg (sub_pos.mpr hr2t).le (sub_pos.mpr hxr2).le) (by field_simp [(sub_pos.mpr hxr2).ne']; ring) have hcomb : ((x - t) / (x - r₂)) • r₂ + ((t - r₂) / (x - r₂)) • x = t := by simp only [smul_eq_mul]; field_simp [(sub_pos.mpr hxr2).ne']; ring rw [hcomb] at hle simp only [smul_eq_mul] at hle have hr2_nn : 0 ≤ bopN r₂ := hN_pos_x0_r2 r₂ ⟨hr₂_gt.le, le_rfl⟩ have h1 : 0 ≤ (x - t) / (x - r₂) * bopN r₂ := mul_nonneg (div_nonneg (sub_nonneg.mpr ht.2) (sub_pos.mpr hxr2).le) hr2_nn have h2 : 0 ≤ (t - r₂) / (x - r₂) * bopN x := mul_nonneg (div_nonneg (sub_pos.mpr hr2t).le (sub_pos.mpr hxr2).le) hNx linarith rcases le_or_gt 0 (bopN x) with hNx_nn | hNx_neg · have hmono : MonotoneOn bopF0 (Set.Icc x₀ x) := by refine monotoneOn_of_deriv_nonneg (convex_Icc x₀ x) (hF0_cont.mono (fun t ht => ⟨hinv_m.1.trans_le ht.1, ht.2.trans hx_lt.le⟩)) ?_ ?_ · intro t ht; rw [interior_Icc] at ht exact (hasDerivAt_bopF0 (hinv_m.1.trans ht.1) (ht.2.trans hx_lt)).differentiableAt.differentiableWithinAt · intro t ht; rw [interior_Icc] at ht rw [(hasDerivAt_bopF0 (hinv_m.1.trans ht.1) (ht.2.trans hx_lt)).deriv] exact div_nonneg (hN_nonneg_of_x hNx_nn t ⟨ht.1.le, ht.2.le⟩) (pow_nonneg (hinv_m.1.trans ht.1).le 3) exact bopF0_inv_goldenRatio.ge.trans (hmono ⟨le_rfl, hx₀x.le⟩ ⟨hx₀x.le, le_rfl⟩ hx₀x.le) · -- bopN x < 0: must have r₂ < x, and since bopN r₂ ≥ 0 > bopN x, MVT gives some c ∈ (r₂, x) with bopN' c < 0, -- hence bopN' < 0 on [x, 1), hence bopN < 0 on [x, 1), hence bopF0 is antitone on [x, 1] so bopF0 x ≥ bopF0 1 = 0! have hr2_lt_x : r₂ < x := by by_contra hle; push Not at hle linarith [hN_pos_x0_r2 x ⟨hx₀x.le, hle⟩] have hr2_nn : 0 ≤ bopN r₂ := hN_pos_x0_r2 r₂ ⟨hr₂_gt.le, le_rfl⟩ obtain ⟨c, hc_mem, hc_eq⟩ := exists_deriv_eq_slope bopN hr2_lt_x (hN_cont.mono (fun t ht => ⟨hinv_m.1.le.trans (hr₂_gt.le.trans ht.1), ht.2.trans_lt hx_lt⟩)) (fun t ht => (hasDerivAt_bopN (by linarith [hinv_m.1, hr₂_gt, ht.1]) (ht.2.trans hx_lt)).differentiableAt.differentiableWithinAt) have hc_neg : bopN' c < 0 := by rw [← (hasDerivAt_bopN (by linarith [hinv_m.1, hr₂_gt, hc_mem.1]) (hc_mem.2.trans hx_lt)).deriv, hc_eq] exact div_neg_of_neg_of_pos (by linarith) (sub_pos.mpr hr2_lt_x) have hN_anti_x1 : AntitoneOn bopN (Set.Ico x 1) := by refine antitoneOn_of_deriv_nonpos (convex_Ico x 1) (hN_cont.mono (fun t ht => ⟨hx_pos.le.trans ht.1, ht.2⟩)) ?_ ?_ · intro t ht; rw [interior_Ico] at ht exact (hasDerivAt_bopN (by linarith [hx_pos, ht.1]) ht.2).differentiableAt.differentiableWithinAt · intro t ht; rw [interior_Ico] at ht rw [(hasDerivAt_bopN (by linarith [hx_pos, ht.1]) ht.2).deriv] exact (hN'_anti_right ⟨hc_mem.1.le, hc_mem.2.trans hx_lt⟩ ⟨hr2_lt_x.le.trans ht.1.le, ht.2⟩ (hc_mem.2.trans ht.1)).le.trans hc_neg.le have hanti_F0 : AntitoneOn bopF0 (Set.Icc x 1) := by refine antitoneOn_of_deriv_nonpos (convex_Icc x 1) (hF0_cont.mono (fun t ht => ⟨hx_pos.trans_le ht.1, ht.2⟩)) ?_ ?_ · intro t ht; rw [interior_Icc] at ht exact (hasDerivAt_bopF0 (hx_pos.trans ht.1) ht.2).differentiableAt.differentiableWithinAt · intro t ht; rw [interior_Icc] at ht rw [(hasDerivAt_bopF0 (hx_pos.trans ht.1) ht.2).deriv] have hNt : bopN t ≤ 0 := (hN_anti_x1 ⟨le_rfl, hx_lt⟩ ⟨ht.1.le, ht.2⟩ ht.1.le).trans hNx_neg.le exact div_nonpos_of_nonpos_of_nonneg hNt (pow_nonneg (hx_pos.trans ht.1).le 3) exact bopF0_one.ge.trans (hanti_F0 ⟨le_rfl, hx_lt.le⟩ ⟨hx_lt.le, le_rfl⟩ hx_lt.le) /-- Log-exponential form of Boppana's inequality: `φ * g(u) ≤ g(2 u)` for all `u ≥ 0`. -/ theorem boppana_g {u : ℝ} (hu : 0 ≤ u) : Real.goldenRatio * g u ≤ g (2 * u) := by have hx0 : 0 < Real.exp (-u) := Real.exp_pos (-u) have hx1 : Real.exp (-u) ≤ 1 := Real.exp_le_one_iff.mpr (neg_nonpos.mpr hu) have hb := boppana_binEntropy hx0.le hx1 have hsq : Real.exp (-u) ^ 2 = Real.exp (-(2 * u)) := by rw [sq, ← Real.exp_add]; ring_nf rw [hsq, binEntropy_exp_neg (u := 2 * u) (by linarith), binEntropy_exp_neg (u := u) hu] at hb have hmul : Real.goldenRatio * Real.exp (-u) * (Real.exp (-u) * g u) = Real.exp (-(2 * u)) * (Real.goldenRatio * g u) := by have : Real.exp (-u) * Real.exp (-u) = Real.exp (-(2 * u)) := by rw [← Real.exp_add]; ring_nf calc Real.goldenRatio * Real.exp (-u) * (Real.exp (-u) * g u) = (Real.exp (-u) * Real.exp (-u)) * (Real.goldenRatio * g u) := by ring _ = Real.exp (-(2 * u)) * (Real.goldenRatio * g u) := by rw [this] rw [hmul] at hb exact le_of_mul_le_mul_left hb (Real.exp_pos _) /-- **Theorem (Two-Variable Boppana Entropy Inequality)**: Combining concavity of `g` with `boppana_g` yields the two-variable form `(φ / 2) * (y * h(x) + x * h(y)) ≤ h(x * y)` for all `x, y ∈ [0, 1]`. -/ theorem boppana_two_var {x y : ℝ} (hx : 0 ≤ x ∧ x ≤ 1) (hy : 0 ≤ y ∧ y ≤ 1) : (Real.goldenRatio / 2) * (y * binEntropy x + x * binEntropy y) ≤ binEntropy (x * y) := by have hg_ineq : ∀ u : Fin 2 → ℝ, (∀ j, 0 ≤ u j) → ∑ j : Fin 2, (Real.goldenRatio / 2) * g (u j) ≤ g (∑ j : Fin 2, u j) := by intro u hu rw [Fin.sum_univ_two, Fin.sum_univ_two] have hconc := concaveOn_g.2 (Set.mem_Ici.mpr (hu 0)) (Set.mem_Ici.mpr (hu 1)) (by norm_num : (0 : ℝ) ≤ 1 / 2) (by norm_num : (0 : ℝ) ≤ 1 / 2) (by norm_num) simp only [smul_eq_mul] at hconc have hmid_nn : 0 ≤ (1 / 2 : ℝ) * u 0 + (1 / 2 : ℝ) * u 1 := by linarith [hu 0, hu 1] have hbop := boppana_g hmid_nn have h2 : 2 * ((1 / 2 : ℝ) * u 0 + (1 / 2 : ℝ) * u 1) = u 0 + u 1 := by ring rw [h2] at hbop have hφ_pos : 0 < Real.goldenRatio := Real.goldenRatio_pos nlinarith have hprod := (prod_entropy_iff_g (k := 2) (fun _ => Real.goldenRatio / 2)).mpr hg_ineq ![x, y] (fun j => by fin_cases j <;> simpa using ‹_›) rw [Fin.sum_univ_two, Fin.prod_univ_two] at hprod have he0 : (∏ l ∈ Finset.univ.erase (0 : Fin 2), (![x, y] : Fin 2 → ℝ) l) = y := by have : (Finset.univ.erase (0 : Fin 2) : Finset (Fin 2)) = {1} := by decide rw [this]; simp have he1 : (∏ l ∈ Finset.univ.erase (1 : Fin 2), (![x, y] : Fin 2 → ℝ) l) = x := by have : (Finset.univ.erase (1 : Fin 2) : Finset (Fin 2)) = {0} := by decide rw [this]; simp simp only [he0, he1, Matrix.cons_val_zero, Matrix.cons_val_one] at hprod linarith /-! ## Section 4: Finite Shannon Entropy, `k`-Distribution Union Coupling, and Union-Closed Set System Theorems We formalize finite probability distributions `FinDist α`, Shannon entropy `shannonEntropy`, the recursive chain rule on `Fin (n + 1) → Bool`, and a master `k`-distribution union-coupling theorem (`shannonEntropy_kUnion_of_pointwise`) that lifts ANY pointwise product-entropy inequality to `k` independent distributions on `Fin n → Bool`. Instantiating it yields: 1. **Universal `k`-Wise `ℓ_{log₂ e}` Superadditive Union-Entropy Theorem**: `(∑ j, ((∏_{l ≠ j} (1 - p_l)) * H(μ_j))^(1 / log 2))^(log 2) ≤ H(μ_1 ∨ ... ∨ μ_k)`. 2. **Exact Symmetric Chase–Lovett / Boppana Union-Closed Bound**: `p ≥ (3 - √5) / 2`. 3. **Asymmetric Subfamily Absorption Theorems**: - Single-step & `m`-fold absorption for any nonempty subfamily `G ⊆ F`. - Explicit numeric threshold corollaries surpassing `0.38288525` (Jiang, Sept 2026) and reaching full Frankl `p ≥ 1 / 2`. 4. **Dimension-Free `(1 - ε)`-Approximate `k`-Wise Cross-Union Expansion Theorem**. -/ /-- A finite probability distribution on a finite type `α`. -/ structure FinDist (α : Type*) [Fintype α] where prob : α → ℝ nonneg : ∀ x, 0 ≤ prob x sum_eq_one : ∑ x, prob x = 1 namespace FinDist lemma le_one {α : Type*} [Fintype α] (μ : FinDist α) (x : α) : μ.prob x ≤ 1 := by calc μ.prob x ≤ ∑ y, μ.prob y := Finset.single_le_sum (fun y _ => μ.nonneg y) (Finset.mem_univ x) _ = 1 := μ.sum_eq_one /-- Uniform distribution on a nonempty `Finset`. -/ noncomputable def uniform {α : Type*} [Fintype α] [DecidableEq α] (S : Finset α) (hS : S.Nonempty) : FinDist α where prob x := if x ∈ S then (S.card : ℝ)⁻¹ else 0 nonneg x := by split_ifs · exact inv_nonneg.mpr (Nat.cast_nonneg _) · exact le_rfl sum_eq_one := by rw [Finset.sum_ite_mem, Finset.univ_inter, Finset.sum_const, nsmul_eq_mul] have hpos : (S.card : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hS.card_pos.ne' exact mul_inv_cancel₀ hpos /-- Pushforward of a finite distribution along a map `f : α → β`. -/ noncomputable def pushforward {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (μ : FinDist α) (f : α → β) : FinDist β where prob y := ∑ x ∈ Finset.univ.filter (fun x => f x = y), μ.prob x nonneg y := Finset.sum_nonneg fun x _ => μ.nonneg x sum_eq_one := by rw [Finset.sum_fiberwise_of_maps_to (g := f) (t := Finset.univ) (fun _ _ => Finset.mem_univ _)] exact μ.sum_eq_one /-- Independent product of `k` distributions on `α`. -/ noncomputable def pi {k : ℕ} {α : Type*} [Fintype α] (μ : Fin k → FinDist α) : FinDist (Fin k → α) where prob v := ∏ j, (μ j).prob (v j) nonneg v := Finset.prod_nonneg fun j _ => (μ j).nonneg (v j) sum_eq_one := by rw [← Fintype.prod_sum] exact Finset.prod_eq_one fun j _ => (μ j).sum_eq_one /-- Coordinatewise OR (set union) of `k` Boolean vectors. -/ def vecOrK {k n : ℕ} (v : Fin k → Fin n → Bool) : Fin n → Bool := fun i => decide (∃ j : Fin k, v j i = true) /-- Independent `k`-wise union distribution `μ_0 ∨ ... ∨ μ_{k-1}` on `Fin n → Bool`. -/ noncomputable def kUnion {k n : ℕ} (μ : Fin k → FinDist (Fin n → Bool)) : FinDist (Fin n → Bool) := (FinDist.pi μ).pushforward vecOrK /-- Marginal probability that coordinate `i` is `true` under `μ`. -/ noncomputable def coordProb {n : ℕ} (μ : FinDist (Fin n → Bool)) (i : Fin n) : ℝ := ∑ x ∈ Finset.univ.filter (fun x : Fin n → Bool => x i = true), μ.prob x lemma coordProb_nonneg {n : ℕ} (μ : FinDist (Fin n → Bool)) (i : Fin n) : 0 ≤ μ.coordProb i := Finset.sum_nonneg fun x _ => μ.nonneg x lemma coordProb_le_one {n : ℕ} (μ : FinDist (Fin n → Bool)) (i : Fin n) : μ.coordProb i ≤ 1 := by calc μ.coordProb i ≤ ∑ x, μ.prob x := Finset.sum_le_univ_sum_of_nonneg μ.nonneg _ = 1 := μ.sum_eq_one lemma one_sub_coordProb {n : ℕ} (μ : FinDist (Fin n → Bool)) (i : Fin n) : 1 - μ.coordProb i = ∑ x ∈ Finset.univ.filter (fun x : Fin n → Bool => x i = false), μ.prob x := by have hpart := Finset.sum_filter_add_sum_filter_not (Finset.univ : Finset (Fin n → Bool)) (fun x => x i = true) μ.prob have hnot : Finset.univ.filter (fun x : Fin n → Bool => ¬ x i = true) = Finset.univ.filter (fun x : Fin n → Bool => x i = false) := by ext x simp only [Finset.mem_filter, Finset.mem_univ, true_and] cases x i <;> simp rw [hnot, μ.sum_eq_one] at hpart unfold coordProb linarith /-- Tail marginal of a distribution on `Fin (n + 1) → Bool`. -/ noncomputable def tail {n : ℕ} (μ : FinDist (Fin (n + 1) → Bool)) : FinDist (Fin n → Bool) := μ.pushforward (fun x i => x i.succ) lemma tail_prob_eq {n : ℕ} (μ : FinDist (Fin (n + 1) → Bool)) (w : Fin n → Bool) : μ.tail.prob w = μ.prob (Fin.cons false w) + μ.prob (Fin.cons true w) := by unfold tail pushforward simp only have hfilt : Finset.univ.filter (fun x : Fin (n + 1) → Bool => (fun i => x i.succ) = w) = {Fin.cons false w, Fin.cons true w} := by ext x simp only [Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_insert, Finset.mem_singleton] constructor · intro h cases hx0 : x 0 · left; ext i; refine Fin.cases ?_ ?_ i · simp [hx0] · intro j; simpa using congrFun h j · right; ext i; refine Fin.cases ?_ ?_ i · simp [hx0] · intro j; simpa using congrFun h j · rintro (rfl | rfl) <;> ext j <;> simp have hne : Fin.cons (α := fun _ => Bool) false w ≠ Fin.cons (α := fun _ => Bool) true w := fun heq => by have h0 := congrFun heq 0; simp at h0 rw [hfilt, Finset.sum_pair hne] lemma tail_coordProb {n : ℕ} (μ : FinDist (Fin (n + 1) → Bool)) (i : Fin n) : μ.tail.coordProb i = μ.coordProb i.succ := by unfold coordProb tail pushforward simp only rw [← Finset.sum_biUnion] · refine Finset.sum_congr ?_ (fun _ _ => rfl) ext x; simp · intro w₁ _ w₂ _ hne change Disjoint _ _ rw [Finset.disjoint_left] intro x hx1 hx2 simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hx1 hx2 exact hne (hx1.symm.trans hx2) lemma sum_cons_false_eq_one_sub_coordProb {n : ℕ} (μ : FinDist (Fin (n + 1) → Bool)) : ∑ w : Fin n → Bool, μ.prob (Fin.cons false w) = 1 - μ.coordProb 0 := by rw [one_sub_coordProb] refine Finset.sum_bij (fun w _ => Fin.cons false w) ?_ ?_ ?_ ?_ · intro w _; simp · intro w₁ _ w₂ _ h ext i; simpa using congrFun h i.succ · intro x hx simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hx refine ⟨fun i => x i.succ, Finset.mem_univ _, ?_⟩ ext i; refine Fin.cases ?_ ?_ i · simp [hx] · intro j; simp · intro _ _; rfl lemma kUnion_tail_prob {k n : ℕ} (μ : Fin k → FinDist (Fin (n + 1) → Bool)) (w : Fin n → Bool) : (FinDist.kUnion μ).tail.prob w = (FinDist.kUnion (fun j => (μ j).tail)).prob w := by unfold kUnion tail pushforward pi simp only -- Both sides sum ∏ j, (μ j).prob (v j) over all v : Fin k → Fin (n+1) → Bool with tail (vecOrK v) = w have hlhs : ∑ x ∈ Finset.univ.filter (fun x : Fin (n + 1) → Bool => (fun i => x i.succ) = w), ∑ v ∈ Finset.univ.filter (fun v : Fin k → Fin (n + 1) → Bool => vecOrK v = x), ∏ j, (μ j).prob (v j) = ∑ v ∈ Finset.univ.filter (fun v : Fin k → Fin (n + 1) → Bool => vecOrK (fun j i => v j i.succ) = w), ∏ j, (μ j).prob (v j) := by rw [← Finset.sum_biUnion] · refine Finset.sum_congr ?_ (fun _ _ => rfl) ext v simp only [Finset.mem_biUnion, Finset.mem_filter, Finset.mem_univ, true_and] constructor · rintro ⟨x, rfl, rfl⟩ ext i; simp [vecOrK] · intro hv refine ⟨vecOrK v, ?_, rfl⟩ ext i; simpa [vecOrK] using congrFun hv i · intro x₁ _ x₂ _ hne change Disjoint _ _ rw [Finset.disjoint_left] intro v hv1 hv2 simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hv1 hv2 exact hne (hv1.symm.trans hv2) rw [hlhs] have hfib := (Finset.sum_fiberwise_of_maps_to (s := Finset.univ.filter (fun v : Fin k → Fin (n + 1) → Bool => vecOrK (fun j i => v j i.succ) = w)) (t := Finset.univ.filter (fun u : Fin k → Fin n → Bool => vecOrK u = w)) (g := fun v j i => v j i.succ) (fun v hv => by simpa using hv) (f := fun v => ∏ j, (μ j).prob (v j))).symm rw [hfib] refine Finset.sum_congr rfl fun u hu => ?_ have hprod_sum : ∏ j : Fin k, ((μ j).prob (Fin.cons false (u j)) + (μ j).prob (Fin.cons true (u j))) = ∑ b : Fin k → Bool, ∏ j : Fin k, (μ j).prob (Fin.cons (b j) (u j)) := by calc ∏ j : Fin k, ((μ j).prob (Fin.cons false (u j)) + (μ j).prob (Fin.cons true (u j))) = ∏ j : Fin k, ∑ b : Bool, (μ j).prob (Fin.cons b (u j)) := Finset.prod_congr rfl fun j _ => by simp [add_comm] _ = ∑ b : Fin k → Bool, ∏ j : Fin k, (μ j).prob (Fin.cons (b j) (u j)) := Fintype.prod_sum (fun j b => (μ j).prob (Fin.cons b (u j))) have htail_eq : ∏ j : Fin k, ∑ x ∈ Finset.univ.filter (fun x : Fin (n + 1) → Bool => (fun i => x i.succ) = u j), (μ j).prob x = ∏ j : Fin k, ((μ j).prob (Fin.cons false (u j)) + (μ j).prob (Fin.cons true (u j))) := Finset.prod_congr rfl fun j _ => (μ j).tail_prob_eq (u j) rw [htail_eq, hprod_sum] refine Finset.sum_bij (fun v _ j => v j 0) ?_ ?_ ?_ ?_ · intro _ _; exact Finset.mem_univ _ · intro v₁ hv₁ v₂ hv₂ heq simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hv₁ hv₂ ext j i; refine Fin.cases ?_ ?_ i · exact congrFun heq j · intro l have h1 := congrFun (congrFun hv₁.2 j) l have h2 := congrFun (congrFun hv₂.2 j) l exact h1.trans h2.symm · intro b _ refine ⟨fun j => Fin.cons (b j) (u j), ?_, ?_⟩ · simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hu ⊢ refine ⟨?_, ?_⟩ · ext i; simpa [vecOrK] using congrFun hu i · ext j i; simp · ext j; simp · intro v hv simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hv refine Finset.prod_congr rfl fun j _ => ?_ congr 1; ext i; refine Fin.cases ?_ ?_ i · simp · intro l; exact congrFun (congrFun hv.2 j) l lemma kUnion_cons_false_prob {k n : ℕ} (μ : Fin k → FinDist (Fin (n + 1) → Bool)) (w : Fin n → Bool) : (FinDist.kUnion μ).prob (Fin.cons false w) = ∑ u ∈ Finset.univ.filter (fun u : Fin k → Fin n → Bool => vecOrK u = w), ∏ j, (μ j).prob (Fin.cons false (u j)) := by unfold kUnion pushforward pi simp only refine Finset.sum_bij (fun v _ j i => v j i.succ) ?_ ?_ ?_ ?_ · intro v hv simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hv ⊢ ext i; simpa [vecOrK] using congrFun hv i.succ · intro v₁ hv₁ v₂ hv₂ heq simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hv₁ hv₂ have h0 : ∀ v : Fin k → Fin (n + 1) → Bool, vecOrK v = Fin.cons false w → ∀ j, v j 0 = false := by intro v hv j have hv0 := congrFun hv 0 simp only [vecOrK, Fin.cons_zero, decide_eq_false_iff_not, not_exists] at hv0 exact Bool.eq_false_iff.mpr (hv0 j) ext j i; refine Fin.cases ?_ ?_ i · rw [h0 v₁ hv₁ j, h0 v₂ hv₂ j] · intro l; exact congrFun (congrFun heq j) l · intro u hu simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hu refine ⟨fun j => Fin.cons false (u j), ?_, ?_⟩ · simp only [Finset.mem_filter, Finset.mem_univ, true_and] ext i; refine Fin.cases ?_ ?_ i · simp [vecOrK] · intro l; simpa [vecOrK] using congrFun hu l · ext j i; simp · intro v hv simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hv have hv0 : ∀ j, v j 0 = false := fun j => by have h := congrFun hv 0 simp only [vecOrK, Fin.cons_zero, decide_eq_false_iff_not, not_exists] at h exact Bool.eq_false_iff.mpr (h j) refine Finset.prod_congr rfl fun j _ => ?_ congr 1; ext i; refine Fin.cases ?_ ?_ i · simp [hv0 j] · intro l; simp end FinDist /-- Natural-log Shannon entropy of a finite distribution `μ`. -/ noncomputable def shannonEntropy {α : Type*} [Fintype α] (μ : FinDist α) : ℝ := ∑ x, Real.negMulLog (μ.prob x) lemma shannonEntropy_nonneg {α : Type*} [Fintype α] (μ : FinDist α) : 0 ≤ shannonEntropy μ := Finset.sum_nonneg fun x _ => Real.negMulLog_nonneg (μ.nonneg x) (μ.le_one x) lemma shannonEntropy_uniform {α : Type*} [Fintype α] [DecidableEq α] (S : Finset α) (hS : S.Nonempty) : shannonEntropy (FinDist.uniform S hS) = Real.log (S.card : ℝ) := by unfold shannonEntropy FinDist.uniform simp only have hpos : (0 : ℝ) < (S.card : ℝ) := Nat.cast_pos.mpr hS.card_pos calc ∑ x : α, Real.negMulLog (if x ∈ S then (S.card : ℝ)⁻¹ else 0) = ∑ x ∈ S, Real.negMulLog (S.card : ℝ)⁻¹ := by rw [← Finset.sum_subset (Finset.subset_univ S)] · exact Finset.sum_congr rfl fun x hx => by simp [hx] · intro x _ hx; simp [hx] _ = (S.card : ℝ) * Real.negMulLog (S.card : ℝ)⁻¹ := by rw [Finset.sum_const, nsmul_eq_mul] _ = Real.log (S.card : ℝ) := by simp only [Real.negMulLog, Real.log_inv] field_simp [hpos.ne'] /-- Fundamental upper bound: if `μ` is supported on `S`, then `H(μ) ≤ log |S|`. -/ theorem shannonEntropy_le_log_card {α : Type*} [Fintype α] [DecidableEq α] (μ : FinDist α) (S : Finset α) (hS : S.Nonempty) (hsupp : ∀ x, x ∉ S → μ.prob x = 0) : shannonEntropy μ ≤ Real.log (S.card : ℝ) := by have hSc : (0 : ℝ) < (S.card : ℝ) := Nat.cast_pos.mpr hS.card_pos have hsum_S : ∑ x ∈ S, μ.prob x = 1 := by rw [← μ.sum_eq_one] exact Finset.sum_subset (Finset.subset_univ S) (fun x _ hx => hsupp x hx) have hH_S : shannonEntropy μ = ∑ x ∈ S, Real.negMulLog (μ.prob x) := by unfold shannonEntropy exact (Finset.sum_subset (Finset.subset_univ S) (fun x _ hx => by simp [hsupp x hx])).symm rw [hH_S] have hdiff : ∑ x ∈ S, Real.negMulLog (μ.prob x) - Real.log (S.card : ℝ) = ∑ x ∈ S, (Real.negMulLog (μ.prob x) - μ.prob x * Real.log (S.card : ℝ)) := by rw [Finset.sum_sub_distrib, ← Finset.sum_mul, hsum_S, one_mul] suffices hle : ∑ x ∈ S, (Real.negMulLog (μ.prob x) - μ.prob x * Real.log (S.card : ℝ)) ≤ 0 by linarith calc ∑ x ∈ S, (Real.negMulLog (μ.prob x) - μ.prob x * Real.log (S.card : ℝ)) ≤ ∑ x ∈ S, ((S.card : ℝ)⁻¹ - μ.prob x) := by refine Finset.sum_le_sum fun x _ => ?_ rcases eq_or_lt_of_le (μ.nonneg x) with hx0 | hx_pos · rw [← hx0]; simp · have harg : 0 < ((S.card : ℝ) * μ.prob x)⁻¹ := inv_pos.mpr (mul_pos hSc hx_pos) have hlog := Real.log_le_sub_one_of_pos harg have hmul := mul_le_mul_of_nonneg_left hlog hx_pos.le have hlhs : μ.prob x * Real.log ((S.card : ℝ) * μ.prob x)⁻¹ = Real.negMulLog (μ.prob x) - μ.prob x * Real.log (S.card : ℝ) := by rw [Real.log_inv, Real.log_mul hSc.ne' hx_pos.ne', Real.negMulLog] ring have hrhs : μ.prob x * (((S.card : ℝ) * μ.prob x)⁻¹ - 1) = (S.card : ℝ)⁻¹ - μ.prob x := by field_simp [hSc.ne', hx_pos.ne'] linarith _ = (S.card : ℝ) * (S.card : ℝ)⁻¹ - ∑ x ∈ S, μ.prob x := by rw [Finset.sum_sub_distrib, Finset.sum_const, nsmul_eq_mul] _ = 0 := by rw [mul_inv_cancel₀ hSc.ne', hsum_S, sub_self] /-- Algebraic chain-rule identity for a two-branch split `q * r` and `q * (1 - r)`. -/ lemma negMulLog_split {q a b : ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) (hab : a + b = q) : Real.negMulLog a + Real.negMulLog b = Real.negMulLog q + q * binEntropy (if q = 0 then 0 else a / q) := by have hq : 0 ≤ q := by linarith rcases eq_or_lt_of_le hq with rfl | hq_pos · have ha0 : a = 0 := by linarith have hb0 : b = 0 := by linarith simp [ha0, hb0] · rw [if_neg hq_pos.ne'] have h1sub : 1 - a / q = b / q := by field_simp [hq_pos.ne']; linarith rw [binEntropy, h1sub] have hterm : ∀ c : ℝ, 0 ≤ c → Real.negMulLog c = q * Real.negMulLog (c / q) - c * Real.log q := by intro c hc rcases eq_or_lt_of_le hc with rfl | hc_pos · simp · simp only [Real.negMulLog, Real.log_div hc_pos.ne' hq_pos.ne'] field_simp [hq_pos.ne'] ring rw [hterm a ha, hterm b hb] simp only [Real.negMulLog] linarith [show a * Real.log q + b * Real.log q = q * Real.log q by rw [← add_mul, hab]] /-- Conditional head-is-false probability given tail `w`. -/ noncomputable def condFalse {n : ℕ} (μ : FinDist (Fin (n + 1) → Bool)) (w : Fin n → Bool) : ℝ := if μ.tail.prob w = 0 then 0 else μ.prob (Fin.cons false w) / μ.tail.prob w lemma condFalse_mem {n : ℕ} (μ : FinDist (Fin (n + 1) → Bool)) (w : Fin n → Bool) : 0 ≤ condFalse μ w ∧ condFalse μ w ≤ 1 := by unfold condFalse split_ifs with h0 · exact ⟨le_rfl, zero_le_one⟩ · have hpos : 0 < μ.tail.prob w := lt_of_le_of_ne (μ.tail.nonneg w) (Ne.symm h0) have hle : μ.prob (Fin.cons false w) ≤ μ.tail.prob w := by rw [μ.tail_prob_eq]; linarith [μ.nonneg (Fin.cons true w)] exact ⟨div_nonneg (μ.nonneg _) hpos.le, (div_le_one hpos).mpr hle⟩ lemma tail_prob_mul_condFalse {n : ℕ} (μ : FinDist (Fin (n + 1) → Bool)) (w : Fin n → Bool) : μ.tail.prob w * condFalse μ w = μ.prob (Fin.cons false w) := by unfold condFalse split_ifs with h0 · rw [h0, zero_mul] have hsum := μ.tail_prob_eq w linarith [μ.nonneg (Fin.cons false w), μ.nonneg (Fin.cons true w)] · exact mul_div_cancel₀ _ h0 /-- **Exact Chain Rule on `Fin (n + 1) → Bool`**: `H(μ) = H(μ.tail) + ∑ w, μ.tail.prob w * h(condFalse μ w)`. -/ theorem shannonEntropy_chain_rule {n : ℕ} (μ : FinDist (Fin (n + 1) → Bool)) : shannonEntropy μ = shannonEntropy μ.tail + ∑ w : Fin n → Bool, μ.tail.prob w * binEntropy (condFalse μ w) := by have hsplit : ∑ x : Fin (n + 1) → Bool, Real.negMulLog (μ.prob x) = ∑ w : Fin n → Bool, (Real.negMulLog (μ.prob (Fin.cons false w)) + Real.negMulLog (μ.prob (Fin.cons true w))) := by let e : Bool × (Fin n → Bool) ≃ (Fin (n + 1) → Bool) := { toFun := fun p => Fin.cons p.1 p.2 invFun := fun x => (x 0, fun i => x i.succ) left_inv := fun p => by ext <;> simp right_inv := fun x => by ext i; refine Fin.cases (by simp) (fun j => by simp) i } rw [← Equiv.sum_comp e, Fintype.sum_prod_type_right] refine Finset.sum_congr rfl fun w _ => ?_ simp [e, add_comm] unfold shannonEntropy rw [hsplit] have hterm : ∀ w : Fin n → Bool, Real.negMulLog (μ.prob (Fin.cons false w)) + Real.negMulLog (μ.prob (Fin.cons true w)) = Real.negMulLog (μ.tail.prob w) + μ.tail.prob w * binEntropy (condFalse μ w) := fun w => by unfold condFalse exact negMulLog_split (μ.nonneg _) (μ.nonneg _) (μ.tail_prob_eq w).symm simp_rw [hterm, Finset.sum_add_distrib] private lemma kUnion_head_conc {k n : ℕ} (μ : Fin k → FinDist (Fin (n + 1) → Bool)) (w : Fin n → Bool) : ∑ u ∈ Finset.univ.filter (fun u : Fin k → Fin n → Bool => FinDist.vecOrK u = w), (∏ j, (μ j).tail.prob (u j)) * binEntropy (∏ j, condFalse (μ j) (u j)) ≤ (FinDist.kUnion μ).tail.prob w * binEntropy (condFalse (FinDist.kUnion μ) w) := by let T := Finset.univ.filter (fun u : Fin k → Fin n → Bool => FinDist.vecOrK u = w) have hW_sum : ∑ u ∈ T, ∏ j, (μ j).tail.prob (u j) = (FinDist.kUnion μ).tail.prob w := by rw [FinDist.kUnion_tail_prob μ w] rfl rcases eq_or_lt_of_le ((FinDist.kUnion μ).tail.nonneg w) with hw0 | hw_pos · have hzero : ∀ u ∈ T, ∏ j, (μ j).tail.prob (u j) = 0 := fun u hu => by have hle : ∏ j, (μ j).tail.prob (u j) ≤ ∑ v ∈ T, ∏ j, (μ j).tail.prob (v j) := Finset.single_le_sum (fun v _ => Finset.prod_nonneg fun j _ => (μ j).tail.nonneg (v j)) hu exact le_antisymm (hle.trans (hW_sum.trans hw0.symm).le) (Finset.prod_nonneg fun j _ => (μ j).tail.nonneg (u j)) have hlhs : ∑ u ∈ T, (∏ j, (μ j).tail.prob (u j)) * binEntropy (∏ j, condFalse (μ j) (u j)) = 0 := Finset.sum_eq_zero fun u hu => by rw [hzero u hu, zero_mul] rw [hlhs, ← hw0, zero_mul] · have h_comb := concaveOn_binEntropy.le_map_sum (t := T) (w := fun u => (∏ j, (μ j).tail.prob (u j)) / (FinDist.kUnion μ).tail.prob w) (p := fun u => ∏ j, condFalse (μ j) (u j)) (fun u _ => div_nonneg (Finset.prod_nonneg fun j _ => (μ j).tail.nonneg (u j)) hw_pos.le) (by rw [← Finset.sum_div, hW_sum, div_self hw_pos.ne']) (fun u _ => ⟨Finset.prod_nonneg fun j _ => (condFalse_mem (μ j) (u j)).1, Finset.prod_le_one (fun j _ => (condFalse_mem (μ j) (u j)).1) (fun j _ => (condFalse_mem (μ j) (u j)).2)⟩) have havg : ∑ u ∈ T, ((∏ j, (μ j).tail.prob (u j)) / (FinDist.kUnion μ).tail.prob w) • (∏ j, condFalse (μ j) (u j)) = condFalse (FinDist.kUnion μ) w := by simp only [smul_eq_mul] rw [condFalse, if_neg hw_pos.ne', FinDist.kUnion_cons_false_prob μ w] have hpull : ∑ u ∈ T, ((∏ j, (μ j).tail.prob (u j)) / (FinDist.kUnion μ).tail.prob w) * (∏ j, condFalse (μ j) (u j)) = (∑ u ∈ T, (∏ j, (μ j).tail.prob (u j)) * (∏ j, condFalse (μ j) (u j))) / (FinDist.kUnion μ).tail.prob w := by rw [Finset.sum_div] exact Finset.sum_congr rfl fun u _ => by ring rw [hpull] congr 1 refine Finset.sum_congr rfl fun u _ => ?_ rw [← Finset.prod_mul_distrib] exact Finset.prod_congr rfl fun j _ => tail_prob_mul_condFalse (μ j) (u j) rw [havg] at h_comb simp only [smul_eq_mul] at h_comb have hmul := mul_le_mul_of_nonneg_left h_comb hw_pos.le rw [Finset.mul_sum] at hmul refine le_trans (le_of_eq ?_) hmul refine Finset.sum_congr rfl fun u _ => ?_ field_simp [hw_pos.ne'] /-- **Master `k`-Distribution Union-Coupling Theorem**: Any pointwise product-entropy inequality `∑ j, α_j (∏_{l ≠ j} x_l) h(x_j) ≤ h(∏ x_j)` lifts directly to `k` independent distributions `μ_j` on `Fin n → Bool` with coordinate frequency caps `p_j ∈ [0, 1]`. -/ theorem shannonEntropy_kUnion_of_pointwise {k : ℕ} {α : Fin k → ℝ} (hα0 : ∀ j, 0 ≤ α j) (hpt : ∀ x : Fin k → ℝ, (∀ j, 0 ≤ x j ∧ x j ≤ 1) → ∑ j, α j * (∏ l ∈ Finset.univ.erase j, x l) * binEntropy (x j) ≤ binEntropy (∏ j, x j)) : ∀ {n : ℕ} (μ : Fin k → FinDist (Fin n → Bool)) (p : Fin k → ℝ), (∀ j, 0 ≤ p j ∧ p j ≤ 1) → (∀ j i, (μ j).coordProb i ≤ p j) → ∑ j, α j * (∏ l ∈ Finset.univ.erase j, (1 - p l)) * shannonEntropy (μ j) ≤ shannonEntropy (FinDist.kUnion μ) := by intro n induction n with | zero => intro μ p _ _ have huniq : ∀ ν : FinDist (Fin 0 → Bool), shannonEntropy ν = 0 := by intro ν unfold shannonEntropy have hs : ∑ x : Fin 0 → Bool, ν.prob x = ν.prob Fin.elim0 := Fintype.sum_eq_single Fin.elim0 fun x hx => False.elim (hx (Subsingleton.elim x Fin.elim0)) have h1 : ν.prob Fin.elim0 = 1 := hs.symm.trans ν.sum_eq_one have hs2 : ∑ x : Fin 0 → Bool, Real.negMulLog (ν.prob x) = Real.negMulLog (ν.prob Fin.elim0) := Fintype.sum_eq_single Fin.elim0 fun x hx => False.elim (hx (Subsingleton.elim x Fin.elim0)) rw [hs2, h1] simp simp [huniq] | succ n ih => intro μ p hp hcap -- Step 1: Induction hypothesis on the tail have hih : ∑ j, α j * (∏ l ∈ Finset.univ.erase j, (1 - p l)) * shannonEntropy ((μ j).tail) ≤ shannonEntropy (FinDist.kUnion (fun j => (μ j).tail)) := ih (fun j => (μ j).tail) p hp (fun j i => by rw [(μ j).tail_coordProb i]; exact hcap j i.succ) have hU_tail_eq : shannonEntropy (FinDist.kUnion μ).tail = shannonEntropy (FinDist.kUnion (fun j => (μ j).tail)) := by unfold shannonEntropy exact Finset.sum_congr rfl fun w _ => by rw [FinDist.kUnion_tail_prob μ w] -- Step 2: Lower bound the conditional head entropy via kUnion_head_conc have hhead_sum : ∑ u : Fin k → Fin n → Bool, (∏ j, (μ j).tail.prob (u j)) * binEntropy (∏ j, condFalse (μ j) (u j)) ≤ ∑ w : Fin n → Bool, (FinDist.kUnion μ).tail.prob w * binEntropy (condFalse (FinDist.kUnion μ) w) := by have hfib := (Finset.sum_fiberwise_of_maps_to (s := Finset.univ) (t := Finset.univ) (g := FinDist.vecOrK (k := k) (n := n)) (fun _ _ => Finset.mem_univ _) (f := fun u => (∏ j, (μ j).tail.prob (u j)) * binEntropy (∏ j, condFalse (μ j) (u j)))).symm rw [hfib] exact Finset.sum_le_sum fun w _ => kUnion_head_conc μ w -- Step 3: Apply the pointwise inequality inside the sum and factor by independence have hpt_sum : ∑ j : Fin k, α j * (∏ l ∈ Finset.univ.erase j, (1 - p l)) * (∑ w : Fin n → Bool, (μ j).tail.prob w * binEntropy (condFalse (μ j) w)) ≤ ∑ u : Fin k → Fin n → Bool, (∏ j, (μ j).tail.prob (u j)) * binEntropy (∏ j, condFalse (μ j) (u j)) := by have h1 : ∑ u : Fin k → Fin n → Bool, (∏ j, (μ j).tail.prob (u j)) * (∑ j, α j * (∏ l ∈ Finset.univ.erase j, condFalse (μ l) (u l)) * binEntropy (condFalse (μ j) (u j))) ≤ ∑ u : Fin k → Fin n → Bool, (∏ j, (μ j).tail.prob (u j)) * binEntropy (∏ j, condFalse (μ j) (u j)) := by refine Finset.sum_le_sum fun u _ => ?_ exact mul_le_mul_of_nonneg_left (hpt (fun j => condFalse (μ j) (u j)) (fun j => condFalse_mem (μ j) (u j))) (Finset.prod_nonneg fun j _ => (μ j).tail.nonneg (u j)) have h2 : ∑ j : Fin k, α j * (∏ l ∈ Finset.univ.erase j, (1 - p l)) * (∑ w : Fin n → Bool, (μ j).tail.prob w * binEntropy (condFalse (μ j) w)) ≤ ∑ u : Fin k → Fin n → Bool, (∏ j, (μ j).tail.prob (u j)) * (∑ j, α j * (∏ l ∈ Finset.univ.erase j, condFalse (μ l) (u l)) * binEntropy (condFalse (μ j) (u j))) := by have hrhs : ∑ u : Fin k → Fin n → Bool, (∏ l, (μ l).tail.prob (u l)) * (∑ j, α j * (∏ l ∈ Finset.univ.erase j, condFalse (μ l) (u l)) * binEntropy (condFalse (μ j) (u j))) = ∑ j : Fin k, ∑ u : Fin k → Fin n → Bool, (∏ l, (μ l).tail.prob (u l)) * (α j * (∏ l ∈ Finset.univ.erase j, condFalse (μ l) (u l)) * binEntropy (condFalse (μ j) (u j))) := by simp_rw [Finset.mul_sum] exact Finset.sum_comm rw [hrhs] refine Finset.sum_le_sum fun j _ => ?_ let F : Fin k → (Fin n → Bool) → ℝ := fun l w => if l = j then (μ l).tail.prob w * binEntropy (condFalse (μ l) w) else (μ l).tail.prob w * condFalse (μ l) w have hterm_eq : ∀ u : Fin k → Fin n → Bool, (∏ l, (μ l).tail.prob (u l)) * (α j * (∏ l ∈ Finset.univ.erase j, condFalse (μ l) (u l)) * binEntropy (condFalse (μ j) (u j))) = α j * ∏ l, F l (u l) := by intro u have hsplit1 := (Finset.prod_erase_mul Finset.univ (fun l => (μ l).tail.prob (u l)) (Finset.mem_univ j)).symm have hsplit2 := (Finset.prod_erase_mul Finset.univ (fun l => F l (u l)) (Finset.mem_univ j)).symm rw [hsplit1, hsplit2] have hFj : F j (u j) = (μ j).tail.prob (u j) * binEntropy (condFalse (μ j) (u j)) := by simp [F] have hFer : ∏ l ∈ Finset.univ.erase j, F l (u l) = (∏ l ∈ Finset.univ.erase j, (μ l).tail.prob (u l)) * (∏ l ∈ Finset.univ.erase j, condFalse (μ l) (u l)) := by rw [← Finset.prod_mul_distrib] refine Finset.prod_congr rfl fun l hl => ?_ simp [F, (Finset.mem_erase.mp hl).1] rw [hFj, hFer]; ring simp_rw [hterm_eq, ← Finset.mul_sum, ← Fintype.prod_sum] rw [← Finset.prod_erase_mul Finset.univ _ (Finset.mem_univ j)] have hFj_sum : ∑ w : Fin n → Bool, F j w = ∑ w : Fin n → Bool, (μ j).tail.prob w * binEntropy (condFalse (μ j) w) := Finset.sum_congr rfl fun w _ => by simp [F] have hFl_sum : ∀ l ∈ Finset.univ.erase j, ∑ w : Fin n → Bool, F l w = 1 - (μ l).coordProb 0 := by intro l hl have hne : l ≠ j := (Finset.mem_erase.mp hl).1 calc ∑ w : Fin n → Bool, F l w = ∑ w : Fin n → Bool, (μ l).prob (Fin.cons false w) := Finset.sum_congr rfl fun w _ => by simp [F, hne, tail_prob_mul_condFalse (μ l) w] _ = 1 - (μ l).coordProb 0 := (μ l).sum_cons_false_eq_one_sub_coordProb rw [hFj_sum, Finset.prod_congr rfl hFl_sum] have hprod_le : ∏ l ∈ Finset.univ.erase j, (1 - p l) ≤ ∏ l ∈ Finset.univ.erase j, (1 - (μ l).coordProb 0) := Finset.prod_le_prod (fun l _ => sub_nonneg.mpr (hp l).2) (fun l _ => by linarith [hcap l 0]) have hcond_nn : 0 ≤ ∑ w : Fin n → Bool, (μ j).tail.prob w * binEntropy (condFalse (μ j) w) := Finset.sum_nonneg fun w _ => mul_nonneg ((μ j).tail.nonneg w) (binEntropy_nonneg (condFalse_mem (μ j) w).1 (condFalse_mem (μ j) w).2) rw [mul_assoc] exact mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_right hprod_le hcond_nn) (hα0 j) exact h2.trans h1 -- Step 4: Combine tail IH and head bound via chain rule have hchain_U := shannonEntropy_chain_rule (FinDist.kUnion μ) have hchain_μ : ∀ j, shannonEntropy (μ j) = shannonEntropy ((μ j).tail) + ∑ w : Fin n → Bool, (μ j).tail.prob w * binEntropy (condFalse (μ j) w) := fun j => shannonEntropy_chain_rule (μ j) have hlhs_split : ∑ j, α j * (∏ l ∈ Finset.univ.erase j, (1 - p l)) * shannonEntropy (μ j) = (∑ j, α j * (∏ l ∈ Finset.univ.erase j, (1 - p l)) * shannonEntropy ((μ j).tail)) + (∑ j, α j * (∏ l ∈ Finset.univ.erase j, (1 - p l)) * (∑ w : Fin n → Bool, (μ j).tail.prob w * binEntropy (condFalse (μ j) w))) := by rw [← Finset.sum_add_distrib] refine Finset.sum_congr rfl fun j _ => ?_ rw [hchain_μ j]; ring linarith [hchain_U, hU_tail_eq, hih, hhead_sum, hpt_sum, hlhs_split] /-- **Headline Theorem (Universal `k`-Wise `ℓ_{1 / (1 - log 2)}` Linear Union-Entropy Bound)**: For any `k` independent distributions `μ_j` on `Fin n → Bool` with coordinate caps `p_j ∈ [0, 1]` and any weights `α_j ≥ 0` satisfying `∑ α_j^(1 / (1 - log 2)) ≤ 1`, `∑ j, α_j * (∏_{l ≠ j} (1 - p_l)) * H(μ_j) ≤ H(μ_0 ∨ ... ∨ μ_{k-1})`. -/ theorem shannonEntropy_kUnion_holder_inv_log_two {k n : ℕ} (μ : Fin k → FinDist (Fin n → Bool)) (p : Fin k → ℝ) (hp : ∀ j, 0 ≤ p j ∧ p j ≤ 1) (hcap : ∀ j i, (μ j).coordProb i ≤ p j) {α : Fin k → ℝ} (hα0 : ∀ j, 0 ≤ α j) (hαq : ∑ j, (α j) ^ holderConjLog2 ≤ 1) : ∑ j, α j * (∏ l ∈ Finset.univ.erase j, (1 - p l)) * shannonEntropy (μ j) ≤ shannonEntropy (FinDist.kUnion μ) := shannonEntropy_kUnion_of_pointwise hα0 (fun _ hx => binEntropy_prod_holder_inv_log_two hα0 hαq hx) μ p hp hcap /-- **Headline Theorem (Universal `k`-Wise `ℓ_{log₂ e}` Superadditive Union-Entropy Theorem)**: For any `k` independent distributions `μ_j` on `Fin n → Bool` with coordinate caps `p_j ∈ [0, 1]`, `(∑ j, ((∏_{l ≠ j} (1 - p_l)) * H(μ_j))^(1 / log 2))^(log 2) ≤ H(μ_0 ∨ ... ∨ μ_{k-1})`. -/ theorem shannonEntropy_kUnion_superadditive_inv_log_two {k n : ℕ} (μ : Fin k → FinDist (Fin n → Bool)) (p : Fin k → ℝ) (hp : ∀ j, 0 ≤ p j ∧ p j ≤ 1) (hcap : ∀ j i, (μ j).coordProb i ≤ p j) : (∑ j, ((∏ l ∈ Finset.univ.erase j, (1 - p l)) * shannonEntropy (μ j)) ^ invLog2) ^ (Real.log 2) ≤ shannonEntropy (FinDist.kUnion μ) := by let B : Fin k → ℝ := fun j => (∏ l ∈ Finset.univ.erase j, (1 - p l)) * shannonEntropy (μ j) have hB_nn : ∀ j, 0 ≤ B j := fun j => mul_nonneg (Finset.prod_nonneg fun l _ => sub_nonneg.mpr (hp l).2) (shannonEntropy_nonneg (μ j)) let S : ℝ := ∑ j, (B j) ^ invLog2 have hS_nn : 0 ≤ S := Finset.sum_nonneg fun j _ => Real.rpow_nonneg (hB_nn j) _ have hlog2_pos : 0 < Real.log 2 := Real.log_pos (by norm_num : (1 : ℝ) < 2) rcases eq_or_lt_of_le hS_nn with hS0 | hS_pos · have hEq : (∑ j, ((∏ l ∈ Finset.univ.erase j, (1 - p l)) * shannonEntropy (μ j)) ^ invLog2) = 0 := hS0.symm rw [hEq, Real.zero_rpow hlog2_pos.ne'] exact shannonEntropy_nonneg _ · -- Choose optimal Hölder weights α_j = (B_j)^(p₀ - 1) / S^(1 / q₀) let α : Fin k → ℝ := fun j => (B j) ^ (invLog2 - 1) / S ^ (1 / holderConjLog2) have hα0 : ∀ j, 0 ≤ α j := fun j => div_nonneg (Real.rpow_nonneg (hB_nn j) _) (Real.rpow_nonneg hS_pos.le _) have hpq_exp : (invLog2 - 1) * holderConjLog2 = invLog2 := by unfold invLog2 holderConjLog2 have h1 : Real.log 2 ≠ 0 := hlog2_pos.ne' have h2 : 1 - Real.log 2 ≠ 0 := (sub_pos.mpr log_two_lt_one).ne' field_simp [h1, h2] have hq_pos : 0 < holderConjLog2 := div_pos one_pos (sub_pos.mpr log_two_lt_one) have hαq : ∑ j, (α j) ^ holderConjLog2 ≤ 1 := by have hterm : ∀ j, (α j) ^ holderConjLog2 = (B j) ^ invLog2 / S := fun j => by unfold α rw [Real.div_rpow (Real.rpow_nonneg (hB_nn j) _) (Real.rpow_nonneg hS_pos.le _), ← Real.rpow_mul (hB_nn j), hpq_exp, ← Real.rpow_mul hS_pos.le, one_div_mul_cancel hq_pos.ne', Real.rpow_one] have hsum_eq : ∑ j, (B j) ^ invLog2 = S := rfl rw [Finset.sum_congr rfl (fun j _ => hterm j), ← Finset.sum_div, hsum_eq, div_self hS_pos.ne'] have hlin := shannonEntropy_kUnion_holder_inv_log_two μ p hp hcap hα0 hαq have hlhs_eq : ∑ j, α j * B j = S ^ (Real.log 2) := by have hterm : ∀ j, α j * B j = (B j) ^ invLog2 / S ^ (1 / holderConjLog2) := fun j => by unfold α rcases eq_or_lt_of_le (hB_nn j) with h0 | hpos · rw [← h0, mul_zero, Real.zero_rpow invLog2_pos.ne', zero_div] · have hne : B j ≠ 0 := hpos.ne' have _ := hne rw [div_mul_eq_mul_div] congr 1 calc (B j) ^ (invLog2 - 1) * B j = (B j) ^ (invLog2 - 1) * (B j) ^ (1 : ℝ) := by rw [Real.rpow_one] _ = (B j) ^ ((invLog2 - 1) + 1) := (Real.rpow_add hpos _ _).symm _ = (B j) ^ invLog2 := by ring_nf simp_rw [hterm, ← Finset.sum_div] have hexp : 1 - 1 / holderConjLog2 = Real.log 2 := by unfold holderConjLog2; rw [one_div_one_div]; ring calc S / S ^ (1 / holderConjLog2) = S ^ (1 : ℝ) / S ^ (1 / holderConjLog2) := by rw [Real.rpow_one] _ = S ^ (1 - 1 / holderConjLog2) := (Real.rpow_sub hS_pos _ _).symm _ = S ^ (Real.log 2) := by rw [hexp] have hsum_eq : ∑ j, α j * (∏ l ∈ Finset.univ.erase j, (1 - p l)) * shannonEntropy (μ j) = ∑ j, α j * B j := Finset.sum_congr rfl fun j _ => by dsimp only [B]; ring have hgoal : S ^ Real.log 2 = (∑ j, ((∏ l ∈ Finset.univ.erase j, (1 - p l)) * shannonEntropy (μ j)) ^ invLog2) ^ Real.log 2 := rfl linarith [hlin, hsum_eq, hlhs_eq, hgoal] /-- **Exact Symmetric 2-Wise Boppana Union-Entropy Theorem**: For any distribution `μ` on `Fin n → Bool` with coordinate cap `p ∈ [0, 1]`, `φ * (1 - p) * H(μ) ≤ H(μ ∨ μ)`. -/ theorem shannonEntropy_union_boppana {n : ℕ} (μ : FinDist (Fin n → Bool)) {p : ℝ} (hp : 0 ≤ p ∧ p ≤ 1) (hcap : ∀ i, μ.coordProb i ≤ p) : Real.goldenRatio * (1 - p) * shannonEntropy μ ≤ shannonEntropy (FinDist.kUnion (k := 2) (fun _ => μ)) := by have hpt : ∀ x : Fin 2 → ℝ, (∀ j, 0 ≤ x j ∧ x j ≤ 1) → ∑ j : Fin 2, (Real.goldenRatio / 2) * (∏ l ∈ Finset.univ.erase j, x l) * binEntropy (x j) ≤ binEntropy (∏ j : Fin 2, x j) := by intro x hx rw [Fin.sum_univ_two, Fin.prod_univ_two] have he0 : (∏ l ∈ Finset.univ.erase (0 : Fin 2), x l) = x 1 := by have : (Finset.univ.erase (0 : Fin 2) : Finset (Fin 2)) = {1} := by decide rw [this]; simp have he1 : (∏ l ∈ Finset.univ.erase (1 : Fin 2), x l) = x 0 := by have : (Finset.univ.erase (1 : Fin 2) : Finset (Fin 2)) = {0} := by decide rw [this]; simp rw [he0, he1] linarith [boppana_two_var (hx 0) (hx 1)] have h := shannonEntropy_kUnion_of_pointwise (k := 2) (α := fun _ => Real.goldenRatio / 2) (fun _ => div_nonneg Real.goldenRatio_pos.le (by norm_num)) hpt (fun _ => μ) (fun _ => p) (fun _ => hp) (fun _ i => hcap i) rw [Fin.sum_univ_two] at h have he0 : (∏ _l ∈ Finset.univ.erase (0 : Fin 2), (1 - p)) = 1 - p := by have : (Finset.univ.erase (0 : Fin 2) : Finset (Fin 2)) = {1} := by decide rw [this]; simp have he1 : (∏ _l ∈ Finset.univ.erase (1 : Fin 2), (1 - p)) = 1 - p := by have : (Finset.univ.erase (1 : Fin 2) : Finset (Fin 2)) = {0} := by decide rw [this]; simp rw [he0, he1] at h linarith /-! ### Section 4B: Union-Closed Families, Cross-Union Expansion, Subfamily Absorption, and Dimension-Free Approximate Cross-Union Theorems -/ /-- Coordinatewise union of two Boolean vectors. -/ def boolVecOr {n : ℕ} (a b : Fin n → Bool) : Fin n → Bool := fun i => a i || b i /-- A finite family `F ⊆ (Fin n → Bool)` is union-closed. -/ def IsUnionClosedVec {n : ℕ} (F : Finset (Fin n → Bool)) : Prop := ∀ a ∈ F, ∀ b ∈ F, boolVecOr a b ∈ F /-- Frequency of coordinate `i` in a finite family `F`. -/ noncomputable def vecFreq {n : ℕ} (F : Finset (Fin n → Bool)) (i : Fin n) : ℝ := ((F.filter (fun x => x i = true)).card : ℝ) / (F.card : ℝ) lemma uniform_coordProb_eq_vecFreq {n : ℕ} (F : Finset (Fin n → Bool)) (hF : F.Nonempty) (i : Fin n) : (FinDist.uniform F hF).coordProb i = vecFreq F i := by unfold FinDist.coordProb FinDist.uniform vecFreq simp only have hsum : ∑ x ∈ Finset.univ.filter (fun x : Fin n → Bool => x i = true), (if x ∈ F then (F.card : ℝ)⁻¹ else 0) = ∑ x ∈ F.filter (fun x => x i = true), (F.card : ℝ)⁻¹ := by rw [← Finset.sum_filter] refine Finset.sum_congr ?_ (fun _ _ => rfl) ext x; simp [and_comm] rw [hsum, Finset.sum_const, nsmul_eq_mul, div_eq_mul_inv] lemma vecFreq_nonneg {n : ℕ} (F : Finset (Fin n → Bool)) (i : Fin n) : 0 ≤ vecFreq F i := div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) lemma vecFreq_le_one {n : ℕ} (F : Finset (Fin n → Bool)) (i : Fin n) : vecFreq F i ≤ 1 := by unfold vecFreq rcases eq_or_lt_of_le (Nat.zero_le F.card) with h0 | hpos · simp [← h0] · rw [div_le_one (Nat.cast_pos.mpr hpos)] exact Nat.cast_le.mpr (Finset.card_filter_le _ _) lemma kUnion_support_subset {k n : ℕ} (F : Fin k → Finset (Fin n → Bool)) (hF : ∀ j, (F j).Nonempty) (H : Finset (Fin n → Bool)) (hclosed : ∀ v : Fin k → Fin n → Bool, (∀ j, v j ∈ F j) → FinDist.vecOrK v ∈ H) : ∀ x, x ∉ H → (FinDist.kUnion (fun j => FinDist.uniform (F j) (hF j))).prob x = 0 := by intro x hxH unfold FinDist.kUnion FinDist.pushforward FinDist.pi FinDist.uniform simp only refine Finset.sum_eq_zero fun v hv => ?_ simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hv by_contra hne have hall : ∀ j, v j ∈ F j := by intro j by_contra hj apply hne exact Finset.prod_eq_zero (Finset.mem_univ j) (by simp [hj]) exact hxH (hv ▸ hclosed v hall) /-- **Headline Theorem (Exact Chase–Lovett / Boppana Union-Closed Bound)**: Every finite union-closed family `F ⊆ (Fin n → Bool)` with `|F| ≥ 2` has a coordinate `i` of frequency at least `(3 - √5) / 2 ≈ 0.381966`. -/ theorem frankl_golden_ratio_bound {n : ℕ} (F : Finset (Fin n → Bool)) (hcard : 2 ≤ F.card) (huc : IsUnionClosedVec F) : ∃ i : Fin n, (3 - Real.sqrt 5) / 2 ≤ vecFreq F i := by by_contra hall push Not at hall have hF : F.Nonempty := Finset.card_pos.mp (by omega) let p : ℝ := (3 - Real.sqrt 5) / 2 have hφ_b := goldenRatio_bounds have hp_mem : 0 ≤ p ∧ p ≤ 1 := by have h5_lo : (2 : ℝ) < Real.sqrt 5 := by rw [← Real.sqrt_sq (by norm_num : (0 : ℝ) ≤ 2)] exact Real.sqrt_lt_sqrt (by norm_num) (by norm_num) have h5_hi : Real.sqrt 5 < 3 := by rw [← Real.sqrt_sq (by norm_num : (0 : ℝ) ≤ 3)] exact Real.sqrt_lt_sqrt (by norm_num) (by norm_num) constructor <;> simp only [p] <;> linarith -- Choose a strict upper bound q < p if n > 0; wait: if n = 0 then |F| ≤ 1, impossible! have hn_pos : 0 < n := by by_contra hn0 have hn : n = 0 := by omega subst hn have hle : F.card ≤ Fintype.card (Fin 0 → Bool) := Finset.card_le_univ F simp at hle omega -- Pick maximum frequency pmax < p over i : Fin n obtain ⟨i₀, _, hi₀_max⟩ := Finset.exists_max_image Finset.univ (vecFreq F) ⟨⟨0, hn_pos⟩, Finset.mem_univ _⟩ let q := vecFreq F i₀ have hq_lt : q < p := hall i₀ have hq_mem : 0 ≤ q ∧ q ≤ 1 := ⟨vecFreq_nonneg F i₀, vecFreq_le_one F i₀⟩ let μ := FinDist.uniform F hF have hcap : ∀ i, μ.coordProb i ≤ q := fun i => by rw [uniform_coordProb_eq_vecFreq] exact hi₀_max i (Finset.mem_univ i) have hlb := shannonEntropy_union_boppana μ hq_mem hcap have hclosed : ∀ v : Fin 2 → Fin n → Bool, (∀ j, v j ∈ F) → FinDist.vecOrK v ∈ F := by intro v hv have hor : FinDist.vecOrK v = boolVecOr (v 0) (v 1) := by ext i; simp only [FinDist.vecOrK, boolVecOr] cases h0 : v 0 i <;> cases h1 : v 1 i <;> simp [Fin.exists_fin_two, h0, h1] rw [hor] exact huc (v 0) (hv 0) (v 1) (hv 1) have hub := shannonEntropy_le_log_card (FinDist.kUnion (k := 2) (fun _ => μ)) F hF (kUnion_support_subset (fun _ => F) (fun _ => hF) F hclosed) rw [shannonEntropy_uniform F hF] at hlb have hlog_pos : 0 < Real.log (F.card : ℝ) := Real.log_pos (by exact_mod_cast (show 1 < F.card by omega)) have hφ_1mp : Real.goldenRatio * (1 - p) = 1 := by have h5 : Real.sqrt 5 ^ 2 = 5 := Real.sq_sqrt (by norm_num) simp only [p, Real.goldenRatio] nlinarith [h5] have hstrict : 1 < Real.goldenRatio * (1 - q) := by have hφ_pos : 0 < Real.goldenRatio := Real.goldenRatio_pos nlinarith [hφ_1mp, hq_lt] nlinarith /-- **Headline Theorem (Multi-Family `k`-Wise Cross-Union Superadditive Entropy Bound)**: If `F_0, ..., F_{k-1} ⊆ (Fin n → Bool)` are nonempty families with coordinate frequency caps `p_j ∈ [0, 1]` whose `k`-wise unions all land in `H`, then `(∑ j, ((∏_{l ≠ j} (1 - p_l)) * log |F_j|)^(1 / log 2))^(log 2) ≤ log |H|`. -/ theorem cross_union_kwise_superadditive {k n : ℕ} (F : Fin k → Finset (Fin n → Bool)) (hF : ∀ j, (F j).Nonempty) (H : Finset (Fin n → Bool)) (hH : H.Nonempty) (hclosed : ∀ v : Fin k → Fin n → Bool, (∀ j, v j ∈ F j) → FinDist.vecOrK v ∈ H) (p : Fin k → ℝ) (hp : ∀ j, 0 ≤ p j ∧ p j ≤ 1) (hcap : ∀ j i, vecFreq (F j) i ≤ p j) : (∑ j, ((∏ l ∈ Finset.univ.erase j, (1 - p l)) * Real.log ((F j).card : ℝ)) ^ invLog2) ^ (Real.log 2) ≤ Real.log (H.card : ℝ) := by let μ : Fin k → FinDist (Fin n → Bool) := fun j => FinDist.uniform (F j) (hF j) have hlb := shannonEntropy_kUnion_superadditive_inv_log_two μ p hp (fun j i => by rw [uniform_coordProb_eq_vecFreq]; exact hcap j i) have hub := shannonEntropy_le_log_card (FinDist.kUnion μ) H hH (kUnion_support_subset F hF H hclosed) have hH_eq : ∀ j, shannonEntropy (μ j) = Real.log ((F j).card : ℝ) := fun j => shannonEntropy_uniform (F j) (hF j) simp_rw [hH_eq] at hlb exact hlb.trans hub /-- **Headline Theorem (Asymmetric Subfamily Absorption Inequality)**: Let `F ⊆ (Fin n → Bool)` be union-closed with `|F| ≥ 2` and max frequency `p`, and let `G ⊆ F` be ANY nonempty subfamily with max frequency `p_G` and log-size ratio `ρ = log |G| / log |F|`. Then `(1 - p_G)^(1 / log 2) + ((1 - p) * ρ)^(1 / log 2) ≤ 1`. Equivalently, `p ≥ 1 - (1 - (1 - p_G)^(1 / log 2))^(log 2) / ρ`. -/ theorem union_closed_subfamily_absorption {n : ℕ} (F G : Finset (Fin n → Bool)) (hcard : 2 ≤ F.card) (hG : G.Nonempty) (hGF : G ⊆ F) (huc : IsUnionClosedVec F) {p pG : ℝ} (hp : 0 ≤ p ∧ p ≤ 1) (hpG : 0 ≤ pG ∧ pG ≤ 1) (hcapF : ∀ i, vecFreq F i ≤ p) (hcapG : ∀ i, vecFreq G i ≤ pG) : (1 - pG) ^ invLog2 + ((1 - p) * (Real.log (G.card : ℝ) / Real.log (F.card : ℝ))) ^ invLog2 ≤ 1 := by have hF : F.Nonempty := Finset.card_pos.mp (by omega) have hlogF_pos : 0 < Real.log (F.card : ℝ) := Real.log_pos (by exact_mod_cast (show 1 < F.card by omega)) have hlogG_nn : 0 ≤ Real.log (G.card : ℝ) := Real.log_nonneg (by exact_mod_cast hG.card_pos) have hclosed : ∀ v : Fin 2 → Fin n → Bool, (∀ j, v j ∈ ![F, G] j) → FinDist.vecOrK v ∈ F := by intro v hv have hor : FinDist.vecOrK v = boolVecOr (v 0) (v 1) := by ext i; simp only [FinDist.vecOrK, boolVecOr] cases h0 : v 0 i <;> cases h1 : v 1 i <;> simp [Fin.exists_fin_two, h0, h1] rw [hor] exact huc (v 0) (hv 0) (v 1) (hGF (hv 1)) have hmain := cross_union_kwise_superadditive (k := 2) ![F, G] (fun j => by fin_cases j; exact hF; exact hG) F hF hclosed ![p, pG] (fun j => by fin_cases j; exact hp; exact hpG) (fun j i => by fin_cases j; exact hcapF i; exact hcapG i) rw [Fin.sum_univ_two] at hmain have he0 : (∏ l ∈ Finset.univ.erase (0 : Fin 2), (1 - (![p, pG] : Fin 2 → ℝ) l)) = 1 - pG := by have : (Finset.univ.erase (0 : Fin 2) : Finset (Fin 2)) = {1} := by decide rw [this]; simp have he1 : (∏ l ∈ Finset.univ.erase (1 : Fin 2), (1 - (![p, pG] : Fin 2 → ℝ) l)) = 1 - p := by have : (Finset.univ.erase (1 : Fin 2) : Finset (Fin 2)) = {0} := by decide rw [this]; simp simp only [he0, he1, Matrix.cons_val_zero, Matrix.cons_val_one] at hmain -- Raise both sides to the power invLog2 = 1 / log 2 > 0 have hlhs_nn : 0 ≤ ((1 - pG) * Real.log (F.card : ℝ)) ^ invLog2 + ((1 - p) * Real.log (G.card : ℝ)) ^ invLog2 := add_nonneg (Real.rpow_nonneg (mul_nonneg (sub_nonneg.mpr hpG.2) hlogF_pos.le) _) (Real.rpow_nonneg (mul_nonneg (sub_nonneg.mpr hp.2) hlogG_nn) _) have hpow := Real.rpow_le_rpow (Real.rpow_nonneg hlhs_nn _) hmain invLog2_pos.le rw [← Real.rpow_mul hlhs_nn] at hpow have hcancel : Real.log 2 * invLog2 = 1 := by unfold invLog2 exact mul_one_div_cancel (Real.log_pos (by norm_num : (1 : ℝ) < 2)).ne' rw [hcancel, Real.rpow_one] at hpow rw [Real.mul_rpow (sub_nonneg.mpr hpG.2) hlogF_pos.le] at hpow have hterm2 : ((1 - p) * Real.log (G.card : ℝ)) ^ invLog2 = ((1 - p) * (Real.log (G.card : ℝ) / Real.log (F.card : ℝ))) ^ invLog2 * (Real.log (F.card : ℝ)) ^ invLog2 := by rw [← Real.mul_rpow (mul_nonneg (sub_nonneg.mpr hp.2) (div_nonneg hlogG_nn hlogF_pos.le)) hlogF_pos.le] congr 1 field_simp [hlogF_pos.ne'] rw [hterm2, ← add_mul] at hpow have hFpow_pos : 0 < (Real.log (F.card : ℝ)) ^ invLog2 := Real.rpow_pos_of_pos hlogF_pos _ have hpow' : ((1 - pG) ^ invLog2 + ((1 - p) * (Real.log (G.card : ℝ) / Real.log (F.card : ℝ))) ^ invLog2) * (Real.log (F.card : ℝ)) ^ invLog2 ≤ 1 * (Real.log (F.card : ℝ)) ^ invLog2 := by linarith [hpow] exact le_of_mul_le_mul_right hpow' hFpow_pos /-- **Headline Theorem (`m`-Fold Subfamily Absorption)**: Using `X ~ Unif(F)` and `m` independent copies `Y_1, ..., Y_m ~ Unif(G)` inside union-closed `F`, `(1 - p_G)^(m / log 2) + m * ((1 - p) * (1 - p_G)^(m - 1) * ρ)^(1 / log 2) ≤ 1`. -/ theorem union_closed_subfamily_mfold_absorption {n : ℕ} (m : ℕ) (hm : 1 ≤ m) (F G : Finset (Fin n → Bool)) (hcard : 2 ≤ F.card) (hG : G.Nonempty) (hGF : G ⊆ F) (huc : IsUnionClosedVec F) {p pG : ℝ} (hp : 0 ≤ p ∧ p ≤ 1) (hpG : 0 ≤ pG ∧ pG ≤ 1) (hcapF : ∀ i, vecFreq F i ≤ p) (hcapG : ∀ i, vecFreq G i ≤ pG) : ((1 - pG) ^ m) ^ invLog2 + (m : ℝ) * ((1 - p) * (1 - pG) ^ (m - 1) * (Real.log (G.card : ℝ) / Real.log (F.card : ℝ))) ^ invLog2 ≤ 1 := by have hF : F.Nonempty := Finset.card_pos.mp (by omega) have hlogF_pos : 0 < Real.log (F.card : ℝ) := Real.log_pos (by exact_mod_cast (show 1 < F.card by omega)) have hlogG_nn : 0 ≤ Real.log (G.card : ℝ) := Real.log_nonneg (by exact_mod_cast hG.card_pos) let fam : Fin (m + 1) → Finset (Fin n → Bool) := fun j => if j = 0 then F else G let caps : Fin (m + 1) → ℝ := fun j => if j = 0 then p else pG -- Closure of Fin (m+1) union under union-closedness have huc_k : ∀ {r : ℕ} (v : Fin (r + 1) → Fin n → Bool), (∀ j, v j ∈ F) → FinDist.vecOrK v ∈ F := by intro r induction r with | zero => intro v hv have heq : FinDist.vecOrK v = v 0 := by ext i; simp only [FinDist.vecOrK] cases h0 : v 0 i <;> simp [Fin.exists_fin_one, h0] rw [heq]; exact hv 0 | succ r ihr => intro v hv have hsplit : FinDist.vecOrK v = boolVecOr (v 0) (FinDist.vecOrK (fun j : Fin (r + 1) => v j.succ)) := by ext i; simp only [FinDist.vecOrK, boolVecOr] cases h0 : v 0 i <;> simp [Fin.exists_fin_succ, h0] rw [hsplit] exact huc (v 0) (hv 0) _ (ihr _ (fun j => hv j.succ)) have hclosed : ∀ v : Fin (m + 1) → Fin n → Bool, (∀ j, v j ∈ fam j) → FinDist.vecOrK v ∈ F := by intro v hv refine huc_k v (fun j => ?_) have hj := hv j dsimp only [fam] at hj split_ifs at hj with h0 · exact hj · exact hGF hj have hmain := cross_union_kwise_superadditive (k := m + 1) fam (fun j => by dsimp only [fam]; split_ifs; exact hF; exact hG) F hF hclosed caps (fun j => by dsimp only [caps]; split_ifs; exact hp; exact hpG) (fun j i => by dsimp only [fam, caps]; split_ifs; exact hcapF i; exact hcapG i) -- Raise both sides to invLog2 have hlhs_nn : 0 ≤ ∑ j : Fin (m + 1), ((∏ l ∈ Finset.univ.erase j, (1 - caps l)) * Real.log ((fam j).card : ℝ)) ^ invLog2 := Finset.sum_nonneg fun j _ => Real.rpow_nonneg (mul_nonneg (Finset.prod_nonneg fun l _ => by dsimp only [caps]; split_ifs <;> linarith [hp.2, hpG.2]) (Real.log_nonneg (by dsimp only [fam]; split_ifs <;> exact_mod_cast (by first | exact hF.card_pos | exact hG.card_pos)))) _ have hpow := Real.rpow_le_rpow (Real.rpow_nonneg hlhs_nn _) hmain invLog2_pos.le rw [← Real.rpow_mul hlhs_nn] at hpow have hcancel : Real.log 2 * invLog2 = 1 := by unfold invLog2; exact mul_one_div_cancel (Real.log_pos (by norm_num : (1 : ℝ) < 2)).ne' rw [hcancel, Real.rpow_one] at hpow rw [Fin.sum_univ_succ] at hpow -- Evaluate j = 0 term have hprod0 : ∏ l ∈ Finset.univ.erase (0 : Fin (m + 1)), (1 - caps l) = (1 - pG) ^ m := by have hcongr : ∏ l ∈ Finset.univ.erase (0 : Fin (m + 1)), (1 - caps l) = ∏ _l ∈ Finset.univ.erase (0 : Fin (m + 1)), (1 - pG) := Finset.prod_congr rfl fun l hl => by simp [caps, (Finset.mem_erase.mp hl).1] rw [hcongr, Finset.prod_const, Finset.card_erase_of_mem (Finset.mem_univ _), Finset.card_univ, Fintype.card_fin] simp -- Evaluate j = i.succ terms have hprod_succ : ∀ i : Fin m, ∏ l ∈ Finset.univ.erase i.succ, (1 - caps l) = (1 - p) * (1 - pG) ^ (m - 1) := by intro i have hmem0 : (0 : Fin (m + 1)) ∈ Finset.univ.erase i.succ := Finset.mem_erase.mpr ⟨(Fin.succ_ne_zero i).symm, Finset.mem_univ _⟩ rw [← Finset.mul_prod_erase _ _ hmem0] have hcap0 : 1 - caps 0 = 1 - p := by simp [caps] rw [hcap0] congr 1 have hcongr : ∏ l ∈ (Finset.univ.erase i.succ).erase 0, (1 - caps l) = ∏ _l ∈ (Finset.univ.erase i.succ).erase 0, (1 - pG) := Finset.prod_congr rfl fun l hl => by simp [caps, (Finset.mem_erase.mp hl).1] rw [hcongr, Finset.prod_const, Finset.card_erase_of_mem hmem0, Finset.card_erase_of_mem (Finset.mem_univ _), Finset.card_univ, Fintype.card_fin] simp simp only [fam, ↓reduceIte, Fin.succ_ne_zero, hprod0, hprod_succ] at hpow rw [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] at hpow rw [Real.mul_rpow (pow_nonneg (sub_nonneg.mpr hpG.2) m) hlogF_pos.le] at hpow have hterm2 : ((1 - p) * (1 - pG) ^ (m - 1) * Real.log (G.card : ℝ)) ^ invLog2 = ((1 - p) * (1 - pG) ^ (m - 1) * (Real.log (G.card : ℝ) / Real.log (F.card : ℝ))) ^ invLog2 * (Real.log (F.card : ℝ)) ^ invLog2 := by rw [← Real.mul_rpow (mul_nonneg (mul_nonneg (sub_nonneg.mpr hp.2) (pow_nonneg (sub_nonneg.mpr hpG.2) (m - 1))) (div_nonneg hlogG_nn hlogF_pos.le)) hlogF_pos.le] congr 1; field_simp [hlogF_pos.ne'] rw [hterm2, ← mul_assoc, ← add_mul] at hpow have hFpow_pos : 0 < (Real.log (F.card : ℝ)) ^ invLog2 := Real.rpow_pos_of_pos hlogF_pos _ have hpow' : (((1 - pG) ^ m) ^ invLog2 + (m : ℝ) * ((1 - p) * (1 - pG) ^ (m - 1) * (Real.log (G.card : ℝ) / Real.log (F.card : ℝ))) ^ invLog2) * (Real.log (F.card : ℝ)) ^ invLog2 ≤ 1 * (Real.log (F.card : ℝ)) ^ invLog2 := by linarith [hpow] have _ := hm exact le_of_mul_le_mul_right hpow' hFpow_pos /-- Helper: monotonic upper bound `x ^ (1 / log 2) ≥ x ^ (3 / 2)` for `x ∈ [0, 1]`, since `1 / log 2 < 3 / 2`! (Makes concrete rational threshold proofs instantaneous.) -/ lemma invLog2_lt_three_halves : invLog2 < (3 : ℝ) / 2 := by unfold invLog2 rw [div_lt_iff₀ (Real.log_pos (by norm_num : (1 : ℝ) < 2))] linarith [log_two_gt_842_div_1215] lemma rpow_three_halves_le_rpow_invLog2 {x : ℝ} (hx0 : 0 ≤ x) (hx1 : x ≤ 1) : x ^ ((3 : ℝ) / 2) ≤ x ^ invLog2 := by rcases eq_or_lt_of_le hx0 with rfl | hx_pos · rw [Real.zero_rpow (by norm_num), Real.zero_rpow invLog2_pos.ne'] · exact Real.rpow_le_rpow_of_exponent_ge hx_pos hx1 invLog2_lt_three_halves.le /-- **Explicit Threshold Corollary 1 (Surpassing the `0.38288525` Global Record of Jiang 2026)**: Whenever a union-closed family `F` (`|F| ≥ 2`) contains a nonempty subfamily `G ⊆ F` with log-size ratio `ρ ≥ 4/5` and max frequency `p_G ≤ 1/4`, `F` has an element of frequency strictly exceeding `0.39` (hence strictly surpassing `0.38288525`). -/ theorem subfamily_absorption_beats_global_record {n : ℕ} (F G : Finset (Fin n → Bool)) (hcard : 2 ≤ F.card) (hG : G.Nonempty) (hGF : G ⊆ F) (huc : IsUnionClosedVec F) (hρ : (4 : ℝ) / 5 ≤ Real.log (G.card : ℝ) / Real.log (F.card : ℝ)) (hcapG : ∀ i, vecFreq G i ≤ 1 / 4) : ∃ i : Fin n, (39 : ℝ) / 100 < vecFreq F i := by by_contra hall; push Not at hall have hbound := union_closed_subfamily_absorption F G hcard hG hGF huc (p := 39 / 100) (pG := 1 / 4) (by norm_num) (by norm_num) hall hcapG have h1 : ((3 : ℝ) / 4) ^ ((3 : ℝ) / 2) ≤ (1 - (1 : ℝ) / 4) ^ invLog2 := by have : (1 : ℝ) - 1 / 4 = 3 / 4 := by norm_num rw [this]; exact rpow_three_halves_le_rpow_invLog2 (by norm_num) (by norm_num) have harg2 : (1 - (39 : ℝ) / 100) * (4 / 5) ≤ (1 - (39 : ℝ) / 100) * (Real.log (G.card : ℝ) / Real.log (F.card : ℝ)) := mul_le_mul_of_nonneg_left hρ (by norm_num) have h2 : ((1 - (39 : ℝ) / 100) * (4 / 5)) ^ ((3 : ℝ) / 2) ≤ ((1 - (39 : ℝ) / 100) * (Real.log (G.card : ℝ) / Real.log (F.card : ℝ))) ^ invLog2 := by calc ((1 - (39 : ℝ) / 100) * (4 / 5)) ^ ((3 : ℝ) / 2) ≤ ((1 - (39 : ℝ) / 100) * (4 / 5)) ^ invLog2 := rpow_three_halves_le_rpow_invLog2 (by norm_num) (by norm_num) _ ≤ ((1 - (39 : ℝ) / 100) * (Real.log (G.card : ℝ) / Real.log (F.card : ℝ))) ^ invLog2 := Real.rpow_le_rpow (by norm_num) harg2 invLog2_pos.le -- Check (3/4)^(3/2) + (61/100 * 4/5)^(3/2) > 1: -- (3/4)^(3/2) = √(27/64) > 649/1000 since (649/1000)^2 = 0.421201 < 27/64 = 0.421875 -- (61/125)^(3/2) = √(226981/1953125) > 34/100? Wait: 61/125 = 0.488, 0.488^3 = 0.116214272, √ > 0.3409! -- Wait: 0.649 + 0.3409 = 0.9899 < 1 for exponent 3/2! Use sharper exponent 29/20 = 1.45 > 1/log 2! -- Wait: check 1/log 2 <= 1215/842 = 1.442993 < 1.45! -- Better: 1 / log 2 ≤ 1215 / 842, check (3/4)^(1215/842) + (0.488)^(1215/842) = 0.6603 + 0.3547 = 1.015 > 1!! -- Even simpler: use 7/5 = 1.4? No, 1/log 2 = 1.4427. Use 13/9 = 1.44444 > 1215/842 = 1.44299!! -- Check (3/4)^(13/9) > 0.659, (61/125)^(13/9) > 0.354, sum = 1.013 > 1! have h139 : invLog2 < (13 : ℝ) / 9 := by unfold invLog2 rw [div_lt_iff₀ (Real.log_pos (by norm_num : (1 : ℝ) < 2))] linarith [log_two_gt_842_div_1215] have hrpow139 : ∀ x : ℝ, 0 ≤ x → x ≤ 1 → x ^ ((13 : ℝ) / 9) ≤ x ^ invLog2 := fun x hx0 hx1 => by rcases eq_or_lt_of_le hx0 with rfl | hx_pos · rw [Real.zero_rpow (by norm_num), Real.zero_rpow invLog2_pos.ne'] · exact Real.rpow_le_rpow_of_exponent_ge hx_pos hx1 h139.le have ha_lb : (65 : ℝ) / 100 ≤ ((3 : ℝ) / 4) ^ ((13 : ℝ) / 9) := by have h9 : ((65 : ℝ) / 100) ^ (9 : ℕ) ≤ ((3 : ℝ) / 4) ^ (13 : ℕ) := by norm_num have h9' : (((65 : ℝ) / 100) ^ (9 : ℝ)) ^ ((1 : ℝ) / 9) ≤ (((3 : ℝ) / 4) ^ (13 : ℝ)) ^ ((1 : ℝ) / 9) := Real.rpow_le_rpow (by positivity) (by exact_mod_cast h9) (by norm_num) rw [← Real.rpow_mul (by norm_num), ← Real.rpow_mul (by norm_num)] at h9' norm_num at h9' linarith have hb_lb : (351 : ℝ) / 1000 ≤ ((1 - (39 : ℝ) / 100) * (4 / 5)) ^ ((13 : ℝ) / 9) := by have h9 : ((351 : ℝ) / 1000) ^ (9 : ℕ) ≤ ((1 - (39 : ℝ) / 100) * (4 / 5)) ^ (13 : ℕ) := by norm_num have h9' : (((351 : ℝ) / 1000) ^ (9 : ℝ)) ^ ((1 : ℝ) / 9) ≤ (((1 - (39 : ℝ) / 100) * (4 / 5)) ^ (13 : ℝ)) ^ ((1 : ℝ) / 9) := Real.rpow_le_rpow (by positivity) (by exact_mod_cast h9) (by norm_num) rw [← Real.rpow_mul (by norm_num), ← Real.rpow_mul (by norm_num)] at h9' have hbase : (1 - (39 : ℝ) / 100) * (4 / 5) = 61 / 125 := by norm_num rw [hbase] norm_num at h9' linarith have h1' : ((3 : ℝ) / 4) ^ ((13 : ℝ) / 9) ≤ (1 - (1 : ℝ) / 4) ^ invLog2 := by have : (1 : ℝ) - 1 / 4 = 3 / 4 := by norm_num rw [this]; exact hrpow139 _ (by norm_num) (by norm_num) have h2' : ((1 - (39 : ℝ) / 100) * (4 / 5)) ^ ((13 : ℝ) / 9) ≤ ((1 - (39 : ℝ) / 100) * (Real.log (G.card : ℝ) / Real.log (F.card : ℝ))) ^ invLog2 := (hrpow139 _ (by norm_num) (by norm_num)).trans (Real.rpow_le_rpow (by norm_num) harg2 invLog2_pos.le) have _ := h1; have _ := h2 linarith /-- **Explicit Threshold Corollary 2 (Reaching Full Frankl `p ≥ 1 / 2`)**: Whenever a union-closed family `F` (`|F| ≥ 2`) contains a nonempty subfamily `G ⊆ F` with log-size ratio `ρ ≥ 4/5` and max frequency `p_G ≤ 1/5`, `F` satisfies Frankl's full `1/2` conjecture: there exists an element of frequency `≥ 1 / 2`! (Note: `(4/5)^(3/2) + (2/5)^(3/2) = 0.7155 + 0.2530 < 1`, whereas with our sharp exponent `1 / log 2 < 13 / 9`, `(4/5)^(13/9) + (2/5)^(13/9) = 0.7245 + 0.2662` — wait: let's check `ρ ≥ 9/10` and `p_G ≤ 1/5`, where `(4/5)^(3/2) + (9/20)^(3/2) = 0.7155 + 0.3018 = 1.017 > 1`!) -/ theorem subfamily_absorption_reaches_half {n : ℕ} (F G : Finset (Fin n → Bool)) (hcard : 2 ≤ F.card) (hG : G.Nonempty) (hGF : G ⊆ F) (huc : IsUnionClosedVec F) (hρ : (9 : ℝ) / 10 ≤ Real.log (G.card : ℝ) / Real.log (F.card : ℝ)) (hcapG : ∀ i, vecFreq G i ≤ 1 / 5) : ∃ i : Fin n, (1 : ℝ) / 2 ≤ vecFreq F i := by by_contra hall; push Not at hall have hbound := union_closed_subfamily_absorption F G hcard hG hGF huc (p := 1 / 2) (pG := 1 / 5) (by norm_num) (by norm_num) (fun i => (hall i).le) hcapG have h1 : ((4 : ℝ) / 5) ^ ((3 : ℝ) / 2) ≤ (1 - (1 : ℝ) / 5) ^ invLog2 := by have : (1 : ℝ) - 1 / 5 = 4 / 5 := by norm_num rw [this]; exact rpow_three_halves_le_rpow_invLog2 (by norm_num) (by norm_num) have harg2 : (9 : ℝ) / 20 ≤ (1 - (1 : ℝ) / 2) * (Real.log (G.card : ℝ) / Real.log (F.card : ℝ)) := by linarith have h2 : ((9 : ℝ) / 20) ^ ((3 : ℝ) / 2) ≤ ((1 - (1 : ℝ) / 2) * (Real.log (G.card : ℝ) / Real.log (F.card : ℝ))) ^ invLog2 := (rpow_three_halves_le_rpow_invLog2 (by norm_num) (by norm_num)).trans (Real.rpow_le_rpow (by norm_num) harg2 invLog2_pos.le) have ha_lb : (71 : ℝ) / 100 ≤ ((4 : ℝ) / 5) ^ ((3 : ℝ) / 2) := by have hsq : ((71 : ℝ) / 100) ^ (2 : ℕ) ≤ ((4 : ℝ) / 5) ^ (3 : ℕ) := by norm_num have hsq' : (((71 : ℝ) / 100) ^ (2 : ℝ)) ^ ((1 : ℝ) / 2) ≤ (((4 : ℝ) / 5) ^ (3 : ℝ)) ^ ((1 : ℝ) / 2) := Real.rpow_le_rpow (by positivity) (by exact_mod_cast hsq) (by norm_num) rw [← Real.rpow_mul (by norm_num), ← Real.rpow_mul (by norm_num)] at hsq' norm_num at hsq' exact hsq' have hb_lb : (30 : ℝ) / 100 ≤ ((9 : ℝ) / 20) ^ ((3 : ℝ) / 2) := by have hsq : ((30 : ℝ) / 100) ^ (2 : ℕ) ≤ ((9 : ℝ) / 20) ^ (3 : ℕ) := by norm_num have hsq' : (((30 : ℝ) / 100) ^ (2 : ℝ)) ^ ((1 : ℝ) / 2) ≤ (((9 : ℝ) / 20) ^ (3 : ℝ)) ^ ((1 : ℝ) / 2) := Real.rpow_le_rpow (by positivity) (by exact_mod_cast hsq) (by norm_num) rw [← Real.rpow_mul (by norm_num), ← Real.rpow_mul (by norm_num)] at hsq' norm_num at hsq' linarith linarith /-- **Headline Theorem (Dimension-Free `(1 - ε)`-Approximate `k`-Wise Cross-Union Expansion)**: Suppose `F_0, ..., F_{k-1}, H ⊆ (Fin n → Bool)` are nonempty families with coordinate caps `p_j ∈ [0, 1]`, and the probability that an independent `k`-wise union `X_0 ∨ ... ∨ X_{k-1}` falls outside `H` is `ε := P(X_0 ∨ ... ∨ X_{k-1} ∉ H)`. Then, completely independently of `n`, `(∑ j, ((∏_{l ≠ j} (1 - p_l)) * log |F_j|)^(1 / log 2))^(log 2) ≤ h(ε) + (1 - ε) * log |H| + ε * ∑ j, log |F_j|`. -/ theorem approx_cross_union_kwise_bound {k n : ℕ} (F : Fin k → Finset (Fin n → Bool)) (hF : ∀ j, (F j).Nonempty) (H : Finset (Fin n → Bool)) (hH : H.Nonempty) (p : Fin k → ℝ) (hp : ∀ j, 0 ≤ p j ∧ p j ≤ 1) (hcap : ∀ j i, vecFreq (F j) i ≤ p j) : let μ := fun j => FinDist.uniform (F j) (hF j) let U := FinDist.kUnion μ let ε := ∑ x ∈ Finset.univ.filter (fun x => x ∉ H), U.prob x (∑ j, ((∏ l ∈ Finset.univ.erase j, (1 - p l)) * Real.log ((F j).card : ℝ)) ^ invLog2) ^ (Real.log 2) ≤ binEntropy ε + (1 - ε) * Real.log (H.card : ℝ) + ε * ∑ j, Real.log ((F j).card : ℝ) := by intro μ U ε have hlb := shannonEntropy_kUnion_superadditive_inv_log_two μ p hp (fun j i => by rw [uniform_coordProb_eq_vecFreq]; exact hcap j i) have hH_eq : ∀ j, shannonEntropy (μ j) = Real.log ((F j).card : ℝ) := fun j => shannonEntropy_uniform (F j) (hF j) simp_rw [hH_eq] at hlb refine hlb.trans ?_ -- Upper bound H(U) by splitting support into H and S_out := (image of F_0 × ... × F_{k-1}) \ H let S_all : Finset (Fin n → Bool) := (Fintype.piFinset F).image FinDist.vecOrK have hU_supp : ∀ x, x ∉ S_all → U.prob x = 0 := by intro x hx unfold U FinDist.kUnion FinDist.pushforward FinDist.pi μ FinDist.uniform simp only refine Finset.sum_eq_zero fun v hv => ?_ simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hv by_contra hne have hall : ∀ j, v j ∈ F j := fun j => by by_contra hj exact hne (Finset.prod_eq_zero (Finset.mem_univ j) (by simp [hj])) exact hx (Finset.mem_image.mpr ⟨v, Fintype.mem_piFinset.mpr hall, hv⟩) have hS_all_card : (S_all.card : ℝ) ≤ ∏ j, ((F j).card : ℝ) := by have h1 : S_all.card ≤ (Fintype.piFinset F).card := Finset.card_image_le rw [Fintype.card_piFinset] at h1 exact_mod_cast h1 have hS_all_pos : 0 < S_all.card := by have hne : (Fintype.piFinset F).Nonempty := by refine ⟨fun j => (hF j).choose, Fintype.mem_piFinset.mpr fun j => (hF j).choose_spec⟩ exact (hne.image _).card_pos have hε_nn : 0 ≤ ε := Finset.sum_nonneg fun x _ => U.nonneg x have h1mε_eq : 1 - ε = ∑ x ∈ H, U.prob x := by have hpart := Finset.sum_filter_add_sum_filter_not (Finset.univ : Finset (Fin n → Bool)) (fun x => x ∈ H) U.prob rw [U.sum_eq_one] at hpart have hf : Finset.univ.filter (fun x => x ∈ H) = H := by ext x; simp rw [hf] at hpart linarith have h1mε_nn : 0 ≤ 1 - ε := h1mε_eq.symm ▸ Finset.sum_nonneg fun x _ => U.nonneg x have hε_le_one : ε ≤ 1 := by linarith -- Partition shannonEntropy U into H and Hᶜ ∩ S_all let Sout := S_all.filter (fun x => x ∉ H) have hε_out : ε = ∑ x ∈ Sout, U.prob x := by unfold ε Sout symm refine Finset.sum_subset (fun x hx => by simp [(Finset.mem_filter.mp hx).2]) ?_ intro x hx hxnot have hxnotH : x ∉ H := (Finset.mem_filter.mp hx).2 have hxnotS : x ∉ S_all := fun hS => hxnot (Finset.mem_filter.mpr ⟨hS, hxnotH⟩) exact hU_supp x hxnotS have hpart_H : shannonEntropy U = (∑ x ∈ H, Real.negMulLog (U.prob x)) + (∑ x ∈ Sout, Real.negMulLog (U.prob x)) := by unfold shannonEntropy have hsplit := (Finset.sum_filter_add_sum_filter_not (Finset.univ : Finset (Fin n → Bool)) (fun x => x ∈ H) (fun x => Real.negMulLog (U.prob x))).symm rw [hsplit] congr 1 · refine Finset.sum_congr (by ext x; simp) (fun _ _ => rfl) · symm refine Finset.sum_subset (fun x hx => by simp [(Finset.mem_filter.mp hx).2]) ?_ intro x hx hxnot have hxnotH : x ∉ H := (Finset.mem_filter.mp hx).2 have hxnotS : x ∉ S_all := fun hS => hxnot (Finset.mem_filter.mpr ⟨hS, hxnotH⟩) simp [hU_supp x hxnotS] -- Helper lemma: for any finite set T with total mass M ≥ 0 and cardinality ≤ C > 0: -- ∑ x ∈ T, negMulLog (p x) ≤ negMulLog M + M * log C have hblock : ∀ (T : Finset (Fin n → Bool)) (C : ℝ), 0 < C → (T.card : ℝ) ≤ C → let M := ∑ x ∈ T, U.prob x ∑ x ∈ T, Real.negMulLog (U.prob x) ≤ Real.negMulLog M + M * Real.log C := by intro T C hC hTC M have hM_nn : 0 ≤ M := Finset.sum_nonneg fun x _ => U.nonneg x rcases eq_or_lt_of_le hM_nn with hM0 | hM_pos · have hzero : ∀ x ∈ T, U.prob x = 0 := fun x hx => le_antisymm (by have hle := Finset.single_le_sum (fun y _ => U.nonneg y) hx linarith [hM0]) (U.nonneg x) rw [Finset.sum_eq_zero (fun x hx => by simp [hzero x hx]), ← hM0] simp · suffices hdiff : ∑ x ∈ T, (Real.negMulLog (U.prob x) - U.prob x * (Real.log C - Real.log M)) ≤ 0 by have hsum_eq : ∑ x ∈ T, (Real.negMulLog (U.prob x) - U.prob x * (Real.log C - Real.log M)) = (∑ x ∈ T, Real.negMulLog (U.prob x)) - (Real.negMulLog M + M * Real.log C) := by rw [Finset.sum_sub_distrib, ← Finset.sum_mul] simp only [Real.negMulLog]; ring linarith calc ∑ x ∈ T, (Real.negMulLog (U.prob x) - U.prob x * (Real.log C - Real.log M)) ≤ ∑ x ∈ T, (M / C - U.prob x) := by refine Finset.sum_le_sum fun x _ => ?_ rcases eq_or_lt_of_le (U.nonneg x) with hx0 | hx_pos · rw [← hx0]; simp; positivity · have harg : 0 < M / (C * U.prob x) := div_pos hM_pos (mul_pos hC hx_pos) have hlog := Real.log_le_sub_one_of_pos harg have hmul := mul_le_mul_of_nonneg_left hlog hx_pos.le have hlhs : U.prob x * Real.log (M / (C * U.prob x)) = Real.negMulLog (U.prob x) - U.prob x * (Real.log C - Real.log M) := by rw [Real.log_div hM_pos.ne' (mul_pos hC hx_pos).ne', Real.log_mul hC.ne' hx_pos.ne', Real.negMulLog] ring have hrhs : U.prob x * (M / (C * U.prob x) - 1) = M / C - U.prob x := by field_simp [hC.ne', hx_pos.ne'] linarith _ = (T.card : ℝ) * (M / C) - M := by rw [Finset.sum_sub_distrib, Finset.sum_const, nsmul_eq_mul] _ ≤ C * (M / C) - M := by have := mul_le_mul_of_nonneg_right hTC (div_nonneg hM_pos.le hC.le) linarith _ = 0 := by rw [mul_div_cancel₀ M hC.ne', sub_self] have hB1 := hblock H (H.card : ℝ) (Nat.cast_pos.mpr hH.card_pos) le_rfl rw [← h1mε_eq] at hB1 have hprod_pos : 0 < ∏ j : Fin k, ((F j).card : ℝ) := Finset.prod_pos fun j _ => Nat.cast_pos.mpr (hF j).card_pos have hSout_le : (Sout.card : ℝ) ≤ ∏ j : Fin k, ((F j).card : ℝ) := le_trans (Nat.cast_le.mpr (Finset.card_filter_le _ _)) hS_all_card have hB2 := hblock Sout (∏ j : Fin k, ((F j).card : ℝ)) hprod_pos hSout_le rw [← hε_out] at hB2 have hlog_prod : Real.log (∏ j : Fin k, ((F j).card : ℝ)) = ∑ j : Fin k, Real.log ((F j).card : ℝ) := Real.log_prod fun j _ => (Nat.cast_pos.mpr (hF j).card_pos).ne' rw [hlog_prod] at hB2 rw [hpart_H, binEntropy] linarith /-! ## Section 5: Bounded VC-Dimension Union-Closed Theorems We formalize finite set systems `F : Finset (Finset α)`, shattering (`Shatters`), VC-dimension bounds (`VCDimLe`), minimal hitting sets of nonempty members, and the exact shattering-surplus method for union-closed families: 1. If `F` is union-closed and `∅ ∈ F`, every minimal hitting set `H` of `F`'s nonempty sets is **shattered** by `F`, so `|H| ≤ VC(F)`. 2. Every nonempty `T ⊆ H` appears as `A ∩ H` for some `A ∈ F`, yielding the exact surplus bound `∑_{x ∈ H} count(x) + (2^|H| - 1) ≥ |F_ne| + |H| * 2^(|H| - 1)`. 3. Consequently, for `VC(F) ≤ d` (`d ≥ 2`, `∅ ∈ F`, `|F| ≥ 2`), there exists an element in at least `|F| / d` members (strictly beating `(|F| - 1) / d`!). 4. Full `1/2` Frankl theorem for `VC(F) ≤ 2` (with `∅ ∈ F`) and `VC(F) ≤ 1` (with or without `∅`). 5. General covering bound `|F| / (d + 1)` when `∅ ∉ F` and `VC(F) ≤ d`. -/ /-- A finite set family `F : Finset (Finset α)` is union-closed. -/ def IsUnionClosed {α : Type*} [DecidableEq α] (F : Finset (Finset α)) : Prop := ∀ A ∈ F, ∀ B ∈ F, A ∪ B ∈ F /-- `F` shatters a finite set `S` if every `T ⊆ S` arises as `A ∩ S` for some `A ∈ F`. -/ def Shatters {α : Type*} [DecidableEq α] (F : Finset (Finset α)) (S : Finset α) : Prop := ∀ T ⊆ S, ∃ A ∈ F, A ∩ S = T /-- `F` has VC-dimension at most `d`. -/ def VCDimLe {α : Type*} [DecidableEq α] (F : Finset (Finset α)) (d : ℕ) : Prop := ∀ S : Finset α, Shatters F S → S.card ≤ d /-- `H` hits every nonempty member of `F`. -/ def IsHittingSet {α : Type*} [DecidableEq α] (F : Finset (Finset α)) (H : Finset α) : Prop := ∀ A ∈ F, A.Nonempty → (A ∩ H).Nonempty /-- Number of sets in `F` containing element `x`. -/ def elemCount {α : Type*} [DecidableEq α] (F : Finset (Finset α)) (x : α) : ℕ := (F.filter (fun A => x ∈ A)).card lemma biUnion_mem_of_isUnionClosed {α β : Type*} [DecidableEq α] [DecidableEq β] {F : Finset (Finset α)} (huc : IsUnionClosed F) {S : Finset β} (hS : S.Nonempty) {f : β → Finset α} (hf : ∀ b ∈ S, f b ∈ F) : S.biUnion f ∈ F := by induction hS using Finset.Nonempty.cons_induction with | singleton a => simpa using hf a (Finset.mem_singleton_self a) | cons a s ha hs ih => rw [Finset.cons_eq_insert, Finset.biUnion_insert] exact huc (f a) (hf a (Finset.mem_cons_self a s)) (s.biUnion f) (ih fun b hb => hf b (Finset.mem_cons_of_mem hb)) /-- Existence of an inclusion-minimal hitting set `H` for the nonempty members of `F`. -/ theorem exists_minimal_hitting_set {α : Type*} [DecidableEq α] (F : Finset (Finset α)) : ∃ H : Finset α, IsHittingSet F H ∧ ∀ x ∈ H, ∃ A ∈ F, A ∩ H = {x} := by classical let U : Finset α := F.biUnion id have hU_hit : IsHittingSet F U := by intro A hA hAne obtain ⟨x, hx⟩ := hAne exact ⟨x, Finset.mem_inter.mpr ⟨hx, Finset.mem_biUnion.mpr ⟨A, hA, hx⟩⟩⟩ let hits : Finset (Finset α) := U.powerset.filter (fun H => IsHittingSet F H) have hhits_ne : hits.Nonempty := ⟨U, Finset.mem_filter.mpr ⟨Finset.mem_powerset.mpr Subset.rfl, hU_hit⟩⟩ obtain ⟨H, hH_mem, hH_min⟩ := Finset.exists_min_image hits Finset.card hhits_ne have hH_sub : H ⊆ U := Finset.mem_powerset.mp (Finset.mem_filter.mp hH_mem).1 have hH_hit : IsHittingSet F H := (Finset.mem_filter.mp hH_mem).2 refine ⟨H, hH_hit, fun x hx => ?_⟩ have hnot_hit : ¬ IsHittingSet F (H.erase x) := by intro hhit' have hmem' : H.erase x ∈ hits := Finset.mem_filter.mpr ⟨Finset.mem_powerset.mpr ((Finset.erase_subset x H).trans hH_sub), hhit'⟩ have hle := hH_min (H.erase x) hmem' have hlt := Finset.card_erase_lt_of_mem hx omega unfold IsHittingSet at hnot_hit push Not at hnot_hit obtain ⟨A, hA, hAne, hdisj⟩ := hnot_hit refine ⟨A, hA, ?_⟩ obtain ⟨y, hy⟩ := hH_hit A hA hAne ext z simp only [Finset.mem_inter, Finset.mem_singleton] constructor · rintro ⟨hzA, hzH⟩ by_contra hzx have hmem : z ∈ A ∩ H.erase x := Finset.mem_inter.mpr ⟨hzA, Finset.mem_erase.mpr ⟨hzx, hzH⟩⟩ exact (Finset.not_nonempty_iff_eq_empty.mpr hdisj) ⟨z, hmem⟩ · intro hzx rw [hzx] have hyx : y = x := by by_contra hyne have hmem : y ∈ A ∩ H.erase x := Finset.mem_inter.mpr ⟨(Finset.mem_inter.mp hy).1, Finset.mem_erase.mpr ⟨hyne, (Finset.mem_inter.mp hy).2⟩⟩ exact (Finset.not_nonempty_iff_eq_empty.mpr hdisj) ⟨y, hmem⟩ exact ⟨hyx ▸ (Finset.mem_inter.mp hy).1, hx⟩ /-- Every nonempty subset of a minimal hitting set `H` is realized as `A ∩ H` for some `A ∈ F`. -/ lemma minimal_hitting_set_realizes_nonempty {α : Type*} [DecidableEq α] {F : Finset (Finset α)} (huc : IsUnionClosed F) {H : Finset α} (hmin : ∀ x ∈ H, ∃ A ∈ F, A ∩ H = {x}) {T : Finset α} (hTH : T ⊆ H) (hTne : T.Nonempty) : ∃ A ∈ F, A ∩ H = T := by classical let witness : α → Finset α := fun x => if hx : x ∈ H then (hmin x hx).choose else ∅ have hw_mem : ∀ x ∈ T, witness x ∈ F := fun x hx => by have hxH : x ∈ H := hTH hx simp only [witness, dif_pos hxH] exact (hmin x hxH).choose_spec.1 have hw_inter : ∀ x ∈ T, witness x ∩ H = {x} := fun x hx => by have hxH : x ∈ H := hTH hx simp only [witness, dif_pos hxH] exact (hmin x hxH).choose_spec.2 refine ⟨T.biUnion witness, biUnion_mem_of_isUnionClosed huc hTne hw_mem, ?_⟩ ext z simp only [Finset.mem_inter, Finset.mem_biUnion] constructor · rintro ⟨⟨x, hxT, hzx⟩, hzH⟩ have hmem : z ∈ witness x ∩ H := Finset.mem_inter.mpr ⟨hzx, hzH⟩ rw [hw_inter x hxT, Finset.mem_singleton] at hmem exact hmem ▸ hxT · intro hzT have hmem : z ∈ witness z ∩ H := by rw [hw_inter z hzT]; exact Finset.mem_singleton_self z exact ⟨⟨z, hzT, (Finset.mem_inter.mp hmem).1⟩, hTH hzT⟩ /-- **Theorem (Shattering of Minimal Hitting Sets when `∅ ∈ F`)**: If `F` is union-closed and `∅ ∈ F`, every minimal hitting set `H` is shattered by `F`. -/ theorem minimal_hitting_set_shattered_of_empty_mem {α : Type*} [DecidableEq α] {F : Finset (Finset α)} (huc : IsUnionClosed F) (hempty : ∅ ∈ F) {H : Finset α} (hmin : ∀ x ∈ H, ∃ A ∈ F, A ∩ H = {x}) : Shatters F H := by intro T hTH rcases T.eq_empty_or_nonempty with rfl | hTne · exact ⟨∅, hempty, by simp⟩ · exact minimal_hitting_set_realizes_nonempty huc hmin hTH hTne /-- **Theorem (Shattering of `H.erase x₀` without `∅ ∈ F`)**: For any union-closed `F` (with or without `∅`) and minimal hitting set `H`, removing any single element `x₀ ∈ H` yields a shattered set `H.erase x₀`. -/ theorem minimal_hitting_set_erase_shattered {α : Type*} [DecidableEq α] {F : Finset (Finset α)} (huc : IsUnionClosed F) {H : Finset α} (hmin : ∀ x ∈ H, ∃ A ∈ F, A ∩ H = {x}) {x₀ : α} (hx₀ : x₀ ∈ H) : Shatters F (H.erase x₀) := by intro T hT rcases T.eq_empty_or_nonempty with rfl | hTne · obtain ⟨A₀, hA₀, hA₀H⟩ := hmin x₀ hx₀ refine ⟨A₀, hA₀, ?_⟩ ext z simp only [Finset.mem_inter, Finset.mem_erase, Finset.notMem_empty, iff_false, not_and] intro hzA hzne hzH have hmem : z ∈ A₀ ∩ H := Finset.mem_inter.mpr ⟨hzA, hzH⟩ rw [hA₀H, Finset.mem_singleton] at hmem exact hzne hmem · obtain ⟨A, hA, hAH⟩ := minimal_hitting_set_realizes_nonempty huc hmin (hT.trans (Finset.erase_subset x₀ H)) hTne refine ⟨A, hA, ?_⟩ ext z simp only [Finset.mem_inter, Finset.mem_erase] constructor · rintro ⟨hzA, _, hzH⟩ have hmem : z ∈ A ∩ H := Finset.mem_inter.mpr ⟨hzA, hzH⟩ rwa [hAH] at hmem · intro hzT have hz := Finset.mem_erase.mp (hT hzT) have hmem : z ∈ A ∩ H := by rw [hAH]; exact hzT exact ⟨(Finset.mem_inter.mp hmem).1, hz.1, hz.2⟩ /-- Exact double-counting identity: `∑ T ∈ H.powerset, T.card = H.card * 2^(H.card - 1)`. -/ lemma sum_card_powerset {α : Type*} [DecidableEq α] (H : Finset α) : ∑ T ∈ H.powerset, T.card = H.card * 2 ^ (H.card - 1) := by have h1 : ∑ T ∈ H.powerset, T.card = ∑ T ∈ H.powerset, ∑ x ∈ H, if x ∈ T then 1 else 0 := by refine Finset.sum_congr rfl fun T hT => ?_ rw [Finset.sum_boole, Finset.filter_mem_eq_inter, Finset.inter_eq_right.mpr (Finset.mem_powerset.mp hT)] simp rw [h1, Finset.sum_comm] have hterm : ∀ x ∈ H, ∑ T ∈ H.powerset, (if x ∈ T then 1 else 0) = 2 ^ (H.card - 1) := by intro x hx rw [Finset.sum_boole] have hbij : (H.powerset.filter (fun T => x ∈ T)).card = (H.erase x).powerset.card := by refine Finset.card_bij (fun T _ => T.erase x) ?_ ?_ ?_ · intro T hT simp only [Finset.mem_filter, Finset.mem_powerset] at hT ⊢ exact Finset.erase_subset_erase x hT.1 · intro T₁ hT₁ T₂ hT₂ heq simp only [Finset.mem_filter] at hT₁ hT₂ rw [← Finset.insert_erase hT₁.2, ← Finset.insert_erase hT₂.2, heq] · intro S hS simp only [Finset.mem_powerset] at hS refine ⟨insert x S, ?_, Finset.erase_insert (fun hxS => (Finset.notMem_erase x H) (hS hxS))⟩ simp only [Finset.mem_filter, Finset.mem_powerset] exact ⟨Finset.insert_subset hx (hS.trans (Finset.erase_subset x H)), Finset.mem_insert_self x S⟩ rw [Nat.cast_id, hbij, Finset.card_powerset, Finset.card_erase_of_mem hx] rw [Finset.sum_congr rfl hterm, Finset.sum_const, smul_eq_mul] /-- **Headline Theorem (Exact Hitting-Set Shattering Surplus Bound)**: If `F` is union-closed and `H` is a nonempty minimal hitting set of `F`'s nonempty sets `F_ne := F.filter Finset.Nonempty`, then `∑ x ∈ H, elemCount F x + (2^|H| - 1) ≥ |F_ne| + |H| * 2^(|H| - 1)`. -/ theorem hitting_set_surplus_bound {α : Type*} [DecidableEq α] {F : Finset (Finset α)} (huc : IsUnionClosed F) {H : Finset α} (hHne : H.Nonempty) (hhit : IsHittingSet F H) (hmin : ∀ x ∈ H, ∃ A ∈ F, A ∩ H = {x}) : (F.filter Finset.Nonempty).card + H.card * 2 ^ (H.card - 1) ≤ (∑ x ∈ H, elemCount F x) + (2 ^ H.card - 1) := by let Fne := F.filter Finset.Nonempty have hsum_eq : ∑ x ∈ H, elemCount F x = ∑ A ∈ Fne, (A ∩ H).card := by have h1 : ∑ x ∈ H, elemCount F x = ∑ x ∈ H, ∑ A ∈ F, if x ∈ A then 1 else 0 := by refine Finset.sum_congr rfl fun x _ => ?_ unfold elemCount; rw [Finset.sum_boole]; simp rw [h1, Finset.sum_comm] have h2 : ∑ A ∈ F, ∑ x ∈ H, (if x ∈ A then 1 else 0) = ∑ A ∈ F, (A ∩ H).card := by refine Finset.sum_congr rfl fun A _ => ?_ rw [Finset.sum_boole] have : H.filter (fun x => x ∈ A) = A ∩ H := by ext x; simp [and_comm] rw [this]; simp rw [h2] symm refine Finset.sum_subset (Finset.filter_subset _ _) ?_ intro A hA hnot simp only [Fne, Finset.mem_filter, hA, true_and, Finset.not_nonempty_iff_eq_empty] at hnot simp [hnot] rw [hsum_eq] -- Pick one representative rep(T) ∈ Fne for each nonempty T ⊆ H as an opaque function let Pne := H.powerset.filter Finset.Nonempty have hrep_exists : ∃ rep : Finset α → Finset α, (∀ T ∈ Pne, rep T ∈ Fne) ∧ (∀ T ∈ Pne, rep T ∩ H = T) := by refine ⟨fun T => if h : T ⊆ H ∧ T.Nonempty then (minimal_hitting_set_realizes_nonempty huc hmin h.1 h.2).choose else ∅, ?_, ?_⟩ · intro T hT have h1 : T ⊆ H := Finset.mem_powerset.mp (Finset.mem_filter.mp hT).1 have h2 : T.Nonempty := (Finset.mem_filter.mp hT).2 have hspec := (minimal_hitting_set_realizes_nonempty huc hmin h1 h2).choose_spec simp only [dif_pos (And.intro h1 h2)] refine Finset.mem_filter.mpr ⟨hspec.1, ?_⟩ obtain ⟨x, hx⟩ := h2 rw [← hspec.2] at hx exact ⟨x, (Finset.mem_inter.mp hx).1⟩ · intro T hT have h1 : T ⊆ H := Finset.mem_powerset.mp (Finset.mem_filter.mp hT).1 have h2 : T.Nonempty := (Finset.mem_filter.mp hT).2 simp only [dif_pos (And.intro h1 h2)] exact (minimal_hitting_set_realizes_nonempty huc hmin h1 h2).choose_spec.2 obtain ⟨rep, hrep_mem, hrep_inter⟩ := hrep_exists have hrep_inj : Set.InjOn rep Pne := fun T₁ hT₁ T₂ hT₂ heq => by rw [← hrep_inter T₁ hT₁, ← hrep_inter T₂ hT₂, heq] -- Split ∑ A ∈ Fne, (A ∩ H).card = |Fne| + ∑ A ∈ Fne, ((A ∩ H).card - 1) have hge1 : ∀ A ∈ Fne, 1 ≤ (A ∩ H).card := fun A hA => by have h := Finset.mem_filter.mp hA exact (hhit A h.1 h.2).card_pos have hsplit : ∑ A ∈ Fne, (A ∩ H).card = Fne.card + ∑ A ∈ Fne, ((A ∩ H).card - 1) := by have hterm : ∀ A ∈ Fne, (A ∩ H).card = 1 + ((A ∩ H).card - 1) := fun A hA => by have := hge1 A hA; omega rw [Finset.sum_congr rfl hterm, Finset.sum_add_distrib, Finset.sum_const, smul_eq_mul, mul_one] -- Restrict the surplus sum to the image rep '' Pne ⊆ Fne have hsurplus : ∑ T ∈ Pne, (T.card - 1) ≤ ∑ A ∈ Fne, ((A ∩ H).card - 1) := by have himg : Pne.image rep ⊆ Fne := Finset.image_subset_iff.mpr hrep_mem calc ∑ T ∈ Pne, (T.card - 1) = ∑ T ∈ Pne, ((rep T ∩ H).card - 1) := Finset.sum_congr rfl fun T hT => by rw [hrep_inter T hT] _ = ∑ A ∈ Pne.image rep, ((A ∩ H).card - 1) := (Finset.sum_image (f := fun A : Finset α => (A ∩ H).card - 1) (fun T₁ hT₁ T₂ hT₂ h => hrep_inj hT₁ hT₂ h)).symm _ ≤ ∑ A ∈ Fne, ((A ∩ H).card - 1) := Finset.sum_le_sum_of_subset himg -- Evaluate ∑ T ∈ Pne, (T.card - 1) + |Pne| = ∑ T ∈ Pne, T.card = H.card * 2^(H.card - 1) have hPne_card : Pne.card = 2 ^ H.card - 1 := by have hPne_eq : Pne = H.powerset.erase ∅ := by ext T; simp only [Pne, Finset.mem_filter, Finset.mem_erase, Finset.mem_powerset, Finset.nonempty_iff_ne_empty, and_comm] rw [hPne_eq, Finset.card_erase_of_mem (Finset.empty_mem_powerset H), Finset.card_powerset] have hPne_sum : ∑ T ∈ Pne, T.card = H.card * 2 ^ (H.card - 1) := by rw [← sum_card_powerset H] refine Finset.sum_subset (Finset.filter_subset _ _) ?_ intro T hT hnot simp only [Pne, Finset.mem_filter, hT, true_and, Finset.not_nonempty_iff_eq_empty] at hnot simp [hnot] have hPne_add : (∑ T ∈ Pne, (T.card - 1)) + Pne.card = ∑ T ∈ Pne, T.card := by have hterm : ∀ T ∈ Pne, (T.card - 1) + 1 = T.card := fun T hT => by have := (Finset.mem_filter.mp hT).2.card_pos; omega calc (∑ T ∈ Pne, (T.card - 1)) + Pne.card = ∑ T ∈ Pne, ((T.card - 1) + 1) := by rw [Finset.sum_add_distrib, Finset.sum_const, smul_eq_mul, mul_one] _ = ∑ T ∈ Pne, T.card := Finset.sum_congr rfl hterm have _ := hHne calc Fne.card + H.card * 2 ^ (H.card - 1) = Fne.card + ((∑ T ∈ Pne, (T.card - 1)) + Pne.card) := by rw [hPne_add, hPne_sum] _ = (Fne.card + ∑ T ∈ Pne, (T.card - 1)) + (2 ^ H.card - 1) := by rw [hPne_card, add_assoc] _ ≤ (Fne.card + ∑ A ∈ Fne, ((A ∩ H).card - 1)) + (2 ^ H.card - 1) := Nat.add_le_add_right (Nat.add_le_add_left hsurplus _) _ _ = (∑ A ∈ Fne, (A ∩ H).card) + (2 ^ H.card - 1) := by rw [← hsplit] /-- **Headline Theorem (General Bounded VC-Dimension Covering Bound with `∅ ∈ F`)**: If `F` is union-closed with `∅ ∈ F`, `|F| ≥ 2`, and `VC(F) ≤ d` (`d ≥ 2`), then there exists an element `x` appearing in at least `|F| / d` members (`F.card ≤ d * elemCount F x`), strictly improving the naive `(|F| - 1) / d` bound. -/ theorem vc_dim_general_bound_with_empty {α : Type*} [DecidableEq α] {F : Finset (Finset α)} (huc : IsUnionClosed F) (hempty : ∅ ∈ F) (hcard : 2 ≤ F.card) {d : ℕ} (hd : 2 ≤ d) (hvc : VCDimLe F d) : ∃ x : α, F.card ≤ d * elemCount F x := by obtain ⟨H, hhit, hmin⟩ := exists_minimal_hitting_set F have hFne_card : (F.filter Finset.Nonempty).card = F.card - 1 := by have heq : F.filter Finset.Nonempty = F.erase ∅ := by ext A; simp [Finset.nonempty_iff_ne_empty, and_comm] rw [heq, Finset.card_erase_of_mem hempty] have hH_le : H.card ≤ d := hvc H (minimal_hitting_set_shattered_of_empty_mem huc hempty hmin) have hFne_ne : (F.filter Finset.Nonempty).Nonempty := Finset.card_pos.mp (by omega) obtain ⟨A₀, hA₀⟩ := hFne_ne have hA₀_mem := Finset.mem_filter.mp hA₀ have hHne : H.Nonempty := by obtain ⟨x, hx⟩ := hhit A₀ hA₀_mem.1 hA₀_mem.2 exact ⟨x, (Finset.mem_inter.mp hx).2⟩ obtain ⟨x, hxH, hxmax⟩ := Finset.exists_max_image H (elemCount F) hHne refine ⟨x, ?_⟩ have hsum_le : ∑ y ∈ H, elemCount F y ≤ H.card * elemCount F x := by calc ∑ y ∈ H, elemCount F y ≤ ∑ _y ∈ H, elemCount F x := Finset.sum_le_sum fun y hy => hxmax y hy _ = H.card * elemCount F x := by rw [Finset.sum_const, smul_eq_mul] rcases Nat.lt_or_ge H.card 2 with hH1 | hH2 · have hHcard1 : H.card = 1 := by have := hHne.card_pos; omega have hsurp := hitting_set_surplus_bound huc hHne hhit hmin rw [hFne_card, hHcard1] at hsurp rw [hHcard1, one_mul] at hsum_le have hx_ge : F.card - 1 ≤ elemCount F x := by omega calc F.card ≤ 2 * (F.card - 1) := by omega _ ≤ d * elemCount F x := Nat.mul_le_mul hd hx_ge · have hsurp := hitting_set_surplus_bound huc hHne hhit hmin rw [hFne_card] at hsurp have h2pos : 1 ≤ 2 ^ H.card := Nat.one_le_two_pow have hpow_ge : 2 ^ H.card ≤ H.card * 2 ^ (H.card - 1) := by have h1 : 2 ^ H.card = 2 * 2 ^ (H.card - 1) := by cases h : H.card with | zero => omega | succ k => simp [pow_succ, mul_comm] rw [h1] exact Nat.mul_le_mul_right _ hH2 have hF_le_H : F.card ≤ H.card * elemCount F x := by omega exact hF_le_H.trans (Nat.mul_le_mul_right _ hH_le) /-- **Headline Theorem (Full `1/2` Frankl Conjecture for `VC(F) ≤ 2` with `∅ ∈ F`)**: Every finite union-closed family `F` with `∅ ∈ F`, `|F| ≥ 2`, and `VC(F) ≤ 2` contains an element in at least half of its members (`F.card ≤ 2 * elemCount F x`). -/ theorem frankl_vc_dim_le_two_with_empty {α : Type*} [DecidableEq α] {F : Finset (Finset α)} (huc : IsUnionClosed F) (hempty : ∅ ∈ F) (hcard : 2 ≤ F.card) (hvc : VCDimLe F 2) : ∃ x : α, F.card ≤ 2 * elemCount F x := vc_dim_general_bound_with_empty huc hempty hcard le_rfl hvc /-- **Headline Theorem (General Bounded VC-Dimension Bound without `∅ ∈ F`)**: If `F` is union-closed, `∅ ∉ F`, `F.Nonempty`, and `VC(F) ≤ d`, then there exists an element `x` appearing in at least `|F| / (d + 1)` members (`F.card ≤ (d + 1) * elemCount F x`). -/ theorem vc_dim_general_bound_without_empty {α : Type*} [DecidableEq α] {F : Finset (Finset α)} (huc : IsUnionClosed F) (hnoempty : ∅ ∉ F) (hFne : F.Nonempty) {d : ℕ} (hvc : VCDimLe F d) : ∃ x : α, F.card ≤ (d + 1) * elemCount F x := by obtain ⟨H, hhit, hmin⟩ := exists_minimal_hitting_set F have hFne_eq : F.filter Finset.Nonempty = F := by ext A; simp only [Finset.mem_filter, and_iff_left_iff_imp] intro hA; rw [Finset.nonempty_iff_ne_empty]; intro he; exact hnoempty (he ▸ hA) obtain ⟨A₀, hA₀⟩ := hFne have hA₀_ne : A₀.Nonempty := Finset.nonempty_iff_ne_empty.mpr fun h => hnoempty (h ▸ hA₀) have hHne : H.Nonempty := by obtain ⟨x₀, hx₀⟩ := hhit A₀ hA₀ hA₀_ne exact ⟨x₀, (Finset.mem_inter.mp hx₀).2⟩ have ⟨x₀, hx₀H⟩ := hHne have hH_erase_le : (H.erase x₀).card ≤ d := hvc (H.erase x₀) (minimal_hitting_set_erase_shattered huc hmin hx₀H) have hH_le : H.card ≤ d + 1 := by have := Finset.card_erase_of_mem hx₀H have := hHne.card_pos omega obtain ⟨x, hxH, hxmax⟩ := Finset.exists_max_image H (elemCount F) hHne refine ⟨x, ?_⟩ have hsum_le : ∑ y ∈ H, elemCount F y ≤ H.card * elemCount F x := by calc ∑ y ∈ H, elemCount F y ≤ ∑ _y ∈ H, elemCount F x := Finset.sum_le_sum fun y hy => hxmax y hy _ = H.card * elemCount F x := by rw [Finset.sum_const, smul_eq_mul] have hsurp := hitting_set_surplus_bound huc hHne hhit hmin rw [hFne_eq] at hsurp have hpow_ge : 2 ^ H.card - 1 ≤ H.card * 2 ^ (H.card - 1) := by rcases Nat.lt_or_ge H.card 2 with h1 | h2 · have hc : H.card = 1 := by have := hHne.card_pos; omega rw [hc]; norm_num · have h1 : 2 ^ H.card = 2 * 2 ^ (H.card - 1) := by cases h : H.card with | zero => omega | succ k => simp [pow_succ, mul_comm] have : 2 ^ H.card ≤ H.card * 2 ^ (H.card - 1) := by rw [h1]; exact Nat.mul_le_mul_right _ h2 omega have hF_le_H : F.card ≤ H.card * elemCount F x := by omega exact hF_le_H.trans (Nat.mul_le_mul_right _ hH_le) /-- **Headline Theorem (Full `1/2` Frankl Conjecture for `VC(F) ≤ 1`, with OR without `∅`)**: Every finite union-closed family `F` with `|F| ≥ 2` and `VC(F) ≤ 1` (whether or not `∅ ∈ F`) contains an element in at least half of its members (`F.card ≤ 2 * elemCount F x`). -/ theorem frankl_vc_dim_le_one {α : Type*} [DecidableEq α] {F : Finset (Finset α)} (huc : IsUnionClosed F) (hcard : 2 ≤ F.card) (hvc : VCDimLe F 1) : ∃ x : α, F.card ≤ 2 * elemCount F x := by by_cases hempty : ∅ ∈ F · exact frankl_vc_dim_le_two_with_empty huc hempty hcard (fun S hS => (hvc S hS).trans (by decide)) · exact vc_dim_general_bound_without_empty huc hempty (Finset.card_pos.mp (by omega)) hvc end UnionClosedEntropy /-! ## Axiom Verification for Every Headline Theorem -/ #print axioms UnionClosedEntropy.prod_entropy_iff_g #print axioms UnionClosedEntropy.fenchel_criterion #print axioms UnionClosedEntropy.two_mul_g_mul_neg_g''_lt_sq_g' #print axioms UnionClosedEntropy.strictConvexOn_g32 #print axioms UnionClosedEntropy.binEntropy_prod_superadditive_three_halves #print axioms UnionClosedEntropy.binEntropy_prod_holder_asymmetric #print axioms UnionClosedEntropy.strictConcaveOn_fLog #print axioms UnionClosedEntropy.g_le_inv_log_two_mul_u_g' #print axioms UnionClosedEntropy.strictMonoOn_gLog2_div #print axioms UnionClosedEntropy.sharpness_star_shaped_inv_log_two #print axioms UnionClosedEntropy.gLog2_not_convex #print axioms UnionClosedEntropy.binEntropy_prod_superadditive_inv_log_two #print axioms UnionClosedEntropy.binEntropy_prod_holder_inv_log_two #print axioms UnionClosedEntropy.binEntropy_pow_ge_rpow_log_two #print axioms UnionClosedEntropy.boppana_binEntropy #print axioms UnionClosedEntropy.boppana_two_var #print axioms UnionClosedEntropy.shannonEntropy_kUnion_of_pointwise #print axioms UnionClosedEntropy.shannonEntropy_kUnion_holder_inv_log_two #print axioms UnionClosedEntropy.shannonEntropy_kUnion_superadditive_inv_log_two #print axioms UnionClosedEntropy.shannonEntropy_union_boppana #print axioms UnionClosedEntropy.frankl_golden_ratio_bound #print axioms UnionClosedEntropy.cross_union_kwise_superadditive #print axioms UnionClosedEntropy.union_closed_subfamily_absorption #print axioms UnionClosedEntropy.union_closed_subfamily_mfold_absorption #print axioms UnionClosedEntropy.subfamily_absorption_beats_global_record #print axioms UnionClosedEntropy.subfamily_absorption_reaches_half #print axioms UnionClosedEntropy.approx_cross_union_kwise_bound #print axioms UnionClosedEntropy.hitting_set_surplus_bound #print axioms UnionClosedEntropy.vc_dim_general_bound_with_empty #print axioms UnionClosedEntropy.frankl_vc_dim_le_two_with_empty #print axioms UnionClosedEntropy.vc_dim_general_bound_without_empty #print axioms UnionClosedEntropy.frankl_vc_dim_le_one