{
  "status": "proved",
  "decl": "ProbabilityTheory.le_cam",
  "lean_source": "import Mathlib.Analysis.Normed.Ring.InfiniteSum\nimport Mathlib.Probability.Distributions.Poisson.Basic\n\n/-! # Le Cam's Poisson approximation theorem\n\nWe compare the singleton masses of probability measures on the natural numbers.\nAdditive convolution contracts their ℓ¹ distance.\n-/\n\nopen MeasureTheory\nopen scoped NNReal BigOperators\n\nnamespace ProbabilityTheory\n\nprivate noncomputable def mass (μ : Measure ℕ) (n : ℕ) : ℝ := μ.real {n}\n\nprivate theorem hasSum_mass (μ : Measure ℕ) [IsProbabilityMeasure μ] :\n    HasSum (mass μ) 1 := by\n  have h : (∑' n : ℕ, μ {n}) = 1 := by\n    rw [← measure_iUnion (fun i j hij ↦ Set.disjoint_singleton.mpr hij)\n      (fun n : ℕ ↦ measurableSet_singleton n)]\n    rw [Set.iUnion_singleton_eq_range]\n    change μ (Set.range id) = 1\n    rw [Set.range_id, measure_univ]\n  have hs : Summable (mass μ) := ENNReal.summable_toReal (h.symm ▸ ENNReal.one_ne_top)\n  have hreal : (∑' n, mass μ n) = 1 := by\n    change (∑' n : ℕ, (μ {n}).toReal) = 1\n    rw [← ENNReal.tsum_toReal_eq (fun n : ℕ ↦ measure_ne_top μ {n}), h, ENNReal.toReal_one]\n  exact hreal ▸ hs.hasSum\n\nprivate noncomputable def massDist (μ ν : Measure ℕ) : ℝ :=\n  ∑' n, |mass μ n - mass ν n|\n\nprivate theorem summable_abs_sub_mass (μ ν : Measure ℕ)\n    [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] :\n    Summable (fun n ↦ |mass μ n - mass ν n|) := by\n  apply ((hasSum_mass μ).summable.add (hasSum_mass ν).summable).of_nonneg_of_le\n  · exact fun _ ↦ abs_nonneg _\n  · intro n\n    have hμ : 0 ≤ mass μ n := measureReal_nonneg\n    have hν : 0 ≤ mass ν n := measureReal_nonneg\n    exact abs_le.mpr ⟨by linarith, by linarith⟩\n\nprivate theorem massDist_triangle (μ ν ρ : Measure ℕ)\n    [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] [IsProbabilityMeasure ρ] :\n    massDist μ ρ ≤ massDist μ ν + massDist ν ρ := by\n  rw [massDist, massDist, massDist, ← (summable_abs_sub_mass μ ν).tsum_add (summable_abs_sub_mass ν ρ)]\n  exact (summable_abs_sub_mass μ ρ).tsum_le_tsum (fun n ↦ abs_sub_le _ _ _)\n    ((summable_abs_sub_mass μ ν).add (summable_abs_sub_mass ν ρ))\n\nprivate theorem mass_conv (μ ν : Measure ℕ) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν]\n    (n : ℕ) :\n    mass (μ ∗ ν) n = ∑ ij ∈ Finset.antidiagonal n, mass μ ij.1 * mass ν ij.2 := by\n  rw [mass, Measure.conv, map_measureReal_apply (by fun_prop) (measurableSet_singleton _)]\n  have hf : (fun ij : ℕ × ℕ ↦ ij.1 + ij.2) ⁻¹' {n} = ↑(Finset.antidiagonal n) := by\n    ext ij\n    simp [Finset.mem_antidiagonal]\n  rw [hf, ← sum_measureReal_singleton]\n  apply Finset.sum_congr rfl\n  intro ij _\n  rw [← Set.singleton_prod_singleton, measureReal_def, Measure.prod_prod, ENNReal.toReal_mul]\n  rfl\n\nprivate theorem massDist_conv_right (μ ν ρ : Measure ℕ)\n    [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] [IsProbabilityMeasure ρ] :\n    massDist (μ ∗ ρ) (ν ∗ ρ) ≤ massDist μ ν := by\n  let f : ℕ → ℝ := fun n ↦ |mass μ n - mass ν n|\n  have hf : Summable f := summable_abs_sub_mass μ ν\n  have hg := (hasSum_mass ρ).summable\n  have hfg : Summable (fun ij : ℕ × ℕ ↦ f ij.1 * mass ρ ij.2) :=\n    hf.mul_of_nonneg hg (fun _ ↦ abs_nonneg _) (fun _ ↦ measureReal_nonneg)\n  calc\n    massDist (μ ∗ ρ) (ν ∗ ρ)\n      ≤ ∑' n, ∑ ij ∈ Finset.antidiagonal n, f ij.1 * mass ρ ij.2 := by\n        apply (summable_abs_sub_mass _ _).tsum_le_tsum _\n          (summable_sum_mul_antidiagonal_of_summable_mul hfg)\n        intro n\n        rw [mass_conv, mass_conv, ← Finset.sum_sub_distrib]\n        simp only [← sub_mul]\n        refine (Finset.abs_sum_le_sum_abs _ _).trans_eq ?_\n        have hρ (k : ℕ) : 0 ≤ mass ρ k := measureReal_nonneg\n        simp [abs_mul, abs_of_nonneg (hρ _), f]\n    _ = massDist μ ν := by\n      rw [← hf.tsum_mul_tsum_eq_tsum_sum_antidiagonal hg hfg, (hasSum_mass ρ).tsum_eq, mul_one]\n      rfl\n\nprivate theorem massDist_conv (μ ν ρ σ : Measure ℕ)\n    [IsProbabilityMeasure μ] [IsProbabilityMeasure ν]\n    [IsProbabilityMeasure ρ] [IsProbabilityMeasure σ] :\n    massDist (μ ∗ ρ) (ν ∗ σ) ≤ massDist μ ν + massDist ρ σ := by\n  apply (massDist_triangle (μ ∗ ρ) (ν ∗ ρ) (ν ∗ σ)).trans\n  apply add_le_add (massDist_conv_right μ ν ρ)\n  rw [Measure.conv_comm ν ρ, Measure.conv_comm ν σ]\n  exact massDist_conv_right ρ σ ν\n\nprivate theorem massDist_poisson_of_bernoulli (μ : Measure ℕ) [IsProbabilityMeasure μ]\n    (hμ : ∀ n : ℕ, n ≠ 0 → n ≠ 1 → mass μ n = 0) :\n    massDist μ (poissonMeasure ⟨mass μ 1, measureReal_nonneg⟩) ≤ 2 * mass μ 1 ^ 2 := by\n  let p : ℝ≥0 := ⟨mass μ 1, measureReal_nonneg⟩\n  change massDist μ (poissonMeasure p) ≤ 2 * (p : ℝ) ^ 2\n  have hp : 0 ≤ (p : ℝ) := p.coe_nonneg\n  have h0 : mass μ 0 = 1 - p := by\n    have h := (hasSum_mass μ).tsum_eq\n    rw [tsum_eq_sum (s := {0, 1}) (fun n hn ↦ hμ n\n      (fun e ↦ hn (by simp [e])) (fun e ↦ hn (by simp [e])))] at h\n    simp at h\n    change mass μ 0 = 1 - mass μ 1\n    linarith\n  -- The signed mass difference sums to zero and is nonpositive off {1}.\n  let d : ℕ → ℝ := fun n ↦ mass μ n - mass (poissonMeasure p) n\n  have hd := (hasSum_mass μ).sub (hasSum_mass (poissonMeasure p))\n  have he : 1 - (p : ℝ) ≤ Real.exp (-(p : ℝ)) := by\n    linarith [Real.add_one_le_exp (-(p : ℝ))]\n  have h_exp : Real.exp (-(p : ℝ)) ≤ 1 := Real.exp_le_one_iff.mpr (by linarith)\n  have hd1 : d 1 = (p : ℝ) * (1 - Real.exp (-(p : ℝ))) := by\n    simp [d, mass, poissonMeasure_real_singleton, ← show (p : ℝ) = μ.real {1} from rfl]\n    ring\n  have hd_other (n : ℕ) (hn : n ≠ 1) : d n ≤ 0 := by\n    by_cases hz : n = 0\n    · subst n\n      rw [show d 0 = mass μ 0 - mass (poissonMeasure p) 0 from rfl, h0]\n      have hz : mass (poissonMeasure p) 0 = Real.exp (-(p : ℝ)) := by\n        simp [mass, poissonMeasure_real_singleton]\n      rw [hz]\n      linarith\n    · have hnonneg : 0 ≤ mass (poissonMeasure p) n := measureReal_nonneg\n      simpa only [d, hμ n hz hn, zero_sub, neg_nonpos] using hnonneg\n  have habs (n : ℕ) : |d n| = (if n = 1 then 2 * d 1 else 0) - d n := by\n    by_cases hn : n = 1\n    · subst n\n      rw [abs_of_nonneg (by rw [hd1]; exact mul_nonneg hp (sub_nonneg.mpr h_exp))]\n      simp\n      ring\n    · simp [hn, abs_of_nonpos (hd_other n hn)]\n  have hi : HasSum (fun n : ℕ ↦ if n = 1 then 2 * d 1 else 0) (2 * d 1) :=\n    hasSum_ite_eq (1 : ℕ) (2 * d 1)\n  have ha : HasSum (fun n ↦ |d n|) (2 * d 1 - (1 - 1)) := by\n    simpa only [habs] using hi.sub hd\n  change (∑' n, |d n|) ≤ _\n  rw [ha.tsum_eq, sub_self, sub_zero, hd1]\n  nlinarith [mul_le_mul_of_nonneg_left (show 1 - Real.exp (-(p : ℝ)) ≤ p by linarith) hp]\n\nprivate theorem poissonMeasure_zero_eq_dirac : poissonMeasure 0 = Measure.dirac (0 : ℕ) := by\n  apply Measure.ext_of_singleton\n  intro n\n  cases n with\n  | zero => simp [poissonMeasure_singleton]\n  | succ n => simp [poissonMeasure_singleton, zero_pow (Nat.succ_ne_zero n)]\n\n/-- Le Cam's Poisson approximation theorem (Wikidata Q3154003).\n\n\"For any finite family of independent Bernoulli trials, let `pᵢ` be the probability\nof success of trial `i` and let `S` be the sum of the trials. The sum over `k ≥ 0`\nof the absolute differences between `P(S = k)` and the Poisson masses of rate\n`∑ i, pᵢ` is at most `2 * ∑ i, pᵢ²`.\"\n\nThe series of absolute differences is summable. The family may be empty, and the\ntrials may take values in `{0, 1}` almost surely. -/\n@[wikidata Q3154003]\ntheorem le_cam {Ω ι : Type*} [MeasurableSpace Ω] [Fintype ι]\n    (P : Measure Ω) [IsProbabilityMeasure P] (X : ι → Ω → ℕ)\n    (hX : ∀ i, AEMeasurable (X i) P) (h_indep : iIndepFun X P)\n    (h_binary : ∀ i, ∀ᵐ ω ∂P, X i ω = 0 ∨ X i ω = 1) :\n    let p : ι → ℝ≥0 := fun i ↦ ⟨P.real (X i ⁻¹' {1}), measureReal_nonneg⟩\n    let rate : ℝ≥0 := ∑ i, p i\n    let error : ℕ → ℝ := fun k ↦\n      |P.real {ω | (∑ i, X i ω) = k} - Real.exp (-(rate : ℝ)) * (rate : ℝ) ^ k / k.factorial|\n    Summable error ∧ (∑' k, error k) ≤ 2 * ∑ i, (p i : ℝ) ^ 2 := by\n  classical\n  let p : ι → ℝ≥0 := fun i ↦ ⟨P.real (X i ⁻¹' {1}), measureReal_nonneg⟩\n  let S : Finset ι → Ω → ℕ := fun s ω ↦ ∑ i ∈ s, X i ω\n  have hS (s : Finset ι) : AEMeasurable (S s) P :=\n    s.aemeasurable_fun_sum fun i _ ↦ hX i\n  let (s : Finset ι) : IsProbabilityMeasure (P.map (S s)) :=\n    (Measure.isProbabilityMeasure_map_iff (hS s)).2 inferInstance\n  let (i : ι) : IsProbabilityMeasure (P.map (X i)) :=\n    (Measure.isProbabilityMeasure_map_iff (hX i)).2 inferInstance\n  have h_single (i : ι) : massDist (P.map (X i)) (poissonMeasure (p i)) ≤ 2 * (p i : ℝ) ^ 2 := by\n    have hmass (n : ℕ) : mass (P.map (X i)) n = P.real (X i ⁻¹' {n}) :=\n      map_measureReal_apply_of_aemeasurable (hX i) (measurableSet_singleton n)\n    have h := massDist_poisson_of_bernoulli (P.map (X i)) (fun n hn0 hn1 ↦ by\n      rw [hmass, measureReal_def, measure_mono_null _ (ae_iff.mp (h_binary i)),\n        ENNReal.toReal_zero]\n      intro ω hω\n      have hn : X i ω = n := hω\n      exact fun h ↦ h.elim (fun e ↦ hn0 (hn.symm.trans e)) (fun e ↦ hn1 (hn.symm.trans e)))\n    change massDist (P.map (X i)) (poissonMeasure (p i)) ≤\n      2 * P.real (X i ⁻¹' {1}) ^ 2\n    simpa only [p, hmass] using h\n  have h_bound (s : Finset ι) :\n      massDist (P.map (S s)) (poissonMeasure (∑ i ∈ s, p i)) ≤ 2 * ∑ i ∈ s, (p i : ℝ) ^ 2 := by\n    induction s using Finset.induction_on with\n    | empty =>\n      have h_empty : S ∅ = fun _ ↦ (0 : ℕ) := by\n        ext ω\n        simp [S]\n      simp [h_empty, Measure.map_const, poissonMeasure_zero_eq_dirac, massDist]\n    | insert i s hi ih =>\n      have h_add : S (insert i s) = X i + S s := by\n        ext ω\n        simp [S, Finset.sum_insert hi, Pi.add_apply]\n      have h_sep : IndepFun (X i) (S s) P := by\n        have h_sum : (∑ j ∈ s, X j) = S s := by\n          funext ω\n          exact Finset.sum_apply ω s X\n        rw [← h_sum]\n        exact (h_indep.indepFun_finsetSum_of_notMem₀ hX hi).symm\n      rw [h_add, h_sep.map_add_eq_map_conv_map₀ (hX i) (hS s),\n        Finset.sum_insert hi, Finset.sum_insert hi, ← poissonMeasure_conv_poissonMeasure]\n      exact (massDist_conv _ _ _ _).trans (by linarith [h_single i])\n  have h_error (k : ℕ) :\n      |mass (P.map (S Finset.univ)) k - mass (poissonMeasure (∑ i, p i)) k| =\n        |P.real {ω | (∑ i, X i ω) = k} -\n          Real.exp (-((∑ i, p i : ℝ≥0) : ℝ)) * ((∑ i, p i : ℝ≥0) : ℝ) ^ k /\n            k.factorial| := by\n    rw [mass, mass, map_measureReal_apply_of_aemeasurable (hS _) (measurableSet_singleton k),\n      poissonMeasure_real_singleton]\n    rfl\n  constructor\n  · simpa only [h_error] using\n      summable_abs_sub_mass (P.map (S Finset.univ)) (poissonMeasure (∑ i, p i))\n  · simpa only [massDist, h_error] using h_bound Finset.univ\n\nend ProbabilityTheory\n\n#print axioms ProbabilityTheory.le_cam\n",
  "build_output": "'ProbabilityTheory.le_cam' depends on axioms: [propext, Classical.choice, Quot.sound]\n",
  "explanation": "For any finite set of independent Bernoulli trials, compare the law of the number of successes with the Poisson law of rate equal to the sum of the success probabilities. The sum of absolute differences is finite and bounded by twice the sum of squared success probabilities. This is the finite Bernoulli case of Proposition 1 of Le Cam (1960), where the absolute differences give the measure norm on a countable space. https://msp.org/pjm/1960/10-4/p11.xhtml\n\nEach law has singleton masses summing to one, so the absolute differences are summable by comparison with the sum of the two mass sequences. The mass of a convolution at k is a sum over pairs adding to k. Apply the triangle inequality inside each such sum and use the Cauchy product identity to bound the resulting series by the original distance times the total mass of the common factor, which is one. For one trial, the Bernoulli mass minus the Poisson mass is nonpositive at zero by 1 − p ≤ exp(−p), and nonpositive at every k ≥ 2 because Bernoulli has no mass there. The signed differences sum to zero, so the absolute sum is twice the difference at one, 2p(1 − exp(−p)). The same exponential inequality bounds this by 2p². Insert one trial at a time. Independence identifies the new sum law as a convolution and Poisson additivity identifies its approximation as a convolution. Applying contraction and the triangle inequality adds just the new single-trial error.\n\nSingle-target triage: grade A, about a page of standard mathematics and 226 lines in the completed Lean file. The pinned Mathlib supplies Poisson masses and convolution additivity, the convolution law of independent sums, and the summable Cauchy product. The local lemmas provide the probability-mass summability argument, the discrete convolution estimate, the Bernoulli-to-Poisson estimate, and the zero-rate base case. Build: Lean 4.36.0 (611c117bfaf7b7ae1cfcf246ce6fba31e8f509e9), supplied prebuilt Mathlib fc4f59e577feb1a4956671bc04ac18aaaf8cd842, both archives checked against fetch.json. Command: lean -DautoImplicit=false LeCam.lean, with LEAN_PATH from the bundle. Independent-agent clean-clone rebuild and fidelity review: UNVERIFIED.",
  "fidelity": [
    "Any probability space: Ω is an arbitrary type with a measurable space and P is an arbitrary probability measure.",
    "Any finite family: the index type has Fintype and there is no Nonempty hypothesis. The proof handles the empty partial sum explicitly, using the point mass at zero for both laws.",
    "Independent binary variables: iIndepFun requires joint independence. Each trial is ℕ-valued, a.e. measurable and a.e. equal to 0 or 1, covering measurable, pointwise binary trials.",
    "Success probabilities and rate: p i is the real measure of the fiber X i = 1, represented as a nonnegative real. The rate is the finite sum of those probabilities. Each p i is determined separately and the theorem allows unequal probabilities and both endpoints.",
    "Sum and Poisson mass: the error uses P.real {ω | (∑ i, X i ω) = k} and the explicit exp(−rate) * rate^k / k.factorial for every natural k.",
    "Conclusion: the theorem explicitly proves Summable error and bounds the full real series by 2 * ∑ i, (p i : ℝ)^2 with a non-strict inequality. This is the full ℓ¹ sum."
  ],
  "prior_work": [
    {
      "addresses": [
        "https://leanprover-community.github.io/1000-missing.html",
        "https://leanprover-community.github.io/1000.html",
        "https://raw.githubusercontent.com/leanprover-community/mathlib4/e54979a532247ae4eb9d5578a8fd40a1bc332101/docs/1000.yaml"
      ],
      "finding": "The missing list names Q3154003 as Le Cam’s theorem. The Mathlib database record has a title and no declarations. The finished list links to that YAML database, where completed entries provide declaration names."
    },
    {
      "addresses": [
        "https://github.com/leanprover-community/mathlib4/tree/e54979a532247ae4eb9d5578a8fd40a1bc332101",
        "https://raw.githubusercontent.com/leanprover-community/mathlib4/e54979a532247ae4eb9d5578a8fd40a1bc332101/Mathlib/Probability/Distributions/Poisson/Basic.lean",
        "https://loogle.lean-lang.org/json?q=%22le_cam%22"
      ],
      "finding": "Searched Mathlib master at e54979a532247ae4eb9d5578a8fd40a1bc332101 for Le Cam and Q3154003. Found the Poisson law and convolution lemmas, and the separate Poisson limit theorem. Found no matching Le Cam approximation proof. Loogle returned no declaration with le_cam in its name."
    },
    {
      "addresses": [
        "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+is%3Aopen+%22Le+Cam%22",
        "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+is%3Aopen+Poisson+approximation+in%3Atitle",
        "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+is%3Aopen+%22poisson+binomial%22"
      ],
      "finding": "Open Mathlib PR searches returned zero hits for “Le Cam” and for both Poisson and approximation in the title. Reviewed the titles of the nine hits for “poisson binomial” and found no matching PR."
    },
    {
      "addresses": [
        "https://github.com/rjwalters/lean-genius/tree/main/proofs/Proofs",
        "https://api.github.com/repos/rjwalters/lean-genius/git/trees/d8540c5a48f69a9f57b87c549c6e09dad63a0670?recursive=1"
      ],
      "finding": "Searched the checked-out Lean files under proofs/Proofs at d8540c5a48f69a9f57b87c549c6e09dad63a0670 for Le Cam, the Wikidata ID and Poisson binomial. Found no matching proof."
    },
    {
      "addresses": [
        "https://github.com/search?q=le_cam+language%3ALean&type=code",
        "https://api.github.com/search/code?q=le_cam+language%3ALean"
      ],
      "finding": "Public web searches for GitHub Lean results by theorem name and Poisson approximation found related contiguity and statistical results but no matching proof. Exhaustive GitHub code search is UNVERIFIED. The code-search API returned HTTP 401."
    },
    {
      "addresses": [
        "https://leanprover-community.github.io/archive/",
        "https://leanprover-community.github.io/archive/stream/287929-mathlib4/topic/Looking.20for.20reviewer.20for.20.2334435.20(Poisson.20convolution).html"
      ],
      "finding": "Searched public archive topic indexes for mathlib4, lean4, maths, general, new members, PR reviews, triage and Is there code for X?, and ran an indexed web search of the archive and Zulip. Found discussion of Poisson convolution and the Poisson limit theorem but no matching approximation proof. Unindexed messages and live search are UNVERIFIED."
    }
  ],
  "database_entry": {
    "wikidata_id": "Q3154003",
    "title": "Le Cam's theorem",
    "decl": "ProbabilityTheory.le_cam",
    "file": "LeCam.lean"
  },
  "stuck": null,
  "sources": [
    "https://leanprover-community.github.io/1000-missing.html",
    "https://leanprover-community.github.io/1000.html",
    "https://msp.org/pjm/1960/10-4/p11.xhtml",
    "https://github.com/Identity-md/lean-bundles/releases/download/pequalnp-e125f04d0dc6/fetch.json",
    "https://raw.githubusercontent.com/leanprover-community/mathlib4/e54979a532247ae4eb9d5578a8fd40a1bc332101/docs/1000.yaml",
    "https://raw.githubusercontent.com/leanprover-community/mathlib4/e54979a532247ae4eb9d5578a8fd40a1bc332101/Mathlib/Probability/Distributions/Poisson/Basic.lean",
    "https://raw.githubusercontent.com/leanprover-community/mathlib4/fc4f59e577feb1a4956671bc04ac18aaaf8cd842/Mathlib/Probability/Distributions/Poisson/Basic.lean",
    "https://raw.githubusercontent.com/leanprover-community/mathlib4/fc4f59e577feb1a4956671bc04ac18aaaf8cd842/Mathlib/Probability/Independence/Basic.lean",
    "https://raw.githubusercontent.com/leanprover-community/mathlib4/fc4f59e577feb1a4956671bc04ac18aaaf8cd842/Mathlib/Topology/Algebra/InfiniteSum/Ring.lean",
    "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+is%3Aopen+%22Le+Cam%22",
    "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+is%3Aopen+Poisson+approximation+in%3Atitle",
    "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+is%3Aopen+%22poisson+binomial%22",
    "https://loogle.lean-lang.org/json?q=%22le_cam%22",
    "https://api.github.com/repos/rjwalters/lean-genius/git/trees/d8540c5a48f69a9f57b87c549c6e09dad63a0670?recursive=1",
    "https://leanprover-community.github.io/archive/",
    "https://leanprover-community.github.io/archive/stream/287929-mathlib4/topic/Looking.20for.20reviewer.20for.20.2334435.20(Poisson.20convolution).html"
  ]
}
