Stat.Minimax.Multinomial.TwoSampleL1
Estimating the L1 distance ‖R − S‖₁ between two probability vectors on k symbols from two independent i.i.d.
Definitions 9 core · 6 supporting This module defines the exact fixed-size experiment for estimating the L1 distance between two finite probability vectors. ★ twoSampleLaw_singleton
Fixed two-sample multinomial L1 experiment
This module defines the exact fixed-size experiment for estimating the L1 distance between two finite probability vectors. It is the neutral interface used by reusable lower bounds for the experiment.
A finite probability vector represented by nonnegative real coordinates whose sum is one.
Definition (Lean source)
The probability mass function represented by a finite probability vector.
Definition (Lean source)
The law of a fixed-size iid sample from a finite probability vector.
Definition (Lean source)
The L1 distance between two finite probability vectors.
Definition (Lean source)
The product law of two independent fixed-size samples.
Definition (Lean source)
Every measurable real-valued statistic of a pair of fixed-size samples.
Definition (Lean source)
The squared risk for estimating the L1 distance in the fixed two-sample experiment.
Definition (Lean source)
The minimax squared risk for estimating the L1 distance from two fixed-size samples.
Definition (Lean source)
Given an alphabet size, a sample size, two probability vectors, and an ordered pair of samples, the singleton mass of the paired iid law factors into its coordinate probabilities.
Formal statement
Proof (Lean source)
6 supporting declarations (lemmas, instances)
-
simplexMass_sumlemma — The nonnegative extended-real coordinates of a probability vector sum to one.Proof (Lean source)
lemma simplexMass_sum {k : ℕ} (R : ProbabilitySimplex k) : ∑ i : Fin k, ofReal (R.1 i) = 1 := by rw [← ENNReal.ofReal_sum_of_nonneg (fun i _ => R.2.1 i), R.2.2] norm_num -
simplexSampleLaw_isProbabilityinstance — A fixed-size iid sample law from a finite probability vector is a probability measure. -
simplexL1_nonneg_le_twolemma — The L1 distance between two finite probability vectors lies between zero and two.hypothesesk :ℕR S :Proof (Lean source)
lemma simplexL1_nonneg_le_two {k : ℕ} (R S : ProbabilitySimplex k) : 0 ≤ simplexL1 R S ∧ simplexL1 R S ≤ 2 := by constructor · exact Finset.sum_nonneg (fun _ _ => abs_nonneg _) · have hterm (i : Fin k) : |R.1 i - S.1 i| ≤ R.1 i + S.1 i := by rw [abs_le] constructor <;> linarith [R.2.1 i, S.2.1 i] calc simplexL1 R S ≤ ∑ i : Fin k, (R.1 i + S.1 i) := Finset.sum_le_sum (fun i _ => hterm i) _ = 2 := by rw [Finset.sum_add_distrib, R.2.2, S.2.2]; ring -
simplexL1_selflemma — The L1 distance from a finite probability vector to itself is zero.Proof (Lean source)
-
simplexL1_symmlemma — The L1 distance between finite probability vectors is symmetric.Proof (Lean source)
lemma simplexL1_symm {k : ℕ} (R S : ProbabilitySimplex k) : simplexL1 R S = simplexL1 S R := by simp only [simplexL1, abs_sub_comm] -
twoSampleLaw_isProbabilityinstance — The product law of two independent fixed-size samples is a probability measure.
ScalarMomentPriors 2 core · 0 supporting This module packages the finite moment-matching priors needed for the paired multinomial construction. ★ exists_scalarMomentPriors
Finite scalar priors for the absolute-value cusp
This module packages the finite moment-matching priors needed for the paired
multinomial construction. The priors live on [-1,1]; their first several
moments agree, while their mean absolute values have an inverse-degree gap.
A pair of finitely supported probability distributions on a common nonempty set of nodes in [-1,1]: the two weight vectors are nonnegative and each sums to one, their moments agree through degree L, and the mean absolute value under the second distribution exceeds that under the first by at least 1/(50 L) (for L = 0 this reads as a nonnegative gap).
Definition (Lean source)
Given a positive moment degree, there exists a pair of finitely supported probability priors on common nodes in [-1,1] whose moments agree through that degree while the mean absolute value under the second exceeds that under the first by at least 1/(50 L).
Formal statement
Proof (Lean source)
PairedSimplex 3 core · 0 supporting Each latent scalar perturbs two cells in opposite directions, preserving their combined mass. ★ pairedBase_tilt_l1
Balanced pairs of multinomial coordinates
Each latent scalar perturbs two cells in opposite directions, preserving their combined mass. This module supplies the exact probability vectors and L1 identity used in the large-sample fuzzy construction.
The uniform probability vector on b pairs of two cells.
Definition (Lean source)
The probability vector obtained by raising the first cell and lowering the second cell in each pair by the same scalar amount. Each latent parameter is in [-1,1], and the common perturbation scale is in [0,1].
Definition (Lean source)
Given a positive balanced pair count, a bounded nonnegative tilt, and bounded cell directions, the L1 distance between the uniform base vector and the tilted vector equals (t/b) · Σ over pairs j of |u_j|.
Formal statement
Proof (Lean source)
FuzzyCertificate 3 core · 5 supporting Two finite priors certify a squared-risk lower bound when their L1 targets are separated and their fixed-sample predictive laws are close. ★ largeSample_fuzzyCertificate
Finite fuzzy certificates for the paired multinomial experiment
Two finite priors certify a squared-risk lower bound when their L1 targets are separated and their fixed-sample predictive laws are close. The certificate uses the exact neutral two-sample experiment.
The alphabet logarithm is the logarithm of Euler's number times the alphabet size.
A finite pair of priors on pairs of probability vectors, serving as fuzzy hypotheses for the fixed two-sample experiment: each prior has finitely many atoms (at least one) with weights summing to one; the second center exceeds the first by at least a positive separation δ; under each prior, the atoms whose L1 distance lies farther than δ/4 from that prior's center carry total weight at most 1/8; and the two prior mixtures of the two-sample laws are within total variation distance 1/16.
Definition (Lean source)
There is a universal constant a > 0 such that for every alphabet size k ≥ 2 and every sample size n > k² a fuzzy certificate exists whose separation δ satisfies δ² ≥ a · k / (n · log(e·k)).
Formal statement
Proof (Lean source)
5 supporting declarations (lemmas, instances)
-
logAlphabet_one_letheorem — The alphabet logarithm is at least one for every nonempty alphabet.Proof (Lean source)
theorem logAlphabet_one_le (k : ℕ) (hk : 1 ≤ k) : 1 ≤ logAlphabet k := by have hkR : (1 : ℝ) ≤ k := by exact_mod_cast hk have hlog : 0 ≤ log (k : ℝ) := Real.log_nonneg hkR unfold logAlphabet rw [Real.log_mul (Real.exp_ne_zero _) (by positivity), Real.log_exp] linarith -
padtheorem — Zero-mass alphabet padding carries a finite fuzzy certificate to every larger alphabet without changing its target separation.hypothesesconclusion∃ V : FuzzyCertificate n k, V.delta = W.deltaProof (Lean source)
theorem FuzzyCertificate.pad {n r k : ℕ} (W : FuzzyCertificate n r) (h : r ≤ k) : ∃ V : FuzzyCertificate n k, V.delta = W.delta := by let f : ((Fin n → Fin r) × (Fin n → Fin r)) → ((Fin n → Fin k) × (Fin n → Fin k)) := fun z => ((fun i => castLE h (z.1 i)), (fun i => castLE h (z.2 i))) have hf : Measurable f := measurable_of_finite f have hmap (w : Fin W.m → ℝ≥0∞) (θ : Fin W.m → ProbabilitySimplex r × ProbabilitySimplex r) : mixture w (fun i => twoSampleLaw n (padSimplex h (θ i).1, padSimplex h (θ i).2)) = Measure.map f (mixture w (fun i => twoSampleLaw n (θ i))) := by unfold mixture rw [Measure.map_finset_sum' hf.aemeasurable] apply Finset.sum_congr rfl intro i _ rw [Measure.map_smul, twoSampleLaw_pad] let μ₀ := mixture W.w₀ (fun i => twoSampleLaw n (W.θ₀ i)) let μ₁ := mixture W.w₁ (fun i => twoSampleLaw n (W.θ₁ i)) letI : IsProbabilityMeasure μ₀ := Causalean.Stat.mixture_isProbabilityMeasure W.w₀ W.w₀_sum _ letI : IsProbabilityMeasure μ₁ := Causalean.Stat.mixture_isProbabilityMeasure W.w₁ W.w₁_sum _ have hcontract : tvDist (Measure.map f μ₀) (Measure.map f μ₁) ≤ tvDist μ₀ μ₁ := by unfold tvDist apply ciSup_le rintro ⟨A, hA⟩ rw [map_measureReal_apply_of_aemeasurable hf.aemeasurable hA, map_measureReal_apply_of_aemeasurable hf.aemeasurable hA] exact le_ciSup bddAbove_tvDist_range ⟨f ⁻¹' A, hA.preimage hf⟩ refine ⟨{ m := W.m m_pos := W.m_pos w₀ := W.w₀ w₁ := W.w₁ w₀_sum := W.w₀_sum w₁_sum := W.w₁_sum θ₀ := fun i => (padSimplex h (W.θ₀ i).1, padSimplex h (W.θ₀ i).2) θ₁ := fun i => (padSimplex h (W.θ₁ i).1, padSimplex h (W.θ₁ i).2) center₀ := W.center₀ center₁ := W.center₁ delta := W.delta delta_pos := W.delta_pos center_sep := W.center_sep bad₀ := ?_ bad₁ := ?_ predictive_close := ?_ }, rfl⟩ · simpa only [padSimplex_l1] using W.bad₀ · simpa only [padSimplex_l1] using W.bad₁ · rw [hmap W.w₀ W.θ₀, hmap W.w₁ W.θ₁] exact hcontract.trans W.predictive_close -
binary_fuzzyCertificatetheorem — A two-point fixed-sample experiment on the binary alphabet admits fuzzy certificates with squared separation at least a positive constant over the sample size, uniformly for sample sizes above four.conclusion∃ a : ℝ,0 < aProof (Lean source)
theorem binary_fuzzyCertificate : ∃ a : ℝ, 0 < a ∧ ∀ n : ℕ, 4 < n → ∃ W : FuzzyCertificate n 2, a / (n : ℝ) ≤ W.delta ^ 2 := by refine ⟨1 / 4096, by norm_num, ?_⟩ intro n hn have hn0 : (0 : ℝ) < n := by exact_mod_cast (by omega : 0 < n) have hsqrt : 0 < sqrt (n : ℝ) := Real.sqrt_pos.2 hn0 have hsqrt_sq : (sqrt (n : ℝ)) ^ 2 = n := Real.sq_sqrt hn0.le let t : ℝ := 1 / (64 * sqrt (n : ℝ)) have ht : 0 < t := by dsimp [t]; positivity have ht1 : t ≤ 1 := by dsimp [t] have hnr : (4 : ℝ) < n := by exact_mod_cast hn have hroot : 1 ≤ sqrt (n : ℝ) := by nlinarith [hsqrt_sq] apply (div_le_iff₀ (by positivity : 0 < 64 * sqrt (n : ℝ))).2 linarith have ht_sq : t ^ 2 = 1 / (4096 * (n : ℝ)) := by dsimp [t] rw [div_pow, mul_pow, hsqrt_sq] norm_num let R : ProbabilitySimplex 2 := ⟨fun _ => 1/2, by constructor · intro i; norm_num · simp⟩ let S : ProbabilitySimplex 2 := ⟨fun i => if i = 0 then (1+t)/2 else (1-t)/2, by constructor · intro i; fin_cases i <;> simp <;> linarith · simp [Fin.sum_univ_two]; ring⟩ have hL1 : simplexL1 R S = t := by simp [simplexL1, R, S, Fin.sum_univ_two] rw [abs_of_nonpos (by linarith), abs_of_nonneg (by linarith)] ring have hRmass (i : Fin 2) : ((simplexPMF R).toMeasure).real {i} = 1/2 := by simp [measureReal_def, simplexPMF, R] have hSmass (i : Fin 2) : ((simplexPMF S).toMeasure).real {i} = if i = 0 then (1+t)/2 else (1-t)/2 := by simp [measureReal_def, simplexPMF, S, show 0 ≤ (if i = 0 then (1+t)/2 else (1-t)/2) from S.2.1 i] have hac : (simplexPMF S).toMeasure ≪ (simplexPMF R).toMeasure := by apply Measure.AbsolutelyContinuous.mk intro s hs hnull have hempty : s = ∅ := by ext i constructor · intro hi have hle : (simplexPMF R).toMeasure {i} ≤ (simplexPMF R).toMeasure s := measure_mono (Set.singleton_subset_iff.mpr hi) rw [hnull] at hle have hzero : ((simplexPMF R).toMeasure).real {i} = 0 := by simp [measureReal_def, bot_unique hle] linarith [hRmass i] · simp simp [hempty] have hchi : 1 + chiSqDiv (simplexPMF S).toMeasure (simplexPMF R).toMeasure = 1 + t ^ 2 := by rw [finite_one_add_chiSqDiv _ _ hac] simp only [Fin.sum_univ_two, hRmass, hSmass] norm_num ring have hpiac : simplexSampleLaw S n ≪ simplexSampleLaw R n := by exact Causalean.Mathlib.Probability.ProductAbsolutelyContinuous.pi_iid_absolutelyContinuous _ _ hac n have hpichi : 1 + chiSqDiv (simplexSampleLaw S n) (simplexSampleLaw R n) = (1 + t ^ 2) ^ n := by exact (one_add_chiSqDiv_pi_iid _ _ hac n).trans (by rw [hchi]) have hnt : (n : ℝ) * t ^ 2 = 1 / 4096 := by rw [ht_sq] field_simp have hpow : (1 + t ^ 2) ^ n ≤ 4096 / 4095 := by calc (1 + t ^ 2) ^ n ≤ (exp (t ^ 2)) ^ n := by apply pow_le_pow_left₀ (by positivity) linarith [Real.add_one_le_exp (t ^ 2)] _ = exp ((n : ℝ) * t ^ 2) := (Real.exp_nat_mul _ _).symm _ = exp (1 / 4096) := by rw [hnt] _ ≤ 1 / (1 - 1 / 4096) := Real.exp_bound_div_one_sub_of_interval (by norm_num) (by norm_num) _ = 4096 / 4095 := by norm_num have hpichi_le : chiSqDiv (simplexSampleLaw S n) (simplexSampleLaw R n) ≤ 1 / 64 := by linarith [hpichi, hpow] have htvPi : tvDist (simplexSampleLaw S n) (simplexSampleLaw R n) ≤ 1 / 16 := by have htv := tvDist_le_half_sqrt_chiSqDiv (simplexSampleLaw S n) (simplexSampleLaw R n) hpiac (Integrable.of_finite) have hsqrtle : sqrt (chiSqDiv (simplexSampleLaw S n) (simplexSampleLaw R n)) ≤ 1 / 8 := by exact (Real.sqrt_le_iff).2 ⟨by norm_num, by nlinarith [hpichi_le]⟩ linarith have hprod : tvDist (twoSampleLaw n (R, R)) (twoSampleLaw n (R, S)) ≤ 1 / 16 := by have hself : tvDist (simplexSampleLaw R n) (simplexSampleLaw R n) = 0 := by simp [tvDist] calc tvDist (twoSampleLaw n (R, R)) (twoSampleLaw n (R, S)) ≤ tvDist (simplexSampleLaw R n) (simplexSampleLaw R n) + tvDist (simplexSampleLaw R n) (simplexSampleLaw S n) := by exact tvDist_prod_le_add _ _ _ _ _ = tvDist (simplexSampleLaw S n) (simplexSampleLaw R n) := by rw [hself, zero_add, tvDist_symm] _ ≤ 1 / 16 := htvPi have hnot : ¬ t / 4 < 0 := by linarith [ht] refine ⟨{ m := 1 m_pos := by omega w₀ := fun _ => 1 w₁ := fun _ => 1 w₀_sum := by simp w₁_sum := by simp θ₀ := fun _ => (R, R) θ₁ := fun _ => (R, S) center₀ := 0 center₁ := t delta := t delta_pos := ht center_sep := by simp bad₀ := by simp [simplexL1_self, hnot] bad₁ := by simp [hL1, hnot] predictive_close := by simpa [mixture] using hprod }, ?_⟩ rw [ht_sq] field_simp exact le_refl _ -
largeAlphabet_fuzzyCertificatetheorem — Above a universal alphabet threshold, balanced moment priors give fixed sample fuzzy certificates at the alphabet-over-samples logarithmic rate.conclusion∃ a : ℝ,0 < aconclusion 1∃ K : ℕ,2 ≤ Kk n :ℕK ≤ kk ^ 2 < n∃ W : FuzzyCertificate n k, a * ((k : ℝ) / ((n : ℝ) * logAlphabet k)) ≤ W.delta ^ 2Proof (Lean source)
theorem largeAlphabet_fuzzyCertificate : ∃ a : ℝ, 0 < a ∧ ∃ K : ℕ, 2 ≤ K ∧ ∀ k n : ℕ, K ≤ k → k ^ 2 < n → ∃ W : FuzzyCertificate n k, a * ((k : ℝ) / ((n : ℝ) * logAlphabet k)) ≤ W.delta ^ 2 := by classical obtain ⟨a, ha, K, hK, hparams⟩ := exists_pairedLargeParameters refine ⟨a, ha, K, hK, ?_⟩ intro k n hk hn obtain ⟨b, L, t, δ, hb, hL, hbk, ht, ht1, hδ, hscale, hvar, hclose, hδgap, hrate⟩ := hparams k n hk hn obtain ⟨P⟩ := exists_scalarMomentPriors L (by omega) let e : Fin (card (Fin b → Fin P.m)) ≃ (Fin b → Fin P.m) := (Fintype.equivFin _).symm let θ (i : Fin (card (Fin b → Fin P.m))) := (pairedBaseVector b hb, pairedTiltVector b hb t ht ht1 (pairedNodeVector P (e i)) (pairedNodeVector_abs_le_one P (e i))) let w (side : Bool) (i : Fin (card (Fin b → Fin P.m))) := pairedProductWeight P b side (e i) let c (side : Bool) := ∑ i, (w side i).toReal * simplexL1 (θ i).1 (θ i).2 letI : Nonempty (Fin b → Fin P.m) := ⟨fun _ => ⟨0, P.m_pos⟩⟩ have hsum (side : Bool) : ∑ i, w side i = 1 := by exact (e.sum_comp (pairedProductWeight P b side)).trans (pairedProductWeight_sum P b side) have hmean (side : Bool) : c side = t * ∑ i : Fin P.m, scalarPriorWeight P side i * |P.node i| := by let f (u : Fin b → Fin P.m) := (pairedProductWeight P b side u).toReal * simplexL1 (pairedBaseVector b hb) (pairedTiltVector b hb t ht ht1 (pairedNodeVector P u) (pairedNodeVector_abs_le_one P u)) change (∑ i, f (e i)) = _ rw [e.sum_comp] exact pairedProductTarget_mean P b hb t ht ht1 side have hbad (side : Bool) : (∑ i, if δ / 4 < |simplexL1 (θ i).1 (θ i).2 - c side| then w side i else 0) ≤ (1 / 8 : ℝ≥0∞) := by rw [hmean side] let f (u : Fin b → Fin P.m) : ℝ≥0∞ := if δ / 4 < |simplexL1 (pairedBaseVector b hb) (pairedTiltVector b hb t ht ht1 (pairedNodeVector P u) (pairedNodeVector_abs_le_one P u)) - t * (∑ j : Fin P.m, scalarPriorWeight P side j * |P.node j|)| then pairedProductWeight P b side u else 0 change (∑ i, f (e i)) ≤ _ rw [e.sum_comp] exact pairedProductTarget_bad_mass_le P b hb t ht ht1 δ hδ hvar side have hsep : δ ≤ c true - c false := by rw [hmean true, hmean false] have hgap := P.abs_gap have hmul := mul_le_mul_of_nonneg_left hgap ht have hδ' : δ ≤ t * ((1 / 50 : ℝ) / (L : ℝ)) := hδgap simpa [scalarPriorWeight, mul_sub] using hδ'.trans hmul have hpred : tvDist (mixture (w false) (fun i => twoSampleLaw n (θ i))) (mixture (w true) (fun i => twoSampleLaw n (θ i))) ≤ 1 / 16 := by have htv := pairedFixedPredictive_tv_le P b n hb t ht ht1 hscale have hleft (side : Bool) : mixture (w side) (fun i => twoSampleLaw n (θ i)) = pairedFixedPredictive P b n hb t ht ht1 side := by let f (u : Fin b → Fin P.m) := pairedProductWeight P b side u • twoSampleLaw n (pairedBaseVector b hb, pairedTiltVector b hb t ht ht1 (pairedNodeVector P u) (pairedNodeVector_abs_le_one P u)) change (∑ i, f (e i)) = _ rw [e.sum_comp] rfl rw [hleft false, hleft true] exact htv.trans hclose let W : FuzzyCertificate n (b * 2) := { m := card (Fin b → Fin P.m) m_pos := Fintype.card_pos w₀ := w false w₁ := w true w₀_sum := hsum false w₁_sum := hsum true θ₀ := θ θ₁ := θ center₀ := c false center₁ := c true delta := δ delta_pos := hδ center_sep := hsep bad₀ := hbad false bad₁ := hbad true predictive_close := hpred } obtain ⟨V, hV⟩ := W.pad hbk refine ⟨V, ?_⟩ simpa only [hV, W, logAlphabet] using hrate -
boundedAlphabet_fuzzyCertificatetheorem — For every finite alphabet bound, binary fuzzy certificates extend to all alphabet sizes below that bound with one positive rate constant.hypothesesK :ℕhK :2 ≤ Kconclusion∃ a : ℝ,0 < aconclusion 1k n :ℕ2 ≤ kk < Kk ^ 2 < n∃ W : FuzzyCertificate n k, a * ((k : ℝ) / ((n : ℝ) * logAlphabet k)) ≤ W.delta ^ 2Proof (Lean source)
theorem boundedAlphabet_fuzzyCertificate (K : ℕ) (hK : 2 ≤ K) : ∃ a : ℝ, 0 < a ∧ ∀ k n : ℕ, 2 ≤ k → k < K → k ^ 2 < n → ∃ W : FuzzyCertificate n k, a * ((k : ℝ) / ((n : ℝ) * logAlphabet k)) ≤ W.delta ^ 2 := by obtain ⟨a, ha, hbinary⟩ := binary_fuzzyCertificate have hKpos : (0 : ℝ) < K := by exact_mod_cast (by omega : 0 < K) refine ⟨a / (K : ℝ), by positivity, ?_⟩ intro k n hk hkK hn have hn4 : 4 < n := by nlinarith obtain ⟨W, hW⟩ := hbinary n hn4 obtain ⟨V, hV⟩ := W.pad hk refine ⟨V, ?_⟩ have hkR : (k : ℝ) ≤ K := by exact_mod_cast (le_of_lt hkK) have hlog : 1 ≤ logAlphabet k := logAlphabet_one_le k (by omega) have hlogpos : 0 < logAlphabet k := by linarith have hnpos : (0 : ℝ) < n := by exact_mod_cast (by omega : 0 < n) have hfrac : (k : ℝ) / ((K : ℝ) * logAlphabet k) ≤ 1 := by apply (div_le_iff₀ (mul_pos hKpos hlogpos)).2 calc (k : ℝ) ≤ K := hkR _ = (K : ℝ) * 1 := by ring _ ≤ (K : ℝ) * logAlphabet k := mul_le_mul_of_nonneg_left hlog hKpos.le _ = 1 * ((K : ℝ) * logAlphabet k) := by ring calc (a / (K : ℝ)) * ((k : ℝ) / ((n : ℝ) * logAlphabet k)) = (a / (n : ℝ)) * ((k : ℝ) / ((K : ℝ) * logAlphabet k)) := by ring _ ≤ (a / (n : ℝ)) * 1 := mul_le_mul_of_nonneg_left hfrac (by positivity) _ = a / (n : ℝ) := by ring _ ≤ V.delta ^ 2 := by simpa only [hV] using hW
PairedProductPrior 4 core · 2 supporting Independent finite scalar moment priors are replicated across balanced pairs of alphabet cells. ★ pairedProductTarget_mean
Product priors on balanced multinomial pairs
Independent finite scalar moment priors are replicated across balanced pairs of alphabet cells. The product weights and exact target mean provide the finite combinatorial layer of the large-sample fuzzy construction.
Select the scalar mass of a node from one of the two moment priors: the second prior's weight when the side flag is true, the first prior's weight otherwise.
Definition (Lean source)
The independent product weight assigned to one vector of scalar nodes.
Definition (Lean source)
The real perturbation at each pair is the scalar node selected by the corresponding coordinate of a product-prior index.
Definition (Lean source)
Given a scalar moment prior, a positive balanced pair count, a bounded nonnegative tilt, and a prior side, the product-prior mean of the L1 distance between the uniform base vector and the tilted vector equals t times the mean absolute node value under the chosen scalar prior.
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
pairedNodeVector_abs_le_onetheorem — Each coordinate of a product-prior perturbation lies in [-1,1].hypothesesconclusion|pairedNodeVector P u j| ≤ 1Proof (Lean source)
theorem pairedNodeVector_abs_le_one {L : ℕ} (P : ScalarMomentPriors L) {b : ℕ} (u : Fin b → Fin P.m) (j : Fin b) : |pairedNodeVector P u j| ≤ 1 := by have h := P.node_mem (u j) exact abs_le.mpr ⟨h.1, h.2⟩ -
pairedProductWeight_sumtheorem — The finite weights of either independent product prior sum to one.hypothesesconclusionProof (Lean source)
theorem pairedProductWeight_sum {L : ℕ} (P : ScalarMomentPriors L) (b : ℕ) (side : Bool) : ∑ u : Fin b → Fin P.m, pairedProductWeight P b side u = 1 := by classical have hnonneg (i : Fin P.m) : 0 ≤ scalarPriorWeight P side i := by cases side <;> simp [scalarPriorWeight, P.w₀_nonneg, P.w₁_nonneg] have hscalar : ∑ i : Fin P.m, scalarPriorWeight P side i = 1 := by cases side <;> simp [scalarPriorWeight, P.w₀_sum, P.w₁_sum] have hsum : ∑ i : Fin P.m, ofReal (scalarPriorWeight P side i) = 1 := by rw [← ENNReal.ofReal_sum_of_nonneg (fun i _ => hnonneg i), hscalar] simp calc _ = ∏ _j : Fin b, ∑ i : Fin P.m, ofReal (scalarPriorWeight P side i) := by simpa [pairedProductWeight] using (Fintype.prod_sum (fun _j : Fin b => fun i : Fin P.m => ofReal (scalarPriorWeight P side i))).symm _ = 1 := by simp [hsum]
PairedPoissonPredictive 2 core · 0 supporting Independent scalar priors across balanced alphabet pairs give independent Poisson count-pair predictive laws. ★ pairedPoissonPredictive_tv_le
Product-prior Poisson predictive laws for balanced cell pairs
Independent scalar priors across balanced alphabet pairs give independent Poisson count-pair predictive laws. Their total variation tensorizes.
The predictive count-vector law under one finite product prior, with one independent balanced Poisson count pair for each alphabet pair.
Definition (Lean source)
Given a moment prior, a pair count, a nonnegative Poisson intensity and bounded nonnegative tilt, and the scale budget 100·λ·t² ≤ L, the total variation distance between the paired Poisson predictive laws of the two prior sides is at most b · 2^(−L/4).
Formal statement
Proof (Lean source)
ScalarPoissonLikelihood 3 core · 2 supporting The two rates have a fixed sum. ★ scalarPoissonPairLikelihood_inner
Likelihood of a balanced pair of Poisson counts
The two rates have a fixed sum. Relative to the pair with equal rates, their joint likelihood is a product of two powers, and its inner product has an exponential Gram formula. These identities are the analytic input to the moment-matched predictive comparison.
The joint law of two independent Poisson counts with rates lambda (1 + t u) and lambda (1 - t u), the opposite perturbations of a common intensity lambda; a negative rate is truncated to zero.
Definition (Lean source)
The function (1 + t u)^z₁ · (1 - t u)^z₂ of a count pair (z₁, z₂). When both perturbed rates are nonnegative it is the likelihood ratio of the balanced Poisson pair with rates λ (1 + t u), λ (1 - t u) relative to the pair with equal rates λ; the two exponential factors cancel because the rates sum to a constant.
Definition (Lean source)
Given a nonnegative Poisson intensity λ and a tilt scale t with two tilt coordinates u and v, the integral of the product of the pair likelihoods at u and at v, under the untilted Poisson pair law with both rates equal to λ, equals exp(2 λ t² u v).
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
poisson_power_mgftheorem — The expectation of a real power under a Poisson law is the exponential of the intensity times the power base minus one.Proof (Lean source)
theorem poisson_power_mgf (q : NNReal) (u : ℝ) : (∫ n : ℕ, u ^ n ∂poissonMeasure q) = exp ((q : ℝ) * (u - 1)) := by rw [integral_poissonMeasure] simp only [smul_eq_mul] rw [show (fun n : ℕ => exp (-(q : ℝ)) * (q : ℝ) ^ n / (n.factorial : ℝ) * u ^ n) = fun n => exp (-(q : ℝ)) * (((q : ℝ) * u) ^ n / (n.factorial : ℝ)) by funext n rw [mul_pow] ring] rw [tsum_mul_left] rw [show (∑' n : ℕ, ((q : ℝ) * u) ^ n / (n.factorial : ℝ)) = exp ((q : ℝ) * u) by simpa only [Real.exp_eq_exp_ℝ] using (NormedSpace.expSeries_div_hasSum_exp ((q : ℝ) * u)).tsum_eq] rw [← Real.exp_add] congr 1 ring -
scalarPoissonPairLaw_eq_withDensitytheorem — At positive baseline intensity and a nonnegative pair of perturbed rates, the balanced Poisson law has the stated likelihood density relative to the unperturbed pair. This localizes the real-to-nonnegative-rate conversion.hypotheseslambda t u :ℝhlambda :0 < lambdahplus :0 ≤ 1 + t * uhminus :0 ≤ 1 - t * uconclusionscalarPoissonPairLaw lambda t u= (scalarPoissonPairLaw lambda t 0).withDensity (fun z => ofReal (scalarPoissonPairLikelihood t u z))Proof (Lean source)
theorem scalarPoissonPairLaw_eq_withDensity (lambda t u : ℝ) (hlambda : 0 < lambda) (hplus : 0 ≤ 1 + t * u) (hminus : 0 ≤ 1 - t * u) : scalarPoissonPairLaw lambda t u = (scalarPoissonPairLaw lambda t 0).withDensity (fun z => ofReal (scalarPoissonPairLikelihood t u z)) := by /- Compare singleton masses using `poissonMeasure_singleton`. The exponential factors cancel exactly because the two rates sum to `2*lambda`. `Measure.ext_of_singleton` applies since the observation space is countable. -/ apply Measure.ext_of_singleton rintro ⟨n, m⟩ rw [withDensity_apply _ (by measurability), lintegral_singleton] simp only [scalarPoissonPairLaw, scalarPoissonPairLikelihood, ← Set.singleton_prod_singleton, Measure.prod_prod, poissonMeasure_singleton] have hp : 0 ≤ lambda * (1 + t * u) := mul_nonneg hlambda.le hplus have hm : 0 ≤ lambda * (1 - t * u) := mul_nonneg hlambda.le hminus simp only [Real.coe_toNNReal _ hp, Real.coe_toNNReal _ hm, mul_zero, add_zero, sub_zero, mul_one, Real.coe_toNNReal _ hlambda.le] rw [← ENNReal.ofReal_mul (by positivity), ← ENNReal.ofReal_mul (by positivity), ← ENNReal.ofReal_mul (by positivity)] congr 1 have hexp : exp (-(lambda * (1 + t * u))) * exp (-(lambda * (1 - t * u))) = exp (-lambda) * exp (-lambda) := by rw [← Real.exp_add, ← Real.exp_add] congr 1 ring calc _ = (exp (-(lambda * (1 + t * u))) * exp (-(lambda * (1 - t * u)))) * (lambda ^ n * lambda ^ m) * ((1 + t * u) ^ n * (1 - t * u) ^ m) / ((n.factorial : ℝ) * (m.factorial : ℝ)) := by rw [mul_pow, mul_pow] ring _ = _ := by rw [hexp]; ring
FinitePoissonPrefix 2 core · 1 supporting The finite Poisson experiment can be read as a fixed-length array by using a common fallback observation when its random count is too small. ★ finitePoissonSampleLaw_map_prefix
A fixed prefix of a finite Poisson sample
The finite Poisson experiment can be read as a fixed-length array by using a common fallback observation when its random count is too small. This module isolates the exact pushforward law needed for fixed-sample comparisons.
Read the first n observations of a finite sample, returning the constant x₀ array when its count is less than n.
Definition (Lean source)
Given a measurable outcome space, a probability law, a Poisson mean, a fallback outcome, and a prefix length, the law of the padded prefix is the fixed-size iid law weighted by the probability that the Poisson count is at least n, plus a point mass at the constant fallback array weighted by the probability that the count is below n.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
measurable_finitePoissonPrefixtheorem — The padded fixed prefix is a measurable function of the finite sample.hypothesesconclusionProof (Lean source)
@[fun_prop] theorem measurable_finitePoissonPrefix {X : Type*} [MeasurableSpace X] (x₀ : X) (n : ℕ) : Measurable (finitePoissonPrefix x₀ n : FiniteSample X → Fin n → X) := by intro t ht rw [MeasurableSpace.measurableSet_iInf] intro m change MeasurableSet ((fun x : Fin m → X => if h : n ≤ m then fun i : Fin n => x (castLE h i) else fun _ => x₀) ⁻¹' t) by_cases h : n ≤ m · simp only [dif_pos h] exact ht.preimage (by fun_prop) · simp only [dif_neg h] exact measurable_const ht
FixedPoissonBridge 1 core · 0 supporting A Poisson sample with a common count law and mean larger than the target sample size can be truncated to a fixed prefix. ★ fixedSampleMixture_tv_le_finitePoisson
Fixed-sample comparison with finite Poisson samples
A Poisson sample with a common count law and mean larger than the target sample size can be truncated to a fixed prefix. The only discrepancy is the event that the Poisson count is too small. This comparison is uniform over finite parameter priors and keeps the ordered iid experiment intact.
Given fixed sample, alphabet, and mixture sizes with a nonempty alphabet and Poisson mean, two normalized mixture weights, and two collections of multinomial vectors, the total variation distance between the two mixtures of fixed-size iid sample laws is at most the total variation distance between the corresponding mixtures of finite Poisson sample laws plus twice the probability that a Poisson count with the given mean falls below the fixed sample size.
Formal statement
Proof (Lean source)
FuzzyRisk 1 core · 0 supporting This module turns a finite two-prior testing certificate into a lower bound for the exact real-valued minimax squared risk of the paired experiment. ★ minimax_lower
Risk transfer from a finite paired fuzzy certificate
This module turns a finite two-prior testing certificate into a lower bound for the exact real-valued minimax squared risk of the paired experiment.
Given a sample size and alphabet size and a valid finite fuzzy certificate, the minimax squared risk of estimating the L1 distance is at least 11δ²/512, where δ is the certificate's separation.
Formal statement
Proof (Lean source)
LargeSample 1 core · 0 supporting The rate applies to every alphabet of size at least two and every fixed sample size greater than the square of that alphabet size. ★ twoSampleL1MinimaxRisk_largeSample_lower
Large-sample two-multinomial L1 minimax lower bound
The rate applies to every alphabet of size at least two and every fixed sample size greater than the square of that alphabet size.
There is a universal constant c > 0 such that, for every alphabet size k ≥ 2 and every sample size n > k², the minimax squared risk of estimating the L1 distance between two probability vectors on k symbols from two independent samples of size n is at least c · k / (n · log(e·k)).
Formal statement
Proof (Lean source)
PairedAlphabetPadding 2 core · 1 supporting An alphabet can be enlarged by assigning zero probability to every new cell. ★ twoSampleLaw_pad
Zero-mass padding of finite multinomial alphabets
An alphabet can be enlarged by assigning zero probability to every new cell. The L1 target and the fixed ordered two-sample experiment are preserved.
A probability vector on a smaller alphabet, extended by zero mass to a larger alphabet.
Definition (Lean source)
Given smaller and larger alphabet sizes and a sample size, an embedding of the smaller alphabet, and a pair of smaller-alphabet probability vectors, relabeling both samples gives exactly the law under zero-mass padding.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
padSimplex_l1theorem — Adding zero-mass labels to both probability vectors preserves their L1 distance exactly.hypothesesconclusionProof (Lean source)
theorem padSimplex_l1 {r k : ℕ} (h : r ≤ k) (R S : ProbabilitySimplex r) : simplexL1 (padSimplex h R) (padSimplex h S) = simplexL1 R S := by change (∑ i : Fin k, |(if hi : (i : ℕ) < r then R.1 ⟨i, hi⟩ else 0) - (if hi : (i : ℕ) < r then S.1 ⟨i, hi⟩ else 0)|) = ∑ i : Fin r, |R.1 i - S.1 i| calc _ = ∑ i : Fin k, if hi : (i : ℕ) < r then |R.1 ⟨i, hi⟩ - S.1 ⟨i, hi⟩| else 0 := by apply Finset.sum_congr rfl intro i _ split_ifs <;> simp _ = _ := sum_pad h (fun i => |R.1 i - S.1 i|)
PairedFixedPredictive 2 core · 0 supporting The first multinomial sample has a common uniform law under both hypotheses. ★ pairedFixedPredictive_tv_le
Fixed two-sample predictive comparison for balanced priors
The first multinomial sample has a common uniform law under both hypotheses. The second sample carries the balanced perturbation. Finite Poisson samples and their paired count vectors control the fixed predictive distance.
The fixed two-sample predictive law under one side of the balanced product prior: the mixture, with that side's product-prior weights, of the two-sample laws whose first sample is drawn from the uniform base vector and whose second sample is drawn from the vector tilted by t in the selected node directions.
Definition (Lean source)
Given a moment-matched prior, a balanced pair count and sample size, a bounded nonnegative tilt, and the scale budget 100·(n/b)·t² ≤ L, the total variation distance between the fixed two-sample predictive laws of the two prior sides is at most b · 2^(−L/4) plus twice the probability that a Poisson count with mean 2n falls below n.
Formal statement
Proof (Lean source)
PairedLargeParameters 1 core · 0 supporting Above a universal alphabet threshold, the moment degree can grow like the alphabet logarithm. ★ exists_pairedLargeParameters
Numerical parameters for the large-alphabet balanced prior
Above a universal alphabet threshold, the moment degree can grow like the alphabet logarithm. A small balanced tilt then meets the Poisson comparison, target concentration, and squared-separation requirements simultaneously.
There are a universal constant a > 0 and an alphabet threshold K ≥ 2 such that for every alphabet size k ≥ K and sample size n > k² there exist a pair count b ≥ 1 with 2b ≤ k, a moment degree L ≥ 1, a tilt t between 0 and 1, and a separation δ > 0 satisfying the comparison budget 100·(n/b)·t² ≤ L, the concentration budget 128·t² ≤ b·δ², the closeness budget b · 2^(−L/4) plus twice the probability that a Poisson count with mean 2n falls below n is at most 1/16, the separation bound δ ≤ t/(50L), and the rate bound δ² ≥ a · k / (n · log(e·k)).
Formal statement
Proof (Lean source)
PairedPoissonCountBridge 2 core · 0 supporting Counting each cell of a finite Poisson sample from a balanced multinomial vector gives independent Poisson counts, paired by alphabet cell. ★ pairedCountVector_map_finitePoissonSampleLaw
Count-vector bridge for the balanced Poisson experiment
Counting each cell of a finite Poisson sample from a balanced multinomial vector gives independent Poisson counts, paired by alphabet cell.
The two counts in each balanced alphabet pair of a finite sample.
Definition (Lean source)
Given a positive balanced pair count and a sample size, a bounded nonnegative tilt, and bounded cell directions, the paired count vector of a finite Poisson sample with mean 2n drawn from the tilted vector consists of independent count pairs, the pair for cell pair j being two independent Poisson counts with rates (n/b)(1 + t·u_j) and (n/b)(1 − t·u_j).
Formal statement
Proof (Lean source)
PairedPoissonMixtureBridge 2 core · 0 supporting The ordered finite Poisson sample can be reconstructed from its cell counts by a parameter-free uniform ordering kernel. ★ pairedFinitePoissonPredictive_tv_le_counts
Ordered Poisson mixtures and paired count vectors
The ordered finite Poisson sample can be reconstructed from its cell counts by a parameter-free uniform ordering kernel. This module isolates that sufficiency step for the balanced product priors.
The predictive law of an ordered finite Poisson sample from one of the balanced product priors.
Definition (Lean source)
Given a scalar moment prior, a positive balanced pair count and sample size, and a bounded nonnegative tilt, the finite-Poisson predictive distance is bounded by the paired count-law predictive distance.
Formal statement
Proof (Lean source)
PairedTargetConcentration 1 core · 0 supporting The L1 target under a balanced product prior is an average of independent bounded scalar absolute values. ★ pairedProductTarget_variance_le
Concentration of the paired product-prior target
The L1 target under a balanced product prior is an average of independent bounded scalar absolute values. This module isolates its finite variance bound before the fuzzy-hypothesis construction.
Given a scalar moment prior, a positive balanced pair count, a bounded nonnegative tilt, and a prior side, the product-prior mean squared deviation of the L1 distance between the base and tilted vectors from t times the mean absolute node value under the chosen scalar prior is at most t²/b.
Formal statement
Proof (Lean source)
PairedTargetTail 1 core · 0 supporting The variance of the balanced product-prior L1 target controls the mass of parameters whose target is far from its exact prior mean. ★ pairedProductTarget_bad_mass_le
Finite tail bound for the paired target
The variance of the balanced product-prior L1 target controls the mass of parameters whose target is far from its exact prior mean.
Given a scalar moment prior, a positive balanced pair count, a bounded nonnegative tilt, a positive target radius δ with 128·t² ≤ b·δ², and a prior side, the product-prior mass of node vectors whose L1 distance between the base and tilted vectors lies farther than δ/4 from its prior mean is at most one eighth.
Formal statement
Proof (Lean source)
ScalarPoissonComparison 2 core · 0 supporting A scalar perturbation raises one cell intensity and lowers its partner by the same amount. ★ scalarPoissonPredictive_tv_le
Predictive comparison for a balanced Poisson pair
A scalar perturbation raises one cell intensity and lowers its partner by the same amount. Equal scalar moments cancel the low-degree terms of the two-cell Poisson likelihood. This module isolates the quantitative remaining tail.
The Poisson count-pair predictive law formed from one of two finite scalar moment priors: the mixture, over the prior's nodes u with the selected side's weights, of the law of two independent Poisson counts with rates lambda (1 + t u) and lambda (1 - t u) (a negative rate is truncated to zero). The Boolean index selects the first (false) or second (true) prior.
Definition (Lean source)
Given a scalar moment-prior pair matched through degree L, a nonnegative Poisson intensity λ and a tilt t between zero and one, and the scale budget 100 λ t² ≤ L, the total variation distance between the two Poisson count-pair predictive laws built from the two priors is at most 2^(-L/4).
Formal statement
Proof (Lean source)
ScalarPriorMeasure 2 core · 2 supporting This module converts the finite weights and nodes of ScalarMomentPriors into probability measures on the real line. ★ scalarMomentPrior_moments_eq
Real-valued measures from finite scalar moment priors
This module converts the finite weights and nodes of ScalarMomentPriors into
probability measures on the real line. Their support and moment identities are
the input required by the analytic moment-matched mixture theorem.
The real-valued atomic prior selected from one side of a finite scalar moment-prior pair.
Definition (Lean source)
Given a scalar moment prior, a moment order, and a proof that the order is within the matched degree, the two prior measures have equal moments of that order.
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
scalarMomentPrior_isProbabilitytheorem — Each side of a finite scalar moment-prior pair is a probability measure on the real line.hypothesesconclusionIsProbabilityMeasure (scalarMomentPrior P side)Proof (Lean source)
theorem scalarMomentPrior_isProbability {L : ℕ} (P : ScalarMomentPriors L) (side : Bool) : IsProbabilityMeasure (scalarMomentPrior P side) := by classical cases side with | false => constructor simpa [scalarMomentPrior, ENNReal.ofReal_sum_of_nonneg (fun i _ => P.w₀_nonneg i)] using congrArg ofReal P.w₀_sum | true => constructor simpa [scalarMomentPrior, ENNReal.ofReal_sum_of_nonneg (fun i _ => P.w₁_nonneg i)] using congrArg ofReal P.w₁_sum -
scalarMomentPrior_supportedtheorem — Each real-valued scalar moment prior is supported on the unit interval.hypothesesconclusionscalarMomentPrior P side {u : ℝ | |u| ≤ 1} = 1Proof (Lean source)
theorem scalarMomentPrior_supported {L : ℕ} (P : ScalarMomentPriors L) (side : Bool) : scalarMomentPrior P side {u : ℝ | |u| ≤ 1} = 1 := by classical have hnode (i : Fin P.m) : P.node i ∈ {u : ℝ | |u| ≤ 1} := by exact abs_le.mpr (P.node_mem i) have hmass : scalarMomentPrior P side {u : ℝ | |u| ≤ 1} = scalarMomentPrior P side univ := by simp [scalarMomentPrior, Measure.coe_finsetSum, Measure.dirac_apply_of_mem, hnode] exact hmass.trans (IsProbabilityMeasure.measure_univ (self := scalarMomentPrior_isProbability P side))