import Mathlib /-! # Exact Extremal Theory and the Anti-Determinism Phase Transition of Causal Emergence ## Overview For a discrete-time Markov transition kernel `P : α → α → ℝ` on a finite microstate space `α` of size `n = |α|` and a surjective coarse-graining `π : α → β` onto `m = |β|` macrostates with fiber sizes `c_a = |π⁻¹(a)| ≥ 1` and fiber-weight distribution `w_a = c_a / n`, the **Hoel–Albantakis–Tononi macro-transition kernel** (PNAS 2013; Hoel, *Entropy* 2017) is $$Q_{a,b} = \frac{1}{c_a} \sum_{i \in \pi^{-1}(a)} \sum_{j \in \pi^{-1}(b)} P_{i,j}.$$ The micro- and macro-**Effective Information** (in nats) are $$\mathrm{EI}(P) = I_{\mathrm{Unif}(\alpha)}(P), \qquad \mathrm{EI}(Q) = I_{\mathrm{Unif}(\beta)}(Q),$$ and the **Causal Emergence** gap is $\Delta\mathrm{EI}(P, \pi) = \mathrm{EI}(Q) - \mathrm{EI}(P)$. In this completely self-contained Lean 4 formalization (zero `sorry`, zero `admit`, zero custom axioms, zero `native_decide`), we establish the exact extremal theory of Hoel–Albantakis–Tononi causal emergence and refute the determinism dogma of macro-scale causal emergence: 1. **Self-Contained Information Theory Engine**: Log-sum inequality (`log_sum_ineq`), non-negativity and concavity of Shannon entropy (`shannonEntropy_concave`), Data Processing Inequality (`effectiveInfo_ge_macro_mutualInfo`), and concavity of mutual information (`mutualInfo_concave`). 2. **Exact Variational Reduction & Balanced No-Emergence**: - `causalEmergence_le_reweight_gap`: $\Delta\mathrm{EI}(P, \pi) \le I_u(Q) - I_w(Q)$. - `causalEmergence_canonicalLift`: exact zero-DPI realizability for every macro-kernel $Q$. - `causalEmergence_nonpos_of_balanced`: for every balanced partition ($c_a \equiv n/m$), $\Delta\mathrm{EI}(P, \pi) \le 0$. - `reweight_gap_eq_shift_plus_noise`: exact decomposition into output-degeneracy shift plus $\sum_a (w_a - 1/m) H(Q_a)$ (heavy-state noise bonus vs. light-state noise penalty). 3. **Universal Concavity Ceiling & Non-Asymptotic Speed Limit**: - `causalEmergence_le_min_fiber_bound`: $\Delta\mathrm{EI}(P, \pi) \le (1 - m c_{\min}/n)\ln m$. - `causalEmergence_le_one_sub_ratio_mul_log`: $\Delta\mathrm{EI}(P, \pi) \le (1 - m/n)\ln m$. - `causalEmergence_universal_upper_bound`: for all $n \ge 2$, $1 \le m \le n$, all $\pi$, $P$, $$\Delta\mathrm{EI}(P, \pi) \le \ln n - \ln(\ln n) - 1 + \frac{(\ln(\ln n) + 1)^2}{4 \ln n}.$$ 4. **Noisy Erasure-Collapse Family & Exact Three-Term Asymptotic Law**: - `symNoisyKernel_causalEmergence_exact`: exact closed-form emergence for the 1-parameter symmetric noisy family $Q(\alpha)$ on the spike partition $c = (n - m + 1, 1, \dots, 1)$. - `erasureCollapse_causalEmergence_exact`: at $\alpha = 0$ (complete erasure of heavy state), $\Delta\mathrm{EI} = (1 - m/n)(1 - 1/m)\ln(m - 1)$. - `causalEmergence_exact_three_term_asymptotic`: exact three-term asymptotic law $\Delta\mathrm{EI}^*(n) = \ln n - \ln(\ln n) - 1 + o(1)$. 5. **The Noisy-Macro Paradox (Universal Anti-Determinism & Phase Transition)**: - `universal_anti_determinism`: for **every** non-balanced coarse-graining $\pi$ onto $m \ge 2$ macrostates, purely bijective deterministic macro-dynamics is **never** optimal; injecting noise into a heavy macrostate strictly increases $\Delta\mathrm{EI}$. - `hoel_four_state_noisy_beats_deterministic`: on Hoel's canonical 4-state benchmark ($n = 4, m = 2$), the noisy Z-channel at $\alpha = 19/20$ strictly beats deterministic macro emergence ($\approx 0.14163$ vs. $0.13081$ nats, $+8.27\%$). - `symNoisyGain_hasDerivWithinAt_zero`: exact smooth right-derivative at complete erasure $G'_{m,p}(0) = \frac{\ln m}{m} + p \ln p$ (the $\ln\alpha$ singularity cancels identically), governing the phase transition between complete erasure ($\alpha^* = 0$) and the interior noisy phase ($\alpha^* \in (0, 1)$). 6. **Sharp Bijective-Deterministic Ceiling & Unbounded Separations**: - `bijectiveDeterministic_sharp_ceiling` & `bijectiveDeterministic_ceiling_tight`: via Schur-concavity on integer partitions, every bijective deterministic macro-kernel satisfies $\Delta\mathrm{EI}(P, \pi) \le \ln(m/n) + \frac{n - m + 1}{n}\ln(n - m + 1)$ (exact!). - `noisy_beats_bijectiveDeterministic_unbounded_ratio`: at $m = n - 1$, noisy erasure-collapse beats every bijective deterministic macro by an unbounded factor $\Omega(\ln n) \to \infty$. - `noisy_beats_bijectiveDeterministic_half_scale`: at $n = 2k, m = k$, noisy erasure-collapse beats every bijective deterministic macro by an additive gap approaching $\ln 2$ (1 full bit). - `noisy_strictly_beats_all_deterministic_fine_scale`: at $m = n - 1$, for **every** $n \ge 4$, noisy erasure-collapse strictly beats **every** deterministic macro-kernel (even arbitrary non-bijective / degenerate deterministic functions $f : \mathrm{Fin}\,(n-1) \to \mathrm{Fin}\,(n-1)$!). -/ namespace CausalEmergenceExtremal open scoped BigOperators open Finset /-! ## Section 1: Self-Contained Discrete Information Theory -/ section InformationTheory /-- Single Shannon entropy term `-x * log x`, with convention `0 * log 0 = 0`. -/ noncomputable def entTerm (x : ℝ) : ℝ := -(x * Real.log x) @[simp] lemma entTerm_zero : entTerm 0 = 0 := by simp [entTerm] @[simp] lemma entTerm_one : entTerm 1 = 0 := by simp [entTerm] lemma entTerm_nonneg {x : ℝ} (hx0 : 0 ≤ x) (hx1 : x ≤ 1) : 0 ≤ entTerm x := by unfold entTerm 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 /-- Binary Shannon entropy `h(x) = -x log x - (1 - x) log (1 - x)`. -/ noncomputable def binEnt (x : ℝ) : ℝ := entTerm x + entTerm (1 - x) @[simp] lemma binEnt_zero : binEnt 0 = 0 := by simp [binEnt] @[simp] lemma binEnt_one : binEnt 1 = 0 := by simp [binEnt] lemma binEnt_symm (x : ℝ) : binEnt (1 - x) = binEnt x := by unfold binEnt; ring lemma binEnt_nonneg {x : ℝ} (hx0 : 0 ≤ x) (hx1 : x ≤ 1) : 0 ≤ binEnt x := by unfold binEnt exact add_nonneg (entTerm_nonneg hx0 hx1) (entTerm_nonneg (by linarith) (by linarith)) /-- Fundamental KL pointwise inequality: `p * log (p / q) ≥ p - q` for `p ≥ 0, q > 0`. -/ lemma mul_log_div_ge_sub {p q : ℝ} (hp : 0 ≤ p) (hq : 0 < q) : p - q ≤ p * Real.log (p / q) := by rcases eq_or_lt_of_le hp with rfl | hp_pos · simp; linarith · have hqp : 0 < q / p := div_pos hq hp_pos have hlog : Real.log (q / p) ≤ q / p - 1 := Real.log_le_sub_one_of_pos hqp have hinv : Real.log (p / q) = -Real.log (q / p) := by rw [Real.log_div (ne_of_gt hp_pos) (ne_of_gt hq), Real.log_div (ne_of_gt hq) (ne_of_gt hp_pos)] ring rw [hinv] have hmul := mul_le_mul_of_nonneg_left hlog (le_of_lt hp_pos) have hsimp : p * (q / p - 1) = q - p := by field_simp [ne_of_gt hp_pos] linarith /-- Finite Log-Sum Inequality: `∑ i ∈ s, a i * log (a i / b i) ≥ (∑ i ∈ s, a i) * log ((∑ i ∈ s, a i) / (∑ i ∈ s, b i))` whenever `a i ≥ 0`, `b i ≥ 0`, and `b i = 0 → a i = 0`. -/ theorem log_sum_ineq {ι : Type*} (s : Finset ι) (a b : ι → ℝ) (ha : ∀ i ∈ s, 0 ≤ a i) (hb : ∀ i ∈ s, 0 ≤ b i) (habs : ∀ i ∈ s, b i = 0 → a i = 0) : (∑ i ∈ s, a i) * Real.log ((∑ i ∈ s, a i) / (∑ i ∈ s, b i)) ≤ ∑ i ∈ s, 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 := Finset.sum_nonneg ha have hB0 : 0 ≤ B := Finset.sum_nonneg hb rcases eq_or_lt_of_le hA0 with hA_eq | hA_pos · have ha_zero : ∀ i ∈ s, a i = 0 := fun i hi => (Finset.sum_eq_zero_iff_of_nonneg ha).mp hA_eq.symm i hi rw [← hA_eq, zero_mul] have hsum0 : ∑ i ∈ s, a i * Real.log (a i / b i) = 0 := Finset.sum_eq_zero fun i hi => by rw [ha_zero i hi, zero_mul] rw [hsum0] · have hB_pos : 0 < B := by rcases eq_or_lt_of_le hB0 with hB_eq | hB_pos · exfalso have hb_zero : ∀ i ∈ s, b i = 0 := fun i hi => (Finset.sum_eq_zero_iff_of_nonneg hb).mp hB_eq.symm i hi have ha_zero : ∀ i ∈ s, a i = 0 := fun i hi => habs i hi (hb_zero i hi) have : A = 0 := Finset.sum_eq_zero ha_zero linarith · exact hB_pos have hterm : ∀ i ∈ s, a i * Real.log (A / B) + (a i - b i * (A / B)) ≤ a i * Real.log (a i / b i) := by intro i hi rcases eq_or_lt_of_le (hb i hi) with hbi0 | hbi_pos · have hai0 : a i = 0 := habs i hi hbi0.symm rw [hai0, ← hbi0]; simp · have hq_pos : 0 < b i * (A / B) := mul_pos hbi_pos (div_pos hA_pos hB_pos) have hkl := mul_log_div_ge_sub (ha i hi) hq_pos rcases eq_or_lt_of_le (ha i hi) with hai0 | hai_pos · rw [← hai0] at hkl ⊢ simp at hkl ⊢ exact hkl · have hlog_eq : Real.log (a i / (b i * (A / B))) = Real.log (a i / b i) - Real.log (A / B) := by rw [Real.log_div (ne_of_gt hai_pos) (ne_of_gt hq_pos), Real.log_mul (ne_of_gt hbi_pos) (ne_of_gt (div_pos hA_pos hB_pos)), Real.log_div (ne_of_gt hai_pos) (ne_of_gt hbi_pos)] ring rw [hlog_eq] at hkl nlinarith have hsum := Finset.sum_le_sum hterm have hlhs : ∑ i ∈ s, (a i * Real.log (A / B) + (a i - b i * (A / B))) = A * Real.log (A / B) := by rw [Finset.sum_add_distrib, ← Finset.sum_mul, Finset.sum_sub_distrib, ← Finset.sum_mul] change A * Real.log (A / B) + (A - B * (A / B)) = A * Real.log (A / B) have hBA : B * (A / B) = A := mul_div_cancel₀ A (ne_of_gt hB_pos) linarith linarith /-- Probability distribution on a finite type. -/ def IsProbDist {α : Type*} [Fintype α] (p : α → ℝ) : Prop := (∀ i, 0 ≤ p i) ∧ ∑ i, p i = 1 /-- Row-stochastic transition kernel `P : α → β → ℝ`. -/ def IsStochastic {α β : Type*} [Fintype α] [Fintype β] (P : α → β → ℝ) : Prop := ∀ i, IsProbDist (P i) /-- Uniform probability distribution on a nonempty finite type. -/ noncomputable def unifDist (α : Type*) [Fintype α] : α → ℝ := fun _ => (1 : ℝ) / (Fintype.card α : ℝ) lemma unifDist_isProbDist (α : Type*) [Fintype α] [Nonempty α] : IsProbDist (unifDist α) := by refine ⟨fun _ => by unfold unifDist; positivity, ?_⟩ simp [unifDist, Fintype.card_pos.ne'] /-- Pushforward distribution `(p P)_j = ∑_i p_i P_{ij}`. -/ noncomputable def pushforward {α β : Type*} [Fintype α] (p : α → ℝ) (P : α → β → ℝ) : β → ℝ := fun j => ∑ i, p i * P i j lemma pushforward_isProbDist {α β : Type*} [Fintype α] [Fintype β] {p : α → ℝ} {P : α → β → ℝ} (hp : IsProbDist p) (hP : IsStochastic P) : IsProbDist (pushforward p P) := by refine ⟨fun j => Finset.sum_nonneg fun i _ => mul_nonneg (hp.1 i) ((hP i).1 j), ?_⟩ unfold pushforward rw [Finset.sum_comm] calc ∑ i, ∑ j, p i * P i j = ∑ i, p i * ∑ j, P i j := by simp_rw [← Finset.mul_sum] _ = ∑ i, p i * 1 := by simp_rw [(hP _).2] _ = 1 := by simp [hp.2] /-- Discrete Shannon entropy `H(p) = ∑_i -p_i log p_i` (in nats). -/ noncomputable def shannonEntropy {α : Type*} [Fintype α] (p : α → ℝ) : ℝ := ∑ i, entTerm (p i) /-- Conditional entropy `H(Y | X) = ∑_i p_i H(P_{i, ·})`. -/ noncomputable def condEntropy {α β : Type*} [Fintype α] [Fintype β] (p : α → ℝ) (P : α → β → ℝ) : ℝ := ∑ i, p i * shannonEntropy (P i) /-- Mutual information `I_p(P) = H(p P) - ∑_i p_i H(P_{i, ·})`. -/ noncomputable def mutualInfo {α β : Type*} [Fintype α] [Fintype β] (p : α → ℝ) (P : α → β → ℝ) : ℝ := shannonEntropy (pushforward p P) - condEntropy p P /-- Hoel–Albantakis–Tononi Effective Information `EI(P) = I_{Unif}(P)`. -/ noncomputable def effectiveInfo {α : Type*} [Fintype α] (P : α → α → ℝ) : ℝ := mutualInfo (unifDist α) P lemma shannonEntropy_nonneg {α : Type*} [Fintype α] {p : α → ℝ} (hp : IsProbDist p) : 0 ≤ shannonEntropy p := by refine Finset.sum_nonneg fun i _ => entTerm_nonneg (hp.1 i) ?_ have hle : p i ≤ ∑ j, p j := Finset.single_le_sum (fun j _ => hp.1 j) (Finset.mem_univ i) linarith [hp.2] lemma shannonEntropy_unif (α : Type*) [Fintype α] [Nonempty α] : shannonEntropy (unifDist α) = Real.log (Fintype.card α) := by have hcard : (0 : ℝ) < Fintype.card α := Nat.cast_pos.mpr Fintype.card_pos unfold shannonEntropy entTerm unifDist simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, one_div, Real.log_inv] field_simp [ne_of_gt hcard] lemma shannonEntropy_le_log_card {α : Type*} [Fintype α] [Nonempty α] {p : α → ℝ} (hp : IsProbDist p) : shannonEntropy p ≤ Real.log (Fintype.card α) := by have hls := log_sum_ineq Finset.univ p (fun _ => (1 : ℝ)) (fun i _ => hp.1 i) (fun _ _ => by norm_num) (fun _ _ h => by norm_num at h) simp only [hp.2, div_one, Finset.sum_const, Finset.card_univ, nsmul_eq_mul, mul_one, one_mul] at hls have h1 : Real.log (1 / (Fintype.card α : ℝ)) = -Real.log (Fintype.card α) := by rw [one_div, Real.log_inv] rw [h1] at hls unfold shannonEntropy entTerm rw [Finset.sum_neg_distrib] linarith /-- Concavity of Shannon entropy on the probability simplex. -/ theorem shannonEntropy_concave {α : Type*} [Fintype α] {p q : α → ℝ} {t : ℝ} (hp : IsProbDist p) (hq : IsProbDist q) (ht0 : 0 ≤ t) (ht1 : t ≤ 1) : t * shannonEntropy p + (1 - t) * shannonEntropy q ≤ shannonEntropy (fun i => t * p i + (1 - t) * q i) := by have hterm : ∀ i : α, t * entTerm (p i) + (1 - t) * entTerm (q i) ≤ entTerm (t * p i + (1 - t) * q i) := by intro i let a : Bool → ℝ := fun b => if b then t * p i else (1 - t) * q i let b : Bool → ℝ := fun b => if b then t else 1 - t have ha : ∀ x ∈ (Finset.univ : Finset Bool), 0 ≤ a x := by intro x _; cases x <;> dsimp [a] · exact mul_nonneg (by linarith) (hq.1 i) · exact mul_nonneg ht0 (hp.1 i) have hb : ∀ x ∈ (Finset.univ : Finset Bool), 0 ≤ b x := by intro x _; cases x <;> dsimp [b] <;> linarith have habs : ∀ x ∈ (Finset.univ : Finset Bool), b x = 0 → a x = 0 := by intro x _ hx; cases x <;> dsimp [a, b] at hx ⊢ <;> simp [hx] have hls := log_sum_ineq Finset.univ a b ha hb habs have hsumA : ∑ x : Bool, a x = t * p i + (1 - t) * q i := by simp [a] have hsumB : ∑ x : Bool, b x = 1 := by simp [b] have hrhs : ∑ x : Bool, a x * Real.log (a x / b x) = t * p i * Real.log (p i) + (1 - t) * q i * Real.log (q i) := by have hT : a true * Real.log (a true / b true) = t * p i * Real.log (p i) := by dsimp [a, b] rcases eq_or_lt_of_le ht0 with rfl | ht_pos · simp · rw [mul_div_cancel_left₀ (p i) (ne_of_gt ht_pos)] have hF : a false * Real.log (a false / b false) = (1 - t) * q i * Real.log (q i) := by dsimp [a, b] rcases eq_or_lt_of_le (show 0 ≤ 1 - t by linarith) with h1t | h1t_pos · have : 1 - t = 0 := h1t.symm; simp [this] · rw [mul_div_cancel_left₀ (q i) (ne_of_gt h1t_pos)] rw [Fintype.sum_bool, hT, hF] rw [hsumA, hsumB, div_one, hrhs] at hls unfold entTerm linarith calc t * shannonEntropy p + (1 - t) * shannonEntropy q = ∑ i, (t * entTerm (p i) + (1 - t) * entTerm (q i)) := by unfold shannonEntropy rw [Finset.mul_sum, Finset.mul_sum, ← Finset.sum_add_distrib] _ ≤ ∑ i, entTerm (t * p i + (1 - t) * q i) := Finset.sum_le_sum fun i _ => hterm i /-- KL-divergence representation of mutual information. -/ lemma mutualInfo_eq_kl_sum {α β : Type*} [Fintype α] [Fintype β] {p : α → ℝ} {P : α → β → ℝ} (hp : IsProbDist p) (hP : IsStochastic P) : mutualInfo p P = ∑ i, ∑ j, (p i * P i j) * Real.log (P i j / pushforward p P j) := by have hterm : ∀ i j, (p i * P i j) * Real.log (P i j / pushforward p P j) = p i * (P i j * Real.log (P i j)) - (p i * P i j) * Real.log (pushforward p P j) := by intro i j rcases eq_or_lt_of_le (hp.1 i) with hpi0 | hpi_pos · rw [← hpi0]; simp · rcases eq_or_lt_of_le ((hP i).1 j) with hPij0 | hPij_pos · rw [← hPij0]; simp · have hqj_pos : 0 < pushforward p P j := by unfold pushforward have hle : p i * P i j ≤ ∑ k, p k * P k j := Finset.single_le_sum (fun k _ => mul_nonneg (hp.1 k) ((hP k).1 j)) (Finset.mem_univ i) linarith [mul_pos hpi_pos hPij_pos] rw [Real.log_div (ne_of_gt hPij_pos) (ne_of_gt hqj_pos)] ring simp_rw [hterm, Finset.sum_sub_distrib] have h1 : ∑ i, ∑ j, p i * (P i j * Real.log (P i j)) = -condEntropy p P := by unfold condEntropy shannonEntropy entTerm simp_rw [Finset.sum_neg_distrib, mul_neg, Finset.sum_neg_distrib, ← Finset.mul_sum, neg_neg] have h2 : ∑ i, ∑ j, (p i * P i j) * Real.log (pushforward p P j) = -shannonEntropy (pushforward p P) := by rw [Finset.sum_comm] unfold shannonEntropy entTerm pushforward simp_rw [← Finset.sum_mul, Finset.sum_neg_distrib, neg_neg] rw [h1, h2] unfold mutualInfo ring /-- Non-negativity of mutual information `I_p(P) ≥ 0`. -/ theorem mutualInfo_nonneg {α β : Type*} [Fintype α] [Fintype β] {p : α → ℝ} {P : α → β → ℝ} (hp : IsProbDist p) (hP : IsStochastic P) : 0 ≤ mutualInfo p P := by rw [mutualInfo_eq_kl_sum hp hP] refine Finset.sum_nonneg fun i _ => ?_ have hls := log_sum_ineq Finset.univ (fun j => p i * P i j) (fun j => p i * pushforward p P j) (fun j _ => mul_nonneg (hp.1 i) ((hP i).1 j)) (fun j _ => mul_nonneg (hp.1 i) ((pushforward_isProbDist hp hP).1 j)) (fun j _ hzero => by rcases mul_eq_zero.mp hzero with hpi0 | hqj0 · rw [hpi0, zero_mul] · have hle : p i * P i j ≤ pushforward p P j := Finset.single_le_sum (fun k _ => mul_nonneg (hp.1 k) ((hP k).1 j)) (Finset.mem_univ i) have hnn : 0 ≤ p i * P i j := mul_nonneg (hp.1 i) ((hP i).1 j) linarith) have hsumA : ∑ j, p i * P i j = p i := by rw [← Finset.mul_sum, (hP i).2, mul_one] have hsumB : ∑ j, p i * pushforward p P j = p i := by rw [← Finset.mul_sum, (pushforward_isProbDist hp hP).2, mul_one] have hlhs : (∑ j, p i * P i j) * Real.log ((∑ j, p i * P i j) / (∑ j, p i * pushforward p P j)) = 0 := by rw [hsumA, hsumB] rcases eq_or_lt_of_le (hp.1 i) with hpi0 | hpi_pos · rw [← hpi0]; simp · rw [div_self (ne_of_gt hpi_pos), Real.log_one, mul_zero] have hrhs : ∑ j, (p i * P i j) * Real.log ((p i * P i j) / (p i * pushforward p P j)) = ∑ j, (p i * P i j) * Real.log (P i j / pushforward p P j) := by refine Finset.sum_congr rfl fun j _ => ?_ rcases eq_or_lt_of_le (hp.1 i) with hpi0 | hpi_pos · rw [← hpi0]; simp · rw [mul_div_mul_left _ _ (ne_of_gt hpi_pos)] linarith /-- Upper bound `I_p(P) ≤ H(p P) ≤ log |β|`. -/ theorem mutualInfo_le_log_card {α β : Type*} [Fintype α] [Fintype β] [Nonempty β] {p : α → ℝ} {P : α → β → ℝ} (hp : IsProbDist p) (hP : IsStochastic P) : mutualInfo p P ≤ Real.log (Fintype.card β) := by unfold mutualInfo have hcond : 0 ≤ condEntropy p P := Finset.sum_nonneg fun i _ => mul_nonneg (hp.1 i) (shannonEntropy_nonneg (hP i)) have hout : shannonEntropy (pushforward p P) ≤ Real.log (Fintype.card β) := shannonEntropy_le_log_card (pushforward_isProbDist hp hP) linarith /-- Concavity of mutual information `p ↦ I_p(Q)` in the input distribution `p`. -/ theorem mutualInfo_concave {α β : Type*} [Fintype α] [Fintype β] {p q : α → ℝ} {Q : α → β → ℝ} {t : ℝ} (hp : IsProbDist p) (hq : IsProbDist q) (hQ : IsStochastic Q) (ht0 : 0 ≤ t) (ht1 : t ≤ 1) : t * mutualInfo p Q + (1 - t) * mutualInfo q Q ≤ mutualInfo (fun i => t * p i + (1 - t) * q i) Q := by unfold mutualInfo have hpush : pushforward (fun i => t * p i + (1 - t) * q i) Q = fun j => t * pushforward p Q j + (1 - t) * pushforward q Q j := by ext j unfold pushforward simp_rw [add_mul, mul_assoc, Finset.sum_add_distrib, ← Finset.mul_sum] have hcond : condEntropy (fun i => t * p i + (1 - t) * q i) Q = t * condEntropy p Q + (1 - t) * condEntropy q Q := by unfold condEntropy simp_rw [add_mul, mul_assoc, Finset.sum_add_distrib, ← Finset.mul_sum] rw [hpush, hcond] have hconc := shannonEntropy_concave (pushforward_isProbDist hp hQ) (pushforward_isProbDist hq hQ) ht0 ht1 linarith end InformationTheory /-! ## Section 2: Hoel–Albantakis–Tononi Coarse-Graining & Variational Reduction -/ section CoarseGraining /-- The microstate fiber `π⁻¹(a)` of macrostate `a`. -/ def fiber {α β : Type*} [Fintype α] [DecidableEq β] (π : α → β) (a : β) : Finset α := Finset.univ.filter (fun i => π i = a) /-- Cardinality `c_a = |π⁻¹(a)|` of macrostate `a`. -/ def fiberSize {α β : Type*} [Fintype α] [DecidableEq β] (π : α → β) (a : β) : ℕ := (fiber π a).card lemma fiberSize_pos {α β : Type*} [Fintype α] [DecidableEq β] {π : α → β} (hπ : Function.Surjective π) (a : β) : 0 < fiberSize π a := by obtain ⟨i, hi⟩ := hπ a exact Finset.card_pos.mpr ⟨i, Finset.mem_filter.mpr ⟨Finset.mem_univ i, hi⟩⟩ lemma sum_fiberSize {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (π : α → β) : ∑ a, fiberSize π a = Fintype.card α := by unfold fiberSize fiber have h := Finset.card_eq_sum_card_fiberwise (s := (Finset.univ : Finset α)) (t := (Finset.univ : Finset β)) (f := π) (fun _ _ => Finset.mem_univ _) simpa using h.symm lemma sum_fiber_eq_univ {α β γ : Type*} [Fintype α] [Fintype β] [DecidableEq β] [AddCommMonoid γ] (π : α → β) (f : α → γ) : ∑ a : β, ∑ i ∈ fiber π a, f i = ∑ i : α, f i := by unfold fiber exact Finset.sum_fiberwise_of_maps_to (fun _ _ => Finset.mem_univ _) f /-- Fiber-weight distribution `w_a = c_a / |α|` induced by uniform micro-interventions. -/ noncomputable def fiberWeight {α β : Type*} [Fintype α] [DecidableEq β] (π : α → β) : β → ℝ := fun a => (fiberSize π a : ℝ) / (Fintype.card α : ℝ) lemma fiberWeight_isProbDist {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] [Nonempty α] (π : α → β) : IsProbDist (fiberWeight π) := by have hn : (0 : ℝ) < Fintype.card α := Nat.cast_pos.mpr Fintype.card_pos refine ⟨fun a => by unfold fiberWeight; positivity, ?_⟩ unfold fiberWeight rw [← Finset.sum_div, ← Nat.cast_sum, sum_fiberSize, div_self (ne_of_gt hn)] /-- Hoel–Albantakis–Tononi macro-transition kernel `Q_{a,b} = (1/c_a) ∑_{i ∈ π⁻¹(a)} ∑_{j ∈ π⁻¹(b)} P_{ij}`. -/ noncomputable def macroKernel {α β : Type*} [Fintype α] [DecidableEq β] (π : α → β) (P : α → α → ℝ) : β → β → ℝ := fun a b => (1 / (fiberSize π a : ℝ)) * ∑ i ∈ fiber π a, ∑ j ∈ fiber π b, P i j lemma macroKernel_isStochastic {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {π : α → β} (hπ : Function.Surjective π) {P : α → α → ℝ} (hP : IsStochastic P) : IsStochastic (macroKernel π P) := by intro a have hca : (0 : ℝ) < fiberSize π a := Nat.cast_pos.mpr (fiberSize_pos hπ a) refine ⟨fun b => by unfold macroKernel exact mul_nonneg (by positivity) (Finset.sum_nonneg fun i _ => Finset.sum_nonneg fun j _ => (hP i).1 j), ?_⟩ unfold macroKernel rw [← Finset.mul_sum, Finset.sum_comm] have hinner : ∀ i ∈ fiber π a, ∑ b : β, ∑ j ∈ fiber π b, P i j = 1 := by intro i _ rw [sum_fiber_eq_univ π (P i), (hP i).2] rw [Finset.sum_congr rfl hinner] simp only [Finset.sum_const, nsmul_eq_mul, mul_one] change (1 / (fiberSize π a : ℝ)) * (fiberSize π a : ℝ) = 1 exact one_div_mul_cancel (ne_of_gt hca) /-- Causal Emergence gap `ΔEI(P, π) = EI(Q_π) - EI(P)`. -/ noncomputable def causalEmergence {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] (π : α → β) (P : α → α → ℝ) : ℝ := effectiveInfo (macroKernel π P) - effectiveInfo P /-- Canonical zero-DPI block lift of a macro-kernel `Q` to microstates: `P^{(Q, π)}_{i,j} = Q_{π(i), π(j)} / c_{π(j)}`. -/ noncomputable def canonicalLift {α β : Type*} [Fintype α] [DecidableEq β] (π : α → β) (Q : β → β → ℝ) : α → α → ℝ := fun i j => Q (π i) (π j) / (fiberSize π (π j) : ℝ) lemma canonicalLift_isStochastic {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {π : α → β} (hπ : Function.Surjective π) {Q : β → β → ℝ} (hQ : IsStochastic Q) : IsStochastic (canonicalLift π Q) := by intro i refine ⟨fun j => div_nonneg ((hQ (π i)).1 (π j)) (Nat.cast_nonneg _), ?_⟩ rw [← sum_fiber_eq_univ π (canonicalLift π Q i)] have hfib : ∀ b : β, ∑ j ∈ fiber π b, canonicalLift π Q i j = Q (π i) b := by intro b have hcb : (0 : ℝ) < fiberSize π b := Nat.cast_pos.mpr (fiberSize_pos hπ b) have hcongr : ∀ j ∈ fiber π b, canonicalLift π Q i j = Q (π i) b / (fiberSize π b : ℝ) := by intro j hj have hπj : π j = b := (Finset.mem_filter.mp hj).2 simp [canonicalLift, hπj] rw [Finset.sum_congr rfl hcongr, Finset.sum_const, nsmul_eq_mul] change (fiberSize π b : ℝ) * (Q (π i) b / (fiberSize π b : ℝ)) = Q (π i) b exact mul_div_cancel₀ _ (ne_of_gt hcb) simp_rw [hfib] exact (hQ (π i)).2 lemma macroKernel_canonicalLift {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] {π : α → β} (hπ : Function.Surjective π) (Q : β → β → ℝ) : macroKernel π (canonicalLift π Q) = Q := by ext a b have hca : (0 : ℝ) < fiberSize π a := Nat.cast_pos.mpr (fiberSize_pos hπ a) have hcb : (0 : ℝ) < fiberSize π b := Nat.cast_pos.mpr (fiberSize_pos hπ b) unfold macroKernel have hinner : ∀ i ∈ fiber π a, ∑ j ∈ fiber π b, canonicalLift π Q i j = Q a b := by intro i hi have hπi : π i = a := (Finset.mem_filter.mp hi).2 have hcongr : ∀ j ∈ fiber π b, canonicalLift π Q i j = Q a b / (fiberSize π b : ℝ) := by intro j hj have hπj : π j = b := (Finset.mem_filter.mp hj).2 simp [canonicalLift, hπi, hπj] rw [Finset.sum_congr rfl hcongr, Finset.sum_const, nsmul_eq_mul] change (fiberSize π b : ℝ) * (Q a b / (fiberSize π b : ℝ)) = Q a b exact mul_div_cancel₀ _ (ne_of_gt hcb) rw [Finset.sum_congr rfl hinner, Finset.sum_const, nsmul_eq_mul] change (1 / (fiberSize π a : ℝ)) * ((fiberSize π a : ℝ) * Q a b) = Q a b field_simp [ne_of_gt hca] /-- Exact Data Processing Inequality for coarse-graining: under uniform micro-interventions, micro-EI is always at least `I_w(Q_π)`. -/ theorem effectiveInfo_ge_macro_mutualInfo {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] [Nonempty α] {π : α → β} (hπ : Function.Surjective π) {P : α → α → ℝ} (hP : IsStochastic P) : mutualInfo (fiberWeight π) (macroKernel π P) ≤ effectiveInfo P := by have hn : (0 : ℝ) < Fintype.card α := Nat.cast_pos.mpr Fintype.card_pos have hu : IsProbDist (unifDist α) := unifDist_isProbDist α have hw : IsProbDist (fiberWeight π) := fiberWeight_isProbDist π have hQ : IsStochastic (macroKernel π P) := macroKernel_isStochastic hπ hP rw [effectiveInfo, mutualInfo_eq_kl_sum hu hP, mutualInfo_eq_kl_sum hw hQ] have hmicro_split : ∑ i : α, ∑ j : α, (unifDist α i * P i j) * Real.log (P i j / pushforward (unifDist α) P j) = ∑ a : β, ∑ b : β, ∑ i ∈ fiber π a, ∑ j ∈ fiber π b, (unifDist α i * P i j) * Real.log ((unifDist α i * P i j) / (unifDist α i * pushforward (unifDist α) P j)) := by rw [← sum_fiber_eq_univ π] refine Finset.sum_congr rfl fun a _ => ?_ trans ∑ i ∈ fiber π a, ∑ b : β, ∑ j ∈ fiber π b, (unifDist α i * P i j) * Real.log ((unifDist α i * P i j) / (unifDist α i * pushforward (unifDist α) P j)) · refine Finset.sum_congr rfl fun i _ => ?_ rw [← sum_fiber_eq_univ π] refine Finset.sum_congr rfl fun b _ => Finset.sum_congr rfl fun j _ => ?_ have hui : 0 < unifDist α i := by unfold unifDist; positivity rw [mul_div_mul_left _ _ (ne_of_gt hui)] · rw [Finset.sum_comm] rw [hmicro_split] refine Finset.sum_le_sum fun a _ => Finset.sum_le_sum fun b _ => ?_ let S := (fiber π a) ×ˢ (fiber π b) let A_fn : α × α → ℝ := fun x => unifDist α x.1 * P x.1 x.2 let B_fn : α × α → ℝ := fun x => unifDist α x.1 * pushforward (unifDist α) P x.2 have hls := log_sum_ineq S A_fn B_fn (fun x _ => mul_nonneg (hu.1 x.1) ((hP x.1).1 x.2)) (fun x _ => mul_nonneg (hu.1 x.1) ((pushforward_isProbDist hu hP).1 x.2)) (fun x _ hB0 => by have hui : 0 < unifDist α x.1 := by unfold unifDist; positivity have hqj0 : pushforward (unifDist α) P x.2 = 0 := by rcases mul_eq_zero.mp hB0 with h | h · linarith · exact h have hle : unifDist α x.1 * P x.1 x.2 ≤ pushforward (unifDist α) P x.2 := Finset.single_le_sum (fun k _ => mul_nonneg (hu.1 k) ((hP k).1 x.2)) (Finset.mem_univ x.1) have hnn : 0 ≤ unifDist α x.1 * P x.1 x.2 := mul_nonneg (hu.1 x.1) ((hP x.1).1 x.2) linarith) have hsumA : ∑ x ∈ S, A_fn x = fiberWeight π a * macroKernel π P a b := by rw [Finset.sum_product] have hca : (0 : ℝ) < fiberSize π a := Nat.cast_pos.mpr (fiberSize_pos hπ a) dsimp only [A_fn] unfold unifDist fiberWeight macroKernel simp_rw [← Finset.mul_sum] field_simp [ne_of_gt hn, ne_of_gt hca] have hsumB : ∑ x ∈ S, B_fn x = fiberWeight π a * pushforward (fiberWeight π) (macroKernel π P) b := by rw [Finset.sum_product] dsimp only [B_fn] have hpush_macro : pushforward (fiberWeight π) (macroKernel π P) b = ∑ j ∈ fiber π b, pushforward (unifDist α) P j := by unfold pushforward fiberWeight macroKernel unifDist have hsimp : ∀ a' : β, ((fiberSize π a' : ℝ) / (Fintype.card α : ℝ)) * ((1 / (fiberSize π a' : ℝ)) * ∑ i ∈ fiber π a', ∑ j ∈ fiber π b, P i j) = (1 / (Fintype.card α : ℝ)) * ∑ i ∈ fiber π a', ∑ j ∈ fiber π b, P i j := by intro a' have hca' : (0 : ℝ) < fiberSize π a' := Nat.cast_pos.mpr (fiberSize_pos hπ a') field_simp [ne_of_gt hn, ne_of_gt hca'] simp_rw [hsimp, ← Finset.mul_sum, sum_fiber_eq_univ π] rw [Finset.sum_comm, Finset.mul_sum] rw [hpush_macro] have hconst : ∀ i ∈ fiber π a, ∑ j ∈ fiber π b, unifDist α i * pushforward (unifDist α) P j = (1 / (Fintype.card α : ℝ)) * ∑ j ∈ fiber π b, pushforward (unifDist α) P j := by intro i _; unfold unifDist; rw [← Finset.mul_sum] rw [Finset.sum_congr rfl hconst, Finset.sum_const, nsmul_eq_mul] change (fiberSize π a : ℝ) * ((1 / (Fintype.card α : ℝ)) * _) = ((fiberSize π a : ℝ) / (Fintype.card α : ℝ)) * _ ring rw [hsumA, hsumB] at hls rw [Finset.sum_product] at hls have hwa : 0 < fiberWeight π a := div_pos (Nat.cast_pos.mpr (fiberSize_pos hπ a)) hn rw [mul_div_mul_left _ _ (ne_of_gt hwa)] at hls exact hls /-- **Theorem 1A (Variational Reduction Upper Bound)**: Causal emergence is bounded above by the pure intervention-reweighting gap `I_u(Q_π) - I_w(Q_π)`. -/ theorem causalEmergence_le_reweight_gap {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] [Nonempty α] {π : α → β} (hπ : Function.Surjective π) {P : α → α → ℝ} (hP : IsStochastic P) : causalEmergence π P ≤ mutualInfo (unifDist β) (macroKernel π P) - mutualInfo (fiberWeight π) (macroKernel π P) := by have h := effectiveInfo_ge_macro_mutualInfo hπ hP unfold causalEmergence effectiveInfo at h ⊢ linarith /-- Exact Effective Information of the canonical lift: zero DPI loss (`EI(P^{(Q,π)}) = I_w(Q)`). -/ theorem effectiveInfo_canonicalLift {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] [Nonempty α] {π : α → β} (hπ : Function.Surjective π) {Q : β → β → ℝ} (hQ : IsStochastic Q) : effectiveInfo (canonicalLift π Q) = mutualInfo (fiberWeight π) Q := by have hu : IsProbDist (unifDist α) := unifDist_isProbDist α have hw : IsProbDist (fiberWeight π) := fiberWeight_isProbDist π have hP : IsStochastic (canonicalLift π Q) := canonicalLift_isStochastic hπ hQ rw [effectiveInfo, mutualInfo_eq_kl_sum hu hP, mutualInfo_eq_kl_sum hw hQ] have hpush : ∀ j : α, pushforward (unifDist α) (canonicalLift π Q) j = pushforward (fiberWeight π) Q (π j) / (fiberSize π (π j) : ℝ) := by intro j unfold pushforward canonicalLift unifDist fiberWeight rw [← sum_fiber_eq_univ π] have hfib : ∀ a : β, ∑ i ∈ fiber π a, (1 / (Fintype.card α : ℝ)) * (Q (π i) (π j) / (fiberSize π (π j) : ℝ)) = ((fiberSize π a : ℝ) / (Fintype.card α : ℝ)) * Q a (π j) / (fiberSize π (π j) : ℝ) := by intro a have hcongr : ∀ i ∈ fiber π a, (1 / (Fintype.card α : ℝ)) * (Q (π i) (π j) / (fiberSize π (π j) : ℝ)) = (1 / (Fintype.card α : ℝ)) * (Q a (π j) / (fiberSize π (π j) : ℝ)) := by intro i hi; rw [(Finset.mem_filter.mp hi).2] rw [Finset.sum_congr rfl hcongr, Finset.sum_const, nsmul_eq_mul] change (fiberSize π a : ℝ) * _ = _ ring simp_rw [hfib, ← Finset.sum_div] rw [← sum_fiber_eq_univ π] refine Finset.sum_congr rfl fun a _ => ?_ have hrow : ∀ i ∈ fiber π a, ∑ j : α, (unifDist α i * canonicalLift π Q i j) * Real.log (canonicalLift π Q i j / pushforward (unifDist α) (canonicalLift π Q) j) = (1 / (Fintype.card α : ℝ)) * ∑ b : β, Q a b * Real.log (Q a b / pushforward (fiberWeight π) Q b) := by intro i hi have hπi : π i = a := (Finset.mem_filter.mp hi).2 rw [← sum_fiber_eq_univ π, Finset.mul_sum] refine Finset.sum_congr rfl fun b _ => ?_ have hcb : (0 : ℝ) < fiberSize π b := Nat.cast_pos.mpr (fiberSize_pos hπ b) have hcell : ∀ j ∈ fiber π b, (unifDist α i * canonicalLift π Q i j) * Real.log (canonicalLift π Q i j / pushforward (unifDist α) (canonicalLift π Q) j) = ((1 / (Fintype.card α : ℝ)) * (Q a b / (fiberSize π b : ℝ))) * Real.log (Q a b / pushforward (fiberWeight π) Q b) := by intro j hj have hπj : π j = b := (Finset.mem_filter.mp hj).2 rw [hpush j] simp only [canonicalLift, unifDist, hπi, hπj] rw [div_div_div_cancel_right₀ (ne_of_gt hcb)] rw [Finset.sum_congr rfl hcell, Finset.sum_const, nsmul_eq_mul] change (fiberSize π b : ℝ) * _ = _ field_simp [ne_of_gt hcb] rw [Finset.sum_congr rfl hrow, Finset.sum_const, nsmul_eq_mul, ← mul_assoc, Finset.mul_sum] refine Finset.sum_congr rfl fun b _ => ?_ change (fiberSize π a : ℝ) * (1 / (Fintype.card α : ℝ)) * (Q a b * Real.log (Q a b / pushforward (fiberWeight π) Q b)) = ((fiberSize π a : ℝ) / (Fintype.card α : ℝ) * Q a b) * Real.log (Q a b / pushforward (fiberWeight π) Q b) ring /-- **Theorem 1B (Exact Realizability of the Variational Reduction)**: Every macro-kernel `Q` is realized with zero DPI loss by `canonicalLift π Q`. -/ theorem causalEmergence_canonicalLift {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] [Nonempty α] {π : α → β} (hπ : Function.Surjective π) {Q : β → β → ℝ} (hQ : IsStochastic Q) : causalEmergence π (canonicalLift π Q) = mutualInfo (unifDist β) Q - mutualInfo (fiberWeight π) Q := by unfold causalEmergence rw [macroKernel_canonicalLift hπ Q, effectiveInfo_canonicalLift hπ hQ] rfl /-- Exact physics decomposition of the reweighting gap into output-degeneracy shift plus the heavy-state noise bonus minus the light-state noise penalty. -/ theorem reweight_gap_eq_shift_plus_noise {β : Type*} [Fintype β] (w u : β → ℝ) (Q : β → β → ℝ) : mutualInfo u Q - mutualInfo w Q = (shannonEntropy (pushforward u Q) - shannonEntropy (pushforward w Q)) + ∑ a : β, (w a - u a) * shannonEntropy (Q a) := by unfold mutualInfo condEntropy have hsum : ∑ a : β, (w a - u a) * shannonEntropy (Q a) = (∑ a : β, w a * shannonEntropy (Q a)) - ∑ a : β, u a * shannonEntropy (Q a) := by simp_rw [sub_mul, Finset.sum_sub_distrib] linarith /-- **Corollary 1C (Exact No-Emergence Theorem for Balanced Coarse-Grainings)**: If every macrostate has the same number of microstates, then causal emergence is NEVER positive. -/ theorem causalEmergence_nonpos_of_balanced {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] [Nonempty α] [Nonempty β] {π : α → β} (hπ : Function.Surjective π) (hbal : ∀ a b : β, fiberSize π a = fiberSize π b) {P : α → α → ℝ} (hP : IsStochastic P) : causalEmergence π P ≤ 0 := by have hw_eq : fiberWeight π = unifDist β := by ext a unfold fiberWeight unifDist have hsum := sum_fiberSize π have hall : ∑ b : β, fiberSize π b = Fintype.card β * fiberSize π a := by have : ∑ b : β, fiberSize π b = ∑ _b : β, fiberSize π a := Finset.sum_congr rfl fun b _ => hbal b a rw [this, Finset.sum_const, Finset.card_univ, smul_eq_mul] have hcard_eq : (Fintype.card α : ℝ) = (Fintype.card β : ℝ) * (fiberSize π a : ℝ) := by exact_mod_cast (hsum.symm.trans hall) have hca : (0 : ℝ) < fiberSize π a := Nat.cast_pos.mpr (fiberSize_pos hπ a) have hm : (0 : ℝ) < Fintype.card β := Nat.cast_pos.mpr Fintype.card_pos rw [hcard_eq] field_simp [ne_of_gt hca, ne_of_gt hm] have hle := causalEmergence_le_reweight_gap hπ hP rw [hw_eq, sub_self] at hle exact hle end CoarseGraining /-! ## Section 3: Universal Concavity Ceiling & Non-Asymptotic Speed Limit -/ section ConcavityCeiling /-- Concavity upper bound on the reweighting gap for any distribution `w` bounded below by `c`. -/ theorem reweight_gap_le_concavity {β : Type*} [Fintype β] [Nonempty β] {w : β → ℝ} {Q : β → β → ℝ} {c : ℝ} (hw : IsProbDist w) (hQ : IsStochastic Q) (hc0 : 0 ≤ c) (hc : ∀ a, c ≤ w a) : mutualInfo (unifDist β) Q - mutualInfo w Q ≤ (1 - (Fintype.card β : ℝ) * c) * mutualInfo (unifDist β) Q := by set m : ℝ := (Fintype.card β : ℝ) have hm : 0 < m := Nat.cast_pos.mpr Fintype.card_pos set t : ℝ := m * c have ht0 : 0 ≤ t := mul_nonneg (le_of_lt hm) hc0 have ht1 : t ≤ 1 := by have hsum : ∑ _a : β, c ≤ ∑ a : β, w a := Finset.sum_le_sum fun a _ => hc a simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, hw.2] at hsum exact hsum rcases eq_or_lt_of_le ht1 with ht_eq | ht_lt · have hw_eq : w = unifDist β := by ext a have hdiff_nn : ∀ b : β, 0 ≤ w b - c := fun b => sub_nonneg.mpr (hc b) have hsum0 : ∑ b : β, (w b - c) = 0 := by rw [Finset.sum_sub_distrib, hw.2, Finset.sum_const, Finset.card_univ, nsmul_eq_mul] linarith have hwa : w a - c = 0 := (Finset.sum_eq_zero_iff_of_nonneg fun b _ => hdiff_nn b).mp hsum0 a (Finset.mem_univ a) unfold unifDist have hc_eq : c = 1 / m := by have : m * c = 1 := ht_eq field_simp [ne_of_gt hm]; linarith linarith rw [hw_eq, sub_self, ht_eq, sub_self, zero_mul] · let r : β → ℝ := fun a => (w a - c) / (1 - t) have h1t : 0 < 1 - t := by linarith have hr : IsProbDist r := by refine ⟨fun a => div_nonneg (sub_nonneg.mpr (hc a)) (le_of_lt h1t), ?_⟩ unfold r rw [← Finset.sum_div, Finset.sum_sub_distrib, hw.2, Finset.sum_const, Finset.card_univ, nsmul_eq_mul] exact div_self (ne_of_gt h1t) have hw_comb : w = fun a => t * unifDist β a + (1 - t) * r a := by ext a unfold unifDist r have htm : t * (1 / m) = c := by dsimp only [t]; field_simp [ne_of_gt hm] rw [htm, mul_div_cancel₀ _ (ne_of_gt h1t)] ring have hconc := mutualInfo_concave (unifDist_isProbDist β) hr hQ ht0 ht1 rw [← hw_comb] at hconc have hr_nn : 0 ≤ mutualInfo r Q := mutualInfo_nonneg hr hQ have hmul_nn : 0 ≤ (1 - t) * mutualInfo r Q := mul_nonneg (le_of_lt h1t) hr_nn linarith /-- **Theorem 2A (Universal Minimum-Fiber Concavity Ceiling)**: If every macrostate has at least `cmin` microstates, then `ΔEI(P, π) ≤ (1 - m * cmin / n) * log m`. -/ theorem causalEmergence_le_min_fiber_bound {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] [Nonempty α] [Nonempty β] {π : α → β} (hπ : Function.Surjective π) {P : α → α → ℝ} (hP : IsStochastic P) {cmin : ℕ} (hcmin : ∀ a : β, cmin ≤ fiberSize π a) : causalEmergence π P ≤ (1 - (Fintype.card β : ℝ) * (cmin : ℝ) / (Fintype.card α : ℝ)) * Real.log (Fintype.card β) := by have hn : (0 : ℝ) < Fintype.card α := Nat.cast_pos.mpr Fintype.card_pos have hw := fiberWeight_isProbDist π have hQ := macroKernel_isStochastic hπ hP have h1 := causalEmergence_le_reweight_gap hπ hP have hc : ∀ a : β, (cmin : ℝ) / (Fintype.card α : ℝ) ≤ fiberWeight π a := fun a => div_le_div_of_nonneg_right (Nat.cast_le.mpr (hcmin a)) (le_of_lt hn) have h2 := reweight_gap_le_concavity hw hQ (by positivity) hc have h3 : mutualInfo (unifDist β) (macroKernel π P) ≤ Real.log (Fintype.card β) := mutualInfo_le_log_card (unifDist_isProbDist β) hQ have hcoeff_nn : 0 ≤ 1 - (Fintype.card β : ℝ) * ((cmin : ℝ) / (Fintype.card α : ℝ)) := by have hsum : ∑ _a : β, ((cmin : ℝ) / (Fintype.card α : ℝ)) ≤ ∑ a : β, fiberWeight π a := Finset.sum_le_sum fun a _ => hc a simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, hw.2] at hsum linarith have hmul : (1 - (Fintype.card β : ℝ) * ((cmin : ℝ) / (Fintype.card α : ℝ))) * mutualInfo (unifDist β) (macroKernel π P) ≤ (1 - (Fintype.card β : ℝ) * ((cmin : ℝ) / (Fintype.card α : ℝ))) * Real.log (Fintype.card β) := mul_le_mul_of_nonneg_left h3 hcoeff_nn have heq : (Fintype.card β : ℝ) * ((cmin : ℝ) / (Fintype.card α : ℝ)) = (Fintype.card β : ℝ) * (cmin : ℝ) / (Fintype.card α : ℝ) := by ring rw [heq] at h2 hmul linarith /-- **Theorem 2B (Universal `(n, m)` Concavity Ceiling)**: For every micro-kernel `P` on `n` states and every surjective coarse-graining onto `m` states, `ΔEI(P, π) ≤ (1 - m / n) * log m`. -/ theorem causalEmergence_le_one_sub_ratio_mul_log {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] [Nonempty α] [Nonempty β] {π : α → β} (hπ : Function.Surjective π) {P : α → α → ℝ} (hP : IsStochastic P) : causalEmergence π P ≤ (1 - (Fintype.card β : ℝ) / (Fintype.card α : ℝ)) * Real.log (Fintype.card β) := by have h := causalEmergence_le_min_fiber_bound hπ hP (cmin := 1) (fun a => fiberSize_pos hπ a) simpa using h /-- Elementary quadratic-tangent upper bound on `(1 - x / n) * log x` valid for any parameter `L > 0`. -/ theorem one_sub_div_mul_log_le_param {n x L : ℝ} (hn : 0 < n) (hx0 : 0 < x) (hxn : x ≤ n) (hL : 0 < L) : (1 - x / n) * Real.log x ≤ (L + Real.log n - Real.log L - 1) ^ 2 / (4 * L) := by have hlog : Real.log x ≤ Real.log n - Real.log L - 1 + L * (x / n) := by have hpos : 0 < L * (x / n) := mul_pos hL (div_pos hx0 hn) have h1 := Real.log_le_sub_one_of_pos hpos have h2 : Real.log (L * (x / n)) = Real.log L + Real.log x - Real.log n := by rw [Real.log_mul (ne_of_gt hL) (ne_of_gt (div_pos hx0 hn)), Real.log_div (ne_of_gt hx0) (ne_of_gt hn)] ring linarith have h1x : 0 ≤ 1 - x / n := by have : x / n ≤ 1 := (div_le_one hn).mpr hxn linarith set B : ℝ := Real.log n - Real.log L - 1 have hmul : (1 - x / n) * Real.log x ≤ (1 - x / n) * (B + L * (x / n)) := mul_le_mul_of_nonneg_left hlog h1x have hquad : (1 - x / n) * (B + L * (x / n)) ≤ (L + B) ^ 2 / (4 * L) := by have hsq : 0 ≤ (2 * L * (x / n) - (L - B)) ^ 2 := sq_nonneg _ have h4L : 0 < 4 * L := by positivity rw [le_div_iff₀ h4L] nlinarith have hLB : L + B = L + Real.log n - Real.log L - 1 := by dsimp only [B]; ring rw [hLB] at hquad linarith /-- **Theorem 3 (Universal Non-Asymptotic Speed Limit on Causal Emergence)**: For every finite state space of size `n ≥ 2`, every coarse-graining `π` onto any `m` macrostates, and every stochastic micro-kernel `P`, $$\Delta\mathrm{EI}(P, \pi) \le \ln n - \ln(\ln n) - 1 + \frac{(\ln(\ln n) + 1)^2}{4 \ln n}.$$ -/ theorem causalEmergence_universal_upper_bound {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] [Nonempty β] (hn2 : 2 ≤ Fintype.card α) {π : α → β} (hπ : Function.Surjective π) {P : α → α → ℝ} (hP : IsStochastic P) : causalEmergence π P ≤ Real.log (Fintype.card α) - Real.log (Real.log (Fintype.card α)) - 1 + (Real.log (Real.log (Fintype.card α)) + 1) ^ 2 / (4 * Real.log (Fintype.card α)) := by have : Nonempty α := Fintype.card_pos_iff.mp (by omega) have h1 := causalEmergence_le_one_sub_ratio_mul_log hπ hP have hn_pos : (0 : ℝ) < Fintype.card α := by positivity have hm_pos : (0 : ℝ) < Fintype.card β := Nat.cast_pos.mpr Fintype.card_pos have hmn : (Fintype.card β : ℝ) ≤ Fintype.card α := Nat.cast_le.mpr (Fintype.card_le_of_surjective π hπ) have hln_pos : 0 < Real.log (Fintype.card α) := Real.log_pos (by exact_mod_cast (show 1 < Fintype.card α by omega)) have h2 := one_sub_div_mul_log_le_param hn_pos hm_pos hmn hln_pos have halg : (Real.log (Fintype.card α) + Real.log (Fintype.card α) - Real.log (Real.log (Fintype.card α)) - 1) ^ 2 / (4 * Real.log (Fintype.card α)) = Real.log (Fintype.card α) - Real.log (Real.log (Fintype.card α)) - 1 + (Real.log (Real.log (Fintype.card α)) + 1) ^ 2 / (4 * Real.log (Fintype.card α)) := by field_simp [ne_of_gt hln_pos] ring linarith end ConcavityCeiling /-! ## Section 4: Spike Coarse-Graining, Noisy Erasure-Collapse & Exact Asymptotic Law -/ section SpikeAndErasureCollapse /-- Canonical spike coarse-graining `Fin n → Fin m` (`m ≥ 1`, `n ≥ m`): states `0, ..., m - 2` are singletons mapped to `1, ..., m - 1`, and the remaining `n - m + 1` states all merge into macrostate `0`. -/ def spikeMap (n m : ℕ) (hm : 0 < m) : Fin n → Fin m := fun i => if h : i.1 < m - 1 then ⟨i.1 + 1, by omega⟩ else ⟨0, hm⟩ lemma spikeMap_surjective {n m : ℕ} (hm : 0 < m) (hmn : m ≤ n) : Function.Surjective (spikeMap n m hm) := by intro a by_cases ha : a.1 = 0 · refine ⟨⟨m - 1, by omega⟩, ?_⟩ ext; simp [spikeMap, ha] · refine ⟨⟨a.1 - 1, by omega⟩, ?_⟩ ext have hlt : a.1 - 1 < m - 1 := by omega simp [spikeMap, hlt] omega lemma spikeMap_fiberSize_ne_zero {n m : ℕ} (hm : 0 < m) (hmn : m ≤ n) {a : Fin m} (ha : a.1 ≠ 0) : fiberSize (spikeMap n m hm) a = 1 := by unfold fiberSize fiber have hset : Finset.univ.filter (fun i : Fin n => spikeMap n m hm i = a) = {⟨a.1 - 1, by omega⟩} := by ext i simp only [Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_singleton] constructor · intro hi unfold spikeMap at hi split_ifs at hi with hlt · apply Fin.ext; have := congrArg Fin.val hi; dsimp at this ⊢; omega · exfalso; have := congrArg Fin.val hi; dsimp at this; exact ha this.symm · intro hi subst hi ext have ha_lt := a.isLt have hlt : a.1 - 1 < m - 1 := by omega simp [spikeMap, hlt] omega rw [hset, Finset.card_singleton] lemma spikeMap_fiberSize_zero {n m : ℕ} (hm : 0 < m) (hmn : m ≤ n) : fiberSize (spikeMap n m hm) ⟨0, hm⟩ = n - m + 1 := by have hsum := sum_fiberSize (spikeMap n m hm) rw [Fintype.card_fin] at hsum have hsplit := Finset.add_sum_erase (s := (Finset.univ : Finset (Fin m))) (f := fiberSize (spikeMap n m hm)) (a := ⟨0, hm⟩) (Finset.mem_univ _) have herase : ∑ a ∈ Finset.univ.erase (⟨0, hm⟩ : Fin m), fiberSize (spikeMap n m hm) a = m - 1 := by have h1 : ∀ a ∈ Finset.univ.erase (⟨0, hm⟩ : Fin m), fiberSize (spikeMap n m hm) a = 1 := by intro a ha have hne : a ≠ ⟨0, hm⟩ := (Finset.mem_erase.mp ha).1 exact spikeMap_fiberSize_ne_zero hm hmn (fun h => hne (Fin.ext h)) rw [Finset.sum_congr rfl h1, Finset.sum_const, Finset.card_erase_of_mem (Finset.mem_univ _), Finset.card_univ, Fintype.card_fin, smul_eq_mul, mul_one] omega /-- The 1-parameter symmetric noisy macro-kernel `Q(α)` on `Fin m` (`m ≥ 2`): - heavy macrostate `0` stays at `0` with probability `α` and scatters uniformly to `1, ..., m - 1` with probability `(1 - α) / (m - 1)` each; - every light macrostate `a ≠ 0` transitions deterministically to itself. -/ noncomputable def symNoisyKernel (m : ℕ) (α : ℝ) : Fin m → Fin m → ℝ := fun a b => if a.1 = 0 then if b.1 = 0 then α else (1 - α) / (m - 1 : ℝ) else if b = a then 1 else 0 /-- Complete erasure-collapse macro-kernel `Q(0)`. -/ noncomputable def erasureCollapseKernel (m : ℕ) : Fin m → Fin m → ℝ := symNoisyKernel m 0 lemma symNoisyKernel_isStochastic {m : ℕ} (hm : 2 ≤ m) {α : ℝ} (h0 : 0 ≤ α) (h1 : α ≤ 1) : IsStochastic (symNoisyKernel m α) := by have hm1 : (0 : ℝ) < (m : ℝ) - 1 := by have : (2 : ℝ) ≤ m := by exact_mod_cast hm linarith intro a by_cases ha : a.1 = 0 · refine ⟨fun b => ?_, ?_⟩ · simp only [symNoisyKernel, ha, ↓reduceIte] split_ifs · exact h0 · exact div_nonneg (by linarith) (le_of_lt hm1) · have hzero : (⟨0, by omega⟩ : Fin m) ∈ (Finset.univ : Finset (Fin m)) := Finset.mem_univ _ rw [← Finset.add_sum_erase _ _ hzero] have h0val : symNoisyKernel m α a ⟨0, by omega⟩ = α := by simp [symNoisyKernel, ha] have hrest : ∀ b ∈ Finset.univ.erase (⟨0, by omega⟩ : Fin m), symNoisyKernel m α a b = (1 - α) / ((m : ℝ) - 1) := by intro b hb have hne : b.1 ≠ 0 := fun h => (Finset.mem_erase.mp hb).1 (Fin.ext h) simp [symNoisyKernel, ha, hne] rw [h0val, Finset.sum_congr rfl hrest, Finset.sum_const, Finset.card_erase_of_mem hzero, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] have hcast : ((m - 1 : ℕ) : ℝ) = (m : ℝ) - 1 := by rw [Nat.cast_sub (by omega)]; simp rw [hcast, mul_div_cancel₀ _ (ne_of_gt hm1)] ring · refine ⟨fun b => by simp only [symNoisyKernel, ha, ↓reduceIte]; split_ifs <;> norm_num, ?_⟩ simp [symNoisyKernel, ha] /-- Helper: Shannon entropy of a distribution `(x, (1-x)/(m-1), ..., (1-x)/(m-1))` on `Fin m`. -/ lemma shannonEntropy_one_spike {m : ℕ} (hm : 2 ≤ m) {x : ℝ} (hx1 : x ≤ 1) {q : Fin m → ℝ} (hq0 : q ⟨0, by omega⟩ = x) (hq_rest : ∀ b : Fin m, b.1 ≠ 0 → q b = (1 - x) / ((m : ℝ) - 1)) : shannonEntropy q = binEnt x + (1 - x) * Real.log ((m : ℝ) - 1) := by have hm1 : (0 : ℝ) < (m : ℝ) - 1 := by have : (2 : ℝ) ≤ m := by exact_mod_cast hm linarith unfold shannonEntropy have hzero : (⟨0, by omega⟩ : Fin m) ∈ (Finset.univ : Finset (Fin m)) := Finset.mem_univ _ rw [← Finset.add_sum_erase _ _ hzero, hq0] have hrest : ∀ b ∈ Finset.univ.erase (⟨0, by omega⟩ : Fin m), entTerm (q b) = entTerm ((1 - x) / ((m : ℝ) - 1)) := by intro b hb have hne : b.1 ≠ 0 := fun h => (Finset.mem_erase.mp hb).1 (Fin.ext h) rw [hq_rest b hne] rw [Finset.sum_congr rfl hrest, Finset.sum_const, Finset.card_erase_of_mem hzero, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] have hcast : ((m - 1 : ℕ) : ℝ) = (m : ℝ) - 1 := by rw [Nat.cast_sub (by omega)]; simp rw [hcast] unfold binEnt entTerm rcases eq_or_lt_of_le (show 0 ≤ 1 - x by linarith) with h1x0 | h1x_pos · have hx1' : 1 - x = 0 := h1x0.symm simp [hx1'] · rw [Real.log_div (ne_of_gt h1x_pos) (ne_of_gt hm1)] field_simp [ne_of_gt hm1] ring /-- Helper: exact mutual information of `symNoisyKernel m α` under any spike input distribution `w = (p, (1-p)/(m-1), ..., (1-p)/(m-1))`. -/ lemma mutualInfo_symNoisy_spike {m : ℕ} (hm : 2 ≤ m) {p α : ℝ} (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (_hα0 : 0 ≤ α) (hα1 : α ≤ 1) {w : Fin m → ℝ} (hw0 : w ⟨0, by omega⟩ = p) (hw_rest : ∀ a : Fin m, a.1 ≠ 0 → w a = (1 - p) / ((m : ℝ) - 1)) : mutualInfo w (symNoisyKernel m α) = binEnt (p * α) - p * binEnt α + (1 - p) * Real.log ((m : ℝ) - 1) := by have hzero : (⟨0, by omega⟩ : Fin m) ∈ (Finset.univ : Finset (Fin m)) := Finset.mem_univ _ have hpf0 : pushforward w (symNoisyKernel m α) ⟨0, by omega⟩ = p * α := by unfold pushforward rw [← Finset.add_sum_erase _ _ hzero, hw0] have h00 : symNoisyKernel m α ⟨0, by omega⟩ ⟨0, by omega⟩ = α := by simp [symNoisyKernel] have hrest : ∀ a ∈ Finset.univ.erase (⟨0, by omega⟩ : Fin m), w a * symNoisyKernel m α a ⟨0, by omega⟩ = 0 := by intro a ha have hne : a.1 ≠ 0 := fun h => (Finset.mem_erase.mp ha).1 (Fin.ext h) have hne' : (⟨0, by omega⟩ : Fin m) ≠ a := fun h => hne (congrArg Fin.val h).symm simp [symNoisyKernel, hne, hne'] rw [h00, Finset.sum_eq_zero hrest, add_zero] have hpf_rest : ∀ b : Fin m, b.1 ≠ 0 → pushforward w (symNoisyKernel m α) b = (1 - p * α) / ((m : ℝ) - 1) := by intro b hb unfold pushforward rw [← Finset.add_sum_erase _ _ hzero, hw0] have h0b : symNoisyKernel m α ⟨0, by omega⟩ b = (1 - α) / ((m : ℝ) - 1) := by simp [symNoisyKernel, hb] have hb_mem : b ∈ Finset.univ.erase (⟨0, by omega⟩ : Fin m) := Finset.mem_erase.mpr ⟨fun h => hb (congrArg Fin.val h), Finset.mem_univ b⟩ have hsum : ∑ a ∈ Finset.univ.erase (⟨0, by omega⟩ : Fin m), w a * symNoisyKernel m α a b = w b := by rw [← Finset.add_sum_erase _ _ hb_mem] have hbb : symNoisyKernel m α b b = 1 := by simp [symNoisyKernel, hb] have hother : ∀ a ∈ (Finset.univ.erase (⟨0, by omega⟩ : Fin m)).erase b, w a * symNoisyKernel m α a b = 0 := by intro a ha have hneb : a ≠ b := (Finset.mem_erase.mp ha).1 have hne0 : a.1 ≠ 0 := fun h => (Finset.mem_erase.mp (Finset.mem_erase.mp ha).2).1 (Fin.ext h) simp [symNoisyKernel, hne0, hneb.symm] rw [hbb, mul_one, Finset.sum_eq_zero hother, add_zero] rw [h0b, hsum, hw_rest b hb] ring have hpα1 : p * α ≤ 1 := by nlinarith have hH_out : shannonEntropy (pushforward w (symNoisyKernel m α)) = binEnt (p * α) + (1 - p * α) * Real.log ((m : ℝ) - 1) := shannonEntropy_one_spike hm hpα1 hpf0 hpf_rest have hH_row0 : shannonEntropy (symNoisyKernel m α ⟨0, by omega⟩) = binEnt α + (1 - α) * Real.log ((m : ℝ) - 1) := shannonEntropy_one_spike hm hα1 (by simp [symNoisyKernel]) (fun b hb => by simp [symNoisyKernel, hb]) have hH_row_rest : ∀ a : Fin m, a.1 ≠ 0 → shannonEntropy (symNoisyKernel m α a) = 0 := by intro a ha unfold shannonEntropy refine Finset.sum_eq_zero fun b _ => ?_ simp only [symNoisyKernel, ha, ↓reduceIte] split_ifs <;> simp have hcond : condEntropy w (symNoisyKernel m α) = p * (binEnt α + (1 - α) * Real.log ((m : ℝ) - 1)) := by unfold condEntropy rw [← Finset.add_sum_erase _ _ hzero, hw0, hH_row0] have hrest : ∀ a ∈ Finset.univ.erase (⟨0, by omega⟩ : Fin m), w a * shannonEntropy (symNoisyKernel m α a) = 0 := by intro a ha have hne : a.1 ≠ 0 := fun h => (Finset.mem_erase.mp ha).1 (Fin.ext h) rw [hH_row_rest a hne, mul_zero] rw [Finset.sum_eq_zero hrest, add_zero] unfold mutualInfo rw [hH_out, hcond] ring /-- The `α`-dependent gain `G_{m,p}(α) = h(α/m) - h(pα) + (p - 1/m) h(α)` over complete erasure. -/ noncomputable def symNoisyGain (m : ℕ) (p α : ℝ) : ℝ := binEnt (α / (m : ℝ)) - binEnt (p * α) + (p - 1 / (m : ℝ)) * binEnt α /-- **Theorem 4A (Exact Closed-Form Emergence of the 1-Parameter Symmetric Noisy Family)**: For all `m ≥ 2`, `n ≥ m`, and `α ∈ [0, 1]`, with `p = (n - m + 1) / n`, the causal emergence of the lifted symmetric noisy kernel `Q(α)` on the spike partition is EXACTLY `(p - 1/m) * log (m - 1) + h(α / m) - h(p * α) + (p - 1/m) * h(α)`. -/ theorem symNoisyKernel_causalEmergence_exact {n m : ℕ} (hm : 2 ≤ m) (hmn : m ≤ n) {α : ℝ} (hα0 : 0 ≤ α) (hα1 : α ≤ 1) : causalEmergence (spikeMap n m (by omega)) (canonicalLift (spikeMap n m (by omega)) (symNoisyKernel m α)) = (((n - m + 1 : ℕ) : ℝ) / (n : ℝ) - 1 / (m : ℝ)) * Real.log ((m : ℝ) - 1) + symNoisyGain m (((n - m + 1 : ℕ) : ℝ) / (n : ℝ)) α := by have : Nonempty (Fin n) := ⟨⟨0, by omega⟩⟩ have hsurj := spikeMap_surjective (n := n) (m := m) (by omega) hmn have hQ := symNoisyKernel_isStochastic hm hα0 hα1 rw [causalEmergence_canonicalLift hsurj hQ] have hm_pos : (0 : ℝ) < m := Nat.cast_pos.mpr (by omega) have hm1_pos : (0 : ℝ) < (m : ℝ) - 1 := by have : (2 : ℝ) ≤ m := by exact_mod_cast hm linarith have hn_pos : (0 : ℝ) < n := Nat.cast_pos.mpr (by omega) set p : ℝ := ((n - m + 1 : ℕ) : ℝ) / (n : ℝ) have hp0 : 0 ≤ p := by positivity have hp1 : p ≤ 1 := by dsimp only [p] rw [div_le_one hn_pos] exact_mod_cast (show n - m + 1 ≤ n by omega) have hu0 : unifDist (Fin m) ⟨0, by omega⟩ = 1 / (m : ℝ) := by simp [unifDist] have hu_rest : ∀ a : Fin m, a.1 ≠ 0 → unifDist (Fin m) a = (1 - 1 / (m : ℝ)) / ((m : ℝ) - 1) := by intro a _ simp only [unifDist, Fintype.card_fin] field_simp [ne_of_gt hm_pos, ne_of_gt hm1_pos] have hIu := mutualInfo_symNoisy_spike hm (p := 1 / (m : ℝ)) (by positivity) (by rw [div_le_one hm_pos]; exact_mod_cast (show 1 ≤ m by omega)) hα0 hα1 hu0 hu_rest have hw0 : fiberWeight (spikeMap n m (by omega)) ⟨0, by omega⟩ = p := by unfold fiberWeight rw [Fintype.card_fin, spikeMap_fiberSize_zero (by omega) hmn] have hw_rest : ∀ a : Fin m, a.1 ≠ 0 → fiberWeight (spikeMap n m (by omega)) a = (1 - p) / ((m : ℝ) - 1) := by intro a ha unfold fiberWeight rw [Fintype.card_fin, spikeMap_fiberSize_ne_zero (by omega) hmn ha] dsimp only [p] have hcast : ((n - m + 1 : ℕ) : ℝ) = (n : ℝ) - (m : ℝ) + 1 := by rw [Nat.cast_add, Nat.cast_sub hmn]; simp rw [hcast] field_simp [ne_of_gt hn_pos, ne_of_gt hm1_pos] ring have hIw := mutualInfo_symNoisy_spike hm hp0 hp1 hα0 hα1 hw0 hw_rest rw [hIu, hIw] unfold symNoisyGain have hdiv : (1 / (m : ℝ)) * α = α / (m : ℝ) := by ring rw [hdiv] ring /-- **Theorem 4B (Exact Closed-Form Emergence of Complete Erasure-Collapse `Q(0)`)**: For all `m ≥ 2` and `n ≥ m`, the noisy erasure-collapse kernel achieves EXACTLY $$\Delta\mathrm{EI} = \left(1 - \frac{m}{n}\right)\left(1 - \frac{1}{m}\right)\ln(m - 1).$$ -/ theorem erasureCollapse_causalEmergence_exact {n m : ℕ} (hm : 2 ≤ m) (hmn : m ≤ n) : causalEmergence (spikeMap n m (by omega)) (canonicalLift (spikeMap n m (by omega)) (erasureCollapseKernel m)) = (1 - (m : ℝ) / (n : ℝ)) * (1 - 1 / (m : ℝ)) * Real.log ((m : ℝ) - 1) := by unfold erasureCollapseKernel rw [symNoisyKernel_causalEmergence_exact hm hmn le_rfl (by norm_num)] have hG0 : symNoisyGain m (((n - m + 1 : ℕ) : ℝ) / (n : ℝ)) 0 = 0 := by simp [symNoisyGain] rw [hG0, add_zero] have hm_pos : (0 : ℝ) < m := Nat.cast_pos.mpr (by omega) have hn_pos : (0 : ℝ) < n := Nat.cast_pos.mpr (by omega) have hcast : ((n - m + 1 : ℕ) : ℝ) = (n : ℝ) - (m : ℝ) + 1 := by rw [Nat.cast_add, Nat.cast_sub hmn]; simp rw [hcast] congr 1 field_simp [ne_of_gt hn_pos, ne_of_gt hm_pos] ring /-- **Theorem 4C (Exact Three-Term Asymptotic Law of Causal Emergence)**: $$\Delta\mathrm{EI}^*(n) = \ln n - \ln(\ln n) - 1 + o(1).$$ -/ theorem causalEmergence_exact_three_term_asymptotic : ∀ ε > 0, ∃ N : ℕ, ∀ n ≥ N, (∀ (m : ℕ) (_ : 0 < m) (π : Fin n → Fin m) (_ : Function.Surjective π) (P : Fin n → Fin n → ℝ) (_ : IsStochastic P), causalEmergence π P ≤ Real.log n - Real.log (Real.log n) - 1 + ε) ∧ (∃ (m : ℕ) (_ : 0 < m) (π : Fin n → Fin m) (_ : Function.Surjective π) (P : Fin n → Fin n → ℝ) (_ : IsStochastic P), Real.log n - Real.log (Real.log n) - 1 - ε ≤ causalEmergence π P) := by intro ε hε have htend_ub : Filter.Tendsto (fun x : ℝ => (Real.log x + 1) ^ 2 / (4 * x)) Filter.atTop (nhds 0) := by have h1 : Filter.Tendsto (fun x : ℝ => Real.log x / x ^ (1/2 : ℝ)) Filter.atTop (nhds 0) := (isLittleO_log_rpow_atTop (show (0 : ℝ) < 1/2 by norm_num)).tendsto_div_nhds_zero have h2 : Filter.Tendsto (fun x : ℝ => (1 : ℝ) / x ^ (1/2 : ℝ)) Filter.atTop (nhds 0) := tendsto_const_nhds.div_atTop (tendsto_rpow_atTop (by norm_num)) have h3 : Filter.Tendsto (fun x : ℝ => (Real.log x / x ^ (1/2 : ℝ) + 1 / x ^ (1/2 : ℝ)) ^ 2 / 4) Filter.atTop (nhds ((0 + 0) ^ 2 / 4)) := ((h1.add h2).pow 2).div_const 4 simp only [add_zero, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, zero_div] at h3 refine h3.congr' ?_ filter_upwards [Filter.eventually_gt_atTop (0 : ℝ)] with x hx have hsq : (x ^ (1/2 : ℝ)) ^ 2 = x := by rw [← Real.rpow_natCast, ← Real.rpow_mul (le_of_lt hx)] norm_num have hne : x ^ (1/2 : ℝ) ≠ 0 := ne_of_gt (Real.rpow_pos_of_pos hx _) field_simp [hne, ne_of_gt hx] rw [hsq] ring have htend_ub_n : Filter.Tendsto (fun n : ℕ => (Real.log (Real.log (n : ℝ)) + 1) ^ 2 / (4 * Real.log (n : ℝ))) Filter.atTop (nhds 0) := htend_ub.comp (Real.tendsto_log_atTop.comp tendsto_natCast_atTop_atTop) have hev_ub : ∀ᶠ n : ℕ in Filter.atTop, (Real.log (Real.log (n : ℝ)) + 1) ^ 2 / (4 * Real.log (n : ℝ)) < ε := (tendsto_order.mp htend_ub_n).2 ε hε have hlog_div_n : Filter.Tendsto (fun n : ℕ => Real.log (n : ℝ) / (n : ℝ)) Filter.atTop (nhds 0) := by have h := (isLittleO_log_rpow_atTop (show (0 : ℝ) < 1 by norm_num)).tendsto_div_nhds_zero simpa [Function.comp_def, Real.rpow_one] using h.comp tendsto_natCast_atTop_atTop have hlog_atTop : Filter.Tendsto (fun n : ℕ => Real.log (n : ℝ)) Filter.atTop Filter.atTop := Real.tendsto_log_atTop.comp tendsto_natCast_atTop_atTop have hdiv_log : Filter.Tendsto (fun n : ℕ => Real.log (Real.log (n : ℝ)) / Real.log (n : ℝ)) Filter.atTop (nhds 0) := by have h := (isLittleO_log_rpow_atTop (show (0 : ℝ) < 1 by norm_num)).tendsto_div_nhds_zero simpa [Function.comp_def, Real.rpow_one] using h.comp hlog_atTop have h_lb_err : Filter.Tendsto (fun n : ℕ => Real.log (Real.log (n : ℝ)) / Real.log (n : ℝ) + 4 * (Real.log (n : ℝ) / (n : ℝ)) * Real.log (n : ℝ) + 4 * (Real.log (n : ℝ) / (n : ℝ))) Filter.atTop (nhds 0) := by have hlog2_div_n : Filter.Tendsto (fun n : ℕ => (Real.log (n : ℝ) / (n : ℝ)) * Real.log (n : ℝ)) Filter.atTop (nhds 0) := by have h := (isLittleO_log_rpow_atTop (show (0 : ℝ) < 1/2 by norm_num)).tendsto_div_nhds_zero have hsq : Filter.Tendsto (fun n : ℕ => (Real.log (n : ℝ) / (n : ℝ) ^ (1/2 : ℝ)) ^ 2) Filter.atTop (nhds 0) := by simpa [Function.comp_def] using (h.pow 2).comp tendsto_natCast_atTop_atTop refine hsq.congr' ?_ filter_upwards [Filter.eventually_gt_atTop 0] with n hn have hnp : (0 : ℝ) < n := Nat.cast_pos.mpr hn have hsq' : ((n : ℝ) ^ (1/2 : ℝ)) ^ 2 = n := by rw [← Real.rpow_natCast, ← Real.rpow_mul (le_of_lt hnp)]; norm_num rw [div_pow, hsq'] ring have hcomb := (hdiv_log.add (hlog2_div_n.const_mul 4)).add (hlog_div_n.const_mul 4) have hcomb' : Filter.Tendsto (fun n : ℕ => Real.log (Real.log (n : ℝ)) / Real.log (n : ℝ) + 4 * ((Real.log (n : ℝ) / (n : ℝ)) * Real.log (n : ℝ)) + 4 * (Real.log (n : ℝ) / (n : ℝ))) Filter.atTop (nhds 0) := by simpa using hcomb exact hcomb'.congr (fun n => by ring) have hev_lb_err : ∀ᶠ n : ℕ in Filter.atTop, Real.log (Real.log (n : ℝ)) / Real.log (n : ℝ) + 4 * (Real.log (n : ℝ) / (n : ℝ)) * Real.log (n : ℝ) + 4 * (Real.log (n : ℝ) / (n : ℝ)) < ε := (tendsto_order.mp h_lb_err).2 ε hε have hev_small : ∀ᶠ n : ℕ in Filter.atTop, Real.log (n : ℝ) / (n : ℝ) < 1 / 8 := (tendsto_order.mp hlog_div_n).2 (1 / 8) (by norm_num) have hev_log : ∀ᶠ n : ℕ in Filter.atTop, (3 : ℝ) < Real.log (n : ℝ) := (Filter.tendsto_atTop.mp hlog_atTop 4).mono fun _ hn => by linarith have hev_all := hev_ub.and (hev_lb_err.and (hev_small.and (hev_log.and (Filter.eventually_ge_atTop 20)))) obtain ⟨N, hN⟩ := Filter.eventually_atTop.mp hev_all refine ⟨N, fun n hn => ?_⟩ obtain ⟨hub, hlb, hsmall, hlog3, hn20⟩ := hN n hn have hn_pos : (0 : ℝ) < n := by positivity have hln_pos : 0 < Real.log (n : ℝ) := by linarith constructor · intro m hm π hπ P hP have : Nonempty (Fin m) := ⟨⟨0, hm⟩⟩ have h := causalEmergence_universal_upper_bound (α := Fin n) (β := Fin m) (by simp; omega) hπ hP simp only [Fintype.card_fin] at h linarith · set x : ℝ := (n : ℝ) / Real.log (n : ℝ) have hx_gt8 : 8 < x := by dsimp only [x] rw [lt_div_iff₀ hln_pos] have hsm : Real.log (n : ℝ) < (1 / 8 : ℝ) * (n : ℝ) := (div_lt_iff₀ hn_pos).mp hsmall linarith set m : ℕ := Nat.floor x have hm_le_x : (m : ℝ) ≤ x := Nat.floor_le (by linarith) have hx_lt_m1 : x - 1 < (m : ℝ) := by have := Nat.lt_floor_add_one x; linarith have hm_ge2 : 2 ≤ m := by have : (2 : ℝ) ≤ (m : ℝ) := by linarith exact_mod_cast this have hmn : m ≤ n := by have h1 : (m : ℝ) ≤ (n : ℝ) := by have hx_le_n : x ≤ (n : ℝ) := by dsimp only [x] rw [div_le_iff₀ hln_pos] nlinarith linarith exact_mod_cast h1 refine ⟨m, by omega, spikeMap n m (by omega), spikeMap_surjective (by omega) hmn, canonicalLift (spikeMap n m (by omega)) (erasureCollapseKernel m), canonicalLift_isStochastic (spikeMap_surjective (by omega) hmn) (symNoisyKernel_isStochastic hm_ge2 le_rfl (by norm_num)), ?_⟩ rw [erasureCollapse_causalEmergence_exact hm_ge2 hmn] have hm_ge_half_x : x / 2 ≤ (m : ℝ) := by linarith have h1_mn : 1 - 1 / Real.log (n : ℝ) ≤ 1 - (m : ℝ) / (n : ℝ) := by have : (m : ℝ) / (n : ℝ) ≤ 1 / Real.log (n : ℝ) := by calc (m : ℝ) / (n : ℝ) ≤ x / (n : ℝ) := div_le_div_of_nonneg_right hm_le_x (le_of_lt hn_pos) _ = 1 / Real.log (n : ℝ) := by dsimp only [x]; field_simp [ne_of_gt hn_pos, ne_of_gt hln_pos] linarith have h1_m : 1 - 2 * (Real.log (n : ℝ) / (n : ℝ)) ≤ 1 - 1 / (m : ℝ) := by have h1 : 1 / (m : ℝ) ≤ 1 / (x / 2) := one_div_le_one_div_of_le (by linarith) hm_ge_half_x have h2 : 1 / (x / 2) = 2 * (Real.log (n : ℝ) / (n : ℝ)) := by dsimp only [x]; field_simp [ne_of_gt hn_pos, ne_of_gt hln_pos] linarith have h_m1_ge : x * (1 - 2 / x) ≤ (m : ℝ) - 1 := by have : x * (1 - 2 / x) = x - 2 := by field_simp [show x ≠ 0 by linarith] linarith have h1_2x_pos : 0 < 1 - 2 / x := by have : 2 / x < 1 / 4 := by rw [div_lt_div_iff₀ (by linarith) (by norm_num)]; linarith linarith have hlog_m1 : Real.log (n : ℝ) - Real.log (Real.log (n : ℝ)) - 4 * (Real.log (n : ℝ) / (n : ℝ)) ≤ Real.log ((m : ℝ) - 1) := by have hmono := Real.log_le_log (mul_pos (by linarith) h1_2x_pos) h_m1_ge rw [Real.log_mul (by linarith) (ne_of_gt h1_2x_pos)] at hmono have hlogx : Real.log x = Real.log (n : ℝ) - Real.log (Real.log (n : ℝ)) := Real.log_div (ne_of_gt hn_pos) (ne_of_gt hln_pos) have hlog_1u : -(4 / x) ≤ Real.log (1 - 2 / x) := by have hpos_inv : 0 < 1 / (1 - 2 / x) := one_div_pos.mpr h1_2x_pos have hle := Real.log_le_sub_one_of_pos hpos_inv rw [one_div, Real.log_inv] at hle have hfrac : (1 - 2 / x)⁻¹ - 1 ≤ 4 / x := by rw [inv_eq_one_div, sub_le_iff_le_add, div_le_iff₀ h1_2x_pos] have h4x_le : 4 / x ≤ 1 / 2 := by rw [div_le_div_iff₀ (by linarith) (by norm_num)]; linarith have hmul_nn : 0 ≤ (2 / x) * (1 - 4 / x) := mul_nonneg (by positivity) (by linarith) have hprod : (4 / x + 1) * (1 - 2 / x) = 1 + (2 / x) * (1 - 4 / x) := by ring linarith linarith have h4x : 4 / x = 4 * (Real.log (n : ℝ) / (n : ℝ)) := by dsimp only [x]; field_simp [ne_of_gt hn_pos, ne_of_gt hln_pos] linarith have hlog_m1_pos : 0 ≤ Real.log ((m : ℝ) - 1) := Real.log_nonneg (by linarith) have hlog_m1_le : Real.log ((m : ℝ) - 1) ≤ Real.log (n : ℝ) := Real.log_le_log (by linarith) (by have : (m : ℝ) ≤ (n : ℝ) := by exact_mod_cast hmn linarith) have hprod_ge : (1 - 1 / Real.log (n : ℝ)) * (1 - 2 * (Real.log (n : ℝ) / (n : ℝ))) ≤ (1 - (m : ℝ) / (n : ℝ)) * (1 - 1 / (m : ℝ)) := mul_le_mul h1_mn h1_m (by linarith) (by have : (m : ℝ) / (n : ℝ) ≤ 1 := (div_le_one hn_pos).mpr (by exact_mod_cast hmn) linarith) have hstep1 : (1 - 1 / Real.log (n : ℝ)) * (1 - 2 * (Real.log (n : ℝ) / (n : ℝ))) * Real.log ((m : ℝ) - 1) ≤ (1 - (m : ℝ) / (n : ℝ)) * (1 - 1 / (m : ℝ)) * Real.log ((m : ℝ) - 1) := mul_le_mul_of_nonneg_right hprod_ge hlog_m1_pos have hprod_ge2 : 1 - 1 / Real.log (n : ℝ) - 2 * (Real.log (n : ℝ) / (n : ℝ)) ≤ (1 - 1 / Real.log (n : ℝ)) * (1 - 2 * (Real.log (n : ℝ) / (n : ℝ))) := by have hnn : 0 ≤ (1 / Real.log (n : ℝ)) * (2 * (Real.log (n : ℝ) / (n : ℝ))) := by positivity nlinarith have hstep2 : (1 - 1 / Real.log (n : ℝ) - 2 * (Real.log (n : ℝ) / (n : ℝ))) * Real.log ((m : ℝ) - 1) ≤ (1 - (m : ℝ) / (n : ℝ)) * (1 - 1 / (m : ℝ)) * Real.log ((m : ℝ) - 1) := le_trans (mul_le_mul_of_nonneg_right hprod_ge2 hlog_m1_pos) hstep1 have hstep3 : Real.log ((m : ℝ) - 1) - (1 / Real.log (n : ℝ)) * Real.log (n : ℝ) - 2 * (Real.log (n : ℝ) / (n : ℝ)) * Real.log (n : ℝ) ≤ (1 - 1 / Real.log (n : ℝ) - 2 * (Real.log (n : ℝ) / (n : ℝ))) * Real.log ((m : ℝ) - 1) := by have h1 : (1 / Real.log (n : ℝ)) * Real.log ((m : ℝ) - 1) ≤ (1 / Real.log (n : ℝ)) * Real.log (n : ℝ) := mul_le_mul_of_nonneg_left hlog_m1_le (by positivity) have h2 : (2 * (Real.log (n : ℝ) / (n : ℝ))) * Real.log ((m : ℝ) - 1) ≤ (2 * (Real.log (n : ℝ) / (n : ℝ))) * Real.log (n : ℝ) := mul_le_mul_of_nonneg_left hlog_m1_le (by positivity) linarith have hcancel : (1 / Real.log (n : ℝ)) * Real.log (n : ℝ) = 1 := one_div_mul_cancel (ne_of_gt hln_pos) have hnn_extra : 0 ≤ Real.log (Real.log (n : ℝ)) / Real.log (n : ℝ) := by have : 0 ≤ Real.log (Real.log (n : ℝ)) := Real.log_nonneg (by linarith) exact div_nonneg this (le_of_lt hln_pos) have hnn_extra2 : 0 ≤ 2 * (Real.log (n : ℝ) / (n : ℝ)) * Real.log (n : ℝ) := by positivity linarith end SpikeAndErasureCollapse /-! ## Section 5: The Noisy-Macro Paradox (Universal Anti-Determinism & Phase Transition) -/ section AntiDeterminism /-- A macro-kernel is a bijective deterministic (permutation) kernel if every row is a distinct standard basis vector. -/ def IsPermutationKernel {β : Type*} [DecidableEq β] (Q : β → β → ℝ) : Prop := ∃ σ : Equiv.Perm β, ∀ a b : β, Q a b = if b = σ a then 1 else 0 /-- A macro-kernel is deterministic (possibly degenerate) if every row is a point mass. -/ def IsDeterministicKernel {β : Type*} [DecidableEq β] (Q : β → β → ℝ) : Prop := ∃ f : β → β, ∀ a b : β, Q a b = if b = f a then 1 else 0 lemma isPermutationKernel_isStochastic {β : Type*} [Fintype β] [DecidableEq β] {Q : β → β → ℝ} (hQ : IsPermutationKernel Q) : IsStochastic Q := by rcases hQ with ⟨σ, hσ⟩ intro a refine ⟨fun b => by rw [hσ]; split_ifs <;> norm_num, ?_⟩ simp [hσ] /-- Exact mutual information of any permutation kernel: `I_p(Q) = H(p)`. -/ lemma mutualInfo_of_isPermutationKernel {β : Type*} [Fintype β] [DecidableEq β] {p : β → ℝ} {Q : β → β → ℝ} (hQ : IsPermutationKernel Q) : mutualInfo p Q = shannonEntropy p := by rcases hQ with ⟨σ, hσ⟩ have hpf : ∀ b : β, pushforward p Q b = p (σ.symm b) := by intro b unfold pushforward have hterm : ∀ a : β, p a * Q a b = if a = σ.symm b then p a else 0 := by intro a rw [hσ a b] by_cases h : a = σ.symm b · subst h; simp · have hne : b ≠ σ a := fun hb => h (by simp [hb]) simp [h, hne] simp [hterm] have hH_out : shannonEntropy (pushforward p Q) = shannonEntropy p := by unfold shannonEntropy simp_rw [hpf] exact Fintype.sum_equiv σ.symm _ _ fun _ => rfl have hcond : condEntropy p Q = 0 := by unfold condEntropy refine Finset.sum_eq_zero fun a _ => ?_ have hrow : shannonEntropy (Q a) = 0 := by unfold shannonEntropy refine Finset.sum_eq_zero fun b _ => ?_ rw [hσ a b]; split_ifs <;> simp rw [hrow, mul_zero] unfold mutualInfo rw [hH_out, hcond, sub_zero] /-- Exact reweighting gap of any permutation kernel: `I_u(Q) - I_w(Q) = log |β| - H(w)`. -/ lemma reweight_gap_of_isPermutationKernel {β : Type*} [Fintype β] [DecidableEq β] [Nonempty β] {w : β → ℝ} {Q : β → β → ℝ} (hQ : IsPermutationKernel Q) : mutualInfo (unifDist β) Q - mutualInfo w Q = Real.log (Fintype.card β) - shannonEntropy w := by rw [mutualInfo_of_isPermutationKernel hQ, mutualInfo_of_isPermutationKernel hQ, shannonEntropy_unif] /-- Single-row noise perturbation of the identity kernel: row `a₀` moves mass `ε` to `a₁`. -/ noncomputable def singleEdgeNoise {β : Type*} [DecidableEq β] (a₀ a₁ : β) (ε : ℝ) : β → β → ℝ := fun a b => if a = a₀ then if b = a₀ then 1 - ε else if b = a₁ then ε else 0 else if b = a then 1 else 0 lemma singleEdgeNoise_isStochastic {β : Type*} [Fintype β] [DecidableEq β] {a₀ a₁ : β} (hne : a₀ ≠ a₁) {ε : ℝ} (h0 : 0 ≤ ε) (h1 : ε ≤ 1) : IsStochastic (singleEdgeNoise a₀ a₁ ε) := by intro a by_cases ha : a = a₀ · rw [ha] refine ⟨fun b => by simp only [singleEdgeNoise, ↓reduceIte]; split_ifs <;> linarith, ?_⟩ have hsum : ∑ b : β, singleEdgeNoise a₀ a₁ ε a₀ b = (1 - ε) + ε := by rw [← Finset.add_sum_erase _ _ (Finset.mem_univ a₀)] have h00 : singleEdgeNoise a₀ a₁ ε a₀ a₀ = 1 - ε := by simp [singleEdgeNoise] have ha1_mem : a₁ ∈ Finset.univ.erase a₀ := Finset.mem_erase.mpr ⟨hne.symm, Finset.mem_univ a₁⟩ rw [h00, ← Finset.add_sum_erase _ _ ha1_mem] have h01 : singleEdgeNoise a₀ a₁ ε a₀ a₁ = ε := by simp [singleEdgeNoise, hne.symm] have hrest : ∀ b ∈ (Finset.univ.erase a₀).erase a₁, singleEdgeNoise a₀ a₁ ε a₀ b = 0 := by intro b hb have h1' : b ≠ a₁ := (Finset.mem_erase.mp hb).1 have h0' : b ≠ a₀ := (Finset.mem_erase.mp (Finset.mem_erase.mp hb).2).1 simp [singleEdgeNoise, h0', h1'] rw [h01, Finset.sum_eq_zero hrest, add_zero] rw [hsum]; ring · refine ⟨fun b => by simp only [singleEdgeNoise, ha, ↓reduceIte]; split_ifs <;> norm_num, ?_⟩ simp [singleEdgeNoise, ha] /-- **Theorem 5A (The Noisy-Macro Paradox / Universal Anti-Determinism Theorem)**: For EVERY finite state space `α`, EVERY macrostate space `β`, and EVERY **non-balanced** surjective coarse-graining `π : α → β`, purely bijective deterministic macro-dynamics is **NEVER optimal** for maximizing causal emergence: there exists an explicit noisy micro-kernel `P` whose causal emergence strictly beats EVERY micro-kernel `P'` inducing bijective deterministic macro-dynamics! -/ theorem universal_anti_determinism {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] [Nonempty α] [Nonempty β] {π : α → β} (hπ : Function.Surjective π) (hnonbal : ∃ a b : β, fiberSize π a ≠ fiberSize π b) : ∃ (P : α → α → ℝ), IsStochastic P ∧ ∀ (P' : α → α → ℝ), IsStochastic P' → IsPermutationKernel (macroKernel π P') → causalEmergence π P' < causalEmergence π P := by set w := fiberWeight π set u := unifDist β set m : ℝ := (Fintype.card β : ℝ) have hm_pos : 0 < m := Nat.cast_pos.mpr Fintype.card_pos have hn_pos : (0 : ℝ) < Fintype.card α := Nat.cast_pos.mpr Fintype.card_pos have hw := fiberWeight_isProbDist π have hu := unifDist_isProbDist β have hheavy : ∃ a₀ : β, u a₀ < w a₀ := by by_contra hall push Not at hall have hsum0 : ∑ a : β, (u a - w a) = 0 := by rw [Finset.sum_sub_distrib, hu.2, hw.2, sub_self] have heq : ∀ a : β, u a = w a := fun a => by have h0 := (Finset.sum_eq_zero_iff_of_nonneg fun b _ => sub_nonneg.mpr (hall b)).mp hsum0 a (Finset.mem_univ a) linarith obtain ⟨a, b, hab⟩ := hnonbal have ha := heq a have hb := heq b have hwa_eq : w a = w b := by have : u a = u b := rfl linarith unfold w fiberWeight at hwa_eq have hca : (fiberSize π a : ℝ) = (fiberSize π b : ℝ) := (div_left_inj' (ne_of_gt hn_pos)).mp hwa_eq exact hab (Nat.cast_injective hca) obtain ⟨a₀, ha₀_heavy⟩ := hheavy have ha₁_ex : ∃ a₁ : β, a₁ ≠ a₀ := by obtain ⟨a, b, hab⟩ := hnonbal by_cases h : a = a₀ · exact ⟨b, fun hb => hab (by rw [h, hb])⟩ · exact ⟨a, h⟩ obtain ⟨a₁, hne10⟩ := ha₁_ex have hne01 : a₀ ≠ a₁ := hne10.symm have hwa₀_pos : 0 < w a₀ := by have : 0 < u a₀ := by unfold u unifDist; positivity linarith have hwa₁_pos : 0 < w a₁ := div_pos (Nat.cast_pos.mpr (fiberSize_pos hπ a₁)) hn_pos set δ : ℝ := w a₀ - u a₀ have hδ_pos : 0 < δ := sub_pos.mpr ha₀_heavy set C : ℝ := 2 / m + w a₀ * |Real.log (w a₀ / w a₁)| + w a₀ * (2 + w a₀ / w a₁) + 1 set ε : ℝ := min (1 / 2) (Real.exp (-(C / δ))) have hε_pos : 0 < ε := lt_min (by norm_num) (Real.exp_pos _) have hε_half : ε ≤ 1 / 2 := min_le_left _ _ have hε_le_exp : ε ≤ Real.exp (-(C / δ)) := min_le_right _ _ have hε_le1 : ε ≤ 1 := by linarith set Q := singleEdgeNoise a₀ a₁ ε have hQ_stoch : IsStochastic Q := singleEdgeNoise_isStochastic hne01 (le_of_lt hε_pos) hε_le1 refine ⟨canonicalLift π Q, canonicalLift_isStochastic hπ hQ_stoch, ?_⟩ intro P' hP' hperm' have hP'_le : causalEmergence π P' ≤ Real.log (Fintype.card β) - shannonEntropy w := by have h1 := causalEmergence_le_reweight_gap hπ hP' rw [reweight_gap_of_isPermutationKernel hperm'] at h1 exact h1 rw [causalEmergence_canonicalLift hπ hQ_stoch, reweight_gap_eq_shift_plus_noise w u Q] have hrow_sum : ∑ a : β, (w a - u a) * shannonEntropy (Q a) = δ * binEnt ε := by rw [← Finset.add_sum_erase _ _ (Finset.mem_univ a₀)] have hrest : ∀ a ∈ Finset.univ.erase a₀, (w a - u a) * shannonEntropy (Q a) = 0 := by intro a ha have hne : a ≠ a₀ := (Finset.mem_erase.mp ha).1 have hH0 : shannonEntropy (Q a) = 0 := by unfold shannonEntropy refine Finset.sum_eq_zero fun b _ => ?_ simp only [Q, singleEdgeNoise, hne, ↓reduceIte] split_ifs <;> simp rw [hH0, mul_zero] have hH0 : shannonEntropy (Q a₀) = binEnt ε := by unfold shannonEntropy rw [← Finset.add_sum_erase _ _ (Finset.mem_univ a₀)] have ha1_mem : a₁ ∈ Finset.univ.erase a₀ := Finset.mem_erase.mpr ⟨hne10, Finset.mem_univ a₁⟩ rw [← Finset.add_sum_erase _ _ ha1_mem] have h00 : Q a₀ a₀ = 1 - ε := by simp [Q, singleEdgeNoise] have h01 : Q a₀ a₁ = ε := by simp [Q, singleEdgeNoise, hne10] have h0r : ∀ b ∈ (Finset.univ.erase a₀).erase a₁, entTerm (Q a₀ b) = 0 := by intro b hb have hb1 : b ≠ a₁ := (Finset.mem_erase.mp hb).1 have hb0 : b ≠ a₀ := (Finset.mem_erase.mp (Finset.mem_erase.mp hb).2).1 simp [Q, singleEdgeNoise, hb0, hb1] rw [h00, h01, Finset.sum_eq_zero h0r, add_zero, binEnt, add_comm] rw [hH0, Finset.sum_eq_zero hrest, add_zero] have hpf_Q : ∀ (p : β → ℝ) (b : β), pushforward p Q b = if b = a₀ then p a₀ * (1 - ε) else if b = a₁ then p a₁ + p a₀ * ε else p b := by intro p b unfold pushforward rw [← Finset.add_sum_erase _ _ (Finset.mem_univ a₀)] by_cases hb0 : b = a₀ · rw [hb0] have h00 : Q a₀ a₀ = 1 - ε := by simp [Q, singleEdgeNoise] have hrest : ∀ a ∈ Finset.univ.erase a₀, p a * Q a a₀ = 0 := by intro a ha have hne : a ≠ a₀ := (Finset.mem_erase.mp ha).1 simp [Q, singleEdgeNoise, hne, hne.symm] rw [h00, Finset.sum_eq_zero hrest, add_zero]; simp · by_cases hb1 : b = a₁ · rw [hb1] have h01 : Q a₀ a₁ = ε := by simp [Q, singleEdgeNoise, hne10] have ha1_mem : a₁ ∈ Finset.univ.erase a₀ := Finset.mem_erase.mpr ⟨hne10, Finset.mem_univ a₁⟩ rw [h01, ← Finset.add_sum_erase _ _ ha1_mem] have h11 : Q a₁ a₁ = 1 := by simp [Q, singleEdgeNoise, hne10] have hrest : ∀ a ∈ (Finset.univ.erase a₀).erase a₁, p a * Q a a₁ = 0 := by intro a ha have ha1' : a ≠ a₁ := (Finset.mem_erase.mp ha).1 have ha0' : a ≠ a₀ := (Finset.mem_erase.mp (Finset.mem_erase.mp ha).2).1 simp [Q, singleEdgeNoise, ha0', ha1'.symm] rw [h11, mul_one, Finset.sum_eq_zero hrest, add_zero] simp [hne10, add_comm] · have h0b : Q a₀ b = 0 := by simp [Q, singleEdgeNoise, hb0, hb1] have hb_mem : b ∈ Finset.univ.erase a₀ := Finset.mem_erase.mpr ⟨hb0, Finset.mem_univ b⟩ rw [h0b, mul_zero, zero_add, ← Finset.add_sum_erase _ _ hb_mem] have hbb : Q b b = 1 := by simp [Q, singleEdgeNoise, hb0] have hrest : ∀ a ∈ (Finset.univ.erase a₀).erase b, p a * Q a b = 0 := by intro a ha have hab' : a ≠ b := (Finset.mem_erase.mp ha).1 have ha0' : a ≠ a₀ := (Finset.mem_erase.mp (Finset.mem_erase.mp ha).2).1 simp [Q, singleEdgeNoise, ha0', hab'.symm] rw [hbb, mul_one, Finset.sum_eq_zero hrest, add_zero] simp [hb0, hb1] have hH_diff : ∀ p : β → ℝ, shannonEntropy (pushforward p Q) - shannonEntropy p = (entTerm (p a₀ * (1 - ε)) - entTerm (p a₀)) + (entTerm (p a₁ + p a₀ * ε) - entTerm (p a₁)) := by intro p unfold shannonEntropy rw [← Finset.sum_sub_distrib, ← Finset.add_sum_erase _ _ (Finset.mem_univ a₀)] have ha1_mem : a₁ ∈ Finset.univ.erase a₀ := Finset.mem_erase.mpr ⟨hne10, Finset.mem_univ a₁⟩ rw [← Finset.add_sum_erase _ _ ha1_mem] have hrest : ∀ b ∈ (Finset.univ.erase a₀).erase a₁, entTerm (pushforward p Q b) - entTerm (p b) = 0 := by intro b hb have hb1 : b ≠ a₁ := (Finset.mem_erase.mp hb).1 have hb0 : b ≠ a₀ := (Finset.mem_erase.mp (Finset.mem_erase.mp hb).2).1 rw [hpf_Q p b]; simp [hb0, hb1] rw [Finset.sum_eq_zero hrest, add_zero, hpf_Q p a₀, hpf_Q p a₁] simp [hne10] have hHu_lb : -(2 / m) * ε ≤ shannonEntropy (pushforward u Q) - Real.log (Fintype.card β) := by rw [← shannonEntropy_unif β, hH_diff u] have hua : u a₀ = 1 / m := rfl have hub : u a₁ = 1 / m := rfl rw [hua, hub] have hterm1 : entTerm (1 / m * (1 - ε)) - entTerm (1 / m) = (1 / m) * (-(1 - ε) * Real.log (1 - ε) + ε * Real.log (1 / m)) := by unfold entTerm rw [Real.log_mul (by positivity) (by linarith)] ring have hterm2 : entTerm (1 / m + 1 / m * ε) - entTerm (1 / m) = (1 / m) * (-(1 + ε) * Real.log (1 + ε) - ε * Real.log (1 / m)) := by have heq : 1 / m + 1 / m * ε = (1 / m) * (1 + ε) := by ring rw [heq] unfold entTerm rw [Real.log_mul (by positivity) (by linarith)] ring rw [hterm1, hterm2] have hlog_m : Real.log (1 - ε) ≤ -ε := by have := Real.log_le_sub_one_of_pos (show 0 < 1 - ε by linarith); linarith have hlog_p : Real.log (1 + ε) ≤ ε := by have := Real.log_le_sub_one_of_pos (show 0 < 1 + ε by linarith); linarith have hinner : -(2 * ε) ≤ -(1 - ε) * Real.log (1 - ε) + -(1 + ε) * Real.log (1 + ε) := by have ha' : (1 - ε) * ε ≤ -(1 - ε) * Real.log (1 - ε) := by nlinarith have hb' : -(1 + ε) * ε ≤ -(1 + ε) * Real.log (1 + ε) := by nlinarith nlinarith have hmul := mul_le_mul_of_nonneg_left hinner (show (0 : ℝ) ≤ 1 / m by positivity) have hmul_eq : (1 / m) * -(2 * ε) = -(2 / m) * ε := by ring linarith have hHw_ub : shannonEntropy (pushforward w Q) - shannonEntropy w ≤ (w a₀ * |Real.log (w a₀ / w a₁)| + w a₀ * (2 + w a₀ / w a₁)) * ε := by rw [hH_diff w] have hA : entTerm (w a₀ * (1 - ε)) - entTerm (w a₀) = w a₀ * (-(1 - ε) * Real.log (1 - ε) + ε * Real.log (w a₀)) := by unfold entTerm rw [Real.log_mul (ne_of_gt hwa₀_pos) (by linarith)] ring have hA_log : -(1 - ε) * Real.log (1 - ε) ≤ ε := by have hpos : 0 < 1 / (1 - ε) := one_div_pos.mpr (by linarith) have hle := Real.log_le_sub_one_of_pos hpos rw [one_div, Real.log_inv] at hle have hmul := mul_le_mul_of_nonneg_left hle (show 0 ≤ 1 - ε by linarith) have hsimp : (1 - ε) * ((1 - ε)⁻¹ - 1) = ε := by field_simp [show 1 - ε ≠ 0 by linarith]; ring linarith set r : ℝ := w a₀ / w a₁ have hr_pos : 0 < r := div_pos hwa₀_pos hwa₁_pos have hB : entTerm (w a₁ + w a₀ * ε) - entTerm (w a₁) = -w a₁ * (1 + r * ε) * Real.log (1 + r * ε) - w a₀ * ε * Real.log (w a₁) := by have heq : w a₁ + w a₀ * ε = w a₁ * (1 + r * ε) := by dsimp only [r]; field_simp [ne_of_gt hwa₁_pos] rw [heq] unfold entTerm rw [Real.log_mul (ne_of_gt hwa₁_pos) (by positivity)] have hwr : w a₁ * r = w a₀ := mul_div_cancel₀ _ (ne_of_gt hwa₁_pos) have hpart : -(w a₁ * (1 + r * ε) * Real.log (w a₁)) - -(w a₁ * Real.log (w a₁)) = -w a₀ * ε * Real.log (w a₁) := by calc -(w a₁ * (1 + r * ε) * Real.log (w a₁)) - -(w a₁ * Real.log (w a₁)) = -((w a₁ * r) * ε * Real.log (w a₁)) := by ring _ = -w a₀ * ε * Real.log (w a₁) := by rw [hwr]; ring linarith have hB_log : -w a₁ * (1 + r * ε) * Real.log (1 + r * ε) ≤ 0 := by have hrε_nn : 0 ≤ r * ε := mul_nonneg (le_of_lt hr_pos) (le_of_lt hε_pos) have hlog_nn : 0 ≤ Real.log (1 + r * ε) := Real.log_nonneg (by linarith) have hfac_nn : 0 ≤ w a₁ * (1 + r * ε) := mul_nonneg (le_of_lt hwa₁_pos) (by linarith) nlinarith have hlog_diff : w a₀ * ε * Real.log (w a₀) - w a₀ * ε * Real.log (w a₁) = w a₀ * ε * Real.log (w a₀ / w a₁) := by rw [Real.log_div (ne_of_gt hwa₀_pos) (ne_of_gt hwa₁_pos)]; ring have habs_le : Real.log (w a₀ / w a₁) ≤ |Real.log (w a₀ / w a₁)| := le_abs_self _ have hterm_comb : (entTerm (w a₀ * (1 - ε)) - entTerm (w a₀)) + (entTerm (w a₁ + w a₀ * ε) - entTerm (w a₁)) ≤ w a₀ * ε + w a₀ * ε * |Real.log (w a₀ / w a₁)| := by rw [hA, hB] have h1 : w a₀ * (-(1 - ε) * Real.log (1 - ε)) ≤ w a₀ * ε := mul_le_mul_of_nonneg_left hA_log (le_of_lt hwa₀_pos) have h2 : w a₀ * ε * Real.log (w a₀ / w a₁) ≤ w a₀ * ε * |Real.log (w a₀ / w a₁)| := mul_le_mul_of_nonneg_left habs_le (mul_nonneg (le_of_lt hwa₀_pos) (le_of_lt hε_pos)) linarith have hrr : 0 ≤ w a₀ * (1 + r) * ε := by positivity linarith have hbonus : C * ε ≤ δ * binEnt ε := by have hbin_ge : -ε * Real.log ε ≤ binEnt ε := by unfold binEnt entTerm have h2 : 0 ≤ -((1 - ε) * Real.log (1 - ε)) := entTerm_nonneg (by linarith) (by linarith) linarith have hlog_ge : C / δ ≤ -Real.log ε := by have h1 : Real.log ε ≤ -(C / δ) := by calc Real.log ε ≤ Real.log (Real.exp (-(C / δ))) := Real.log_le_log hε_pos hε_le_exp _ = -(C / δ) := Real.log_exp _ linarith have h1 : C * ε = δ * (ε * (C / δ)) := by field_simp [ne_of_gt hδ_pos] have h2 : δ * (ε * (C / δ)) ≤ δ * (-ε * Real.log ε) := by have : ε * (C / δ) ≤ ε * (-Real.log ε) := mul_le_mul_of_nonneg_left hlog_ge (le_of_lt hε_pos) nlinarith have h3 : δ * (-ε * Real.log ε) ≤ δ * binEnt ε := mul_le_mul_of_nonneg_left hbin_ge (le_of_lt hδ_pos) linarith rw [hrow_sum] have hstrict : Real.log (Fintype.card β) - shannonEntropy w < (shannonEntropy (pushforward u Q) - shannonEntropy (pushforward w Q)) + δ * binEnt ε := by linarith linarith /-- **Theorem 5B (Exact Hoel 4-State Benchmark Breakthrough, `n = 4, m = 2`)**: On Hoel–Albantakis–Tononi's canonical 4-state partition (`c = (3, 1)`), the explicit noisy Z-channel at `α = 19/20` strictly beats EVERY bijective deterministic macro-kernel (`≈ 0.14163` vs `0.13081` nats, `+8.27%`), proved via the exact integer identity `80 * (ΔEI_noisy(19/20) - ΔEI_det) = log ((23^23 * 20^20) / (3^3 * 21^42)) > 0`. -/ theorem hoel_four_state_noisy_beats_deterministic : ∀ (P' : Fin 4 → Fin 4 → ℝ), IsStochastic P' → IsPermutationKernel (macroKernel (spikeMap 4 2 (by omega)) P') → causalEmergence (spikeMap 4 2 (by omega)) P' < causalEmergence (spikeMap 4 2 (by omega)) (canonicalLift (spikeMap 4 2 (by omega)) (symNoisyKernel 2 (19 / 20))) := by intro P' hP' hperm' have hsurj := spikeMap_surjective (n := 4) (m := 2) (by omega) (by omega) have hP'_le := causalEmergence_le_reweight_gap hsurj hP' rw [reweight_gap_of_isPermutationKernel hperm'] at hP'_le have hHw : shannonEntropy (fiberWeight (spikeMap 4 2 (by omega))) = binEnt (3 / 4) := by have h0 : fiberWeight (spikeMap 4 2 (by omega)) 0 = 3 / 4 := by unfold fiberWeight rw [Fintype.card_fin] change (fiberSize (spikeMap 4 2 (by omega)) ⟨0, by omega⟩ : ℝ) / (4 : ℝ) = 3 / 4 rw [spikeMap_fiberSize_zero (by omega) (by omega)] norm_num have h1 : fiberWeight (spikeMap 4 2 (by omega)) 1 = 1 / 4 := by unfold fiberWeight rw [Fintype.card_fin] change (fiberSize (spikeMap 4 2 (by omega)) ⟨1, by omega⟩ : ℝ) / (4 : ℝ) = 1 / 4 rw [spikeMap_fiberSize_ne_zero (by omega) (by omega) (by decide)] norm_num unfold shannonEntropy binEnt rw [Fin.sum_univ_two, h0, h1] norm_num rw [Fintype.card_fin, hHw] at hP'_le rw [symNoisyKernel_causalEmergence_exact (n := 4) (m := 2) (by omega) (by omega) (by norm_num) (by norm_num)] have hlog1 : Real.log (((2 : ℕ) : ℝ) - 1) = 0 := by norm_num rw [hlog1, mul_zero, zero_add] unfold symNoisyGain have hnorm : ((4 - 2 + 1 : ℕ) : ℝ) / ((4 : ℕ) : ℝ) = 3 / 4 := by norm_num have hcast2' : ((2 : ℕ) : ℝ) = 2 := by norm_num rw [hnorm, hcast2'] -- Exact rational reduction: 80 * gap = log((23^23 * 20^20) / (3^3 * 21^42)) > 0 have hdiff_eq : 80 * ((binEnt ((19 / 20 : ℝ) / (2 : ℝ)) - binEnt ((3 / 4 : ℝ) * (19 / 20)) + (3 / 4 - 1 / (2 : ℝ)) * binEnt (19 / 20)) - (Real.log 2 - binEnt (3 / 4))) = Real.log (((23 : ℝ) ^ 23 * (20 : ℝ) ^ 20) / ((3 : ℝ) ^ 3 * (21 : ℝ) ^ 42)) := by have h1 : ((19 / 20 : ℝ) / (2 : ℝ)) = 19 / 40 := by norm_num have h2 : (1 : ℝ) - 19 / 40 = 21 / 40 := by norm_num have h3 : (3 / 4 : ℝ) * (19 / 20) = 57 / 80 := by norm_num have h4 : (1 : ℝ) - 57 / 80 = 23 / 80 := by norm_num have h5 : (1 : ℝ) - 19 / 20 = 1 / 20 := by norm_num have h6 : (1 : ℝ) - 3 / 4 = 1 / 4 := by norm_num have hlog40 : Real.log 40 = Real.log 2 + Real.log 20 := by rw [← Real.log_mul (by norm_num) (by norm_num)]; norm_num have hlog80 : Real.log 80 = 2 * Real.log 2 + Real.log 20 := by have : (80 : ℝ) = 2 * (2 * 20) := by norm_num rw [this, Real.log_mul (by norm_num) (by norm_num), Real.log_mul (by norm_num) (by norm_num)] ring have hlog57 : Real.log 57 = Real.log 3 + Real.log 19 := by rw [← Real.log_mul (by norm_num) (by norm_num)]; norm_num have hlog4 : Real.log 4 = 2 * Real.log 2 := by have : (4 : ℝ) = 2 * 2 := by norm_num rw [this, Real.log_mul (by norm_num) (by norm_num)]; ring unfold binEnt entTerm rw [h1, h2, h3, h4, h5, h6] rw [Real.log_div (by norm_num) (by norm_num), Real.log_div (by norm_num) (by norm_num), Real.log_div (by norm_num) (by norm_num), Real.log_div (by norm_num) (by norm_num), Real.log_div (by norm_num) (by norm_num), Real.log_div (by norm_num) (by norm_num), Real.log_div (by norm_num) (by norm_num), Real.log_div (by norm_num) (by norm_num), Real.log_div (by positivity) (by positivity), Real.log_mul (by positivity) (by positivity), Real.log_mul (by positivity) (by positivity), Real.log_pow, Real.log_pow, Real.log_pow, Real.log_pow, Real.log_one, hlog40, hlog80, hlog57, hlog4] push_cast ring have hlog_pos : 0 < Real.log (((23 : ℝ) ^ 23 * (20 : ℝ) ^ 20) / ((3 : ℝ) ^ 3 * (21 : ℝ) ^ 42)) := Real.log_pos (by norm_num) have hgap_pos : 0 < (binEnt ((19 / 20 : ℝ) / (2 : ℝ)) - binEnt ((3 / 4 : ℝ) * (19 / 20)) + (3 / 4 - 1 / (2 : ℝ)) * binEnt (19 / 20)) - (Real.log 2 - binEnt (3 / 4)) := by linarith have hcast2 : ((2 : ℕ) : ℝ) = 2 := by norm_num rw [hcast2] at hP'_le linarith /-- Smooth cancellation identity for `symNoisyGain m p α` on `α ≥ 0`: the `α * log α` singularities cancel identically! -/ lemma symNoisyGain_eq_smooth {m : ℕ} (hm : 0 < m) {p α : ℝ} (hp : 0 < p) (hα : 0 ≤ α) : symNoisyGain m p α = α * (Real.log (m : ℝ) / (m : ℝ) + p * Real.log p) + entTerm (1 - α / (m : ℝ)) - entTerm (1 - p * α) + (p - 1 / (m : ℝ)) * entTerm (1 - α) := by have hm_pos : (0 : ℝ) < m := Nat.cast_pos.mpr hm unfold symNoisyGain binEnt rcases eq_or_lt_of_le hα with rfl | hα_pos · simp [entTerm] · unfold entTerm rw [Real.log_div (ne_of_gt hα_pos) (ne_of_gt hm_pos), Real.log_mul (ne_of_gt hp) (ne_of_gt hα_pos)] ring /-- **Theorem 5C (Exact Critical Phase-Transition Derivative at Complete Erasure `α = 0`)**: The `α`-gain `G_{m,p}(α)` is right-differentiable at `α = 0` with exact slope $$G'_{m,p}(0^+) = \frac{\ln m}{m} + p \ln p.$$ -/ theorem symNoisyGain_hasDerivWithinAt_zero {m : ℕ} (hm : 0 < m) {p : ℝ} (hp : 0 < p) : HasDerivWithinAt (symNoisyGain m p) (Real.log (m : ℝ) / (m : ℝ) + p * Real.log p) (Set.Ici 0) 0 := by have hm_pos : (0 : ℝ) < m := Nat.cast_pos.mpr hm let g : ℝ → ℝ := fun α => α * (Real.log (m : ℝ) / (m : ℝ) + p * Real.log p) + entTerm (1 - α / (m : ℝ)) - entTerm (1 - p * α) + (p - 1 / (m : ℝ)) * entTerm (1 - α) have hderiv_ent : ∀ c : ℝ, HasDerivAt (fun α => entTerm (1 - c * α)) c 0 := by intro c have hlin : HasDerivAt (fun α : ℝ => 1 - c * α) (-c) 0 := by have h1 : HasDerivAt (fun α : ℝ => c * α) c 0 := by simpa using (hasDerivAt_id (0 : ℝ)).const_mul c simpa using (hasDerivAt_const (0 : ℝ) (1 : ℝ)).fun_sub h1 have hlog : HasDerivAt (fun α : ℝ => Real.log (1 - c * α)) (-c / (1 - c * 0)) 0 := hlin.log (by norm_num) have hmul := (hlin.fun_mul hlog).fun_neg have hval : -(-c * Real.log (1 - c * 0) + (1 - c * 0) * (-c / (1 - c * 0))) = c := by simp rw [hval] at hmul exact hmul have hd0 : HasDerivAt (fun α : ℝ => α * (Real.log (m : ℝ) / (m : ℝ) + p * Real.log p)) (Real.log (m : ℝ) / (m : ℝ) + p * Real.log p) 0 := by simpa using (hasDerivAt_id (0 : ℝ)).mul_const (Real.log (m : ℝ) / (m : ℝ) + p * Real.log p) have hd1 : HasDerivAt (fun α : ℝ => entTerm (1 - α / (m : ℝ))) (1 / (m : ℝ)) 0 := by have h := hderiv_ent (1 / (m : ℝ)) have heq : (fun α => entTerm (1 - (1 / (m : ℝ)) * α)) = (fun α => entTerm (1 - α / (m : ℝ))) := by ext α; congr 1; ring rwa [heq] at h have hd2 : HasDerivAt (fun α : ℝ => entTerm (1 - p * α)) p 0 := hderiv_ent p have hd3 : HasDerivAt (fun α : ℝ => (p - 1 / (m : ℝ)) * entTerm (1 - α)) (p - 1 / (m : ℝ)) 0 := by have h := (hderiv_ent 1).const_mul (p - 1 / (m : ℝ)) simpa using h have hdg : HasDerivAt g (Real.log (m : ℝ) / (m : ℝ) + p * Real.log p) 0 := by have h := ((hd0.fun_add hd1).fun_sub hd2).fun_add hd3 have hval : Real.log (m : ℝ) / (m : ℝ) + p * Real.log p + 1 / (m : ℝ) - p + (p - 1 / (m : ℝ)) = Real.log (m : ℝ) / (m : ℝ) + p * Real.log p := by ring rwa [hval] at h refine hdg.hasDerivWithinAt.congr ?_ ?_ · intro α hα exact symNoisyGain_eq_smooth hm hp hα · exact symNoisyGain_eq_smooth hm hp le_rfl /-- **Corollary 5D (Interior Noisy Phase Criterion)**: Whenever `log m / m + p * log p > 0`, there exists `α ∈ (0, 1)` strictly outperforming complete erasure `Q(0)`. -/ theorem symNoisyGain_pos_of_phase_supercritical {m : ℕ} (hm : 0 < m) {p : ℝ} (hp : 0 < p) (hcrit : 0 < Real.log (m : ℝ) / (m : ℝ) + p * Real.log p) : ∃ α : ℝ, 0 < α ∧ α < 1 ∧ 0 < symNoisyGain m p α := by have hd := symNoisyGain_hasDerivWithinAt_zero hm hp have h0 : symNoisyGain m p 0 = 0 := by simp [symNoisyGain] rw [hasDerivWithinAt_iff_tendsto_slope] at hd have hev := (tendsto_order.mp hd).1 0 hcrit rw [Filter.eventually_iff_exists_mem] at hev obtain ⟨s, hs, hpos⟩ := hev rw [mem_nhdsWithin] at hs obtain ⟨U, hU_open, h0U, hsub⟩ := hs obtain ⟨δ, hδ_pos, hball⟩ := Metric.isOpen_iff.mp hU_open 0 h0U set α : ℝ := min (1 / 2) (δ / 2) have hα_pos : 0 < α := lt_min (by norm_num) (by linarith) have hα_lt1 : α < 1 := lt_of_le_of_lt (min_le_left _ _) (by norm_num) have hα_mem : α ∈ s := by apply hsub refine ⟨hball ?_, ⟨le_of_lt hα_pos, ne_of_gt hα_pos⟩⟩ rw [Metric.mem_ball, Real.dist_eq, sub_zero, abs_of_pos hα_pos] exact lt_of_le_of_lt (min_le_right _ _) (by linarith) have hslope := hpos α hα_mem rw [slope_def_field, h0, sub_zero, sub_zero] at hslope exact ⟨α, hα_pos, hα_lt1, (div_pos_iff_of_pos_right hα_pos).mp hslope⟩ end AntiDeterminism /-! ## Section 6: Exact Bijective-Deterministic Ceiling & Unbounded Separations -/ section DeterministicCeilingsAndSeparations /-- Superadditivity of `x * log x` on `[1, ∞)`: `a log a + b log b ≤ (a + b - 1) log (a + b - 1)`. -/ lemma mul_log_superadd {a b : ℝ} (ha : 1 ≤ a) (hb : 1 ≤ b) : a * Real.log a + b * Real.log b ≤ (a + b - 1) * Real.log (a + b - 1) := by let g : ℝ → ℝ := fun t => (t + b - 1) * Real.log (t + b - 1) - t * Real.log t have hmono : MonotoneOn g (Set.Ici 1) := by apply monotoneOn_of_deriv_nonneg (convex_Ici 1) · -- Continuity of g on [1, ∞) refine ContinuousOn.sub ?_ ?_ · refine ContinuousOn.mul (continuous_id.add continuous_const |>.sub continuous_const).continuousOn ?_ refine ContinuousOn.log (continuous_id.add continuous_const |>.sub continuous_const).continuousOn ?_ intro t ht; simp only [Set.mem_Ici] at ht; linarith · refine continuousOn_id.mul (ContinuousOn.log continuousOn_id ?_) intro t ht; simp only [Set.mem_Ici] at ht; linarith · -- Differentiability on interior (1, ∞) intro t ht rw [interior_Ici, Set.mem_Ioi] at ht have ht_pos : 0 < t := by linarith have htb_pos : 0 < t + b - 1 := by linarith have hd1 : HasDerivAt (fun x : ℝ => x + b - 1) 1 t := by simpa using ((hasDerivAt_id t).add_const b).sub_const 1 have hdg : HasDerivAt g (Real.log (t + b - 1) - Real.log t) t := by have hA := hd1.fun_mul (hd1.log (ne_of_gt htb_pos)) have hB := (hasDerivAt_id t).fun_mul ((hasDerivAt_id t).log (ne_of_gt ht_pos)) exact (hA.fun_sub hB).congr_deriv (by simp only [id_eq, one_mul, one_div] rw [mul_inv_cancel₀ (ne_of_gt htb_pos), mul_inv_cancel₀ (ne_of_gt ht_pos)] ring) exact hdg.differentiableAt.differentiableWithinAt · -- Non-negative derivative on interior (1, ∞) intro t ht rw [interior_Ici, Set.mem_Ioi] at ht have ht_pos : 0 < t := by linarith have htb_pos : 0 < t + b - 1 := by linarith have hd1 : HasDerivAt (fun x : ℝ => x + b - 1) 1 t := by simpa using ((hasDerivAt_id t).add_const b).sub_const 1 have hdg : HasDerivAt g (Real.log (t + b - 1) - Real.log t) t := by have hA := hd1.fun_mul (hd1.log (ne_of_gt htb_pos)) have hB := (hasDerivAt_id t).fun_mul ((hasDerivAt_id t).log (ne_of_gt ht_pos)) exact (hA.fun_sub hB).congr_deriv (by simp only [id_eq, one_mul, one_div] rw [mul_inv_cancel₀ (ne_of_gt htb_pos), mul_inv_cancel₀ (ne_of_gt ht_pos)] ring) rw [hdg.deriv] have hle : Real.log t ≤ Real.log (t + b - 1) := Real.log_le_log ht_pos (by linarith) linarith have h1a := hmono Set.self_mem_Ici ha ha dsimp only [g] at h1a have hg1 : (1 + b - 1) * Real.log (1 + b - 1) - 1 * Real.log 1 = b * Real.log b := by simp linarith /-- Schur-convexity upper bound on `∑ c_a log c_a` for integer partitions `c_a ≥ 1`. -/ lemma sum_mul_log_partition_le {ι : Type*} [DecidableEq ι] (s : Finset ι) (hs : s.Nonempty) (c : ι → ℕ) (hc : ∀ a ∈ s, 1 ≤ c a) : ∑ a ∈ s, (c a : ℝ) * Real.log (c a) ≤ (((∑ a ∈ s, c a) - s.card + 1 : ℕ) : ℝ) * Real.log (((∑ a ∈ s, c a) - s.card + 1 : ℕ) : ℝ) := by induction s using Finset.induction_on with | empty => exact absurd hs Finset.not_nonempty_empty | @insert x t hx ih => by_cases ht : t.Nonempty · have hct : ∀ a ∈ t, 1 ≤ c a := fun a ha => hc a (Finset.mem_insert_of_mem ha) have hsum_t_ge : t.card ≤ ∑ a ∈ t, c a := by calc t.card = ∑ _a ∈ t, 1 := by simp _ ≤ ∑ a ∈ t, c a := Finset.sum_le_sum hct have hih := ih ht hct rw [Finset.sum_insert hx, Finset.sum_insert hx, Finset.card_insert_of_notMem hx] have hcx : (1 : ℝ) ≤ (c x : ℝ) := by exact_mod_cast hc x (Finset.mem_insert_self x t) have hrem : (1 : ℝ) ≤ (((∑ a ∈ t, c a) - t.card + 1 : ℕ) : ℝ) := by exact_mod_cast (show 1 ≤ (∑ a ∈ t, c a) - t.card + 1 by omega) have hsup := mul_log_superadd hcx hrem have hcast : (c x : ℝ) + (((∑ a ∈ t, c a) - t.card + 1 : ℕ) : ℝ) - 1 = (((c x + ∑ a ∈ t, c a) - (t.card + 1) + 1 : ℕ) : ℝ) := by have hnat : c x + ((∑ a ∈ t, c a) - t.card + 1) = ((c x + ∑ a ∈ t, c a) - (t.card + 1) + 1) + 1 := by have : 1 ≤ c x := hc x (Finset.mem_insert_self x t) omega have hreal : (c x : ℝ) + (((∑ a ∈ t, c a) - t.card + 1 : ℕ) : ℝ) = (((c x + ∑ a ∈ t, c a) - (t.card + 1) + 1 : ℕ) : ℝ) + 1 := by exact_mod_cast hnat linarith rw [hcast] at hsup linarith · rw [Finset.not_nonempty_iff_eq_empty] at ht subst ht have hcx1 : c x - 1 + 1 = c x := Nat.sub_add_cancel (hc x (Finset.mem_insert_self x ∅)) simp [hcx1] /-- Schur-concavity lower bound on Shannon entropy of fiber weights of any surjective map. -/ theorem shannonEntropy_fiberWeight_ge_spike {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] [Nonempty β] {π : α → β} (hπ : Function.Surjective π) : Real.log (Fintype.card α) - (((Fintype.card α - Fintype.card β + 1 : ℕ) : ℝ) / (Fintype.card α : ℝ)) * Real.log ((Fintype.card α - Fintype.card β + 1 : ℕ) : ℝ) ≤ shannonEntropy (fiberWeight π) := by have : Nonempty α := Fintype.card_pos_iff.mp (lt_of_lt_of_le Fintype.card_pos (Fintype.card_le_of_surjective π hπ)) have hn_pos : (0 : ℝ) < Fintype.card α := Nat.cast_pos.mpr Fintype.card_pos have hH_expand : shannonEntropy (fiberWeight π) = Real.log (Fintype.card α) - (1 / (Fintype.card α : ℝ)) * ∑ a : β, (fiberSize π a : ℝ) * Real.log (fiberSize π a) := by unfold shannonEntropy entTerm fiberWeight have hterm : ∀ a : β, -((fiberSize π a : ℝ) / (Fintype.card α : ℝ) * Real.log ((fiberSize π a : ℝ) / (Fintype.card α : ℝ))) = ((fiberSize π a : ℝ) / (Fintype.card α : ℝ)) * Real.log (Fintype.card α) - (1 / (Fintype.card α : ℝ)) * ((fiberSize π a : ℝ) * Real.log (fiberSize π a)) := by intro a have hca_pos : (0 : ℝ) < fiberSize π a := Nat.cast_pos.mpr (fiberSize_pos hπ a) rw [Real.log_div (ne_of_gt hca_pos) (ne_of_gt hn_pos)] ring simp_rw [hterm, Finset.sum_sub_distrib, ← Finset.sum_mul, ← Finset.mul_sum, ← Finset.sum_div, ← Nat.cast_sum, sum_fiberSize, div_self (ne_of_gt hn_pos), one_mul] rw [hH_expand] have hpart := sum_mul_log_partition_le Finset.univ Finset.univ_nonempty (fiberSize π) (fun a _ => fiberSize_pos hπ a) rw [sum_fiberSize, Finset.card_univ] at hpart have hmul := mul_le_mul_of_nonneg_left hpart (show (0 : ℝ) ≤ 1 / (Fintype.card α : ℝ) by positivity) have hrew : (1 / (Fintype.card α : ℝ)) * (((Fintype.card α - Fintype.card β + 1 : ℕ) : ℝ) * Real.log ((Fintype.card α - Fintype.card β + 1 : ℕ) : ℝ)) = (((Fintype.card α - Fintype.card β + 1 : ℕ) : ℝ) / (Fintype.card α : ℝ)) * Real.log ((Fintype.card α - Fintype.card β + 1 : ℕ) : ℝ) := by ring linarith /-- **Theorem 6A (Exact Sharp Bijective-Deterministic Ceiling)**: For EVERY micro-kernel `P` on `n` states and EVERY surjective coarse-graining `π` onto `m` macrostates whose induced macro-kernel is bijective deterministic (a permutation matrix), $$\Delta\mathrm{EI}(P, \pi) \le \ln\!\left(\frac{m}{n}\right) + \frac{n - m + 1}{n}\ln(n - m + 1).$$ -/ theorem bijectiveDeterministic_sharp_ceiling {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] [Nonempty β] {π : α → β} (hπ : Function.Surjective π) {P : α → α → ℝ} (hP : IsStochastic P) (hperm : IsPermutationKernel (macroKernel π P)) : causalEmergence π P ≤ Real.log ((Fintype.card β : ℝ) / (Fintype.card α : ℝ)) + (((Fintype.card α - Fintype.card β + 1 : ℕ) : ℝ) / (Fintype.card α : ℝ)) * Real.log ((Fintype.card α - Fintype.card β + 1 : ℕ) : ℝ) := by have : Nonempty α := Fintype.card_pos_iff.mp (lt_of_lt_of_le Fintype.card_pos (Fintype.card_le_of_surjective π hπ)) have hn_pos : (0 : ℝ) < Fintype.card α := Nat.cast_pos.mpr Fintype.card_pos have hm_pos : (0 : ℝ) < Fintype.card β := Nat.cast_pos.mpr Fintype.card_pos have h1 := causalEmergence_le_reweight_gap hπ hP rw [reweight_gap_of_isPermutationKernel hperm] at h1 have h2 := shannonEntropy_fiberWeight_ge_spike hπ rw [Real.log_div (ne_of_gt hm_pos) (ne_of_gt hn_pos)] linarith /-- **Theorem 6B (Exact Tightness of the Bijective-Deterministic Ceiling)**: For every `n ≥ m ≥ 1`, equality in Theorem 6A is achieved by lifting the identity macro-kernel along `spikeMap n m`. -/ theorem bijectiveDeterministic_ceiling_tight {n m : ℕ} (hm : 0 < m) (hmn : m ≤ n) : let idQ : Fin m → Fin m → ℝ := fun a b => if b = a then 1 else 0 causalEmergence (spikeMap n m hm) (canonicalLift (spikeMap n m hm) idQ) = Real.log ((m : ℝ) / (n : ℝ)) + (((n - m + 1 : ℕ) : ℝ) / (n : ℝ)) * Real.log ((n - m + 1 : ℕ) : ℝ) := by intro idQ have : Nonempty (Fin n) := ⟨⟨0, by omega⟩⟩ have : Nonempty (Fin m) := ⟨⟨0, hm⟩⟩ have hsurj := spikeMap_surjective (n := n) (m := m) hm hmn have hperm : IsPermutationKernel idQ := ⟨Equiv.refl _, fun _ _ => rfl⟩ rw [causalEmergence_canonicalLift hsurj (isPermutationKernel_isStochastic hperm), reweight_gap_of_isPermutationKernel hperm] have hn_pos : (0 : ℝ) < n := Nat.cast_pos.mpr (by omega) have hm_pos : (0 : ℝ) < m := Nat.cast_pos.mpr hm have hH_spike : shannonEntropy (fiberWeight (spikeMap n m hm)) = Real.log (n : ℝ) - (((n - m + 1 : ℕ) : ℝ) / (n : ℝ)) * Real.log ((n - m + 1 : ℕ) : ℝ) := by unfold shannonEntropy entTerm fiberWeight rw [← Finset.add_sum_erase _ _ (Finset.mem_univ (⟨0, hm⟩ : Fin m))] simp only [Fintype.card_fin] rw [spikeMap_fiberSize_zero hm hmn] have hrest : ∀ a ∈ Finset.univ.erase (⟨0, hm⟩ : Fin m), -((fiberSize (spikeMap n m hm) a : ℝ) / (n : ℝ) * Real.log ((fiberSize (spikeMap n m hm) a : ℝ) / (n : ℝ))) = (1 / (n : ℝ)) * Real.log (n : ℝ) := by intro a ha have hne : a.1 ≠ 0 := fun h => (Finset.mem_erase.mp ha).1 (Fin.ext h) rw [spikeMap_fiberSize_ne_zero hm hmn hne] simp only [Nat.cast_one, one_div, Real.log_inv] ring rw [Finset.sum_congr rfl hrest, Finset.sum_const, Finset.card_erase_of_mem (Finset.mem_univ _), Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] have hnm1_pos : (0 : ℝ) < ((n - m + 1 : ℕ) : ℝ) := by positivity rw [Real.log_div (ne_of_gt hnm1_pos) (ne_of_gt hn_pos)] have hcast1 : ((m - 1 : ℕ) : ℝ) = (m : ℝ) - 1 := by rw [Nat.cast_sub hm]; simp have hcast2 : ((n - m + 1 : ℕ) : ℝ) = (n : ℝ) - (m : ℝ) + 1 := by rw [Nat.cast_add, Nat.cast_sub hmn]; simp rw [hcast1] have hcombine : (((n - m + 1 : ℕ) : ℝ) / (n : ℝ)) * Real.log (n : ℝ) + ((m : ℝ) - 1) * ((1 / (n : ℝ)) * Real.log (n : ℝ)) = Real.log (n : ℝ) := by rw [hcast2]; field_simp [ne_of_gt hn_pos]; ring linarith rw [Fintype.card_fin, hH_spike, Real.log_div (ne_of_gt hm_pos) (ne_of_gt hn_pos)] ring /-- **Theorem 6C (Unbounded `Ω(log n)` Multiplicative Separation Over All Bijective Deterministic Macros at `m = n - 1`)**: When merging just two microstates out of `n`, EVERY bijective deterministic macro-kernel satisfies `ΔEI ≤ (2 log 2 - 1) / n`, whereas the noisy erasure-collapse kernel achieves `((n - 2) / (n * (n - 1))) * log (n - 2)`, beating EVERY bijective deterministic macro by an arbitrarily large multiplicative factor `C` for sufficiently large `n`! -/ theorem noisy_beats_bijectiveDeterministic_unbounded_ratio : (∀ (n : ℕ), 3 ≤ n → ∀ (π : Fin n → Fin (n - 1)), Function.Surjective π → ∀ (P : Fin n → Fin n → ℝ), IsStochastic P → IsPermutationKernel (macroKernel π P) → causalEmergence π P ≤ (2 * Real.log 2 - 1) / (n : ℝ)) ∧ (∀ C : ℝ, ∃ N : ℕ, ∀ n ≥ N, ∀ (hn : 3 ≤ n), C * ((2 * Real.log 2 - 1) / (n : ℝ)) < causalEmergence (spikeMap n (n - 1) (by omega)) (canonicalLift (spikeMap n (n - 1) (by omega)) (erasureCollapseKernel (n - 1)))) := by constructor · intro n hn π hπ P hP hperm have : Nonempty (Fin (n - 1)) := ⟨⟨0, by omega⟩⟩ have hceil := bijectiveDeterministic_sharp_ceiling hπ hP hperm simp only [Fintype.card_fin] at hceil have hnm1 : n - (n - 1) + 1 = 2 := by omega rw [hnm1] at hceil have hn_pos : (0 : ℝ) < n := by positivity have hcast : ((n - 1 : ℕ) : ℝ) = (n : ℝ) - 1 := by rw [Nat.cast_sub (by omega)]; simp rw [hcast] at hceil have hlog_le : Real.log (((n : ℝ) - 1) / (n : ℝ)) ≤ -1 / (n : ℝ) := by have hpos : 0 < ((n : ℝ) - 1) / (n : ℝ) := by have : (3 : ℝ) ≤ n := by exact_mod_cast hn exact div_pos (by linarith) hn_pos have h := Real.log_le_sub_one_of_pos hpos have heq : ((n : ℝ) - 1) / (n : ℝ) - 1 = -1 / (n : ℝ) := by field_simp [ne_of_gt hn_pos]; ring linarith push_cast at hceil have hrew : -1 / (n : ℝ) + (2 : ℝ) / (n : ℝ) * Real.log 2 = (2 * Real.log 2 - 1) / (n : ℝ) := by ring linarith · intro C have hconst_pos : 0 < 2 * Real.log 2 - 1 := by have h : (1 : ℝ) < 2 * Real.log 2 := by have h4 : Real.exp 1 < 4 := by have := Real.exp_one_lt_d9; linarith have hlog4 : 1 < Real.log 4 := by calc (1 : ℝ) = Real.log (Real.exp 1) := (Real.log_exp 1).symm _ < Real.log 4 := Real.log_lt_log (Real.exp_pos 1) h4 have h4eq : Real.log 4 = 2 * Real.log 2 := by have : (4 : ℝ) = 2 * 2 := by norm_num rw [this, Real.log_mul (by norm_num) (by norm_num)]; ring linarith linarith have htend : Filter.Tendsto (fun n : ℕ => Real.log ((n : ℝ) - 2)) Filter.atTop Filter.atTop := by have hsub : Filter.Tendsto (fun n : ℕ => (n : ℝ) - 2) Filter.atTop Filter.atTop := Filter.tendsto_atTop_add_const_right _ (-2) tendsto_natCast_atTop_atTop exact Real.tendsto_log_atTop.comp hsub have hev := (Filter.tendsto_atTop.mp htend (2 * max C 0 * (2 * Real.log 2 - 1) + 1)).and (Filter.eventually_ge_atTop 6) obtain ⟨N, hN⟩ := Filter.eventually_atTop.mp hev refine ⟨N, fun n hn hn3 => ?_⟩ obtain ⟨hlog_big, hn6⟩ := hN n hn rw [erasureCollapse_causalEmergence_exact (n := n) (m := n - 1) (by omega) (by omega)] have hn_pos : (0 : ℝ) < n := by positivity have hcast1 : ((n - 1 : ℕ) : ℝ) = (n : ℝ) - 1 := by rw [Nat.cast_sub (by omega)]; simp rw [hcast1] have hsimp : (1 - ((n : ℝ) - 1) / (n : ℝ)) * (1 - 1 / ((n : ℝ) - 1)) * Real.log (((n : ℝ) - 1) - 1) = (((n : ℝ) - 2) / ((n : ℝ) - 1)) * (Real.log ((n : ℝ) - 2) / (n : ℝ)) := by have hn1_ne : (n : ℝ) - 1 ≠ 0 := by have h6 : (6 : ℝ) ≤ n := by exact_mod_cast hn6 linarith have hlog_eq : ((n : ℝ) - 1) - 1 = (n : ℝ) - 2 := by ring rw [hlog_eq] field_simp [ne_of_gt hn_pos, hn1_ne] ring rw [hsimp] have hfrac : (1 / 2 : ℝ) ≤ ((n : ℝ) - 2) / ((n : ℝ) - 1) := by have : (6 : ℝ) ≤ n := by exact_mod_cast hn6 rw [div_le_div_iff₀ (by norm_num) (by linarith)] linarith have hlog_pos : 0 < Real.log ((n : ℝ) - 2) := by have : 0 ≤ 2 * max C 0 * (2 * Real.log 2 - 1) := by positivity linarith have h1 : (1 / 2 : ℝ) * (Real.log ((n : ℝ) - 2) / (n : ℝ)) ≤ (((n : ℝ) - 2) / ((n : ℝ) - 1)) * (Real.log ((n : ℝ) - 2) / (n : ℝ)) := mul_le_mul_of_nonneg_right hfrac (div_nonneg (le_of_lt hlog_pos) (le_of_lt hn_pos)) have hC_le : C * (2 * Real.log 2 - 1) < (1 / 2 : ℝ) * Real.log ((n : ℝ) - 2) := by have hle : C * (2 * Real.log 2 - 1) ≤ max C 0 * (2 * Real.log 2 - 1) := mul_le_mul_of_nonneg_right (le_max_left C 0) (le_of_lt hconst_pos) linarith have hdiv := div_lt_div_of_pos_right hC_le hn_pos have hrew1 : C * (2 * Real.log 2 - 1) / (n : ℝ) = C * ((2 * Real.log 2 - 1) / (n : ℝ)) := by ring have hrew2 : (1 / 2 : ℝ) * Real.log ((n : ℝ) - 2) / (n : ℝ) = (1 / 2 : ℝ) * (Real.log ((n : ℝ) - 2) / (n : ℝ)) := by ring linarith /-- **Theorem 6D (Full 1-Bit Additive Separation at Half-Scale `n = 2k, m = k`)**: For every `ε > 0`, for all sufficiently large `k`, the noisy erasure-collapse kernel at `(2k, k)` beats the sharp bijective-deterministic ceiling by at least `log 2 - ε` (approaching 1 full bit). -/ theorem noisy_beats_bijectiveDeterministic_half_scale : ∀ ε > 0, ∃ K : ℕ, ∀ k ≥ K, ∀ (hk : 2 ≤ k), (Real.log ((k : ℝ) / (2 * k : ℝ)) + (((2 * k - k + 1 : ℕ) : ℝ) / (2 * k : ℝ)) * Real.log ((2 * k - k + 1 : ℕ) : ℝ)) + (Real.log 2 - ε) ≤ causalEmergence (spikeMap (2 * k) k (by omega)) (canonicalLift (spikeMap (2 * k) k (by omega)) (erasureCollapseKernel k)) := by intro ε hε -- Notice: -- EC(2k, k) = (1/2) * (1 - 1/k) * log(k - 1) -- Det(2k, k) = -log 2 + ((k + 1) / (2k)) * log(k + 1) -- EC - Det - log 2 = (1/2) * log((k - 1) / (k + 1)) - (1 / (2k)) * log(k^2 - 1) → 0! have hlog_div : Filter.Tendsto (fun k : ℕ => Real.log ((k : ℝ) + 1) / (k : ℝ)) Filter.atTop (nhds 0) := by have h1 := (isLittleO_log_rpow_atTop (show (0 : ℝ) < 1 by norm_num)).tendsto_div_nhds_zero have h2 : Filter.Tendsto (fun k : ℕ => Real.log ((k : ℝ) + 1) / ((k : ℝ) + 1)) Filter.atTop (nhds 0) := by have hadd : Filter.Tendsto (fun k : ℕ => (k : ℝ) + 1) Filter.atTop Filter.atTop := Filter.tendsto_atTop_add_const_right _ 1 tendsto_natCast_atTop_atTop simpa [Function.comp_def, Real.rpow_one] using h1.comp hadd have hrat : Filter.Tendsto (fun k : ℕ => ((k : ℝ) + 1) / (k : ℝ)) Filter.atTop (nhds 1) := by have hinv : Filter.Tendsto (fun k : ℕ => (1 : ℝ) / (k : ℝ)) Filter.atTop (nhds 0) := tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop have := tendsto_const_nhds (x := (1 : ℝ)).add hinv simp only [add_zero] at this refine this.congr' ?_ filter_upwards [Filter.eventually_gt_atTop 0] with k hk have hkp : (0 : ℝ) < k := Nat.cast_pos.mpr hk field_simp [ne_of_gt hkp] have hmul := h2.mul hrat simp only [zero_mul] at hmul refine hmul.congr' ?_ filter_upwards [Filter.eventually_gt_atTop 0] with k hk have hkp : (0 : ℝ) < k := Nat.cast_pos.mpr hk field_simp [ne_of_gt hkp, show (k : ℝ) + 1 ≠ 0 by linarith] have hinv : Filter.Tendsto (fun k : ℕ => (2 : ℝ) / ((k : ℝ) - 1)) Filter.atTop (nhds 0) := tendsto_const_nhds.div_atTop (Filter.tendsto_atTop_add_const_right _ (-1) tendsto_natCast_atTop_atTop) have hsum_err : Filter.Tendsto (fun k : ℕ => (1 / 2 : ℝ) * (2 / ((k : ℝ) - 1)) + Real.log ((k : ℝ) + 1) / (k : ℝ)) Filter.atTop (nhds 0) := by simpa using (hinv.const_mul (1 / 2 : ℝ)).add hlog_div have hev := ((tendsto_order.mp hsum_err).2 ε hε).and (Filter.eventually_ge_atTop 3) obtain ⟨K, hK⟩ := Filter.eventually_atTop.mp hev refine ⟨K, fun k hk hk2 => ?_⟩ obtain ⟨herr, hk3⟩ := hK k hk rw [erasureCollapse_causalEmergence_exact (n := 2 * k) (m := k) hk2 (by omega)] have hk_pos : (0 : ℝ) < k := by positivity have hk1_pos : (0 : ℝ) < (k : ℝ) - 1 := by have h3 : (3 : ℝ) ≤ k := by exact_mod_cast hk3 linarith have h2k_cast : ((2 * k : ℕ) : ℝ) = 2 * (k : ℝ) := by push_cast; ring have hsub_cast : ((2 * k - k + 1 : ℕ) : ℝ) = (k : ℝ) + 1 := by have : 2 * k - k + 1 = k + 1 := by omega rw [this]; push_cast; ring rw [h2k_cast, hsub_cast] have hhalf : (k : ℝ) / (2 * (k : ℝ)) = 1 / 2 := by field_simp [ne_of_gt hk_pos] rw [hhalf, one_div, Real.log_inv] have hec_simp : (1 - (2 : ℝ)⁻¹) * (1 - 1 / (k : ℝ)) * Real.log ((k : ℝ) - 1) = (1 / 2 : ℝ) * Real.log ((k : ℝ) - 1) - (1 / (2 * (k : ℝ))) * Real.log ((k : ℝ) - 1) := by field_simp [ne_of_gt hk_pos]; ring rw [hec_simp] have hdet_simp : (((k : ℝ) + 1) / (2 * (k : ℝ))) * Real.log ((k : ℝ) + 1) = (1 / 2 : ℝ) * Real.log ((k : ℝ) + 1) + (1 / (2 * (k : ℝ))) * Real.log ((k : ℝ) + 1) := by field_simp [ne_of_gt hk_pos] rw [hdet_simp] -- Bound log((k+1)/(k-1)) ≤ 2 / (k - 1) have hlog_ratio : Real.log ((k : ℝ) + 1) - Real.log ((k : ℝ) - 1) ≤ 2 / ((k : ℝ) - 1) := by rw [← Real.log_div (by linarith) (ne_of_gt hk1_pos)] have hle := Real.log_le_sub_one_of_pos (div_pos (show (0 : ℝ) < (k : ℝ) + 1 by linarith) hk1_pos) have heq : ((k : ℝ) + 1) / ((k : ℝ) - 1) - 1 = 2 / ((k : ℝ) - 1) := by field_simp [ne_of_gt hk1_pos]; ring linarith have hlog_mono : Real.log ((k : ℝ) - 1) ≤ Real.log ((k : ℝ) + 1) := Real.log_le_log hk1_pos (by linarith) have htail : (1 / (2 * (k : ℝ))) * Real.log ((k : ℝ) - 1) + (1 / (2 * (k : ℝ))) * Real.log ((k : ℝ) + 1) ≤ Real.log ((k : ℝ) + 1) / (k : ℝ) := by have h1 : (1 / (2 * (k : ℝ))) * Real.log ((k : ℝ) - 1) ≤ (1 / (2 * (k : ℝ))) * Real.log ((k : ℝ) + 1) := mul_le_mul_of_nonneg_left hlog_mono (by positivity) have h2 : (1 / (2 * (k : ℝ))) * Real.log ((k : ℝ) + 1) + (1 / (2 * (k : ℝ))) * Real.log ((k : ℝ) + 1) = Real.log ((k : ℝ) + 1) / (k : ℝ) := by ring linarith linarith /-- Elementary sharp bound `(r + 1) * log (1 + 1 / r) ≤ 1 + 1 / (2 * r)` for all `r > 0`. -/ lemma succ_mul_log_one_add_inv_le {r : ℝ} (hr : 0 < r) : (r + 1) * Real.log (1 + 1 / r) ≤ 1 + 1 / (2 * r) := by -- Equivalent to (1 + u) * log(1 + u) ≤ u + u^2 / 2 for u = 1 / r > 0 set u : ℝ := 1 / r have hu_pos : 0 < u := one_div_pos.mpr hr let φ : ℝ → ℝ := fun x => x + x ^ 2 / 2 - (1 + x) * Real.log (1 + x) have hmono : MonotoneOn φ (Set.Ici 0) := by apply monotoneOn_of_deriv_nonneg (convex_Ici 0) · refine ContinuousOn.sub (continuous_id.add (continuous_pow 2 |>.div_const 2)).continuousOn ?_ refine ContinuousOn.mul (continuous_const.add continuous_id).continuousOn ?_ refine ContinuousOn.log (continuous_const.add continuous_id).continuousOn ?_ intro x hx; simp only [Set.mem_Ici] at hx; linarith · intro x hx rw [interior_Ici, Set.mem_Ioi] at hx have hx1 : 0 < 1 + x := by linarith have hd1 : HasDerivAt (fun t : ℝ => t + t ^ 2 / 2) (1 + x) x := by have hsq : HasDerivAt (fun t : ℝ => t ^ 2 / 2) x x := by have := (hasDerivAt_pow 2 x).div_const 2 simpa [pow_one] using this simpa using (hasDerivAt_id x).fun_add hsq have hd2 : HasDerivAt (fun t : ℝ => (1 + t) * Real.log (1 + t)) (Real.log (1 + x) + 1) x := by have hlin : HasDerivAt (fun t : ℝ => 1 + t) 1 x := by simpa using (hasDerivAt_const x (1 : ℝ)).fun_add (hasDerivAt_id x) have hmul := hlin.fun_mul (hlin.log (ne_of_gt hx1)) have hval : 1 * Real.log (1 + x) + (1 + x) * (1 / (1 + x)) = Real.log (1 + x) + 1 := by field_simp [ne_of_gt hx1] rwa [hval] at hmul exact (hd1.fun_sub hd2).differentiableAt.differentiableWithinAt · intro x hx rw [interior_Ici, Set.mem_Ioi] at hx have hx1 : 0 < 1 + x := by linarith have hd1 : HasDerivAt (fun t : ℝ => t + t ^ 2 / 2) (1 + x) x := by have hsq : HasDerivAt (fun t : ℝ => t ^ 2 / 2) x x := by have := (hasDerivAt_pow 2 x).div_const 2 simpa [pow_one] using this simpa using (hasDerivAt_id x).fun_add hsq have hd2 : HasDerivAt (fun t : ℝ => (1 + t) * Real.log (1 + t)) (Real.log (1 + x) + 1) x := by have hlin : HasDerivAt (fun t : ℝ => 1 + t) 1 x := by simpa using (hasDerivAt_const x (1 : ℝ)).fun_add (hasDerivAt_id x) have hmul := hlin.fun_mul (hlin.log (ne_of_gt hx1)) have hval : 1 * Real.log (1 + x) + (1 + x) * (1 / (1 + x)) = Real.log (1 + x) + 1 := by field_simp [ne_of_gt hx1] rwa [hval] at hmul rw [(hd1.fun_sub hd2).deriv] have hlog := Real.log_le_sub_one_of_pos hx1 linarith have h0u := hmono Set.self_mem_Ici (le_of_lt hu_pos) (le_of_lt hu_pos) dsimp only [φ] at h0u have hφ0 : (0 : ℝ) + (0 : ℝ) ^ 2 / 2 - (1 + 0) * Real.log (1 + 0) = 0 := by simp rw [hφ0] at h0u have hmul := mul_le_mul_of_nonneg_left (show (1 + u) * Real.log (1 + u) ≤ u + u ^ 2 / 2 by linarith) (le_of_lt hr) have hlhs : r * ((1 + u) * Real.log (1 + u)) = (r + 1) * Real.log (1 + 1 / r) := by dsimp only [u]; field_simp [ne_of_gt hr] have hrhs : r * (u + u ^ 2 / 2) = 1 + 1 / (2 * r) := by dsimp only [u]; field_simp [ne_of_gt hr] linarith /-- Analytic inequality proving noisy erasure-collapse strictly beats every deterministic (even degenerate) macro-kernel at `m = n - 1` for all `n ≥ 4`. -/ lemma fine_scale_det_lt_erasureCollapse {n r : ℕ} (hn : 4 ≤ n) (hr1 : 1 ≤ r) (hrm : r ≤ n - 1) : Real.log (((n - 1 : ℕ) : ℝ) / (n : ℝ)) + (((r + 1 : ℕ) : ℝ) / (n : ℝ)) * Real.log ((r + 1 : ℕ) : ℝ) - ((r : ℝ) / ((n - 1 : ℕ) : ℝ)) * Real.log (r : ℝ) < (((n - 2 : ℕ) : ℝ) / ((n : ℝ) * ((n - 1 : ℕ) : ℝ))) * Real.log ((n - 2 : ℕ) : ℝ) := by by_cases hn4 : n = 4 · -- Direct exact integer-ratio check for n = 4, r ∈ {1, 2, 3} subst hn4 have hcases : r = 1 ∨ r = 2 ∨ r = 3 := by omega rcases hcases with rfl | rfl | rfl · -- r = 1: 12 * (RHS - LHS) = log(2^20 / 3^12) > 0 have hrew : 12 * ((((4 - 2 : ℕ) : ℝ) / ((4 : ℝ) * ((4 - 1 : ℕ) : ℝ))) * Real.log ((4 - 2 : ℕ) : ℝ) - (Real.log (((4 - 1 : ℕ) : ℝ) / (4 : ℝ)) + (((1 + 1 : ℕ) : ℝ) / (4 : ℝ)) * Real.log ((1 + 1 : ℕ) : ℝ) - ((1 : ℝ) / ((4 - 1 : ℕ) : ℝ)) * Real.log (1 : ℝ))) = Real.log (((2 : ℝ) ^ 20) / ((3 : ℝ) ^ 12)) := by have hlog4 : Real.log 4 = 2 * Real.log 2 := by have : (4 : ℝ) = 2 * 2 := by norm_num rw [this, Real.log_mul (by norm_num) (by norm_num)]; ring rw [Real.log_div (x := (2 : ℝ) ^ 20) (y := (3 : ℝ) ^ 12) (by positivity) (by positivity), Real.log_pow, Real.log_pow] norm_num rw [Real.log_div (by norm_num) (by norm_num), hlog4] ring have hpos : 0 < Real.log (((2 : ℝ) ^ 20) / ((3 : ℝ) ^ 12)) := Real.log_pos (by norm_num) linarith · -- r = 2: 12 * (RHS - LHS) = log(2^34 / 3^21) > 0 have hrew : 12 * ((((4 - 2 : ℕ) : ℝ) / ((4 : ℝ) * ((4 - 1 : ℕ) : ℝ))) * Real.log ((4 - 2 : ℕ) : ℝ) - (Real.log (((4 - 1 : ℕ) : ℝ) / (4 : ℝ)) + (((2 + 1 : ℕ) : ℝ) / (4 : ℝ)) * Real.log ((2 + 1 : ℕ) : ℝ) - ((2 : ℝ) / ((4 - 1 : ℕ) : ℝ)) * Real.log (2 : ℝ))) = Real.log (((2 : ℝ) ^ 34) / ((3 : ℝ) ^ 21)) := by have hlog4 : Real.log 4 = 2 * Real.log 2 := by have : (4 : ℝ) = 2 * 2 := by norm_num rw [this, Real.log_mul (by norm_num) (by norm_num)]; ring rw [Real.log_div (x := (2 : ℝ) ^ 34) (y := (3 : ℝ) ^ 21) (by positivity) (by positivity), Real.log_pow, Real.log_pow] norm_num rw [Real.log_div (by norm_num) (by norm_num), hlog4] ring have hpos : 0 < Real.log (((2 : ℝ) ^ 34) / ((3 : ℝ) ^ 21)) := Real.log_pos (by norm_num) linarith · -- r = 3: LHS = 0 < (1/6) * log 2 norm_num have hlhs0 : Real.log (3 / 4) + Real.log 4 - Real.log 3 = 0 := by rw [Real.log_div (by norm_num) (by norm_num)]; ring have hpos : 0 < (1 / 6 : ℝ) * Real.log 2 := mul_pos (by norm_num) (Real.log_pos (by norm_num)) linarith · -- Uniform analytic proof for ALL n ≥ 5 (so m = n - 1 ≥ 4) set m : ℕ := n - 1 have hm4 : 4 ≤ m := by omega have hn_pos : (0 : ℝ) < n := by positivity have hm_pos : (0 : ℝ) < m := by positivity have hr_pos : (0 : ℝ) < r := by positivity have hm_eq : (m : ℝ) = (n : ℝ) - 1 := by rw [Nat.cast_sub (by omega)]; simp have hm1_eq : ((n - 2 : ℕ) : ℝ) = (m : ℝ) - 1 := by have : n - 2 = m - 1 := by omega rw [this, Nat.cast_sub (by omega)]; simp -- Step 1: Reduce to n * LHS ≤ (1 - r / m) * log r + 1 / (2 * r) have hlog_mn : Real.log ((m : ℝ) / (n : ℝ)) ≤ -1 / (n : ℝ) := by have h := Real.log_le_sub_one_of_pos (div_pos hm_pos hn_pos) have heq : (m : ℝ) / (n : ℝ) - 1 = -1 / (n : ℝ) := by rw [hm_eq]; field_simp [ne_of_gt hn_pos]; ring linarith have hstep1 : (n : ℝ) * (Real.log ((m : ℝ) / (n : ℝ)) + (((r + 1 : ℕ) : ℝ) / (n : ℝ)) * Real.log ((r + 1 : ℕ) : ℝ) - ((r : ℝ) / (m : ℝ)) * Real.log (r : ℝ)) ≤ (1 - (r : ℝ) / (m : ℝ)) * Real.log (r : ℝ) + 1 / (2 * (r : ℝ)) := by have hr1_cast : ((r + 1 : ℕ) : ℝ) = (r : ℝ) + 1 := by push_cast; ring rw [hr1_cast] have hlog_split : Real.log ((r : ℝ) + 1) = Real.log (r : ℝ) + Real.log (1 + 1 / (r : ℝ)) := by have h1 : (r : ℝ) + 1 = (r : ℝ) * (1 + 1 / (r : ℝ)) := by field_simp [ne_of_gt hr_pos] rw [h1, Real.log_mul (ne_of_gt hr_pos) (by positivity)] have hsup := succ_mul_log_one_add_inv_le hr_pos have hn_m : (n : ℝ) * ((r : ℝ) / (m : ℝ)) = (r : ℝ) + (r : ℝ) / (m : ℝ) := by have : (n : ℝ) = (m : ℝ) + 1 := by linarith rw [this]; field_simp [ne_of_gt hm_pos] have hn_m_log : (n : ℝ) * ((r : ℝ) / (m : ℝ) * Real.log (r : ℝ)) = ((r : ℝ) + (r : ℝ) / (m : ℝ)) * Real.log (r : ℝ) := by rw [← mul_assoc, hn_m] have hmul_log : (n : ℝ) * Real.log ((m : ℝ) / (n : ℝ)) ≤ -1 := by have h := mul_le_mul_of_nonneg_left hlog_mn (le_of_lt hn_pos) have hcancel : (n : ℝ) * (-1 / (n : ℝ)) = -1 := by field_simp [ne_of_gt hn_pos] linarith have hcancel2 : (n : ℝ) * (((r : ℝ) + 1) / (n : ℝ) * Real.log ((r : ℝ) + 1)) = ((r : ℝ) + 1) * Real.log ((r : ℝ) + 1) := by field_simp [ne_of_gt hn_pos] rw [mul_sub, mul_add, hcancel2, hlog_split, hn_m_log] linarith -- Step 2: Show (1 - r / m) * log r + 1 / (2 * r) < ((m - 1) / m) * log (m - 1) have htarget : (1 - (r : ℝ) / (m : ℝ)) * Real.log (r : ℝ) + 1 / (2 * (r : ℝ)) < (((m : ℝ) - 1) / (m : ℝ)) * Real.log ((m : ℝ) - 1) := by have hm_ge4 : (4 : ℝ) ≤ m := by exact_mod_cast hm4 have hm1_ge3 : (3 : ℝ) ≤ (m : ℝ) - 1 := by linarith have hlog3_gt1 : (1 : ℝ) < Real.log 3 := by have h3e : Real.exp 1 < 3 := by have := Real.exp_one_lt_d9; linarith calc (1 : ℝ) = Real.log (Real.exp 1) := (Real.log_exp 1).symm _ < Real.log 3 := Real.log_lt_log (Real.exp_pos 1) h3e have hlogm1_gt1 : (1 : ℝ) < Real.log ((m : ℝ) - 1) := lt_of_lt_of_le hlog3_gt1 (Real.log_le_log (by norm_num) hm1_ge3) have hratio_ge : (3 / 4 : ℝ) ≤ ((m : ℝ) - 1) / (m : ℝ) := by rw [div_le_div_iff₀ (by norm_num) hm_pos]; linarith by_cases hr_eq1 : r = 1 · subst hr_eq1 simp only [Nat.cast_one, Real.log_one, mul_zero, zero_add, mul_one] nlinarith · by_cases hr_eqm : r = m · subst hr_eqm rw [div_self (ne_of_gt hm_pos), sub_self, zero_mul, zero_add] have h1 : 1 / (2 * (m : ℝ)) ≤ 1 / 8 := by rw [div_le_div_iff₀ (by positivity) (by norm_num)]; linarith nlinarith · -- Now 2 ≤ r ≤ m - 1; split on r ≤ m / 2 vs r > m / 2 have hr_ge2 : (2 : ℝ) ≤ r := by exact_mod_cast (show 2 ≤ r by omega) have hr_lem1 : (r : ℝ) ≤ (m : ℝ) - 1 := by have hnat : r + 1 ≤ m := by omega have hreal : (r : ℝ) + 1 ≤ (m : ℝ) := by exact_mod_cast hnat linarith by_cases hhalf : (r : ℝ) ≤ (m : ℝ) / 2 · -- Case 2 ≤ r ≤ m / 2 have hlog_r : Real.log (r : ℝ) ≤ Real.log (m : ℝ) - Real.log 2 := by rw [← Real.log_div (ne_of_gt hm_pos) (by norm_num)] exact Real.log_le_log hr_pos hhalf have hlog_diff : Real.log (m : ℝ) - Real.log ((m : ℝ) - 1) ≤ 1 / ((m : ℝ) - 1) := by rw [← Real.log_div (ne_of_gt hm_pos) (by linarith)] have h := Real.log_le_sub_one_of_pos (div_pos hm_pos (show (0 : ℝ) < (m : ℝ) - 1 by linarith)) have heq : (m : ℝ) / ((m : ℝ) - 1) - 1 = 1 / ((m : ℝ) - 1) := by field_simp [show (m : ℝ) - 1 ≠ 0 by linarith]; ring linarith have hcoeff : 1 - (r : ℝ) / (m : ℝ) ≤ ((m : ℝ) - 1) / (m : ℝ) := by have : 1 - (r : ℝ) / (m : ℝ) = ((m : ℝ) - (r : ℝ)) / (m : ℝ) := by field_simp [ne_of_gt hm_pos] rw [this] exact div_le_div_of_nonneg_right (by linarith) (le_of_lt hm_pos) have hlog_r_nn : 0 ≤ Real.log (r : ℝ) := Real.log_nonneg (by linarith) have h1 : (1 - (r : ℝ) / (m : ℝ)) * Real.log (r : ℝ) ≤ (((m : ℝ) - 1) / (m : ℝ)) * (Real.log (m : ℝ) - Real.log 2) := by calc (1 - (r : ℝ) / (m : ℝ)) * Real.log (r : ℝ) ≤ (((m : ℝ) - 1) / (m : ℝ)) * Real.log (r : ℝ) := mul_le_mul_of_nonneg_right hcoeff hlog_r_nn _ ≤ (((m : ℝ) - 1) / (m : ℝ)) * (Real.log (m : ℝ) - Real.log 2) := mul_le_mul_of_nonneg_left hlog_r (by positivity) have h2 : (((m : ℝ) - 1) / (m : ℝ)) * (Real.log (m : ℝ) - Real.log ((m : ℝ) - 1)) ≤ 1 / (m : ℝ) := by have hm_le := mul_le_mul_of_nonneg_left hlog_diff (show 0 ≤ ((m : ℝ) - 1) / (m : ℝ) by positivity) have hsimp : (((m : ℝ) - 1) / (m : ℝ)) * (1 / ((m : ℝ) - 1)) = 1 / (m : ℝ) := by field_simp [ne_of_gt hm_pos, show (m : ℝ) - 1 ≠ 0 by linarith] linarith have hlog2_gt : (2 / 3 : ℝ) < Real.log 2 := by have he2 : Real.exp 2 < 8 := by have he1 : Real.exp 1 < 2.72 := by have := Real.exp_one_lt_d9; linarith have he2_eq : Real.exp 2 = Real.exp 1 * Real.exp 1 := by rw [← Real.exp_add]; norm_num rw [he2_eq]; nlinarith [Real.exp_pos 1] have hlog8 : 2 < Real.log 8 := by calc (2 : ℝ) = Real.log (Real.exp 2) := (Real.log_exp 2).symm _ < Real.log 8 := Real.log_lt_log (Real.exp_pos 2) he2 have h8eq : Real.log 8 = 3 * Real.log 2 := by have : (8 : ℝ) = (2 : ℝ) ^ 3 := by norm_num rw [this, Real.log_pow]; norm_num linarith have hinv_m : 1 / (m : ℝ) ≤ 1 / 4 := one_div_le_one_div_of_le (by norm_num) hm_ge4 have hinv_2r : 1 / (2 * (r : ℝ)) ≤ 1 / 4 := one_div_le_one_div_of_le (by norm_num) (by linarith) nlinarith · -- Case m / 2 < r ≤ m - 1 push Not at hhalf have h1rm : 1 - (r : ℝ) / (m : ℝ) < 1 / 2 := by have : (1 / 2 : ℝ) < (r : ℝ) / (m : ℝ) := by rw [div_lt_div_iff₀ (by norm_num) hm_pos]; linarith linarith have hlog_r_le : Real.log (r : ℝ) ≤ Real.log ((m : ℝ) - 1) := Real.log_le_log hr_pos hr_lem1 have hlog_r_pos : 0 < Real.log (r : ℝ) := Real.log_pos (by linarith) have h1 : (1 - (r : ℝ) / (m : ℝ)) * Real.log (r : ℝ) < (1 / 2 : ℝ) * Real.log ((m : ℝ) - 1) := by calc (1 - (r : ℝ) / (m : ℝ)) * Real.log (r : ℝ) < (1 / 2 : ℝ) * Real.log (r : ℝ) := mul_lt_mul_of_pos_right h1rm hlog_r_pos _ ≤ (1 / 2 : ℝ) * Real.log ((m : ℝ) - 1) := mul_le_mul_of_nonneg_left hlog_r_le (by norm_num) have h2 : 1 / (2 * (r : ℝ)) < 1 / (m : ℝ) := one_div_lt_one_div_of_lt hm_pos (by linarith) have h3 : (1 / 2 : ℝ) * Real.log ((m : ℝ) - 1) + 1 / (m : ℝ) < (((m : ℝ) - 1) / (m : ℝ)) * Real.log ((m : ℝ) - 1) := by have hdiff : (((m : ℝ) - 1) / (m : ℝ) - 1 / 2) = ((m : ℝ) - 2) / (2 * (m : ℝ)) := by field_simp [ne_of_gt hm_pos]; ring have hge : 1 / (m : ℝ) ≤ ((m : ℝ) - 2) / (2 * (m : ℝ)) := by rw [div_le_div_iff₀ hm_pos (by positivity)] nlinarith nlinarith linarith -- Combine Step 1 and Step 2 and divide by n > 0 have hcomb := lt_of_le_of_lt hstep1 htarget have hdiv := div_lt_div_of_pos_right hcomb hn_pos rw [mul_div_cancel_left₀ _ (ne_of_gt hn_pos)] at hdiv rw [hm1_eq] have hrhs_eq : (((m : ℝ) - 1) / (m : ℝ)) * Real.log ((m : ℝ) - 1) / (n : ℝ) = (((m : ℝ) - 1) / ((n : ℝ) * (m : ℝ))) * Real.log ((m : ℝ) - 1) := by field_simp [ne_of_gt hn_pos, ne_of_gt hm_pos] linarith /-- **Theorem 6E (Strict Separation Over ALL Deterministic — Even Degenerate! — Macro-Kernels at `m = n - 1`)**: For EVERY `n ≥ 4`, EVERY surjective `π : Fin n → Fin (n - 1)`, and EVERY stochastic micro-kernel `P` whose induced macro-kernel `macroKernel π P` is deterministic (bijective OR arbitrarily degenerate!), the noisy erasure-collapse kernel achieves STRICTLY GREATER causal emergence! -/ theorem noisy_strictly_beats_all_deterministic_fine_scale {n : ℕ} (hn : 4 ≤ n) (π : Fin n → Fin (n - 1)) (hπ : Function.Surjective π) (P : Fin n → Fin n → ℝ) (hP : IsStochastic P) (hdet : IsDeterministicKernel (macroKernel π P)) : causalEmergence π P < causalEmergence (spikeMap n (n - 1) (by omega)) (canonicalLift (spikeMap n (n - 1) (by omega)) (erasureCollapseKernel (n - 1))) := by have : Nonempty (Fin n) := ⟨⟨0, by omega⟩⟩ have : Nonempty (Fin (n - 1)) := ⟨⟨0, by omega⟩⟩ let m : ℕ := n - 1 have hm3 : 3 ≤ m := by omega have hn_pos : (0 : ℝ) < n := Nat.cast_pos.mpr (by omega) have hm_pos : (0 : ℝ) < m := Nat.cast_pos.mpr (by omega) -- Step 1: Identify the unique heavy macrostate a₀ with fiberSize π a₀ = 2 (all others = 1) have hsum_excess : ∑ a : Fin m, (fiberSize π a - 1) = 1 := by have hge : ∀ a : Fin m, 1 ≤ fiberSize π a := fun a => fiberSize_pos hπ a have hadd : ∑ a : Fin m, (fiberSize π a - 1) + ∑ _a : Fin m, 1 = ∑ a : Fin m, fiberSize π a := by rw [← Finset.sum_add_distrib] refine Finset.sum_congr rfl fun a _ => Nat.sub_add_cancel (hge a) rw [sum_fiberSize, Fintype.card_fin] at hadd simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, smul_eq_mul, mul_one] at hadd omega have ha₀_ex : ∃ a₀ : Fin m, fiberSize π a₀ = 2 ∧ ∀ a : Fin m, a ≠ a₀ → fiberSize π a = 1 := by have hnz : ∃ a₀ : Fin m, fiberSize π a₀ - 1 ≠ 0 := by by_contra hall push Not at hall have : ∑ a : Fin m, (fiberSize π a - 1) = 0 := Finset.sum_eq_zero fun a _ => hall a omega obtain ⟨a₀, ha₀_nz⟩ := hnz have hsplit := Finset.add_sum_erase (s := (Finset.univ : Finset (Fin m))) (f := fun a => fiberSize π a - 1) (a := a₀) (Finset.mem_univ a₀) rw [hsum_excess] at hsplit have ha₀_eq1 : fiberSize π a₀ - 1 = 1 := by omega have hrest0 : ∑ a ∈ Finset.univ.erase a₀, (fiberSize π a - 1) = 0 := by omega have hge : ∀ a : Fin m, 1 ≤ fiberSize π a := fun a => fiberSize_pos hπ a refine ⟨a₀, by have := hge a₀; omega, fun a hne => ?_⟩ have ha_mem : a ∈ Finset.univ.erase a₀ := Finset.mem_erase.mpr ⟨hne, Finset.mem_univ a⟩ have h0 : fiberSize π a - 1 = 0 := (Finset.sum_eq_zero_iff.mp hrest0) a ha_mem have := hge a omega obtain ⟨a₀, ha₀_two, hother_one⟩ := ha₀_ex -- Step 2: Upper bound causalEmergence π P by H(u Q) - H(w Q) have hle_rew := causalEmergence_le_reweight_gap hπ hP rcases hdet with ⟨f, hf⟩ have hcond_zero : ∀ p : Fin m → ℝ, condEntropy p (macroKernel π P) = 0 := by intro p unfold condEntropy refine Finset.sum_eq_zero fun a _ => ?_ have hrow : shannonEntropy (macroKernel π P a) = 0 := by unfold shannonEntropy refine Finset.sum_eq_zero fun b _ => ?_ rw [hf a b]; split_ifs <;> simp rw [hrow, mul_zero] have hrew_eq : mutualInfo (unifDist (Fin m)) (macroKernel π P) - mutualInfo (fiberWeight π) (macroKernel π P) = shannonEntropy (pushforward (unifDist (Fin m)) (macroKernel π P)) - shannonEntropy (pushforward (fiberWeight π) (macroKernel π P)) := by unfold mutualInfo rw [hcond_zero, hcond_zero, sub_zero, sub_zero] rw [hrew_eq] at hle_rew -- Step 3: Compute pushforwards of u and w through deterministic f via fiber sizes s_b = |f⁻¹(b)| set s : Fin m → ℕ := fun b => (Finset.univ.filter (fun a : Fin m => f a = b)).card have hsum_s : ∑ b : Fin m, s b = m := by have h := sum_fiberSize f simpa [s, fiberSize, fiber] using h have hpf_u : ∀ b : Fin m, pushforward (unifDist (Fin m)) (macroKernel π P) b = (s b : ℝ) / (m : ℝ) := by intro b unfold pushforward unifDist simp_rw [hf, Fintype.card_fin, mul_ite, mul_one, mul_zero] rw [← Finset.sum_filter, Finset.sum_const, nsmul_eq_mul] have hfilt : Finset.univ.filter (fun a : Fin m => b = f a) = Finset.univ.filter (fun a : Fin m => f a = b) := by ext a; simp [eq_comm] rw [hfilt] change (s b : ℝ) * (1 / (m : ℝ)) = (s b : ℝ) / (m : ℝ) ring have hpf_w : ∀ b : Fin m, pushforward (fiberWeight π) (macroKernel π P) b = ((if b = f a₀ then s b + 1 else s b : ℕ) : ℝ) / (n : ℝ) := by intro b unfold pushforward fiberWeight simp_rw [hf, Fintype.card_fin, mul_ite, mul_one, mul_zero, ← Finset.sum_filter] have hfilt : Finset.univ.filter (fun a : Fin m => b = f a) = Finset.univ.filter (fun a : Fin m => f a = b) := by ext a; simp [eq_comm] rw [hfilt, ← Finset.sum_div, ← Nat.cast_sum] congr 1; congr 1 set Fb := Finset.univ.filter (fun a : Fin m => f a = b) by_cases hb : b = f a₀ · have ha₀_mem : a₀ ∈ Fb := Finset.mem_filter.mpr ⟨Finset.mem_univ a₀, hb.symm⟩ rw [← Finset.add_sum_erase _ _ ha₀_mem, ha₀_two] have hrest : ∀ a ∈ Fb.erase a₀, fiberSize π a = 1 := fun a ha => hother_one a (Finset.mem_erase.mp ha).1 rw [Finset.sum_congr rfl hrest, Finset.sum_const, Finset.card_erase_of_mem ha₀_mem, smul_eq_mul, mul_one, if_pos hb] have hpos : 1 ≤ Fb.card := Finset.card_pos.mpr ⟨a₀, ha₀_mem⟩ change 2 + (s b - 1) = s b + 1 change 1 ≤ s b at hpos omega · have ha₀_not : a₀ ∉ Fb := fun h => hb (Finset.mem_filter.mp h).2.symm have hall : ∀ a ∈ Fb, fiberSize π a = 1 := fun a ha => hother_one a (fun h => ha₀_not (h ▸ ha)) rw [Finset.sum_congr rfl hall, Finset.sum_const, smul_eq_mul, mul_one, if_neg hb] -- Step 4: Expand H(u Q) - H(w Q) and drop non-positive terms for b ≠ f a₀! set b₀ : Fin m := f a₀ set r : ℕ := s b₀ have hr1 : 1 ≤ r := Finset.card_pos.mpr ⟨a₀, Finset.mem_filter.mpr ⟨Finset.mem_univ a₀, rfl⟩⟩ have hrm : r ≤ m := by have : s b₀ ≤ ∑ b : Fin m, s b := Finset.single_le_sum (fun _ _ => Nat.zero_le _) (Finset.mem_univ b₀) omega have hH_u : shannonEntropy (pushforward (unifDist (Fin m)) (macroKernel π P)) = Real.log (m : ℝ) - (1 / (m : ℝ)) * ∑ b : Fin m, (s b : ℝ) * Real.log (s b) := by unfold shannonEntropy entTerm simp_rw [hpf_u] have hterm : ∀ b : Fin m, -((s b : ℝ) / (m : ℝ) * Real.log ((s b : ℝ) / (m : ℝ))) = ((s b : ℝ) / (m : ℝ)) * Real.log (m : ℝ) - (1 / (m : ℝ)) * ((s b : ℝ) * Real.log (s b)) := by intro b by_cases hsb : s b = 0 · simp [hsb] · have hpos : (0 : ℝ) < s b := Nat.cast_pos.mpr (Nat.pos_of_ne_zero hsb) rw [Real.log_div (ne_of_gt hpos) (ne_of_gt hm_pos)]; ring simp_rw [hterm, Finset.sum_sub_distrib, ← Finset.sum_mul, ← Finset.mul_sum, ← Finset.sum_div, ← Nat.cast_sum, hsum_s, div_self (ne_of_gt hm_pos), one_mul] have hsum_sw : ∑ b : Fin m, (if b = b₀ then s b + 1 else s b) = n := by rw [← Finset.add_sum_erase _ _ (Finset.mem_univ b₀)] simp only [↓reduceIte] have hrest : ∀ b ∈ Finset.univ.erase b₀, (if b = b₀ then s b + 1 else s b) = s b := fun b hb => if_neg (Finset.mem_erase.mp hb).1 rw [Finset.sum_congr rfl hrest] have hsplit : s b₀ + ∑ b ∈ Finset.univ.erase b₀, s b = m := by have h := Finset.add_sum_erase (s := (Finset.univ : Finset (Fin m))) (f := s) (a := b₀) (Finset.mem_univ b₀) rw [hsum_s] at h exact h change s b₀ + 1 + ∑ b ∈ Finset.univ.erase b₀, s b = n omega have hH_w : shannonEntropy (pushforward (fiberWeight π) (macroKernel π P)) = Real.log (n : ℝ) - (1 / (n : ℝ)) * ∑ b : Fin m, ((if b = b₀ then s b + 1 else s b : ℕ) : ℝ) * Real.log ((if b = b₀ then s b + 1 else s b : ℕ) : ℝ) := by unfold shannonEntropy entTerm simp_rw [hpf_w] have hterm : ∀ b : Fin m, -(((if b = b₀ then s b + 1 else s b : ℕ) : ℝ) / (n : ℝ) * Real.log (((if b = b₀ then s b + 1 else s b : ℕ) : ℝ) / (n : ℝ))) = (((if b = b₀ then s b + 1 else s b : ℕ) : ℝ) / (n : ℝ)) * Real.log (n : ℝ) - (1 / (n : ℝ)) * (((if b = b₀ then s b + 1 else s b : ℕ) : ℝ) * Real.log ((if b = b₀ then s b + 1 else s b : ℕ) : ℝ)) := by intro b set k := if b = b₀ then s b + 1 else s b by_cases hk : k = 0 · simp [hk] · have hpos : (0 : ℝ) < k := Nat.cast_pos.mpr (Nat.pos_of_ne_zero hk) rw [Real.log_div (ne_of_gt hpos) (ne_of_gt hn_pos)]; ring have hsum_cast : (∑ b : Fin m, ((if b = b₀ then s b + 1 else s b : ℕ) : ℝ)) = (n : ℝ) := by rw [← Nat.cast_sum, hsum_sw] rw [Finset.sum_congr rfl fun b _ => hterm b, Finset.sum_sub_distrib, ← Finset.sum_mul, ← Finset.mul_sum, ← Finset.sum_div, hsum_cast, div_self (ne_of_gt hn_pos), one_mul] have hdiff_le : shannonEntropy (pushforward (unifDist (Fin m)) (macroKernel π P)) - shannonEntropy (pushforward (fiberWeight π) (macroKernel π P)) ≤ Real.log ((m : ℝ) / (n : ℝ)) + (((r + 1 : ℕ) : ℝ) / (n : ℝ)) * Real.log ((r + 1 : ℕ) : ℝ) - ((r : ℝ) / (m : ℝ)) * Real.log (r : ℝ) := by rw [hH_u, hH_w, Real.log_div (ne_of_gt hm_pos) (ne_of_gt hn_pos)] rw [← Finset.add_sum_erase _ _ (Finset.mem_univ b₀), ← Finset.add_sum_erase (f := fun b => ((if b = b₀ then s b + 1 else s b : ℕ) : ℝ) * Real.log ((if b = b₀ then s b + 1 else s b : ℕ) : ℝ)) _ (Finset.mem_univ b₀)] simp only [↓reduceIte] have hrest_eq : ∑ b ∈ Finset.univ.erase b₀, ((if b = b₀ then s b + 1 else s b : ℕ) : ℝ) * Real.log ((if b = b₀ then s b + 1 else s b : ℕ) : ℝ) = ∑ b ∈ Finset.univ.erase b₀, (s b : ℝ) * Real.log (s b) := by refine Finset.sum_congr rfl fun b hb => by simp [(Finset.mem_erase.mp hb).1] rw [hrest_eq] have hrest_nn : 0 ≤ ∑ b ∈ Finset.univ.erase b₀, (s b : ℝ) * Real.log (s b) := by refine Finset.sum_nonneg fun b _ => ?_ by_cases hsb : s b = 0 · simp [hsb] · have h1 : (1 : ℝ) ≤ s b := by exact_mod_cast Nat.pos_of_ne_zero hsb exact mul_nonneg (by linarith) (Real.log_nonneg h1) have hinv_le : (1 / (n : ℝ)) ≤ 1 / (m : ℝ) := one_div_le_one_div_of_le hm_pos (by exact_mod_cast (show m ≤ n by omega)) have hdrop : (1 / (n : ℝ)) * ∑ b ∈ Finset.univ.erase b₀, (s b : ℝ) * Real.log (s b) ≤ (1 / (m : ℝ)) * ∑ b ∈ Finset.univ.erase b₀, (s b : ℝ) * Real.log (s b) := mul_le_mul_of_nonneg_right hinv_le hrest_nn have h1 : (1 / (n : ℝ)) * (((r + 1 : ℕ) : ℝ) * Real.log ((r + 1 : ℕ) : ℝ)) = (((r + 1 : ℕ) : ℝ) / (n : ℝ)) * Real.log ((r + 1 : ℕ) : ℝ) := by ring have h2 : (1 / (m : ℝ)) * ((r : ℝ) * Real.log (r : ℝ)) = ((r : ℝ) / (m : ℝ)) * Real.log (r : ℝ) := by ring linarith -- Step 5: Apply fine_scale_det_lt_erasureCollapse and rewrite RHS as erasureCollapse emergence! have hstrict := fine_scale_det_lt_erasureCollapse hn hr1 hrm rw [erasureCollapse_causalEmergence_exact (n := n) (m := n - 1) (by omega) (by omega)] have hm_cast : ((n - 1 : ℕ) : ℝ) = (n : ℝ) - 1 := by rw [Nat.cast_sub (by omega)]; simp have hm2_cast : ((n - 2 : ℕ) : ℝ) = ((n : ℝ) - 1) - 1 := by rw [Nat.cast_sub (by omega)]; simp; ring have hrhs_eq : (((n - 2 : ℕ) : ℝ) / ((n : ℝ) * ((n - 1 : ℕ) : ℝ))) * Real.log ((n - 2 : ℕ) : ℝ) = (1 - ((n - 1 : ℕ) : ℝ) / (n : ℝ)) * (1 - 1 / ((n - 1 : ℕ) : ℝ)) * Real.log (((n - 1 : ℕ) : ℝ) - 1) := by rw [hm_cast, hm2_cast] have hn1_ne : (n : ℝ) - 1 ≠ 0 := by have h4 : (4 : ℝ) ≤ n := by exact_mod_cast hn linarith field_simp [ne_of_gt hn_pos, hn1_ne] ring linarith end DeterministicCeilingsAndSeparations /-! ## Axiom Verification on All Headline Theorems -/ #print axioms causalEmergence_le_reweight_gap #print axioms causalEmergence_canonicalLift #print axioms causalEmergence_nonpos_of_balanced #print axioms causalEmergence_le_min_fiber_bound #print axioms causalEmergence_le_one_sub_ratio_mul_log #print axioms causalEmergence_universal_upper_bound #print axioms symNoisyKernel_causalEmergence_exact #print axioms erasureCollapse_causalEmergence_exact #print axioms causalEmergence_exact_three_term_asymptotic #print axioms universal_anti_determinism #print axioms hoel_four_state_noisy_beats_deterministic #print axioms symNoisyGain_hasDerivWithinAt_zero #print axioms symNoisyGain_pos_of_phase_supercritical #print axioms bijectiveDeterministic_sharp_ceiling #print axioms bijectiveDeterministic_ceiling_tight #print axioms noisy_beats_bijectiveDeterministic_unbounded_ratio #print axioms noisy_beats_bijectiveDeterministic_half_scale #print axioms noisy_strictly_beats_all_deterministic_fine_scale end CausalEmergenceExtremal