import Mathlib.Analysis.SpecialFunctions.Log.Basic import Mathlib.Analysis.SpecialFunctions.Log.Deriv import Mathlib.Analysis.SpecialFunctions.Log.NegMulLog import Mathlib.Analysis.Complex.ExponentialBounds import Mathlib.Analysis.Calculus.MeanValue import Mathlib.Topology.Order.IntermediateValue import Mathlib.LinearAlgebra.Dimension.Finrank import Mathlib.LinearAlgebra.FiniteDimensional.Defs import Mathlib.Tactic /-! # Exact Quantitative Theory of Markov Lumpability, Dynamical Information Closure, # Dobrushin Contraction, and Noise-Induced Emergence Phase Transitions ## Overview For a finite microstate space `α`, a row-stochastic Markov transition kernel `P : α → α → ℝ`, and a surjective coarse-graining `π : α → β` onto a finite macrostate space `β`, we establish a completely self-contained Lean 4 theory connecting: 1. **Self-Contained Discrete Information Theory, Pinsker, & Dobrushin Contraction**: - Log-sum inequality (`log_sum_ineq`), Gibbs inequality & equality characterization (`klDiv_nonneg`, `klDiv_eq_zero_iff`), exact Pinsker inequality (`pinsker_ineq`), Dobrushin TV contraction (`tvDist_kernelStep_le_dobrushin`), and our 5-line weighted AM-GM Fiber-Dobrushin Strong Data Processing Inequality (`klDiv_point_mixture_le_tv`). 2. **Kemeny–Snell Strong Lumpability, Dynamical Information Closure (DIC), & NTIC**: - Exact operator intertwining (`stronglyLumpable_iff_intertwining`, `stronglyLumpable_multiStep_intertwining`), exact Bregman–Pythagorean KL projection identity (`dicDefect_pythagorean_projection`), DIC–Strong Lumpability rigidity (`dicDefect_eq_zero_iff_stronglyLumpable`), and NTIC identity & bounds (`ntic_eq_two_macro_sub_micro`, `ntic_bounds`). 3. **Exact Two-Sided Quantitative Sandwich Between Kemeny–Snell `ε`-Lumpability and DIC**: - Universal Pinsker lower bound (`dicDefect_ge_two_mul_sq_avg_tv`). - Fiber-Dobrushin conditional-entropy upper bound (`dicDefect_le_fiberDiam_mul_condEntropy`). - Fiber-size-independent universal macro-cardinality upper bound via linear-algebraic Carathéodory support reduction (`dicDefect_le_fiberDiam_mul_log_card`): `DIC(P, π; μ) ≤ ε_diam(P, π) · min(H_μ(X_t | M_t), ln |β|)`. - Sharpness via the shared-anchor family achieving `DIC = ε · ln(m - 1)` (`dicDefect_tight_sharedAnchor`) and quantitative `ε`-lumpability closure guarantee (`ntic_pos_of_small_ksDefect`). 4. **Dobrushin Contraction Under Coarse-Graining, Horizon-Uniform Intertwining, & Macro-Memory**: - Coarse-graining contraction monotonicity (`dobrushin_coarseGraining_monotone`) and Doeblin minorization bound (`dobrushin_le_of_doeblin`). - Exact finite-horizon and horizon-uniform multi-step intertwining error bounds (`multiStep_intertwining_error_bound`, `multiStep_intertwining_horizon_uniform`) and stationary distribution stability (`stationary_distribution_stability`). - Exact 2-step observable macro-memory decomposition (`dic_eq_mem2_add_hiddenLeakage`) and universal non-Markovianity ceiling (`mem2_le_dicDefect`). 5. **Weak vs. Strong Lumpability & The Weak-Lumpability Closure Paradox**: - Invariant-fiber weak lumpability implies exact Markov path law at all horizons `k ∈ ℕ` and zero macro-memory (`invariantFiber_exact_weakLumpability`, `invariantFiber_mem2_eq_zero`). - Universal Pre-Sampled Shift Lift `P^shift(Q)`: exact weak lumpability at all horizons, `DIC = h_rate(Q)`, and `NTIC = H(q) - 2 h_rate(Q)` (`shiftLift_exact_weakLumpability_and_dic`). - Weak-Lumpability Closure Paradox (`weakLumpability_closure_paradox`): exact Markovianity at all horizons simultaneously with maximal `ε_diam = 1`, maximal `DIC = ln m`, and minimally negative `NTIC = -ln m`. 6. **Three Sharp Noise-Induced Phase Transitions & Strongly Lumpable Predictive Synergy**: - Thermal phase transition in `P^shift(Q_{m, η})`: unique critical noise `η_c(m) < 1/2` with exact asymptotic law `lim_{m→∞} (1/2 - η_c(m)) ln m = ln 2` (`symShiftLift_unique_critical_noise`, `symShiftLift_critical_noise_asymptotic`). - Intra-fiber mixing noise weak-to-strong closure transition with universal bound `λ_c ≤ 1 - I(M_{t+1}; M_t) / DIC(0)` (`fiberMixedKernel_critical_phase_transition`). - Partition-blind global isotropic noise-induced re-entrant informational closure (`globalIsotropicNoise_ntic_sign_flip`) on a 3-state metastable-trap chain. - Exact strong lumpability, zero marginal mutual information, and exact Rosas–Mediano predictive synergy `Ψ_d(p) = ln 2 - h((1 + (1 - 2p)^d)/2)` of `d`-spin binary parity under independent spin-flip noise (`paritySpinKernel_exact_synergy`). -/ open scoped BigOperators open Finset Filter Topology namespace MarkovLumpingClosure /-! ## Section 1: Self-Contained Information Theory, Pinsker, & Dobrushin Contraction -/ /-- A probability distribution on a finite type `α`. -/ def IsProbDist {α : Type*} [Fintype α] (μ : α → ℝ) : Prop := (∀ i, 0 ≤ μ i) ∧ ∑ i, μ i = 1 /-- A row-stochastic Markov transition kernel `K : α → β → ℝ`. -/ def IsStochastic {α β : Type*} [Fintype β] (K : α → β → ℝ) : Prop := ∀ i, IsProbDist (K i) /-- Absolute continuity of discrete non-negative measures: `p i ≠ 0 → q i ≠ 0`. -/ def AbsCont {α : Type*} (p q : α → ℝ) : Prop := ∀ i, p i ≠ 0 → q i ≠ 0 /-- Negative `x log x`, with `0 ↦ 0` by `Real.log 0 = 0`. -/ noncomputable def negMulLog (x : ℝ) : ℝ := -x * Real.log x /-- Discrete Shannon entropy (in nats). -/ noncomputable def shannonEntropy {α : Type*} [Fintype α] (p : α → ℝ) : ℝ := ∑ i, negMulLog (p i) /-- Binary Shannon entropy (in nats). -/ noncomputable def binEntropy (p : ℝ) : ℝ := negMulLog p + negMulLog (1 - p) /-- Discrete Kullback–Leibler divergence (in nats). -/ noncomputable def klDiv {α : Type*} [Fintype α] (p q : α → ℝ) : ℝ := ∑ i, if p i = 0 then 0 else p i * Real.log (p i / q i) /-- Total variation distance `d_TV(p, q) = (1/2) ∑_i |p_i - q_i|`. -/ noncomputable def tvDist {α : Type*} [Fintype α] (p q : α → ℝ) : ℝ := (1 / 2) * ∑ i, |p i - q i| /-- One-step pushforward of a distribution `μ` through a kernel `K`: `(μ K)_j = ∑_i μ_i K_{i,j}`. -/ def kernelStep {α β : Type*} [Fintype α] (μ : α → ℝ) (K : α → β → ℝ) (j : β) : ℝ := ∑ i, μ i * K i j /-- Matrix product of two Markov kernels. -/ def kernelMul {α β γ : Type*} [Fintype β] (K : α → β → ℝ) (L : β → γ → ℝ) (i : α) (k : γ) : ℝ := ∑ j, K i j * L j k /-- `k`-th power of a Markov kernel `P : α → α → ℝ`. -/ def kernelPow {α : Type*} [Fintype α] [DecidableEq α] (P : α → α → ℝ) : ℕ → (α → α → ℝ) | 0 => fun i j => if i = j then 1 else 0 | k + 1 => kernelMul (kernelPow P k) P /-- Pushforward of a micro-distribution `μ` along coarse-graining `π : α → β`. -/ def pushForward {α β : Type*} [Fintype α] [DecidableEq β] (π : α → β) (μ : α → ℝ) (a : β) : ℝ := ∑ i ∈ univ.filter (fun i => π i = a), μ i /-- Mutual information `I_μ(K) = H(μ K) - ∑_i μ_i H(K_i)` (in nats). -/ noncomputable def mutualInfo {α β : Type*} [Fintype α] [Fintype β] (μ : α → ℝ) (K : α → β → ℝ) : ℝ := shannonEntropy (kernelStep μ K) - ∑ i, μ i * shannonEntropy (K i) /-- Dobrushin ergodicity (contraction) coefficient `τ_1(K) = max_{i,i'} d_TV(K_i, K_{i'})`. -/ noncomputable def dobrushinCoeff {α β : Type*} [Fintype α] [Fintype β] (K : α → β → ℝ) : ℝ := if h : (univ : Finset (α × α)).Nonempty then univ.sup' h (fun p => tvDist (K p.1) (K p.2)) else 0 /-! ### Basic Algebraic & Probabilistic Helpers -/ lemma negMulLog_zero : negMulLog 0 = 0 := by simp [negMulLog] lemma negMulLog_one : negMulLog 1 = 0 := by simp [negMulLog] lemma negMulLog_nonneg {x : ℝ} (hx0 : 0 ≤ x) (hx1 : x ≤ 1) : 0 ≤ negMulLog x := by unfold negMulLog rcases eq_or_lt_of_le hx0 with rfl | hpos · simp · have hlog : Real.log x ≤ 0 := Real.log_nonpos (le_of_lt hpos) hx1 nlinarith lemma binEntropy_symm (p : ℝ) : binEntropy (1 - p) = binEntropy p := by unfold binEntropy ring_nf lemma binEntropy_zero : binEntropy 0 = 0 := by simp [binEntropy, negMulLog] lemma binEntropy_one : binEntropy 1 = 0 := by simp [binEntropy, negMulLog] lemma binEntropy_half : binEntropy (1 / 2 : ℝ) = Real.log 2 := by unfold binEntropy negMulLog have h1 : (1 : ℝ) - 1 / 2 = 1 / 2 := by norm_num rw [h1, Real.log_div one_ne_zero two_ne_zero, Real.log_one] ring lemma binEntropy_nonneg {p : ℝ} (hp0 : 0 ≤ p) (hp1 : p ≤ 1) : 0 ≤ binEntropy p := by unfold binEntropy exact add_nonneg (negMulLog_nonneg hp0 hp1) (negMulLog_nonneg (by linarith) (by linarith)) lemma isProbDist_le_one {α : Type*} [Fintype α] {μ : α → ℝ} (hμ : IsProbDist μ) (i : α) : μ i ≤ 1 := by have h1 : μ i ≤ ∑ j, μ j := single_le_sum (fun j _ => hμ.1 j) (mem_univ i) linarith [hμ.2] lemma isProbDist_kernelStep {α β : Type*} [Fintype α] [Fintype β] {μ : α → ℝ} {K : α → β → ℝ} (hμ : IsProbDist μ) (hK : IsStochastic K) : IsProbDist (kernelStep μ K) := by refine ⟨fun j => sum_nonneg fun i _ => mul_nonneg (hμ.1 i) ((hK i).1 j), ?_⟩ unfold kernelStep rw [sum_comm] simp_rw [← mul_sum, (hK _).2, mul_one] exact hμ.2 lemma isStochastic_kernelMul {α β γ : Type*} [Fintype β] [Fintype γ] {K : α → β → ℝ} {L : β → γ → ℝ} (hK : IsStochastic K) (hL : IsStochastic L) : IsStochastic (kernelMul K L) := fun i => isProbDist_kernelStep (hK i) hL lemma isStochastic_kernelPow {α : Type*} [Fintype α] [DecidableEq α] {P : α → α → ℝ} (hP : IsStochastic P) : ∀ k, IsStochastic (kernelPow P k) | 0 => fun i => by refine ⟨fun j => by simp only [kernelPow]; split_ifs <;> norm_num, ?_⟩ simp [kernelPow] | k + 1 => isStochastic_kernelMul (isStochastic_kernelPow hP k) hP lemma kernelStep_kernelMul {α β γ : Type*} [Fintype α] [Fintype β] (μ : α → ℝ) (K : α → β → ℝ) (L : β → γ → ℝ) : kernelStep μ (kernelMul K L) = kernelStep (kernelStep μ K) L := by ext k unfold kernelStep kernelMul simp_rw [mul_sum, sum_mul, mul_assoc] rw [sum_comm] lemma kernelStep_kernelPow_zero {α : Type*} [Fintype α] [DecidableEq α] (μ : α → ℝ) (P : α → α → ℝ) : kernelStep μ (kernelPow P 0) = μ := by ext j simp [kernelStep, kernelPow] lemma kernelStep_kernelPow_succ {α : Type*} [Fintype α] [DecidableEq α] (μ : α → ℝ) (P : α → α → ℝ) (k : ℕ) : kernelStep μ (kernelPow P (k + 1)) = kernelStep (kernelStep μ (kernelPow P k)) P := by exact kernelStep_kernelMul μ (kernelPow P k) P lemma sum_fiberwise_eq {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (π : α → β) (f : α → ℝ) : ∑ a : β, ∑ i ∈ univ.filter (fun i => π i = a), f i = ∑ i : α, f i := sum_fiberwise_of_maps_to (s := univ) (t := univ) (g := π) (fun _ _ => mem_univ _) f lemma isProbDist_pushForward {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (π : α → β) {μ : α → ℝ} (hμ : IsProbDist μ) : IsProbDist (pushForward π μ) := by refine ⟨fun a => sum_nonneg fun i _ => hμ.1 i, ?_⟩ unfold pushForward rw [sum_fiberwise_eq π μ] exact hμ.2 lemma absCont_of_kernelStep {α β : Type*} [Fintype α] {μ : α → ℝ} {K : α → β → ℝ} (hμ : ∀ i, 0 ≤ μ i) (hK : ∀ i j, 0 ≤ K i j) {i : α} (hi : 0 < μ i) : AbsCont (K i) (kernelStep μ K) := by intro j hKij hstep have hpos : 0 < K i j := lt_of_le_of_ne (hK i j) (Ne.symm hKij) have hle : μ i * K i j ≤ kernelStep μ K j := single_le_sum (fun r _ => mul_nonneg (hμ r) (hK r j)) (mem_univ i) linarith [mul_pos hi hpos] /-! ### Log-Sum Inequality, Gibbs Inequality, & Exact Pinsker Inequality -/ /-- Fundamental scalar log inequality: for `a ≥ 0, b > 0`, `a * log (a / b) ≥ a - b` (with `0 * log 0 = 0`). -/ lemma mul_log_div_ge_sub {a b : ℝ} (ha : 0 ≤ a) (hb : 0 < b) : a - b ≤ if a = 0 then 0 else a * Real.log (a / b) := by by_cases ha0 : a = 0 · simp [ha0]; linarith · simp only [ha0, ↓reduceIte] have ha_pos : 0 < a := lt_of_le_of_ne ha (Ne.symm ha0) have h := Real.log_le_sub_one_of_pos (div_pos hb ha_pos) have hlog : Real.log (b / a) = -Real.log (a / b) := by rw [Real.log_div (ne_of_gt hb) (ne_of_gt ha_pos), Real.log_div (ne_of_gt ha_pos) (ne_of_gt hb)] ring rw [hlog] at h have hmul := mul_le_mul_of_nonneg_left h ha have hsimp : a * (b / a - 1) = b - a := by field_simp linarith /-- Strict equality case of `mul_log_div_ge_sub`: `a * log (a / b) = a - b` iff `a = b`. -/ lemma mul_log_div_eq_sub_iff {a b : ℝ} (ha : 0 ≤ a) (hb : 0 < b) : (if a = 0 then 0 else a * Real.log (a / b)) = a - b ↔ a = b := by constructor · intro heq by_cases ha0 : a = 0 · simp [ha0] at heq; linarith · simp only [ha0, ↓reduceIte] at heq have ha_pos : 0 < a := lt_of_le_of_ne ha (Ne.symm ha0) by_contra hne have hne1 : b / a ≠ 1 := by intro h1; apply hne; exact ((div_eq_one_iff_eq (ne_of_gt ha_pos)).mp h1).symm have hlt : Real.log (b / a) < b / a - 1 := Real.log_lt_sub_one_of_pos (div_pos hb ha_pos) hne1 have hlog : Real.log (b / a) = -Real.log (a / b) := by rw [Real.log_div (ne_of_gt hb) (ne_of_gt ha_pos), Real.log_div (ne_of_gt ha_pos) (ne_of_gt hb)] ring rw [hlog] at hlt have hmul := mul_lt_mul_of_pos_left hlt ha_pos have hsimp : a * (b / a - 1) = b - a := by field_simp linarith · intro h; subst h have hb0 : a ≠ 0 := ne_of_gt hb simp [div_self hb0] /-- Finite Log-Sum Inequality: `A * log (A / B) ≤ ∑_{i ∈ s} a_i * log (a_i / b_i)` for `a_i, b_i ≥ 0` with `a_i ≠ 0 → b_i ≠ 0`. -/ theorem log_sum_ineq {ι : Type*} (s : Finset ι) (a b : ι → ℝ) (ha : ∀ i ∈ s, 0 ≤ a i) (hb : ∀ i ∈ s, 0 ≤ b i) (hac : ∀ i ∈ s, a i ≠ 0 → b i ≠ 0) : (if ∑ i ∈ s, a i = 0 then 0 else (∑ i ∈ s, a i) * Real.log ((∑ i ∈ s, a i) / (∑ i ∈ s, b i))) ≤ ∑ i ∈ s, (if a i = 0 then 0 else a i * Real.log (a i / b i)) := by set A := ∑ i ∈ s, a i set B := ∑ i ∈ s, b i have hA0 : 0 ≤ A := sum_nonneg ha have hB0 : 0 ≤ B := sum_nonneg hb by_cases hA_zero : A = 0 · simp only [hA_zero, ↓reduceIte] have ha_zero : ∀ i ∈ s, a i = 0 := fun i hi => (sum_eq_zero_iff_of_nonneg ha).mp hA_zero i hi rw [sum_eq_zero (fun i hi => by simp [ha_zero i hi])] · simp only [hA_zero, ↓reduceIte] have hA_pos : 0 < A := lt_of_le_of_ne hA0 (Ne.symm hA_zero) have hB_pos : 0 < B := by by_contra hBn have hBz : B = 0 := le_antisymm (not_lt.mp hBn) hB0 have hb_zero : ∀ i ∈ s, b i = 0 := fun i hi => (sum_eq_zero_iff_of_nonneg hb).mp hBz i hi have ha_zero : ∀ i ∈ s, a i = 0 := fun i hi => by by_contra hne; exact hac i hi hne (hb_zero i hi) exact hA_zero (sum_eq_zero ha_zero) -- Apply mul_log_div_ge_sub to each term with scaled b_i * (A / B) have hterm : ∀ i ∈ s, (a i - b i * (A / B)) + a i * Real.log (A / B) ≤ if a i = 0 then 0 else a i * Real.log (a i / b i) := by intro i hi by_cases hai : a i = 0 · simp only [hai, ↓reduceIte, zero_mul, add_zero, zero_sub, neg_nonpos] exact mul_nonneg (hb i hi) (div_nonneg hA0 hB0) · simp only [hai, ↓reduceIte] have hai_pos : 0 < a i := lt_of_le_of_ne (ha i hi) (Ne.symm hai) have hbi_pos : 0 < b i := lt_of_le_of_ne (hb i hi) (Ne.symm (hac i hi hai)) have hscaled_pos : 0 < b i * (A / B) := mul_pos hbi_pos (div_pos hA_pos hB_pos) have h1 := mul_log_div_ge_sub (ha i hi) hscaled_pos simp only [hai, ↓reduceIte] at h1 have hlog_eq : Real.log (a i / (b i * (A / B))) = Real.log (a i / b i) - Real.log (A / B) := by rw [div_mul_eq_div_div, Real.log_div (ne_of_gt (div_pos hai_pos hbi_pos)) (ne_of_gt (div_pos hA_pos hB_pos))] rw [hlog_eq] at h1 linarith have hsum := sum_le_sum hterm rw [sum_add_distrib, sum_sub_distrib, ← sum_mul, ← sum_mul] at hsum have hcancel : A - B * (A / B) = 0 := by field_simp; ring linarith /-- Gibbs' inequality: `D_KL(p ‖ q) ≥ 0` for probability distributions with `p ≪ q`. -/ theorem klDiv_nonneg {α : Type*} [Fintype α] {p q : α → ℝ} (hp : IsProbDist p) (hq : IsProbDist q) (hac : AbsCont p q) : 0 ≤ klDiv p q := by have h := log_sum_ineq univ p q (fun i _ => hp.1 i) (fun i _ => hq.1 i) (fun i _ => hac i) rw [hp.2, hq.2] at h simp only [one_ne_zero, ↓reduceIte, div_one, Real.log_one, mul_zero] at h exact h /-- Strict equality characterization of Gibbs' inequality: `D_KL(p ‖ q) = 0 ↔ p = q`. -/ theorem klDiv_eq_zero_iff {α : Type*} [Fintype α] {p q : α → ℝ} (hp : IsProbDist p) (hq : IsProbDist q) (hac : AbsCont p q) : klDiv p q = 0 ↔ p = q := by constructor · intro hkl have hterm : ∀ i : α, p i - q i ≤ if p i = 0 then 0 else p i * Real.log (p i / q i) := by intro i by_cases hpi : p i = 0 · simp [hpi]; linarith [hq.1 i] · exact mul_log_div_ge_sub (hp.1 i) (lt_of_le_of_ne (hq.1 i) (Ne.symm (hac i hpi))) have hsum_diff : ∑ i : α, ((if p i = 0 then 0 else p i * Real.log (p i / q i)) - (p i - q i)) = 0 := by rw [sum_sub_distrib, sum_sub_distrib, hp.2, hq.2] unfold klDiv at hkl linarith have hzero : ∀ i ∈ (univ : Finset α), (if p i = 0 then 0 else p i * Real.log (p i / q i)) - (p i - q i) = 0 := (sum_eq_zero_iff_of_nonneg (fun i _ => sub_nonneg.mpr (hterm i))).mp hsum_diff ext i have hi := sub_eq_zero.mp (hzero i (mem_univ i)) by_cases hqi : q i = 0 · have hpi : p i = 0 := by by_contra hne; exact hac i hne hqi rw [hpi, hqi] · exact (mul_log_div_eq_sub_iff (hp.1 i) (lt_of_le_of_ne (hq.1 i) (Ne.symm hqi))).mp hi · intro h; subst h unfold klDiv refine sum_eq_zero fun i _ => ?_ by_cases hpi : p i = 0 · simp [hpi] · simp [hpi] /-- Shannon entropy is non-negative and bounded above by `ln |α|`. -/ lemma shannonEntropy_nonneg {α : Type*} [Fintype α] {p : α → ℝ} (hp : IsProbDist p) : 0 ≤ shannonEntropy p := sum_nonneg fun i _ => negMulLog_nonneg (hp.1 i) (isProbDist_le_one hp i) lemma shannonEntropy_le_log_card {α : Type*} [Fintype α] [Nonempty α] {p : α → ℝ} (hp : IsProbDist p) : shannonEntropy p ≤ Real.log (Fintype.card α : ℝ) := by set n : ℝ := (Fintype.card α : ℝ) have hn_pos : 0 < n := Nat.cast_pos.mpr Fintype.card_pos let u : α → ℝ := fun _ => 1 / n have hu : IsProbDist u := by refine ⟨fun _ => by positivity, ?_⟩ simp [u, n, ne_of_gt hn_pos] have hac : AbsCont p u := fun _ _ => div_ne_zero one_ne_zero (ne_of_gt hn_pos) have hkl : 0 ≤ klDiv p u := klDiv_nonneg hp hu hac have heq : klDiv p u = Real.log n - shannonEntropy p := by unfold klDiv shannonEntropy negMulLog have h1 : ∀ i : α, (if p i = 0 then 0 else p i * Real.log (p i / u i)) = p i * Real.log n + p i * Real.log (p i) := by intro i by_cases hpi : p i = 0 · simp [hpi] · simp only [hpi, ↓reduceIte, u] rw [Real.log_div hpi (div_ne_zero one_ne_zero (ne_of_gt hn_pos)), Real.log_div one_ne_zero (ne_of_gt hn_pos), Real.log_one] ring simp_rw [h1, sum_add_distrib, ← sum_mul, hp.2, one_mul] simp only [neg_mul, sum_neg_distrib] ring linarith /-- Support-cardinality entropy bound: `H(p) ≤ ln |supp(p)|`. -/ lemma shannonEntropy_le_log_support_card {α : Type*} [Fintype α] [DecidableEq α] {p : α → ℝ} (hp : IsProbDist p) {s : Finset α} (hs : ∀ i, p i ≠ 0 → i ∈ s) (hs_ne : s.Nonempty) : shannonEntropy p ≤ Real.log (s.card : ℝ) := by set k : ℝ := (s.card : ℝ) have hk_pos : 0 < k := Nat.cast_pos.mpr hs_ne.card_pos have hsum_s : ∑ i ∈ s, p i = 1 := by rw [← hp.2] exact sum_subset (subset_univ s) (fun i _ hi => by by_contra hne; exact hi (hs i hne)) have hls := log_sum_ineq s p (fun _ => 1 / k) (fun i _ => hp.1 i) (fun _ _ => by positivity) (fun _ _ _ => div_ne_zero one_ne_zero (ne_of_gt hk_pos)) have hsum_u : ∑ _i ∈ s, (1 / k) = 1 := by simp [k, ne_of_gt hk_pos] rw [hsum_s, hsum_u] at hls simp only [one_ne_zero, ↓reduceIte, div_one, Real.log_one, mul_zero] at hls have heq : (∑ i ∈ s, if p i = 0 then 0 else p i * Real.log (p i / (1 / k))) = Real.log k - shannonEntropy p := by have hterm : ∀ i ∈ s, (if p i = 0 then 0 else p i * Real.log (p i / (1 / k))) = p i * Real.log k - negMulLog (p i) := by intro i _ by_cases hpi : p i = 0 · simp [hpi, negMulLog] · simp only [hpi, ↓reduceIte, negMulLog] rw [Real.log_div hpi (div_ne_zero one_ne_zero (ne_of_gt hk_pos)), Real.log_div one_ne_zero (ne_of_gt hk_pos), Real.log_one] ring rw [sum_congr rfl hterm, sum_sub_distrib, ← sum_mul, hsum_s, one_mul] have hHs : ∑ i ∈ s, negMulLog (p i) = shannonEntropy p := by unfold shannonEntropy exact sum_subset (subset_univ s) (fun i _ hi => by have hpi : p i = 0 := by by_contra hne; exact hi (hs i hne) simp [hpi, negMulLog]) rw [hHs] linarith /-- Binary entropy upper bound `h(p) ≤ ln 2`. -/ lemma binEntropy_le_log_two {p : ℝ} (hp0 : 0 ≤ p) (hp1 : p ≤ 1) : binEntropy p ≤ Real.log 2 := by let q : Fin 2 → ℝ := fun i => if i = 0 then p else 1 - p have hq : IsProbDist q := by refine ⟨fun i => by fin_cases i <;> simp [q] <;> linarith, ?_⟩ simp [q, Fin.sum_univ_two] have h := shannonEntropy_le_log_card hq have hEq : shannonEntropy q = binEntropy p := by simp [shannonEntropy, binEntropy, q, Fin.sum_univ_two] have hcard : (Fintype.card (Fin 2) : ℝ) = 2 := by norm_num rw [hEq, hcard] at h exact h /-- Quadratic lower bound on binary entropy near `1/2`: `ln 2 - 4 * x^2 ≤ h(1/2 - x)` for all `x ∈ (-1/2, 1/2)`. -/ lemma log_two_sub_four_sq_le_binEntropy {x : ℝ} (hx1 : -(1 / 2 : ℝ) < x) (hx2 : x < 1 / 2) : Real.log 2 - 4 * x ^ 2 ≤ binEntropy (1 / 2 - x) := by set u : ℝ := 2 * x have hu1 : 0 < 1 + u := by linarith have hu2 : 0 < 1 - u := by linarith have h1 : Real.log (1 + u) ≤ u := by have := Real.log_le_sub_one_of_pos hu1; linarith have h2 : Real.log (1 - u) ≤ -u := by have := Real.log_le_sub_one_of_pos hu2; linarith have hmul1 : ((1 + u) / 2) * Real.log (1 + u) ≤ ((1 + u) / 2) * u := mul_le_mul_of_nonneg_left h1 (by linarith) have hmul2 : ((1 - u) / 2) * Real.log (1 - u) ≤ ((1 - u) / 2) * (-u) := mul_le_mul_of_nonneg_left h2 (by linarith) have hsum : ((1 + u) / 2) * Real.log (1 + u) + ((1 - u) / 2) * Real.log (1 - u) ≤ u ^ 2 := by nlinarith have hident : Real.log 2 - binEntropy (1 / 2 - x) = ((1 + u) / 2) * Real.log (1 + u) + ((1 - u) / 2) * Real.log (1 - u) := by unfold binEntropy negMulLog have ha : (1 / 2 : ℝ) - x = (1 - u) / 2 := by simp [u]; ring have hb : (1 : ℝ) - (1 - u) / 2 = (1 + u) / 2 := by ring rw [ha, hb, Real.log_div (ne_of_gt hu2) two_ne_zero, Real.log_div (ne_of_gt hu1) two_ne_zero] ring have hu2_eq : u ^ 2 = 4 * x ^ 2 := by simp [u]; ring linarith /-! ### Exact Pinsker Inequality (`2 * d_TV(p, q)^2 ≤ D_KL(p ‖ q)`) -/ /-- Binary Pinsker inequality via the 1-variable derivative `g'(b) = -(a - b)(2b - 1)^2 / (b(1-b)) ≤ 0`. -/ lemma binary_pinsker_ineq {a b : ℝ} (hb0 : 0 ≤ b) (hba : b ≤ a) (ha1 : a ≤ 1) (hac1 : a ≠ 0 → b ≠ 0) (hac2 : 1 - a ≠ 0 → 1 - b ≠ 0) : 2 * (a - b) ^ 2 ≤ (if a = 0 then 0 else a * Real.log (a / b)) + (if 1 - a = 0 then 0 else (1 - a) * Real.log ((1 - a) / (1 - b))) := by rcases eq_or_lt_of_le hba with rfl | hlt · by_cases hb_eq : b = 0 · simp [hb_eq] · by_cases hb1' : 1 - b = 0 · simp [hb_eq, hb1'] · simp [hb_eq, hb1'] -- Now b < a have ha_pos : 0 < a := lt_of_le_of_lt hb0 hlt have hb_pos : 0 < b := lt_of_le_of_ne hb0 (Ne.symm (hac1 (ne_of_gt ha_pos))) have h1b_pos : 0 < 1 - b := by linarith by_cases ha1_eq : a = 1 · -- Special case a = 1: need 2 * (1 - b)^2 ≤ -log b for b ∈ (0, 1) subst ha1_eq simp only [one_ne_zero, ↓reduceIte, sub_self, one_mul, add_zero, Real.log_div one_ne_zero (ne_of_gt hb_pos), Real.log_one, zero_sub] -- Show f(t) = -log t - 2*(1-t)^2 is antitone on [b, 1], with f(1) = 0 let f : ℝ → ℝ := fun t => -Real.log t - 2 * (1 - t) ^ 2 have hderiv : ∀ t ∈ Set.Icc b 1, HasDerivAt f (-t⁻¹ + 4 * (1 - t)) t := by intro t ht have ht_pos : 0 < t := lt_of_lt_of_le hb_pos ht.1 have h1 : HasDerivAt (fun x => -Real.log x) (-t⁻¹) t := (Real.hasDerivAt_log (ne_of_gt ht_pos)).neg have h2 : HasDerivAt (fun x => 2 * (1 - x) ^ 2) (-4 * (1 - t)) t := by have hsub : HasDerivAt (fun x : ℝ => 1 - x) (-1) t := by have := (hasDerivAt_const t (1 : ℝ)).sub (hasDerivAt_id t) exact this.congr_deriv (by ring) have hsq := hsub.pow 2 have hmul := hsq.const_mul (2 : ℝ) refine hmul.congr_deriv ?_ ring refine (h1.sub h2).congr_deriv ?_ ring have hanti : AntitoneOn f (Set.Icc b 1) := by apply antitoneOn_of_deriv_nonpos (convex_Icc b 1) · exact fun t ht => (hderiv t ht).continuousAt.continuousWithinAt · exact fun t ht => (hderiv t (interior_subset ht)).differentiableAt.differentiableWithinAt · intro t ht have ht' := interior_subset ht rw [(hderiv t ht').deriv] have ht_pos : 0 < t := lt_of_lt_of_le hb_pos ht'.1 have hsq : 0 ≤ (2 * t - 1) ^ 2 := sq_nonneg _ have h1 : 4 * t * (1 - t) ≤ 1 := by nlinarith have h2 : 4 * (1 - t) ≤ t⁻¹ := by rw [← one_div, le_div_iff₀ ht_pos]; linarith linarith have hfb : f 1 ≤ f b := hanti ⟨le_rfl, le_of_lt hlt⟩ ⟨le_of_lt hlt, le_rfl⟩ (le_of_lt hlt) simp only [f, Real.log_one, sub_self, neg_zero, sq, mul_zero] at hfb linarith · -- General interior case: 0 < b < a < 1 have h1a_pos : 0 < 1 - a := lt_of_le_of_ne (by linarith) (sub_ne_zero.mpr (Ne.symm ha1_eq)).symm have h1a_ne : 1 - a ≠ 0 := ne_of_gt h1a_pos have ha_ne : a ≠ 0 := ne_of_gt ha_pos simp only [ha_ne, h1a_ne, ↓reduceIte] let f : ℝ → ℝ := fun t => a * Real.log (a / t) + (1 - a) * Real.log ((1 - a) / (1 - t)) - 2 * (a - t) ^ 2 have hderiv : ∀ t ∈ Set.Icc b a, HasDerivAt f (-(a / t) + (1 - a) / (1 - t) + 4 * (a - t)) t := by intro t ht have ht_pos : 0 < t := lt_of_lt_of_le hb_pos ht.1 have h1t_pos : 0 < 1 - t := by linarith [ht.2] have hd1 : HasDerivAt (fun x => a * Real.log (a / x)) (-(a / t)) t := by have hrew : ∀ᶠ x in 𝓝 t, a * Real.log (a / x) = a * Real.log a - a * Real.log x := by filter_upwards [lt_mem_nhds ht_pos] with x hx rw [Real.log_div ha_ne (ne_of_gt hx)]; ring have hlin : HasDerivAt (fun x => a * Real.log a - a * Real.log x) (-(a / t)) t := by have h := (hasDerivAt_const t (a * Real.log a)).sub ((Real.hasDerivAt_log (ne_of_gt ht_pos)).const_mul a) refine h.congr_deriv ?_ field_simp [ne_of_gt ht_pos] ring exact hlin.congr_of_eventuallyEq hrew have hd2 : HasDerivAt (fun x => (1 - a) * Real.log ((1 - a) / (1 - x))) ((1 - a) / (1 - t)) t := by have hrew : ∀ᶠ x in 𝓝 t, (1 - a) * Real.log ((1 - a) / (1 - x)) = (1 - a) * Real.log (1 - a) - (1 - a) * Real.log (1 - x) := by filter_upwards [gt_mem_nhds (show t < 1 by linarith)] with x hx rw [Real.log_div h1a_ne (ne_of_gt (by linarith))]; ring have hsub : HasDerivAt (fun x : ℝ => 1 - x) (-1) t := by have := (hasDerivAt_const t (1 : ℝ)).sub (hasDerivAt_id t) exact this.congr_deriv (by ring) have hlog1 : HasDerivAt (fun x => Real.log (1 - x)) ((-1) / (1 - t)) t := by simpa using hsub.log (ne_of_gt h1t_pos) have hlin : HasDerivAt (fun x => (1 - a) * Real.log (1 - a) - (1 - a) * Real.log (1 - x)) ((1 - a) / (1 - t)) t := by have h := (hasDerivAt_const t ((1 - a) * Real.log (1 - a))).sub (hlog1.const_mul (1 - a)) refine h.congr_deriv ?_ ring exact hlin.congr_of_eventuallyEq hrew have hd3 : HasDerivAt (fun x => 2 * (a - x) ^ 2) (-4 * (a - t)) t := by have hsub : HasDerivAt (fun x : ℝ => a - x) (-1) t := by have := (hasDerivAt_const t a).sub (hasDerivAt_id t) exact this.congr_deriv (by ring) refine ((hsub.pow 2).const_mul (2 : ℝ)).congr_deriv ?_ ring refine ((hd1.add hd2).sub hd3).congr_deriv ?_ ring have hanti : AntitoneOn f (Set.Icc b a) := by apply antitoneOn_of_deriv_nonpos (convex_Icc b a) · exact fun t ht => (hderiv t ht).continuousAt.continuousWithinAt · exact fun t ht => (hderiv t (interior_subset ht)).differentiableAt.differentiableWithinAt · intro t ht have ht' := interior_subset ht rw [(hderiv t ht').deriv] have ht_pos : 0 < t := lt_of_lt_of_le hb_pos ht'.1 have h1t_pos : 0 < 1 - t := by linarith [ht'.2] have hden : 0 < t * (1 - t) := mul_pos ht_pos h1t_pos have hfac : -(a / t) + (1 - a) / (1 - t) + 4 * (a - t) = -((a - t) * (2 * t - 1) ^ 2) / (t * (1 - t)) := by field_simp; ring rw [hfac] exact div_nonpos_of_nonpos_of_nonneg (neg_nonpos.mpr (mul_nonneg (by linarith [ht'.2]) (sq_nonneg _))) (le_of_lt hden) have hfa : f a ≤ f b := hanti ⟨le_rfl, le_of_lt hlt⟩ ⟨le_of_lt hlt, le_rfl⟩ (le_of_lt hlt) have hfa_zero : f a = 0 := by simp [f, div_self ha_ne, div_self h1a_ne] rw [hfa_zero] at hfa linarith /-- Total variation distance equals the sum of positive parts `∑_{p_i ≥ q_i} (p_i - q_i)`. -/ lemma tvDist_eq_sum_filter_ge {α : Type*} [Fintype α] [DecidableEq α] {p q : α → ℝ} (hp : ∑ i, p i = 1) (hq : ∑ i, q i = 1) : tvDist p q = ∑ i ∈ univ.filter (fun i => q i ≤ p i), (p i - q i) := by unfold tvDist set A := univ.filter (fun i : α => q i ≤ p i) set B := univ.filter (fun i : α => ¬ q i ≤ p i) have hpart : ∀ f : α → ℝ, ∑ i, f i = (∑ i ∈ A, f i) + (∑ i ∈ B, f i) := fun f => (sum_filter_add_sum_filter_not univ (fun i => q i ≤ p i) f).symm have hdiff : (∑ i ∈ A, (p i - q i)) + (∑ i ∈ B, (p i - q i)) = 0 := by rw [← hpart, sum_sub_distrib, hp, hq, sub_self] have habsA : ∑ i ∈ A, |p i - q i| = ∑ i ∈ A, (p i - q i) := sum_congr rfl fun i hi => abs_of_nonneg (sub_nonneg.mpr (mem_filter.mp hi).2) have habsB : ∑ i ∈ B, |p i - q i| = -(∑ i ∈ B, (p i - q i)) := by rw [← sum_neg_distrib] refine sum_congr rfl fun i hi => ?_ have hlt : p i < q i := not_le.mp (mem_filter.mp hi).2 rw [abs_of_neg (sub_neg.mpr hlt), neg_sub] rw [hpart (fun i => |p i - q i|), habsA, habsB] linarith /-- Total variation distance equals `∑_i max (p_i - q_i) 0` and `∑_i (p_i - min (p_i) (q_i))`. -/ lemma tvDist_eq_sum_sub_min {α : Type*} [Fintype α] [DecidableEq α] {p q : α → ℝ} (hp : ∑ i, p i = 1) (hq : ∑ i, q i = 1) : tvDist p q = ∑ i, (p i - min (p i) (q i)) := by rw [tvDist_eq_sum_filter_ge hp hq] rw [← sum_filter_add_sum_filter_not univ (fun i => q i ≤ p i) (fun i => p i - min (p i) (q i))] have h1 : ∑ i ∈ univ.filter (fun i => q i ≤ p i), (p i - min (p i) (q i)) = ∑ i ∈ univ.filter (fun i => q i ≤ p i), (p i - q i) := sum_congr rfl fun i hi => by rw [min_eq_right (mem_filter.mp hi).2] have h2 : ∑ i ∈ univ.filter (fun i => ¬ q i ≤ p i), (p i - min (p i) (q i)) = 0 := sum_eq_zero fun i hi => by rw [min_eq_left (le_of_lt (not_le.mp (mem_filter.mp hi).2)), sub_self] rw [h1, h2, add_zero] /-- **Exact Pinsker's Inequality**: `2 * d_TV(p, q)^2 ≤ D_KL(p ‖ q)`. -/ theorem pinsker_ineq {α : Type*} [Fintype α] [DecidableEq α] {p q : α → ℝ} (hp : IsProbDist p) (hq : IsProbDist q) (hac : AbsCont p q) : 2 * (tvDist p q) ^ 2 ≤ klDiv p q := by set A := univ.filter (fun i : α => q i ≤ p i) set B := univ.filter (fun i : α => ¬ q i ≤ p i) set a := ∑ i ∈ A, p i set b := ∑ i ∈ A, q i have hsum_p : a + ∑ i ∈ B, p i = 1 := by rw [sum_filter_add_sum_filter_not]; exact hp.2 have hsum_q : b + ∑ i ∈ B, q i = 1 := by rw [sum_filter_add_sum_filter_not]; exact hq.2 have h1a : ∑ i ∈ B, p i = 1 - a := by linarith have h1b : ∑ i ∈ B, q i = 1 - b := by linarith have hlsA := log_sum_ineq A p q (fun i _ => hp.1 i) (fun i _ => hq.1 i) (fun i _ => hac i) have hlsB := log_sum_ineq B p q (fun i _ => hp.1 i) (fun i _ => hq.1 i) (fun i _ => hac i) rw [h1a, h1b] at hlsB have hkl_split : klDiv p q = (∑ i ∈ A, if p i = 0 then 0 else p i * Real.log (p i / q i)) + (∑ i ∈ B, if p i = 0 then 0 else p i * Real.log (p i / q i)) := by unfold klDiv exact (sum_filter_add_sum_filter_not univ (fun i => q i ≤ p i) _).symm have hb0 : 0 ≤ b := sum_nonneg fun i _ => hq.1 i have hba : b ≤ a := sum_le_sum fun i hi => (mem_filter.mp hi).2 have ha1 : a ≤ 1 := by linarith [sum_nonneg (s := B) (fun i _ => hp.1 i)] have hac1 : a ≠ 0 → b ≠ 0 := by intro ha_ne hb_eq have hqz : ∀ i ∈ A, q i = 0 := (sum_eq_zero_iff_of_nonneg (fun i _ => hq.1 i)).mp hb_eq have hpz : ∀ i ∈ A, p i = 0 := fun i hi => by by_contra hne; exact hac i hne (hqz i hi) exact ha_ne (sum_eq_zero hpz) have hac2 : 1 - a ≠ 0 → 1 - b ≠ 0 := by intro h1a_ne h1b_eq rw [← h1b] at h1b_eq have hqz : ∀ i ∈ B, q i = 0 := (sum_eq_zero_iff_of_nonneg (fun i _ => hq.1 i)).mp h1b_eq have hpz : ∀ i ∈ B, p i = 0 := fun i hi => by by_contra hne; exact hac i hne (hqz i hi) exact h1a_ne (by rw [← h1a]; exact sum_eq_zero hpz) have hbin := binary_pinsker_ineq hb0 hba ha1 hac1 hac2 have htv : tvDist p q = a - b := by rw [tvDist_eq_sum_filter_ge hp.2 hq.2, sum_sub_distrib] rw [htv, hkl_split] linarith /-! ### TV Distance Properties & Dobrushin Contraction Theorem -/ lemma tvDist_nonneg {α : Type*} [Fintype α] (p q : α → ℝ) : 0 ≤ tvDist p q := by unfold tvDist exact mul_nonneg (by norm_num) (sum_nonneg fun _ _ => abs_nonneg _) lemma tvDist_self {α : Type*} [Fintype α] (p : α → ℝ) : tvDist p p = 0 := by simp [tvDist] lemma tvDist_comm {α : Type*} [Fintype α] (p q : α → ℝ) : tvDist p q = tvDist q p := by unfold tvDist congr 1 refine sum_congr rfl fun i _ => abs_sub_comm (p i) (q i) lemma tvDist_triangle {α : Type*} [Fintype α] (p q r : α → ℝ) : tvDist p r ≤ tvDist p q + tvDist q r := by unfold tvDist rw [← mul_add, ← sum_add_distrib] exact mul_le_mul_of_nonneg_left (sum_le_sum fun i _ => abs_sub_le (p i) (q i) (r i)) (by norm_num) lemma tvDist_le_one {α : Type*} [Fintype α] {p q : α → ℝ} (hp : IsProbDist p) (hq : IsProbDist q) : tvDist p q ≤ 1 := by unfold tvDist have h : ∑ i, |p i - q i| ≤ ∑ i, (p i + q i) := sum_le_sum fun i _ => by calc |p i - q i| ≤ |p i| + |q i| := abs_sub (p i) (q i) _ = p i + q i := by rw [abs_of_nonneg (hp.1 i), abs_of_nonneg (hq.1 i)] rw [sum_add_distrib, hp.2, hq.2] at h linarith lemma tvDist_pushForward_le {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (π : α → β) (p q : α → ℝ) : tvDist (pushForward π p) (pushForward π q) ≤ tvDist p q := by unfold tvDist pushForward refine mul_le_mul_of_nonneg_left ?_ (by norm_num) calc ∑ a : β, |∑ i ∈ univ.filter (fun i => π i = a), p i - ∑ i ∈ univ.filter (fun i => π i = a), q i| = ∑ a : β, |∑ i ∈ univ.filter (fun i => π i = a), (p i - q i)| := by refine sum_congr rfl fun a _ => by rw [sum_sub_distrib] _ ≤ ∑ a : β, ∑ i ∈ univ.filter (fun i => π i = a), |p i - q i| := sum_le_sum fun a _ => abs_sum_le_sum_abs _ _ _ = ∑ i : α, |p i - q i| := sum_fiberwise_eq π (fun i => |p i - q i|) lemma tvDist_le_dobrushinCoeff {α β : Type*} [Fintype α] [Fintype β] (K : α → β → ℝ) (i j : α) : tvDist (K i) (K j) ≤ dobrushinCoeff K := by unfold dobrushinCoeff have hne : (univ : Finset (α × α)).Nonempty := ⟨(i, j), mem_univ _⟩ rw [dif_pos hne] exact le_sup' (fun p : α × α => tvDist (K p.1) (K p.2)) (mem_univ (i, j)) lemma dobrushinCoeff_nonneg {α β : Type*} [Fintype α] [Fintype β] (K : α → β → ℝ) : 0 ≤ dobrushinCoeff K := by unfold dobrushinCoeff split_ifs with hne · obtain ⟨p, hp⟩ := hne exact le_trans (tvDist_nonneg (K p.1) (K p.2)) (le_sup' (fun q : α × α => tvDist (K q.1) (K q.2)) hp) · rfl lemma dobrushinCoeff_le_one {α β : Type*} [Fintype α] [Fintype β] {K : α → β → ℝ} (hK : IsStochastic K) : dobrushinCoeff K ≤ 1 := by unfold dobrushinCoeff split_ifs with hne · exact sup'_le hne _ fun p _ => tvDist_le_one (hK p.1) (hK p.2) · norm_num lemma dobrushinCoeff_le_of_forall {α β : Type*} [Fintype α] [Fintype β] (K : α → β → ℝ) {c : ℝ} (hc0 : 0 ≤ c) (h : ∀ i j, tvDist (K i) (K j) ≤ c) : dobrushinCoeff K ≤ c := by unfold dobrushinCoeff split_ifs with hne · exact sup'_le hne _ fun p _ => h p.1 p.2 · exact hc0 /-- Convexity of TV distance in the first argument (weighted average). -/ lemma tvDist_convex_left {ι β : Type*} [Fintype β] (s : Finset ι) (w : ι → ℝ) (hw : ∀ i ∈ s, 0 ≤ w i) (hw1 : ∑ i ∈ s, w i = 1) (p : ι → β → ℝ) (q : β → ℝ) : tvDist (fun b => ∑ i ∈ s, w i * p i b) q ≤ ∑ i ∈ s, w i * tvDist (p i) q := by unfold tvDist calc (1 / 2 : ℝ) * ∑ b : β, |(∑ i ∈ s, w i * p i b) - q b| = (1 / 2 : ℝ) * ∑ b : β, |∑ i ∈ s, w i * (p i b - q b)| := by congr 1; refine sum_congr rfl fun b _ => ?_ have h1 : (∑ i ∈ s, w i * (p i b - q b)) = (∑ i ∈ s, w i * p i b) - q b := by simp_rw [mul_sub, sum_sub_distrib, ← sum_mul, hw1, one_mul] rw [h1] _ ≤ (1 / 2 : ℝ) * ∑ b : β, ∑ i ∈ s, |w i * (p i b - q b)| := mul_le_mul_of_nonneg_left (sum_le_sum fun b _ => abs_sum_le_sum_abs _ _) (by norm_num) _ = (1 / 2 : ℝ) * ∑ b : β, ∑ i ∈ s, w i * |p i b - q b| := by congr 1; refine sum_congr rfl fun b _ => sum_congr rfl fun i hi => ?_ rw [abs_mul, abs_of_nonneg (hw i hi)] _ = ∑ i ∈ s, w i * ((1 / 2 : ℝ) * ∑ b : β, |p i b - q b|) := by rw [sum_comm, mul_sum] refine sum_congr rfl fun i _ => ?_ rw [← mul_sum]; ring /-- **Dobrushin Total-Variation Contraction Theorem**: For any stochastic kernel `K : α → β → ℝ` and probability distributions `μ, ν ∈ Δ(α)`, `d_TV(μ K, ν K) ≤ τ_1(K) * d_TV(μ, ν)`. -/ theorem tvDist_kernelStep_le_dobrushin {α β : Type*} [Fintype α] [Fintype β] [DecidableEq α] {K : α → β → ℝ} {μ ν : α → ℝ} (hμ : IsProbDist μ) (hν : IsProbDist ν) : tvDist (kernelStep μ K) (kernelStep ν K) ≤ dobrushinCoeff K * tvDist μ ν := by set d := tvDist μ ν by_cases hd : d = 0 · have hμν : μ = ν := by ext i have hsum : ∑ j : α, |μ j - ν j| = 0 := by have hd' : (1 / 2 : ℝ) * ∑ j : α, |μ j - ν j| = 0 := hd linarith have hi : |μ i - ν i| = 0 := (sum_eq_zero_iff_of_nonneg (fun j _ => abs_nonneg _)).mp hsum i (mem_univ i) linarith [abs_eq_zero.mp hi] rw [hμν, tvDist_self, hd, mul_zero] · have hd_pos : 0 < d := lt_of_le_of_ne (tvDist_nonneg μ ν) (Ne.symm hd) -- Decompose μ - ν = d * (u - v) where u, v are probability distributions let u : α → ℝ := fun i => max (μ i - ν i) 0 / d let v : α → ℝ := fun i => max (ν i - μ i) 0 / d have hu_sum : ∑ i, u i = 1 := by simp only [u, ← sum_div] rw [div_eq_one_iff_eq (ne_of_gt hd_pos)] have hpos : ∑ i, max (μ i - ν i) 0 = tvDist μ ν := by rw [tvDist_eq_sum_sub_min hμ.2 hν.2] refine sum_congr rfl fun i _ => ?_ rcases le_total (μ i) (ν i) with h | h · rw [min_eq_left h, max_eq_right (by linarith), sub_self] · rw [min_eq_right h, max_eq_left (by linarith)] exact hpos have hv_sum : ∑ i, v i = 1 := by simp only [v, ← sum_div] rw [div_eq_one_iff_eq (ne_of_gt hd_pos)] have hpos : ∑ i, max (ν i - μ i) 0 = tvDist ν μ := by rw [tvDist_eq_sum_sub_min hν.2 hμ.2] refine sum_congr rfl fun i _ => ?_ rcases le_total (ν i) (μ i) with h | h · rw [min_eq_left h, max_eq_right (by linarith), sub_self] · rw [min_eq_right h, max_eq_left (by linarith)] rw [hpos, tvDist_comm] have hdiff : ∀ i, μ i - ν i = d * (u i - v i) := by intro i simp only [u, v] field_simp [ne_of_gt hd_pos] rcases le_total (μ i) (ν i) with h | h · rw [max_eq_right (by linarith), max_eq_left (by linarith)]; ring · rw [max_eq_left (by linarith), max_eq_right (by linarith)]; ring -- Express (μ K)_b - (ν K)_b = d * ∑_i ∑_j u_i v_j (K_{i,b} - K_{j,b}) have hstep_diff : ∀ b : β, kernelStep μ K b - kernelStep ν K b = d * ∑ i : α, ∑ j : α, (u i * v j) * (K i b - K j b) := by intro b unfold kernelStep rw [← sum_sub_distrib] have h1 : ∑ i : α, (μ i * K i b - ν i * K i b) = d * ∑ i : α, (u i - v i) * K i b := by rw [mul_sum] refine sum_congr rfl fun i _ => ?_ rw [← sub_mul, hdiff i, mul_assoc] rw [h1] congr 1 have h2 : ∑ i : α, ∑ j : α, (u i * v j) * (K i b - K j b) = (∑ i : α, u i * K i b) * (∑ j : α, v j) - (∑ i : α, u i) * (∑ j : α, v j * K j b) := by simp_rw [mul_sub, sum_sub_distrib] congr 1 · rw [sum_mul] refine sum_congr rfl fun i _ => ?_ rw [mul_sum] refine sum_congr rfl fun j _ => by ring · rw [sum_mul] refine sum_congr rfl fun i _ => ?_ rw [mul_sum] refine sum_congr rfl fun j _ => by ring rw [h2, hu_sum, hv_sum, mul_one, one_mul, ← sum_sub_distrib] refine sum_congr rfl fun i _ => by ring -- Bound TV distance via triangle inequality over the product coupling u_i v_j have huv_nonneg : ∀ i j, 0 ≤ u i * v j := fun i j => mul_nonneg (div_nonneg (le_max_right _ _) (le_of_lt hd_pos)) (div_nonneg (le_max_right _ _) (le_of_lt hd_pos)) unfold tvDist calc (1 / 2 : ℝ) * ∑ b : β, |kernelStep μ K b - kernelStep ν K b| = (1 / 2 : ℝ) * ∑ b : β, d * |∑ i : α, ∑ j : α, (u i * v j) * (K i b - K j b)| := by congr 1; refine sum_congr rfl fun b _ => ?_ rw [hstep_diff b, abs_mul, abs_of_pos hd_pos] _ ≤ (1 / 2 : ℝ) * ∑ b : β, d * ∑ i : α, ∑ j : α, (u i * v j) * |K i b - K j b| := by refine mul_le_mul_of_nonneg_left (sum_le_sum fun b _ => ?_) (by norm_num) refine mul_le_mul_of_nonneg_left ?_ (le_of_lt hd_pos) calc |∑ i : α, ∑ j : α, (u i * v j) * (K i b - K j b)| ≤ ∑ i : α, |∑ j : α, (u i * v j) * (K i b - K j b)| := abs_sum_le_sum_abs _ _ _ ≤ ∑ i : α, ∑ j : α, |(u i * v j) * (K i b - K j b)| := sum_le_sum fun i _ => abs_sum_le_sum_abs _ _ _ = ∑ i : α, ∑ j : α, (u i * v j) * |K i b - K j b| := sum_congr rfl fun i _ => sum_congr rfl fun j _ => by rw [abs_mul, abs_of_nonneg (huv_nonneg i j)] _ = d * ∑ i : α, ∑ j : α, (u i * v j) * tvDist (K i) (K j) := by rw [← mul_sum] have hswap : ∑ b : β, ∑ i : α, ∑ j : α, (u i * v j) * |K i b - K j b| = ∑ i : α, ∑ j : α, (u i * v j) * ∑ b : β, |K i b - K j b| := by rw [sum_comm] refine sum_congr rfl fun i _ => ?_ rw [sum_comm] refine sum_congr rfl fun j _ => by rw [mul_sum] rw [hswap] unfold tvDist have hpull : (1 / 2 : ℝ) * (d * ∑ i : α, ∑ j : α, (u i * v j) * ∑ b : β, |K i b - K j b|) = d * ∑ i : α, ∑ j : α, (u i * v j) * ((1 / 2 : ℝ) * ∑ b : β, |K i b - K j b|) := by rw [mul_left_comm, mul_sum] congr 1 refine sum_congr rfl fun i _ => ?_ rw [mul_sum] refine sum_congr rfl fun j _ => by ring exact hpull _ ≤ d * ∑ i : α, ∑ j : α, (u i * v j) * dobrushinCoeff K := by refine mul_le_mul_of_nonneg_left (sum_le_sum fun i _ => sum_le_sum fun j _ => ?_) (le_of_lt hd_pos) exact mul_le_mul_of_nonneg_left (tvDist_le_dobrushinCoeff K i j) (huv_nonneg i j) _ = dobrushinCoeff K * d := by have h1 : ∑ i : α, ∑ j : α, (u i * v j) * dobrushinCoeff K = dobrushinCoeff K := by simp_rw [← sum_mul, ← mul_sum, hv_sum, mul_one, hu_sum, one_mul] rw [h1]; ring /-! ### Our 5-Line Weighted AM-GM Fiber-Dobrushin Strong Data Processing Inequality -/ /-- Scalar weighted AM-GM log bound: for `0 ≤ q < p` and `0 < w ≤ 1`, `p * log (p / (w * p + (1 - w) * q)) ≤ (p - q) * log (1 / w)`. -/ lemma scalar_sdpi_log_bound {p q w : ℝ} (hq : 0 ≤ q) (hqp : q < p) (hw0 : 0 < w) (hw1 : w ≤ 1) : p * Real.log (p / (w * p + (1 - w) * q)) ≤ (p - q) * Real.log (1 / w) := by have hp_pos : 0 < p := lt_of_le_of_lt hq hqp have hmix_pos : 0 < w * p + (1 - w) * q := by nlinarith have h1w : 0 ≤ 1 - w := by linarith -- Apply 2-term log-sum inequality to (q, q) and (p - q, w * (p - q))! -- Wait: even simpler! Direct log concavity via Real.log_le_sub_one_of_pos! -- Notice w * p + (1 - w) * q = q + w * (p - q). -- Let r = (q + w * (p - q)) / p = α + (1 - α) * w where α = q / p ∈ [0, 1). -- We prove: -log r ≤ (1 - α) * (-log w), i.e., log (w^(1-α) / r) ≤ 0, -- equivalently by 2-term log-sum on a = (q, p - q), b = (q, w * (p - q)): -- (q + (p - q)) * log((q + (p - q)) / (q + w * (p - q))) ≤ q * log(q/q) + (p - q) * log((p-q)/(w*(p-q)))! let a : Fin 2 → ℝ := fun i => if i = 0 then q else p - q let b : Fin 2 → ℝ := fun i => if i = 0 then q else w * (p - q) have ha : ∀ i ∈ (univ : Finset (Fin 2)), 0 ≤ a i := fun i _ => by fin_cases i <;> simp [a] <;> linarith have hb : ∀ i ∈ (univ : Finset (Fin 2)), 0 ≤ b i := fun i _ => by fin_cases i <;> simp [b] <;> nlinarith have hac : ∀ i ∈ (univ : Finset (Fin 2)), a i ≠ 0 → b i ≠ 0 := fun i _ hai => by fin_cases i · simpa [a, b] using hai · simp only [a, b] at hai ⊢ exact mul_ne_zero (ne_of_gt hw0) hai have hls := log_sum_ineq univ a b ha hb hac have hA : ∑ i : Fin 2, a i = p := by simp [a, Fin.sum_univ_two] have hB : ∑ i : Fin 2, b i = w * p + (1 - w) * q := by simp [b, Fin.sum_univ_two]; ring rw [hA, hB] at hls have hpq_ne : p - q ≠ 0 := ne_of_gt (by linarith) simp only [ne_of_gt hp_pos, ↓reduceIte, Fin.sum_univ_two, a, b, Fin.isValue, Fin.one_eq_zero_iff] at hls norm_num at hls simp only [hpq_ne, ↓reduceIte] at hls have hterm1 : (p - q) / (w * (p - q)) = 1 / w := by field_simp rw [hterm1] at hls exact hls /-- **Fiber-Dobrushin Point-to-Mixture Strong Data Processing Inequality**: For any probability distributions `p, q ∈ Δ(β)` and weight `w ∈ (0, 1]`, `D_KL(p ‖ w p + (1 - w) q) ≤ d_TV(p, q) * log (1 / w)`. -/ theorem klDiv_point_mixture_le_tv {β : Type*} [Fintype β] [DecidableEq β] {p q : β → ℝ} (hp : IsProbDist p) (hq : IsProbDist q) {w : ℝ} (hw0 : 0 < w) (hw1 : w ≤ 1) : klDiv p (fun b => w * p b + (1 - w) * q b) ≤ tvDist p q * Real.log (1 / w) := by rw [tvDist_eq_sum_sub_min hp.2 hq.2, sum_mul] unfold klDiv refine sum_le_sum fun b _ => ?_ by_cases hpb : p b = 0 · simp only [hpb, ↓reduceIte, zero_sub] have hmin : min (0 : ℝ) (q b) = 0 := min_eq_left (hq.1 b) rw [hmin] simp · simp only [hpb, ↓reduceIte] have hpb_pos : 0 < p b := lt_of_le_of_ne (hp.1 b) (Ne.symm hpb) rcases le_or_gt (p b) (q b) with hle | hlt · -- p b ≤ q b: log(p b / (w p b + (1-w) q b)) ≤ 0 while RHS = 0 rw [min_eq_left hle, sub_self, zero_mul] have hmix_ge : p b ≤ w * p b + (1 - w) * q b := by nlinarith have hdiv_le : p b / (w * p b + (1 - w) * q b) ≤ 1 := (div_le_one (lt_of_lt_of_le hpb_pos hmix_ge)).mpr hmix_ge exact mul_nonpos_of_nonneg_of_nonpos (hp.1 b) (Real.log_nonpos (le_of_lt (div_pos hpb_pos (lt_of_lt_of_le hpb_pos hmix_ge))) hdiv_le) · -- q b < p b: apply scalar_sdpi_log_bound! rw [min_eq_right (le_of_lt hlt)] exact scalar_sdpi_log_bound (hq.1 b) hlt hw0 hw1 /-- **Channel-Level Fiber-Dobrushin SDPI**: For any stochastic channel `K : ι → β → ℝ` on a finite set `s`, probability weights `w` on `s`, and any `i ∈ s` with `w i > 0`, `D_KL(K_i ‖ ∑_{j ∈ s} w_j K_j) ≤ (max_{j,j' ∈ s} d_TV(K_j, K_{j'})) * log (1 / w_i)`. -/ theorem klDiv_row_avg_le_diam_mul_log {ι β : Type*} [Fintype β] [DecidableEq ι] [DecidableEq β] (s : Finset ι) (w : ι → ℝ) (hw : ∀ j ∈ s, 0 ≤ w j) (hw1 : ∑ j ∈ s, w j = 1) (K : ι → β → ℝ) (hK : ∀ j ∈ s, IsProbDist (K j)) {D : ℝ} (hD : ∀ j ∈ s, ∀ j' ∈ s, tvDist (K j) (K j') ≤ D) {i : ι} (hi : i ∈ s) (hwi : 0 < w i) : klDiv (K i) (fun b => ∑ j ∈ s, w j * K j b) ≤ D * Real.log (1 / w i) := by have hwi_le : w i ≤ 1 := by have := single_le_sum hw hi; linarith by_cases hwi1 : w i = 1 · -- Only i has positive mass, so avg = K i and KL = 0 have hother : ∀ j ∈ s.erase i, w j = 0 := by have hsum_er : ∑ j ∈ s.erase i, w j = 0 := by have := add_sum_erase s w hi; linarith exact (sum_eq_zero_iff_of_nonneg (fun j hj => hw j (mem_of_mem_erase hj))).mp hsum_er have havg : (fun b => ∑ j ∈ s, w j * K j b) = K i := by ext b rw [← add_sum_erase s (fun j => w j * K j b) hi, hwi1, one_mul, sum_eq_zero (fun j hj => by rw [hother j hj, zero_mul]), add_zero] rw [havg, (klDiv_eq_zero_iff (hK i hi) (hK i hi) (fun _ h => h)).mpr rfl, hwi1, div_one, Real.log_one, mul_zero] · have hwi_lt : w i < 1 := lt_of_le_of_ne hwi_le hwi1 have hrem_pos : 0 < 1 - w i := by linarith have hrem_sum : ∑ j ∈ s.erase i, w j = 1 - w i := by have := add_sum_erase s w hi; linarith let q : β → ℝ := fun b => ∑ j ∈ s.erase i, (w j / (1 - w i)) * K j b have hq_dist : IsProbDist q := by refine ⟨fun b => sum_nonneg fun j hj => mul_nonneg (div_nonneg (hw j (mem_of_mem_erase hj)) (le_of_lt hrem_pos)) ((hK j (mem_of_mem_erase hj)).1 b), ?_⟩ simp only [q] rw [sum_comm] simp_rw [← mul_sum] have h1 : ∀ j ∈ s.erase i, ∑ b : β, K j b = 1 := fun j hj => (hK j (mem_of_mem_erase hj)).2 rw [sum_congr rfl fun j hj => by rw [h1 j hj, mul_one], ← sum_div, hrem_sum, div_self (ne_of_gt hrem_pos)] have hmix_eq : (fun b => ∑ j ∈ s, w j * K j b) = fun b => w i * K i b + (1 - w i) * q b := by ext b rw [← add_sum_erase s (fun j => w j * K j b) hi] congr 1 simp only [q, mul_sum] refine sum_congr rfl fun j _ => ?_ field_simp [ne_of_gt hrem_pos] rw [hmix_eq] have hsdpi := klDiv_point_mixture_le_tv (hK i hi) hq_dist hwi hwi_le have htv_le : tvDist (K i) q ≤ D := by rw [tvDist_comm] calc tvDist q (K i) ≤ ∑ j ∈ s.erase i, (w j / (1 - w i)) * tvDist (K j) (K i) := tvDist_convex_left (s.erase i) (fun j => w j / (1 - w i)) (fun j hj => div_nonneg (hw j (mem_of_mem_erase hj)) (le_of_lt hrem_pos)) (by rw [← sum_div, hrem_sum, div_self (ne_of_gt hrem_pos)]) K (K i) _ ≤ ∑ j ∈ s.erase i, (w j / (1 - w i)) * D := sum_le_sum fun j hj => mul_le_mul_of_nonneg_left (hD j (mem_of_mem_erase hj) i hi) (div_nonneg (hw j (mem_of_mem_erase hj)) (le_of_lt hrem_pos)) _ = D := by rw [← sum_mul, ← sum_div, hrem_sum, div_self (ne_of_gt hrem_pos), one_mul] have hlog_nonneg : 0 ≤ Real.log (1 / w i) := Real.log_nonneg ((one_le_div hwi).mpr hwi_le) exact le_trans hsdpi (mul_le_mul_of_nonneg_right htv_le hlog_nonneg) /-! ## Section 2: Kemeny–Snell Strong Lumpability, Dynamical Information Closure (DIC), & NTIC -/ /-- Lumped micro-to-macro transition row `P̄_{i, b} = ∑_{j : π(j) = b} P_{i, j}`. -/ def lumpedRow {α β : Type*} [Fintype α] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (i : α) (b : β) : ℝ := pushForward π (P i) b /-- **Kemeny–Snell Strong Lumpability** (1960): microstates in the same fiber have identical macro-transition rows. -/ def IsStronglyLumpable {α β : Type*} [Fintype α] [DecidableEq β] (P : α → α → ℝ) (π : α → β) : Prop := ∀ i i' : α, π i = π i' → ∀ b : β, lumpedRow P π i b = lumpedRow P π i' b /-- Conditional micro-distribution within macrostate fiber `a`: `μ(i | a) = μ_i / (π_* μ)_a`. -/ noncomputable def condFiberDist {α β : Type*} [Fintype α] [DecidableEq β] (π : α → β) (μ : α → ℝ) (a : β) (i : α) : ℝ := if π i = a ∧ pushForward π μ a ≠ 0 then μ i / pushForward π μ a else 0 /-- The `μ`-induced macro-transition kernel `Q^(μ)_{a, b} = ∑_{i ∈ π⁻¹(a)} μ(i | a) P̄_{i, b}` (falling back to the fiber-uniform average if `(π_* μ)_a = 0`). -/ noncomputable def inducedMacroKernel {α β : Type*} [Fintype α] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (μ : α → ℝ) (a b : β) : ℝ := if pushForward π μ a ≠ 0 then ∑ i ∈ univ.filter (fun i => π i = a), condFiberDist π μ a i * lumpedRow P π i b else (1 / ((univ.filter (fun i => π i = a)).card : ℝ)) * ∑ i ∈ univ.filter (fun i => π i = a), lumpedRow P π i b /-- **Dynamical Information Closure (DIC) Defect**: `DIC(P, π; μ) = I_μ(M_{t+1}; X_t | M_t) = ∑_i μ_i D_KL(P̄_i ‖ Q^(μ)_{π(i)})`. -/ noncomputable def dicDefect {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (μ : α → ℝ) : ℝ := ∑ i : α, μ i * klDiv (lumpedRow P π i) (inducedMacroKernel P π μ (π i)) /-- Macroscopic one-step mutual information `I_μ(M_{t+1}; M_t)`. -/ noncomputable def macroMutualInfo {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (μ : α → ℝ) : ℝ := mutualInfo (pushForward π μ) (inducedMacroKernel P π μ) /-- Micro-to-macro one-step mutual information `I_μ(M_{t+1}; X_t)`. -/ noncomputable def microToMacroMutualInfo {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (μ : α → ℝ) : ℝ := mutualInfo μ (lumpedRow P π) /-- **Non-Trivial Informational Closure (NTIC)** (Bertschinger et al. 2006; Pfante et al. 2014): `NTIC(P, π; μ) = I_μ(M_{t+1}; M_t) - DIC(P, π; μ)`. -/ noncomputable def ntic {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (μ : α → ℝ) : ℝ := macroMutualInfo P π μ - dicDefect P π μ /-- Local Kemeny–Snell fiber TV-diameter `ε_diam(P, π; a) = max_{i, i' ∈ π⁻¹(a)} d_TV(P̄_i, P̄_{i'})`. -/ noncomputable def fiberDiam {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (a : β) : ℝ := let F := univ.filter (fun i : α => π i = a) if h : (F ×ˢ F).Nonempty then (F ×ˢ F).sup' h (fun p => tvDist (lumpedRow P π p.1) (lumpedRow P π p.2)) else 0 /-- Global Kemeny–Snell strong-lumpability defect `ε_diam(P, π) = max_a ε_diam(P, π; a)`. -/ noncomputable def ksDefectDiam {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (P : α → α → ℝ) (π : α → β) : ℝ := if h : (univ : Finset β).Nonempty then univ.sup' h (fun a => fiberDiam P π a) else 0 /-- Kernel-relative Kemeny–Snell lumpability defect `ε_KS(P, π; Q) = max_i d_TV(P̄_i, Q_{π(i)})`. -/ noncomputable def ksDefectKernel {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (Q : β → β → ℝ) : ℝ := if h : (univ : Finset α).Nonempty then univ.sup' h (fun i => tvDist (lumpedRow P π i) (Q (π i))) else 0 /-- Conditional intra-fiber micro-entropy `H_μ(X_t | M_t = a)`. -/ noncomputable def fiberCondEntropy {α β : Type*} [Fintype α] [DecidableEq β] (π : α → β) (μ : α → ℝ) (a : β) : ℝ := ∑ i ∈ univ.filter (fun i => π i = a), negMulLog (condFiberDist π μ a i) /-- Expected conditional micro-entropy `H_μ(X_t | M_t) = ∑_a (π_* μ)_a H_μ(X_t | M_t = a)`. -/ noncomputable def condMicroEntropy {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (π : α → β) (μ : α → ℝ) : ℝ := ∑ a : β, pushForward π μ a * fiberCondEntropy π μ a lemma isStochastic_lumpedRow {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) (π : α → β) : IsStochastic (lumpedRow P π) := fun i => isProbDist_pushForward π (hP i) lemma pushForward_kernelStep_eq_kernelStep_lumpedRow {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (μ : α → ℝ) : pushForward π (kernelStep μ P) = kernelStep μ (lumpedRow P π) := by ext b unfold pushForward kernelStep lumpedRow rw [sum_comm] refine sum_congr rfl fun i _ => ?_ unfold pushForward rw [mul_sum] lemma condFiberDist_sum {α β : Type*} [Fintype α] [DecidableEq β] (π : α → β) (μ : α → ℝ) {a : β} (ha : pushForward π μ a ≠ 0) : ∑ i ∈ univ.filter (fun i => π i = a), condFiberDist π μ a i = 1 := by have h1 : ∑ i ∈ univ.filter (fun i => π i = a), condFiberDist π μ a i = ∑ i ∈ univ.filter (fun i => π i = a), μ i / pushForward π μ a := sum_congr rfl fun i hi => by simp [condFiberDist, (mem_filter.mp hi).2, ha] rw [h1, ← sum_div] exact div_self ha lemma condFiberDist_nonneg {α β : Type*} [Fintype α] [DecidableEq β] (π : α → β) {μ : α → ℝ} (hμ : IsProbDist μ) (a : β) (i : α) : 0 ≤ condFiberDist π μ a i := by unfold condFiberDist split_ifs with h · exact div_nonneg (hμ.1 i) (sum_nonneg fun j _ => hμ.1 j) · rfl lemma isStochastic_inducedMacroKernel {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) {π : α → β} (hπ : Function.Surjective π) {μ : α → ℝ} (hμ : IsProbDist μ) : IsStochastic (inducedMacroKernel P π μ) := by intro a unfold inducedMacroKernel split_ifs with ha · refine ⟨fun b => sum_nonneg fun i _ => mul_nonneg (condFiberDist_nonneg π hμ a i) ((isStochastic_lumpedRow hP π i).1 b), ?_⟩ rw [sum_comm] simp_rw [← mul_sum, (isStochastic_lumpedRow hP π _).2, mul_one] exact condFiberDist_sum π μ ha · obtain ⟨i0, hi0⟩ := hπ a have hcard_pos : 0 < ((univ.filter (fun i => π i = a)).card : ℝ) := Nat.cast_pos.mpr (card_pos.mpr ⟨i0, mem_filter.mpr ⟨mem_univ _, hi0⟩⟩) refine ⟨fun b => mul_nonneg (by positivity) (sum_nonneg fun i _ => (isStochastic_lumpedRow hP π i).1 b), ?_⟩ rw [← mul_sum, sum_comm] simp_rw [(isStochastic_lumpedRow hP π _).2] simp [ne_of_gt hcard_pos] lemma kernelStep_inducedMacroKernel_eq_pushForward {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (P : α → α → ℝ) (π : α → β) {μ : α → ℝ} (hμ : IsProbDist μ) : kernelStep (pushForward π μ) (inducedMacroKernel P π μ) = pushForward π (kernelStep μ P) := by rw [pushForward_kernelStep_eq_kernelStep_lumpedRow] ext b unfold kernelStep rw [← sum_fiberwise_eq π (fun i => μ i * lumpedRow P π i b)] refine sum_congr rfl fun a _ => ?_ unfold inducedMacroKernel by_cases ha : pushForward π μ a = 0 · simp only [ha, ne_eq, not_true_eq_false, ↓reduceIte, zero_mul] have hμz : ∀ i ∈ univ.filter (fun i => π i = a), μ i = 0 := (sum_eq_zero_iff_of_nonneg (fun i _ => hμ.1 i)).mp ha exact (sum_eq_zero fun i hi => by rw [hμz i hi, zero_mul]).symm · simp only [ha, ne_eq, not_false_eq_true, ↓reduceIte, mul_sum] refine sum_congr rfl fun i hi => ?_ simp only [condFiberDist, (mem_filter.mp hi).2, ha, ne_eq, not_false_eq_true, and_self, ↓reduceIte] field_simp [ha] lemma absCont_lumpedRow_inducedMacroKernel {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) (π : α → β) {μ : α → ℝ} (hμ : IsProbDist μ) {i : α} (hμi : 0 < μ i) : AbsCont (lumpedRow P π i) (inducedMacroKernel P π μ (π i)) := by have hqa_pos : 0 < pushForward π μ (π i) := lt_of_lt_of_le hμi (single_le_sum (fun j _ => hμ.1 j) (mem_filter.mpr ⟨mem_univ i, rfl⟩)) have hqa_ne : pushForward π μ (π i) ≠ 0 := ne_of_gt hqa_pos intro b hPb hQb unfold inducedMacroKernel at hQb simp only [hqa_ne, ne_eq, not_false_eq_true, ↓reduceIte] at hQb have hPb_pos : 0 < lumpedRow P π i b := lt_of_le_of_ne ((isStochastic_lumpedRow hP π i).1 b) (Ne.symm hPb) have hcond_pos : 0 < condFiberDist π μ (π i) i := by simp only [condFiberDist, true_and, hqa_ne, ne_eq, not_false_eq_true, ↓reduceIte] exact div_pos hμi hqa_pos have hle : condFiberDist π μ (π i) i * lumpedRow P π i b ≤ ∑ j ∈ univ.filter (fun j => π j = π i), condFiberDist π μ (π i) j * lumpedRow P π j b := single_le_sum (fun j _ => mul_nonneg (condFiberDist_nonneg π hμ (π i) j) ((isStochastic_lumpedRow hP π j).1 b)) (mem_filter.mpr ⟨mem_univ i, rfl⟩) linarith [mul_pos hcond_pos hPb_pos] /-- **Theorem 1 (Kemeny–Snell Strong Lumpability ↔ Universal Operator Intertwining)**: `(P, π)` is strongly lumpable iff there exists a stochastic macro-kernel `Q` intertwining the pushforward for EVERY micro-distribution `μ ∈ Δ(α)`. -/ theorem stronglyLumpable_iff_intertwining {α β : Type*} [Fintype α] [Fintype β] [DecidableEq α] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) {π : α → β} (hπ : Function.Surjective π) : IsStronglyLumpable P π ↔ ∃ Q : β → β → ℝ, IsStochastic Q ∧ ∀ μ : α → ℝ, IsProbDist μ → pushForward π (kernelStep μ P) = kernelStep (pushForward π μ) Q := by constructor · intro hsl -- Pick a section of π via surjectivity choose s hs using hπ let Q : β → β → ℝ := fun a b => lumpedRow P π (s a) b refine ⟨Q, fun a => isStochastic_lumpedRow hP π (s a), fun μ _ => ?_⟩ rw [pushForward_kernelStep_eq_kernelStep_lumpedRow] ext b unfold kernelStep rw [← sum_fiberwise_eq π (fun i => μ i * lumpedRow P π i b)] refine sum_congr rfl fun a _ => ?_ have hconst : ∀ i ∈ univ.filter (fun i => π i = a), lumpedRow P π i b = Q a b := fun i hi => hsl i (s a) ((mem_filter.mp hi).2.trans (hs a).symm) b rw [sum_congr rfl fun i hi => by rw [hconst i hi], ← sum_mul] rfl · rintro ⟨Q, _, hinter⟩ i i' hπeq b let δi : α → ℝ := fun j => if j = i then 1 else 0 let δi' : α → ℝ := fun j => if j = i' then 1 else 0 have hδi : IsProbDist δi := ⟨fun j => by dsimp [δi]; split_ifs <;> norm_num, by simp [δi]⟩ have hδi' : IsProbDist δi' := ⟨fun j => by dsimp [δi']; split_ifs <;> norm_num, by simp [δi']⟩ have heval : ∀ (x : α), pushForward π (kernelStep (fun j => if j = x then 1 else 0) P) b = lumpedRow P π x b := by intro x rw [pushForward_kernelStep_eq_kernelStep_lumpedRow] simp [kernelStep] have hpush : ∀ (x : α) (a : β), pushForward π (fun j => if j = x then 1 else 0) a = if a = π x then 1 else 0 := by intro x a unfold pushForward by_cases hxa : a = π x · rw [if_pos hxa, sum_eq_single x] · simp · intro j _ hji; simp [hji] · intro hx; exact absurd (mem_filter.mpr ⟨mem_univ x, hxa.symm⟩) hx · rw [if_neg hxa, sum_eq_zero] intro j hj have : j ≠ x := fun h => hxa ((h ▸ (mem_filter.mp hj).2).symm) simp [this] have hi_eq : lumpedRow P π i b = Q (π i) b := by rw [← heval i, hinter δi hδi] dsimp only [δi] unfold kernelStep simp_rw [hpush i] simp only [ite_mul, one_mul, zero_mul, sum_ite_eq', mem_univ, ↓reduceIte] have hi'_eq : lumpedRow P π i' b = Q (π i') b := by rw [← heval i', hinter δi' hδi'] dsimp only [δi'] unfold kernelStep simp_rw [hpush i'] simp only [ite_mul, one_mul, zero_mul, sum_ite_eq', mem_univ, ↓reduceIte] rw [hi_eq, hi'_eq, hπeq] /-- **Theorem 2 (Exact Multi-Step Intertwining Under Strong Lumpability)**: If `Q` intertwines `(P, π)`, then `π_*(μ P^k) = (π_* μ) Q^k` for ALL `k ∈ ℕ` and ALL `μ ∈ Δ(α)`. -/ theorem stronglyLumpable_multiStep_intertwining {α β : Type*} [Fintype α] [Fintype β] [DecidableEq α] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) {π : α → β} {Q : β → β → ℝ} (hinter : ∀ μ, IsProbDist μ → pushForward π (kernelStep μ P) = kernelStep (pushForward π μ) Q) {μ : α → ℝ} (hμ : IsProbDist μ) : ∀ k : ℕ, pushForward π (kernelStep μ (kernelPow P k)) = kernelStep (pushForward π μ) (kernelPow Q k) | 0 => by rw [kernelStep_kernelPow_zero, kernelStep_kernelPow_zero] | k + 1 => by rw [kernelStep_kernelPow_succ, kernelStep_kernelPow_succ] rw [hinter _ (isProbDist_kernelStep hμ (isStochastic_kernelPow hP k))] rw [stronglyLumpable_multiStep_intertwining hP hinter hμ k] /-- **Theorem 3 (Exact Bregman–Pythagorean Projection Identity for DIC)**: For any `μ ∈ Δ(α)` and any macro-kernel `Q` with `Q^(μ)_a ≪ Q_a` on active macrostates, `∑_i μ_i D_KL(P̄_i ‖ Q_{π(i)}) = DIC(P, π; μ) + ∑_a (π_* μ)_a D_KL(Q^(μ)_a ‖ Q_a)`. -/ theorem dicDefect_pythagorean_projection {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) (π : α → β) {μ : α → ℝ} (hμ : IsProbDist μ) {Q : β → β → ℝ} (hac : ∀ a, pushForward π μ a ≠ 0 → AbsCont (inducedMacroKernel P π μ a) (Q a)) : ∑ i : α, μ i * klDiv (lumpedRow P π i) (Q (π i)) = dicDefect P π μ + ∑ a : β, pushForward π μ a * klDiv (inducedMacroKernel P π μ a) (Q a) := by unfold dicDefect rw [← sum_fiberwise_eq π (fun i => μ i * klDiv (lumpedRow P π i) (Q (π i))), ← sum_fiberwise_eq π (fun i => μ i * klDiv (lumpedRow P π i) (inducedMacroKernel P π μ (π i))), ← sum_add_distrib] refine sum_congr rfl fun a _ => ?_ by_cases ha : pushForward π μ a = 0 · have hμz : ∀ i ∈ univ.filter (fun i => π i = a), μ i = 0 := (sum_eq_zero_iff_of_nonneg (fun i _ => hμ.1 i)).mp ha simp only [ha, zero_mul, add_zero] rw [sum_eq_zero (fun i hi => by rw [hμz i hi, zero_mul]), sum_eq_zero (fun i hi => by rw [hμz i hi, zero_mul])] · -- Active fiber a: expand KL(P̄_i ‖ Q_a) = KL(P̄_i ‖ Q^(μ)_a) + ∑_b P̄_{i,b} log(Q^(μ)_{a,b} / Q_{a,b}) have hsplit : ∀ i ∈ univ.filter (fun i => π i = a), μ i * klDiv (lumpedRow P π i) (Q (π i)) = μ i * klDiv (lumpedRow P π i) (inducedMacroKernel P π μ (π i)) + ∑ b : β, μ i * (if lumpedRow P π i b = 0 then 0 else lumpedRow P π i b * Real.log (inducedMacroKernel P π μ a b / Q a b)) := by intro i hi have hπi : π i = a := (mem_filter.mp hi).2 rw [hπi] by_cases hμi : μ i = 0 · simp [hμi] · have hμi_pos : 0 < μ i := lt_of_le_of_ne (hμ.1 i) (Ne.symm hμi) have hac1 : AbsCont (lumpedRow P π i) (inducedMacroKernel P π μ a) := by rw [← hπi]; exact absCont_lumpedRow_inducedMacroKernel hP π hμ hμi_pos have hac2 : AbsCont (inducedMacroKernel P π μ a) (Q a) := hac a ha unfold klDiv rw [mul_sum, mul_sum, ← sum_add_distrib] refine sum_congr rfl fun b _ => ?_ by_cases hPb : lumpedRow P π i b = 0 · simp [hPb] · simp only [hPb, ↓reduceIte] have hQb : inducedMacroKernel P π μ a b ≠ 0 := hac1 b hPb have hQab : Q a b ≠ 0 := hac2 b hQb have hlog : Real.log (lumpedRow P π i b / Q a b) = Real.log (lumpedRow P π i b / inducedMacroKernel P π μ a b) + Real.log (inducedMacroKernel P π μ a b / Q a b) := by rw [← Real.log_mul (div_ne_zero hPb hQb) (div_ne_zero hQb hQab)] congr 1; field_simp [hQb, hQab] rw [hlog]; ring rw [sum_congr rfl hsplit, sum_add_distrib] congr 1 rw [sum_comm] unfold klDiv rw [mul_sum] refine sum_congr rfl fun b _ => ?_ by_cases hQb : inducedMacroKernel P π μ a b = 0 · simp only [hQb, ↓reduceIte, mul_zero] refine sum_eq_zero fun i hi => ?_ by_cases hμi : μ i = 0 · simp [hμi] · have hμi_pos : 0 < μ i := lt_of_le_of_ne (hμ.1 i) (Ne.symm hμi) have hac1 := absCont_lumpedRow_inducedMacroKernel hP π hμ hμi_pos rw [(mem_filter.mp hi).2] at hac1 have hPb : lumpedRow P π i b = 0 := by by_contra hne; exact hac1 b hne hQb simp [hPb] · simp only [hQb, ↓reduceIte] have hterm : ∀ i ∈ univ.filter (fun i => π i = a), μ i * (if lumpedRow P π i b = 0 then 0 else lumpedRow P π i b * Real.log (inducedMacroKernel P π μ a b / Q a b)) = (μ i * lumpedRow P π i b) * Real.log (inducedMacroKernel P π μ a b / Q a b) := by intro i _ by_cases hPb : lumpedRow P π i b = 0 · simp [hPb] · simp [hPb]; ring rw [sum_congr rfl hterm, ← sum_mul] have hsum_eq : ∑ i ∈ univ.filter (fun i => π i = a), μ i * lumpedRow P π i b = pushForward π μ a * inducedMacroKernel P π μ a b := by unfold inducedMacroKernel simp only [ha, ne_eq, not_false_eq_true, ↓reduceIte, mul_sum] refine sum_congr rfl fun i hi => ?_ simp only [condFiberDist, (mem_filter.mp hi).2, ha, ne_eq, not_false_eq_true, and_self, ↓reduceIte] field_simp [ha] rw [hsum_eq, mul_assoc] /-- `DIC(P, π; μ) ≥ 0` universally. -/ theorem dicDefect_nonneg {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) {π : α → β} (hπ : Function.Surjective π) {μ : α → ℝ} (hμ : IsProbDist μ) : 0 ≤ dicDefect P π μ := by unfold dicDefect refine sum_nonneg fun i _ => ?_ by_cases hμi : μ i = 0 · simp [hμi] · have hμi_pos : 0 < μ i := lt_of_le_of_ne (hμ.1 i) (Ne.symm hμi) exact mul_nonneg (hμ.1 i) (klDiv_nonneg (isStochastic_lumpedRow hP π i) (isStochastic_inducedMacroKernel hP hπ hμ (π i)) (absCont_lumpedRow_inducedMacroKernel hP π hμ hμi_pos)) /-- **Theorem 4 (DIC–Strong Lumpability Rigidity)**: For ANY strictly positive micro-distribution `μ` (`∀ i, 0 < μ i`), `DIC(P, π; μ) = 0 ↔ IsStronglyLumpable P π`. -/ theorem dicDefect_eq_zero_iff_stronglyLumpable {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) {π : α → β} (hπ : Function.Surjective π) {μ : α → ℝ} (hμ : IsProbDist μ) (hμ_pos : ∀ i, 0 < μ i) : dicDefect P π μ = 0 ↔ IsStronglyLumpable P π := by constructor · intro hdic i i' hπeq b have hnonneg : ∀ j ∈ (univ : Finset α), 0 ≤ μ j * klDiv (lumpedRow P π j) (inducedMacroKernel P π μ (π j)) := fun j _ => mul_nonneg (hμ.1 j) (klDiv_nonneg (isStochastic_lumpedRow hP π j) (isStochastic_inducedMacroKernel hP hπ hμ (π j)) (absCont_lumpedRow_inducedMacroKernel hP π hμ (hμ_pos j))) have hzero := (sum_eq_zero_iff_of_nonneg hnonneg).mp hdic have hi := (mul_eq_zero.mp (hzero i (mem_univ i))).resolve_left (ne_of_gt (hμ_pos i)) have hi' := (mul_eq_zero.mp (hzero i' (mem_univ i'))).resolve_left (ne_of_gt (hμ_pos i')) have heqi := (klDiv_eq_zero_iff (isStochastic_lumpedRow hP π i) (isStochastic_inducedMacroKernel hP hπ hμ (π i)) (absCont_lumpedRow_inducedMacroKernel hP π hμ (hμ_pos i))).mp hi have heqi' := (klDiv_eq_zero_iff (isStochastic_lumpedRow hP π i') (isStochastic_inducedMacroKernel hP hπ hμ (π i')) (absCont_lumpedRow_inducedMacroKernel hP π hμ (hμ_pos i'))).mp hi' rw [congrFun heqi b, congrFun heqi' b, hπeq] · intro hsl unfold dicDefect refine sum_eq_zero fun i _ => ?_ have hqa_ne : pushForward π μ (π i) ≠ 0 := ne_of_gt (lt_of_lt_of_le (hμ_pos i) (single_le_sum (fun j _ => hμ.1 j) (mem_filter.mpr ⟨mem_univ i, rfl⟩))) have hQeq : inducedMacroKernel P π μ (π i) = lumpedRow P π i := by ext b unfold inducedMacroKernel simp only [hqa_ne, ne_eq, not_false_eq_true, ↓reduceIte] rw [sum_congr rfl fun j hj => by rw [hsl j i (mem_filter.mp hj).2 b], ← sum_mul, condFiberDist_sum π μ hqa_ne, one_mul] rw [hQeq, (klDiv_eq_zero_iff (isStochastic_lumpedRow hP π i) (isStochastic_lumpedRow hP π i) (fun _ h => h)).mpr rfl, mul_zero] /-- Mutual information equals expected KL divergence to the output marginal: `I_μ(K) = ∑_i μ_i D_KL(K_i ‖ μ K)`. -/ lemma mutualInfo_eq_sum_klDiv {α β : Type*} [Fintype α] [Fintype β] {μ : α → ℝ} (hμ : IsProbDist μ) {K : α → β → ℝ} (hK : IsStochastic K) : mutualInfo μ K = ∑ i : α, μ i * klDiv (K i) (kernelStep μ K) := by unfold mutualInfo shannonEntropy klDiv negMulLog have hterm : ∀ i : α, μ i * (∑ b : β, if K i b = 0 then 0 else K i b * Real.log (K i b / kernelStep μ K b)) = -(μ i * ∑ b : β, -K i b * Real.log (K i b)) - ∑ b : β, μ i * K i b * Real.log (kernelStep μ K b) := by intro i by_cases hμi : μ i = 0 · simp [hμi] · have hμi_pos : 0 < μ i := lt_of_le_of_ne (hμ.1 i) (Ne.symm hμi) have hac := absCont_of_kernelStep hμ.1 (fun r c => (hK r).1 c) hμi_pos rw [mul_sum, mul_sum, ← sum_neg_distrib, ← sum_sub_distrib] refine sum_congr rfl fun b _ => ?_ by_cases hKb : K i b = 0 · simp [hKb] · simp only [hKb, ↓reduceIte] rw [Real.log_div hKb (hac b hKb)] ring simp_rw [hterm, sum_sub_distrib, sum_neg_distrib] rw [sum_comm (s := univ) (t := univ) (f := fun i b => μ i * K i b * Real.log (kernelStep μ K b))] have hmarg : ∀ b : β, ∑ i : α, μ i * K i b * Real.log (kernelStep μ K b) = kernelStep μ K b * Real.log (kernelStep μ K b) := fun b => by rw [← sum_mul]; rfl simp_rw [hmarg] ring_nf simp only [sum_neg_distrib] ring lemma mutualInfo_nonneg {α β : Type*} [Fintype α] [Fintype β] {μ : α → ℝ} (hμ : IsProbDist μ) {K : α → β → ℝ} (hK : IsStochastic K) : 0 ≤ mutualInfo μ K := by rw [mutualInfo_eq_sum_klDiv hμ hK] refine sum_nonneg fun i _ => ?_ by_cases hμi : μ i = 0 · simp [hμi] · exact mul_nonneg (hμ.1 i) (klDiv_nonneg (hK i) (isProbDist_kernelStep hμ hK) (absCont_of_kernelStep hμ.1 (fun r c => (hK r).1 c) (lt_of_le_of_ne (hμ.1 i) (Ne.symm hμi)))) lemma mutualInfo_le_log_card {α β : Type*} [Fintype α] [Fintype β] [Nonempty β] {μ : α → ℝ} (hμ : IsProbDist μ) {K : α → β → ℝ} (hK : IsStochastic K) : mutualInfo μ K ≤ Real.log (Fintype.card β : ℝ) := by unfold mutualInfo have h1 := shannonEntropy_le_log_card (isProbDist_kernelStep hμ hK) have h2 : 0 ≤ ∑ i : α, μ i * shannonEntropy (K i) := sum_nonneg fun i _ => mul_nonneg (hμ.1 i) (shannonEntropy_nonneg (hK i)) linarith /-- **Theorem 5 (Exact DIC Chain Rule & NTIC Decomposition)**: `DIC(P, π; μ) = I_μ(M_{t+1}; X_t) - I_μ(M_{t+1}; M_t)`, `NTIC(P, π; μ) = 2 I_μ(M_{t+1}; M_t) - I_μ(M_{t+1}; X_t)`, and `-ln |β| ≤ NTIC(P, π; μ) ≤ I_μ(M_{t+1}; M_t) ≤ ln |β|`. -/ theorem dicDefect_eq_mutualInfo_gap {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) {π : α → β} (hπ : Function.Surjective π) {μ : α → ℝ} (hμ : IsProbDist μ) : dicDefect P π μ = microToMacroMutualInfo P π μ - macroMutualInfo P π μ := by let r : β → ℝ := pushForward π (kernelStep μ P) have hQ_stoch := isStochastic_inducedMacroKernel hP hπ hμ have hstep_micro : kernelStep μ (lumpedRow P π) = r := (pushForward_kernelStep_eq_kernelStep_lumpedRow P π μ).symm have hstep_macro : kernelStep (pushForward π μ) (inducedMacroKernel P π μ) = r := kernelStep_inducedMacroKernel_eq_pushForward P π hμ have hpyth := dicDefect_pythagorean_projection hP π hμ (Q := fun _ b => r b) (fun a ha => by have hqa_pos : 0 < pushForward π μ a := lt_of_le_of_ne ((isProbDist_pushForward π hμ).1 a) (Ne.symm ha) have h := absCont_of_kernelStep (isProbDist_pushForward π hμ).1 (fun r c => (hQ_stoch r).1 c) hqa_pos rwa [hstep_macro] at h) have hmicro : microToMacroMutualInfo P π μ = ∑ i : α, μ i * klDiv (lumpedRow P π i) r := by unfold microToMacroMutualInfo rw [mutualInfo_eq_sum_klDiv hμ (isStochastic_lumpedRow hP π), hstep_micro] have hmacro : macroMutualInfo P π μ = ∑ a : β, pushForward π μ a * klDiv (inducedMacroKernel P π μ a) r := by unfold macroMutualInfo rw [mutualInfo_eq_sum_klDiv (isProbDist_pushForward π hμ) hQ_stoch, hstep_macro] linarith theorem ntic_eq_two_macro_sub_micro {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) {π : α → β} (hπ : Function.Surjective π) {μ : α → ℝ} (hμ : IsProbDist μ) : ntic P π μ = 2 * macroMutualInfo P π μ - microToMacroMutualInfo P π μ := by unfold ntic linarith [dicDefect_eq_mutualInfo_gap hP hπ hμ] theorem ntic_bounds {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] [Nonempty β] {P : α → α → ℝ} (hP : IsStochastic P) {π : α → β} (hπ : Function.Surjective π) {μ : α → ℝ} (hμ : IsProbDist μ) : -Real.log (Fintype.card β : ℝ) ≤ ntic P π μ ∧ ntic P π μ ≤ macroMutualInfo P π μ ∧ macroMutualInfo P π μ ≤ Real.log (Fintype.card β : ℝ) := by have hdic_nn := dicDefect_nonneg hP hπ hμ have hmicro_ub : microToMacroMutualInfo P π μ ≤ Real.log (Fintype.card β : ℝ) := mutualInfo_le_log_card hμ (isStochastic_lumpedRow hP π) have hmacro_nn : 0 ≤ macroMutualInfo P π μ := mutualInfo_nonneg (isProbDist_pushForward π hμ) (isStochastic_inducedMacroKernel hP hπ hμ) have hmacro_ub : macroMutualInfo P π μ ≤ Real.log (Fintype.card β : ℝ) := mutualInfo_le_log_card (isProbDist_pushForward π hμ) (isStochastic_inducedMacroKernel hP hπ hμ) have hntic := ntic_eq_two_macro_sub_micro hP hπ hμ exact ⟨by linarith, by unfold ntic; linarith, hmacro_ub⟩ /-! ## Section 3: Exact Two-Sided Quantitative Sandwich Between Kemeny–Snell `ε`-Lumpability and DIC -/ lemma fiberDiam_nonneg {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (a : β) : 0 ≤ fiberDiam P π a := by unfold fiberDiam dsimp only split_ifs with hne · obtain ⟨p, hp⟩ := hne exact le_trans (tvDist_nonneg _ _) (le_sup' (fun q : α × α => tvDist (lumpedRow P π q.1) (lumpedRow P π q.2)) hp) · rfl lemma tvDist_le_fiberDiam {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (P : α → α → ℝ) (π : α → β) {a : β} {i i' : α} (hi : π i = a) (hi' : π i' = a) : tvDist (lumpedRow P π i) (lumpedRow P π i') ≤ fiberDiam P π a := by unfold fiberDiam have hmem : (i, i') ∈ univ.filter (fun j => π j = a) ×ˢ univ.filter (fun j => π j = a) := mem_product.mpr ⟨mem_filter.mpr ⟨mem_univ i, hi⟩, mem_filter.mpr ⟨mem_univ i', hi'⟩⟩ have hne : (univ.filter (fun j => π j = a) ×ˢ univ.filter (fun j => π j = a)).Nonempty := ⟨(i, i'), hmem⟩ rw [dif_pos hne] exact le_sup' (fun p : α × α => tvDist (lumpedRow P π p.1) (lumpedRow P π p.2)) hmem lemma fiberDiam_le_ksDefectDiam {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (a : β) : fiberDiam P π a ≤ ksDefectDiam P π := by unfold ksDefectDiam have hne : (univ : Finset β).Nonempty := ⟨a, mem_univ a⟩ rw [dif_pos hne] exact le_sup' (fun b => fiberDiam P π b) (mem_univ a) /-- **Theorem 6 (Universal Pinsker Lower Bound on DIC)**: `DIC(P, π; μ) ≥ 2 ∑_i μ_i d_TV(P̄_i, Q^(μ)_{π(i)})^2 ≥ 2 (∑_i μ_i d_TV(P̄_i, Q^(μ)_{π(i)}))^2`. -/ theorem dicDefect_ge_two_mul_sq_avg_tv {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) {π : α → β} (hπ : Function.Surjective π) {μ : α → ℝ} (hμ : IsProbDist μ) : 2 * (∑ i : α, μ i * tvDist (lumpedRow P π i) (inducedMacroKernel P π μ (π i))) ^ 2 ≤ 2 * ∑ i : α, μ i * (tvDist (lumpedRow P π i) (inducedMacroKernel P π μ (π i))) ^ 2 ∧ 2 * ∑ i : α, μ i * (tvDist (lumpedRow P π i) (inducedMacroKernel P π μ (π i))) ^ 2 ≤ dicDefect P π μ := by constructor · -- Jensen / Cauchy-Schwarz for x ↦ x^2: (∑ μ_i x_i)^2 ≤ ∑ μ_i x_i^2 let x : α → ℝ := fun i => tvDist (lumpedRow P π i) (inducedMacroKernel P π μ (π i)) let m : ℝ := ∑ i : α, μ i * x i have hvar : 0 ≤ ∑ i : α, μ i * (x i - m) ^ 2 := sum_nonneg fun i _ => mul_nonneg (hμ.1 i) (sq_nonneg _) have hexpand : ∑ i : α, μ i * (x i - m) ^ 2 = (∑ i : α, μ i * x i ^ 2) - m ^ 2 := by have h1 : ∀ i, μ i * (x i - m) ^ 2 = μ i * x i ^ 2 - 2 * m * (μ i * x i) + m ^ 2 * μ i := fun i => by ring simp_rw [h1, sum_add_distrib, sum_sub_distrib, ← mul_sum, hμ.2] simp only [m]; ring linarith · -- Termwise Pinsker unfold dicDefect rw [mul_sum] refine sum_le_sum fun i _ => ?_ by_cases hμi : μ i = 0 · simp [hμi] · have hμi_pos : 0 < μ i := lt_of_le_of_ne (hμ.1 i) (Ne.symm hμi) have hpin := pinsker_ineq (isStochastic_lumpedRow hP π i) (isStochastic_inducedMacroKernel hP hπ hμ (π i)) (absCont_lumpedRow_inducedMacroKernel hP π hμ hμi_pos) nlinarith /-- **Theorem 7 (Fiber-Dobrushin Conditional-Entropy Upper Bound on DIC)**: `DIC(P, π; μ) ≤ ∑_a (π_* μ)_a ε_diam(P, π; a) H_μ(X_t | M_t = a) ≤ ε_diam(P, π) H_μ(X_t | M_t)`. -/ theorem dicDefect_le_fiberDiam_mul_condEntropy {α β : Type*} [Fintype α] [Fintype β] [DecidableEq α] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) (π : α → β) {μ : α → ℝ} (hμ : IsProbDist μ) : dicDefect P π μ ≤ ∑ a : β, pushForward π μ a * (fiberDiam P π a * fiberCondEntropy π μ a) ∧ ∑ a : β, pushForward π μ a * (fiberDiam P π a * fiberCondEntropy π μ a) ≤ ksDefectDiam P π * condMicroEntropy π μ := by constructor · unfold dicDefect rw [← sum_fiberwise_eq π (fun i => μ i * klDiv (lumpedRow P π i) (inducedMacroKernel P π μ (π i)))] refine sum_le_sum fun a _ => ?_ by_cases ha : pushForward π μ a = 0 · have hμz : ∀ i ∈ univ.filter (fun i => π i = a), μ i = 0 := (sum_eq_zero_iff_of_nonneg (fun i _ => hμ.1 i)).mp ha rw [ha, zero_mul, sum_eq_zero fun i hi => by rw [hμz i hi, zero_mul]] · set F := univ.filter (fun i : α => π i = a) have hqa_pos : 0 < pushForward π μ a := lt_of_le_of_ne ((isProbDist_pushForward π hμ).1 a) (Ne.symm ha) have hQ_eq : inducedMacroKernel P π μ a = fun b => ∑ j ∈ F, condFiberDist π μ a j * lumpedRow P π j b := by ext b; unfold inducedMacroKernel; simp [ha, F] unfold fiberCondEntropy rw [mul_sum, mul_sum] refine sum_le_sum fun i hi => ?_ have hπi : π i = a := (mem_filter.mp hi).2 rw [hπi, hQ_eq] by_cases hμi : μ i = 0 · have hci : condFiberDist π μ a i = 0 := by simp [condFiberDist, hπi, ha, hμi] simp [hμi, hci, negMulLog] · have hμi_pos : 0 < μ i := lt_of_le_of_ne (hμ.1 i) (Ne.symm hμi) have hci_eq : condFiberDist π μ a i = μ i / pushForward π μ a := by simp [condFiberDist, hπi, ha] have hci_pos : 0 < condFiberDist π μ a i := by rw [hci_eq]; exact div_pos hμi_pos hqa_pos have hsdpi := klDiv_row_avg_le_diam_mul_log F (condFiberDist π μ a) (fun j _ => condFiberDist_nonneg π hμ a j) (condFiberDist_sum π μ ha) (lumpedRow P π) (fun j _ => isStochastic_lumpedRow hP π j) (fun j hj j' hj' => tvDist_le_fiberDiam P π (mem_filter.mp hj).2 (mem_filter.mp hj').2) hi hci_pos have hμ_eq : μ i = pushForward π μ a * condFiberDist π μ a i := by rw [hci_eq]; field_simp [ha] have hlog_eq : condFiberDist π μ a i * Real.log (1 / condFiberDist π μ a i) = negMulLog (condFiberDist π μ a i) := by unfold negMulLog rw [Real.log_div one_ne_zero (ne_of_gt hci_pos), Real.log_one] ring calc μ i * klDiv (lumpedRow P π i) (fun b => ∑ j ∈ F, condFiberDist π μ a j * lumpedRow P π j b) ≤ μ i * (fiberDiam P π a * Real.log (1 / condFiberDist π μ a i)) := mul_le_mul_of_nonneg_left hsdpi (hμ.1 i) _ = pushForward π μ a * (fiberDiam P π a * negMulLog (condFiberDist π μ a i)) := by rw [hμ_eq, ← hlog_eq]; ring · unfold condMicroEntropy rw [mul_sum] refine sum_le_sum fun a _ => ?_ have hH_nn : 0 ≤ fiberCondEntropy π μ a := by unfold fiberCondEntropy refine sum_nonneg fun i hi => negMulLog_nonneg (condFiberDist_nonneg π hμ a i) ?_ by_cases ha : pushForward π μ a = 0 · simp [condFiberDist, ha] · have := single_le_sum (fun j _ => condFiberDist_nonneg π hμ a j) hi rwa [condFiberDist_sum π μ ha] at this have hqa_nn : 0 ≤ pushForward π μ a := (isProbDist_pushForward π hμ).1 a have hdiam := fiberDiam_le_ksDefectDiam P π a have h1 : fiberDiam P π a * fiberCondEntropy π μ a ≤ ksDefectDiam P π * fiberCondEntropy π μ a := mul_le_mul_of_nonneg_right hdiam hH_nn have h2 : pushForward π μ a * (fiberDiam P π a * fiberCondEntropy π μ a) ≤ pushForward π μ a * (ksDefectDiam P π * fiberCondEntropy π μ a) := mul_le_mul_of_nonneg_left h1 hqa_nn linarith /-- **Linear-Algebraic Carathéodory Support Reduction for Channel Mutual Information**: For any finite family of distributions `{K_i}_{i ∈ s}` on `β` (with `|β| = m`) and probability weights `w` on `s`, there exist probability weights `w'` on `s` supported on at most `|β|` points with the exact same average `∑ w'_i K_i = ∑ w_i K_i` and no smaller JSD: `∑ w_i D_KL(K_i ‖ q) ≤ ∑ w'_i D_KL(K_i ‖ q)`. -/ lemma caratheodory_support_reduction {ι β : Type*} [Fintype β] [DecidableEq ι] (s : Finset ι) (K : ι → β → ℝ) (hK : ∀ i ∈ s, IsProbDist (K i)) (w : ι → ℝ) (hw : ∀ i ∈ s, 0 ≤ w i) (hw1 : ∑ i ∈ s, w i = 1) : ∃ w' : ι → ℝ, (∀ i ∈ s, 0 ≤ w' i) ∧ (∑ i ∈ s, w' i = 1) ∧ ((s.filter (fun i => w' i ≠ 0)).card ≤ Fintype.card β) ∧ (∀ b : β, ∑ i ∈ s, w' i * K i b = ∑ i ∈ s, w i * K i b) ∧ (∑ i ∈ s, w' i * shannonEntropy (K i) ≤ ∑ i ∈ s, w i * shannonEntropy (K i)) := by -- Strong induction on the support size n = |(s.filter (w i ≠ 0))| suffices h : ∀ n : ℕ, ∀ w : ι → ℝ, (∀ i ∈ s, 0 ≤ w i) → (∑ i ∈ s, w i = 1) → (s.filter (fun i => w i ≠ 0)).card = n → ∃ w' : ι → ℝ, (∀ i ∈ s, 0 ≤ w' i) ∧ (∑ i ∈ s, w' i = 1) ∧ ((s.filter (fun i => w' i ≠ 0)).card ≤ Fintype.card β) ∧ (∀ b : β, ∑ i ∈ s, w' i * K i b = ∑ i ∈ s, w i * K i b) ∧ (∑ i ∈ s, w' i * shannonEntropy (K i) ≤ ∑ i ∈ s, w i * shannonEntropy (K i)) from h (s.filter (fun i => w i ≠ 0)).card w hw hw1 rfl intro n induction n using Nat.strong_induction_on with | h n ih => intro w hw hw1 hcard by_cases hle : n ≤ Fintype.card β · exact ⟨w, hw, hw1, hcard ▸ hle, fun _ => rfl, le_rfl⟩ · -- Support size n > |β|: linear map (T → ℝ) → (β → ℝ) has non-trivial kernel! set T := s.filter (fun i => w i ≠ 0) have hlt : Fintype.card β < T.card := by omega let L : (T → ℝ) →ₗ[ℝ] (β → ℝ) := { toFun := fun v b => ∑ i : T, v i * K i.1 b map_add' := fun u v => by ext b; simp [add_mul, sum_add_distrib] map_smul' := fun c v => by ext b; simp [mul_assoc, mul_sum] } have hfin_lt : Module.finrank ℝ (β → ℝ) < Module.finrank ℝ (T → ℝ) := by rw [Module.finrank_pi, Module.finrank_pi, Fintype.card_coe] exact hlt have hnot_inj : ¬ Function.Injective L := fun hinj => not_le_of_gt hfin_lt (LinearMap.finrank_le_finrank_of_injective hinj) rw [← LinearMap.ker_eq_bot, Submodule.eq_bot_iff] at hnot_inj push Not at hnot_inj obtain ⟨v0, hv0_ker, hv0_ne⟩ := hnot_inj -- Orient v so that ∑ v_i * H(K_i) ≤ 0 let v : T → ℝ := if ∑ i : T, v0 i * shannonEntropy (K i.1) ≤ 0 then v0 else -v0 have hv_ker : ∀ b : β, ∑ i : T, v i * K i.1 b = 0 := by intro b have h0 : ∑ i : T, v0 i * K i.1 b = 0 := congrFun (LinearMap.mem_ker.mp hv0_ker) b dsimp only [v] split_ifs · exact h0 · simp only [Pi.neg_apply, neg_mul, sum_neg_distrib, h0, neg_zero] have hv_ne : v ≠ 0 := by dsimp only [v]; split_ifs · exact hv0_ne · exact neg_ne_zero.mpr hv0_ne have hv_H : ∑ i : T, v i * shannonEntropy (K i.1) ≤ 0 := by dsimp only [v]; split_ifs with h · exact h · simp only [Pi.neg_apply, neg_mul, sum_neg_distrib]; linarith -- Summing hv_ker over b gives ∑ v_i = 0! have hv_sum : ∑ i : T, v i = 0 := by have h1 : ∑ b : β, ∑ i : T, v i * K i.1 b = 0 := sum_eq_zero fun b _ => hv_ker b rw [sum_comm] at h1 have h2 : ∀ i : T, ∑ b : β, v i * K i.1 b = v i := fun i => by rw [← mul_sum, (hK i.1 (mem_filter.mp i.2).1).2, mul_one] simpa [h2] using h1 -- Hence some coordinate of v is strictly negative! have hneg_exists : ∃ i : T, v i < 0 := by by_contra hall push Not at hall have hvz : ∀ i ∈ (univ : Finset T), v i = 0 := (sum_eq_zero_iff_of_nonneg (fun i _ => hall i)).mp hv_sum exact hv_ne (funext fun i => hvz i (mem_univ i)) -- Choose t = min_{v i < 0} (w i / (-v i)) > 0 let negSet : Finset T := univ.filter (fun i : T => v i < 0) have hneg_ne : negSet.Nonempty := by obtain ⟨i0, hi0⟩ := hneg_exists exact ⟨i0, mem_filter.mpr ⟨mem_univ i0, hi0⟩⟩ obtain ⟨i0, hi0_mem, hi0_min⟩ := exists_min_image negSet (fun i : T => w i.1 / (-v i)) hneg_ne set t : ℝ := w i0.1 / (-v i0) have hwi0_pos : 0 < w i0.1 := lt_of_le_of_ne (hw i0.1 (mem_filter.mp i0.2).1) (Ne.symm (mem_filter.mp i0.2).2) have hvi0_neg : v i0 < 0 := (mem_filter.mp hi0_mem).2 have ht_pos : 0 < t := div_pos hwi0_pos (neg_pos.mpr hvi0_neg) -- Define updated weights w1 let w1 : ι → ℝ := fun i => if hi : i ∈ T then w i + t * v ⟨i, hi⟩ else 0 have hw1_nn : ∀ i ∈ s, 0 ≤ w1 i := by intro i hi dsimp only [w1] split_ifs with hT · by_cases hvi : v ⟨i, hT⟩ < 0 · have hmin := hi0_min ⟨i, hT⟩ (mem_filter.mpr ⟨mem_univ _, hvi⟩) have hneg_pos : 0 < -v ⟨i, hT⟩ := neg_pos.mpr hvi have hmul : t * (-v ⟨i, hT⟩) ≤ w i := (le_div_iff₀ hneg_pos).mp hmin linarith · push Not at hvi exact add_nonneg (hw i hi) (mul_nonneg (le_of_lt ht_pos) hvi) · rfl have hsum_w1_on_T : ∀ f : ι → ℝ, ∑ i ∈ s, w1 i * f i = (∑ i ∈ s, w i * f i) + t * ∑ i : T, v i * f i.1 := by intro f have h1 : ∑ i ∈ s, w1 i * f i = ∑ i ∈ T, w1 i * f i := by symm exact sum_subset (filter_subset _ s) fun i _ hi => by simp [w1, hi] have h2 : ∑ i ∈ T, w1 i * f i = ∑ i : T, (w i.1 + t * v i) * f i.1 := by rw [← sum_coe_sort T (fun i => w1 i * f i)] refine sum_congr rfl fun i _ => by simp [w1, i.2] have h3 : ∑ i ∈ s, w i * f i = ∑ i : T, w i.1 * f i.1 := by have hsub_w : ∑ i ∈ T, w i * f i = ∑ i ∈ s, w i * f i := sum_subset (filter_subset _ s) fun i hi hni => by have hwi : w i = 0 := by by_contra hne; exact hni (mem_filter.mpr ⟨hi, hne⟩) simp [hwi] rw [← hsub_w, ← sum_coe_sort T (fun i => w i * f i)] rw [h1, h2, h3] simp_rw [add_mul, sum_add_distrib, mul_assoc, ← mul_sum] have hw1_sum : ∑ i ∈ s, w1 i = 1 := by have h := hsum_w1_on_T (fun _ => 1) simp only [mul_one, hv_sum, mul_zero, add_zero] at h rw [h, hw1] have hw1_avg : ∀ b : β, ∑ i ∈ s, w1 i * K i b = ∑ i ∈ s, w i * K i b := fun b => by rw [hsum_w1_on_T (fun i => K i b), hv_ker b, mul_zero, add_zero] have hw1_H : ∑ i ∈ s, w1 i * shannonEntropy (K i) ≤ ∑ i ∈ s, w i * shannonEntropy (K i) := by rw [hsum_w1_on_T (fun i => shannonEntropy (K i))] nlinarith -- Support strictly shrank because w1 i0 = 0! have hw1_i0 : w1 i0.1 = 0 := by simp only [w1, i0.2, ↓reduceDIte, t] have hne : v i0 ≠ 0 := ne_of_lt hvi0_neg field_simp [hne]; ring have hsub : s.filter (fun i => w1 i ≠ 0) ⊂ T := by refine Finset.ssubset_iff_subset_ne.mpr ⟨fun i hi => ?_, fun heq => ?_⟩ · obtain ⟨his, hne⟩ := mem_filter.mp hi by_contra hni exact hne (by simp [w1, hni]) · have hmem : i0.1 ∈ s.filter (fun i => w1 i ≠ 0) := heq.symm ▸ i0.2 exact (mem_filter.mp hmem).2 hw1_i0 have hcard_lt : (s.filter (fun i => w1 i ≠ 0)).card < n := by rw [← hcard]; exact card_lt_card hsub obtain ⟨w', hw'_nn, hw'_sum, hw'_card, hw'_avg, hw'_H⟩ := ih _ hcard_lt w1 hw1_nn hw1_sum rfl exact ⟨w', hw'_nn, hw'_sum, hw'_card, fun b => (hw'_avg b).trans (hw1_avg b), le_trans hw'_H hw1_H⟩ /-- **Theorem 8 (Fiber-Size-Independent Universal Macro-Cardinality DIC Upper Bound)**: Even when fibers have arbitrarily many microstates (`H_μ(X_t | M_t) → ∞`), `DIC(P, π; μ) ≤ ∑_a (π_* μ)_a ε_diam(P, π; a) ln |β| ≤ ε_diam(P, π) ln |β|`. -/ theorem dicDefect_le_fiberDiam_mul_log_card {α β : Type*} [Fintype α] [Fintype β] [DecidableEq α] [DecidableEq β] [Nonempty β] {P : α → α → ℝ} (hP : IsStochastic P) (π : α → β) {μ : α → ℝ} (hμ : IsProbDist μ) : dicDefect P π μ ≤ (∑ a : β, pushForward π μ a * fiberDiam P π a) * Real.log (Fintype.card β : ℝ) ∧ (∑ a : β, pushForward π μ a * fiberDiam P π a) * Real.log (Fintype.card β : ℝ) ≤ ksDefectDiam P π * Real.log (Fintype.card β : ℝ) := by have hlog_nn : 0 ≤ Real.log (Fintype.card β : ℝ) := Real.log_nonneg (Nat.one_le_cast.mpr Fintype.card_pos) constructor · unfold dicDefect rw [← sum_fiberwise_eq π (fun i => μ i * klDiv (lumpedRow P π i) (inducedMacroKernel P π μ (π i))), sum_mul] refine sum_le_sum fun a _ => ?_ by_cases ha : pushForward π μ a = 0 · have hμz : ∀ i ∈ univ.filter (fun i => π i = a), μ i = 0 := (sum_eq_zero_iff_of_nonneg (fun i _ => hμ.1 i)).mp ha rw [ha, zero_mul, zero_mul, sum_eq_zero fun i hi => by rw [hμz i hi, zero_mul]] · set F := univ.filter (fun i : α => π i = a) set qa := pushForward π μ a have hqa_pos : 0 < qa := lt_of_le_of_ne ((isProbDist_pushForward π hμ).1 a) (Ne.symm ha) let w : α → ℝ := condFiberDist π μ a have hw_nn : ∀ i ∈ F, 0 ≤ w i := fun i _ => condFiberDist_nonneg π hμ a i have hw_sum : ∑ i ∈ F, w i = 1 := condFiberDist_sum π μ ha have hK_dist : ∀ i ∈ F, IsProbDist (lumpedRow P π i) := fun i _ => isStochastic_lumpedRow hP π i -- Apply Carathéodory support reduction on fiber F! obtain ⟨w', hw'_nn, hw'_sum, hw'_card, hw'_avg, hw'_H⟩ := caratheodory_support_reduction F (lumpedRow P π) hK_dist w hw_nn hw_sum -- Let q_a = ∑_{i ∈ F} w_i P̄_i = ∑_{i ∈ F} w'_i P̄_i let avg : β → ℝ := fun b => ∑ i ∈ F, w i * lumpedRow P π i b have havg_eq : inducedMacroKernel P π μ a = avg := by ext b; unfold inducedMacroKernel; rw [if_pos ha] have havg_eq' : avg = fun b => ∑ i ∈ F, w' i * lumpedRow P π i b := by ext b; exact (hw'_avg b).symm -- Rewrite fiber JSD as H(avg) - ∑ w_i H(P̄_i) ≤ H(avg) - ∑ w'_i H(P̄_i) = ∑ w'_i KL(P̄_i ‖ avg) have hjsd_eq : ∀ (u : α → ℝ), (∀ i ∈ F, 0 ≤ u i) → (∑ i ∈ F, u i = 1) → (∀ b, ∑ i ∈ F, u i * lumpedRow P π i b = avg b) → ∑ i ∈ F, u i * klDiv (lumpedRow P π i) avg = shannonEntropy avg - ∑ i ∈ F, u i * shannonEntropy (lumpedRow P π i) := by intro u hu_nn hu_sum hu_avg -- Prove directly by expanding klDiv unfold klDiv shannonEntropy negMulLog have hterm : ∀ i ∈ F, u i * (∑ b : β, if lumpedRow P π i b = 0 then 0 else lumpedRow P π i b * Real.log (lumpedRow P π i b / avg b)) = -(u i * ∑ b : β, -lumpedRow P π i b * Real.log (lumpedRow P π i b)) - ∑ b : β, u i * lumpedRow P π i b * Real.log (avg b) := by intro i hi by_cases hui : u i = 0 · simp [hui] · have hui_pos : 0 < u i := lt_of_le_of_ne (hu_nn i hi) (Ne.symm hui) rw [mul_sum, mul_sum, ← sum_neg_distrib, ← sum_sub_distrib] refine sum_congr rfl fun b _ => ?_ by_cases hPb : lumpedRow P π i b = 0 · simp [hPb] · simp only [hPb, ↓reduceIte] have hPb_pos : 0 < lumpedRow P π i b := lt_of_le_of_ne ((hK_dist i hi).1 b) (Ne.symm hPb) have havg_pos : 0 < avg b := by rw [← hu_avg b] exact lt_of_lt_of_le (mul_pos hui_pos hPb_pos) (single_le_sum (fun j hj => mul_nonneg (hu_nn j hj) ((hK_dist j hj).1 b)) hi) rw [Real.log_div hPb (ne_of_gt havg_pos)] ring rw [sum_congr rfl hterm, sum_sub_distrib, sum_neg_distrib] rw [sum_comm (s := F) (t := univ) (f := fun i b => u i * lumpedRow P π i b * Real.log (avg b))] have hmarg : ∀ b : β, ∑ i ∈ F, u i * lumpedRow P π i b * Real.log (avg b) = avg b * Real.log (avg b) := fun b => by rw [← sum_mul, hu_avg b] simp_rw [hmarg] simp only [neg_mul, sum_neg_distrib] ring have hstep1 : ∑ i ∈ F, w i * klDiv (lumpedRow P π i) avg ≤ ∑ i ∈ F, w' i * klDiv (lumpedRow P π i) avg := by rw [hjsd_eq w hw_nn hw_sum (fun _ => rfl), hjsd_eq w' hw'_nn hw'_sum hw'_avg] linarith -- Now apply Fiber-Dobrushin SDPI to w'! have hstep2 : ∑ i ∈ F, w' i * klDiv (lumpedRow P π i) avg ≤ fiberDiam P π a * ∑ i ∈ F, negMulLog (w' i) := by rw [havg_eq', mul_sum] refine sum_le_sum fun i hi => ?_ by_cases hwi' : w' i = 0 · simp [hwi', negMulLog] · have hwi'_pos : 0 < w' i := lt_of_le_of_ne (hw'_nn i hi) (Ne.symm hwi') have hsdpi := klDiv_row_avg_le_diam_mul_log F w' hw'_nn hw'_sum (lumpedRow P π) hK_dist (fun j hj j' hj' => tvDist_le_fiberDiam P π (mem_filter.mp hj).2 (mem_filter.mp hj').2) hi hwi'_pos have hlog_eq : w' i * Real.log (1 / w' i) = negMulLog (w' i) := by unfold negMulLog rw [Real.log_div one_ne_zero (ne_of_gt hwi'_pos), Real.log_one]; ring calc w' i * klDiv (lumpedRow P π i) (fun b => ∑ j ∈ F, w' j * lumpedRow P π j b) ≤ w' i * (fiberDiam P π a * Real.log (1 / w' i)) := mul_le_mul_of_nonneg_left hsdpi (hw'_nn i hi) _ = fiberDiam P π a * negMulLog (w' i) := by rw [← hlog_eq]; ring -- Bound H(w') ≤ ln |supp(w')| ≤ ln |β|! let w'Ext : α → ℝ := fun i => if i ∈ F then w' i else 0 have hw'Ext : IsProbDist w'Ext := by refine ⟨fun i => by dsimp only [w'Ext]; split_ifs with hi; exact hw'_nn i hi; rfl, ?_⟩ calc ∑ i : α, w'Ext i = ∑ i ∈ F, w'Ext i := (sum_subset (subset_univ F) fun i _ hi => by simp [w'Ext, hi]).symm _ = ∑ i ∈ F, w' i := sum_congr rfl fun i hi => by simp [w'Ext, hi] _ = 1 := hw'_sum set S' := F.filter (fun i => w' i ≠ 0) have hS'_ne : S'.Nonempty := by by_contra hempty rw [not_nonempty_iff_eq_empty] at hempty have hzero : ∀ i ∈ F, w' i = 0 := fun i hi => by by_contra hne have hmem : i ∈ S' := mem_filter.mpr ⟨hi, hne⟩ rw [hempty] at hmem; exact notMem_empty i hmem have := sum_eq_zero hzero linarith have hH_le : ∑ i ∈ F, negMulLog (w' i) ≤ Real.log (Fintype.card β : ℝ) := by have hEq : ∑ i ∈ F, negMulLog (w' i) = shannonEntropy w'Ext := by unfold shannonEntropy rw [← sum_subset (subset_univ F) fun i _ hi => by simp [w'Ext, hi, negMulLog]] exact sum_congr rfl fun i hi => by simp [w'Ext, hi] rw [hEq] have h1 := shannonEntropy_le_log_support_card hw'Ext (s := S') (fun i hne => by dsimp only [w'Ext] at hne split_ifs at hne with hi · exact mem_filter.mpr ⟨hi, hne⟩ · exact absurd rfl hne) hS'_ne have h2 : Real.log (S'.card : ℝ) ≤ Real.log (Fintype.card β : ℝ) := Real.log_le_log (Nat.cast_pos.mpr hS'_ne.card_pos) (Nat.cast_le.mpr hw'_card) exact le_trans h1 h2 have hfiber_le : ∑ i ∈ F, w i * klDiv (lumpedRow P π i) avg ≤ fiberDiam P π a * Real.log (Fintype.card β : ℝ) := le_trans hstep1 (le_trans hstep2 (mul_le_mul_of_nonneg_left hH_le (fiberDiam_nonneg P π a))) -- Multiply by qa = pushForward π μ a have hrew : ∑ i ∈ F, μ i * klDiv (lumpedRow P π i) (inducedMacroKernel P π μ (π i)) = qa * ∑ i ∈ F, w i * klDiv (lumpedRow P π i) avg := by rw [mul_sum] refine sum_congr rfl fun i hi => ?_ have hπi : π i = a := (mem_filter.mp hi).2 rw [hπi, havg_eq] have hqa_ne : pushForward π μ a ≠ 0 := ha simp only [w, condFiberDist, hπi, hqa_ne, ne_eq, not_false_eq_true, and_self, ↓reduceIte, qa] field_simp [hqa_ne] rw [hrew, mul_assoc] exact mul_le_mul_of_nonneg_left hfiber_le (le_of_lt hqa_pos) · have hsum_le : ∑ a : β, pushForward π μ a * fiberDiam P π a ≤ ksDefectDiam P π := by calc ∑ a : β, pushForward π μ a * fiberDiam P π a ≤ ∑ a : β, pushForward π μ a * ksDefectDiam P π := sum_le_sum fun a _ => mul_le_mul_of_nonneg_left (fiberDiam_le_ksDefectDiam P π a) ((isProbDist_pushForward π hμ).1 a) _ = ksDefectDiam P π := by rw [← sum_mul, (isProbDist_pushForward π hμ).2, one_mul] exact mul_le_mul_of_nonneg_right hsum_le hlog_nn /-- **Theorem 9 (Quantitative `ε`-Lumpability Guarantee for Positive NTIC)**: Whenever `I_μ(M_{t+1}; M_t) > ε_diam(P, π) · min(H_μ(X_t | M_t), ln |β|)`, emergent informational closure `NTIC(P, π; μ) > 0` is strictly guaranteed. -/ theorem ntic_pos_of_small_ksDefect {α β : Type*} [Fintype α] [Fintype β] [DecidableEq α] [DecidableEq β] [Nonempty β] {P : α → α → ℝ} (hP : IsStochastic P) (π : α → β) {μ : α → ℝ} (hμ : IsProbDist μ) (hgap : ksDefectDiam P π * min (condMicroEntropy π μ) (Real.log (Fintype.card β : ℝ)) < macroMutualInfo P π μ) : 0 < ntic P π μ := by have h1 := (dicDefect_le_fiberDiam_mul_condEntropy hP π hμ) have h2 := (dicDefect_le_fiberDiam_mul_log_card hP π hμ) have hdic_le1 : dicDefect P π μ ≤ ksDefectDiam P π * condMicroEntropy π μ := le_trans h1.1 h1.2 have hdic_le2 : dicDefect P π μ ≤ ksDefectDiam P π * Real.log (Fintype.card β : ℝ) := le_trans h2.1 h2.2 have hdic_le : dicDefect P π μ ≤ ksDefectDiam P π * min (condMicroEntropy π μ) (Real.log (Fintype.card β : ℝ)) := by rcases le_total (condMicroEntropy π μ) (Real.log (Fintype.card β : ℝ)) with hle | hle · rw [min_eq_left hle]; exact hdic_le1 · rw [min_eq_right hle]; exact hdic_le2 unfold ntic linarith /-- Shared-anchor kernel: from `(a, c)` (with `c : Fin (m - 1)`), transition to macrostate `0` with prob `1 - ε` and to macrostate `c.val + 1` with prob `ε`, uniformly across the target fiber. -/ noncomputable def anchorKernel (m : ℕ) (hm : 2 ≤ m) (ε : ℝ) : (Fin m × Fin (m - 1)) → (Fin m × Fin (m - 1)) → ℝ := fun src dst => let target : Fin m := ⟨src.2.val + 1, by omega⟩ let p_macro : ℝ := if dst.1 = ⟨0, by omega⟩ then 1 - ε else if dst.1 = target then ε else 0 p_macro / ((m - 1 : ℕ) : ℝ) /-- **Theorem 10 (Sharpness / Tightness of the `ε · ln m` DIC Upper Bound)**: For every `m ≥ 3` and every `ε ∈ [0, 1]`, `anchorKernel m hm ε` under `π = Prod.fst` and uniform micro-distribution achieves `ε_diam = ε` and `DIC = ε · ln(m - 1)`, matching the universal bound `ε · ln m` up to the sharp asymptotic factor `ln(m - 1) / ln m → 1`. -/ theorem dicDefect_tight_sharedAnchor (m : ℕ) (hm : 3 ≤ m) {ε : ℝ} (hε0 : 0 ≤ ε) (hε1 : ε ≤ 1) : let hm2 : 2 ≤ m := by omega let P := anchorKernel m hm2 ε let μ : Fin m × Fin (m - 1) → ℝ := fun _ => 1 / (Fintype.card (Fin m × Fin (m - 1)) : ℝ) IsStochastic P ∧ IsProbDist μ ∧ ksDefectDiam P Prod.fst = ε ∧ dicDefect P Prod.fst μ = ε * Real.log ((m - 1 : ℕ) : ℝ) := by intro hm2 P μ have hm1_pos : (0 : ℝ) < ((m - 1 : ℕ) : ℝ) := Nat.cast_pos.mpr (by omega) have hm_pos : (0 : ℝ) < (m : ℝ) := Nat.cast_pos.mpr (by omega) have hcard_prod : (Fintype.card (Fin m × Fin (m - 1)) : ℝ) = (m : ℝ) * ((m - 1 : ℕ) : ℝ) := by simp [Fintype.card_prod] -- Helper: lumped row of anchorKernel have hlumped : ∀ (src : Fin m × Fin (m - 1)) (b : Fin m), lumpedRow P Prod.fst src b = if b = ⟨0, by omega⟩ then 1 - ε else if b = ⟨src.2.val + 1, by omega⟩ then ε else 0 := by intro src b unfold lumpedRow pushForward have hfilt : univ.filter (fun j : Fin m × Fin (m - 1) => j.1 = b) = Finset.image (fun r : Fin (m - 1) => (b, r)) univ := by ext ⟨b', r⟩ simp [eq_comm] rw [hfilt, sum_image (fun x _ y _ h => (Prod.mk.inj h).2)] dsimp only [P, anchorKernel] set val : ℝ := (if b = ⟨0, by omega⟩ then 1 - ε else if b = ⟨src.2.val + 1, by omega⟩ then ε else 0) have hsum_c : ∑ _r : Fin (m - 1), val / ((m - 1 : ℕ) : ℝ) = ((m - 1 : ℕ) : ℝ) * (val / ((m - 1 : ℕ) : ℝ)) := by simp [nsmul_eq_mul] rw [hsum_c] field_simp [ne_of_gt hm1_pos] have hP_stoch : IsStochastic P := by intro src refine ⟨fun dst => ?_, ?_⟩ · dsimp only [P, anchorKernel] apply div_nonneg _ (le_of_lt hm1_pos) split_ifs <;> linarith · rw [← sum_fiberwise_eq Prod.fst (P src)] have h1 : ∀ b : Fin m, ∑ dst ∈ univ.filter (fun j : Fin m × Fin (m - 1) => j.1 = b), P src dst = lumpedRow P Prod.fst src b := fun _ => rfl simp_rw [h1, hlumped] let z0 : Fin m := ⟨0, by omega⟩ let t : Fin m := ⟨src.2.val + 1, by omega⟩ have hne : t ≠ z0 := by intro h; have := congrArg Fin.val h; simp [t, z0] at this rw [← add_sum_erase univ _ (mem_univ z0), if_pos rfl] have h2 : ∑ b ∈ univ.erase z0, (if b = z0 then 1 - ε else if b = t then ε else 0) = ε := by rw [sum_eq_single t] · simp [hne] · intro b hb hbt have hbz : b ≠ z0 := ne_of_mem_erase hb simp [hbz, hbt] · intro ht; exact absurd (mem_erase.mpr ⟨hne, mem_univ t⟩) ht rw [h2]; ring have hμ_dist : IsProbDist μ := by refine ⟨fun _ => by dsimp [μ]; positivity, ?_⟩ simp only [μ, sum_const, card_univ, nsmul_eq_mul, hcard_prod] field_simp [ne_of_gt hm_pos, ne_of_gt hm1_pos] -- TV distance between two rows in the same fiber: 0 if same second coord, ε if distinct! have htv_pair : ∀ (a : Fin m) (c c' : Fin (m - 1)), tvDist (lumpedRow P Prod.fst (a, c)) (lumpedRow P Prod.fst (a, c')) = if c = c' then 0 else ε := by intro a c c' by_cases hcc : c = c' · subst hcc; simp [tvDist_self] · simp only [hcc, ↓reduceIte] unfold tvDist simp_rw [hlumped] let z0 : Fin m := ⟨0, by omega⟩ let t1 : Fin m := ⟨c.val + 1, by omega⟩ let t2 : Fin m := ⟨c'.val + 1, by omega⟩ have ht1z : t1 ≠ z0 := fun h => by have := congrArg Fin.val h; simp [t1, z0] at this have ht2z : t2 ≠ z0 := fun h => by have := congrArg Fin.val h; simp [t2, z0] at this have ht12 : t1 ≠ t2 := fun h => hcc (Fin.ext (by have := congrArg Fin.val h; simp [t1, t2] at this; omega)) have hsum : ∑ b : Fin m, |(if b = z0 then 1 - ε else if b = t1 then ε else 0) - (if b = z0 then 1 - ε else if b = t2 then ε else 0)| = 2 * ε := by rw [← add_sum_erase univ _ (mem_univ t1)] have ht1_val : |(if t1 = z0 then 1 - ε else if t1 = t1 then ε else 0) - (if t1 = z0 then 1 - ε else if t1 = t2 then ε else 0)| = ε := by simp [ht1z, ht12, abs_of_nonneg hε0] rw [ht1_val, ← add_sum_erase (univ.erase t1) _ (mem_erase.mpr ⟨ht12.symm, mem_univ t2⟩)] have ht2_val : |(if t2 = z0 then 1 - ε else if t2 = t1 then ε else 0) - (if t2 = z0 then 1 - ε else if t2 = t2 then ε else 0)| = ε := by simp [ht2z, ht12.symm, abs_of_nonneg hε0] rw [ht2_val] have hrest : ∑ b ∈ (univ.erase t1).erase t2, |(if b = z0 then 1 - ε else if b = t1 then ε else 0) - (if b = z0 then 1 - ε else if b = t2 then ε else 0)| = 0 := by refine sum_eq_zero fun b hb => ?_ have hbt2 : b ≠ t2 := ne_of_mem_erase hb have hbt1 : b ≠ t1 := ne_of_mem_erase (mem_of_mem_erase hb) by_cases hbz : b = z0 · simp [hbz] · simp [hbz, hbt1, hbt2] rw [hrest]; ring rw [hsum]; ring have hfiber_diam : ∀ a : Fin m, fiberDiam P Prod.fst a = ε := by intro a apply le_antisymm · unfold fiberDiam dsimp only split_ifs with hne · refine sup'_le hne _ fun p hp => ?_ obtain ⟨hp1, hp2⟩ := mem_product.mp hp have h1 : p.1.1 = a := (mem_filter.mp hp1).2 have h2 : p.2.1 = a := (mem_filter.mp hp2).2 have hEq : tvDist (lumpedRow P Prod.fst p.1) (lumpedRow P Prod.fst p.2) = if p.1.2 = p.2.2 then 0 else ε := by have := htv_pair a p.1.2 p.2.2 rwa [show (a, p.1.2) = p.1 from Prod.ext h1.symm rfl, show (a, p.2.2) = p.2 from Prod.ext h2.symm rfl] at this rw [hEq]; split_ifs <;> linarith · exact hε0 · let c0 : Fin (m - 1) := ⟨0, by omega⟩ let c1 : Fin (m - 1) := ⟨1, by omega⟩ have hc01 : c0 ≠ c1 := fun h => by have := congrArg Fin.val h; simp [c0, c1] at this have hle := tvDist_le_fiberDiam P Prod.fst (a := a) (i := (a, c0)) (i' := (a, c1)) rfl rfl rw [htv_pair a c0 c1, if_neg hc01] at hle exact hle have hks_diam : ksDefectDiam P Prod.fst = ε := by unfold ksDefectDiam have hne : (univ : Finset (Fin m)).Nonempty := ⟨⟨0, by omega⟩, mem_univ _⟩ rw [dif_pos hne] apply le_antisymm · exact sup'_le hne _ fun a _ => le_of_eq (hfiber_diam a) · rw [← hfiber_diam ⟨0, by omega⟩] exact le_sup' (fun a => fiberDiam P Prod.fst a) (mem_univ _) -- Compute inducedMacroKernel and DIC have hpush : ∀ a : Fin m, pushForward Prod.fst μ a = 1 / (m : ℝ) := by intro a unfold pushForward have hfilt : univ.filter (fun j : Fin m × Fin (m - 1) => j.1 = a) = Finset.image (fun r : Fin (m - 1) => (a, r)) univ := by ext ⟨b', r⟩; simp [eq_comm] rw [hfilt, sum_image (fun x _ y _ h => (Prod.mk.inj h).2)] simp only [μ, hcard_prod, sum_const, card_univ, Fintype.card_fin, nsmul_eq_mul] field_simp [ne_of_gt hm_pos, ne_of_gt hm1_pos] have hQ : ∀ (a b : Fin m), inducedMacroKernel P Prod.fst μ a b = if b = ⟨0, by omega⟩ then 1 - ε else ε / ((m - 1 : ℕ) : ℝ) := by intro a b unfold inducedMacroKernel have ha : pushForward Prod.fst μ a ≠ 0 := by rw [hpush a]; positivity rw [if_pos ha] have hfilt : univ.filter (fun j : Fin m × Fin (m - 1) => j.1 = a) = Finset.image (fun r : Fin (m - 1) => (a, r)) univ := by ext ⟨b', r⟩; simp [eq_comm] rw [hfilt, sum_image (fun x _ y _ h => (Prod.mk.inj h).2)] have hcond : ∀ r : Fin (m - 1), condFiberDist Prod.fst μ a (a, r) = 1 / ((m - 1 : ℕ) : ℝ) := by intro r unfold condFiberDist rw [if_pos ⟨rfl, ha⟩, hpush a] dsimp only [μ] rw [hcard_prod] field_simp [ne_of_gt hm_pos, ne_of_gt hm1_pos] simp_rw [hcond, hlumped] by_cases hb0 : b = ⟨0, by omega⟩ · simp only [hb0, ↓reduceIte, sum_const, card_univ, Fintype.card_fin, nsmul_eq_mul] field_simp [ne_of_gt hm1_pos] · simp only [hb0, ↓reduceIte] have hb_pos : 0 < b.val := Nat.pos_of_ne_zero fun h => hb0 (Fin.ext h) let r0 : Fin (m - 1) := ⟨b.val - 1, by omega⟩ rw [sum_eq_single r0] · have hbe : b = ⟨r0.val + 1, by omega⟩ := Fin.ext (by simp [r0]; omega) simp only [hbe, ↓reduceIte]; ring · intro r _ hrr0 have hne : b ≠ ⟨r.val + 1, by omega⟩ := fun h => hrr0 (Fin.ext (by have := congrArg Fin.val h; simp [r0] at this ⊢; omega)) simp [hne] · intro h; exact absurd (mem_univ r0) h have hkl_row : ∀ (src : Fin m × Fin (m - 1)), klDiv (lumpedRow P Prod.fst src) (inducedMacroKernel P Prod.fst μ src.1) = ε * Real.log ((m - 1 : ℕ) : ℝ) := by intro src unfold klDiv simp_rw [hlumped, hQ] let z0 : Fin m := ⟨0, by omega⟩ let t : Fin m := ⟨src.2.val + 1, by omega⟩ have htz : t ≠ z0 := fun h => by have := congrArg Fin.val h; simp [t, z0] at this rw [← add_sum_erase univ _ (mem_univ z0)] have hz0_term : (if (if z0 = z0 then 1 - ε else if z0 = t then ε else 0) = 0 then (0 : ℝ) else (if z0 = z0 then 1 - ε else if z0 = t then ε else 0) * Real.log ((if z0 = z0 then 1 - ε else if z0 = t then ε else 0) / (if z0 = z0 then 1 - ε else ε / ((m - 1 : ℕ) : ℝ)))) = 0 := by simp only [↓reduceIte] by_cases h1ε : 1 - ε = 0 · simp [h1ε] · simp [h1ε] rw [hz0_term, zero_add, sum_eq_single t] · rw [if_neg htz, if_pos rfl, if_neg htz] by_cases hεz : ε = 0 · simp [hεz] · rw [if_neg hεz] have hdiv : ε / (ε / ((m - 1 : ℕ) : ℝ)) = ((m - 1 : ℕ) : ℝ) := by field_simp [hεz, ne_of_gt hm1_pos] rw [hdiv] · intro b hb hbt have hbz : b ≠ z0 := ne_of_mem_erase hb rw [if_neg hbz, if_neg hbt, if_pos rfl] · intro ht; exact absurd (mem_erase.mpr ⟨htz, mem_univ t⟩) ht have hdic : dicDefect P Prod.fst μ = ε * Real.log ((m - 1 : ℕ) : ℝ) := by unfold dicDefect simp_rw [hkl_row, ← sum_mul, hμ_dist.2, one_mul] exact ⟨hP_stoch, hμ_dist, hks_diam, hdic⟩ /-! ## Section 4: Dobrushin Contraction Under Coarse-Graining, Horizon-Uniform Intertwining, & Macro-Memory -/ /-- **Theorem 11 (Dobrushin Contraction Monotonicity Under Coarse-Graining)**: Coarse-graining never worsens Dobrushin contraction: `τ_1(Q^(μ)) ≤ τ_1(P̄) ≤ τ_1(P) ≤ 1`. -/ theorem dobrushin_coarseGraining_monotone {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) {π : α → β} (hπ : Function.Surjective π) {μ : α → ℝ} (hμ : IsProbDist μ) : dobrushinCoeff (inducedMacroKernel P π μ) ≤ dobrushinCoeff (lumpedRow P π) ∧ dobrushinCoeff (lumpedRow P π) ≤ dobrushinCoeff P ∧ dobrushinCoeff P ≤ 1 := by have h1 : dobrushinCoeff (lumpedRow P π) ≤ dobrushinCoeff P := by apply dobrushinCoeff_le_of_forall _ (dobrushinCoeff_nonneg P) intro i j exact le_trans (tvDist_pushForward_le π (P i) (P j)) (tvDist_le_dobrushinCoeff P i j) have h2 : dobrushinCoeff (inducedMacroKernel P π μ) ≤ dobrushinCoeff (lumpedRow P π) := by apply dobrushinCoeff_le_of_forall _ (dobrushinCoeff_nonneg (lumpedRow P π)) intro a a' -- Each row Q_a is a convex combination of lumpedRow P π i on fiber a! have hrow_conv : ∀ c : β, ∃ w : α → ℝ, (∀ i ∈ (univ : Finset α), 0 ≤ w i) ∧ (∑ i : α, w i = 1) ∧ inducedMacroKernel P π μ c = fun b => ∑ i : α, w i * lumpedRow P π i b := by intro c by_cases hc : pushForward π μ c = 0 · obtain ⟨i0, hi0⟩ := hπ c set F := univ.filter (fun i : α => π i = c) have hF_pos : (0 : ℝ) < (F.card : ℝ) := Nat.cast_pos.mpr (card_pos.mpr ⟨i0, mem_filter.mpr ⟨mem_univ i0, hi0⟩⟩) let w : α → ℝ := fun i => if π i = c then 1 / (F.card : ℝ) else 0 refine ⟨w, fun i _ => by dsimp [w]; split_ifs <;> positivity, ?_, ?_⟩ · have hsub : ∑ i ∈ F, w i = ∑ i : α, w i := sum_subset (subset_univ F) fun i _ hi => by have hne : π i ≠ c := fun h => hi (mem_filter.mpr ⟨mem_univ i, h⟩) simp [w, hne] rw [← hsub] have hconst : ∑ i ∈ F, w i = ∑ _i ∈ F, (1 / (F.card : ℝ)) := sum_congr rfl fun i hi => by simp [w, (mem_filter.mp hi).2] rw [hconst, sum_const, nsmul_eq_mul] field_simp [ne_of_gt hF_pos] · ext b unfold inducedMacroKernel rw [if_neg (not_not.mpr hc)] have hsub : ∑ i ∈ F, w i * lumpedRow P π i b = ∑ i : α, w i * lumpedRow P π i b := sum_subset (subset_univ F) fun i _ hi => by have hne : π i ≠ c := fun h => hi (mem_filter.mpr ⟨mem_univ i, h⟩) simp [w, hne] rw [← hsub, mul_sum] exact sum_congr rfl fun i hi => by simp [w, (mem_filter.mp hi).2, F] · let w : α → ℝ := condFiberDist π μ c refine ⟨w, fun i _ => condFiberDist_nonneg π hμ c i, ?_, ?_⟩ · have hsub : ∑ i ∈ univ.filter (fun i => π i = c), w i = ∑ i : α, w i := sum_subset (subset_univ _) fun i _ hi => by have hne : π i ≠ c := fun h => hi (mem_filter.mpr ⟨mem_univ i, h⟩) simp [w, condFiberDist, hne] rw [← hsub] exact condFiberDist_sum π μ hc · ext b unfold inducedMacroKernel rw [if_pos hc] exact sum_subset (subset_univ _) fun i _ hi => by have hne : π i ≠ c := fun h => hi (mem_filter.mpr ⟨mem_univ i, h⟩) simp [condFiberDist, hne] obtain ⟨wa, hwa_nn, hwa_sum, hQa⟩ := hrow_conv a obtain ⟨wa', hwa'_nn, hwa'_sum, hQa'⟩ := hrow_conv a' rw [hQa] calc tvDist (fun b => ∑ i : α, wa i * lumpedRow P π i b) (inducedMacroKernel P π μ a') ≤ ∑ i : α, wa i * tvDist (lumpedRow P π i) (inducedMacroKernel P π μ a') := tvDist_convex_left univ wa hwa_nn hwa_sum (lumpedRow P π) (inducedMacroKernel P π μ a') _ ≤ ∑ i : α, wa i * dobrushinCoeff (lumpedRow P π) := by refine sum_le_sum fun i _ => mul_le_mul_of_nonneg_left ?_ (hwa_nn i (mem_univ i)) rw [tvDist_comm, hQa'] calc tvDist (fun b => ∑ j : α, wa' j * lumpedRow P π j b) (lumpedRow P π i) ≤ ∑ j : α, wa' j * tvDist (lumpedRow P π j) (lumpedRow P π i) := tvDist_convex_left univ wa' hwa'_nn hwa'_sum (lumpedRow P π) (lumpedRow P π i) _ ≤ ∑ j : α, wa' j * dobrushinCoeff (lumpedRow P π) := sum_le_sum fun j _ => mul_le_mul_of_nonneg_left (tvDist_le_dobrushinCoeff (lumpedRow P π) j i) (hwa'_nn j (mem_univ j)) _ = dobrushinCoeff (lumpedRow P π) := by rw [← sum_mul, hwa'_sum, one_mul] _ = dobrushinCoeff (lumpedRow P π) := by rw [← sum_mul, hwa_sum, one_mul] exact ⟨h2, h1, dobrushinCoeff_le_one hP⟩ /-- **Doeblin Minorization Bound**: If `P_{i, j} ≥ η · ρ_j` for all `i, j` with `0 ≤ η` and `ρ ∈ Δ(α)`, then `τ_1(P) ≤ 1 - η`. -/ theorem dobrushin_le_of_doeblin {α : Type*} [Fintype α] [DecidableEq α] {P : α → α → ℝ} (hP : IsStochastic P) {ρ : α → ℝ} (hρ : IsProbDist ρ) {η : ℝ} (hη1 : η ≤ 1) (hdoeb : ∀ i j, η * ρ j ≤ P i j) : dobrushinCoeff P ≤ 1 - η := by apply dobrushinCoeff_le_of_forall P (by linarith) intro i j rw [tvDist_eq_sum_sub_min (hP i).2 (hP j).2] have hle : ∑ k : α, (P i k - min (P i k) (P j k)) ≤ ∑ k : α, (P i k - η * ρ k) := sum_le_sum fun k _ => sub_le_sub_left (le_min (hdoeb i k) (hdoeb j k)) _ have hrhs : ∑ k : α, (P i k - η * ρ k) = 1 - η := by rw [sum_sub_distrib, (hP i).2, ← mul_sum, hρ.2, mul_one] linarith lemma tvDist_le_ksDefectKernel {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (Q : β → β → ℝ) (i : α) : tvDist (lumpedRow P π i) (Q (π i)) ≤ ksDefectKernel P π Q := by unfold ksDefectKernel have hne : (univ : Finset α).Nonempty := ⟨i, mem_univ i⟩ rw [dif_pos hne] exact le_sup' (fun j => tvDist (lumpedRow P π j) (Q (π j))) (mem_univ i) lemma ksDefectKernel_nonneg {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (Q : β → β → ℝ) : 0 ≤ ksDefectKernel P π Q := by unfold ksDefectKernel split_ifs with hne · obtain ⟨i, hi⟩ := hne exact le_trans (tvDist_nonneg _ _) (le_sup' (fun j => tvDist (lumpedRow P π j) (Q (π j))) hi) · rfl /-- One-step intertwining TV error is bounded by `ε_KS(P, π; Q)`. -/ lemma oneStep_intertwining_error_le {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (Q : β → β → ℝ) {μ : α → ℝ} (hμ : IsProbDist μ) : tvDist (pushForward π (kernelStep μ P)) (kernelStep (pushForward π μ) Q) ≤ ksDefectKernel P π Q := by rw [pushForward_kernelStep_eq_kernelStep_lumpedRow] have hQ_rew : ∀ b : β, kernelStep (pushForward π μ) Q b = ∑ i : α, μ i * Q (π i) b := by intro b unfold kernelStep pushForward rw [← sum_fiberwise_eq π (fun i => μ i * Q (π i) b)] refine sum_congr rfl fun a _ => ?_ rw [sum_mul] exact sum_congr rfl fun i hi => by rw [(mem_filter.mp hi).2] unfold tvDist calc (1 / 2 : ℝ) * ∑ b : β, |kernelStep μ (lumpedRow P π) b - kernelStep (pushForward π μ) Q b| = (1 / 2 : ℝ) * ∑ b : β, |∑ i : α, μ i * (lumpedRow P π i b - Q (π i) b)| := by congr 1; refine sum_congr rfl fun b _ => ?_ rw [hQ_rew b] unfold kernelStep rw [← sum_sub_distrib] congr 1; refine sum_congr rfl fun i _ => by ring _ ≤ (1 / 2 : ℝ) * ∑ b : β, ∑ i : α, μ i * |lumpedRow P π i b - Q (π i) b| := by refine mul_le_mul_of_nonneg_left (sum_le_sum fun b _ => ?_) (by norm_num) calc |∑ i : α, μ i * (lumpedRow P π i b - Q (π i) b)| ≤ ∑ i : α, |μ i * (lumpedRow P π i b - Q (π i) b)| := abs_sum_le_sum_abs _ _ _ = ∑ i : α, μ i * |lumpedRow P π i b - Q (π i) b| := sum_congr rfl fun i _ => by rw [abs_mul, abs_of_nonneg (hμ.1 i)] _ = ∑ i : α, μ i * tvDist (lumpedRow P π i) (Q (π i)) := by rw [sum_comm, mul_sum] refine sum_congr rfl fun i _ => ?_ unfold tvDist; rw [← mul_sum]; ring _ ≤ ∑ i : α, μ i * ksDefectKernel P π Q := sum_le_sum fun i _ => mul_le_mul_of_nonneg_left (tvDist_le_ksDefectKernel P π Q i) (hμ.1 i) _ = ksDefectKernel P π Q := by rw [← sum_mul, hμ.2, one_mul] /-- **Theorem 12 (Exact Multi-Step Intertwining Error Bound via Dobrushin Contraction)**: For any stochastic `P`, `Q`, any `μ ∈ Δ(α)`, and any horizon `k ∈ ℕ`: `d_TV(π_*(μ P^k), (π_* μ) Q^k) ≤ ε_KS(P, π; Q) · ∑_{r=0}^{k-1} τ_1(Q)^r`. -/ theorem multiStep_intertwining_error_bound {α β : Type*} [Fintype α] [Fintype β] [DecidableEq α] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) (π : α → β) {Q : β → β → ℝ} (hQ : IsStochastic Q) {μ : α → ℝ} (hμ : IsProbDist μ) : ∀ k : ℕ, tvDist (pushForward π (kernelStep μ (kernelPow P k))) (kernelStep (pushForward π μ) (kernelPow Q k)) ≤ ksDefectKernel P π Q * ∑ r ∈ range k, (dobrushinCoeff Q) ^ r | 0 => by rw [kernelStep_kernelPow_zero, kernelStep_kernelPow_zero, tvDist_self, range_zero, sum_empty, mul_zero] | k + 1 => by rw [kernelStep_kernelPow_succ, kernelStep_kernelPow_succ] set μk := kernelStep μ (kernelPow P k) set qk := kernelStep (pushForward π μ) (kernelPow Q k) have hμk : IsProbDist μk := isProbDist_kernelStep hμ (isStochastic_kernelPow hP k) have hqk : IsProbDist qk := isProbDist_kernelStep (isProbDist_pushForward π hμ) (isStochastic_kernelPow hQ k) have htri := tvDist_triangle (pushForward π (kernelStep μk P)) (kernelStep (pushForward π μk) Q) (kernelStep qk Q) have hstep1 := oneStep_intertwining_error_le P π Q hμk have hstep2 := tvDist_kernelStep_le_dobrushin (K := Q) (isProbDist_pushForward π hμk) hqk have hih := multiStep_intertwining_error_bound hP π hQ hμ k have hgeom : ksDefectKernel P π Q + dobrushinCoeff Q * (ksDefectKernel P π Q * ∑ r ∈ range k, (dobrushinCoeff Q) ^ r) = ksDefectKernel P π Q * ∑ r ∈ range (k + 1), (dobrushinCoeff Q) ^ r := by rw [sum_range_succ', pow_zero, mul_add, mul_one, add_comm] congr 1 rw [mul_sum, mul_sum, mul_sum] refine sum_congr rfl fun r _ => by rw [pow_succ']; ring have hdob_nn := dobrushinCoeff_nonneg Q calc tvDist (pushForward π (kernelStep μk P)) (kernelStep qk Q) ≤ tvDist (pushForward π (kernelStep μk P)) (kernelStep (pushForward π μk) Q) + tvDist (kernelStep (pushForward π μk) Q) (kernelStep qk Q) := htri _ ≤ ksDefectKernel P π Q + dobrushinCoeff Q * tvDist (pushForward π μk) qk := add_le_add hstep1 hstep2 _ ≤ ksDefectKernel P π Q + dobrushinCoeff Q * (ksDefectKernel P π Q * ∑ r ∈ range k, (dobrushinCoeff Q) ^ r) := add_le_add le_rfl (mul_le_mul_of_nonneg_left hih hdob_nn) _ = ksDefectKernel P π Q * ∑ r ∈ range (k + 1), (dobrushinCoeff Q) ^ r := hgeom /-- **Theorem 13 (Horizon-Uniform Intertwining & Stationary Distribution Stability)**: Whenever `τ_1(Q) < 1`: 1. For ALL horizons `k ∈ ℕ` and ALL `μ ∈ Δ(α)`, `d_TV(π_*(μ P^k), (π_* μ) Q^k) ≤ ε_KS(P, π; Q) / (1 - τ_1(Q))`. 2. For ANY stationary distributions `ν P = ν` and `q Q = q`, `d_TV(π_* ν, q) ≤ ε_KS(P, π; Q) / (1 - τ_1(Q))`. -/ theorem multiStep_intertwining_horizon_uniform {α β : Type*} [Fintype α] [Fintype β] [DecidableEq α] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) (π : α → β) {Q : β → β → ℝ} (hQ : IsStochastic Q) (hτ : dobrushinCoeff Q < 1) {μ : α → ℝ} (hμ : IsProbDist μ) (k : ℕ) : tvDist (pushForward π (kernelStep μ (kernelPow P k))) (kernelStep (pushForward π μ) (kernelPow Q k)) ≤ ksDefectKernel P π Q / (1 - dobrushinCoeff Q) := by have h1 := multiStep_intertwining_error_bound hP π hQ hμ k have hτ_nn : 0 ≤ dobrushinCoeff Q := dobrushinCoeff_nonneg Q have hden_pos : 0 < 1 - dobrushinCoeff Q := by linarith have hsum_le : ∑ r ∈ range k, (dobrushinCoeff Q) ^ r ≤ 1 / (1 - dobrushinCoeff Q) := by rw [le_div_iff₀ hden_pos] have htel : (∑ r ∈ range k, (dobrushinCoeff Q) ^ r) * (1 - dobrushinCoeff Q) = 1 - (dobrushinCoeff Q) ^ k := by have := geom_sum_mul (dobrushinCoeff Q) k linarith rw [htel] have hpow_nn : 0 ≤ (dobrushinCoeff Q) ^ k := pow_nonneg hτ_nn k linarith calc tvDist (pushForward π (kernelStep μ (kernelPow P k))) (kernelStep (pushForward π μ) (kernelPow Q k)) ≤ ksDefectKernel P π Q * ∑ r ∈ range k, (dobrushinCoeff Q) ^ r := h1 _ ≤ ksDefectKernel P π Q * (1 / (1 - dobrushinCoeff Q)) := mul_le_mul_of_nonneg_left hsum_le (ksDefectKernel_nonneg P π Q) _ = ksDefectKernel P π Q / (1 - dobrushinCoeff Q) := by ring theorem stationary_distribution_stability {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (P : α → α → ℝ) (π : α → β) {Q : β → β → ℝ} (hτ : dobrushinCoeff Q < 1) {ν : α → ℝ} (hν : IsProbDist ν) (hν_stat : kernelStep ν P = ν) {q : β → ℝ} (hq : IsProbDist q) (hq_stat : kernelStep q Q = q) : tvDist (pushForward π ν) q ≤ ksDefectKernel P π Q / (1 - dobrushinCoeff Q) := by have hden_pos : 0 < 1 - dobrushinCoeff Q := by linarith have hstep : tvDist (pushForward π ν) q ≤ ksDefectKernel P π Q + dobrushinCoeff Q * tvDist (pushForward π ν) q := by calc tvDist (pushForward π ν) q = tvDist (pushForward π (kernelStep ν P)) (kernelStep q Q) := by rw [hν_stat, hq_stat] _ ≤ tvDist (pushForward π (kernelStep ν P)) (kernelStep (pushForward π ν) Q) + tvDist (kernelStep (pushForward π ν) Q) (kernelStep q Q) := tvDist_triangle _ _ _ _ ≤ ksDefectKernel P π Q + dobrushinCoeff Q * tvDist (pushForward π ν) q := add_le_add (oneStep_intertwining_error_le P π Q hν) (tvDist_kernelStep_le_dobrushin (isProbDist_pushForward π hν) hq) rw [le_div_iff₀ hden_pos] linarith /-! ### 2-Step Observable Macro-Memory `Mem_2` & Exact Chain-Rule Decomposition -/ /-- Micro-flow from macrostate `a` into microstate `j`: `∑_{i : π(i) = a} ν_i P_{i, j}`. -/ def macroToMicroFlow {α β : Type*} [Fintype α] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (ν : α → ℝ) (a : β) (j : α) : ℝ := ∑ i ∈ univ.filter (fun i => π i = a), ν i * P i j /-- Joint 2-step macro probability `ℙ_ν(M_0 = a, M_1 = b)`. -/ def jointMacro2 {α β : Type*} [Fintype α] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (ν : α → ℝ) (a b : β) : ℝ := ∑ j ∈ univ.filter (fun j => π j = b), macroToMicroFlow P π ν a j /-- Conditional micro-distribution `ℙ_ν(X_1 = j | M_0 = a, M_1 = b)`. -/ noncomputable def condMicroGivenMacro2 {α β : Type*} [Fintype α] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (ν : α → ℝ) (a b : β) (j : α) : ℝ := if π j = b ∧ jointMacro2 P π ν a b ≠ 0 then macroToMicroFlow P π ν a j / jointMacro2 P π ν a b else 0 /-- 2-step conditional macro transition `ℙ_ν(M_2 = c | M_0 = a, M_1 = b)`. -/ noncomputable def condMacro2 {α β : Type*} [Fintype α] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (ν : α → ℝ) (a b c : β) : ℝ := ∑ j ∈ univ.filter (fun j => π j = b), condMicroGivenMacro2 P π ν a b j * lumpedRow P π j c /-- **2-Step Observable Macro-Memory** `Mem_2(P, π; ν) = I_ν(M_2; M_0 | M_1)`: vanishes iff `(M_0, M_1, M_2)` is first-order Markovian! -/ noncomputable def mem2 {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (ν : α → ℝ) : ℝ := ∑ a : β, ∑ b : β, jointMacro2 P π ν a b * klDiv (condMacro2 P π ν a b) (inducedMacroKernel P π ν b) /-- **Hidden Intra-Fiber Predictive Leakage** `I_ν(M_2; X_1 | M_1, M_0)`: predictive information about `M_2` hidden inside microstate `X_1` even after conditioning on `(M_0, M_1)`. -/ noncomputable def hiddenLeakage {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (ν : α → ℝ) : ℝ := ∑ a : β, ∑ b : β, ∑ j ∈ univ.filter (fun j => π j = b), macroToMicroFlow P π ν a j * klDiv (lumpedRow P π j) (condMacro2 P π ν a b) lemma macroToMicroFlow_nonneg {α β : Type*} [Fintype α] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) (π : α → β) {ν : α → ℝ} (hν : IsProbDist ν) (a : β) (j : α) : 0 ≤ macroToMicroFlow P π ν a j := sum_nonneg fun i _ => mul_nonneg (hν.1 i) ((hP i).1 j) lemma sum_macroToMicroFlow_eq {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (ν : α → ℝ) (j : α) : ∑ a : β, macroToMicroFlow P π ν a j = kernelStep ν P j := sum_fiberwise_eq π (fun i => ν i * P i j) lemma jointMacro2_nonneg {α β : Type*} [Fintype α] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) (π : α → β) {ν : α → ℝ} (hν : IsProbDist ν) (a b : β) : 0 ≤ jointMacro2 P π ν a b := sum_nonneg fun j _ => macroToMicroFlow_nonneg hP π hν a j lemma isProbDist_condMacro2 {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) (π : α → β) {ν : α → ℝ} (hν : IsProbDist ν) {a b : β} (hab : jointMacro2 P π ν a b ≠ 0) : IsProbDist (condMacro2 P π ν a b) := by have hcond_nn : ∀ j, 0 ≤ condMicroGivenMacro2 P π ν a b j := fun j => by unfold condMicroGivenMacro2 split_ifs · exact div_nonneg (macroToMicroFlow_nonneg hP π hν a j) (jointMacro2_nonneg hP π hν a b) · rfl refine ⟨fun c => sum_nonneg fun j _ => mul_nonneg (hcond_nn j) ((isStochastic_lumpedRow hP π j).1 c), ?_⟩ unfold condMacro2 rw [sum_comm] simp_rw [← mul_sum, (isStochastic_lumpedRow hP π _).2, mul_one] have hrew : ∑ j ∈ univ.filter (fun j => π j = b), condMicroGivenMacro2 P π ν a b j = ∑ j ∈ univ.filter (fun j => π j = b), macroToMicroFlow P π ν a j / jointMacro2 P π ν a b := sum_congr rfl fun j hj => by simp [condMicroGivenMacro2, (mem_filter.mp hj).2, hab] rw [hrew, ← sum_div] exact div_self hab lemma absCont_lumpedRow_condMacro2 {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) (π : α → β) {ν : α → ℝ} (hν : IsProbDist ν) {a b : β} {j : α} (hπj : π j = b) (hflow : 0 < macroToMicroFlow P π ν a j) : AbsCont (lumpedRow P π j) (condMacro2 P π ν a b) := by have hab_pos : 0 < jointMacro2 P π ν a b := lt_of_lt_of_le hflow (single_le_sum (fun r _ => macroToMicroFlow_nonneg hP π hν a r) (mem_filter.mpr ⟨mem_univ j, hπj⟩)) have hab : jointMacro2 P π ν a b ≠ 0 := ne_of_gt hab_pos intro c hPjc hcondc have hPjc_pos : 0 < lumpedRow P π j c := lt_of_le_of_ne ((isStochastic_lumpedRow hP π j).1 c) (Ne.symm hPjc) have hcm_pos : 0 < condMicroGivenMacro2 P π ν a b j := by simp only [condMicroGivenMacro2, hπj, hab, ne_eq, not_false_eq_true, and_self, ↓reduceIte] exact div_pos hflow hab_pos have hle : condMicroGivenMacro2 P π ν a b j * lumpedRow P π j c ≤ condMacro2 P π ν a b c := single_le_sum (fun r _ => mul_nonneg (by unfold condMicroGivenMacro2; split_ifs · exact div_nonneg (macroToMicroFlow_nonneg hP π hν a r) (jointMacro2_nonneg hP π hν a b) · rfl) ((isStochastic_lumpedRow hP π r).1 c)) (mem_filter.mpr ⟨mem_univ j, hπj⟩) linarith [mul_pos hcm_pos hPjc_pos] lemma absCont_condMacro2_inducedMacroKernel {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) (π : α → β) {ν : α → ℝ} (hν : IsProbDist ν) (hstat : kernelStep ν P = ν) {a b : β} (hab : jointMacro2 P π ν a b ≠ 0) : AbsCont (condMacro2 P π ν a b) (inducedMacroKernel P π ν b) := by intro c hcc hQc have hcc_pos : 0 < condMacro2 P π ν a b c := lt_of_le_of_ne ((isProbDist_condMacro2 hP π hν hab).1 c) (Ne.symm hcc) -- Some j in fiber b has both macroToMicroFlow > 0 and lumpedRow j c > 0 have hex : ∃ j ∈ univ.filter (fun j => π j = b), 0 < condMicroGivenMacro2 P π ν a b j * lumpedRow P π j c := by by_contra hall push Not at hall have hle : condMacro2 P π ν a b c ≤ 0 := sum_nonpos hall linarith obtain ⟨j, hj, hpos⟩ := hex have hπj : π j = b := (mem_filter.mp hj).2 have hflow_pos : 0 < macroToMicroFlow P π ν a j := by by_contra hle have h0 : macroToMicroFlow P π ν a j = 0 := le_antisymm (not_lt.mp hle) (macroToMicroFlow_nonneg hP π hν a j) simp [condMicroGivenMacro2, h0] at hpos have hPjc_ne : lumpedRow P π j c ≠ 0 := by intro h0; simp [h0] at hpos have hνj_pos : 0 < ν j := by rw [← congrFun hstat j, ← sum_macroToMicroFlow_eq P π ν j] exact lt_of_lt_of_le hflow_pos (single_le_sum (fun r _ => macroToMicroFlow_nonneg hP π hν r j) (mem_univ a)) have hac := absCont_lumpedRow_inducedMacroKernel hP π hν hνj_pos rw [hπj] at hac exact hac c hPjc_ne hQc lemma mem2_nonneg {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) {π : α → β} (hπ : Function.Surjective π) {ν : α → ℝ} (hν : IsProbDist ν) (hstat : kernelStep ν P = ν) : 0 ≤ mem2 P π ν := by unfold mem2 refine sum_nonneg fun a _ => sum_nonneg fun b _ => ?_ by_cases hab : jointMacro2 P π ν a b = 0 · simp [hab] · exact mul_nonneg (jointMacro2_nonneg hP π hν a b) (klDiv_nonneg (isProbDist_condMacro2 hP π hν hab) (isStochastic_inducedMacroKernel hP hπ hν b) (absCont_condMacro2_inducedMacroKernel hP π hν hstat hab)) lemma hiddenLeakage_nonneg {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) (π : α → β) {ν : α → ℝ} (hν : IsProbDist ν) : 0 ≤ hiddenLeakage P π ν := by unfold hiddenLeakage refine sum_nonneg fun a _ => sum_nonneg fun b _ => sum_nonneg fun j hj => ?_ by_cases hfl : macroToMicroFlow P π ν a j = 0 · simp [hfl] · have hfl_pos : 0 < macroToMicroFlow P π ν a j := lt_of_le_of_ne (macroToMicroFlow_nonneg hP π hν a j) (Ne.symm hfl) have hab : jointMacro2 P π ν a b ≠ 0 := ne_of_gt (lt_of_lt_of_le hfl_pos (single_le_sum (fun r _ => macroToMicroFlow_nonneg hP π hν a r) hj)) exact mul_nonneg (le_of_lt hfl_pos) (klDiv_nonneg (isStochastic_lumpedRow hP π j) (isProbDist_condMacro2 hP π hν hab) (absCont_lumpedRow_condMacro2 hP π hν (mem_filter.mp hj).2 hfl_pos)) /-- **Theorem 14 (Exact Memory–Leakage Chain Rule & Universal Non-Markovianity Ceiling)**: For any stationary distribution `ν` (`ν P = ν`): `DIC(P, π; ν) = Mem_2(P, π; ν) + HiddenLeakage(P, π; ν)`, and consequently `0 ≤ Mem_2(P, π; ν) ≤ DIC(P, π; ν) ≤ ε_diam(P, π) · min(H_ν(X_1 | M_1), ln |β|)`. -/ theorem dic_eq_mem2_add_hiddenLeakage {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) (π : α → β) {ν : α → ℝ} (hν : IsProbDist ν) (hstat : kernelStep ν P = ν) : dicDefect P π ν = mem2 P π ν + hiddenLeakage P π ν := by -- Expand DIC using stationarity ν_j = ∑_a macroToMicroFlow a j and fiberwise over b = π(j) have hdic_rew : dicDefect P π ν = ∑ a : β, ∑ b : β, ∑ j ∈ univ.filter (fun j => π j = b), macroToMicroFlow P π ν a j * klDiv (lumpedRow P π j) (inducedMacroKernel P π ν b) := by unfold dicDefect rw [← sum_fiberwise_eq π (fun j => ν j * klDiv (lumpedRow P π j) (inducedMacroKernel P π ν (π j)))] have hinner : ∀ b : β, ∑ j ∈ univ.filter (fun j => π j = b), ν j * klDiv (lumpedRow P π j) (inducedMacroKernel P π ν (π j)) = ∑ a : β, ∑ j ∈ univ.filter (fun j => π j = b), macroToMicroFlow P π ν a j * klDiv (lumpedRow P π j) (inducedMacroKernel P π ν b) := by intro b rw [sum_comm] refine sum_congr rfl fun j hj => ?_ rw [(mem_filter.mp hj).2, ← sum_mul, sum_macroToMicroFlow_eq, hstat] simp_rw [hinner] rw [sum_comm] rw [hdic_rew] unfold mem2 hiddenLeakage rw [← sum_add_distrib] refine sum_congr rfl fun a _ => ?_ rw [← sum_add_distrib] refine sum_congr rfl fun b _ => ?_ by_cases hab : jointMacro2 P π ν a b = 0 · have hfz : ∀ j ∈ univ.filter (fun j => π j = b), macroToMicroFlow P π ν a j = 0 := (sum_eq_zero_iff_of_nonneg (fun j _ => macroToMicroFlow_nonneg hP π hν a j)).mp hab simp only [hab, zero_mul, zero_add] rw [sum_eq_zero (fun j hj => by rw [hfz j hj, zero_mul]), sum_eq_zero (fun j hj => by rw [hfz j hj, zero_mul])] · -- Pythagorean KL split inside pair (a, b) have hsplit : ∀ j ∈ univ.filter (fun j => π j = b), macroToMicroFlow P π ν a j * klDiv (lumpedRow P π j) (inducedMacroKernel P π ν b) = macroToMicroFlow P π ν a j * klDiv (lumpedRow P π j) (condMacro2 P π ν a b) + ∑ c : β, macroToMicroFlow P π ν a j * (if lumpedRow P π j c = 0 then 0 else lumpedRow P π j c * Real.log (condMacro2 P π ν a b c / inducedMacroKernel P π ν b c)) := by intro j hj by_cases hfl : macroToMicroFlow P π ν a j = 0 · simp [hfl] · have hfl_pos : 0 < macroToMicroFlow P π ν a j := lt_of_le_of_ne (macroToMicroFlow_nonneg hP π hν a j) (Ne.symm hfl) have hac1 := absCont_lumpedRow_condMacro2 hP π hν (mem_filter.mp hj).2 hfl_pos have hac2 := absCont_condMacro2_inducedMacroKernel hP π hν hstat hab unfold klDiv rw [mul_sum, mul_sum, ← sum_add_distrib] refine sum_congr rfl fun c _ => ?_ by_cases hPjc : lumpedRow P π j c = 0 · simp [hPjc] · simp only [hPjc, ↓reduceIte] have hcc : condMacro2 P π ν a b c ≠ 0 := hac1 c hPjc have hQc : inducedMacroKernel P π ν b c ≠ 0 := hac2 c hcc have hlog : Real.log (lumpedRow P π j c / inducedMacroKernel P π ν b c) = Real.log (lumpedRow P π j c / condMacro2 P π ν a b c) + Real.log (condMacro2 P π ν a b c / inducedMacroKernel P π ν b c) := by rw [← Real.log_mul (div_ne_zero hPjc hcc) (div_ne_zero hcc hQc)] congr 1; field_simp [hcc, hQc] rw [hlog]; ring rw [sum_congr rfl hsplit, sum_add_distrib, add_comm] congr 1 rw [sum_comm] unfold klDiv rw [mul_sum] refine sum_congr rfl fun c _ => ?_ by_cases hcc : condMacro2 P π ν a b c = 0 · simp only [hcc, ↓reduceIte, mul_zero] refine sum_eq_zero fun j hj => ?_ by_cases hfl : macroToMicroFlow P π ν a j = 0 · simp [hfl] · have hfl_pos : 0 < macroToMicroFlow P π ν a j := lt_of_le_of_ne (macroToMicroFlow_nonneg hP π hν a j) (Ne.symm hfl) have hac1 := absCont_lumpedRow_condMacro2 hP π hν (mem_filter.mp hj).2 hfl_pos have hPjc : lumpedRow P π j c = 0 := by by_contra hne; exact hac1 c hne hcc simp [hPjc] · simp only [hcc, ↓reduceIte] have hterm : ∀ j ∈ univ.filter (fun j => π j = b), macroToMicroFlow P π ν a j * (if lumpedRow P π j c = 0 then 0 else lumpedRow P π j c * Real.log (condMacro2 P π ν a b c / inducedMacroKernel P π ν b c)) = (macroToMicroFlow P π ν a j * lumpedRow P π j c) * Real.log (condMacro2 P π ν a b c / inducedMacroKernel P π ν b c) := by intro j _ by_cases hPjc : lumpedRow P π j c = 0 · simp [hPjc] · simp [hPjc]; ring rw [sum_congr rfl hterm, ← sum_mul] have hsum_eq : ∑ j ∈ univ.filter (fun j => π j = b), macroToMicroFlow P π ν a j * lumpedRow P π j c = jointMacro2 P π ν a b * condMacro2 P π ν a b c := by unfold condMacro2 rw [mul_sum] refine sum_congr rfl fun j hj => ?_ simp only [condMicroGivenMacro2, (mem_filter.mp hj).2, hab, ne_eq, not_false_eq_true, and_self, ↓reduceIte] field_simp [hab] rw [hsum_eq, mul_assoc] theorem mem2_le_dicDefect {α β : Type*} [Fintype α] [Fintype β] [DecidableEq α] [DecidableEq β] [Nonempty β] {P : α → α → ℝ} (hP : IsStochastic P) {π : α → β} (hπ : Function.Surjective π) {ν : α → ℝ} (hν : IsProbDist ν) (hstat : kernelStep ν P = ν) : 0 ≤ mem2 P π ν ∧ mem2 P π ν ≤ dicDefect P π ν ∧ dicDefect P π ν ≤ ksDefectDiam P π * min (condMicroEntropy π ν) (Real.log (Fintype.card β : ℝ)) := by have hdec := dic_eq_mem2_add_hiddenLeakage hP π hν hstat have hmem_nn := mem2_nonneg hP hπ hν hstat have hhid_nn := hiddenLeakage_nonneg hP π hν have h1 := dicDefect_le_fiberDiam_mul_condEntropy hP π hν have h2 := dicDefect_le_fiberDiam_mul_log_card hP π hν have hub : dicDefect P π ν ≤ ksDefectDiam P π * min (condMicroEntropy π ν) (Real.log (Fintype.card β : ℝ)) := by rcases le_total (condMicroEntropy π ν) (Real.log (Fintype.card β : ℝ)) with hle | hle · rw [min_eq_left hle]; exact le_trans h1.1 h1.2 · rw [min_eq_right hle]; exact le_trans h2.1 h2.2 exact ⟨hmem_nn, by linarith, hub⟩ /-! ## Section 5: Weak vs. Strong Lumpability & The Weak-Lumpability Closure Paradox -/ /-- **Kemeny–Snell / Buchholz Invariant-Fiber Weak Lumpability Condition**: Starting in conditional fiber distribution `ν(· | a)` and evolving one step under `P`, conditioning on macrostate `b` reproduces `ν(· | b)` identically with weight `Q_{a, b}`. -/ def IsInvariantFiber {α β : Type*} [Fintype α] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (ν : α → ℝ) (Q : β → β → ℝ) : Prop := ∀ a b : β, ∀ j : α, π j = b → ∑ i ∈ univ.filter (fun i => π i = a), condFiberDist π ν a i * P i j = Q a b * condFiberDist π ν b j /-- Recursive micro-state probability vector `v_k(j) = ℙ_ν(M_0 = γ_0, ..., M_k = γ_k, X_k = j)`. -/ def pathMicroVec {α β : Type*} [Fintype α] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (ν : α → ℝ) : (k : ℕ) → (Fin (k + 1) → β) → (α → ℝ) | 0, γ => fun i => if π i = γ 0 then ν i else 0 | k + 1, γ => fun j => if π j = γ (Fin.last (k + 1)) then kernelStep (pathMicroVec P π ν k (Fin.init γ)) P j else 0 /-- Exact `k`-step macro-trajectory probability `ℙ_ν(M_0 = γ_0, ..., M_k = γ_k)`. -/ def macroPathProb {α β : Type*} [Fintype α] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (ν : α → ℝ) (k : ℕ) (γ : Fin (k + 1) → β) : ℝ := ∑ i : α, pathMicroVec P π ν k γ i /-- Exact `k`-step Markov chain path probability `q_{γ_0} ∏_{r=0}^{k-1} Q_{γ_r, γ_{r+1}}`. -/ def markovPathProb {β : Type*} (q : β → ℝ) (Q : β → β → ℝ) : (k : ℕ) → (Fin (k + 1) → β) → ℝ | 0, γ => q (γ 0) | k + 1, γ => markovPathProb q Q k (Fin.init γ) * Q (γ (Fin.castSucc (Fin.last k))) (γ (Fin.last (k + 1))) lemma pathMicroVec_eq_of_invariantFiber {α β : Type*} [Fintype α] [DecidableEq β] {P : α → α → ℝ} {π : α → β} {ν : α → ℝ} {Q : β → β → ℝ} (hpos : ∀ a, pushForward π ν a ≠ 0) (hinv : IsInvariantFiber P π ν Q) : ∀ (k : ℕ) (γ : Fin (k + 1) → β) (j : α), pathMicroVec P π ν k γ j = markovPathProb (pushForward π ν) Q k γ * condFiberDist π ν (γ (Fin.last k)) j | 0, γ, j => by simp only [pathMicroVec, markovPathProb, Fin.last_zero, condFiberDist] by_cases h : π j = γ 0 · rw [if_pos h, if_pos ⟨h, hpos (γ 0)⟩] field_simp [hpos (γ 0)] · rw [if_neg h, if_neg (fun hc => h hc.1), mul_zero] | k + 1, γ, j => by simp only [pathMicroVec, markovPathProb] by_cases h : π j = γ (Fin.last (k + 1)) · rw [if_pos h] unfold kernelStep have hih := pathMicroVec_eq_of_invariantFiber hpos hinv k (Fin.init γ) simp_rw [hih, mul_assoc, ← mul_sum] have hinit_last : Fin.init γ (Fin.last k) = γ (Fin.castSucc (Fin.last k)) := rfl rw [hinit_last] set a := γ (Fin.castSucc (Fin.last k)) set b := γ (Fin.last (k + 1)) have hsub : ∑ i ∈ univ.filter (fun i => π i = a), condFiberDist π ν a i * P i j = ∑ i : α, condFiberDist π ν a i * P i j := sum_subset (subset_univ _) fun i _ hi => by have hne : π i ≠ a := fun hx => hi (mem_filter.mpr ⟨mem_univ i, hx⟩) simp [condFiberDist, hne] rw [← hsub, hinv a b j h] · rw [if_neg h] have hcz : condFiberDist π ν (γ (Fin.last (k + 1))) j = 0 := by simp [condFiberDist, h] rw [hcz, mul_zero] /-- **Theorem 15 (Kemeny–Snell / Buchholz Exact Weak Lumpability Theorem)**: Under the invariant-fiber condition `IsInvariantFiber P π ν Q` (with active macrostates), the macro-process `(M_0, ..., M_k)` has the **EXACT** Markov chain path law `(π_* ν, Q)` for EVERY horizon `k ∈ ℕ` and EVERY trajectory `γ : Fin (k + 1) → β`, and `Mem_2(P, π; ν) = 0`. -/ theorem invariantFiber_exact_weakLumpability {α β : Type*} [Fintype α] [DecidableEq β] {P : α → α → ℝ} {π : α → β} {ν : α → ℝ} {Q : β → β → ℝ} (hpos : ∀ a, pushForward π ν a ≠ 0) (hinv : IsInvariantFiber P π ν Q) (k : ℕ) (γ : Fin (k + 1) → β) : macroPathProb P π ν k γ = markovPathProb (pushForward π ν) Q k γ := by unfold macroPathProb simp_rw [pathMicroVec_eq_of_invariantFiber hpos hinv k γ, ← mul_sum] have hsub : ∑ j ∈ univ.filter (fun j => π j = γ (Fin.last k)), condFiberDist π ν (γ (Fin.last k)) j = ∑ j : α, condFiberDist π ν (γ (Fin.last k)) j := sum_subset (subset_univ _) fun j _ hj => by have hne : π j ≠ γ (Fin.last k) := fun hx => hj (mem_filter.mpr ⟨mem_univ j, hx⟩) simp [condFiberDist, hne] rw [← hsub, condFiberDist_sum π ν (hpos (γ (Fin.last k))), mul_one] /-- Direct identity `D_KL(p ‖ p) = 0` for any `p : β → ℝ`. -/ lemma klDiv_self {β : Type*} [Fintype β] (p : β → ℝ) : klDiv p p = 0 := by unfold klDiv exact sum_eq_zero fun b _ => by by_cases h : p b = 0 <;> simp [h] theorem invariantFiber_mem2_eq_zero {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {P : α → α → ℝ} (_hP : IsStochastic P) {π : α → β} {ν : α → ℝ} {Q : β → β → ℝ} (hpos : ∀ a, pushForward π ν a ≠ 0) (hinv : IsInvariantFiber P π ν Q) : inducedMacroKernel P π ν = Q ∧ mem2 P π ν = 0 := by have hQ_eq : inducedMacroKernel P π ν = Q := by ext a b unfold inducedMacroKernel rw [if_pos (hpos a)] unfold lumpedRow pushForward simp_rw [mul_sum] rw [sum_comm] rw [sum_congr rfl fun j hj => hinv a b j (mem_filter.mp hj).2] rw [← mul_sum, condFiberDist_sum π ν (hpos b), mul_one] refine ⟨hQ_eq, ?_⟩ unfold mem2 refine sum_eq_zero fun a _ => sum_eq_zero fun b _ => ?_ by_cases hab : jointMacro2 P π ν a b = 0 · simp [hab] · -- Show condMacro2 P π ν a b = Q b = inducedMacroKernel P π ν b! have hflow_eq : ∀ j ∈ univ.filter (fun j => π j = b), macroToMicroFlow P π ν a j = pushForward π ν a * Q a b * condFiberDist π ν b j := by intro j hj unfold macroToMicroFlow have hrew : ∀ i ∈ univ.filter (fun i => π i = a), ν i * P i j = pushForward π ν a * (condFiberDist π ν a i * P i j) := by intro i hi simp only [condFiberDist, (mem_filter.mp hi).2, hpos a, ne_eq, not_false_eq_true, and_self, ↓reduceIte] field_simp [hpos a] rw [sum_congr rfl hrew, ← mul_sum, hinv a b j (mem_filter.mp hj).2] ring have hjoint_eq : jointMacro2 P π ν a b = pushForward π ν a * Q a b := by unfold jointMacro2 rw [sum_congr rfl hflow_eq, ← mul_sum, condFiberDist_sum π ν (hpos b), mul_one] have hcond_eq : condMacro2 P π ν a b = inducedMacroKernel P π ν b := by ext c unfold condMacro2 inducedMacroKernel rw [if_pos (hpos b)] refine sum_congr rfl fun j hj => ?_ unfold condMicroGivenMacro2 rw [if_pos ⟨(mem_filter.mp hj).2, hab⟩, hflow_eq j hj, hjoint_eq] have hne : pushForward π ν a * Q a b ≠ 0 := by rwa [← hjoint_eq] field_simp [left_ne_zero_of_mul hne, right_ne_zero_of_mul hne] rw [hcond_eq, klDiv_self, mul_zero] /-! ### The Universal Pre-Sampled Shift Lift `P^shift(Q)` & The Weak-Lumpability Closure Paradox -/ /-- **Pre-Sampled Shift Lift** `P^shift(Q)` on `β × β` with coarse-graining `π = Prod.fst`: microstate `(a, c)` deterministically transitions to macrostate `c` and samples the next hidden target `d` from `Q_{c, d}`. -/ def shiftLift {β : Type*} [DecidableEq β] (Q : β → β → ℝ) : (β × β) → (β × β) → ℝ := fun p r => if r.1 = p.2 then Q r.1 r.2 else 0 /-- Stationary edge distribution `ν(a, c) = q_a Q_{a, c}` of `P^shift(Q)`. -/ def shiftLiftDist {β : Type*} (q : β → ℝ) (Q : β → β → ℝ) : (β × β) → ℝ := fun p => q p.1 * Q p.1 p.2 /-- Entropy rate `h_rate(q, Q) = ∑_a q_a H(Q_a)` of a Markov chain `(q, Q)`. -/ noncomputable def entropyRate {β : Type*} [Fintype β] (q : β → ℝ) (Q : β → β → ℝ) : ℝ := ∑ a : β, q a * shannonEntropy (Q a) /-- **Theorem 16 (Universal Pre-Sampled Shift Lift Theorem)**: For EVERY stochastic macro-kernel `Q` on `β` with strictly positive stationary distribution `q`: 1. `P^shift(Q)` is row-stochastic and `ν(a, c) = q_a Q_{a, c}` is stationary. 2. `(P^shift(Q), Prod.fst, ν, Q)` satisfies `IsInvariantFiber`, hence has the **EXACT** Markov chain path law `(q, Q)` at EVERY horizon `k ∈ ℕ` and `Mem_2 = 0`. 3. `DIC(P^shift(Q), Prod.fst; ν) = h_rate(q, Q)`, `I_ν(M_{t+1}; M_t) = H(q) - h_rate(q, Q)`, and `NTIC(P^shift(Q), Prod.fst; ν) = H(q) - 2 h_rate(q, Q)`. -/ theorem shiftLift_exact_weakLumpability_and_dic {β : Type*} [Fintype β] [DecidableEq β] {Q : β → β → ℝ} (hQ : IsStochastic Q) {q : β → ℝ} (hq : IsProbDist q) (hq_pos : ∀ a, 0 < q a) (hq_stat : kernelStep q Q = q) : let P := shiftLift Q let ν := shiftLiftDist q Q IsStochastic P ∧ IsProbDist ν ∧ kernelStep ν P = ν ∧ pushForward Prod.fst ν = q ∧ IsInvariantFiber P Prod.fst ν Q ∧ (∀ k γ, macroPathProb P Prod.fst ν k γ = markovPathProb q Q k γ) ∧ mem2 P Prod.fst ν = 0 ∧ dicDefect P Prod.fst ν = entropyRate q Q ∧ macroMutualInfo P Prod.fst ν = shannonEntropy q - entropyRate q Q ∧ ntic P Prod.fst ν = shannonEntropy q - 2 * entropyRate q Q := by intro P ν have hP_stoch : IsStochastic P := by intro ⟨a, c⟩ refine ⟨fun ⟨b, d⟩ => by dsimp [P, shiftLift]; split_ifs; exact (hQ b).1 d; rfl, ?_⟩ rw [Fintype.sum_prod_type] have h1 : ∀ b : β, ∑ d : β, P (a, c) (b, d) = if b = c then 1 else 0 := fun b => by dsimp only [P, shiftLift] split_ifs with hbc · exact (hQ b).2 · exact sum_const_zero simp_rw [h1] simp have hpush : pushForward Prod.fst ν = q := by ext a unfold pushForward have hfilt : univ.filter (fun p : β × β => p.1 = a) = Finset.image (fun c : β => (a, c)) univ := by ext ⟨a', c⟩; simp [eq_comm] rw [hfilt, sum_image (fun x _ y _ h => (Prod.mk.inj h).2)] dsimp only [ν, shiftLiftDist] rw [← mul_sum, (hQ a).2, mul_one] have hν_dist : IsProbDist ν := by refine ⟨fun ⟨a, c⟩ => mul_nonneg (hq.1 a) ((hQ a).1 c), ?_⟩ rw [← sum_fiberwise_eq Prod.fst ν] change ∑ a : β, pushForward Prod.fst ν a = 1 rw [hpush]; exact hq.2 have hν_stat : kernelStep ν P = ν := by ext ⟨b, d⟩ unfold kernelStep rw [Fintype.sum_prod_type] dsimp only [ν, shiftLiftDist, P, shiftLift] have hinner : ∀ a : β, ∑ c : β, q a * Q a c * (if b = c then Q b d else 0) = q a * Q a b * Q b d := fun a => by rw [sum_eq_single b] · simp · intro c _ hcb; simp [Ne.symm hcb] · intro h; exact absurd (mem_univ b) h simp_rw [hinner, ← sum_mul] have hq_b : ∑ a : β, q a * Q a b = q b := congrFun hq_stat b rw [hq_b] have hpos_push : ∀ a, pushForward Prod.fst ν a ≠ 0 := fun a => by rw [hpush]; exact ne_of_gt (hq_pos a) have hcond_eq : ∀ a c : β, condFiberDist Prod.fst ν a (a, c) = Q a c := by intro a c unfold condFiberDist rw [if_pos ⟨rfl, hpos_push a⟩, hpush] dsimp only [ν, shiftLiftDist] field_simp [ne_of_gt (hq_pos a)] have hinv : IsInvariantFiber P Prod.fst ν Q := by intro a b ⟨b', d⟩ hπ dsimp only at hπ; subst hπ have hfilt : univ.filter (fun p : β × β => p.1 = a) = Finset.image (fun c : β => (a, c)) univ := by ext ⟨a', c⟩; simp [eq_comm] rw [hfilt, sum_image (fun x _ y _ h => (Prod.mk.inj h).2)] simp_rw [hcond_eq a, hcond_eq b'] dsimp only [P, shiftLift] rw [sum_eq_single b'] · simp · intro c _ hcb; simp [Ne.symm hcb] · intro h; exact absurd (mem_univ b') h have hpath : ∀ k γ, macroPathProb P Prod.fst ν k γ = markovPathProb q Q k γ := fun k γ => by rw [← hpush] exact invariantFiber_exact_weakLumpability hpos_push hinv k γ have hmem := invariantFiber_mem2_eq_zero hP_stoch hpos_push hinv have hlumped : ∀ a c b : β, lumpedRow P Prod.fst (a, c) b = if b = c then 1 else 0 := by intro a c b unfold lumpedRow pushForward have hfilt : univ.filter (fun p : β × β => p.1 = b) = Finset.image (fun d : β => (b, d)) univ := by ext ⟨b', d⟩; simp [eq_comm] rw [hfilt, sum_image (fun x _ y _ h => (Prod.mk.inj h).2)] dsimp only [P, shiftLift] split_ifs with hbc · exact (hQ b).2 · exact sum_const_zero have hdic : dicDefect P Prod.fst ν = entropyRate q Q := by unfold dicDefect entropyRate shannonEntropy negMulLog rw [Fintype.sum_prod_type] refine sum_congr rfl fun a _ => ?_ rw [mul_sum] refine sum_congr rfl fun c _ => ?_ rw [hmem.1] dsimp only [ν, shiftLiftDist] have hkl : klDiv (lumpedRow P Prod.fst (a, c)) (Q a) = if Q a c = 0 then 0 else -Real.log (Q a c) := by unfold klDiv simp_rw [hlumped] rw [sum_eq_single c] · simp only [↓reduceIte, one_ne_zero, one_mul] by_cases hQac : Q a c = 0 · simp [hQac] · rw [if_neg hQac, Real.log_div one_ne_zero hQac, Real.log_one]; ring · intro b _ hbc; simp [hbc] · intro h; exact absurd (mem_univ c) h rw [hkl] by_cases hQac : Q a c = 0 · simp [hQac] · simp only [hQac, ↓reduceIte]; ring have hmacro_mi : macroMutualInfo P Prod.fst ν = shannonEntropy q - entropyRate q Q := by unfold macroMutualInfo mutualInfo entropyRate rw [hpush, hmem.1, hq_stat] have hntic : ntic P Prod.fst ν = shannonEntropy q - 2 * entropyRate q Q := by unfold ntic; rw [hmacro_mi, hdic]; ring exact ⟨hP_stoch, hν_dist, hν_stat, hpush, hinv, hpath, hmem.2, hdic, hmacro_mi, hntic⟩ /-- **Theorem 17 (The Weak-Lumpability Closure Paradox)**: For every `m ≥ 2`, the uniform Pre-Sampled Shift Lift `P^shift(U_m)` on `Fin m × Fin m` is: - **100% exactly weakly lumpable** (exact Markov chain path law at ALL horizons `k ∈ ℕ`, `Mem_2 = 0`), - **Maximally non-strongly-lumpable** (`ε_diam = 1`), - **Maximally informationally open** (`DIC = ln m`, attaining the absolute ceiling!), - **Minimally negative in NTIC** (`NTIC = -ln m`, attaining the absolute floor!). -/ theorem weakLumpability_closure_paradox (m : ℕ) (hm : 2 ≤ m) : let U : Fin m → Fin m → ℝ := fun _ _ => 1 / (m : ℝ) let u : Fin m → ℝ := fun _ => 1 / (m : ℝ) let P := shiftLift U let ν := shiftLiftDist u U IsStochastic P ∧ IsProbDist ν ∧ kernelStep ν P = ν ∧ (∀ k γ, macroPathProb P Prod.fst ν k γ = markovPathProb u U k γ) ∧ mem2 P Prod.fst ν = 0 ∧ ksDefectDiam P Prod.fst = 1 ∧ dicDefect P Prod.fst ν = Real.log (m : ℝ) ∧ ntic P Prod.fst ν = -Real.log (m : ℝ) := by intro U u P ν have hm_pos : (0 : ℝ) < (m : ℝ) := Nat.cast_pos.mpr (by omega) have hu_dist : IsProbDist u := by refine ⟨fun _ => by positivity, ?_⟩ simp [u, ne_of_gt hm_pos] have hU_stoch : IsStochastic U := fun _ => hu_dist have hu_pos : ∀ a : Fin m, 0 < u a := fun _ => by dsimp [u]; positivity have hu_stat : kernelStep u U = u := by ext b; unfold kernelStep; simp only [u, U, sum_const, card_univ, Fintype.card_fin, nsmul_eq_mul] field_simp [ne_of_gt hm_pos] have hmain := shiftLift_exact_weakLumpability_and_dic hU_stoch hu_dist hu_pos hu_stat have hH_u : shannonEntropy u = Real.log (m : ℝ) := by unfold shannonEntropy negMulLog simp only [u, sum_const, card_univ, Fintype.card_fin, nsmul_eq_mul] rw [Real.log_div one_ne_zero (ne_of_gt hm_pos), Real.log_one] field_simp [ne_of_gt hm_pos]; ring have hrate : entropyRate u U = Real.log (m : ℝ) := by unfold entropyRate simp_rw [show ∀ a : Fin m, shannonEntropy (U a) = Real.log (m : ℝ) from fun _ => hH_u] rw [← sum_mul, hu_dist.2, one_mul] -- Compute ksDefectDiam = 1 have hlumped : ∀ a c b : Fin m, lumpedRow P Prod.fst (a, c) b = if b = c then 1 else 0 := by intro a c b unfold lumpedRow pushForward have hfilt : univ.filter (fun p : Fin m × Fin m => p.1 = b) = Finset.image (fun d : Fin m => (b, d)) univ := by ext ⟨b', d⟩; simp [eq_comm] rw [hfilt, sum_image (fun x _ y _ h => (Prod.mk.inj h).2)] dsimp only [P, shiftLift] split_ifs with hbc · exact (hU_stoch b).2 · exact sum_const_zero have hdiam_eq : ksDefectDiam P Prod.fst = 1 := by apply le_antisymm · unfold ksDefectDiam have hne : (univ : Finset (Fin m)).Nonempty := ⟨⟨0, by omega⟩, mem_univ _⟩ rw [dif_pos hne] refine sup'_le hne _ fun a _ => ?_ unfold fiberDiam; dsimp only split_ifs with hF · exact sup'_le hF _ fun p _ => tvDist_le_one (isStochastic_lumpedRow hmain.1 Prod.fst p.1) (isStochastic_lumpedRow hmain.1 Prod.fst p.2) · norm_num · let z0 : Fin m := ⟨0, by omega⟩ let z1 : Fin m := ⟨1, by omega⟩ have hz01 : z0 ≠ z1 := fun h => by have := congrArg Fin.val h; simp [z0, z1] at this have htv1 : tvDist (lumpedRow P Prod.fst (z0, z0)) (lumpedRow P Prod.fst (z0, z1)) = 1 := by unfold tvDist simp_rw [hlumped] rw [← add_sum_erase univ _ (mem_univ z0), ← add_sum_erase (univ.erase z0) _ (mem_erase.mpr ⟨hz01.symm, mem_univ z1⟩)] have hrest : ∑ b ∈ (univ.erase z0).erase z1, |(if b = z0 then (1 : ℝ) else 0) - (if b = z1 then 1 else 0)| = 0 := sum_eq_zero fun b hb => by simp [ne_of_mem_erase hb, ne_of_mem_erase (mem_of_mem_erase hb)] rw [hrest]; simp [hz01, hz01.symm]; norm_num calc (1 : ℝ) = tvDist (lumpedRow P Prod.fst (z0, z0)) (lumpedRow P Prod.fst (z0, z1)) := htv1.symm _ ≤ fiberDiam P Prod.fst z0 := tvDist_le_fiberDiam P Prod.fst rfl rfl _ ≤ ksDefectDiam P Prod.fst := fiberDiam_le_ksDefectDiam P Prod.fst z0 refine ⟨hmain.1, hmain.2.1, hmain.2.2.1, hmain.2.2.2.2.2.1, hmain.2.2.2.2.2.2.1, hdiam_eq, ?_, ?_⟩ · rw [hmain.2.2.2.2.2.2.2.1, hrate] · rw [hmain.2.2.2.2.2.2.2.2.2, hH_u, hrate]; ring /-! ## Section 6: Three Sharp Noise-Induced Phase Transitions & Strongly Lumpable Predictive Synergy -/ /-! ### Part 6A: Thermal Phase Transition in Weakly Lumpable `P^shift(Q_{m, η})` & Exact Asymptotic Law -/ /-- Symmetric `m`-state noisy macro-kernel `Q_{m, η}`: stays with probability `1 - η`, jumps uniformly to the other `m - 1` states with probability `η / (m - 1)`. -/ noncomputable def symNoisyKernel (m : ℕ) (η : ℝ) (a b : Fin m) : ℝ := if a = b then 1 - η else η / ((m - 1 : ℕ) : ℝ) /-- Closed-form entropy rate `h(η) + η ln(m - 1)` of `Q_{m, η}`. -/ noncomputable def symEntropyRateFn (m : ℕ) (η : ℝ) : ℝ := binEntropy η + η * Real.log ((m - 1 : ℕ) : ℝ) /-- Closed-form NTIC `ln m - 2(h(η) + η ln(m - 1))` of `P^shift(Q_{m, η})`. -/ noncomputable def symShiftNticFn (m : ℕ) (η : ℝ) : ℝ := Real.log (m : ℝ) - 2 * symEntropyRateFn m η /-- **Theorem 18a (Exact NTIC Formula for Weakly Lumpable Symmetric Family `P^shift(Q_{m, η})`)**: For every `m ≥ 2` and `η ∈ [0, 1]`, `P^shift(Q_{m, η})` is 100% weakly lumpable at all horizons with `Mem_2 = 0`, `DIC = h(η) + η ln(m - 1)`, and `NTIC = ln m - 2(h(η) + η ln(m - 1))`. -/ theorem symShiftLift_ntic_exact (m : ℕ) (hm : 2 ≤ m) {η : ℝ} (hη0 : 0 ≤ η) (hη1 : η ≤ 1) : let Q := symNoisyKernel m η let u : Fin m → ℝ := fun _ => 1 / (m : ℝ) let P := shiftLift Q let ν := shiftLiftDist u Q IsStochastic P ∧ IsProbDist ν ∧ kernelStep ν P = ν ∧ (∀ k γ, macroPathProb P Prod.fst ν k γ = markovPathProb u Q k γ) ∧ mem2 P Prod.fst ν = 0 ∧ dicDefect P Prod.fst ν = symEntropyRateFn m η ∧ ntic P Prod.fst ν = symShiftNticFn m η := by intro Q u P ν have hm_pos : (0 : ℝ) < (m : ℝ) := Nat.cast_pos.mpr (by omega) have hm1_pos : (0 : ℝ) < ((m - 1 : ℕ) : ℝ) := Nat.cast_pos.mpr (by omega) have hu_dist : IsProbDist u := ⟨fun _ => by dsimp [u]; positivity, by simp [u, ne_of_gt hm_pos]⟩ have hu_pos : ∀ a : Fin m, 0 < u a := fun _ => by dsimp [u]; positivity have hQ_stoch : IsStochastic Q := by intro a refine ⟨fun b => by dsimp [Q, symNoisyKernel]; split_ifs <;> positivity [sub_nonneg.mpr hη1], ?_⟩ dsimp only [Q, symNoisyKernel] rw [← add_sum_erase univ _ (mem_univ a), if_pos rfl] have hrest : ∑ b ∈ univ.erase a, (if a = b then 1 - η else η / ((m - 1 : ℕ) : ℝ)) = η := by rw [sum_congr rfl fun b hb => by rw [if_neg (ne_of_mem_erase hb).symm]] rw [sum_const, card_erase_of_mem (mem_univ a), card_univ, Fintype.card_fin, nsmul_eq_mul] field_simp [ne_of_gt hm1_pos] rw [hrest]; ring have hu_stat : kernelStep u Q = u := by ext b unfold kernelStep simp only [u, Q, symNoisyKernel] rw [← add_sum_erase univ _ (mem_univ b), if_pos rfl] have hrest : ∑ a ∈ univ.erase b, 1 / (m : ℝ) * (if a = b then 1 - η else η / ((m - 1 : ℕ) : ℝ)) = (1 / (m : ℝ)) * η := by rw [sum_congr rfl fun a ha => by rw [if_neg (ne_of_mem_erase ha)]] rw [sum_const, card_erase_of_mem (mem_univ b), card_univ, Fintype.card_fin, nsmul_eq_mul] field_simp [ne_of_gt hm_pos, ne_of_gt hm1_pos] rw [hrest]; ring have hmain := shiftLift_exact_weakLumpability_and_dic hQ_stoch hu_dist hu_pos hu_stat have hH_u : shannonEntropy u = Real.log (m : ℝ) := by unfold shannonEntropy negMulLog simp only [u, sum_const, card_univ, Fintype.card_fin, nsmul_eq_mul] rw [Real.log_div one_ne_zero (ne_of_gt hm_pos), Real.log_one] field_simp [ne_of_gt hm_pos]; ring have hH_row : ∀ a : Fin m, shannonEntropy (Q a) = symEntropyRateFn m η := by intro a unfold shannonEntropy symEntropyRateFn binEntropy negMulLog dsimp only [Q, symNoisyKernel] rw [← add_sum_erase univ _ (mem_univ a), if_pos rfl] have hrest : ∑ b ∈ univ.erase a, -(if a = b then 1 - η else η / ((m - 1 : ℕ) : ℝ)) * Real.log (if a = b then 1 - η else η / ((m - 1 : ℕ) : ℝ)) = -η * Real.log η + η * Real.log ((m - 1 : ℕ) : ℝ) := by rw [sum_congr rfl fun b hb => by rw [if_neg (ne_of_mem_erase hb).symm]] rw [sum_const, card_erase_of_mem (mem_univ a), card_univ, Fintype.card_fin, nsmul_eq_mul] by_cases hηz : η = 0 · simp [hηz] · rw [Real.log_div hηz (ne_of_gt hm1_pos)] field_simp [ne_of_gt hm1_pos]; ring rw [hrest]; ring have hrate : entropyRate u Q = symEntropyRateFn m η := by unfold entropyRate simp_rw [hH_row, ← sum_mul, hu_dist.2, one_mul] refine ⟨hmain.1, hmain.2.1, hmain.2.2.1, hmain.2.2.2.2.2.1, hmain.2.2.2.2.2.2.1, ?_, ?_⟩ · rw [hmain.2.2.2.2.2.2.2.1, hrate] · unfold symShiftNticFn rw [hmain.2.2.2.2.2.2.2.2.2, hH_u, hrate] lemma continuous_negMulLog : Continuous negMulLog := by unfold negMulLog have h : (fun x : ℝ => -x * Real.log x) = fun x => Real.negMulLog x := by ext x; unfold Real.negMulLog; ring rw [h] exact Real.continuous_negMulLog lemma continuous_binEntropy : Continuous binEntropy := continuous_negMulLog.add (continuous_negMulLog.comp (continuous_const.sub continuous_id)) lemma continuous_symEntropyRateFn (m : ℕ) : Continuous (symEntropyRateFn m) := continuous_binEntropy.add (continuous_id.mul continuous_const) lemma symEntropyRateFn_strictMonoOn (m : ℕ) (hm : 2 ≤ m) : StrictMonoOn (symEntropyRateFn m) (Set.Icc 0 (1 - 1 / (m : ℝ))) := by have hm_pos : (0 : ℝ) < (m : ℝ) := Nat.cast_pos.mpr (by omega) have hm1_pos : (0 : ℝ) < ((m - 1 : ℕ) : ℝ) := Nat.cast_pos.mpr (by omega) have hm1_cast : ((m - 1 : ℕ) : ℝ) = (m : ℝ) - 1 := by rw [Nat.cast_sub (by omega : 1 ≤ m), Nat.cast_one] apply strictMonoOn_of_deriv_pos (convex_Icc _ _) · exact (continuous_symEntropyRateFn m).continuousOn · intro x hx rw [interior_Icc] at hx have hx0 : 0 < x := hx.1 have hx1 : x < 1 := by have : 0 < 1 / (m : ℝ) := by positivity linarith [hx.2] have h1x : 0 < 1 - x := by linarith have hd1 : HasDerivAt negMulLog (-Real.log x - 1) x := by unfold negMulLog have h := (hasDerivAt_id x).neg.mul (Real.hasDerivAt_log (ne_of_gt hx0)) refine h.congr_deriv ?_ simp only [Pi.neg_apply, id_eq] field_simp [ne_of_gt hx0]; ring have hd2 : HasDerivAt (fun t => negMulLog (1 - t)) (Real.log (1 - x) + 1) x := by unfold negMulLog have hsub : HasDerivAt (fun t : ℝ => 1 - t) (-1) x := ((hasDerivAt_const x (1 : ℝ)).sub (hasDerivAt_id x)).congr_deriv (by ring) have hlog : HasDerivAt (fun t => Real.log (1 - t)) ((-1) / (1 - x)) x := by simpa using hsub.log (ne_of_gt h1x) have h := hsub.neg.mul hlog refine h.congr_deriv ?_ simp only [Pi.neg_apply] field_simp [ne_of_gt h1x] have hd3 : HasDerivAt (fun t => t * Real.log ((m - 1 : ℕ) : ℝ)) (Real.log ((m - 1 : ℕ) : ℝ)) x := by simpa using (hasDerivAt_id x).mul_const (Real.log ((m - 1 : ℕ) : ℝ)) have hderiv : HasDerivAt (symEntropyRateFn m) (Real.log (((1 - x) * ((m - 1 : ℕ) : ℝ)) / x)) x := by unfold symEntropyRateFn binEntropy refine ((hd1.add hd2).add hd3).congr_deriv ?_ rw [Real.log_div (ne_of_gt (mul_pos h1x hm1_pos)) (ne_of_gt hx0), Real.log_mul (ne_of_gt h1x) (ne_of_gt hm1_pos)] ring rw [hderiv.deriv] apply Real.log_pos rw [one_lt_div hx0, hm1_cast] have hmul : x * (m : ℝ) < (m : ℝ) - 1 := by have h2 := hx.2 have := mul_lt_mul_of_pos_right h2 hm_pos have hsimp : (1 - 1 / (m : ℝ)) * (m : ℝ) = (m : ℝ) - 1 := by field_simp [ne_of_gt hm_pos] linarith linarith lemma symEntropyRateFn_zero (m : ℕ) : symEntropyRateFn m 0 = 0 := by simp [symEntropyRateFn, binEntropy_zero] lemma symEntropyRateFn_max (m : ℕ) (hm : 2 ≤ m) : symEntropyRateFn m (1 - 1 / (m : ℝ)) = Real.log (m : ℝ) := by have hm_pos : (0 : ℝ) < (m : ℝ) := Nat.cast_pos.mpr (by omega) have hm1_pos : (0 : ℝ) < ((m - 1 : ℕ) : ℝ) := Nat.cast_pos.mpr (by omega) have hm1_cast : ((m - 1 : ℕ) : ℝ) = (m : ℝ) - 1 := by rw [Nat.cast_sub (by omega : 1 ≤ m), Nat.cast_one] unfold symEntropyRateFn binEntropy negMulLog have h1 : 1 - (1 - 1 / (m : ℝ)) = 1 / (m : ℝ) := by ring have h2 : 1 - 1 / (m : ℝ) = ((m - 1 : ℕ) : ℝ) / (m : ℝ) := by rw [hm1_cast]; field_simp [ne_of_gt hm_pos] rw [h1, h2, Real.log_div (ne_of_gt hm1_pos) (ne_of_gt hm_pos), Real.log_div one_ne_zero (ne_of_gt hm_pos), Real.log_one] rw [hm1_cast]; field_simp [ne_of_gt hm_pos]; ring /-- **Theorem 18b (Unique Critical Thermal Noise Threshold `η_c(m)` in Weakly Lumpable `P^shift(Q_{m, η})`)**: For every `m ≥ 2`, there exists a UNIQUE critical noise threshold `η_c ∈ (0, 1 - 1/m)` separating positive NTIC (`η < η_c`) from negative NTIC (`η > η_c`), with `η_c < 1/2`. -/ theorem symShiftLift_unique_critical_noise (m : ℕ) (hm : 2 ≤ m) : ∃! ηc : ℝ, ηc ∈ Set.Ioo (0 : ℝ) (1 - 1 / (m : ℝ)) ∧ symShiftNticFn m ηc = 0 ∧ ηc < 1 / 2 ∧ (∀ η ∈ Set.Icc (0 : ℝ) (1 - 1 / (m : ℝ)), η < ηc → 0 < symShiftNticFn m η) ∧ (∀ η ∈ Set.Icc (0 : ℝ) (1 - 1 / (m : ℝ)), ηc < η → symShiftNticFn m η < 0) := by have hm_pos : (0 : ℝ) < (m : ℝ) := Nat.cast_pos.mpr (by omega) have hm_gt1 : (1 : ℝ) < (m : ℝ) := Nat.one_lt_cast.mpr (by omega) have hlogm_pos : 0 < Real.log (m : ℝ) := Real.log_pos hm_gt1 have h0_le : (0 : ℝ) ≤ 1 - 1 / (m : ℝ) := by have : 1 / (m : ℝ) ≤ 1 := (div_le_one hm_pos).mpr (le_of_lt hm_gt1) linarith have hmono := symEntropyRateFn_strictMonoOn m hm have hcont : ContinuousOn (symEntropyRateFn m) (Set.Icc 0 (1 - 1 / (m : ℝ))) := (continuous_symEntropyRateFn m).continuousOn have hivt := intermediate_value_Icc h0_le hcont have hmem : Real.log (m : ℝ) / 2 ∈ Set.Icc (symEntropyRateFn m 0) (symEntropyRateFn m (1 - 1 / (m : ℝ))) := by rw [symEntropyRateFn_zero, symEntropyRateFn_max m hm] exact ⟨by linarith, by linarith⟩ obtain ⟨ηc, hηc_mem, hηc_eq⟩ := hivt hmem have hntic_zero : symShiftNticFn m ηc = 0 := by unfold symShiftNticFn; linarith have hηc_pos : 0 < ηc := by rcases eq_or_lt_of_le hηc_mem.1 with rfl | hpos · rw [symEntropyRateFn_zero] at hηc_eq; linarith · exact hpos have hηc_lt_max : ηc < 1 - 1 / (m : ℝ) := by rcases eq_or_lt_of_le hηc_mem.2 with heq | hlt · rw [heq, symEntropyRateFn_max m hm] at hηc_eq; linarith · exact hlt -- Prove ηc < 1/2 by evaluating symEntropyRateFn at 1/2! have hhalf_mem : (1 / 2 : ℝ) ∈ Set.Icc (0 : ℝ) (1 - 1 / (m : ℝ)) := by refine ⟨by norm_num, ?_⟩ have hm2 : (2 : ℝ) ≤ (m : ℝ) := Nat.ofNat_le_cast.mpr hm have : 1 / (m : ℝ) ≤ 1 / 2 := one_div_le_one_div_of_le (by norm_num) hm2 linarith have hhalf_gt : Real.log (m : ℝ) / 2 < symEntropyRateFn m (1 / 2) := by unfold symEntropyRateFn rw [binEntropy_half] have hm1_pos : (0 : ℝ) < ((m - 1 : ℕ) : ℝ) := Nat.cast_pos.mpr (by omega) have h4 : (m : ℝ) < 4 * ((m - 1 : ℕ) : ℝ) := by have hm1_cast : ((m - 1 : ℕ) : ℝ) = (m : ℝ) - 1 := by rw [Nat.cast_sub (by omega : 1 ≤ m), Nat.cast_one] have hm2 : (2 : ℝ) ≤ (m : ℝ) := Nat.ofNat_le_cast.mpr hm linarith have hlog4 := Real.log_lt_log hm_pos h4 rw [Real.log_mul (by norm_num) (ne_of_gt hm1_pos), show (4 : ℝ) = 2 ^ 2 by norm_num, Real.log_pow] at hlog4 push_cast at hlog4 linarith have hηc_lt_half : ηc < 1 / 2 := by by_contra hge push Not at hge have hle := hmono.monotoneOn hhalf_mem hηc_mem hge linarith refine ⟨ηc, ⟨⟨hηc_pos, hηc_lt_max⟩, hntic_zero, hηc_lt_half, ?_, ?_⟩, ?_⟩ · intro η hη hlt have h1 := hmono hη hηc_mem hlt unfold symShiftNticFn; linarith · intro η hη hgt have h1 := hmono hηc_mem hη hgt unfold symShiftNticFn; linarith · intro η' ⟨hη'_mem, hη'_zero, _, _, _⟩ have hη'_eq : symEntropyRateFn m η' = Real.log (m : ℝ) / 2 := by unfold symShiftNticFn at hη'_zero; linarith rcases lt_trichotomy η' ηc with hlt | rfl | hgt · have := hmono ⟨le_of_lt hη'_mem.1, le_of_lt hη'_mem.2⟩ hηc_mem hlt; linarith · rfl · have := hmono hηc_mem ⟨le_of_lt hη'_mem.1, le_of_lt hη'_mem.2⟩ hgt; linarith /-- **Theorem 18c (Exact Non-Asymptotic Two-Sided Bounds & Universal Asymptotic Law for `η_c(m)`)**: For any sequence `ηc : ℕ → ℝ` of critical thermal thresholds (`symShiftNticFn m (ηc m) = 0`, `0 < ηc m < 1/2` for `m ≥ 2`): 1. For all `m ≥ 3`, `1 / 2 - ηc m ≤ ln 2 / ln(m - 1)`. 2. `lim_{m → ∞} (1 / 2 - ηc m) · ln m = ln 2`, i.e., `ηc(m) = 1/2 - ln 2 / ln m + o(1 / ln m)`. -/ theorem symShiftLift_critical_noise_asymptotic (ηc : ℕ → ℝ) (hcrit : ∀ m, 2 ≤ m → 0 < ηc m ∧ ηc m < 1 / 2 ∧ symShiftNticFn m (ηc m) = 0) : (∀ m, 3 ≤ m → 1 / 2 - ηc m ≤ Real.log 2 / Real.log ((m - 1 : ℕ) : ℝ)) ∧ Tendsto (fun m : ℕ => (1 / 2 - ηc m) * Real.log (m : ℝ)) atTop (𝓝 (Real.log 2)) := by have hub_nonasymp : ∀ m, 3 ≤ m → 1 / 2 - ηc m ≤ Real.log 2 / Real.log ((m - 1 : ℕ) : ℝ) := by intro m hm obtain ⟨hpos, hhalf, hzero⟩ := hcrit m (by omega) have hlogm1_pos : 0 < Real.log ((m - 1 : ℕ) : ℝ) := Real.log_pos (Nat.one_lt_cast.mpr (by omega)) have hle_m : Real.log ((m - 1 : ℕ) : ℝ) ≤ Real.log (m : ℝ) := Real.log_le_log (Nat.cast_pos.mpr (by omega)) (Nat.cast_le.mpr (by omega)) have hh_le : binEntropy (ηc m) ≤ Real.log 2 := binEntropy_le_log_two (le_of_lt hpos) (by linarith) unfold symShiftNticFn symEntropyRateFn at hzero rw [le_div_iff₀ hlogm1_pos] nlinarith refine ⟨hub_nonasymp, ?_⟩ -- Squeeze (1/2 - ηc m) * log m between lower and upper sequences converging to log 2! have htend_log_ratio : Tendsto (fun m : ℕ => Real.log (m : ℝ) / Real.log ((m - 1 : ℕ) : ℝ)) atTop (𝓝 1) := by have hlog_inf : Tendsto (fun m : ℕ => Real.log ((m - 1 : ℕ) : ℝ)) atTop atTop := by refine Real.tendsto_log_atTop.comp ?_ exact tendsto_natCast_atTop_atTop.comp (tendsto_sub_atTop_nat 1) have hdiff_zero : Tendsto (fun m : ℕ => Real.log ((m : ℝ) / ((m - 1 : ℕ) : ℝ)) / Real.log ((m - 1 : ℕ) : ℝ)) atTop (𝓝 0) := by have hratio1 : Tendsto (fun m : ℕ => (m : ℝ) / ((m - 1 : ℕ) : ℝ)) atTop (𝓝 1) := by have hrew : ∀ᶠ m : ℕ in atTop, (m : ℝ) / ((m - 1 : ℕ) : ℝ) = 1 + 1 / ((m - 1 : ℕ) : ℝ) := by filter_upwards [eventually_ge_atTop 2] with m hm have hm1 : (0 : ℝ) < ((m - 1 : ℕ) : ℝ) := Nat.cast_pos.mpr (by omega) have hm1_cast : ((m - 1 : ℕ) : ℝ) = (m : ℝ) - 1 := by rw [Nat.cast_sub (by omega : 1 ≤ m), Nat.cast_one] rw [hm1_cast]; field_simp [show (m : ℝ) - 1 ≠ 0 by linarith]; ring rw [tendsto_congr' hrew] have hinv : Tendsto (fun m : ℕ => 1 / ((m - 1 : ℕ) : ℝ)) atTop (𝓝 0) := tendsto_const_nhds.div_atTop (tendsto_natCast_atTop_atTop.comp (tendsto_sub_atTop_nat 1)) simpa using tendsto_const_nhds.add hinv have hlog_zero : Tendsto (fun m : ℕ => Real.log ((m : ℝ) / ((m - 1 : ℕ) : ℝ))) atTop (𝓝 0) := by simpa [Function.comp_def, Real.log_one] using (Real.continuousAt_log one_ne_zero).tendsto.comp hratio1 exact hlog_zero.div_atTop hlog_inf have hrew : ∀ᶠ m : ℕ in atTop, Real.log (m : ℝ) / Real.log ((m - 1 : ℕ) : ℝ) = 1 + Real.log ((m : ℝ) / ((m - 1 : ℕ) : ℝ)) / Real.log ((m - 1 : ℕ) : ℝ) := by filter_upwards [eventually_ge_atTop 3] with m hm have hm_pos : (0 : ℝ) < (m : ℝ) := Nat.cast_pos.mpr (by omega) have hm1_pos : (0 : ℝ) < ((m - 1 : ℕ) : ℝ) := Nat.cast_pos.mpr (by omega) have hlog1_ne : Real.log ((m - 1 : ℕ) : ℝ) ≠ 0 := ne_of_gt (Real.log_pos (Nat.one_lt_cast.mpr (by omega))) rw [Real.log_div (ne_of_gt hm_pos) (ne_of_gt hm1_pos)] field_simp [hlog1_ne]; ring rw [tendsto_congr' hrew] simpa using tendsto_const_nhds.add hdiff_zero let ub : ℕ → ℝ := fun m => Real.log 2 * (Real.log (m : ℝ) / Real.log ((m - 1 : ℕ) : ℝ)) let lb : ℕ → ℝ := fun m => Real.log 2 - 4 * (Real.log 2 / Real.log ((m - 1 : ℕ) : ℝ)) ^ 2 - Real.log ((m : ℝ) / ((m - 1 : ℕ) : ℝ)) / 2 have hub_tend : Tendsto ub atTop (𝓝 (Real.log 2)) := by simpa [ub] using (tendsto_const_nhds (x := Real.log 2)).mul htend_log_ratio have hlb_tend : Tendsto lb atTop (𝓝 (Real.log 2)) := by have hlog_inf : Tendsto (fun m : ℕ => Real.log ((m - 1 : ℕ) : ℝ)) atTop atTop := Real.tendsto_log_atTop.comp (tendsto_natCast_atTop_atTop.comp (tendsto_sub_atTop_nat 1)) have hterm1 : Tendsto (fun m : ℕ => 4 * (Real.log 2 / Real.log ((m - 1 : ℕ) : ℝ)) ^ 2) atTop (𝓝 0) := by have hq : Tendsto (fun m : ℕ => Real.log 2 / Real.log ((m - 1 : ℕ) : ℝ)) atTop (𝓝 0) := tendsto_const_nhds.div_atTop hlog_inf simpa using (tendsto_const_nhds (x := (4 : ℝ))).mul (hq.pow 2) have hterm2 : Tendsto (fun m : ℕ => Real.log ((m : ℝ) / ((m - 1 : ℕ) : ℝ)) / 2) atTop (𝓝 0) := by have hratio1 : Tendsto (fun m : ℕ => (m : ℝ) / ((m - 1 : ℕ) : ℝ)) atTop (𝓝 1) := by have hrew : ∀ᶠ m : ℕ in atTop, (m : ℝ) / ((m - 1 : ℕ) : ℝ) = 1 + 1 / ((m - 1 : ℕ) : ℝ) := by filter_upwards [eventually_ge_atTop 2] with m hm have hm1_cast : ((m - 1 : ℕ) : ℝ) = (m : ℝ) - 1 := by rw [Nat.cast_sub (by omega : 1 ≤ m), Nat.cast_one] rw [hm1_cast]; field_simp [show (m : ℝ) - 1 ≠ 0 by have : (2 : ℝ) ≤ (m : ℝ) := Nat.ofNat_le_cast.mpr hm; linarith]; ring rw [tendsto_congr' hrew] have hinv : Tendsto (fun m : ℕ => 1 / ((m - 1 : ℕ) : ℝ)) atTop (𝓝 0) := tendsto_const_nhds.div_atTop (tendsto_natCast_atTop_atTop.comp (tendsto_sub_atTop_nat 1)) simpa using tendsto_const_nhds.add hinv have hlog0 : Tendsto (fun m : ℕ => Real.log ((m : ℝ) / ((m - 1 : ℕ) : ℝ))) atTop (𝓝 0) := by simpa [Function.comp_def, Real.log_one] using (Real.continuousAt_log one_ne_zero).tendsto.comp hratio1 simpa using hlog0.div_const 2 simpa [lb] using (tendsto_const_nhds.sub hterm1).sub hterm2 refine tendsto_of_tendsto_of_tendsto_of_le_of_le' hlb_tend hub_tend ?_ ?_ · -- Eventually lb m ≤ (1/2 - ηc m) * log m filter_upwards [eventually_ge_atTop 6] with m hm obtain ⟨hpos, hhalf, hzero⟩ := hcrit m (by omega) set x := 1 / 2 - ηc m have hx_pos : 0 < x := sub_pos.mpr hhalf have hx_lt : x < 1 / 2 := sub_lt_self _ hpos have hlogm_pos : 0 < Real.log (m : ℝ) := Real.log_pos (Nat.one_lt_cast.mpr (by omega)) have hlogm1_pos : 0 < Real.log ((m - 1 : ℕ) : ℝ) := Real.log_pos (Nat.one_lt_cast.mpr (by omega)) have hx_ub : x ≤ Real.log 2 / Real.log ((m - 1 : ℕ) : ℝ) := hub_nonasymp m (by omega) have hsq_le : x ^ 2 ≤ (Real.log 2 / Real.log ((m - 1 : ℕ) : ℝ)) ^ 2 := pow_le_pow_left₀ (le_of_lt hx_pos) hx_ub 2 have hbin_lb := log_two_sub_four_sq_le_binEntropy (x := x) (by linarith) hx_lt have hη_eq : 1 / 2 - x = ηc m := by simp [x] rw [hη_eq] at hbin_lb unfold symShiftNticFn symEntropyRateFn at hzero have hlog_split : Real.log (m : ℝ) - Real.log ((m - 1 : ℕ) : ℝ) = Real.log ((m : ℝ) / ((m - 1 : ℕ) : ℝ)) := (Real.log_div (ne_of_gt (Nat.cast_pos.mpr (by omega))) (ne_of_gt (Nat.cast_pos.mpr (by omega)))).symm have hle_m : Real.log ((m - 1 : ℕ) : ℝ) ≤ Real.log (m : ℝ) := Real.log_le_log (Nat.cast_pos.mpr (by omega)) (Nat.cast_le.mpr (by omega)) have hx_mul_le : x * Real.log ((m - 1 : ℕ) : ℝ) ≤ x * Real.log (m : ℝ) := mul_le_mul_of_nonneg_left hle_m (le_of_lt hx_pos) dsimp only [lb] nlinarith · -- Eventually (1/2 - ηc m) * log m ≤ ub m filter_upwards [eventually_ge_atTop 3] with m hm have hlogm_nn : 0 ≤ Real.log (m : ℝ) := Real.log_nonneg (Nat.one_le_cast.mpr (by omega)) have h1 := hub_nonasymp m hm have h2 := mul_le_mul_of_nonneg_right h1 hlogm_nn dsimp only [ub] have hring : Real.log 2 / Real.log ((m - 1 : ℕ) : ℝ) * Real.log (m : ℝ) = Real.log 2 * (Real.log (m : ℝ) / Real.log ((m - 1 : ℕ) : ℝ)) := by ring linarith /-! ### Part 6B: Intra-Fiber Mixing Noise-Induced Closure Transition (Weak → Strong Lumpability) -/ /-- **Intra-Fiber Mixing Operator** `P_λ = ((1 - λ) I + λ E_ν) P`: with probability `λ`, scrambles the microstate inside its current macrostate fiber according to the stationary conditional `ν(· | π(i))` before taking a step of `P`. -/ noncomputable def fiberMixedKernel {α β : Type*} [Fintype α] [DecidableEq β] (P : α → α → ℝ) (π : α → β) (ν : α → ℝ) (lam : ℝ) (i j : α) : ℝ := (1 - lam) * P i j + lam * ∑ r ∈ univ.filter (fun r => π r = π i), condFiberDist π ν (π i) r * P r j /-- Convexity of KL divergence in the first argument (from `log_sum_ineq`). -/ lemma klDiv_convex_left {β : Type*} [Fintype β] {p₁ p₂ q : β → ℝ} (hp₁ : IsProbDist p₁) (hp₂ : IsProbDist p₂) (hq : IsProbDist q) (hac₁ : AbsCont p₁ q) (hac₂ : AbsCont p₂ q) {t : ℝ} (ht0 : 0 ≤ t) (ht1 : t ≤ 1) : klDiv (fun b => (1 - t) * p₁ b + t * p₂ b) q ≤ (1 - t) * klDiv p₁ q + t * klDiv p₂ q := by unfold klDiv rw [mul_sum, mul_sum, ← sum_add_distrib] refine sum_le_sum fun b _ => ?_ let a : Fin 2 → ℝ := fun k => if k = 0 then (1 - t) * p₁ b else t * p₂ b let c : Fin 2 → ℝ := fun k => if k = 0 then (1 - t) * q b else t * q b have ha : ∀ k ∈ (univ : Finset (Fin 2)), 0 ≤ a k := fun k _ => by fin_cases k <;> simp [a] <;> nlinarith [hp₁.1 b, hp₂.1 b] have hc : ∀ k ∈ (univ : Finset (Fin 2)), 0 ≤ c k := fun k _ => by fin_cases k <;> simp [c] <;> nlinarith [hq.1 b] have hac : ∀ k ∈ (univ : Finset (Fin 2)), a k ≠ 0 → c k ≠ 0 := fun k _ hak => by fin_cases k · simp only [a, c] at hak ⊢ exact mul_ne_zero (left_ne_zero_of_mul hak) (hac₁ b (right_ne_zero_of_mul hak)) · simp only [a, c, Fin.isValue] at hak ⊢ norm_num at hak ⊢ exact ⟨hak.1, hac₂ b hak.2⟩ have hls := log_sum_ineq univ a c ha hc hac have hA : ∑ k : Fin 2, a k = (1 - t) * p₁ b + t * p₂ b := by simp [a, Fin.sum_univ_two] have hC : ∑ k : Fin 2, c k = q b := by simp [c, Fin.sum_univ_two]; ring rw [hA, hC] at hls have hrhs : ∑ k : Fin 2, (if a k = 0 then 0 else a k * Real.log (a k / c k)) = (1 - t) * (if p₁ b = 0 then 0 else p₁ b * Real.log (p₁ b / q b)) + t * (if p₂ b = 0 then 0 else p₂ b * Real.log (p₂ b / q b)) := by rw [Fin.sum_univ_two] simp only [a, c, ↓reduceIte] have h10 : ((1 : Fin 2) = 0) ↔ False := by decide simp only [h10, ↓reduceIte] congr 1 · by_cases h1t : 1 - t = 0 · simp [h1t] · by_cases hp : p₁ b = 0 · simp [hp] · have hmul_ne : (1 - t) * p₁ b ≠ 0 := mul_ne_zero h1t hp rw [if_neg hmul_ne, if_neg hp] have hdiv : (1 - t) * p₁ b / ((1 - t) * q b) = p₁ b / q b := by by_cases hqb : q b = 0 · exact absurd hqb (hac₁ b hp) · field_simp [h1t, hqb] rw [hdiv]; ring · by_cases ht : t = 0 · simp [ht] · by_cases hp : p₂ b = 0 · simp [hp] · have hmul_ne : t * p₂ b ≠ 0 := mul_ne_zero ht hp rw [if_neg hmul_ne, if_neg hp] have hdiv : t * p₂ b / (t * q b) = p₂ b / q b := by by_cases hqb : q b = 0 · exact absurd hqb (hac₂ b hp) · field_simp [ht, hqb] rw [hdiv]; ring rw [hrhs] at hls exact hls /-- **Theorem 19a (Exact Invariance & Linear Contraction Under Intra-Fiber Mixing)**: For any stationary `(P, π, ν)` with active macrostates and any `λ ∈ [0, 1]`, `P_λ` preserves `ν`, `Q^(ν)`, `I_ν(M_{t+1}; M_t)`, and exact weak lumpability identically, scales `ε_diam(P_λ) = (1 - λ) ε_diam(P)`, satisfies `DIC(P_λ) ≤ (1 - λ) DIC(P)`, and achieves exact strong lumpability (`DIC(P_1) = 0`) at `λ = 1`. -/ theorem fiberMixedKernel_invariance {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) {π : α → β} (hπ : Function.Surjective π) {ν : α → ℝ} (hν : IsProbDist ν) (hstat : kernelStep ν P = ν) (hpos : ∀ a, pushForward π ν a ≠ 0) {lam : ℝ} (hlam0 : 0 ≤ lam) (hlam1 : lam ≤ 1) : let Plam := fiberMixedKernel P π ν lam IsStochastic Plam ∧ kernelStep ν Plam = ν ∧ (∀ i b, lumpedRow Plam π i b = (1 - lam) * lumpedRow P π i b + lam * inducedMacroKernel P π ν (π i) b) ∧ inducedMacroKernel Plam π ν = inducedMacroKernel P π ν ∧ macroMutualInfo Plam π ν = macroMutualInfo P π ν ∧ ksDefectDiam Plam π = (1 - lam) * ksDefectDiam P π ∧ dicDefect Plam π ν ≤ (1 - lam) * dicDefect P π ν ∧ (IsStronglyLumpable (fiberMixedKernel P π ν 1) π) ∧ (∀ Q, IsInvariantFiber P π ν Q → IsInvariantFiber Plam π ν Q) := by intro Plam have hQ_stoch := isStochastic_inducedMacroKernel hP hπ hν have hPlam_stoch : IsStochastic Plam := by intro i refine ⟨fun j => add_nonneg (mul_nonneg (by linarith) ((hP i).1 j)) (mul_nonneg hlam0 (sum_nonneg fun r _ => mul_nonneg (condFiberDist_nonneg π hν (π i) r) ((hP r).1 j))), ?_⟩ unfold Plam fiberMixedKernel rw [sum_add_distrib, ← mul_sum, (hP i).2, mul_one, ← mul_sum, sum_comm] simp_rw [← mul_sum, (hP _).2, mul_one, condFiberDist_sum π ν (hpos (π i))] ring have hPlam_stat : kernelStep ν Plam = ν := by ext j unfold kernelStep Plam fiberMixedKernel simp_rw [mul_add, sum_add_distrib, ← mul_assoc] have h1 : ∑ i : α, ν i * (1 - lam) * P i j = (1 - lam) * ν j := by have : ∑ i : α, ν i * (1 - lam) * P i j = (1 - lam) * kernelStep ν P j := by unfold kernelStep; rw [mul_sum]; exact sum_congr rfl fun i _ => by ring rw [this, hstat] have h2 : ∑ i : α, ν i * lam * ∑ r ∈ univ.filter (fun r => π r = π i), condFiberDist π ν (π i) r * P r j = lam * ν j := by rw [← sum_fiberwise_eq π (fun i => ν i * lam * ∑ r ∈ univ.filter (fun r => π r = π i), condFiberDist π ν (π i) r * P r j)] have hfib : ∀ a : β, ∑ i ∈ univ.filter (fun i => π i = a), ν i * lam * ∑ r ∈ univ.filter (fun r => π r = π i), condFiberDist π ν (π i) r * P r j = lam * ∑ r ∈ univ.filter (fun r => π r = a), ν r * P r j := by intro a rw [sum_congr rfl fun i hi => by rw [(mem_filter.mp hi).2]] rw [← sum_mul, ← sum_mul] have hpush_a : ∑ i ∈ univ.filter (fun i => π i = a), ν i = pushForward π ν a := rfl rw [hpush_a, mul_comm (pushForward π ν a) lam, mul_assoc] congr 1 rw [mul_sum] refine sum_congr rfl fun r hr => ?_ simp only [condFiberDist, (mem_filter.mp hr).2, hpos a, ne_eq, not_false_eq_true, and_self, ↓reduceIte] field_simp [hpos a] simp_rw [hfib, ← mul_sum, sum_fiberwise_eq π (fun r => ν r * P r j)] change lam * kernelStep ν P j = lam * ν j rw [hstat] rw [h1, h2]; ring have hlumped : ∀ i b, lumpedRow Plam π i b = (1 - lam) * lumpedRow P π i b + lam * inducedMacroKernel P π ν (π i) b := by intro i b unfold lumpedRow pushForward Plam fiberMixedKernel rw [sum_add_distrib, ← mul_sum, ← mul_sum, sum_comm] congr 1 congr 1 unfold inducedMacroKernel rw [if_pos (hpos (π i))] refine sum_congr rfl fun r _ => ?_ unfold lumpedRow pushForward rw [mul_sum] have hQ_inv : inducedMacroKernel Plam π ν = inducedMacroKernel P π ν := by ext a b unfold inducedMacroKernel rw [if_pos (hpos a), if_pos (hpos a)] simp_rw [hlumped] have hrew : ∀ i ∈ univ.filter (fun i => π i = a), condFiberDist π ν a i * ((1 - lam) * lumpedRow P π i b + lam * inducedMacroKernel P π ν (π i) b) = (1 - lam) * (condFiberDist π ν a i * lumpedRow P π i b) + lam * (condFiberDist π ν a i * inducedMacroKernel P π ν a b) := fun i hi => by rw [(mem_filter.mp hi).2]; ring rw [sum_congr rfl hrew, sum_add_distrib, ← mul_sum, ← mul_sum, ← sum_mul, condFiberDist_sum π ν (hpos a), one_mul] unfold inducedMacroKernel rw [if_pos (hpos a)]; ring have hmi_inv : macroMutualInfo Plam π ν = macroMutualInfo P π ν := by unfold macroMutualInfo; rw [hQ_inv] -- TV distance scales linearly by (1 - lam) have htv_scale : ∀ i i', π i = π i' → tvDist (lumpedRow Plam π i) (lumpedRow Plam π i') = (1 - lam) * tvDist (lumpedRow P π i) (lumpedRow P π i') := by intro i i' hπeq unfold tvDist have h1 : ∀ b, |lumpedRow Plam π i b - lumpedRow Plam π i' b| = (1 - lam) * |lumpedRow P π i b - lumpedRow P π i' b| := by intro b rw [hlumped i b, hlumped i' b, hπeq] have : (1 - lam) * lumpedRow P π i b + lam * inducedMacroKernel P π ν (π i') b - ((1 - lam) * lumpedRow P π i' b + lam * inducedMacroKernel P π ν (π i') b) = (1 - lam) * (lumpedRow P π i b - lumpedRow P π i' b) := by ring rw [this, abs_mul, abs_of_nonneg (by linarith)] simp_rw [h1, ← mul_sum]; ring have hdiam_scale : ksDefectDiam Plam π = (1 - lam) * ksDefectDiam P π := by unfold ksDefectDiam split_ifs with hne · apply le_antisymm · refine sup'_le hne _ fun a _ => ?_ have hfib_le : fiberDiam Plam π a ≤ (1 - lam) * fiberDiam P π a := by unfold fiberDiam; dsimp only split_ifs with hF · refine sup'_le hF _ fun p hp => ?_ obtain ⟨hp1, hp2⟩ := mem_product.mp hp rw [htv_scale p.1 p.2 ((mem_filter.mp hp1).2.trans (mem_filter.mp hp2).2.symm)] exact mul_le_mul_of_nonneg_left (le_sup' (fun q : α × α => tvDist (lumpedRow P π q.1) (lumpedRow P π q.2)) hp) (by linarith) · linarith exact le_trans hfib_le (mul_le_mul_of_nonneg_left (le_sup' (fun b => fiberDiam P π b) (mem_univ a)) (by linarith)) · by_cases h1lam : 1 - lam = 0 · rw [h1lam, zero_mul] obtain ⟨a0, ha0⟩ := hne exact le_trans (fiberDiam_nonneg Plam π a0) (le_sup' (fun b => fiberDiam Plam π b) ha0) · have h1lam_pos : 0 < 1 - lam := lt_of_le_of_ne (by linarith) (Ne.symm h1lam) rw [mul_comm, ← le_div_iff₀ h1lam_pos] refine sup'_le hne _ fun a _ => ?_ rw [le_div_iff₀ h1lam_pos, mul_comm] have hfib_ge : (1 - lam) * fiberDiam P π a ≤ fiberDiam Plam π a := by unfold fiberDiam; dsimp only split_ifs with hF · rw [mul_comm, ← le_div_iff₀ h1lam_pos] refine sup'_le hF _ fun p hp => ?_ rw [le_div_iff₀ h1lam_pos, mul_comm] obtain ⟨hp1, hp2⟩ := mem_product.mp hp rw [← htv_scale p.1 p.2 ((mem_filter.mp hp1).2.trans (mem_filter.mp hp2).2.symm)] exact le_sup' (fun q : α × α => tvDist (lumpedRow Plam π q.1) (lumpedRow Plam π q.2)) hp · linarith exact le_trans hfib_ge (le_sup' (fun b => fiberDiam Plam π b) (mem_univ a)) · ring have hdic_le : dicDefect Plam π ν ≤ (1 - lam) * dicDefect P π ν := by unfold dicDefect rw [hQ_inv, mul_sum] refine sum_le_sum fun i _ => ?_ by_cases hνi : ν i = 0 · simp [hνi] · have hνi_pos : 0 < ν i := lt_of_le_of_ne (hν.1 i) (Ne.symm hνi) have hac1 := absCont_lumpedRow_inducedMacroKernel hP π hν hνi_pos have hconv := klDiv_convex_left (isStochastic_lumpedRow hP π i) (hQ_stoch (π i)) (hQ_stoch (π i)) hac1 (fun _ h => h) hlam0 hlam1 rw [klDiv_self, mul_zero, add_zero] at hconv have hrow_eq : lumpedRow Plam π i = fun b => (1 - lam) * lumpedRow P π i b + lam * inducedMacroKernel P π ν (π i) b := funext (hlumped i) rw [hrow_eq] calc ν i * klDiv (fun b => (1 - lam) * lumpedRow P π i b + lam * inducedMacroKernel P π ν (π i) b) (inducedMacroKernel P π ν (π i)) ≤ ν i * ((1 - lam) * klDiv (lumpedRow P π i) (inducedMacroKernel P π ν (π i))) := mul_le_mul_of_nonneg_left hconv (hν.1 i) _ = (1 - lam) * (ν i * klDiv (lumpedRow P π i) (inducedMacroKernel P π ν (π i))) := by ring have hstrong1 : IsStronglyLumpable (fiberMixedKernel P π ν 1) π := by intro i i' hπeq b have h1 : ∀ x, lumpedRow (fiberMixedKernel P π ν 1) π x b = inducedMacroKernel P π ν (π x) b := by intro x unfold lumpedRow pushForward fiberMixedKernel simp only [sub_self, zero_mul, zero_add, one_mul] rw [sum_comm] unfold inducedMacroKernel rw [if_pos (hpos (π x))] refine sum_congr rfl fun r _ => ?_ unfold lumpedRow pushForward; rw [mul_sum] rw [h1 i, h1 i', hπeq] have hweak : ∀ Q, IsInvariantFiber P π ν Q → IsInvariantFiber Plam π ν Q := by intro Q hinv a b j hπj unfold Plam fiberMixedKernel simp_rw [mul_add, sum_add_distrib] have h1 : ∑ i ∈ univ.filter (fun i => π i = a), condFiberDist π ν a i * ((1 - lam) * P i j) = (1 - lam) * (Q a b * condFiberDist π ν b j) := by have : ∑ i ∈ univ.filter (fun i => π i = a), condFiberDist π ν a i * ((1 - lam) * P i j) = (1 - lam) * ∑ i ∈ univ.filter (fun i => π i = a), condFiberDist π ν a i * P i j := by rw [mul_sum]; exact sum_congr rfl fun i _ => by ring rw [this, hinv a b j hπj] have h2 : ∑ i ∈ univ.filter (fun i => π i = a), condFiberDist π ν a i * (lam * ∑ r ∈ univ.filter (fun r => π r = π i), condFiberDist π ν (π i) r * P r j) = lam * (Q a b * condFiberDist π ν b j) := by rw [sum_congr rfl fun i hi => by rw [(mem_filter.mp hi).2, hinv a b j hπj]] rw [← sum_mul, condFiberDist_sum π ν (hpos a), one_mul] rw [h1, h2]; ring exact ⟨hPlam_stoch, hPlam_stat, hlumped, hQ_inv, hmi_inv, hdiam_scale, hdic_le, hstrong1, hweak⟩ /-- **Theorem 19b (Sharp Intra-Fiber Mixing Closure Phase Transition)**: For ANY stationary chain `(P, π, ν)` with strictly positive `ν`, positive macro mutual information `I_ν(M_{t+1}; M_t) > 0`, and initially negative NTIC (`I_ν(M_{t+1}; M_t) < DIC(P, π; ν)`), there exists a UNIQUE sharp critical intra-fiber mixing threshold `λ_c ∈ (0, 1)` such that: - `λ < λ_c → NTIC(P_λ) < 0` (micro-dominated phase), - `λ = λ_c → NTIC(P_λ) = 0` (exact critical point), - `λ > λ_c → NTIC(P_λ) > 0` (emergent informational closure phase), satisfying the universal analytical upper bound `λ_c ≤ 1 - I_ν(M_{t+1}; M_t) / DIC(P, π; ν)`. -/ theorem fiberMixedKernel_critical_phase_transition {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {P : α → α → ℝ} (hP : IsStochastic P) {π : α → β} (hπ : Function.Surjective π) {ν : α → ℝ} (hν : IsProbDist ν) (hν_pos : ∀ i, 0 < ν i) (hstat : kernelStep ν P = ν) (hI_pos : 0 < macroMutualInfo P π ν) (hntic_neg : ntic P π ν < 0) : ∃! lamc : ℝ, lamc ∈ Set.Ioo (0 : ℝ) 1 ∧ ntic (fiberMixedKernel P π ν lamc) π ν = 0 ∧ lamc ≤ 1 - macroMutualInfo P π ν / dicDefect P π ν ∧ (∀ lam ∈ Set.Icc (0 : ℝ) 1, lam < lamc → ntic (fiberMixedKernel P π ν lam) π ν < 0) ∧ (∀ lam ∈ Set.Icc (0 : ℝ) 1, lamc < lam → 0 < ntic (fiberMixedKernel P π ν lam) π ν) := by have hpos : ∀ a, pushForward π ν a ≠ 0 := fun a => by obtain ⟨i0, hi0⟩ := hπ a exact ne_of_gt (lt_of_lt_of_le (hν_pos i0) (single_le_sum (fun j _ => hν.1 j) (mem_filter.mpr ⟨mem_univ i0, hi0⟩))) have hQ_stoch := isStochastic_inducedMacroKernel hP hπ hν have hdic0_pos : 0 < dicDefect P π ν := by unfold ntic at hntic_neg; linarith -- Define f(lam) = dicDefect (fiberMixedKernel P π ν lam) π ν let f : ℝ → ℝ := fun lam => dicDefect (fiberMixedKernel P π ν lam) π ν -- Express f(lam) explicitly via Q^(ν) to prove continuity on [0, 1] have hf_eq : ∀ lam ∈ Set.Icc (0 : ℝ) 1, f lam = ∑ i : α, ν i * ∑ b : β, (let r := (1 - lam) * lumpedRow P π i b + lam * inducedMacroKernel P π ν (π i) b if r = 0 then 0 else r * Real.log (r / inducedMacroKernel P π ν (π i) b)) := by intro lam hlam have hinv := fiberMixedKernel_invariance hP hπ hν hstat hpos hlam.1 hlam.2 unfold f dicDefect klDiv rw [hinv.2.2.2.1] refine sum_congr rfl fun i _ => by congr 1; refine sum_congr rfl fun b _ => by rw [hinv.2.2.1 i b] -- Continuity of f on [0, 1] have hf_cont : ContinuousOn f (Set.Icc 0 1) := by -- Express each term as -negMulLog r - r * log Q_{π(i), b} (continuous!) have hterm_cont : ∀ (i : α) (b : β), ContinuousOn (fun lam : ℝ => let r := (1 - lam) * lumpedRow P π i b + lam * inducedMacroKernel P π ν (π i) b if r = 0 then 0 else r * Real.log (r / inducedMacroKernel P π ν (π i) b)) (Set.Icc 0 1) := by intro i b by_cases hQb : inducedMacroKernel P π ν (π i) b = 0 · -- Then lumpedRow P π i b = 0 as well by absolute continuity! have hPb : lumpedRow P π i b = 0 := by by_contra hne exact absCont_lumpedRow_inducedMacroKernel hP π hν (hν_pos i) b hne hQb have hzero : ∀ lam ∈ Set.Icc (0 : ℝ) 1, (let r := (1 - lam) * lumpedRow P π i b + lam * inducedMacroKernel P π ν (π i) b if r = 0 then (0 : ℝ) else r * Real.log (r / inducedMacroKernel P π ν (π i) b)) = 0 := by intro lam _; simp [hPb, hQb] exact continuousOn_const.congr hzero · have hrew : ∀ lam ∈ Set.Icc (0 : ℝ) 1, (let r := (1 - lam) * lumpedRow P π i b + lam * inducedMacroKernel P π ν (π i) b if r = 0 then (0 : ℝ) else r * Real.log (r / inducedMacroKernel P π ν (π i) b)) = -negMulLog ((1 - lam) * lumpedRow P π i b + lam * inducedMacroKernel P π ν (π i) b) - ((1 - lam) * lumpedRow P π i b + lam * inducedMacroKernel P π ν (π i) b) * Real.log (inducedMacroKernel P π ν (π i) b) := by intro lam _ dsimp only set r := (1 - lam) * lumpedRow P π i b + lam * inducedMacroKernel P π ν (π i) b by_cases hr : r = 0 · simp [hr, negMulLog] · rw [if_neg hr, Real.log_div hr hQb]; unfold negMulLog; ring have hlin : Continuous (fun lam : ℝ => (1 - lam) * lumpedRow P π i b + lam * inducedMacroKernel P π ν (π i) b) := ((continuous_const.sub continuous_id).mul continuous_const).add (continuous_id.mul continuous_const) have hc : Continuous (fun lam : ℝ => -negMulLog ((1 - lam) * lumpedRow P π i b + lam * inducedMacroKernel P π ν (π i) b) - ((1 - lam) * lumpedRow P π i b + lam * inducedMacroKernel P π ν (π i) b) * Real.log (inducedMacroKernel P π ν (π i) b)) := (continuous_negMulLog.comp hlin).neg.sub (hlin.mul continuous_const) exact hc.continuousOn.congr hrew have hsum_cont : ContinuousOn (fun lam : ℝ => ∑ i : α, ν i * ∑ b : β, (let r := (1 - lam) * lumpedRow P π i b + lam * inducedMacroKernel P π ν (π i) b if r = 0 then 0 else r * Real.log (r / inducedMacroKernel P π ν (π i) b))) (Set.Icc 0 1) := continuousOn_finsetSum _ fun i _ => continuousOn_const.mul (continuousOn_finsetSum _ fun b _ => hterm_cont i b) exact hsum_cont.congr hf_eq -- Strict antitonicity of f on [0, 1]: P_{lam2} is a convex mixture of P_{lam1} and P_1! have hf_strictAnti : StrictAntiOn f (Set.Icc 0 1) := by intro l1 hl1 l2 hl2 hlt have h1l1_pos : 0 < 1 - l1 := by linarith [hl2.2] set t : ℝ := (l2 - l1) / (1 - l1) have ht0 : 0 < t := div_pos (by linarith) h1l1_pos have ht1 : t ≤ 1 := (div_le_one h1l1_pos).mpr (by linarith [hl2.2]) have hinv1 := fiberMixedKernel_invariance hP hπ hν hstat hpos hl1.1 hl1.2 have hinv2 := fiberMixedKernel_invariance hP hπ hν hstat hpos hl2.1 hl2.2 -- f(l1) > 0 because l1 < 1 and DIC(0) > 0! have hf1_pos : 0 < f l1 := by have hnn := dicDefect_nonneg hinv1.1 hπ hν refine lt_of_le_of_ne hnn (Ne.symm fun h0 => ?_) have hsl1 := (dicDefect_eq_zero_iff_stronglyLumpable hinv1.1 hπ hν hν_pos).mp h0 have hsl0 : IsStronglyLumpable P π := by intro i i' hπeq b have heq := hsl1 i i' hπeq b rw [hinv1.2.2.1 i b, hinv1.2.2.1 i' b, hπeq] at heq have hmul : (1 - l1) * lumpedRow P π i b = (1 - l1) * lumpedRow P π i' b := by linarith exact mul_left_cancel₀ (ne_of_gt h1l1_pos) hmul have hdic0 := (dicDefect_eq_zero_iff_stronglyLumpable hP hπ hν hν_pos).mpr hsl0 linarith -- Convexity: lumpedRow(P_{l2}) = (1 - t) * lumpedRow(P_{l1}) + t * Q^(ν) have hf2_le : f l2 ≤ (1 - t) * f l1 := by unfold f dicDefect rw [hinv2.2.2.2.1, hinv1.2.2.2.1, mul_sum] refine sum_le_sum fun i _ => ?_ have hrow2 : lumpedRow (fiberMixedKernel P π ν l2) π i = fun b => (1 - t) * lumpedRow (fiberMixedKernel P π ν l1) π i b + t * inducedMacroKernel P π ν (π i) b := by ext b rw [hinv2.2.2.1 i b, hinv1.2.2.1 i b] have h1t : 1 - t = (1 - l2) / (1 - l1) := by simp [t]; field_simp [ne_of_gt h1l1_pos]; ring rw [h1t]; simp only [t]; field_simp [ne_of_gt h1l1_pos]; ring have hac1 : AbsCont (lumpedRow (fiberMixedKernel P π ν l1) π i) (inducedMacroKernel P π ν (π i)) := by rw [← hinv1.2.2.2.1] exact absCont_lumpedRow_inducedMacroKernel hinv1.1 π hν (hν_pos i) have hconv := klDiv_convex_left (isStochastic_lumpedRow hinv1.1 π i) (hQ_stoch (π i)) (hQ_stoch (π i)) hac1 (fun _ h => h) (le_of_lt ht0) ht1 rw [klDiv_self, mul_zero, add_zero] at hconv rw [hrow2] calc ν i * klDiv _ (inducedMacroKernel P π ν (π i)) ≤ ν i * ((1 - t) * klDiv (lumpedRow (fiberMixedKernel P π ν l1) π i) (inducedMacroKernel P π ν (π i))) := mul_le_mul_of_nonneg_left hconv (hν.1 i) _ = (1 - t) * (ν i * klDiv (lumpedRow (fiberMixedKernel P π ν l1) π i) (inducedMacroKernel P π ν (π i))) := by ring nlinarith have hf0 : f 0 = dicDefect P π ν := by have hP0 : fiberMixedKernel P π ν 0 = P := by ext i j; simp [fiberMixedKernel] simp [f, hP0] have hf1 : f 1 = 0 := by have hinv1 := fiberMixedKernel_invariance hP hπ hν hstat hpos (lam := 1) (by norm_num) le_rfl exact (dicDefect_eq_zero_iff_stronglyLumpable hinv1.1 hπ hν hν_pos).mpr hinv1.2.2.2.2.2.2.2.1 -- Apply IVT to (-f) on [0, 1] for target (-macroMutualInfo P π ν) have hivt := intermediate_value_Icc (a := (0 : ℝ)) (b := 1) (by norm_num) hf_cont.neg have hmem : -macroMutualInfo P π ν ∈ Set.Icc (-f 0) (-f 1) := by rw [hf0, hf1, neg_zero] unfold ntic at hntic_neg exact ⟨by linarith, by linarith⟩ obtain ⟨lamc, hlamc_mem, hlamc_eq⟩ := hivt hmem have hflamc : f lamc = macroMutualInfo P π ν := by simp only [Pi.neg_apply] at hlamc_eq; linarith have hlamc_pos : 0 < lamc := by rcases eq_or_lt_of_le hlamc_mem.1 with rfl | hlt · rw [hf0] at hflamc; unfold ntic at hntic_neg; linarith · exact hlt have hlamc_lt1 : lamc < 1 := by rcases eq_or_lt_of_le hlamc_mem.2 with rfl | hlt · rw [hf1] at hflamc; linarith · exact hlt have hntic_lam : ∀ lam ∈ Set.Icc (0 : ℝ) 1, ntic (fiberMixedKernel P π ν lam) π ν = macroMutualInfo P π ν - f lam := by intro lam hlam have hinv := fiberMixedKernel_invariance hP hπ hν hstat hpos hlam.1 hlam.2 unfold ntic; rw [hinv.2.2.2.2.1] have hlamc_ub : lamc ≤ 1 - macroMutualInfo P π ν / dicDefect P π ν := by have hinv := fiberMixedKernel_invariance hP hπ hν hstat hpos hlamc_mem.1 hlamc_mem.2 have hle : macroMutualInfo P π ν ≤ (1 - lamc) * dicDefect P π ν := by rw [← hflamc]; exact hinv.2.2.2.2.2.2.1 have hdiv : macroMutualInfo P π ν / dicDefect P π ν ≤ 1 - lamc := (div_le_iff₀ hdic0_pos).mpr hle linarith refine ⟨lamc, ⟨⟨hlamc_pos, hlamc_lt1⟩, ?_, hlamc_ub, ?_, ?_⟩, ?_⟩ · rw [hntic_lam lamc hlamc_mem, hflamc, sub_self] · intro lam hlam hlt rw [hntic_lam lam hlam] have := hf_strictAnti hlam hlamc_mem hlt linarith · intro lam hlam hgt rw [hntic_lam lam hlam] have := hf_strictAnti hlamc_mem hlam hgt linarith · intro l' ⟨hl'_mem, hl'_zero, _, _, _⟩ have hl'_Icc : l' ∈ Set.Icc (0 : ℝ) 1 := ⟨le_of_lt hl'_mem.1, le_of_lt hl'_mem.2⟩ rw [hntic_lam l' hl'_Icc] at hl'_zero rcases lt_trichotomy l' lamc with hlt | rfl | hgt · have := hf_strictAnti hl'_Icc hlamc_mem hlt; linarith · rfl · have := hf_strictAnti hlamc_mem hl'_Icc hgt; linarith /-! ### Part 6C: Global Isotropic Noise-Induced Re-Entrant Informational Closure (Stochastic Resonance of NTIC!) -/ /-- Rational lower Padé bound on `log y` for `y ≥ 1`: `2 * ((y - 1)/(y + 1)) + (2/3) * ((y - 1)/(y + 1))^3 ≤ log y`. -/ lemma log_ge_pade {y : ℝ} (hy : 1 ≤ y) : 2 * ((y - 1) / (y + 1)) + (2 / 3) * ((y - 1) / (y + 1)) ^ 3 ≤ Real.log y := by let g : ℝ → ℝ := fun t => Real.log t - (2 * ((t - 1) / (t + 1)) + (2 / 3) * ((t - 1) / (t + 1)) ^ 3) have hderiv : ∀ t ∈ Set.Icc (1 : ℝ) y, HasDerivAt g ((t - 1) ^ 4 / (t * (t + 1) ^ 4)) t := by intro t ht have ht_pos : 0 < t := lt_of_lt_of_le one_pos ht.1 have ht1_pos : 0 < t + 1 := by linarith have hu : HasDerivAt (fun x : ℝ => (x - 1) / (x + 1)) (2 / (t + 1) ^ 2) t := by have hnum : HasDerivAt (fun x : ℝ => x - 1) 1 t := ((hasDerivAt_id t).sub (hasDerivAt_const t (1 : ℝ))).congr_deriv (by ring) have hden : HasDerivAt (fun x : ℝ => x + 1) 1 t := ((hasDerivAt_id t).add (hasDerivAt_const t (1 : ℝ))).congr_deriv (by ring) refine (hnum.div hden (ne_of_gt ht1_pos)).congr_deriv ?_ field_simp [ne_of_gt ht1_pos]; ring have hlog := Real.hasDerivAt_log (ne_of_gt ht_pos) have h1 := hu.const_mul (2 : ℝ) have h3 := (hu.pow 3).const_mul (2 / 3 : ℝ) refine (hlog.sub (h1.add h3)).congr_deriv ?_ norm_num field_simp [ne_of_gt ht_pos, ne_of_gt ht1_pos]; ring have hmono : MonotoneOn g (Set.Icc 1 y) := by apply monotoneOn_of_deriv_nonneg (convex_Icc 1 y) · exact fun t ht => (hderiv t ht).continuousAt.continuousWithinAt · exact fun t ht => (hderiv t (interior_subset ht)).differentiableAt.differentiableWithinAt · intro t ht have ht' := interior_subset ht rw [(hderiv t ht').deriv] have ht_pos : 0 < t := lt_of_lt_of_le one_pos ht'.1 positivity have h0 := hmono ⟨le_rfl, hy⟩ ⟨hy, le_rfl⟩ hy simp only [g, Real.log_one, sub_self, zero_div, mul_zero, zero_pow (by norm_num : 3 ≠ 0), add_zero] at h0 linarith /-- Rational upper Padé bound on `log y` for `y ≥ 1`: `log y ≤ 2 * (y - 1) / (y + 1) + (y - 1)^3 / (6 * y * (y + 1))`. -/ lemma log_le_pade {y : ℝ} (hy : 1 ≤ y) : Real.log y ≤ 2 * (y - 1) / (y + 1) + (y - 1) ^ 3 / (6 * y * (y + 1)) := by let g : ℝ → ℝ := fun t => 2 * (t - 1) / (t + 1) + (t - 1) ^ 3 / (6 * t * (t + 1)) - Real.log t have hderiv : ∀ t ∈ Set.Icc (1 : ℝ) y, HasDerivAt g ((t - 1) ^ 4 / (6 * t ^ 2 * (t + 1) ^ 2)) t := by intro t ht have ht_pos : 0 < t := lt_of_lt_of_le one_pos ht.1 have ht1_pos : 0 < t + 1 := by linarith have hnum1 : HasDerivAt (fun x : ℝ => 2 * (x - 1)) 2 t := by have h : HasDerivAt (fun x : ℝ => x - 1) 1 t := ((hasDerivAt_id t).sub (hasDerivAt_const t (1 : ℝ))).congr_deriv (by ring) exact (h.const_mul (2 : ℝ)).congr_deriv (by ring) have hden1 : HasDerivAt (fun x : ℝ => x + 1) 1 t := ((hasDerivAt_id t).add (hasDerivAt_const t (1 : ℝ))).congr_deriv (by ring) have hd1 : HasDerivAt (fun x : ℝ => 2 * (x - 1) / (x + 1)) (4 / (t + 1) ^ 2) t := by refine (hnum1.div hden1 (ne_of_gt ht1_pos)).congr_deriv ?_ field_simp [ne_of_gt ht1_pos]; ring have hnum2 : HasDerivAt (fun x : ℝ => (x - 1) ^ 3) (3 * (t - 1) ^ 2) t := by have h : HasDerivAt (fun x : ℝ => x - 1) 1 t := ((hasDerivAt_id t).sub (hasDerivAt_const t (1 : ℝ))).congr_deriv (by ring) refine (h.pow 3).congr_deriv ?_; norm_num have hden2 : HasDerivAt (fun x : ℝ => 6 * x * (x + 1)) (12 * t + 6) t := by have h1 : HasDerivAt (fun x : ℝ => 6 * x) 6 t := by simpa using (hasDerivAt_id t).const_mul (6 : ℝ) refine (h1.mul hden1).congr_deriv ?_; ring have h6_pos : 0 < 6 * t * (t + 1) := by positivity have hd2 := hnum2.div hden2 (ne_of_gt h6_pos) have hlog := Real.hasDerivAt_log (ne_of_gt ht_pos) refine ((hd1.add hd2).sub hlog).congr_deriv ?_ field_simp [ne_of_gt ht_pos, ne_of_gt ht1_pos]; ring have hmono : MonotoneOn g (Set.Icc 1 y) := by apply monotoneOn_of_deriv_nonneg (convex_Icc 1 y) · exact fun t ht => (hderiv t ht).continuousAt.continuousWithinAt · exact fun t ht => (hderiv t (interior_subset ht)).differentiableAt.differentiableWithinAt · intro t ht have ht' := interior_subset ht rw [(hderiv t ht').deriv] have ht_pos : 0 < t := lt_of_lt_of_le one_pos ht'.1 positivity have h0 := hmono ⟨le_rfl, hy⟩ ⟨hy, le_rfl⟩ hy simp only [g, Real.log_one, sub_self, mul_zero, zero_div, zero_pow (by norm_num : 3 ≠ 0), add_zero] at h0 linarith /-- Binary scaling helper for `log x` (`x > 0`, `k ∈ ℤ`): reduces `x = 2^k * y` with `y ≥ 1`. -/ lemma log_bounds_of_pow2_neg {x : ℝ} (hx : 0 < x) (k : ℕ) (hy : 1 ≤ x * (2 : ℝ) ^ k) : (2 * ((x * (2 : ℝ) ^ k - 1) / (x * (2 : ℝ) ^ k + 1)) + (2 / 3) * ((x * (2 : ℝ) ^ k - 1) / (x * (2 : ℝ) ^ k + 1)) ^ 3) - (k : ℝ) * 0.6931471808 ≤ Real.log x ∧ Real.log x ≤ (2 * (x * (2 : ℝ) ^ k - 1) / (x * (2 : ℝ) ^ k + 1) + (x * (2 : ℝ) ^ k - 1) ^ 3 / (6 * (x * (2 : ℝ) ^ k) * (x * (2 : ℝ) ^ k + 1))) - (k : ℝ) * 0.6931471803 := by have h2k_pos : (0 : ℝ) < (2 : ℝ) ^ k := by positivity have hlog_eq : Real.log (x * (2 : ℝ) ^ k) = Real.log x + (k : ℝ) * Real.log 2 := by rw [Real.log_mul (ne_of_gt hx) (ne_of_gt h2k_pos), Real.log_pow] have hlo := log_ge_pade hy have hhi := log_le_pade hy have h2lo : (0.6931471803 : ℝ) < Real.log 2 := Real.log_two_gt_d9 have h2hi : Real.log 2 < (0.6931471808 : ℝ) := Real.log_two_lt_d9 have hk_nn : (0 : ℝ) ≤ (k : ℝ) := Nat.cast_nonneg k constructor <;> nlinarith /-- Explicit 3-state irreducible metastable-trap Markov kernel (`d = 1/50, g = 1/10, b = 1/500`). Under coarse-graining `trapCoarse = (0, 0, 1)`, state `0` rapidly escapes macrostate `0`, while state `1` is a metastable core inside macrostate `0`. -/ noncomputable def trapKernel : Fin 3 → Fin 3 → ℝ | 0, 0 => 0 | 0, 1 => 0 | 0, 2 => 1 | 1, 0 => 0 | 1, 1 => 49 / 50 | 1, 2 => 1 / 50 | 2, 0 => 1 / 10 | 2, 1 => 1 / 500 | 2, 2 => 449 / 500 /-- Coarse-graining `π : Fin 3 → Fin 2` lumping `{0, 1} ↦ 0` and `{2} ↦ 1`. -/ def trapCoarse : Fin 3 → Fin 2 | 0 => 0 | 1 => 0 | 2 => 1 /-- Partition-blind global isotropic depolarizing noise `P_η = (1 - η) P + η U_3`. -/ noncomputable def noisyTrapKernel (η : ℝ) (i j : Fin 3) : ℝ := (1 - η) * trapKernel i j + η * (1 / 3) /-- Explicit closed-form rational stationary distribution `μ(η)` of `noisyTrapKernel η`. -/ noncomputable def trapStationary (η : ℝ) : Fin 3 → ℝ := let c := 1 - η let D1 := (49 * η + 1) / 50 let A := 1 + c / 10 + c / (500 * D1) let B := (η / 3) * (1 + 1 / D1) let μ2 := (1 - B) / A let μ0 := c * (1 / 10) * μ2 + η / 3 let μ1 := (c * (1 / 500) * μ2 + η / 3) / D1 fun i => match i with | 0 => μ0 | 1 => μ1 | 2 => μ2 lemma trapCoarse_surjective : Function.Surjective trapCoarse := by intro b; fin_cases b · exact ⟨0, rfl⟩ · exact ⟨2, rfl⟩ lemma noisyTrapKernel_stochastic {η : ℝ} (hη0 : 0 ≤ η) (hη1 : η ≤ 1) : IsStochastic (noisyTrapKernel η) := by intro i refine ⟨fun j => ?_, ?_⟩ · fin_cases i <;> fin_cases j <;> simp [noisyTrapKernel, trapKernel] <;> linarith · fin_cases i <;> simp [Fin.sum_univ_three, noisyTrapKernel, trapKernel] <;> ring lemma trapStationary_valid {η : ℝ} (hη0 : 0 ≤ η) (hη1 : η ≤ 1) : IsProbDist (trapStationary η) ∧ (∀ i, 0 < trapStationary η i) ∧ kernelStep (trapStationary η) (noisyTrapKernel η) = trapStationary η := by set c := 1 - η set D1 := (49 * η + 1) / 50 have hD1_pos : 0 < D1 := by simp [D1]; linarith set A := 1 + c / 10 + c / (500 * D1) have hA_pos : 0 < A := by have hc : 0 ≤ c := by simp [c]; linarith have h1 : 0 ≤ c / (500 * D1) := div_nonneg hc (by positivity) simp [A]; linarith set B := (η / 3) * (1 + 1 / D1) have h1B_pos : 0 < 1 - B := by have hrew : 1 - B = (3 + 96 * η - 49 * η ^ 2) / (3 * (49 * η + 1)) := by simp [B, D1]; field_simp [show 49 * η + 1 ≠ 0 by linarith]; ring rw [hrew] apply div_pos _ (by linarith) nlinarith have hμ2_pos : 0 < (1 - B) / A := div_pos h1B_pos hA_pos have hμ0_pos : 0 < c * (1 / 10) * ((1 - B) / A) + η / 3 := by rcases eq_or_lt_of_le hη0 with rfl | hpos · have : c = 1 := by simp [c] rw [this]; linarith · have hc : 0 ≤ c := by simp [c]; linarith nlinarith have hμ1_pos : 0 < (c * (1 / 500) * ((1 - B) / A) + η / 3) / D1 := by apply div_pos _ hD1_pos rcases eq_or_lt_of_le hη0 with rfl | hpos · have : c = 1 := by simp [c] rw [this]; linarith · have hc : 0 ≤ c := by simp [c]; linarith nlinarith have hsum : trapStationary η 0 + trapStationary η 1 + trapStationary η 2 = 1 := by dsimp only [trapStationary] change (c * (1 / 10) * ((1 - B) / A) + η / 3) + (c * (1 / 500) * ((1 - B) / A) + η / 3) / D1 + (1 - B) / A = 1 have hfac : (c * (1 / 10) * ((1 - B) / A) + η / 3) + (c * (1 / 500) * ((1 - B) / A) + η / 3) / D1 + (1 - B) / A = A * ((1 - B) / A) + B := by simp only [A, B]; field_simp [ne_of_gt hD1_pos]; ring rw [hfac, mul_div_cancel₀ _ (ne_of_gt hA_pos)]; ring have hpos_all : ∀ i : Fin 3, 0 < trapStationary η i := fun i => by fin_cases i · exact hμ0_pos · exact hμ1_pos · exact hμ2_pos have hdist : IsProbDist (trapStationary η) := by refine ⟨fun i => le_of_lt (hpos_all i), ?_⟩ rw [Fin.sum_univ_three]; exact hsum have hstat : kernelStep (trapStationary η) (noisyTrapKernel η) = trapStationary η := by ext j unfold kernelStep rw [Fin.sum_univ_three] have hstep_rew : ∀ j : Fin 3, trapStationary η 0 * noisyTrapKernel η 0 j + trapStationary η 1 * noisyTrapKernel η 1 j + trapStationary η 2 * noisyTrapKernel η 2 j = c * (trapStationary η 0 * trapKernel 0 j + trapStationary η 1 * trapKernel 1 j + trapStationary η 2 * trapKernel 2 j) + η / 3 := by intro j' simp only [noisyTrapKernel, c] linear_combination (η / 3) * hsum rw [hstep_rew j] fin_cases j · -- j = 0: c * (1/10 * μ2) + η/3 = μ0 simp only [trapKernel, mul_zero, zero_add] dsimp only [trapStationary] ring · -- j = 1: c * (49/50 * μ1 + 1/500 * μ2) + η/3 = μ1 simp only [trapKernel, mul_zero, zero_add] dsimp only [trapStationary] change c * ((c * (1 / 500) * ((1 - B) / A) + η / 3) / D1 * (49 / 50) + (1 - B) / A * (1 / 500)) + η / 3 = (c * (1 / 500) * ((1 - B) / A) + η / 3) / D1 have hD1_eq : 1 - c * (49 / 50) = D1 := by simp [D1, c]; ring field_simp [ne_of_gt hD1_pos] linear_combination -(c * (1 / 500) * ((1 - B) / A) + η / 3) * hD1_eq · -- j = 2: follows from sum = 1! have htot : (c * (trapStationary η 0 * trapKernel 0 0 + trapStationary η 1 * trapKernel 1 0 + trapStationary η 2 * trapKernel 2 0) + η / 3) + (c * (trapStationary η 0 * trapKernel 0 1 + trapStationary η 1 * trapKernel 1 1 + trapStationary η 2 * trapKernel 2 1) + η / 3) + (c * (trapStationary η 0 * trapKernel 0 2 + trapStationary η 1 * trapKernel 1 2 + trapStationary η 2 * trapKernel 2 2) + η / 3) = 1 := by simp only [trapKernel, c] linear_combination (1 - η) * hsum have h0 : c * (trapStationary η 0 * trapKernel 0 0 + trapStationary η 1 * trapKernel 1 0 + trapStationary η 2 * trapKernel 2 0) + η / 3 = trapStationary η 0 := by simp only [trapKernel, mul_zero, zero_add]; dsimp only [trapStationary]; ring have h1 : c * (trapStationary η 0 * trapKernel 0 1 + trapStationary η 1 * trapKernel 1 1 + trapStationary η 2 * trapKernel 2 1) + η / 3 = trapStationary η 1 := by simp only [trapKernel, mul_zero, zero_add]; dsimp only [trapStationary] change c * ((c * (1 / 500) * ((1 - B) / A) + η / 3) / D1 * (49 / 50) + (1 - B) / A * (1 / 500)) + η / 3 = (c * (1 / 500) * ((1 - B) / A) + η / 3) / D1 have hD1_eq : 1 - c * (49 / 50) = D1 := by simp [D1, c]; ring field_simp [ne_of_gt hD1_pos] linear_combination -(c * (1 / 500) * ((1 - B) / A) + η / 3) * hD1_eq change c * (trapStationary η 0 * trapKernel 0 2 + trapStationary η 1 * trapKernel 1 2 + trapStationary η 2 * trapKernel 2 2) + η / 3 = trapStationary η 2 linarith exact ⟨hdist, hpos_all, hstat⟩ /-- Exact 5-binary-entropy formula for `NTIC(noisyTrapKernel η, trapCoarse; trapStationary η)`: `NTIC = h(q_0) - 2 q_0 h(Q_{0,0}) - q_1 h(Q_{1,0}) + μ_0 h(P̄_{0,0}) + μ_1 h(P̄_{1,0})`. -/ lemma noisyTrapKernel_ntic_formula {η : ℝ} (hη0 : 0 ≤ η) (hη1 : η ≤ 1) : let P := noisyTrapKernel η let μ := trapStationary η let q0 := μ 0 + μ 1 let q1 := μ 2 let p00 := P 0 0 + P 0 1 let p10 := P 1 0 + P 1 1 let p20 := P 2 0 + P 2 1 let Q00 := (μ 0 * p00 + μ 1 * p10) / q0 ntic P trapCoarse μ = binEntropy q0 - 2 * q0 * binEntropy Q00 - q1 * binEntropy p20 + μ 0 * binEntropy p00 + μ 1 * binEntropy p10 := by intro P μ q0 q1 p00 p10 p20 Q00 have hP := noisyTrapKernel_stochastic hη0 hη1 obtain ⟨hμ, hμ_pos, hstat⟩ := trapStationary_valid hη0 hη1 have hntic := ntic_eq_two_macro_sub_micro hP trapCoarse_surjective hμ rw [hntic] -- Compute pushForward, lumpedRow, inducedMacroKernel explicitly! have hpush0 : pushForward trapCoarse μ 0 = q0 := by unfold pushForward have hfilt : univ.filter (fun i : Fin 3 => trapCoarse i = 0) = {0, 1} := by decide rw [hfilt]; simp [q0] have hpush1 : pushForward trapCoarse μ 1 = q1 := by unfold pushForward have hfilt : univ.filter (fun i : Fin 3 => trapCoarse i = 1) = {2} := by decide rw [hfilt]; simp [q1] have hq0_pos : 0 < q0 := add_pos (hμ_pos 0) (hμ_pos 1) have hq1_pos : 0 < q1 := hμ_pos 2 have hq_sum : q0 + q1 = 1 := by have := hμ.2; rw [Fin.sum_univ_three] at this; linarith have h1q0 : 1 - q0 = q1 := by linarith have hlump0 : ∀ i : Fin 3, lumpedRow P trapCoarse i 0 = P i 0 + P i 1 := fun i => by unfold lumpedRow pushForward have hfilt : univ.filter (fun j : Fin 3 => trapCoarse j = 0) = {0, 1} := by decide rw [hfilt]; simp have hlump1 : ∀ i : Fin 3, lumpedRow P trapCoarse i 1 = 1 - (P i 0 + P i 1) := fun i => by have hsum := (isStochastic_lumpedRow hP trapCoarse i).2 rw [Fin.sum_univ_two, hlump0 i] at hsum; linarith have hQ00_eq : inducedMacroKernel P trapCoarse μ 0 0 = Q00 := by unfold inducedMacroKernel have hne : pushForward trapCoarse μ 0 ≠ 0 := by rw [hpush0]; exact ne_of_gt hq0_pos rw [if_pos hne] have hfilt : univ.filter (fun i : Fin 3 => trapCoarse i = 0) = {0, 1} := by decide rw [hfilt, sum_pair (by decide : (0 : Fin 3) ≠ 1)] unfold condFiberDist rw [if_pos ⟨rfl, hne⟩, if_pos ⟨rfl, hne⟩, hpush0, hlump0 0, hlump0 1] dsimp only [Q00, p00, p10] field_simp [ne_of_gt hq0_pos] have hQ01_eq : inducedMacroKernel P trapCoarse μ 0 1 = 1 - Q00 := by have hsum := (isStochastic_inducedMacroKernel hP trapCoarse_surjective hμ 0).2 rw [Fin.sum_univ_two, hQ00_eq] at hsum; linarith have hQ10_eq : inducedMacroKernel P trapCoarse μ 1 0 = p20 := by unfold inducedMacroKernel have hne : pushForward trapCoarse μ 1 ≠ 0 := by rw [hpush1]; exact ne_of_gt hq1_pos rw [if_pos hne] have hfilt : univ.filter (fun i : Fin 3 => trapCoarse i = 1) = {2} := by decide rw [hfilt, sum_singleton] unfold condFiberDist rw [if_pos ⟨rfl, hne⟩, hpush1, hlump0 2] dsimp only [q1, p20] rw [div_mul_eq_mul_div, mul_div_cancel_left₀ _ (ne_of_gt hq1_pos)] have hQ11_eq : inducedMacroKernel P trapCoarse μ 1 1 = 1 - p20 := by have hsum := (isStochastic_inducedMacroKernel hP trapCoarse_surjective hμ 1).2 rw [Fin.sum_univ_two, hQ10_eq] at hsum; linarith have hstep_eq : kernelStep (pushForward trapCoarse μ) (inducedMacroKernel P trapCoarse μ) = pushForward trapCoarse μ := by rw [kernelStep_inducedMacroKernel_eq_pushForward P trapCoarse hμ, hstat] have hstep_micro : kernelStep μ (lumpedRow P trapCoarse) = pushForward trapCoarse μ := by rw [← pushForward_kernelStep_eq_kernelStep_lumpedRow P trapCoarse μ, hstat] have hH_push : shannonEntropy (pushForward trapCoarse μ) = binEntropy q0 := by unfold shannonEntropy binEntropy rw [Fin.sum_univ_two, hpush0, hpush1, h1q0] have hH_Q0 : shannonEntropy (inducedMacroKernel P trapCoarse μ 0) = binEntropy Q00 := by unfold shannonEntropy binEntropy rw [Fin.sum_univ_two, hQ00_eq, hQ01_eq] have hH_Q1 : shannonEntropy (inducedMacroKernel P trapCoarse μ 1) = binEntropy p20 := by unfold shannonEntropy binEntropy rw [Fin.sum_univ_two, hQ10_eq, hQ11_eq] have hH_P0 : shannonEntropy (lumpedRow P trapCoarse 0) = binEntropy p00 := by unfold shannonEntropy binEntropy rw [Fin.sum_univ_two, hlump0 0, hlump1 0] have hH_P1 : shannonEntropy (lumpedRow P trapCoarse 1) = binEntropy p10 := by unfold shannonEntropy binEntropy rw [Fin.sum_univ_two, hlump0 1, hlump1 1] have hH_P2 : shannonEntropy (lumpedRow P trapCoarse 2) = binEntropy p20 := by unfold shannonEntropy binEntropy rw [Fin.sum_univ_two, hlump0 2, hlump1 2] unfold macroMutualInfo microToMacroMutualInfo mutualInfo rw [hstep_eq, hstep_micro, hH_push, Fin.sum_univ_two, Fin.sum_univ_three, hpush0, hpush1, hH_Q0, hH_Q1, hH_P0, hH_P1, hH_P2] dsimp only [q1] ring /-- Helper to bound `negMulLog x` from `log_bounds_of_pow2_neg`. -/ lemma negMulLog_bounds_of_pow2 {x : ℝ} (hx : 0 < x) (k : ℕ) (hy : 1 ≤ x * (2 : ℝ) ^ k) : -x * ((2 * (x * (2 : ℝ) ^ k - 1) / (x * (2 : ℝ) ^ k + 1) + (x * (2 : ℝ) ^ k - 1) ^ 3 / (6 * (x * (2 : ℝ) ^ k) * (x * (2 : ℝ) ^ k + 1))) - (k : ℝ) * 0.6931471803) ≤ negMulLog x ∧ negMulLog x ≤ -x * ((2 * ((x * (2 : ℝ) ^ k - 1) / (x * (2 : ℝ) ^ k + 1)) + (2 / 3) * ((x * (2 : ℝ) ^ k - 1) / (x * (2 : ℝ) ^ k + 1)) ^ 3) - (k : ℝ) * 0.6931471808) := by obtain ⟨hlo, hhi⟩ := log_bounds_of_pow2_neg hx k hy unfold negMulLog constructor <;> nlinarith /-- Helper to bound `binEntropy p` for rational `p ∈ (0, 1)` using powers of `2`. -/ lemma binEntropy_bounds_of_pow2 {p : ℝ} (hp0 : 0 < p) (hp1 : p < 1) (k₁ k₂ : ℕ) (hy₁ : 1 ≤ p * (2 : ℝ) ^ k₁) (hy₂ : 1 ≤ (1 - p) * (2 : ℝ) ^ k₂) {lo hi : ℝ} (hlo : lo ≤ -p * ((2 * (p * (2 : ℝ) ^ k₁ - 1) / (p * (2 : ℝ) ^ k₁ + 1) + (p * (2 : ℝ) ^ k₁ - 1) ^ 3 / (6 * (p * (2 : ℝ) ^ k₁) * (p * (2 : ℝ) ^ k₁ + 1))) - (k₁ : ℝ) * 0.6931471803) + -(1 - p) * ((2 * ((1 - p) * (2 : ℝ) ^ k₂ - 1) / ((1 - p) * (2 : ℝ) ^ k₂ + 1) + ((1 - p) * (2 : ℝ) ^ k₂ - 1) ^ 3 / (6 * ((1 - p) * (2 : ℝ) ^ k₂) * ((1 - p) * (2 : ℝ) ^ k₂ + 1))) - (k₂ : ℝ) * 0.6931471803)) (hhi : -p * ((2 * ((p * (2 : ℝ) ^ k₁ - 1) / (p * (2 : ℝ) ^ k₁ + 1)) + (2 / 3) * ((p * (2 : ℝ) ^ k₁ - 1) / (p * (2 : ℝ) ^ k₁ + 1)) ^ 3) - (k₁ : ℝ) * 0.6931471808) + -(1 - p) * ((2 * (((1 - p) * (2 : ℝ) ^ k₂ - 1) / ((1 - p) * (2 : ℝ) ^ k₂ + 1)) + (2 / 3) * (((1 - p) * (2 : ℝ) ^ k₂ - 1) / ((1 - p) * (2 : ℝ) ^ k₂ + 1)) ^ 3) - (k₂ : ℝ) * 0.6931471808) ≤ hi) : lo ≤ binEntropy p ∧ binEntropy p ≤ hi := by obtain ⟨h1lo, h1hi⟩ := negMulLog_bounds_of_pow2 hp0 k₁ hy₁ obtain ⟨h2lo, h2hi⟩ := negMulLog_bounds_of_pow2 (by linarith : 0 < 1 - p) k₂ hy₂ unfold binEntropy exact ⟨by linarith, by linarith⟩ /-- **Theorem 20 (Global Isotropic Noise-Induced Re-Entrant Informational Closure / Stochastic Resonance of NTIC)**: On the 3-state irreducible metastable-trap chain `trapKernel` under **completely partition-blind** global isotropic noise `P_η = (1 - η) P + η U_3` with stationary distribution `μ(η)`: 1. At zero noise (`η = 0`): `NTIC < 0` (no informational closure). 2. At intermediate global noise (`η = 1/16`): `NTIC > 0` (emergent informational closure CREATED by global white noise!). 3. At high global noise (`η = 1/2`): `NTIC < 0` again, and at thermal death (`η = 1`): `NTIC = 0`. 4. Consequently, there exist **TWO strictly interior critical noise thresholds** `0 < η₁ < 1/16 < η₂ < 1/2` with `NTIC(η₁) = 0` and `NTIC(η₂) = 0`, framing a **re-entrant island of noise-induced informational closure**. -/ theorem globalIsotropicNoise_ntic_sign_flip : ntic (noisyTrapKernel 0) trapCoarse (trapStationary 0) < 0 ∧ 0 < ntic (noisyTrapKernel (1 / 16)) trapCoarse (trapStationary (1 / 16)) ∧ ntic (noisyTrapKernel (1 / 2)) trapCoarse (trapStationary (1 / 2)) < 0 ∧ ntic (noisyTrapKernel 1) trapCoarse (trapStationary 1) = 0 ∧ (∃ η₁ ∈ Set.Ioo (0 : ℝ) (1 / 16), ntic (noisyTrapKernel η₁) trapCoarse (trapStationary η₁) = 0) ∧ (∃ η₂ ∈ Set.Ioo (1 / 16 : ℝ) (1 / 2), ntic (noisyTrapKernel η₂) trapCoarse (trapStationary η₂) = 0) := by -- 1. Evaluate at η = 0 have hneg0 : ntic (noisyTrapKernel 0) trapCoarse (trapStationary 0) < 0 := by rw [noisyTrapKernel_ntic_formula (by norm_num) (by norm_num)] have hμ0 : trapStationary 0 0 = 1 / 12 := by simp [trapStationary]; norm_num have hμ1 : trapStationary 0 1 = 1 / 12 := by simp [trapStationary]; norm_num have hμ2 : trapStationary 0 2 = 5 / 6 := by simp [trapStationary]; norm_num have hp0 : noisyTrapKernel 0 0 0 + noisyTrapKernel 0 0 1 = 0 := by simp [noisyTrapKernel, trapKernel] have hp1 : noisyTrapKernel 0 1 0 + noisyTrapKernel 0 1 1 = 49 / 50 := by simp [noisyTrapKernel, trapKernel] have hp2 : noisyTrapKernel 0 2 0 + noisyTrapKernel 0 2 1 = 51 / 500 := by simp [noisyTrapKernel, trapKernel]; norm_num simp only [hμ0, hμ1, hμ2, hp0, hp1, hp2] norm_num only rw [binEntropy_zero] have hq := (binEntropy_bounds_of_pow2 (p := 1 / 6) (by norm_num) (by norm_num) 3 1 (by norm_num) (by norm_num) (lo := 0.450) (hi := 0.451) (by norm_num) (by norm_num)).2 have hQ0 := (binEntropy_bounds_of_pow2 (p := 49 / 100) (by norm_num) (by norm_num) 2 1 (by norm_num) (by norm_num) (lo := 0.692) (hi := 0.694) (by norm_num) (by norm_num)).1 have hQ1 := (binEntropy_bounds_of_pow2 (p := 51 / 500) (by norm_num) (by norm_num) 4 1 (by norm_num) (by norm_num) (lo := 0.328) (hi := 0.331) (by norm_num) (by norm_num)).1 have hP1 := (binEntropy_bounds_of_pow2 (p := 49 / 50) (by norm_num) (by norm_num) 1 6 (by norm_num) (by norm_num) (lo := 0.096) (hi := 0.100) (by norm_num) (by norm_num)).2 linarith -- 2. Evaluate at η = 1/16 have hpos16 : 0 < ntic (noisyTrapKernel (1 / 16)) trapCoarse (trapStationary (1 / 16)) := by rw [noisyTrapKernel_ntic_formula (by norm_num) (by norm_num)] have hμ0 : trapStationary (1 / 16) 0 = 568 / 6969 := by simp [trapStationary]; norm_num have hμ1 : trapStationary (1 / 16) 1 = 1891 / 6969 := by simp [trapStationary]; norm_num have hμ2 : trapStationary (1 / 16) 2 = 4510 / 6969 := by simp [trapStationary]; norm_num have hp0 : noisyTrapKernel (1 / 16) 0 0 + noisyTrapKernel (1 / 16) 0 1 = 1 / 24 := by simp [noisyTrapKernel, trapKernel]; norm_num have hp1 : noisyTrapKernel (1 / 16) 1 0 + noisyTrapKernel (1 / 16) 1 1 = 461 / 480 := by simp [noisyTrapKernel, trapKernel]; norm_num have hp2 : noisyTrapKernel (1 / 16) 2 0 + noisyTrapKernel (1 / 16) 2 1 = 659 / 4800 := by simp [noisyTrapKernel, trapKernel]; norm_num simp only [hμ0, hμ1, hμ2, hp0, hp1, hp2] norm_num only have hq := (binEntropy_bounds_of_pow2 (p := 2459 / 6969) (by norm_num) (by norm_num) 2 1 (by norm_num) (by norm_num) (lo := 0.649) (hi := 0.650) (by norm_num) (by norm_num)).1 have hQ0 := (binEntropy_bounds_of_pow2 (p := 883111 / 1180320) (by norm_num) (by norm_num) 1 2 (by norm_num) (by norm_num) (lo := 0.564) (hi := 0.565) (by norm_num) (by norm_num)).2 have hQ1 := (binEntropy_bounds_of_pow2 (p := 659 / 4800) (by norm_num) (by norm_num) 3 1 (by norm_num) (by norm_num) (lo := 0.399) (hi := 0.401) (by norm_num) (by norm_num)).2 have hP0 := (binEntropy_bounds_of_pow2 (p := 1 / 24) (by norm_num) (by norm_num) 5 1 (by norm_num) (by norm_num) (lo := 0.172) (hi := 0.175) (by norm_num) (by norm_num)).1 have hP1 := (binEntropy_bounds_of_pow2 (p := 461 / 480) (by norm_num) (by norm_num) 1 5 (by norm_num) (by norm_num) (lo := 0.165) (hi := 0.168) (by norm_num) (by norm_num)).1 linarith -- 3. Evaluate at η = 1/2 have hnegHalf : ntic (noisyTrapKernel (1 / 2)) trapCoarse (trapStationary (1 / 2)) < 0 := by rw [noisyTrapKernel_ntic_formula (by norm_num) (by norm_num)] have hμ0 : trapStationary (1 / 2) 0 = 614 / 3219 := by simp [trapStationary]; norm_num have hμ1 : trapStationary (1 / 2) 1 = 1055 / 3219 := by simp [trapStationary]; norm_num have hμ2 : trapStationary (1 / 2) 2 = 1550 / 3219 := by simp [trapStationary]; norm_num have hp0 : noisyTrapKernel (1 / 2) 0 0 + noisyTrapKernel (1 / 2) 0 1 = 1 / 3 := by simp [noisyTrapKernel, trapKernel]; norm_num have hp1 : noisyTrapKernel (1 / 2) 1 0 + noisyTrapKernel (1 / 2) 1 1 = 247 / 300 := by simp [noisyTrapKernel, trapKernel]; norm_num have hp2 : noisyTrapKernel (1 / 2) 2 0 + noisyTrapKernel (1 / 2) 2 1 = 1153 / 3000 := by simp [noisyTrapKernel, trapKernel]; norm_num simp only [hμ0, hμ1, hμ2, hp0, hp1, hp2] norm_num only have hq := (binEntropy_bounds_of_pow2 (p := 1669 / 3219) (by norm_num) (by norm_num) 1 2 (by norm_num) (by norm_num) (lo := 0.691) (hi := 0.694) (by norm_num) (by norm_num)).2 have hQ0 := (binEntropy_bounds_of_pow2 (p := 64397 / 100140) (by norm_num) (by norm_num) 1 2 (by norm_num) (by norm_num) (lo := 0.651) (hi := 0.653) (by norm_num) (by norm_num)).1 have hQ1 := (binEntropy_bounds_of_pow2 (p := 1153 / 3000) (by norm_num) (by norm_num) 2 1 (by norm_num) (by norm_num) (lo := 0.665) (hi := 0.667) (by norm_num) (by norm_num)).1 have hP0 := (binEntropy_bounds_of_pow2 (p := 1 / 3) (by norm_num) (by norm_num) 2 1 (by norm_num) (by norm_num) (lo := 0.635) (hi := 0.638) (by norm_num) (by norm_num)).2 have hP1 := (binEntropy_bounds_of_pow2 (p := 247 / 300) (by norm_num) (by norm_num) 1 3 (by norm_num) (by norm_num) (lo := 0.466) (hi := 0.468) (by norm_num) (by norm_num)).2 linarith -- 4. Evaluate at η = 1 (thermal death: NTIC = 0) have hzero1 : ntic (noisyTrapKernel 1) trapCoarse (trapStationary 1) = 0 := by rw [noisyTrapKernel_ntic_formula (by norm_num) (by norm_num)] have hμ0 : trapStationary 1 0 = 1 / 3 := by simp [trapStationary] have hμ1 : trapStationary 1 1 = 1 / 3 := by simp [trapStationary]; norm_num have hμ2 : trapStationary 1 2 = 1 / 3 := by simp [trapStationary]; norm_num have hp0 : noisyTrapKernel 1 0 0 + noisyTrapKernel 1 0 1 = 2 / 3 := by simp [noisyTrapKernel, trapKernel]; norm_num have hp1 : noisyTrapKernel 1 1 0 + noisyTrapKernel 1 1 1 = 2 / 3 := by simp [noisyTrapKernel, trapKernel]; norm_num have hp2 : noisyTrapKernel 1 2 0 + noisyTrapKernel 1 2 1 = 2 / 3 := by simp [noisyTrapKernel, trapKernel]; norm_num simp only [hμ0, hμ1, hμ2, hp0, hp1, hp2] norm_num only ring -- 5. Continuity of η ↦ ntic(noisyTrapKernel η) on [0, 1] + IVT for η₁ and η₂! let F : ℝ → ℝ := fun η => ntic (noisyTrapKernel η) trapCoarse (trapStationary η) have hF_cont : ContinuousOn F (Set.Icc 0 1) := by have hD1_ne : ∀ η ∈ Set.Icc (0 : ℝ) 1, (49 * η + 1) / 50 ≠ 0 := fun η hη => by linarith [hη.1] have hA_ne : ∀ η ∈ Set.Icc (0 : ℝ) 1, 1 + (1 - η) / 10 + (1 - η) / (500 * ((49 * η + 1) / 50)) ≠ 0 := fun η hη => by have h1 : 0 ≤ (1 - η) / (500 * ((49 * η + 1) / 50)) := div_nonneg (by linarith [hη.2]) (by linarith [hη.1]) linarith [hη.2] have hμ_cont : ∀ i : Fin 3, ContinuousOn (fun η => trapStationary η i) (Set.Icc 0 1) := by intro i have hD1 : ContinuousOn (fun η : ℝ => (49 * η + 1) / 50) (Set.Icc 0 1) := by fun_prop have hA : ContinuousOn (fun η : ℝ => 1 + (1 - η) / 10 + (1 - η) / (500 * ((49 * η + 1) / 50))) (Set.Icc 0 1) := by refine (ContinuousOn.add ?_ ?_) · fun_prop · exact ContinuousOn.div (by fun_prop) (continuousOn_const.mul hD1) (fun η hη => mul_ne_zero (by norm_num) (hD1_ne η hη)) have hB : ContinuousOn (fun η : ℝ => (η / 3) * (1 + 1 / ((49 * η + 1) / 50))) (Set.Icc 0 1) := ContinuousOn.mul (by fun_prop) (continuousOn_const.add (continuousOn_const.div hD1 hD1_ne)) have hμ2 : ContinuousOn (fun η : ℝ => (1 - (η / 3) * (1 + 1 / ((49 * η + 1) / 50))) / (1 + (1 - η) / 10 + (1 - η) / (500 * ((49 * η + 1) / 50)))) (Set.Icc 0 1) := (continuousOn_const.sub hB).div hA hA_ne fin_cases i · exact ((continuousOn_const.sub continuousOn_id).mul continuousOn_const |>.mul hμ2).add (by fun_prop) · exact (((continuousOn_const.sub continuousOn_id).mul continuousOn_const |>.mul hμ2).add (by fun_prop)).div hD1 hD1_ne · exact hμ2 have hq0_cont : ContinuousOn (fun η => trapStationary η 0 + trapStationary η 1) (Set.Icc 0 1) := (hμ_cont 0).add (hμ_cont 1) have hq0_ne : ∀ η ∈ Set.Icc (0 : ℝ) 1, trapStationary η 0 + trapStationary η 1 ≠ 0 := fun η hη => by obtain ⟨_, hpos, _⟩ := trapStationary_valid hη.1 hη.2 exact ne_of_gt (add_pos (hpos 0) (hpos 1)) have hp_cont : ∀ i : Fin 3, ContinuousOn (fun η => noisyTrapKernel η i 0 + noisyTrapKernel η i 1) (Set.Icc 0 1) := fun i => by unfold noisyTrapKernel; fun_prop have hQ00_cont : ContinuousOn (fun η => (trapStationary η 0 * (noisyTrapKernel η 0 0 + noisyTrapKernel η 0 1) + trapStationary η 1 * (noisyTrapKernel η 1 0 + noisyTrapKernel η 1 1)) / (trapStationary η 0 + trapStationary η 1)) (Set.Icc 0 1) := (((hμ_cont 0).mul (hp_cont 0)).add ((hμ_cont 1).mul (hp_cont 1))).div hq0_cont hq0_ne have hG_cont : ContinuousOn (fun η => binEntropy (trapStationary η 0 + trapStationary η 1) - 2 * (trapStationary η 0 + trapStationary η 1) * binEntropy ((trapStationary η 0 * (noisyTrapKernel η 0 0 + noisyTrapKernel η 0 1) + trapStationary η 1 * (noisyTrapKernel η 1 0 + noisyTrapKernel η 1 1)) / (trapStationary η 0 + trapStationary η 1)) - trapStationary η 2 * binEntropy (noisyTrapKernel η 2 0 + noisyTrapKernel η 2 1) + trapStationary η 0 * binEntropy (noisyTrapKernel η 0 0 + noisyTrapKernel η 0 1) + trapStationary η 1 * binEntropy (noisyTrapKernel η 1 0 + noisyTrapKernel η 1 1)) (Set.Icc 0 1) := by refine ((((continuous_binEntropy.comp_continuousOn hq0_cont).sub ((continuousOn_const.mul hq0_cont).mul (continuous_binEntropy.comp_continuousOn hQ00_cont))).sub ((hμ_cont 2).mul (continuous_binEntropy.comp_continuousOn (hp_cont 2)))).add ((hμ_cont 0).mul (continuous_binEntropy.comp_continuousOn (hp_cont 0)))).add ((hμ_cont 1).mul (continuous_binEntropy.comp_continuousOn (hp_cont 1))) exact hG_cont.congr fun η hη => noisyTrapKernel_ntic_formula hη.1 hη.2 have hex1 : ∃ η₁ ∈ Set.Ioo (0 : ℝ) (1 / 16), F η₁ = 0 := by have hivt := intermediate_value_Icc (a := (0 : ℝ)) (b := 1 / 16) (by norm_num) (hF_cont.mono (Set.Icc_subset_Icc le_rfl (by norm_num))) obtain ⟨η₁, hmem, heq⟩ := hivt ⟨le_of_lt hneg0, le_of_lt hpos16⟩ refine ⟨η₁, ⟨?_, ?_⟩, heq⟩ · rcases eq_or_lt_of_le hmem.1 with rfl | h · exact absurd heq (ne_of_lt hneg0) · exact h · rcases eq_or_lt_of_le hmem.2 with rfl | h · exact absurd heq (ne_of_gt hpos16) · exact h have hex2 : ∃ η₂ ∈ Set.Ioo (1 / 16 : ℝ) (1 / 2), F η₂ = 0 := by have hivt := intermediate_value_Icc' (a := (1 / 16 : ℝ)) (b := 1 / 2) (by norm_num) (hF_cont.mono (Set.Icc_subset_Icc (by norm_num) (by norm_num))) obtain ⟨η₂, hmem, heq⟩ := hivt ⟨le_of_lt hnegHalf, le_of_lt hpos16⟩ refine ⟨η₂, ⟨?_, ?_⟩, heq⟩ · rcases eq_or_lt_of_le hmem.1 with rfl | h · exact absurd heq (ne_of_gt hpos16) · exact h · rcases eq_or_lt_of_le hmem.2 with rfl | h · exact absurd heq (ne_of_lt hnegHalf) · exact h exact ⟨hneg0, hpos16, hnegHalf, hzero1, hex1, hex2⟩ /-! ### Part 6D: Strongly Lumpable `d`-Spin Binary Parity & Exact Rosas–Mediano Predictive Synergy `Ψ_d(p)` -/ /-- Exact binary parity of a `d`-spin configuration `x : Fin d → Bool`. -/ def finParity : {d : ℕ} → (Fin d → Bool) → Bool | 0, _ => false | _ + 1, x => xor (x 0) (finParity (fun i => x i.succ)) /-- Independent per-spin binary symmetric flip kernel `BSC(p)^⊗d` on `Fin d → Bool`. -/ def spinKernel {d : ℕ} (p : ℝ) (x y : Fin d → Bool) : ℝ := ∏ r : Fin d, if x r = y r then 1 - p else p /-- Exact `d`-spin macro parity kernel `Q_d(p)` with stay probability `(1 + (1 - 2p)^d) / 2`. -/ noncomputable def parityMacroKernel (d : ℕ) (p : ℝ) (a b : Bool) : ℝ := if a = b then (1 + (1 - 2 * p) ^ d) / 2 else (1 - (1 - 2 * p) ^ d) / 2 /-- Single-spin marginal transition kernel `K^{(r)}_{c, b} = ℙ_u(M_{t+1} = b | X_t^{(r)} = c)` under uniform micro-distribution on `Fin d → Bool`. -/ noncomputable def singleSpinMacroKernel {d : ℕ} (P : (Fin d → Bool) → (Fin d → Bool) → ℝ) (r : Fin d) (c b : Bool) : ℝ := (1 / ((univ.filter (fun x : Fin d → Bool => x r = c)).card : ℝ)) * ∑ x ∈ univ.filter (fun x : Fin d → Bool => x r = c), lumpedRow P finParity x b /-- **Rosas–Mediano Predictive Synergy Criterion `Ψ`** (PLOS Comp. Biol. 2020): `Ψ(P; u) = I_u(M_{t+1}; M_t) - ∑_{r=1}^d I_u(M_{t+1}; X_t^{(r)})`. -/ noncomputable def predictiveSynergy {d : ℕ} (P : (Fin d → Bool) → (Fin d → Bool) → ℝ) : ℝ := let u : (Fin d → Bool) → ℝ := fun _ => 1 / (Fintype.card (Fin d → Bool) : ℝ) let uBool : Bool → ℝ := fun _ => 1 / 2 macroMutualInfo P finParity u - ∑ r : Fin d, mutualInfo uBool (singleSpinMacroKernel P r) lemma spinKernel_lumped_exact : ∀ (d : ℕ) (p : ℝ) (x : Fin d → Bool) (b : Bool), lumpedRow (spinKernel p) finParity x b = parityMacroKernel d p (finParity x) b | 0, p, x, b => by unfold lumpedRow pushForward spinKernel parityMacroKernel finParity cases b <;> simp [pow_zero] | d + 1, p, x, b => by unfold lumpedRow pushForward -- Split y : Fin (d + 1) → Bool into (y 0, fun i => y i.succ) via Fin.consEquiv let e := (Fin.consEquiv (fun _ : Fin (d + 1) => Bool)) have hsum_eq : ∑ y ∈ univ.filter (fun y : Fin (d + 1) → Bool => finParity y = b), spinKernel p x y = ∑ y : Fin (d + 1) → Bool, if finParity y = b then spinKernel p x y else 0 := by rw [sum_filter] rw [hsum_eq, ← Equiv.sum_comp e, Fintype.sum_prod_type] have hcons_par : ∀ (y0 : Bool) (y' : Fin d → Bool), finParity (e (y0, y')) = xor y0 (finParity y') := fun y0 y' => by simp [e, finParity, Fin.consEquiv] have hcons_ker : ∀ (y0 : Bool) (y' : Fin d → Bool), spinKernel p x (e (y0, y')) = (if x 0 = y0 then 1 - p else p) * spinKernel p (fun i => x i.succ) y' := fun y0 y' => by unfold spinKernel rw [Fin.prod_univ_succ] simp [e, Fin.consEquiv] simp_rw [hcons_par, hcons_ker] have hbranch : ∀ y0 : Bool, ∑ y' : Fin d → Bool, (if xor y0 (finParity y') = b then (if x 0 = y0 then 1 - p else p) * spinKernel p (fun i => x i.succ) y' else 0) = (if x 0 = y0 then 1 - p else p) * parityMacroKernel d p (finParity (fun i => x i.succ)) (xor y0 b) := by intro y0 have hiff : ∀ y' : Fin d → Bool, (xor y0 (finParity y') = b) ↔ (finParity y' = xor y0 b) := by intro y'; cases y0 <;> cases finParity y' <;> cases b <;> decide have hrew : ∀ y' : Fin d → Bool, (if xor y0 (finParity y') = b then (if x 0 = y0 then 1 - p else p) * spinKernel p (fun i => x i.succ) y' else 0) = (if x 0 = y0 then 1 - p else p) * (if finParity y' = xor y0 b then spinKernel p (fun i => x i.succ) y' else 0) := fun y' => by simp only [hiff y']; split_ifs <;> ring simp_rw [hrew, ← mul_sum, ← sum_filter] congr 1 exact spinKernel_lumped_exact d p (fun i => x i.succ) (xor y0 b) simp_rw [hbranch, Fintype.sum_bool] have hpar_step : finParity x = xor (x 0) (finParity (fun i => x i.succ)) := rfl rw [hpar_step] unfold parityMacroKernel cases hx0 : x 0 <;> cases hpx : finParity (fun i => x i.succ) <;> cases b <;> simp [pow_succ'] <;> ring /-- **Theorem 21 (Exact Strong Lumpability, Zero Marginal Information, & Exact Rosas–Mediano Predictive Synergy of `d`-Spin Parity)**: For every `d ≥ 2` and spin-flip noise `p ∈ [0, 1]`: 1. `spinKernel p` is row-stochastic and **exact strongly lumpable** under `finParity` (`DIC = 0`). 2. Its macro-kernel is `Q_d(p)` with exact Dobrushin contraction `τ_1(Q_d(p)) = |1 - 2 p|^d`. 3. Every single spin `r : Fin d` has **ZERO** marginal mutual information with `M_{t+1}`: `I_u(M_{t+1}; X_t^{(r)}) = 0`. 4. Rosas–Mediano's predictive synergy equals the exact closed form `Ψ_d(p) = ln 2 - h((1 + (1 - 2p)^d) / 2)`, which is **strictly positive** for all `p ≠ 1/2` and vanishes identically at `p = 1/2`. -/ theorem paritySpinKernel_exact_synergy (d : ℕ) (hd : 2 ≤ d) {p : ℝ} (hp0 : 0 ≤ p) (hp1 : p ≤ 1) : let P := @spinKernel d p let u : (Fin d → Bool) → ℝ := fun _ => 1 / (Fintype.card (Fin d → Bool) : ℝ) let uBool : Bool → ℝ := fun _ => 1 / 2 IsStochastic P ∧ IsStronglyLumpable P finParity ∧ dicDefect P finParity u = 0 ∧ dobrushinCoeff (parityMacroKernel d p) = |1 - 2 * p| ^ d ∧ (∀ r : Fin d, mutualInfo uBool (singleSpinMacroKernel P r) = 0) ∧ predictiveSynergy P = Real.log 2 - binEntropy ((1 + (1 - 2 * p) ^ d) / 2) ∧ (p ≠ 1 / 2 → 0 < predictiveSynergy P) ∧ (p = 1 / 2 → predictiveSynergy P = 0) := by intro P u uBool have hcard_pos : (0 : ℝ) < (Fintype.card (Fin d → Bool) : ℝ) := Nat.cast_pos.mpr Fintype.card_pos have hu_dist : IsProbDist u := ⟨fun _ => by dsimp [u]; positivity, by simp [u]⟩ have hu_pos : ∀ x, 0 < u x := fun _ => by dsimp [u]; positivity have huBool : IsProbDist uBool := ⟨fun _ => by dsimp [uBool]; norm_num, by simp [uBool]⟩ have hP_stoch : IsStochastic P := by intro x refine ⟨fun y => prod_nonneg fun r _ => by split_ifs <;> linarith, ?_⟩ rw [← sum_fiberwise_eq finParity (P x)] have h1 : ∀ b : Bool, ∑ y ∈ univ.filter (fun y => finParity y = b), P x y = parityMacroKernel d p (finParity x) b := fun b => spinKernel_lumped_exact d p x b simp_rw [h1, Fintype.sum_bool, parityMacroKernel] cases finParity x <;> simp <;> ring have hstrong : IsStronglyLumpable P finParity := by intro x x' hpar b rw [spinKernel_lumped_exact d p x b, spinKernel_lumped_exact d p x' b, hpar] -- Helper: flipping coordinate r flips finParity! have hflip_par : ∀ (d' : ℕ) (r : Fin d') (x : Fin d' → Bool), finParity (Function.update x r (!x r)) = !finParity x := by intro d' induction d' with | zero => intro r; exact Fin.elim0 r | succ k ih => intro r x refine Fin.cases ?_ ?_ r · -- r = 0 have htail : (fun i : Fin k => Function.update x 0 (!x 0) i.succ) = (fun i => x i.succ) := by ext i; simp simp only [finParity, Function.update_self, htail] cases x 0 <;> cases finParity (fun i => x i.succ) <;> rfl · -- r = j.succ intro j have hhead : Function.update x j.succ (!x j.succ) 0 = x 0 := Function.update_of_ne (Fin.succ_ne_zero j).symm _ _ have htail : (fun i : Fin k => Function.update x j.succ (!x j.succ) i.succ) = Function.update (fun i => x i.succ) j (!(x j.succ)) := by ext i by_cases hij : i = j · subst hij; simp · have hne : i.succ ≠ j.succ := fun h => hij (Fin.succ_injective _ h) simp [Function.update_of_ne hne, Function.update_of_ne hij] simp only [finParity, hhead, htail, ih j (fun i => x i.succ)] cases x 0 <;> cases finParity (fun i => x i.succ) <;> rfl have hsurj : Function.Surjective (@finParity d) := by intro b let x0 : Fin d → Bool := fun _ => false by_cases hb : finParity x0 = b · exact ⟨x0, hb⟩ · refine ⟨Function.update x0 ⟨0, by omega⟩ (!x0 ⟨0, by omega⟩), ?_⟩ rw [hflip_par d ⟨0, by omega⟩ x0] cases h1 : finParity x0 <;> cases b <;> simp_all have hdic0 : dicDefect P finParity u = 0 := (dicDefect_eq_zero_iff_stronglyLumpable hP_stoch hsurj hu_dist hu_pos).mpr hstrong -- Dobrushin coefficient of parityMacroKernel d p = |1 - 2p|^d have hdob : dobrushinCoeff (parityMacroKernel d p) = |1 - 2 * p| ^ d := by have htv_tf : tvDist (parityMacroKernel d p true) (parityMacroKernel d p false) = |1 - 2 * p| ^ d := by unfold tvDist parityMacroKernel rw [Fintype.sum_bool] simp only [↓reduceIte, Bool.true_eq_false, Bool.false_eq_true] have h1 : (1 + (1 - 2 * p) ^ d) / 2 - (1 - (1 - 2 * p) ^ d) / 2 = (1 - 2 * p) ^ d := by ring have h2 : (1 - (1 - 2 * p) ^ d) / 2 - (1 + (1 - 2 * p) ^ d) / 2 = -((1 - 2 * p) ^ d) := by ring rw [h1, h2, abs_neg, abs_pow] ring apply le_antisymm · apply dobrushinCoeff_le_of_forall _ (by positivity) intro a b cases a <;> cases b · rw [tvDist_self]; positivity · rw [tvDist_comm, htv_tf] · rw [htv_tf] · rw [tvDist_self]; positivity · rw [← htv_tf]; exact tvDist_le_dobrushinCoeff (parityMacroKernel d p) true false -- Parity fibers have equal size (so pushForward finParity u = uBool) have hpush_u : pushForward finParity u = uBool := by let flip0 : (Fin d → Bool) ≃ (Fin d → Bool) := { toFun := fun x => Function.update x ⟨0, by omega⟩ (!x ⟨0, by omega⟩) invFun := fun x => Function.update x ⟨0, by omega⟩ (!x ⟨0, by omega⟩) left_inv := fun x => by ext r; by_cases hr : r = ⟨0, by omega⟩ <;> simp [hr] right_inv := fun x => by ext r; by_cases hr : r = ⟨0, by omega⟩ <;> simp [hr] } have hcard_eq : (univ.filter (fun x : Fin d → Bool => finParity x = true)).card = (univ.filter (fun x : Fin d → Bool => finParity x = false)).card := by refine card_bij (fun x _ => flip0 x) ?_ ?_ ?_ · intro x hx have hpar : finParity x = true := (mem_filter.mp hx).2 exact mem_filter.mpr ⟨mem_univ _, by simp [flip0, hflip_par, hpar]⟩ · intro x₁ _ x₂ _ h; exact flip0.injective h · intro y hy refine ⟨flip0 y, mem_filter.mpr ⟨mem_univ _, ?_⟩, flip0.apply_symm_apply y⟩ have hpar : finParity y = false := (mem_filter.mp hy).2 simp [flip0, hflip_par, hpar] have hsum_push := (isProbDist_pushForward finParity hu_dist).2 rw [Fintype.sum_bool] at hsum_push have heq_push : pushForward finParity u true = pushForward finParity u false := by unfold pushForward simp only [u, sum_const, nsmul_eq_mul, hcard_eq] ext b; cases b <;> dsimp [uBool] <;> linarith -- Zero marginal mutual information for every single spin r : Fin d! have hzero_marg : ∀ r : Fin d, mutualInfo uBool (singleSpinMacroKernel P r) = 0 := by intro r -- Pick a different coordinate r' ≠ r (possible since d ≥ 2!) have hr'_ex : ∃ r' : Fin d, r' ≠ r := by by_cases h0 : r = ⟨0, by omega⟩ · exact ⟨⟨1, by omega⟩, fun h => by have := congrArg Fin.val (h.trans h0); simp at this⟩ · exact ⟨⟨0, by omega⟩, Ne.symm h0⟩ obtain ⟨r', hr'_ne⟩ := hr'_ex let flipR : (Fin d → Bool) ≃ (Fin d → Bool) := { toFun := fun x => Function.update x r' (!x r') invFun := fun x => Function.update x r' (!x r') left_inv := fun x => by ext j; by_cases hj : j = r' <;> simp [hj] right_inv := fun x => by ext j; by_cases hj : j = r' <;> simp [hj] } have hker_const : ∀ c b : Bool, singleSpinMacroKernel P r c b = 1 / 2 := by intro c b unfold singleSpinMacroKernel set S := univ.filter (fun x : Fin d → Bool => x r = c) have hS_ne : S.Nonempty := ⟨fun _ => c, mem_filter.mpr ⟨mem_univ _, rfl⟩⟩ have hS_pos : (0 : ℝ) < (S.card : ℝ) := Nat.cast_pos.mpr hS_ne.card_pos have hinv_S : ∀ x ∈ S, flipR x ∈ S := fun x hx => mem_filter.mpr ⟨mem_univ _, by dsimp [flipR]; rw [Function.update_of_ne hr'_ne.symm]; exact (mem_filter.mp hx).2⟩ have hsum_pair : ∑ x ∈ S, lumpedRow P finParity x b = ∑ x ∈ S, lumpedRow P finParity (flipR x) b := by refine sum_bij (fun x _ => flipR x) hinv_S (fun x₁ _ x₂ _ h => flipR.injective h) (fun y hy => ⟨flipR y, hinv_S y hy, flipR.apply_symm_apply y⟩) (fun x _ => by have hinv : flipR (flipR x) = x := flipR.left_inv x; rw [hinv]) have hadd : ∀ x : Fin d → Bool, lumpedRow P finParity x b + lumpedRow P finParity (flipR x) b = 1 := fun x => by rw [spinKernel_lumped_exact d p x b, spinKernel_lumped_exact d p (flipR x) b] have hfx : flipR x = Function.update x r' (!x r') := rfl rw [hfx, hflip_par d r' x] unfold parityMacroKernel cases finParity x <;> cases b <;> simp <;> ring have h2sum : 2 * ∑ x ∈ S, lumpedRow P finParity x b = (S.card : ℝ) := by calc 2 * ∑ x ∈ S, lumpedRow P finParity x b = (∑ x ∈ S, lumpedRow P finParity x b) + (∑ x ∈ S, lumpedRow P finParity (flipR x) b) := by rw [← hsum_pair]; ring _ = ∑ x ∈ S, (lumpedRow P finParity x b + lumpedRow P finParity (flipR x) b) := (sum_add_distrib).symm _ = ∑ _x ∈ S, (1 : ℝ) := sum_congr rfl fun x _ => hadd x _ = (S.card : ℝ) := by simp have hsum_val : ∑ x ∈ S, lumpedRow P finParity x b = (S.card : ℝ) / 2 := by linarith rw [hsum_val] field_simp [ne_of_gt hS_pos] unfold mutualInfo shannonEntropy kernelStep simp_rw [hker_const, Fintype.sum_bool, uBool] norm_num ring -- Exact macro mutual information = ln 2 - h((1 + (1 - 2p)^d) / 2) have hQ_eq : inducedMacroKernel P finParity u = parityMacroKernel d p := by ext a b unfold inducedMacroKernel have ha : pushForward finParity u a ≠ 0 := by rw [hpush_u]; dsimp [uBool]; norm_num rw [if_pos ha] have hconst : ∀ x ∈ univ.filter (fun x => finParity x = a), lumpedRow P finParity x b = parityMacroKernel d p a b := fun x hx => by rw [spinKernel_lumped_exact d p x b, (mem_filter.mp hx).2] rw [sum_congr rfl fun x hx => by rw [hconst x hx], ← sum_mul, condFiberDist_sum finParity u ha, one_mul] have hmacro_mi : macroMutualInfo P finParity u = Real.log 2 - binEntropy ((1 + (1 - 2 * p) ^ d) / 2) := by unfold macroMutualInfo mutualInfo rw [hpush_u, hQ_eq] have hstep_u : kernelStep uBool (parityMacroKernel d p) = uBool := by ext b; unfold kernelStep parityMacroKernel uBool rw [Fintype.sum_bool]; cases b <;> simp <;> ring rw [hstep_u] have hH_uBool : shannonEntropy uBool = Real.log 2 := by unfold shannonEntropy uBool rw [Fintype.sum_bool, ← binEntropy_half] unfold binEntropy; norm_num have hH_Q : ∀ a : Bool, shannonEntropy (parityMacroKernel d p a) = binEntropy ((1 + (1 - 2 * p) ^ d) / 2) := fun a => by unfold shannonEntropy binEntropy parityMacroKernel rw [Fintype.sum_bool] have h1 : 1 - (1 + (1 - 2 * p) ^ d) / 2 = (1 - (1 - 2 * p) ^ d) / 2 := by ring rw [h1] cases a · simp only [↓reduceIte, Bool.false_eq_true]; ring · simp only [↓reduceIte, Bool.true_eq_false] rw [hH_uBool, Fintype.sum_bool, hH_Q true, hH_Q false] dsimp [uBool]; ring have hpsi_eq : predictiveSynergy P = Real.log 2 - binEntropy ((1 + (1 - 2 * p) ^ d) / 2) := by unfold predictiveSynergy dsimp only have hzm : ∀ r : Fin d, mutualInfo (fun _ : Bool => (1 / 2 : ℝ)) (singleSpinMacroKernel P r) = 0 := hzero_marg simp_rw [hzm, sum_const_zero, sub_zero] exact hmacro_mi have hpsi_pos : p ≠ 1 / 2 → 0 < predictiveSynergy P := by intro hne rw [hpsi_eq] set s := (1 + (1 - 2 * p) ^ d) / 2 have hpow_ne : (1 - 2 * p) ^ d ≠ 0 := pow_ne_zero d (by intro h; apply hne; linarith) have hpow_le : |(1 - 2 * p) ^ d| ≤ 1 := by rw [abs_pow] exact pow_le_one₀ (abs_nonneg _) (abs_le.mpr ⟨by linarith, by linarith⟩) have hs0 : 0 ≤ s := by have := (abs_le.mp hpow_le).1; simp [s]; linarith have hs1 : s ≤ 1 := by have := (abs_le.mp hpow_le).2; simp [s]; linarith have hs_ne : s ≠ 1 / 2 := by intro h; apply hpow_ne; simp [s] at h; linarith -- D_KL((s, 1-s) ‖ (1/2, 1/2)) = ln 2 - h(s) > 0 since (s, 1-s) ≠ (1/2, 1/2)! let ps : Fin 2 → ℝ := fun i => if i = 0 then s else 1 - s let pu : Fin 2 → ℝ := fun _ => 1 / 2 have hps : IsProbDist ps := ⟨fun i => by fin_cases i <;> simp [ps] <;> linarith, by simp [ps, Fin.sum_univ_two]⟩ have hpu : IsProbDist pu := ⟨fun _ => by dsimp [pu]; norm_num, by simp [pu]⟩ have hac : AbsCont ps pu := fun _ _ => by dsimp [pu]; norm_num have hkl_nn := klDiv_nonneg hps hpu hac have hkl_ne : klDiv ps pu ≠ 0 := fun h0 => by have heq := (klDiv_eq_zero_iff hps hpu hac).mp h0 exact hs_ne (congrFun heq 0) have hkl_eq : klDiv ps pu = Real.log 2 - binEntropy s := by unfold klDiv binEntropy negMulLog rw [Fin.sum_univ_two] simp only [ps, pu, ↓reduceIte] have h10 : ((1 : Fin 2) = 0) ↔ False := by decide simp only [h10, ↓reduceIte] have ht : ∀ t : ℝ, (if t = 0 then (0 : ℝ) else t * Real.log (t / (1 / 2))) = t * Real.log 2 + t * Real.log t := fun t => by by_cases ht0 : t = 0 · simp [ht0] · rw [if_neg ht0, Real.log_div ht0 (by norm_num), Real.log_div one_ne_zero two_ne_zero, Real.log_one]; ring rw [ht s, ht (1 - s)]; ring linarith [lt_of_le_of_ne hkl_nn (Ne.symm hkl_ne)] have hpsi_zero : p = 1 / 2 → predictiveSynergy P = 0 := by intro hp; subst hp rw [hpsi_eq] have h0 : (1 - 2 * (1 / 2 : ℝ)) ^ d = 0 := by rw [show (1 - 2 * (1 / 2 : ℝ)) = 0 by norm_num, zero_pow (by omega)] rw [h0, add_zero, binEntropy_half, sub_self] exact ⟨hP_stoch, hstrong, hdic0, hdob, hzero_marg, hpsi_eq, hpsi_pos, hpsi_zero⟩ end MarkovLumpingClosure /-! ## Axiom Audit on Every Headline Theorem -/ #print axioms MarkovLumpingClosure.pinsker_ineq #print axioms MarkovLumpingClosure.tvDist_kernelStep_le_dobrushin #print axioms MarkovLumpingClosure.klDiv_point_mixture_le_tv #print axioms MarkovLumpingClosure.stronglyLumpable_iff_intertwining #print axioms MarkovLumpingClosure.stronglyLumpable_multiStep_intertwining #print axioms MarkovLumpingClosure.dicDefect_pythagorean_projection #print axioms MarkovLumpingClosure.dicDefect_eq_zero_iff_stronglyLumpable #print axioms MarkovLumpingClosure.dicDefect_eq_mutualInfo_gap #print axioms MarkovLumpingClosure.ntic_eq_two_macro_sub_micro #print axioms MarkovLumpingClosure.ntic_bounds #print axioms MarkovLumpingClosure.dicDefect_ge_two_mul_sq_avg_tv #print axioms MarkovLumpingClosure.dicDefect_le_fiberDiam_mul_condEntropy #print axioms MarkovLumpingClosure.dicDefect_le_fiberDiam_mul_log_card #print axioms MarkovLumpingClosure.ntic_pos_of_small_ksDefect #print axioms MarkovLumpingClosure.dicDefect_tight_sharedAnchor #print axioms MarkovLumpingClosure.dobrushin_coarseGraining_monotone #print axioms MarkovLumpingClosure.dobrushin_le_of_doeblin #print axioms MarkovLumpingClosure.multiStep_intertwining_error_bound #print axioms MarkovLumpingClosure.multiStep_intertwining_horizon_uniform #print axioms MarkovLumpingClosure.stationary_distribution_stability #print axioms MarkovLumpingClosure.dic_eq_mem2_add_hiddenLeakage #print axioms MarkovLumpingClosure.mem2_le_dicDefect #print axioms MarkovLumpingClosure.invariantFiber_exact_weakLumpability #print axioms MarkovLumpingClosure.invariantFiber_mem2_eq_zero #print axioms MarkovLumpingClosure.shiftLift_exact_weakLumpability_and_dic #print axioms MarkovLumpingClosure.weakLumpability_closure_paradox #print axioms MarkovLumpingClosure.symShiftLift_ntic_exact #print axioms MarkovLumpingClosure.symShiftLift_unique_critical_noise #print axioms MarkovLumpingClosure.symShiftLift_critical_noise_asymptotic #print axioms MarkovLumpingClosure.fiberMixedKernel_invariance #print axioms MarkovLumpingClosure.fiberMixedKernel_critical_phase_transition #print axioms MarkovLumpingClosure.globalIsotropicNoise_ntic_sign_flip #print axioms MarkovLumpingClosure.paritySpinKernel_exact_synergy