Exact Lean source
Nonadditivity.WeightedBellScalar
Download original .lean · View on GitHub · Jump to source
Direct imports
Imported by project modules
3 direct reverse imports
Relationships above come from literal import commands. The declarations below link to types and references extracted from Lean’s environment. Source text is complete and unchanged.
Declarations in this module
41 project constants, including generated, internal and private declarations.
41 declarations
Nonadditivity.WeightedBellScalar.continuous_perturbedWeightsNonadditivity.WeightedBellScalar.continuous_perturbedWeights_applyNonadditivity.WeightedBellScalar.exists_perturbation_parameterNonadditivity.WeightedBellScalar.perturbation_margin_posNonadditivity.WeightedBellScalar.perturbedWeightsNonadditivity.WeightedBellScalar.perturbedWeights._proof_1internal/detail/privateNonadditivity.WeightedBellScalar.perturbedWeights._proof_2internal/detail/privateNonadditivity.WeightedBellScalar.perturbedWeights._proof_3internal/detail/privateNonadditivity.WeightedBellScalar.perturbedWeights._proof_4internal/detail/privateNonadditivity.WeightedBellScalar.perturbedWeights.congr_simpNonadditivity.WeightedBellScalar.perturbedWeights.eq_1internal/detail/privateNonadditivity.WeightedBellScalar.perturbedWeights_closeNonadditivity.WeightedBellScalar.perturbedWeights_close._simp_1_1internal/detail/privateNonadditivity.WeightedBellScalar.perturbedWeights_one_indexNonadditivity.WeightedBellScalar.perturbedWeights_positiveNonadditivity.WeightedBellScalar.perturbedWeights_shannon_leNonadditivity.WeightedBellScalar.perturbedWeights_shannon_le._proof_1_1internal/detail/privateNonadditivity.WeightedBellScalar.perturbedWeights_sumNonadditivity.WeightedBellScalar.perturbedWeights_sum._proof_1_1internal/detail/privateNonadditivity.WeightedBellScalar.perturbedWeights_sum._simp_1_3internal/detail/privateNonadditivity.WeightedBellScalar.perturbedWeights_sum_sqNonadditivity.WeightedBellScalar.perturbedWeights_sum_sq._proof_1_1internal/detail/privateNonadditivity.WeightedBellScalar.perturbedWeights_sum_sq._simp_1_4internal/detail/privateNonadditivity.WeightedBellScalar.perturbedWeights_zeroNonadditivity.WeightedBellScalar.perturbedWeights_zero_indexNonadditivity.WeightedBellScalar.shannon_le_of_merged_distributionNonadditivity.WeightedBellScalar.shannon_le_of_merged_distribution._simp_1_1internal/detail/privateNonadditivity.WeightedBellScalar.weightsNonadditivity.WeightedBellScalar.weights.eq_1internal/detail/privateNonadditivity.WeightedBellScalar.weights.eq_2internal/detail/privateNonadditivity.WeightedBellScalar.weights.match_1internal/detail/privateNonadditivity.WeightedBellScalar.weights_nonnegNonadditivity.WeightedBellScalar.weights_shannon_leNonadditivity.WeightedBellScalar.weights_sumNonadditivity.WeightedBellScalar.weights_sum._simp_1_1internal/detail/private_private.Nonadditivity.WeightedBellScalar.0.Nonadditivity.BellOutput.mergedWeights.match_1.eq_1internal/detail/private_private.Nonadditivity.WeightedBellScalar.0.Nonadditivity.BellOutput.mergedWeights.match_1.eq_2internal/detail/private_private.Nonadditivity.WeightedBellScalar.0.Nonadditivity.BellOutput.mergedWeights.match_1.splitterinternal/detail/private_private.Nonadditivity.WeightedBellScalar.0.Nonadditivity.WeightedBellScalar.weights.match_1.eq_1internal/detail/private_private.Nonadditivity.WeightedBellScalar.0.Nonadditivity.WeightedBellScalar.weights.match_1.eq_2internal/detail/private_private.Nonadditivity.WeightedBellScalar.0.Nonadditivity.WeightedBellScalar.weights.match_1.splitterinternal/detail/private
Full module
1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.GeneralBell78/-! # Strict Bell entropy margins from arbitrarily small weight perturbations -/910noncomputable section1112namespace Nonadditivity.WeightedBellScalar1314open Entropy BellOutput15open scoped BigOperators1617set_option backward.isDefEq.respectTransparency false18set_option maxHeartbeats 6000001920section Merged21variable {κ : Type*} [Fintype κ] [DecidableEq κ]2223/-- The diagonal pair probabilities merge because the corresponding Bell24states coincide; off-diagonal branches retain their product probabilities. -/25def weights (p : κ → ℝ) : MergedLabel κ → ℝ26| none => ∑ i, p i ^ 227| some z => p z.val.1 * p z.val.22829omit [DecidableEq κ] in30theorem weights_nonneg (p : κ → ℝ) (hp : ∀ i, 0 ≤ p i) (z : MergedLabel κ) :310 ≤ weights p z := by32cases z with33| none => exact Finset.sum_nonneg (fun i _ => sq_nonneg _)34| some z => exact mul_nonneg (hp _) (hp _)3536theorem weights_sum (p : κ → ℝ) (hsum : ∑ i, p i = 1) :37∑ z, weights p z = 1 := by38have h := split_pair_sum (fun z : κ × κ => p z.1 * p z.2)39have ht : (∑ z : κ × κ, p z.1 * p z.2) = 1 := by40simp only [Fintype.sum_prod_type, ← Finset.mul_sum, hsum, mul_one]41rw [ht] at h42simpa only [Fintype.sum_option, weights, pow_two, add_comm] using h.symm4344/-- Gibbs' inequality against the normalized uniform Bell mixture gives45the exact supporting line with slope `-log K` at diagonal mass `1/K`. -/46theorem shannon_le_of_merged_distribution [Nonempty κ] (r : MergedLabel κ → ℝ)47(hr : ∀ z, 0 ≤ r z) (hsum : ∑ z, r z = 1) :48shannon r ≤ 2 * Real.log (Fintype.card κ) - r none * Real.log (Fintype.card κ) := by49have hk : (0 : ℝ) < Fintype.card κ := by positivity50have hq (z : MergedLabel κ) : 0 < mergedWeights z := by51cases z <;> dsimp [mergedWeights] <;> positivity52have hb := Finset.sum_le_sum (fun z (_ : z ∈ Finset.univ) =>53GeneralBell.mul_log_lower (hr z) (hq z))54have hcross : (∑ z, r z * Real.log (mergedWeights z)) =55-2 * Real.log (Fintype.card κ) + r none * Real.log (Fintype.card κ) := by56have hs := hsum57rw [Fintype.sum_option] at hs58have hs' : (∑ i, r (some i)) = 1 - r none := by linarith59simp only [Fintype.sum_option, mergedWeights, one_div, Real.log_inv,60Real.log_pow, ← Finset.sum_mul]61rw [hs']62ring63simp only [Finset.sum_sub_distrib, Finset.sum_add_distrib, hsum,64mergedWeights_sum, hcross] at hb65unfold shannon66linarith6768theorem weights_shannon_le [Nonempty κ] (p : κ → ℝ) (hp : ∀ i, 0 ≤ p i)69(hsum : ∑ i, p i = 1) :70shannon (weights p) ≤ 2 * Real.log (Fintype.card κ) -71(∑ i, p i ^ 2) * Real.log (Fintype.card κ) :=72shannon_le_of_merged_distribution (weights p) (weights_nonneg p hp) (weights_sum p hsum)7374end Merged757677/-- A two-coordinate perturbation, defined for every real parameter so its78continuity is available before imposing positivity. -/79def perturbedWeights {K : ℕ} (hK : 2 ≤ K) (t : ℝ) (i : Fin K) : ℝ :=801 / (K : ℝ) + (if i = ⟨0, by omega⟩ then t else 0) -81(if i = ⟨1, by omega⟩ then t else 0)8283@[simp] theorem perturbedWeights_zero {K : ℕ} (hK : 2 ≤ K) :84perturbedWeights hK 0 = fun _ => 1 / (K : ℝ) := by85funext i86simp [perturbedWeights]8788@[simp] theorem perturbedWeights_zero_index {K : ℕ} (hK : 2 ≤ K) (t : ℝ) :89perturbedWeights hK t ⟨0, by omega⟩ = 1 / (K : ℝ) + t := by90simp [perturbedWeights]9192@[simp] theorem perturbedWeights_one_index {K : ℕ} (hK : 2 ≤ K) (t : ℝ) :93perturbedWeights hK t ⟨1, by omega⟩ = 1 / (K : ℝ) - t := by94simp [perturbedWeights]9596theorem perturbedWeights_sum {K : ℕ} (hK : 2 ≤ K) (t : ℝ) :97∑ i, perturbedWeights hK t i = 1 := by98have hk : (K : ℝ) ≠ 0 := by exact_mod_cast (by omega : K ≠ 0)99simp only [perturbedWeights, Finset.sum_sub_distrib, Finset.sum_add_distrib,100Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul,101Finset.sum_ite_eq', Finset.mem_univ, if_true]102field_simp103ring104105theorem perturbedWeights_positive {K : ℕ} (hK : 2 ≤ K) {t : ℝ}106(ht : 0 ≤ t) (htK : t < 1 / (K : ℝ)) (i : Fin K) :1070 < perturbedWeights hK t i := by108have hu : (0 : ℝ) < 1 / (K : ℝ) := by positivity109dsimp [perturbedWeights]110split_ifs <;> linarith111112theorem perturbedWeights_close {K : ℕ} (hK : 2 ≤ K) (t : ℝ) (i : Fin K) :113|perturbedWeights hK t i - 1 / (K : ℝ)| ≤ |t| := by114dsimp [perturbedWeights]115split_ifs <;> ring_nf <;> simp [abs_neg, abs_nonneg]116117theorem continuous_perturbedWeights_apply {K : ℕ} (hK : 2 ≤ K) (i : Fin K) :118Continuous (fun t : ℝ => perturbedWeights hK t i) := by119unfold perturbedWeights120split_ifs <;> fun_prop121122theorem continuous_perturbedWeights {K : ℕ} (hK : 2 ≤ K) :123Continuous (perturbedWeights hK) :=124continuous_pi (continuous_perturbedWeights_apply hK)125126theorem perturbedWeights_sum_sq {K : ℕ} (hK : 2 ≤ K) (t : ℝ) :127∑ i, perturbedWeights hK t i ^ 2 = 1 / (K : ℝ) + 2 * t ^ 2 := by128have hk : (K : ℝ) ≠ 0 := by exact_mod_cast (by omega : K ≠ 0)129have hpoint (i : Fin K) : perturbedWeights hK t i ^ 2 =130(1 / (K : ℝ)) ^ 2 +131(if i = ⟨0, by omega⟩ then 2 * (1 / (K : ℝ)) * t + t ^ 2 else 0) +132(if i = ⟨1, by omega⟩ then -2 * (1 / (K : ℝ)) * t + t ^ 2 else 0) := by133by_cases h0 : i = ⟨0, by omega⟩134· simp [perturbedWeights, h0]135ring136· by_cases h1 : i = ⟨1, by omega⟩137· simp [perturbedWeights, h1]138ring139· simp [perturbedWeights, h0, h1]140simp_rw [hpoint]141simp only [Finset.sum_add_distrib, Finset.sum_const, Finset.card_univ,142Fintype.card_fin, nsmul_eq_mul, Finset.sum_ite_eq', Finset.mem_univ, if_true]143field_simp144ring145146/-- The exact strict reserve in Bell entropy is quadratic in the small147weight perturbation. -/148theorem perturbedWeights_shannon_le {K : ℕ} (hK : 2 ≤ K) {t : ℝ}149(ht : 0 ≤ t) (htK : t < 1 / (K : ℝ)) :150shannon (weights (perturbedWeights hK t)) ≤1512 * Real.log (K : ℝ) - Real.log (K : ℝ) / K -1522 * t ^ 2 * Real.log (K : ℝ) := by153letI : NeZero K := ⟨by omega⟩154have h := weights_shannon_le (perturbedWeights hK t)155(fun i => (perturbedWeights_positive hK ht htK i).le) (perturbedWeights_sum hK t)156rw [perturbedWeights_sum_sq] at h157simp only [Fintype.card_fin] at h158convert h using 1159ring160161theorem perturbation_margin_pos {K : ℕ} (hK : 2 ≤ K) {t : ℝ} (ht : 0 < t) :1620 < 2 * t ^ 2 * Real.log (K : ℝ) := by163have hlog : 0 < Real.log (K : ℝ) := Real.log_pos (by exact_mod_cast (by omega : 1 < K))164exact mul_pos (mul_pos (by norm_num) (sq_pos_of_pos ht)) hlog165166/-- Positive admissible perturbations exist within every prescribed167neighborhood of the uniform weights. -/168theorem exists_perturbation_parameter {K : ℕ} (hK : 2 ≤ K) {ε : ℝ} (hε : 0 < ε) :169∃ t : ℝ, 0 < t ∧ t < 1 / (K : ℝ) ∧ t < ε := by170have hu : (0 : ℝ) < 1 / (K : ℝ) := by positivity171refine ⟨min (ε / 2) ((1 / (K : ℝ)) / 2),172lt_min (half_pos hε) (half_pos hu), ?_, ?_⟩173· exact (min_le_right _ _).trans_lt (half_lt_self hu)174· exact (min_le_left _ _).trans_lt (half_lt_self hε)175176end Nonadditivity.WeightedBellScalar