Download full_collection/exchangeability.jsonl from DAPS-Math/DAPS-Blueprint: direct link, hf CLI and curl.
- Browser
- Download file 288 kB
-
https://huggingface.co/datasets/DAPS-Math/DAPS-Blueprint/resolve/main/full_collection/exchangeability.jsonl
- Command line
-
hf download hf://datasets/DAPS-Math/DAPS-Blueprint/full_collection/exchangeability.jsonl
-
curl -L -o exchangeability.jsonl https://huggingface.co/datasets/DAPS-Math/DAPS-Blueprint/resolve/main/full_collection/exchangeability.jsonl
288 kB
| {"id":"lem:kallenberg_chain","label":"kallenberg_chain","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["lem:tailSigma_eq_iInf","lem:futureFiltration_antitone","lem:condExp_indicator_eq"],"nlp_text":"Conditional expectations of indicators given the reverse filtration converge to conditional expectations given the tail \\(\\sigma \\)-algebra.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.condExp_indicator_revFiltration_eq_tail","latex_link":"sect0004.html#lem:kallenberg_chain","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.condExp_indicator_revFiltration_eq_tail","lean_decl_name":"Exchangeability.DeFinetti.ViaMartingale.condExp_indicator_revFiltration_eq_tail","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaMartingale/KallenbergChain.lean","lean4_code":"/-- **Conditional expectation on revFiltration equals tail.**\n\nFor contractable X with k < m, the conditional expectation of the indicator 1_{X_k ∈ B}\ngiven revFiltration X m equals the conditional expectation given tailSigma X.\n\n**Proof:**\n1. By `condExp_indicator_revFiltration_eq_of_le`, the sequence `μ[φ | revFiltration X n]`\n is constant for n ≥ m.\n2. By `condExp_tendsto_iInf`, this sequence converges a.e. to `μ[φ | tailSigma X]`.\n3. A constant sequence converges to its value, so the value equals the limit.\n-/\nlemma condExp_indicator_revFiltration_eq_tail\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n {X : ℕ → Ω → α} (hContr : Contractable μ X) (hX : ∀ n, Measurable (X n))\n {k m : ℕ} (hkm : k < m)\n {B : Set α} (hB : MeasurableSet B) :\n μ[Set.indicator (X k ⁻¹' B) (fun _ => (1 : ℝ)) | revFiltration X m]\n =ᵐ[μ]\n μ[Set.indicator (X k ⁻¹' B) (fun _ => (1 : ℝ)) | tailSigma X] := by\n set φ : Ω → ℝ := Set.indicator (X k ⁻¹' B) (fun _ => (1 : ℝ))\n set f := fun n => μ[φ | revFiltration X n]\n have hφ_int : Integrable φ μ := .indicator (integrable_const 1) ((hX k) hB)\n -- Reverse martingale convergence: f n → μ[φ | tailSigma X] a.e.\n have h_conv := Exchangeability.Probability.condExp_tendsto_iInf\n (revFiltration_antitone X) (revFiltration_le X hX) φ hφ_int\n -- For n ≥ m, f n =ᵐ f m (chain is eventually constant)\n have h_const : ∀ n, m ≤ n → f n =ᵐ[μ] f m :=\n fun n hn => (condExp_indicator_revFiltration_eq_of_le hContr hX hkm hn hB).symm\n -- Combine: pointwise constancy for n ≥ m\n have h_ae_const : ∀ᵐ ω ∂μ, ∀ n ≥ m, f n ω = f m ω := by\n rw [ae_all_iff]; intro n\n by_cases hn : m ≤ n\n · filter_upwards [h_const n hn] with ω hω _ using hω\n · filter_upwards with _ hmn using (hn hmn).elim\n -- Eventually constant sequence converges to its value\n filter_upwards [h_conv, h_ae_const] with ω h_tendsto h_all_const\n exact tendsto_const_nhds_iff.mp <|\n h_tendsto.congr' (eventually_atTop.mpr ⟨m, fun n hn => h_all_const n hn⟩)\n","line":235,"end_line":272,"proof_status":"formalized"} | |
| {"id":"lem:extreme_members_equal","label":"extreme_members_equal","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["lem:kallenberg_chain","lem:condexp_convergence"],"nlp_text":"For any measurable \\(B\\): \\(\\mathbb {E}[\\mathbf{1}_{X_m \\in B} \\mid \\mathcal{T}] = \\mathbb {E}[\\mathbf{1}_{X_0 \\in B} \\mid \\mathcal{T}]\\) a.s.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.extreme_members_equal_on_tail","latex_link":"sect0004.html#lem:extreme_members_equal","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.extreme_members_equal_on_tail","lean_decl_name":"Exchangeability.DeFinetti.ViaMartingale.extreme_members_equal_on_tail","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaMartingale/CondExpConvergence.lean","lean4_code":"/-- Conditional expectations of indicators are equal on the tail σ-algebra.\n\nFor any contractable process X and measurable set B,\n```\nP[X_m ∈ B | tail] = P[X_0 ∈ B | tail]\n```\n\n**Proof (Kallenberg route):**\n1. By `condExp_indicator_revFiltration_eq_tail`, conditioning on `revFiltration X (m+1)`\n equals conditioning on `tailSigma X` (via reverse martingale convergence).\n2. By `condexp_convergence`, both indicators have equal conditional expectation\n given `futureFiltration X m = revFiltration X (m+1)`.\n3. Combine to get equality on the tail.\n\nThis is the Kallenberg-style proof using the chain lemma and reverse martingale\nconvergence. See `extreme_members_equal_on_tail_via_tower` for an alternative\nproof using the tower property. -/\nlemma extreme_members_equal_on_tail\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n {X : ℕ → Ω → α}\n (hX : Contractable μ X)\n (hX_meas : ∀ n, Measurable (X n))\n (m : ℕ) (B : Set α) (hB : MeasurableSet B) :\n μ[Set.indicator B (fun _ => (1 : ℝ)) ∘ (X m) | tailSigma X]\n =ᵐ[μ]\n μ[Set.indicator B (fun _ => (1 : ℝ)) ∘ (X 0) | tailSigma X] := by\n -- Preimage formulation to match KallenbergChain API\n have h_pre : ∀ n, Set.indicator B (fun _ => (1 : ℝ)) ∘ X n =\n Set.indicator (X n ⁻¹' B) (fun _ => (1 : ℝ)) := fun n => by\n ext ω; simp only [Function.comp_apply, Set.indicator]; rfl\n simp only [h_pre]\n -- CE(X_k | rev (m+1)) = CE(X_k | tail) via Kallenberg chain + convergence\n have h_m := condExp_indicator_revFiltration_eq_tail hX hX_meas (Nat.lt_succ_self m) hB\n have h_0 := condExp_indicator_revFiltration_eq_tail hX hX_meas (Nat.zero_lt_succ m) hB\n -- CE(X_m | rev (m+1)) = CE(X_0 | rev (m+1)) via contractability\n have h_eq : μ[Set.indicator (X m ⁻¹' B) (fun _ => (1 : ℝ)) | revFiltration X (m + 1)]\n =ᵐ[μ] μ[Set.indicator (X 0 ⁻¹' B) (fun _ => (1 : ℝ)) | revFiltration X (m + 1)] := by\n convert condexp_convergence hX hX_meas 0 m (Nat.zero_le m) B hB using 2\n exact h_m.symm.trans (h_eq.trans h_0)\n","line":118,"end_line":156,"proof_status":"formalized"} | |
| {"id":"lem:finite_level_factorization","label":"finite_level_factorization","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["lem:extreme_members_equal"],"nlp_text":"For finite products of indicators, the conditional expectation given \\(\\mathcal{F}_m\\) factors as a product of individual conditional expectations.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.finite_level_factorization","latex_link":"sect0004.html#lem:finite_level_factorization","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.finite_level_factorization","lean_decl_name":"Exchangeability.DeFinetti.ViaMartingale.finite_level_factorization","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaMartingale/Factorization.lean","lean4_code":"/-- **Finite-level factorization builder (formerly Axiom 3).**\n\nFor a contractable sequence, at any future level `m ≥ r`, the conditional expectation\nof the product indicator factors:\n```\nμ[∏ᵢ<r 1_{Xᵢ∈Cᵢ} | σ(θₘ₊₁X)] = ∏ᵢ<r μ[1_{X₀∈Cᵢ} | σ(θₘ₊₁X)]\n```\n\nThis iteratively applies conditional independence to pull out one coordinate at a time,\nusing contractability to replace each `Xᵢ` with `X₀`. -/\nlemma finite_level_factorization\n {Ω α : Type*} [MeasurableSpace Ω] [StandardBorelSpace Ω]\n [MeasurableSpace α] [StandardBorelSpace α]\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n (X : ℕ → Ω → α)\n (hX : Contractable μ X)\n (hX_meas : ∀ n, Measurable (X n))\n (r : ℕ) (C : Fin r → Set α) (hC : ∀ i, MeasurableSet (C i))\n (m : ℕ) (hm : m ≥ r) :\n μ[indProd X r C | futureFiltration X m]\n =ᵐ[μ]\n (fun ω => ∏ i : Fin r,\n μ[Set.indicator (C i) (fun _ => (1:ℝ)) ∘ (X 0) | futureFiltration X m] ω) := by\n classical\n induction r with\n | zero =>\n -- r = 0: empty product is 1\n -- Both indProd X 0 C and the RHS product are constant 1\n have h_ind : indProd X 0 C = fun _ => 1 := funext fun _ => by simp [indProd]\n have h_rhs : (fun ω => ∏ i : Fin 0,\n μ[Set.indicator (C i) (fun _ => (1:ℝ)) ∘ (X 0) | futureFiltration X m] ω) = fun _ => 1 :=\n funext fun _ => by simp\n -- μ[indProd X 0 C | F] = μ[1 | F] = 1 = RHS (all definitional)\n conv_lhs => rw [h_ind]\n rw [condExp_const (futureFiltration_le X m hX_meas), h_rhs]\n | succ r ih =>\n -- r ↦ r+1: Inductive step using indicator factorization\n -- Must have r+1 ≤ m, which gives r < m for conditional independence\n have hrm : r < m := Nat.lt_of_succ_le hm\n\n -- Split C into \"first r\" and \"last\"\n let Cinit : Fin r → Set α := fun j => C (Fin.castSucc j)\n let Clast : Set α := C ⟨r, Nat.lt_succ_self r⟩\n have hCinit : ∀ j, MeasurableSet (Cinit j) := fun j => hC _\n have hClast : MeasurableSet Clast := hC ⟨r, Nat.lt_succ_self r⟩\n\n -- Factorize the product ∏_{i<r+1} 1_{Xᵢ∈Cᵢ} = (∏_{i<r} 1_{Xᵢ∈Cᵢ}) · 1_{Xᵣ∈Clast}\n have hsplit : indProd X (r+1) C\n = fun ω => indProd X r Cinit ω * Set.indicator Clast (fun _ => (1:ℝ)) (X r ω) := by\n funext ω\n simp only [indProd, Cinit, Clast]\n -- Split the product using Fin.prod_univ_castSucc\n rw [Fin.prod_univ_castSucc]; rfl\n\n -- Express the two factors as indicators of sets\n set A := firstRCylinder X r Cinit with hA_def\n set B := X r ⁻¹' Clast with hB_def\n\n -- Rewrite indProd using indicator algebra\n have hf_indicator : indProd X r Cinit = A.indicator (fun _ => (1:ℝ)) :=\n indProd_eq_firstRCylinder_indicator X r Cinit\n\n have hg_indicator : (Set.indicator Clast (fun _ => (1:ℝ)) ∘ X r)\n = B.indicator (fun _ => (1:ℝ)) :=\n indicator_comp_preimage (X r) Clast 1\n\n -- The product is the indicator of A ∩ B\n have hprod_indicator :\n (fun ω => indProd X r Cinit ω * (Set.indicator Clast (fun _ => (1:ℝ)) (X r ω)))\n = (A ∩ B).indicator (fun _ => (1:ℝ)) := by\n ext ω\n have hg' : Set.indicator Clast (fun _ => (1:ℝ)) (X r ω) = B.indicator (fun _ => (1:ℝ)) ω := by\n simpa only [Function.comp_apply] using congr_fun hg_indicator ω\n rw [congr_fun hf_indicator ω, hg']\n have := congr_fun (indicator_mul_indicator_eq_indicator_inter A B 1 1) ω\n simp only [Pi.mul_apply] at this\n convert this using 1\n ring_nf\n\n -- Measurability of A in firstRSigma X r\n have hA_meas_firstR : MeasurableSet[firstRSigma X r] A := by\n rw [hA_def]\n exact firstRCylinder_measurable_in_firstRSigma X r Cinit hCinit\n\n -- Measurability of B in σ(X r)\n have hB_meas_Xr : MeasurableSet[MeasurableSpace.comap (X r) inferInstance] B := by\n rw [hB_def]\n -- B = X r ⁻¹' Clast, which is measurable in σ(X r) by definition of comap\n exact ⟨Clast, hClast, rfl⟩\n\n -- Conditional independence from block_coord_condIndep\n have h_condIndep : ProbabilityTheory.CondIndep\n (futureFiltration X m)\n (firstRSigma X r)\n (MeasurableSpace.comap (X r) inferInstance)\n (futureFiltration_le X m hX_meas)\n μ :=\n block_coord_condIndep X hX hX_meas hrm\n\n -- Apply indicator factorization using the CI\n have hfactor :\n μ[(A.indicator (fun _ => (1:ℝ))) * (B.indicator (fun _ => (1:ℝ))) | futureFiltration X m]\n =ᵐ[μ]\n (fun ω => (μ[A.indicator (fun _ => (1:ℝ)) | futureFiltration X m] ω)\n * (μ[B.indicator (fun _ => (1:ℝ)) | futureFiltration X m] ω)) := by\n -- Convert product of indicators to indicator of intersection\n have h_inter : (A.indicator (fun _ => (1:ℝ))) * (B.indicator (fun _ => (1:ℝ)))\n = (A ∩ B).indicator (fun _ => (1:ℝ)) := by\n ext ω; simp only [Pi.mul_apply]\n simpa using congr_fun (indicator_mul_indicator_eq_indicator_inter A B 1 1) ω\n -- Apply standard CI product formula\n calc μ[(A.indicator (fun _ => (1:ℝ))) * (B.indicator (fun _ => (1:ℝ))) | futureFiltration X m]\n _ =ᵐ[μ] μ[(A ∩ B).indicator (fun _ => (1:ℝ)) | futureFiltration X m] :=\n condExp_congr_ae (EventuallyEq.of_eq h_inter)\n _ =ᵐ[μ] (μ[A.indicator (fun _ => (1:ℝ)) | futureFiltration X m] *\n μ[B.indicator (fun _ => (1:ℝ)) | futureFiltration X m]) :=\n condexp_indicator_inter_of_condIndep\n (futureFiltration_le X m hX_meas)\n (firstRSigma_le_ambient X r hX_meas)\n (fun s hs => by obtain ⟨t, ht, rfl⟩ := hs; exact (hX_meas r) ht)\n h_condIndep\n hA_meas_firstR\n hB_meas_Xr\n\n -- Apply IH to the first r factors\n have hIH : μ[indProd X r Cinit | futureFiltration X m] =ᵐ[μ]\n (fun ω => ∏ i : Fin r,\n μ[Set.indicator (Cinit i) (fun _ => (1:ℝ)) ∘ (X 0) | futureFiltration X m] ω) :=\n ih Cinit hCinit (Nat.le_of_succ_le hm)\n\n -- Replace Xᵣ with X₀ using contractability\n have hswap : μ[(Set.indicator Clast (fun _ => (1:ℝ)) ∘ X r) | futureFiltration X m]\n =ᵐ[μ]\n μ[(Set.indicator Clast (fun _ => (1:ℝ)) ∘ X 0) | futureFiltration X m] := by\n -- condexp_convergence swaps X_m with X_k, so swap X_m with X_r, then with X_0\n have h1 := condexp_convergence hX hX_meas r m (Nat.le_of_lt hrm) Clast hClast\n have h2 := condexp_convergence hX hX_meas 0 m (Nat.zero_le m) Clast hClast\n exact h1.symm.trans h2\n\n -- Combine everything\n calc μ[indProd X (r+1) C | futureFiltration X m]\n _ =ᵐ[μ] μ[(fun ω => indProd X r Cinit ω\n * Set.indicator Clast (fun _ => (1:ℝ)) (X r ω))\n | futureFiltration X m] := by\n refine condExp_congr_ae (EventuallyEq.of_eq hsplit)\n _ =ᵐ[μ] μ[(A.indicator (fun _ => (1:ℝ)))\n * (B.indicator (fun _ => (1:ℝ)))\n | futureFiltration X m] := by\n refine condExp_congr_ae (EventuallyEq.of_eq ?_)\n funext ω\n rw [← hf_indicator, ← hg_indicator]; rfl\n _ =ᵐ[μ] (fun ω => (μ[A.indicator (fun _ => (1:ℝ)) | futureFiltration X m] ω)\n * (μ[B.indicator (fun _ => (1:ℝ)) | futureFiltration X m] ω)) := hfactor\n _ =ᵐ[μ] (fun ω => (μ[indProd X r Cinit | futureFiltration X m] ω)\n * (μ[Set.indicator Clast (fun _ => (1:ℝ)) ∘ X r | futureFiltration X m] ω)) :=\n (condExp_congr_ae (.of_eq hf_indicator.symm)).mul (condExp_congr_ae (.of_eq hg_indicator.symm))\n _ =ᵐ[μ] (fun ω => (∏ i : Fin r,\n μ[Set.indicator (Cinit i) (fun _ => (1:ℝ)) ∘ (X 0)\n | futureFiltration X m] ω)\n * (μ[Set.indicator Clast (fun _ => (1:ℝ)) ∘ X r | futureFiltration X m] ω)) :=\n hIH.mul .rfl\n _ =ᵐ[μ] (fun ω => (∏ i : Fin r,\n μ[Set.indicator (Cinit i) (fun _ => (1:ℝ)) ∘ (X 0)\n | futureFiltration X m] ω)\n * μ[Set.indicator Clast (fun _ => (1:ℝ)) ∘ (X 0)\n | futureFiltration X m] ω) :=\n EventuallyEq.rfl.mul hswap\n _ =ᵐ[μ] (fun ω => ∏ i : Fin (r+1),\n μ[Set.indicator (C i) (fun _ => (1:ℝ)) ∘ (X 0)\n | futureFiltration X m] ω) := by\n apply EventuallyEq.of_eq\n funext ω\n -- Reverse of hsplit: combine products using Fin.prod_univ_castSucc\n symm\n rw [Fin.prod_univ_castSucc]\n simp only [Cinit, Clast, Fin.last]\n","line":174,"end_line":349,"proof_status":"formalized"} | |
| {"id":"lem:tail_factorization","label":"tail_factorization","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["lem:finite_level_factorization","lem:tailSigma_le_futureFiltration"],"nlp_text":"The tail \\(\\sigma \\)-algebra factorization follows from the finite-level factorization via reverse martingale convergence.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.tail_factorization_from_future","latex_link":"sect0004.html#lem:tail_factorization","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.tail_factorization_from_future","lean_decl_name":"Exchangeability.DeFinetti.ViaMartingale.tail_factorization_from_future","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaMartingale/Factorization.lean","lean4_code":"/-- **Tail factorization on finite cylinders (formerly Axiom 4).**\n\nAssume you have, for all large enough `m`, the finite‑level factorization\nat the future filtration:\n```\nμ[indProd X r C | σ(θ_{m+1}X)]\n = ∏ i<r μ[1_{X₀∈C i} | σ(θ_{m+1}X)] a.s.\n```\nThen the same factorization holds **at the tail σ‑algebra**:\n```\nμ[indProd X r C | 𝒯_X]\n = ∏ i<r μ[1_{X₀∈C i} | 𝒯_X] a.s.\n```\n\nThis passes the finite‑level equality to the tail using bounded\ndominated convergence together with reverse martingale convergence. -/\nlemma tail_factorization_from_future\n {Ω α : Type*} [MeasurableSpace Ω] [MeasurableSpace α]\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n (X : ℕ → Ω → α)\n (hX : ∀ n, Measurable (X n))\n (r : ℕ) (C : Fin r → Set α) (hC : ∀ i, MeasurableSet (C i))\n -- finite-level factorization hypothesis (available after applying the wrapper repeatedly)\n (h_fact :\n ∀ m ≥ r, -- any `m` with at least r future steps works\n μ[indProd X r C | futureFiltration X m]\n =ᵐ[μ]\n (fun ω => ∏ i : Fin r,\n μ[Set.indicator (C i) (fun _ => (1 : ℝ)) ∘ (X 0) | futureFiltration X m] ω))\n -- reverse-martingale convergence for each singleton factor\n (h_rev :\n ∀ i : Fin r,\n (∀ᵐ ω ∂μ,\n Tendsto (fun m => μ[Set.indicator (C i) (fun _ => (1 : ℝ)) ∘ (X 0)\n | futureFiltration X m] ω)\n atTop\n (𝓝 (μ[Set.indicator (C i) (fun _ => (1 : ℝ)) ∘ (X 0)\n | tailSigma X] ω)))) :\n μ[indProd X r C | tailSigma X]\n =ᵐ[μ]\n (fun ω => ∏ i : Fin r,\n μ[Set.indicator (C i) (fun _ => (1 : ℝ)) ∘ (X 0) | tailSigma X] ω) := by\n classical\n -- Strategy: Use reverse martingale convergence for the LHS\n -- The future filtration decreases to the tail σ-algebra, so reverse martingale\n -- convergence gives: μ[f | futureFiltration X m] → μ[f | tailSigma X] ae\n\n -- LHS reverse martingale convergence for the product\n have h_lhs_conv : ∀ᵐ ω ∂μ,\n Tendsto (fun m => μ[indProd X r C | futureFiltration X m] ω)\n atTop\n (𝓝 (μ[indProd X r C | tailSigma X] ω)) := by\n -- Apply Lévy's reverse martingale convergence directly\n have h_conv := Exchangeability.Probability.condExp_tendsto_iInf\n (μ := μ)\n (𝔽 := futureFiltration X)\n (h_filtration := futureFiltration_antitone X)\n (h_le := fun n => futureFiltration_le X n hX)\n (f := indProd X r C)\n (h_f_int := indProd_integrable X r C hX hC)\n simpa only [← tailSigmaFuture_eq_iInf, tailSigmaFuture_eq_tailSigma] using h_conv\n\n -- RHS convergence: product of convergent sequences\n have h_rhs_conv : ∀ᵐ ω ∂μ,\n Tendsto (fun m => ∏ i : Fin r,\n μ[Set.indicator (C i) (fun _ => (1 : ℝ)) ∘ (X 0) | futureFiltration X m] ω)\n atTop\n (𝓝 (∏ i : Fin r,\n μ[Set.indicator (C i) (fun _ => (1 : ℝ)) ∘ (X 0) | tailSigma X] ω)) := by\n -- Product of tendsto gives tendsto of product (finitely many factors)\n filter_upwards [ae_all_iff.mpr h_rev] with ω hω\n exact tendsto_finset_prod _ (fun i _ => hω i)\n\n -- Both LHS and RHS converge, and they're equal at each finite level for large m\n -- Therefore their limits are equal\n have h_eq_ae : ∀ᵐ ω ∂μ,\n μ[indProd X r C | tailSigma X] ω\n = (∏ i : Fin r,\n μ[Set.indicator (C i) (fun _ => (1 : ℝ)) ∘ (X 0) | tailSigma X] ω) := by\n -- Combine the three ae sets\n have h_fact_large : ∀ᵐ ω ∂μ, ∀ m ≥ r,\n μ[indProd X r C | futureFiltration X m] ω\n = (∏ i : Fin r,\n μ[Set.indicator (C i) (fun _ => (1 : ℝ)) ∘ (X 0) | futureFiltration X m] ω) := by\n -- Countable intersection of ae sets\n -- For each m ≥ r, we have an ae set where equality holds\n -- Take countable intersection indexed by {m // m ≥ r}\n have h_count_inter : ∀ᵐ ω ∂μ, ∀ m : {m // m ≥ r},\n μ[indProd X r C | futureFiltration X m] ω\n = (∏ i : Fin r,\n μ[Set.indicator (C i) (fun _ => (1 : ℝ)) ∘ (X 0) | futureFiltration X m] ω) := by\n -- Use ae_all_iff for countable intersection\n rw [ae_all_iff]\n intro ⟨m, hm⟩\n exact h_fact m hm\n -- Convert from subtype to ∀ m ≥ r\n filter_upwards [h_count_inter] with ω hω m hm\n exact hω ⟨m, hm⟩\n\n filter_upwards [h_lhs_conv, h_rhs_conv, h_fact_large] with ω hlhs hrhs hfact\n -- At ω, both sequences converge and are eventually equal, so limits are equal\n exact tendsto_nhds_unique hlhs (hrhs.congr' (eventually_atTop.mpr ⟨r, fun m hm => (hfact m hm).symm⟩))\n\n exact h_eq_ae\n","line":351,"end_line":454,"proof_status":"formalized"} | |
| {"id":"lem:condexp_convergence","label":"condexp_convergence","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["lem:pair_law_eq"],"nlp_text":"For \\(k \\le m\\) and measurable \\(B\\): \\(\\mathbb {E}[\\mathbf{1}_{X_m \\in B} \\mid \\mathcal{F}_m] = \\mathbb {E}[\\mathbf{1}_{X_k \\in B} \\mid \\mathcal{F}_m]\\) a.s.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.condexp_convergence","latex_link":"sect0004.html#lem:condexp_convergence","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.condexp_convergence","lean_decl_name":"Exchangeability.DeFinetti.ViaMartingale.condexp_convergence","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaMartingale/CondExpConvergence.lean","lean4_code":"/-- **Conditional expectation convergence:** For k ≤ m, all coordinates look\nthe same when conditioned on the future filtration at level m.\n\nThis is the key convergence result: for k ≤ m and measurable set B,\n```\nP[X_m ∈ B | θ_{m+1} X] = P[X_k ∈ B | θ_{m+1} X]\n```\n\n**Proof:** Uses the CE bridge lemma from CondExp.lean with the measure equality from\ncontractability. The key insight is that deleting coordinates doesn't change the joint distribution\nwith the future, which implies conditional expectation equality by the bridge lemma. -/\nlemma condexp_convergence\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n {X : ℕ → Ω → α} (hX : Contractable μ X)\n (hX_meas : ∀ n, Measurable (X n))\n (k m : ℕ) (hk : k ≤ m)\n (B : Set α) (hB : MeasurableSet B) :\n μ[Set.indicator B (fun _ => (1 : ℝ)) ∘ (X m) | futureFiltration X m]\n =ᵐ[μ]\n μ[Set.indicator B (fun _ => (1 : ℝ)) ∘ (X k) | futureFiltration X m] := by\n -- Use the CE bridge lemma with Y = X m, Y' = X k, Z = shiftRV X (m+1)\n -- The key is that futureFiltration X m = σ(shiftRV X (m+1)) by definition\n\n -- Get the measure equality from contractability\n have hmeas_eq := contractable_dist_eq hX hX_meas k m hk\n\n -- Apply the CE bridge lemma\n have h := Exchangeability.Probability.condexp_indicator_eq_of_pair_law_eq\n (X m) (X k) (shiftRV X (m + 1))\n (hX_meas m) (hX_meas k) (measurable_shiftRV hX_meas)\n hmeas_eq hB\n\n -- Simplify: futureFiltration X m = MeasurableSpace.comap (shiftRV X (m + 1)) inferInstance\n simpa [futureFiltration] using h\n","line":37,"end_line":70,"proof_status":"formalized"} | |
| {"id":"lem:covariance_structure","label":"covariance_structure","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["def:blockAvg_L2","def:contractable"],"nlp_text":"For contractable sequences, the covariance \\(\\mathrm{Cov}(f(X_i), f(X_j))\\) is constant for \\(i \\ne j\\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaL2.contractable_covariance_structure","latex_link":"sect0004.html#lem:covariance_structure","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaL2.contractable_covariance_structure","lean_decl_name":"Exchangeability.DeFinetti.ViaL2.contractable_covariance_structure","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaL2/BlockAverages.lean","lean4_code":"/-- **Uniform covariance structure for contractable L² sequences.**\n\nA contractable sequence X in L²(μ) has uniform second-moment structure:\n- All X_i have the same mean m\n- All X_i have the same variance σ²\n- All distinct pairs (X_i, X_j) have the same covariance σ²·ρ\n- The correlation coefficient satisfies |ρ| ≤ 1\n\nThis is proved using the Cauchy-Schwarz inequality and the fact that contractability\nforces all marginals of the same dimension to have identical distributions. -/\nlemma contractable_covariance_structure\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n (X : ℕ → Ω → ℝ) (hX_contract : Contractable μ X)\n (hX_meas : ∀ i, Measurable (X i))\n (hX_L2 : ∀ i, MemLp (X i) 2 μ) :\n ∃ (m σSq ρ : ℝ),\n (∀ k, ∫ ω, X k ω ∂μ = m) ∧\n (∀ k, ∫ ω, (X k ω - m)^2 ∂μ = σSq) ∧\n (∀ i j, i ≠ j → ∫ ω, (X i ω - m) * (X j ω - m) ∂μ = σSq * ρ) ∧\n 0 ≤ σSq ∧ -1 ≤ ρ ∧ ρ ≤ 1 := by\n -- Strategy: Use contractability to show all marginals of same size have same distribution\n -- This implies all X_i have the same mean and variance, and all pairs have same covariance\n\n -- Define m as the mean of X_0 (all X_i have the same distribution by contractability)\n let m := ∫ ω, X 0 ω ∂μ\n\n -- All X_i have the same mean by contractability (single-variable marginal)\n have hmean : ∀ k, ∫ ω, X k ω ∂μ = m := by\n intro k\n -- Use contractable_single_marginal_eq to show X_k has same distribution as X_0\n have h_eq_dist := contractable_single_marginal_eq (X := X) hX_contract hX_meas k\n -- Transfer integral via equal distributions\n have h_int_k : ∫ ω, X k ω ∂μ = ∫ x, x ∂(Measure.map (X k) μ) := by\n have h_ae : AEStronglyMeasurable (id : ℝ → ℝ) (Measure.map (X k) μ) :=\n aestronglyMeasurable_id\n exact (integral_map (hX_meas k).aemeasurable h_ae).symm\n have h_int_0 : ∫ ω, X 0 ω ∂μ = ∫ x, x ∂(Measure.map (X 0) μ) := by\n have h_ae : AEStronglyMeasurable (id : ℝ → ℝ) (Measure.map (X 0) μ) :=\n aestronglyMeasurable_id\n exact (integral_map (hX_meas 0).aemeasurable h_ae).symm\n rw [h_int_k, h_eq_dist, ← h_int_0]\n\n -- Define σSq as the variance of X_0\n let σSq := ∫ ω, (X 0 ω - m)^2 ∂μ\n\n -- All X_i have the same variance\n have hvar : ∀ k, ∫ ω, (X k ω - m)^2 ∂μ = σSq := by\n intro k\n -- Use equal distribution to transfer the variance integral\n have h_eq_dist := contractable_single_marginal_eq (X := X) hX_contract hX_meas k\n have hmean_k := hmean k\n -- The variance with k's mean equals variance with m (since they're equal)\n show ∫ ω, (X k ω - m)^2 ∂μ = σSq\n -- Transform X_k integral to X_0 integral via measure map\n have h_int_k : ∫ ω, (X k ω - m)^2 ∂μ = ∫ x, (x - m)^2 ∂(Measure.map (X k) μ) := by\n have h_ae : AEStronglyMeasurable (fun x : ℝ => (x - m)^2) (Measure.map (X k) μ) := by\n exact (continuous_id.sub continuous_const).pow 2 |>.aestronglyMeasurable\n exact (integral_map (hX_meas k).aemeasurable h_ae).symm\n have h_int_0 : ∫ ω, (X 0 ω - m)^2 ∂μ = ∫ x, (x - m)^2 ∂(Measure.map (X 0) μ) := by\n have h_ae : AEStronglyMeasurable (fun x : ℝ => (x - m)^2) (Measure.map (X 0) μ) := by\n exact (continuous_id.sub continuous_const).pow 2 |>.aestronglyMeasurable\n exact (integral_map (hX_meas 0).aemeasurable h_ae).symm\n rw [h_int_k, h_eq_dist, ← h_int_0]\n\n -- Define ρ from the covariance of (X_0, X_1)\n have hσSq_nonneg : 0 ≤ σSq := by\n apply integral_nonneg\n intro ω\n exact sq_nonneg _\n\n by_cases hσSq_pos : 0 < σSq\n · -- Case: positive variance\n let ρ := (∫ ω, (X 0 ω - m) * (X 1 ω - m) ∂μ) / σSq\n\n -- All pairs have the same covariance\n have hcov : ∀ i j, i ≠ j → ∫ ω, (X i ω - m) * (X j ω - m) ∂μ = σSq * ρ := by\n intro i j hij\n -- Apply contractability to get equal distributions for pairs\n by_cases h_ord : i < j\n · -- Case i < j: use contractable_map_pair directly\n have h_eq_dist := contractable_map_pair (X := X) hX_contract hX_meas h_ord\n -- Transfer the covariance integral via measure map\n have h_int_ij : ∫ ω, (X i ω - m) * (X j ω - m) ∂μ\n = ∫ p : ℝ × ℝ, (p.1 - m) * (p.2 - m) ∂(Measure.map (fun ω => (X i ω, X j ω)) μ) := by\n have h_ae : AEStronglyMeasurable (fun p : ℝ × ℝ => (p.1 - m) * (p.2 - m))\n (Measure.map (fun ω => (X i ω, X j ω)) μ) := by\n exact ((continuous_fst.sub continuous_const).mul\n (continuous_snd.sub continuous_const)).aestronglyMeasurable\n have h_comp : (fun ω => (X i ω - m) * (X j ω - m))\n = (fun p : ℝ × ℝ => (p.1 - m) * (p.2 - m)) ∘ (fun ω => (X i ω, X j ω)) := rfl\n rw [h_comp]\n exact (integral_map ((hX_meas i).prodMk (hX_meas j)).aemeasurable h_ae).symm\n have h_int_01 : ∫ ω, (X 0 ω - m) * (X 1 ω - m) ∂μ\n = ∫ p : ℝ × ℝ, (p.1 - m) * (p.2 - m) ∂(Measure.map (fun ω => (X 0 ω, X 1 ω)) μ) := by\n have h_ae : AEStronglyMeasurable (fun p : ℝ × ℝ => (p.1 - m) * (p.2 - m))\n (Measure.map (fun ω => (X 0 ω, X 1 ω)) μ) := by\n exact ((continuous_fst.sub continuous_const).mul\n (continuous_snd.sub continuous_const)).aestronglyMeasurable\n have h_comp : (fun ω => (X 0 ω - m) * (X 1 ω - m))\n = (fun p : ℝ × ℝ => (p.1 - m) * (p.2 - m)) ∘ (fun ω => (X 0 ω, X 1 ω)) := rfl\n rw [h_comp]\n exact (integral_map ((hX_meas 0).prodMk (hX_meas 1)).aemeasurable h_ae).symm\n rw [h_int_ij, h_eq_dist, ← h_int_01]\n -- Now need to show: ∫ (X 0 ω - m) * (X 1 ω - m) ∂μ = σSq * ρ\n -- This follows from the definition of ρ\n have hρ_def : ρ = (∫ ω, (X 0 ω - m) * (X 1 ω - m) ∂μ) / σSq := rfl\n rw [hρ_def]\n field_simp [ne_of_gt hσSq_pos]\n · -- Case j < i: use symmetry\n push_neg at h_ord\n have h_ji : j < i := Nat.lt_of_le_of_ne h_ord (Ne.symm hij)\n have h_eq_dist := contractable_map_pair (X := X) hX_contract hX_meas h_ji\n have h_int_ji : ∫ ω, (X j ω - m) * (X i ω - m) ∂μ\n = ∫ p : ℝ × ℝ, (p.1 - m) * (p.2 - m) ∂(Measure.map (fun ω => (X j ω, X i ω)) μ) := by\n have h_ae : AEStronglyMeasurable (fun p : ℝ × ℝ => (p.1 - m) * (p.2 - m))\n (Measure.map (fun ω => (X j ω, X i ω)) μ) := by\n exact ((continuous_fst.sub continuous_const).mul\n (continuous_snd.sub continuous_const)).aestronglyMeasurable\n have h_comp : (fun ω => (X j ω - m) * (X i ω - m))\n = (fun p : ℝ × ℝ => (p.1 - m) * (p.2 - m)) ∘ (fun ω => (X j ω, X i ω)) := rfl\n rw [h_comp]\n exact (integral_map ((hX_meas j).prodMk (hX_meas i)).aemeasurable h_ae).symm\n have h_int_01 : ∫ ω, (X 0 ω - m) * (X 1 ω - m) ∂μ\n = ∫ p : ℝ × ℝ, (p.1 - m) * (p.2 - m) ∂(Measure.map (fun ω => (X 0 ω, X 1 ω)) μ) := by\n have h_ae : AEStronglyMeasurable (fun p : ℝ × ℝ => (p.1 - m) * (p.2 - m))\n (Measure.map (fun ω => (X 0 ω, X 1 ω)) μ) := by\n exact ((continuous_fst.sub continuous_const).mul\n (continuous_snd.sub continuous_const)).aestronglyMeasurable\n have h_comp : (fun ω => (X 0 ω - m) * (X 1 ω - m))\n = (fun p : ℝ × ℝ => (p.1 - m) * (p.2 - m)) ∘ (fun ω => (X 0 ω, X 1 ω)) := rfl\n rw [h_comp]\n exact (integral_map ((hX_meas 0).prodMk (hX_meas 1)).aemeasurable h_ae).symm\n have h_symm : ∫ ω, (X i ω - m) * (X j ω - m) ∂μ = ∫ ω, (X j ω - m) * (X i ω - m) ∂μ := by\n congr 1; ext ω; ring\n rw [h_symm, h_int_ji, h_eq_dist, ← h_int_01]\n -- Now need to show: ∫ (X 0 ω - m) * (X 1 ω - m) ∂μ = σSq * ρ\n -- This follows from the definition of ρ\n have hρ_def : ρ = (∫ ω, (X 0 ω - m) * (X 1 ω - m) ∂μ) / σSq := rfl\n rw [hρ_def]\n field_simp [ne_of_gt hσSq_pos]\n\n -- Bound on ρ from Cauchy-Schwarz\n have hρ_bd : -1 ≤ ρ ∧ ρ ≤ 1 := by\n -- By Cauchy-Schwarz: |E[(X-m)(Y-m)]|² ≤ E[(X-m)²] · E[(Y-m)²]\n -- For X_0, X_1: |Cov|² ≤ σ² · σ² = σ⁴\n -- So |Cov| ≤ σ², and thus |ρ| = |Cov/σ²| ≤ 1\n\n -- The centered variables are in L²\n have hf₀ : MemLp (fun ω => X 0 ω - m) 2 μ := (hX_L2 0).sub (memLp_const m)\n have hf₁ : MemLp (fun ω => X 1 ω - m) 2 μ := (hX_L2 1).sub (memLp_const m)\n\n -- Their product is integrable\n have h_int : Integrable (fun ω => (X 0 ω - m) * (X 1 ω - m)) μ := hf₀.integrable_mul hf₁\n\n -- Apply Cauchy-Schwarz: |∫ f·g| ≤ √(∫ f²) · √(∫ g²)\n have h_cs : |∫ ω, (X 0 ω - m) * (X 1 ω - m) ∂μ|\n ≤ Real.sqrt (∫ ω, (X 0 ω - m)^2 ∂μ) * Real.sqrt (∫ ω, (X 1 ω - m)^2 ∂μ) := by\n -- Apply Hölder's inequality directly to the integrand\n have h_tri : |∫ ω, (X 0 ω - m) * (X 1 ω - m) ∂μ| ≤ ∫ ω, |(X 0 ω - m) * (X 1 ω - m)| ∂μ :=\n MeasureTheory.norm_integral_le_integral_norm (fun ω => (X 0 ω - m) * (X 1 ω - m))\n have h_abs_mul : ∫ ω, |(X 0 ω - m) * (X 1 ω - m)| ∂μ = ∫ ω, |X 0 ω - m| * |X 1 ω - m| ∂μ := by\n congr 1\n funext ω\n exact abs_mul (X 0 ω - m) (X 1 ω - m)\n have h_holder : ∫ ω, |X 0 ω - m| * |X 1 ω - m| ∂μ\n ≤ (∫ ω, |X 0 ω - m| ^ 2 ∂μ) ^ (1/2 : ℝ) * (∫ ω, |X 1 ω - m| ^ 2 ∂μ) ^ (1/2 : ℝ) := by\n have h_nonneg₀ : ∀ᵐ ω ∂μ, 0 ≤ |X 0 ω - m| := ae_of_all μ (fun ω => abs_nonneg _)\n have h_nonneg₁ : ∀ᵐ ω ∂μ, 0 ≤ |X 1 ω - m| := ae_of_all μ (fun ω => abs_nonneg _)\n have h_key : ∫ ω, |X 0 ω - m| * |X 1 ω - m| ∂μ\n ≤ (∫ ω, |X 0 ω - m| ^ (2:ℝ) ∂μ) ^ ((2:ℝ)⁻¹) * (∫ ω, |X 1 ω - m| ^ (2:ℝ) ∂μ) ^ ((2:ℝ)⁻¹) := by\n have hpq : (2:ℝ).HolderConjugate 2 := by\n constructor\n · norm_num\n · norm_num\n · norm_num\n have hf₀' : MemLp (fun ω => |X 0 ω - m|) (ENNReal.ofReal 2) μ := by\n have h2 : (ENNReal.ofReal 2 : ENNReal) = (2 : ENNReal) := by norm_num\n rw [h2]\n have : MemLp (fun ω => ‖X 0 ω - m‖) 2 μ := hf₀.norm\n have h_eq : (fun ω => ‖X 0 ω - m‖) =ᵐ[μ] (fun ω => |X 0 ω - m|) := by\n filter_upwards with ω\n exact Real.norm_eq_abs _\n exact MemLp.ae_eq h_eq this\n have hf₁' : MemLp (fun ω => |X 1 ω - m|) (ENNReal.ofReal 2) μ := by\n have h2 : (ENNReal.ofReal 2 : ENNReal) = (2 : ENNReal) := by norm_num\n rw [h2]\n have : MemLp (fun ω => ‖X 1 ω - m‖) 2 μ := hf₁.norm\n have h_eq : (fun ω => ‖X 1 ω - m‖) =ᵐ[μ] (fun ω => |X 1 ω - m|) := by\n filter_upwards with ω\n exact Real.norm_eq_abs _\n exact MemLp.ae_eq h_eq this\n have := MeasureTheory.integral_mul_le_Lp_mul_Lq_of_nonneg hpq h_nonneg₀ h_nonneg₁ hf₀' hf₁'\n convert this using 2 <;> norm_num\n convert h_key using 2\n · norm_num\n · norm_num\n have h_sqrt_conv : (∫ ω, |X 0 ω - m| ^ 2 ∂μ) ^ (1/2 : ℝ) * (∫ ω, |X 1 ω - m| ^ 2 ∂μ) ^ (1/2 : ℝ)\n = Real.sqrt (∫ ω, (X 0 ω - m)^2 ∂μ) * Real.sqrt (∫ ω, (X 1 ω - m)^2 ∂μ) := by\n have h4 : (∫ ω, |X 0 ω - m| ^ 2 ∂μ) ^ (1/2 : ℝ) = Real.sqrt (∫ ω, (X 0 ω - m)^2 ∂μ) := by\n rw [Real.sqrt_eq_rpow]\n congr 1\n congr 1\n funext ω\n rw [sq_abs]\n have h5 : (∫ ω, |X 1 ω - m| ^ 2 ∂μ) ^ (1/2 : ℝ) = Real.sqrt (∫ ω, (X 1 ω - m)^2 ∂μ) := by\n rw [Real.sqrt_eq_rpow]\n congr 1\n congr 1\n funext ω\n rw [sq_abs]\n rw [h4, h5]\n calc |∫ ω, (X 0 ω - m) * (X 1 ω - m) ∂μ|\n ≤ ∫ ω, |(X 0 ω - m) * (X 1 ω - m)| ∂μ := h_tri\n _ = ∫ ω, |X 0 ω - m| * |X 1 ω - m| ∂μ := h_abs_mul\n _ ≤ (∫ ω, |X 0 ω - m| ^ 2 ∂μ) ^ (1/2 : ℝ) * (∫ ω, |X 1 ω - m| ^ 2 ∂μ) ^ (1/2 : ℝ) := h_holder\n _ = Real.sqrt (∫ ω, (X 0 ω - m)^2 ∂μ) * Real.sqrt (∫ ω, (X 1 ω - m)^2 ∂μ) := h_sqrt_conv\n\n -- Substitute the variances\n rw [hvar 0, hvar 1] at h_cs\n have h_sqrt_sq : Real.sqrt σSq * Real.sqrt σSq = σSq := by\n have : σSq * σSq = σSq ^ 2 := (sq σSq).symm\n rw [← Real.sqrt_mul hσSq_nonneg, this, Real.sqrt_sq hσSq_nonneg]\n rw [h_sqrt_sq] at h_cs\n\n -- The covariance equals σSq * ρ by definition\n have h_cov_eq : ∫ ω, (X 0 ω - m) * (X 1 ω - m) ∂μ = σSq * ρ := by\n have : ρ = (∫ ω, (X 0 ω - m) * (X 1 ω - m) ∂μ) / σSq := rfl\n rw [this]; field_simp [ne_of_gt hσSq_pos]\n rw [h_cov_eq] at h_cs\n\n -- Now |σSq * ρ| ≤ σSq\n rw [abs_mul, abs_of_pos hσSq_pos, mul_comm] at h_cs\n have h_ρ_bd : |ρ| * σSq ≤ σSq := h_cs\n have : |ρ| ≤ 1 := (mul_le_iff_le_one_left hσSq_pos).mp h_ρ_bd\n exact abs_le.mp this\n\n exact ⟨m, σSq, ρ, hmean, hvar, hcov, hσSq_nonneg, hρ_bd⟩\n\n · -- Case: zero variance (all X_i are constant a.s.)\n push_neg at hσSq_pos\n have hσSq_zero : σSq = 0 := le_antisymm hσSq_pos hσSq_nonneg\n\n -- When variance is 0, all X_i = m almost surely\n have hX_const : ∀ i, ∀ᵐ ω ∂μ, X i ω = m := by\n intro i\n -- Use the fact that variance of X_i is 0\n have h_var_i : ∫ ω, (X i ω - m)^2 ∂μ = 0 := by\n rw [hvar i, hσSq_zero]\n -- When ∫ f² = 0 for a nonnegative function, f = 0 a.e.\n have h_ae_zero : ∀ᵐ ω ∂μ, (X i ω - m)^2 = 0 := by\n have h_nonneg : ∀ ω, 0 ≤ (X i ω - m)^2 := fun ω => sq_nonneg _\n have h_integrable : Integrable (fun ω => (X i ω - m)^2) μ := by\n have : MemLp (fun ω => X i ω - m) 2 μ := (hX_L2 i).sub (memLp_const m)\n exact this.integrable_sq\n exact integral_eq_zero_iff_of_nonneg_ae (ae_of_all _ h_nonneg) h_integrable |>.mp h_var_i\n -- Square equals zero iff the value equals zero\n filter_upwards [h_ae_zero] with ω h\n exact sub_eq_zero.mp (sq_eq_zero_iff.mp h)\n\n -- Covariance is 0\n have hcov : ∀ i j, i ≠ j → ∫ ω, (X i ω - m) * (X j ω - m) ∂μ = 0 := by\n intro i j _\n -- Use the fact that X_i = m and X_j = m almost everywhere\n have h_ae_prod : ∀ᵐ ω ∂μ, (X i ω - m) * (X j ω - m) = 0 := by\n filter_upwards [hX_const i, hX_const j] with ω hi hj\n rw [hi, hj]\n ring\n -- Integral of a.e. zero function is zero\n have h_integrable : Integrable (fun ω => (X i ω - m) * (X j ω - m)) μ := by\n have h_i : MemLp (fun ω => X i ω - m) 2 μ := (hX_L2 i).sub (memLp_const m)\n have h_j : MemLp (fun ω => X j ω - m) 2 μ := (hX_L2 j).sub (memLp_const m)\n exact h_i.integrable_mul h_j\n exact integral_eq_zero_of_ae h_ae_prod\n\n -- ρ = 0 works\n use m, σSq, 0\n refine ⟨hmean, hvar, ?_, hσSq_nonneg, ?_⟩\n · intro i j hij\n rw [hcov i j hij, hσSq_zero]\n ring\n · norm_num\n","line":101,"end_line":381,"proof_status":"formalized"} | |
| {"id":"lem:l2_bound_windows","label":"l2_bound_windows","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["lem:covariance_structure"],"nlp_text":"The L\\(^2\\) norm of the difference between averages over disjoint windows is bounded.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaL2.l2_bound_two_windows","latex_link":"sect0004.html#lem:l2_bound_windows","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaL2.l2_bound_two_windows","lean_decl_name":"Exchangeability.DeFinetti.ViaL2.l2_bound_two_windows","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaL2/BlockAverages.lean","lean4_code":"/-- **L² bound wrapper for two starting windows**.\n\nFor contractable sequences, the L² difference between averages starting at different\nindices n and m is uniformly small. This gives us the key uniform bound we need.\n\nNOTE: This wrapper is not used in the main proof. The uniform version with disjointness\nhypothesis is used instead. This wrapper is left for potential future use.\n-/\n@[nolint unusedArguments]\nlemma l2_bound_two_windows\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n (X : ℕ → Ω → ℝ) (hX_contract : Contractable μ X)\n (hX_meas : ∀ i, Measurable (X i))\n (hX_L2 : ∀ i, MemLp (X i) 2 μ)\n (f : ℝ → ℝ) (hf_meas : Measurable f)\n (hf_bdd : ∃ M, ∀ x, |f x| ≤ M)\n (n m : ℕ) {k : ℕ} (hk : 0 < k)\n (_hdisj : Disjoint (window n k) (window m k)) :\n ∃ Cf : ℝ, 0 ≤ Cf ∧\n ∫ ω, ((1/(k:ℝ)) * ∑ i : Fin k, f (X (n + i.val + 1) ω) -\n (1/(k:ℝ)) * ∑ i : Fin k, f (X (m + i.val + 1) ω))^2 ∂μ\n ≤ Cf / k := by\n -- Get covariance constant and structure\n obtain ⟨Cf, mf, σSqf, ρf, hCf_def, hCf_nonneg, hmean, hvar, hcov, hσSq_nn, hρ_bd1, hρ_bd2⟩ :=\n get_covariance_constant X hX_contract hX_meas hX_L2 f hf_meas hf_bdd\n -- Apply uniform bound with the covariance structure\n refine ⟨Cf, hCf_nonneg, ?_⟩\n exact l2_bound_two_windows_uniform X hX_contract hX_meas hX_L2 f hf_meas hf_bdd\n Cf mf σSqf ρf hCf_def hCf_nonneg hmean hvar hcov hσSq_nn ⟨hρ_bd1, hρ_bd2⟩ n m k hk\n","line":948,"end_line":976,"proof_status":"formalized"} | |
| {"id":"lem:l2_bound","label":"l2_bound","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["lem:l2_bound_windows"],"nlp_text":"For contractable sequences, certain L\\(^2\\) norms of block averages are bounded.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.L2Approach.l2_contractability_bound","latex_link":"sect0004.html#lem:l2_bound","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.L2Approach.l2_contractability_bound","lean_decl_name":"Exchangeability.DeFinetti.L2Approach.l2_contractability_bound","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/L2Helpers.lean","lean4_code":"@[nolint unusedArguments]\ntheorem l2_contractability_bound\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n {n : ℕ} (ξ : Fin n → Ω → ℝ)\n (m : ℝ) (σ ρ : ℝ)\n (_hρ_bd : -1 ≤ ρ ∧ ρ ≤ 1)\n (_hmean : ∀ k, ∫ ω, ξ k ω ∂μ = m)\n (_hL2 : ∀ k, MemLp (fun ω => ξ k ω - m) 2 μ)\n (_hvar : ∀ k, ∫ ω, (ξ k ω - m)^2 ∂μ = σ ^ 2)\n (_hcov : ∀ i j, i ≠ j → ∫ ω, (ξ i ω - m) * (ξ j ω - m) ∂μ = σ ^ 2 * ρ)\n (p q : Fin n → ℝ)\n (_hp_prob : (∑ i, p i) = 1 ∧ ∀ i, 0 ≤ p i)\n (_hq_prob : (∑ i, q i) = 1 ∧ ∀ i, 0 ≤ q i) :\n ∫ ω, (∑ i, p i * ξ i ω - ∑ i, q i * ξ i ω)^2 ∂μ ≤\n 2 * σ ^ 2 * (1 - ρ) * (⨆ i, |p i - q i|) := by\n -- Proof following Kallenberg page 26, Lemma 1.2 exactly\n classical\n let c : Fin n → ℝ := fun i => p i - q i\n set σSq : ℝ := σ ^ 2\n\n -- Preliminary facts about c = p - q\n have hc_sum : ∑ j, c j = 0 := by\n simp only [c, Finset.sum_sub_distrib, _hp_prob.1, _hq_prob.1]; ring\n have hc_abs_sum : ∑ j, |c j| ≤ 2 :=\n prob_dist_diff_abs_sum_le_two p q _hp_prob _hq_prob\n\n -- Step 1: E(∑cᵢξᵢ)² = E(∑cᵢ(ξᵢ-m))² using ∑cⱼ = 0\n have step1 : ∫ ω, (∑ i, c i * ξ i ω)^2 ∂μ =\n ∫ ω, (∑ i, c i * (ξ i ω - m))^2 ∂μ :=\n integral_sq_weighted_sum_eq_centered ξ c m hc_sum\n\n -- Step 2: = ∑ᵢⱼ cᵢcⱼ cov(ξᵢ, ξⱼ) by expanding square and linearity\n have h_integrable :\n ∀ i j, Integrable (fun ω => (ξ i ω - m) * (ξ j ω - m)) μ := fun i j => by\n classical\n have h_mul : MemLp (fun ω => (ξ i ω - m) * (ξ j ω - m)) 1 μ :=\n (MemLp.mul' (hf := _hL2 j) (hφ := _hL2 i) : _)\n simpa [memLp_one_iff_integrable] using h_mul\n have step2 : ∫ ω, (∑ i, c i * (ξ i ω - m))^2 ∂μ =\n ∑ i, ∑ j, c i * c j * ∫ ω, (ξ i ω - m) * (ξ j ω - m) ∂μ :=\n integral_sq_weighted_sum_eq_double_sum (fun i => fun ω => ξ i ω - m) c h_integrable\n\n -- Step 3: = σ²ρ(∑cᵢ)² + σ²(1-ρ)∑cᵢ² by separating i=j from i≠j\n have step3 : ∑ i, ∑ j, c i * c j * ∫ ω, (ξ i ω - m) * (ξ j ω - m) ∂μ =\n σSq * ρ * (∑ i, c i)^2 + σSq * (1 - ρ) * ∑ i, (c i)^2 := by\n have hvar : ∀ k, ∫ ω, (ξ k ω - m)^2 ∂μ = σSq := fun k => _hvar k\n have hcov :\n ∀ i j, i ≠ j → ∫ ω, (ξ i ω - m) * (ξ j ω - m) ∂μ = σSq * ρ :=\n fun i j hij => _hcov i j hij\n trans (∑ i, ∑ j, c i * c j * (if i = j then σSq else σSq * ρ))\n · congr 1; ext i; congr 1; ext j\n split_ifs with h\n · subst h\n have h_sq :\n (fun ω => (ξ i ω - m) * (ξ i ω - m)) = (fun ω => (ξ i ω - m)^2) := by\n funext ω; ring\n rw [h_sq]; exact congr_arg (c i * c i * ·) (hvar i)\n · exact congr_arg (c i * c j * ·) (hcov i j h)\n · exact double_sum_covariance_formula σSq ρ σSq (σSq * ρ) rfl rfl\n\n -- Step 4: = σ²(1-ρ)∑cᵢ² since (∑cᵢ)² = 0\n have step4 : σSq * ρ * (∑ i, c i)^2 + σSq * (1 - ρ) * ∑ i, (c i)^2 =\n σSq * (1 - ρ) * ∑ i, (c i)^2 :=\n covariance_formula_zero_sum σSq ρ hc_sum\n\n -- Steps 5-6: Combine inequalities to get final bound\n have step5 : ∑ i, (c i)^2 ≤ ∑ i, |c i| * (⨆ j, |c j|) :=\n sum_sq_le_sum_abs_mul_sup\n\n calc ∫ ω, (∑ i, p i * ξ i ω - ∑ i, q i * ξ i ω)^2 ∂μ\n = ∫ ω, (∑ i, c i * ξ i ω)^2 ∂μ := by\n congr 1; ext ω; congr 1\n conv_lhs => rw [← Finset.sum_sub_distrib]\n simp only [c]; congr 1; ext i; ring\n _ = ∫ ω, (∑ i, c i * (ξ i ω - m))^2 ∂μ := step1\n _ = ∑ i, ∑ j, c i * c j * ∫ ω, (ξ i ω - m) * (ξ j ω - m) ∂μ := step2\n _ = σSq * ρ * (∑ i, c i)^2 + σSq * (1 - ρ) * ∑ i, (c i)^2 := step3\n _ = σSq * (1 - ρ) * ∑ i, (c i)^2 := step4\n _ ≤ 2 * σSq * (1 - ρ) * (⨆ i, |p i - q i|) :=\n l2_bound_from_steps σSq ρ (sq_nonneg σ) _hρ_bd.2 rfl hc_abs_sum step5\n _ = 2 * σ ^ 2 * (1 - ρ) * (⨆ i, |p i - q i|) := by\n simp [σSq, pow_two, mul_comm, mul_left_comm, mul_assoc]\n","line":851,"end_line":932,"proof_status":"formalized"} | |
| {"id":"lem:kallenberg_L2_bound","label":"kallenberg_L2_bound","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["lem:l2_bound"],"nlp_text":"The key L\\(^2\\) bound that drives the Cesaro convergence.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaL2.kallenberg_L2_bound","latex_link":"sect0004.html#lem:kallenberg_L2_bound","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaL2.kallenberg_L2_bound","lean_decl_name":"Exchangeability.DeFinetti.ViaL2.kallenberg_L2_bound","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaL2/CesaroConvergence.lean","lean4_code":"/-- **Kallenberg's L² bound (Lemma 1.2)** - Core of the elementary proof.\n\nFor an exchangeable sequence and centered variables Z_i := f(X_i) - E[f(X_1)],\nthe L² distance between any two weighted averages satisfies:\n\n ‖∑ p_i Z_i - ∑ q_i Z_i‖²_L² ≤ C_f · sup_i |p_i - q_i|\n\nwhere C_f := E[(Z_1 - Z_2)²].\n\n**Key application:** For uniform block averages of length n,\n ‖A_{m,n} - A_{m',n}‖_L² ≤ √(C_f/n)\n\nmaking the family {A_{m,n}}_m Cauchy in L² as n→∞.\n\n**Proof:** Pure algebra + exchangeability:\n1. Expand ‖∑ c_i Z_i‖² = ∑ c_i² E[Z_i²] + ∑_{i≠j} c_i c_j E[Z_i Z_j]\n2. By exchangeability: E[Z_i²] = E[Z_1²], E[Z_i Z_j] = E[Z_1 Z_2] for i≠j\n3. For c_i = p_i - q_i (differences of probability weights): ∑ c_i = 0\n4. Algebraic bound: ∑ c_i² ≤ (∑|c_i|) · sup|c_i| ≤ 2 · sup|c_i|\n5. Substitute and simplify to get the bound\n\nThis is **exactly** Kallenberg's Lemma 1.2. No ergodic theory needed!\n\n## Why this proof uses `l2_contractability_bound` instead of `kallenberg_L2_bound`\n\n**The Circularity Problem:**\n\nThe de Finetti theorem we're proving establishes: **Contractable ↔ Exchangeable**\n\n- `contractable_of_exchangeable` (✓ proved in Contractability.lean): Exchangeable → Contractable\n- `cesaro_to_condexp_L2` (this file): Contractable → Exchangeable (via conditionally i.i.d.)\n\nSince we're trying to prove Contractable → Exchangeable, we **cannot assume exchangeability**\nin this proof - that would be circular!\n\n**Why `kallenberg_L2_bound` requires exchangeability:**\n\n`kallenberg_L2_bound` needs `Exchangeable μ Z` to establish uniform second moments:\n- E[Z_i²] = E[Z_0²] for all i (uniform variance)\n- E[Z_i Z_j] = E[Z_0 Z_1] for all i≠j (uniform pairwise covariance)\n\nExchangeability gives this via permutation invariance: swapping indices doesn't change the distribution.\n\n**Why contractability is insufficient for `kallenberg_L2_bound`:**\n\nContractability only tells us about *increasing* subsequences:\n- For any increasing k : Fin m → ℕ, the subsequence (Z_{k(0)}, ..., Z_{k(m-1)}) has the\n same distribution as (Z_0, ..., Z_{m-1})\n\nThis is weaker than exchangeability:\n- ✓ We know (Z_0, Z_1) has same distribution as (Z_1, Z_2), (Z_2, Z_3), etc.\n- ✗ We DON'T know (Z_0, Z_1) has same distribution as (Z_1, Z_0) - contractability doesn't\n give permutation invariance!\n\n**However: contractability DOES give uniform covariance!**\n\nEven though contractability ≠ exchangeability, contractability is *sufficient* for:\n- E[Z_i²] = E[Z_0²] for all i (from the increasing subsequence {i})\n- E[Z_i Z_j] = E[Z_0 Z_1] for all i<j (from the increasing subsequence {i,j})\n\nThis is exactly the covariance structure needed by `l2_contractability_bound` from\nL2Helpers.lean, which doesn't assume full exchangeability.\n\n**Note:** By the end of this proof, we'll have shown Contractable → Exchangeable, so\ncontractable sequences ARE exchangeable. But we can't use that equivalence while\nproving it - that would be begging the question!\n\n-/\n\nlemma kallenberg_L2_bound\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n (Z : ℕ → Ω → ℝ) (hZ_exch : Exchangeable μ Z) (hZ_meas : ∀ i, Measurable (Z i))\n (p q : ℕ → ℝ) (s : Finset ℕ) (hs : s.Nonempty)\n (hp_prob : (s.sum p = 1) ∧ (∀ i ∈ s, 0 ≤ p i))\n (hq_prob : (s.sum q = 1) ∧ (∀ i ∈ s, 0 ≤ q i))\n (hZ_L2 : ∀ i ∈ s, MemLp (Z i) 2 μ) :\n ∫ ω, ((s.sum fun i => (p i - q i) * Z i ω) ^ 2) ∂μ\n ≤ (∫ ω, (Z 0 ω - Z 1 ω)^2 ∂μ) * (s.sup' hs (fun i => |(p i - q i)|)) := by\n -- Kallenberg Lemma 1.2: Pure algebraic proof using exchangeability\n -- NOTE: This lemma requires Exchangeable, but cesaro_to_condexp_L2 uses\n -- l2_contractability_bound instead (see comment above)\n\n -- Notation: c_i := p_i - q_i (differences of probability weights)\n let c := fun i => p i - q i\n\n -- Key fact: ∑ c_i = 0 (since both p and q sum to 1)\n have hc_sum_zero : s.sum c = 0 := by\n simp only [c, Finset.sum_sub_distrib, hp_prob.1, hq_prob.1]\n norm_num\n\n -- Step 1: Expand E[(∑ c_i Z_i)²]\n -- E[(∑ c_i Z_i)²] = ∑ c_i² E[Z_i²] + ∑_{i≠j} c_i c_j E[Z_i Z_j]\n\n -- Step 2: Use exchangeability to identify second moments\n -- By exchangeability: E[Z_i²] = E[Z_0²] and E[Z_i Z_j] = E[Z_0 Z_1] for i≠j\n\n -- Step 3: Algebraic simplification using ∑ c_i = 0\n -- ∑_{i≠j} c_i c_j = (∑ c_i)² - ∑ c_i² = -∑ c_i²\n\n -- Step 4: Bound ∑ c_i² ≤ (∑|c_i|) · sup|c_i| ≤ 2 · sup|c_i|\n\n -- Step 5: Combine to get final bound\n -- E[(∑ c_i Z_i)²] ≤ C_f · sup|c_i| where C_f = E[(Z_0 - Z_1)²]\n\n -- Use the complete proof from L2Helpers.l2_contractability_bound\n -- Strategy: Reindex to Fin s.card, apply the theorem, then reindex back\n\n classical\n\n -- Step 1: Reindex from Finset ℕ to Fin s.card\n let n := s.card\n\n -- Get an order isomorphism between s and Fin n\n -- enum : Fin n ≃o { x // x ∈ s }\n let enum := s.orderIsoOfFin rfl\n\n -- Define the reindexed functions (extract .val from subtype)\n let ξ : Fin n → Ω → ℝ := fun i ω => Z (enum i).val ω\n let p' : Fin n → ℝ := fun i => p (enum i).val\n let q' : Fin n → ℝ := fun i => q (enum i).val\n\n -- Step 2: Compute mean, variance, and correlation from exchangeability\n let m := ∫ ω, Z 0 ω ∂μ\n let σSq := ∫ ω, (Z 0 ω - m)^2 ∂μ\n let covOffDiag := ∫ ω, (Z 0 ω - m) * (Z 1 ω - m) ∂μ\n let ρ := if σSq = 0 then 0 else covOffDiag / σSq\n\n -- Step 3: Prove hypotheses for l2_contractability_bound\n\n -- Convert Exchangeable to Contractable\n have hZ_contract : Contractable μ Z := contractable_of_exchangeable hZ_exch hZ_meas\n\n -- Prove σSq ≥ 0 (variance is always non-negative) - needed for ρ bounds\n have hσSq_nonneg : 0 ≤ σSq := by\n simp only [σSq]\n apply integral_nonneg\n intro ω\n positivity\n\n -- Prove ρ bounds (correlation coefficient is always in [-1, 1])\n have hρ_bd : -1 ≤ ρ ∧ ρ ≤ 1 := by\n simp only [ρ]\n by_cases h : σSq = 0\n · -- If σSq = 0, then ρ = 0, so bounds hold trivially\n simp [h]\n · -- If σSq ≠ 0, use Cauchy-Schwarz to show |covOffDiag / σSq| ≤ 1\n simp [h]\n -- Need to show: -1 ≤ covOffDiag / σSq ≤ 1\n -- Equivalent to: |covOffDiag| ≤ σSq (since σSq > 0)\n\n have hσSq_pos : 0 < σSq := by\n cases (hσSq_nonneg.lt_or_eq) with\n | inl h_lt => exact h_lt\n | inr h_eq => exact (h h_eq.symm).elim\n\n -- Apply Cauchy-Schwarz: |∫ f·g| ≤ (∫ f²)^(1/2) · (∫ g²)^(1/2)\n have h_cs : |covOffDiag| ≤ σSq := by\n simp only [covOffDiag, σSq]\n\n -- First establish Z 0, Z 1 ∈ L² using contractability\n obtain ⟨k, hk⟩ := hs.exists_mem\n have hZk_L2 : MemLp (Z k) 2 μ := hZ_L2 k hk\n\n have hZ0_L2 : MemLp (Z 0) 2 μ := by\n by_cases h : k = 0\n · subst h; exact hZk_L2\n · -- Use contractable_map_single to show Z k and Z 0 have same distribution\n -- Then transfer MemLp via equal eLpNorm\n have h_dist := Exchangeability.DeFinetti.L2Helpers.contractable_map_single\n (X := Z) hZ_contract hZ_meas (i := k)\n -- h_dist : Measure.map (Z k) μ = Measure.map (Z 0) μ\n -- Transfer eLpNorm: show eLpNorm (Z 0) 2 μ = eLpNorm (Z k) 2 μ\n have h_Lpnorm_eq : eLpNorm (Z 0) 2 μ = eLpNorm (Z k) 2 μ := by\n symm\n calc eLpNorm (Z k) 2 μ\n = eLpNorm id 2 (Measure.map (Z k) μ) := by\n symm\n exact eLpNorm_map_measure aestronglyMeasurable_id (hZ_meas k).aemeasurable\n _ = eLpNorm id 2 (Measure.map (Z 0) μ) := by rw [h_dist]\n _ = eLpNorm (Z 0) 2 μ := by\n exact eLpNorm_map_measure aestronglyMeasurable_id (hZ_meas 0).aemeasurable\n -- Now transfer MemLp using equal eLpNorm\n have : eLpNorm (Z 0) 2 μ < ⊤ := by\n rw [h_Lpnorm_eq]\n exact hZk_L2.eLpNorm_lt_top\n exact ⟨(hZ_meas 0).aestronglyMeasurable, this⟩\n have hZ1_L2 : MemLp (Z 1) 2 μ := by\n by_cases h : k = 1\n · subst h; exact hZk_L2\n · -- Use contractable_map_single to show Z k and Z 1 have same distribution\n -- Then transfer MemLp via equal eLpNorm\n have h_dist := Exchangeability.DeFinetti.L2Helpers.contractable_map_single\n (X := Z) hZ_contract hZ_meas (i := k)\n -- h_dist : Measure.map (Z k) μ = Measure.map (Z 0) μ\n have h_dist1 := Exchangeability.DeFinetti.L2Helpers.contractable_map_single\n (X := Z) hZ_contract hZ_meas (i := 1)\n -- h_dist1 : Measure.map (Z 1) μ = Measure.map (Z 0) μ\n -- Transfer eLpNorm: show eLpNorm (Z 1) 2 μ = eLpNorm (Z k) 2 μ\n have h_Lpnorm_eq : eLpNorm (Z 1) 2 μ = eLpNorm (Z k) 2 μ := by\n calc eLpNorm (Z 1) 2 μ\n = eLpNorm id 2 (Measure.map (Z 1) μ) := by\n symm\n exact eLpNorm_map_measure aestronglyMeasurable_id (hZ_meas 1).aemeasurable\n _ = eLpNorm id 2 (Measure.map (Z 0) μ) := by rw [h_dist1]\n _ = eLpNorm id 2 (Measure.map (Z k) μ) := by rw [← h_dist]\n _ = eLpNorm (Z k) 2 μ := by\n exact eLpNorm_map_measure aestronglyMeasurable_id (hZ_meas k).aemeasurable\n -- Now transfer MemLp using equal eLpNorm\n have : eLpNorm (Z 1) 2 μ < ⊤ := by\n rw [h_Lpnorm_eq]\n exact hZk_L2.eLpNorm_lt_top\n exact ⟨(hZ_meas 1).aestronglyMeasurable, this⟩\n\n -- Now Z i - m ∈ L² for i = 0, 1\n have hm : MemLp (fun _ : Ω => m) 2 μ := memLp_const m\n have hf : MemLp (fun ω => Z 0 ω - m) 2 μ := MemLp.sub hZ0_L2 hm\n have hg : MemLp (fun ω => Z 1 ω - m) 2 μ := MemLp.sub hZ1_L2 hm\n\n -- Apply Cauchy-Schwarz\n calc |∫ ω, (Z 0 ω - m) * (Z 1 ω - m) ∂μ|\n ≤ (∫ ω, (Z 0 ω - m) ^ 2 ∂μ) ^ (1/2 : ℝ) * (∫ ω, (Z 1 ω - m) ^ 2 ∂μ) ^ (1/2 : ℝ) := by\n exact Exchangeability.Probability.IntegrationHelpers.abs_integral_mul_le_L2 hf hg\n _ = (∫ ω, (Z 0 ω - m) ^ 2 ∂μ) ^ (1/2 : ℝ) * (∫ ω, (Z 0 ω - m) ^ 2 ∂μ) ^ (1/2 : ℝ) := by\n -- Use equal distributions: Z 1 has same variance as Z 0\n congr 1\n -- Use contractability: Z 1 has same distribution as Z 0\n have h_dist := Exchangeability.DeFinetti.L2Helpers.contractable_map_single\n (X := Z) hZ_contract hZ_meas (i := 1)\n rw [← Exchangeability.Probability.IntegrationHelpers.integral_pushforward_sq_diff (hZ_meas 1) m,\n h_dist,\n Exchangeability.Probability.IntegrationHelpers.integral_pushforward_sq_diff (hZ_meas 0) m]\n _ = ∫ ω, (Z 0 ω - m) ^ 2 ∂μ := by\n have h_nonneg : 0 ≤ ∫ ω, (Z 0 ω - m) ^ 2 ∂μ := integral_nonneg (fun ω => by positivity)\n rw [← Real.sqrt_eq_rpow]\n exact Real.mul_self_sqrt h_nonneg\n\n -- From |covOffDiag| ≤ σSq and σSq > 0, derive -1 ≤ ρ ≤ 1\n constructor\n · -- Lower bound: -1 ≤ covOffDiag / σSq\n have : -σSq ≤ covOffDiag := by\n have h_neg : -|covOffDiag| ≤ covOffDiag := neg_abs_le _\n linarith [h_cs]\n calc -1 = -σSq / σSq := by field_simp\n _ ≤ covOffDiag / σSq := by apply div_le_div_of_nonneg_right; linarith; exact le_of_lt hσSq_pos\n · -- Upper bound: covOffDiag / σSq ≤ 1\n have : covOffDiag ≤ σSq := le_of_abs_le h_cs\n calc covOffDiag / σSq ≤ σSq / σSq := by apply div_le_div_of_nonneg_right; exact this; exact le_of_lt hσSq_pos\n _ = 1 := by field_simp\n\n -- Prove all marginals have the same mean m\n have hmean : ∀ k : Fin n, ∫ ω, ξ k ω ∂μ = m := by\n intro k\n -- ξ k = Z (enum k).val, and all Z i have the same distribution by contractability\n have h_same_dist := Exchangeability.DeFinetti.L2Helpers.contractable_map_single\n (X := Z) hZ_contract hZ_meas (i := (enum k).val)\n -- Equal distributions → equal integrals\n simp only [ξ, m]\n rw [← Exchangeability.Probability.IntegrationHelpers.integral_pushforward_id (hZ_meas _),\n h_same_dist,\n Exchangeability.Probability.IntegrationHelpers.integral_pushforward_id (hZ_meas _)]\n\n -- Prove all ξ k - m are in L²\n have hL2 : ∀ k : Fin n, MemLp (fun ω => ξ k ω - m) 2 μ := by\n intro k\n -- This follows from ξ k = Z (enum k).val and hZ_L2\n -- enum k has type { x // x ∈ s }, so (enum k).val ∈ s by (enum k).property\n have hk_in_s : (enum k).val ∈ s := (enum k).property\n have hZ_k_L2_orig := hZ_L2 (enum k).val hk_in_s\n -- ξ k ω - m = Z (enum k).val ω - m, so same MemLp\n convert hZ_k_L2_orig.sub (memLp_const m) using 1\n\n -- Prove all variances equal σ²\n have hvar : ∀ k : Fin n, ∫ ω, (ξ k ω - m)^2 ∂μ = σSq := by\n intro k\n -- Same distribution → same variance\n have h_same_dist := Exchangeability.DeFinetti.L2Helpers.contractable_map_single\n (X := Z) hZ_contract hZ_meas (i := (enum k).val)\n simp only [ξ, σSq]\n -- Use integral_pushforward_sq_diff\n rw [← Exchangeability.Probability.IntegrationHelpers.integral_pushforward_sq_diff (hZ_meas _) m,\n h_same_dist,\n Exchangeability.Probability.IntegrationHelpers.integral_pushforward_sq_diff (hZ_meas _) m]\n\n -- Prove all covariances equal σ²ρ\n have hcov : ∀ i j : Fin n, i ≠ j → ∫ ω, (ξ i ω - m) * (ξ j ω - m) ∂μ = σSq * ρ := by\n intro i j hij\n -- Use contractable_map_pair to show all pairs have same distribution as (Z 0, Z 1)\n simp only [ξ, σSq, ρ, covOffDiag]\n\n -- Get the indices from enum\n let i' := (enum i).val\n let j' := (enum j).val\n\n -- We need i' < j' or j' < i' (since i ≠ j in the image of an order isomorphism)\n have hij' : i' ≠ j' := by\n intro heq\n have : (enum i).val = (enum j).val := heq\n have : enum i = enum j := Subtype.ext this\n have : i = j := enum.injective this\n contradiction\n\n -- Case split on ordering\n rcases hij'.lt_or_lt with h_lt | h_lt\n · -- Case i' < j': Use contractable_map_pair directly\n have h_dist := Exchangeability.DeFinetti.L2Helpers.contractable_map_pair\n (X := Z) hZ_contract hZ_meas h_lt\n -- Use integral_map to transfer the integral\n have h_prod_meas : Measurable (fun ω => (Z i' ω, Z j' ω)) :=\n (hZ_meas i').prodMk (hZ_meas j')\n have h_func_ae : AEStronglyMeasurable (fun p : ℝ × ℝ => (p.1 - m) * (p.2 - m))\n (Measure.map (fun ω => (Z i' ω, Z j' ω)) μ) := by\n apply Continuous.aestronglyMeasurable\n exact (continuous_fst.sub continuous_const).mul (continuous_snd.sub continuous_const)\n have h_func_ae' : AEStronglyMeasurable (fun p : ℝ × ℝ => (p.1 - m) * (p.2 - m))\n (Measure.map (fun ω => (Z 0 ω, Z 1 ω)) μ) := by\n apply Continuous.aestronglyMeasurable\n exact (continuous_fst.sub continuous_const).mul (continuous_snd.sub continuous_const)\n calc ∫ ω, (Z i' ω - m) * (Z j' ω - m) ∂μ\n = ∫ p, (p.1 - m) * (p.2 - m) ∂(Measure.map (fun ω => (Z i' ω, Z j' ω)) μ) := by\n rw [← integral_map h_prod_meas.aemeasurable h_func_ae]\n _ = ∫ p, (p.1 - m) * (p.2 - m) ∂(Measure.map (fun ω => (Z 0 ω, Z 1 ω)) μ) := by\n rw [h_dist]\n _ = ∫ ω, (Z 0 ω - m) * (Z 1 ω - m) ∂μ := by\n rw [integral_map ((hZ_meas 0).prodMk (hZ_meas 1)).aemeasurable h_func_ae']\n _ = σSq * ρ := by\n simp only [σSq, ρ, covOffDiag]\n by_cases h : ∫ ω, (Z 0 ω - m) ^ 2 ∂μ = 0\n · -- If variance is 0, covariance is also 0 by Cauchy-Schwarz\n simp [h]\n -- Goal: ∫ (Z 0 - m)(Z 1 - m) = 0\n -- Get MemLp for Z 0 and Z 1\n obtain ⟨k, hk⟩ := hs.exists_mem\n have hZk_L2 : MemLp (Z k) 2 μ := hZ_L2 k hk\n have hZ0_L2_local : MemLp (Z 0) 2 μ := by\n by_cases h' : k = 0\n · subst h'; exact hZk_L2\n · have h_dist := Exchangeability.DeFinetti.L2Helpers.contractable_map_single\n (X := Z) hZ_contract hZ_meas (i := k)\n have h_Lpnorm_eq : eLpNorm (Z 0) 2 μ = eLpNorm (Z k) 2 μ := by\n symm\n calc eLpNorm (Z k) 2 μ\n = eLpNorm id 2 (Measure.map (Z k) μ) := by\n symm; exact eLpNorm_map_measure aestronglyMeasurable_id (hZ_meas k).aemeasurable\n _ = eLpNorm id 2 (Measure.map (Z 0) μ) := by rw [h_dist]\n _ = eLpNorm (Z 0) 2 μ := by\n exact eLpNorm_map_measure aestronglyMeasurable_id (hZ_meas 0).aemeasurable\n have : eLpNorm (Z 0) 2 μ < ⊤ := by\n rw [h_Lpnorm_eq]\n exact hZk_L2.eLpNorm_lt_top\n exact ⟨(hZ_meas 0).aestronglyMeasurable, this⟩\n have hZ1_L2_local : MemLp (Z 1) 2 μ := by\n by_cases h' : k = 1\n · subst h'; exact hZk_L2\n · have h_dist := Exchangeability.DeFinetti.L2Helpers.contractable_map_single\n (X := Z) hZ_contract hZ_meas (i := k)\n have h_dist1 := Exchangeability.DeFinetti.L2Helpers.contractable_map_single\n (X := Z) hZ_contract hZ_meas (i := 1)\n have h_Lpnorm_eq : eLpNorm (Z 1) 2 μ = eLpNorm (Z k) 2 μ := by\n calc eLpNorm (Z 1) 2 μ\n = eLpNorm id 2 (Measure.map (Z 1) μ) := by\n symm; exact eLpNorm_map_measure aestronglyMeasurable_id (hZ_meas 1).aemeasurable\n _ = eLpNorm id 2 (Measure.map (Z 0) μ) := by rw [h_dist1]\n _ = eLpNorm id 2 (Measure.map (Z k) μ) := by rw [← h_dist]\n _ = eLpNorm (Z k) 2 μ := by\n exact eLpNorm_map_measure aestronglyMeasurable_id (hZ_meas k).aemeasurable\n have : eLpNorm (Z 1) 2 μ < ⊤ := by\n rw [h_Lpnorm_eq]\n exact hZk_L2.eLpNorm_lt_top\n exact ⟨(hZ_meas 1).aestronglyMeasurable, this⟩\n -- Centered versions\n have hm_const : MemLp (fun _ : Ω => m) 2 μ := memLp_const m\n have hf_local : MemLp (fun ω => Z 0 ω - m) 2 μ := MemLp.sub hZ0_L2_local hm_const\n have hg_local : MemLp (fun ω => Z 1 ω - m) 2 μ := MemLp.sub hZ1_L2_local hm_const\n -- Cauchy-Schwarz: |∫fg| ≤ √(∫f²) * √(∫g²)\n have cs := Exchangeability.Probability.IntegrationHelpers.abs_integral_mul_le_L2 hf_local hg_local\n -- Use h : ∫(Z 0 - m)² = 0 to show bound is 0\n have : (∫ ω, (Z 0 ω - m) ^ 2 ∂μ) ^ (1/2 : ℝ) = 0 := by rw [h]; norm_num\n rw [this, zero_mul] at cs\n exact abs_eq_zero.mp (le_antisymm cs (abs_nonneg _))\n · simp [h]; field_simp\n · -- Case j' < i': Use symmetry of multiplication\n have h_dist := Exchangeability.DeFinetti.L2Helpers.contractable_map_pair\n (X := Z) hZ_contract hZ_meas h_lt\n -- Note: (Z i' - m) * (Z j' - m) = (Z j' - m) * (Z i' - m)\n have h_prod_meas : Measurable (fun ω => (Z j' ω, Z i' ω)) :=\n (hZ_meas j').prodMk (hZ_meas i')\n have h_func_ae : AEStronglyMeasurable (fun p : ℝ × ℝ => (p.1 - m) * (p.2 - m))\n (Measure.map (fun ω => (Z j' ω, Z i' ω)) μ) := by\n apply Continuous.aestronglyMeasurable\n exact (continuous_fst.sub continuous_const).mul (continuous_snd.sub continuous_const)\n have h_func_ae' : AEStronglyMeasurable (fun p : ℝ × ℝ => (p.1 - m) * (p.2 - m))\n (Measure.map (fun ω => (Z 0 ω, Z 1 ω)) μ) := by\n apply Continuous.aestronglyMeasurable\n exact (continuous_fst.sub continuous_const).mul (continuous_snd.sub continuous_const)\n calc ∫ ω, (Z i' ω - m) * (Z j' ω - m) ∂μ\n = ∫ ω, (Z j' ω - m) * (Z i' ω - m) ∂μ := by\n congr 1 with ω; ring\n _ = ∫ p, (p.1 - m) * (p.2 - m) ∂(Measure.map (fun ω => (Z j' ω, Z i' ω)) μ) := by\n rw [← integral_map h_prod_meas.aemeasurable h_func_ae]\n _ = ∫ p, (p.1 - m) * (p.2 - m) ∂(Measure.map (fun ω => (Z 0 ω, Z 1 ω)) μ) := by\n rw [h_dist]\n _ = ∫ ω, (Z 0 ω - m) * (Z 1 ω - m) ∂μ := by\n rw [integral_map ((hZ_meas 0).prodMk (hZ_meas 1)).aemeasurable h_func_ae']\n _ = σSq * ρ := by\n simp only [σSq, ρ, covOffDiag]\n by_cases h : ∫ ω, (Z 0 ω - m) ^ 2 ∂μ = 0\n · -- If variance is 0, covariance is also 0 by Cauchy-Schwarz\n simp [h]\n -- Goal: ∫ (Z 0 - m)(Z 1 - m) = 0\n -- Get MemLp for Z 0 and Z 1\n obtain ⟨k, hk⟩ := hs.exists_mem\n have hZk_L2 : MemLp (Z k) 2 μ := hZ_L2 k hk\n have hZ0_L2_local : MemLp (Z 0) 2 μ := by\n by_cases h' : k = 0\n · subst h'; exact hZk_L2\n · have h_dist := Exchangeability.DeFinetti.L2Helpers.contractable_map_single\n (X := Z) hZ_contract hZ_meas (i := k)\n have h_Lpnorm_eq : eLpNorm (Z 0) 2 μ = eLpNorm (Z k) 2 μ := by\n symm\n calc eLpNorm (Z k) 2 μ\n = eLpNorm id 2 (Measure.map (Z k) μ) := by\n symm; exact eLpNorm_map_measure aestronglyMeasurable_id (hZ_meas k).aemeasurable\n _ = eLpNorm id 2 (Measure.map (Z 0) μ) := by rw [h_dist]\n _ = eLpNorm (Z 0) 2 μ := by\n exact eLpNorm_map_measure aestronglyMeasurable_id (hZ_meas 0).aemeasurable\n have : eLpNorm (Z 0) 2 μ < ⊤ := by\n rw [h_Lpnorm_eq]\n exact hZk_L2.eLpNorm_lt_top\n exact ⟨(hZ_meas 0).aestronglyMeasurable, this⟩\n have hZ1_L2_local : MemLp (Z 1) 2 μ := by\n by_cases h' : k = 1\n · subst h'; exact hZk_L2\n · have h_dist := Exchangeability.DeFinetti.L2Helpers.contractable_map_single\n (X := Z) hZ_contract hZ_meas (i := k)\n have h_dist1 := Exchangeability.DeFinetti.L2Helpers.contractable_map_single\n (X := Z) hZ_contract hZ_meas (i := 1)\n have h_Lpnorm_eq : eLpNorm (Z 1) 2 μ = eLpNorm (Z k) 2 μ := by\n calc eLpNorm (Z 1) 2 μ\n = eLpNorm id 2 (Measure.map (Z 1) μ) := by\n symm; exact eLpNorm_map_measure aestronglyMeasurable_id (hZ_meas 1).aemeasurable\n _ = eLpNorm id 2 (Measure.map (Z 0) μ) := by rw [h_dist1]\n _ = eLpNorm id 2 (Measure.map (Z k) μ) := by rw [← h_dist]\n _ = eLpNorm (Z k) 2 μ := by\n exact eLpNorm_map_measure aestronglyMeasurable_id (hZ_meas k).aemeasurable\n have : eLpNorm (Z 1) 2 μ < ⊤ := by\n rw [h_Lpnorm_eq]\n exact hZk_L2.eLpNorm_lt_top\n exact ⟨(hZ_meas 1).aestronglyMeasurable, this⟩\n -- Centered versions\n have hm_const : MemLp (fun _ : Ω => m) 2 μ := memLp_const m\n have hf_local : MemLp (fun ω => Z 0 ω - m) 2 μ := MemLp.sub hZ0_L2_local hm_const\n have hg_local : MemLp (fun ω => Z 1 ω - m) 2 μ := MemLp.sub hZ1_L2_local hm_const\n -- Cauchy-Schwarz: |∫fg| ≤ √(∫f²) * √(∫g²)\n have cs := Exchangeability.Probability.IntegrationHelpers.abs_integral_mul_le_L2 hf_local hg_local\n -- Use h : ∫(Z 0 - m)² = 0 to show bound is 0\n have : (∫ ω, (Z 0 ω - m) ^ 2 ∂μ) ^ (1/2 : ℝ) = 0 := by rw [h]; norm_num\n rw [this, zero_mul] at cs\n exact abs_eq_zero.mp (le_antisymm cs (abs_nonneg _))\n · simp [h]; field_simp\n\n -- Prove p' and q' are probability distributions\n have hp'_prob : (∑ i : Fin n, p' i) = 1 ∧ ∀ i, 0 ≤ p' i := by\n constructor\n · -- ∑ over Fin n equals ∑ over s via reindexing\n -- enum : Fin n ≃o { x // x ∈ s } is a bijection\n have : ∑ i : Fin n, p' i = s.sum p := by\n -- Use Finset.sum_bij with the bijection induced by enum\n simp only [p']\n -- Convert sum over Fin n to sum over s using enum bijection\n have h_bij : ∑ i : Fin n, p (enum i).val = s.sum p := by\n -- enum gives a bijection between Fin n and { x // x ∈ s }\n -- The map i ↦ (enum i).val is a bijection Fin n → s\n rw [Finset.sum_bij'\n (fun (i : Fin n) (_ : i ∈ Finset.univ) => (enum i).val)\n (fun (a : ℕ) (ha : a ∈ s) => enum.symm ⟨a, ha⟩)]\n · intro i _; exact (enum i).property\n · intro a ha; simp\n · intro a ha; simp\n · intro i hi; simp [OrderIso.symm_apply_apply]\n · intro a ha; simp\n exact h_bij\n rw [this]; exact hp_prob.1\n · intro i\n -- p' i = p (enum i).val, and (enum i).val ∈ s by (enum i).property\n exact hp_prob.2 (enum i).val (enum i).property\n\n have hq'_prob : (∑ i : Fin n, q' i) = 1 ∧ ∀ i, 0 ≤ q' i := by\n constructor\n · have : ∑ i : Fin n, q' i = s.sum q := by\n -- Same proof as for p', just with q instead of p\n simp only [q']\n have h_bij : ∑ i : Fin n, q (enum i).val = s.sum q := by\n rw [Finset.sum_bij'\n (fun (i : Fin n) (_ : i ∈ Finset.univ) => (enum i).val)\n (fun (a : ℕ) (ha : a ∈ s) => enum.symm ⟨a, ha⟩)]\n · intro i _; exact (enum i).property\n · intro a ha; simp\n · intro a ha; simp\n · intro i hi; simp [OrderIso.symm_apply_apply]\n · intro a ha; simp\n exact h_bij\n rw [this]; exact hq_prob.1\n · intro i\n exact hq_prob.2 (enum i).val (enum i).property\n\n -- Step 4: Apply l2_contractability_bound and convert result\n\n -- Convert hvar to the form l2_contractability_bound expects\n have hvar' : ∀ k : Fin n, ∫ ω, (ξ k ω - m)^2 ∂μ = (σSq ^ (1/2 : ℝ))^2 := by\n intro k\n rw [← Real.sqrt_eq_rpow, Real.sq_sqrt hσSq_nonneg]\n exact hvar k\n\n -- Convert hcov to the form l2_contractability_bound expects\n have hcov' : ∀ i j : Fin n, i ≠ j → ∫ ω, (ξ i ω - m) * (ξ j ω - m) ∂μ = (σSq ^ (1/2 : ℝ))^2 * ρ := by\n intro i j hij\n rw [← Real.sqrt_eq_rpow, Real.sq_sqrt hσSq_nonneg]\n exact hcov i j hij\n\n -- First, prove that ∫ (Z 0 - Z 1)^2 = 2*σ^2*(1 - ρ)\n have h_diff_sq : ∫ ω, (Z 0 ω - Z 1 ω)^2 ∂μ = 2 * σSq * (1 - ρ) := by\n -- Strategy: Rewrite Z 0 - Z 1 = (Z 0 - m) - (Z 1 - m) and expand\n have h_expand : ∀ ω, (Z 0 ω - Z 1 ω)^2 =\n (Z 0 ω - m)^2 + (Z 1 ω - m)^2 - 2 * (Z 0 ω - m) * (Z 1 ω - m) := by\n intro ω\n ring\n\n -- Integrability facts: Z 0 and Z 1 are in L² by contractability\n -- Since some Z k (k ∈ s) is in L², and contractability gives equal distributions,\n -- all Z i have the same L² norm\n obtain ⟨k, hk⟩ := hs.exists_mem\n have hZk_L2 : MemLp (Z k) 2 μ := hZ_L2 k hk\n\n have hZ0_L2 : MemLp (Z 0) 2 μ := by\n by_cases h : k = 0\n · subst h; exact hZk_L2\n · -- Use that Z 0 has same distribution as Z k via contractability\n -- Equal distributions imply equal eLpNorm, hence MemLp transfers\n have h_dist := Exchangeability.DeFinetti.L2Helpers.contractable_map_single\n (X := Z) hZ_contract hZ_meas (i := k)\n -- Transfer eLpNorm using equal distributions\n have h_Lpnorm_eq : eLpNorm (Z 0) 2 μ = eLpNorm (Z k) 2 μ := by\n symm\n calc eLpNorm (Z k) 2 μ\n = eLpNorm id 2 (Measure.map (Z k) μ) := by\n symm\n exact eLpNorm_map_measure aestronglyMeasurable_id (hZ_meas k).aemeasurable\n _ = eLpNorm id 2 (Measure.map (Z 0) μ) := by rw [h_dist]\n _ = eLpNorm (Z 0) 2 μ := by\n exact eLpNorm_map_measure aestronglyMeasurable_id (hZ_meas 0).aemeasurable\n have : eLpNorm (Z 0) 2 μ < ⊤ := by\n rw [h_Lpnorm_eq]\n exact hZk_L2.eLpNorm_lt_top\n exact ⟨(hZ_meas 0).aestronglyMeasurable, this⟩\n have hZ1_L2 : MemLp (Z 1) 2 μ := by\n by_cases h : k = 1\n · subst h; exact hZk_L2\n · -- Use that Z 1 has same distribution as Z k via contractability\n -- Equal distributions imply equal eLpNorm, hence MemLp transfers\n have h_dist := Exchangeability.DeFinetti.L2Helpers.contractable_map_single\n (X := Z) hZ_contract hZ_meas (i := k)\n have h_dist1 := Exchangeability.DeFinetti.L2Helpers.contractable_map_single\n (X := Z) hZ_contract hZ_meas (i := 1)\n -- Transfer eLpNorm using equal distributions\n have h_Lpnorm_eq : eLpNorm (Z 1) 2 μ = eLpNorm (Z k) 2 μ := by\n calc eLpNorm (Z 1) 2 μ\n = eLpNorm id 2 (Measure.map (Z 1) μ) := by\n symm\n exact eLpNorm_map_measure aestronglyMeasurable_id (hZ_meas 1).aemeasurable\n _ = eLpNorm id 2 (Measure.map (Z 0) μ) := by rw [h_dist1]\n _ = eLpNorm id 2 (Measure.map (Z k) μ) := by rw [← h_dist]\n _ = eLpNorm (Z k) 2 μ := by\n exact eLpNorm_map_measure aestronglyMeasurable_id (hZ_meas k).aemeasurable\n have : eLpNorm (Z 1) 2 μ < ⊤ := by\n rw [h_Lpnorm_eq]\n exact hZk_L2.eLpNorm_lt_top\n exact ⟨(hZ_meas 1).aestronglyMeasurable, this⟩\n\n -- (Z i - m)² is integrable when Z i ∈ L²\n have hint_sq0 : Integrable (fun ω => (Z 0 ω - m)^2) μ := by\n have : (fun ω => (Z 0 ω - m)^2) = (fun ω => (Z 0 ω)^2 - 2 * m * Z 0 ω + m^2) := by\n ext ω; ring\n rw [this]\n apply Integrable.add\n · apply Integrable.sub\n · exact (hZ0_L2.integrable_sq)\n · exact Integrable.const_mul (hZ0_L2.integrable one_le_two) _\n · exact integrable_const _\n have hint_sq1 : Integrable (fun ω => (Z 1 ω - m)^2) μ := by\n have : (fun ω => (Z 1 ω - m)^2) = (fun ω => (Z 1 ω)^2 - 2 * m * Z 1 ω + m^2) := by\n ext ω; ring\n rw [this]\n apply Integrable.add\n · apply Integrable.sub\n · exact (hZ1_L2.integrable_sq)\n · exact Integrable.const_mul (hZ1_L2.integrable one_le_two) _\n · exact integrable_const _\n\n -- (Z 0 - m) * (Z 1 - m) is integrable (product of L² functions)\n have hint_prod : Integrable (fun ω => (Z 0 ω - m) * (Z 1 ω - m)) μ := by\n have hm : MemLp (fun _ : Ω => m) 2 μ := memLp_const m\n have hf : MemLp (fun ω => Z 0 ω - m) 2 μ := MemLp.sub hZ0_L2 hm\n have hg : MemLp (fun ω => Z 1 ω - m) 2 μ := MemLp.sub hZ1_L2 hm\n exact MemLp.integrable_mul hf hg\n\n -- Algebraically, (Z_0 - Z_1)² = (Z_0 - m)² + (Z_1 - m)² - 2(Z_0 - m)(Z_1 - m)\n -- Taking expectations: E[(Z_0 - Z_1)²] = σ² + σ² - 2·cov = 2σ²(1 - ρ)\n\n -- First prove Z 1 has same variance as Z 0\n have hvar1 : ∫ ω, (Z 1 ω - m)^2 ∂μ = σSq := by\n -- Use contractability: Z 1 has same distribution as Z 0\n have h_dist := Exchangeability.DeFinetti.L2Helpers.contractable_map_single\n (X := Z) hZ_contract hZ_meas (i := 1)\n simp only [σSq]\n rw [← Exchangeability.Probability.IntegrationHelpers.integral_pushforward_sq_diff (hZ_meas 1) m,\n h_dist,\n Exchangeability.Probability.IntegrationHelpers.integral_pushforward_sq_diff (hZ_meas 0) m]\n\n -- Now compute the integral using the expansion\n calc ∫ ω, (Z 0 ω - Z 1 ω)^2 ∂μ\n = ∫ ω, ((Z 0 ω - m)^2 + (Z 1 ω - m)^2 - 2 * (Z 0 ω - m) * (Z 1 ω - m)) ∂μ := by\n apply integral_congr_ae\n filter_upwards with ω\n exact h_expand ω\n _ = 2 * σSq * (1 - ρ) := by\n -- Distribute the integral using linearity\n have h1 : ∫ ω, ((Z 0 ω - m)^2 + (Z 1 ω - m)^2) ∂μ = ∫ ω, (Z 0 ω - m)^2 ∂μ + ∫ ω, (Z 1 ω - m)^2 ∂μ :=\n integral_add hint_sq0 hint_sq1\n have h_int_prod : Integrable (fun ω => 2 * (Z 0 ω - m) * (Z 1 ω - m)) μ := by\n convert hint_prod.const_mul 2 using 1\n ext ω\n ring\n have h2 : ∫ ω, ((Z 0 ω - m)^2 + (Z 1 ω - m)^2 - 2 * (Z 0 ω - m) * (Z 1 ω - m)) ∂μ =\n ∫ ω, ((Z 0 ω - m)^2 + (Z 1 ω - m)^2) ∂μ - ∫ ω, 2 * (Z 0 ω - m) * (Z 1 ω - m) ∂μ :=\n integral_sub (hint_sq0.add hint_sq1) h_int_prod\n have h3 : ∫ ω, 2 * (Z 0 ω - m) * (Z 1 ω - m) ∂μ = 2 * ∫ ω, (Z 0 ω - m) * (Z 1 ω - m) ∂μ := by\n have : (fun ω => 2 * (Z 0 ω - m) * (Z 1 ω - m)) = (fun ω => 2 * ((Z 0 ω - m) * (Z 1 ω - m))) := by\n ext ω; ring\n rw [this, integral_const_mul]\n calc ∫ ω, ((Z 0 ω - m)^2 + (Z 1 ω - m)^2 - 2 * (Z 0 ω - m) * (Z 1 ω - m)) ∂μ\n = ∫ ω, ((Z 0 ω - m)^2 + (Z 1 ω - m)^2) ∂μ - ∫ ω, 2 * (Z 0 ω - m) * (Z 1 ω - m) ∂μ := h2\n _ = (∫ ω, (Z 0 ω - m)^2 ∂μ + ∫ ω, (Z 1 ω - m)^2 ∂μ) - ∫ ω, 2 * (Z 0 ω - m) * (Z 1 ω - m) ∂μ := by rw [h1]\n _ = (∫ ω, (Z 0 ω - m)^2 ∂μ + ∫ ω, (Z 1 ω - m)^2 ∂μ) - 2 * ∫ ω, (Z 0 ω - m) * (Z 1 ω - m) ∂μ := by rw [h3]\n _ = (σSq + σSq) - 2 * covOffDiag := by simp only [σSq, covOffDiag]; rw [hvar1]\n _ = 2 * σSq - 2 * covOffDiag := by ring\n _ = 2 * σSq - 2 * (σSq * ρ) := by\n congr 1\n simp only [ρ, covOffDiag]\n by_cases h : σSq = 0\n · -- When σSq = 0, variance is 0, so Z 0 ω - m = 0 a.e.\n -- Therefore the covariance integral is also 0\n simp [h]\n -- σSq = ∫ (Z 0 - m)² = 0 and integrand ≥ 0, so Z 0 - m = 0 a.e.\n have : (fun ω => (Z 0 ω - m) * (Z 1 ω - m)) =ᵐ[μ] 0 := by\n have h_sq_zero : ∀ᵐ ω ∂μ, (Z 0 ω - m) ^ 2 = 0 := by\n rw [← h] at hσSq_nonneg\n have : ∫ (ω : Ω), (Z 0 ω - m) ^ 2 ∂μ = 0 := h\n exact (integral_eq_zero_iff_of_nonneg_ae (Eventually.of_forall (fun ω => sq_nonneg _)) hint_sq0).mp this\n filter_upwards [h_sq_zero] with ω hω\n have : Z 0 ω - m = 0 := by\n have := sq_eq_zero_iff.mp hω\n exact this\n simp [this]\n rw [integral_congr_ae this]\n simp\n · simp [h]; field_simp\n _ = 2 * σSq * (1 - ρ) := by ring\n\n -- Apply l2_contractability_bound to get the bound in terms of ξ, p', q'\n have h_bound := Exchangeability.DeFinetti.L2Approach.l2_contractability_bound\n ξ m (σSq ^ (1/2 : ℝ)) ρ hρ_bd hmean hL2 hvar' hcov' p' q' hp'_prob hq'_prob\n\n -- Convert the bound back to the original variables Z, p, q, s\n calc ∫ ω, (s.sum fun i => (p i - q i) * Z i ω) ^ 2 ∂μ\n = ∫ ω, (∑ k : Fin n, (p' k - q' k) * ξ k ω) ^ 2 ∂μ := by\n -- Reindex sum from s to Fin n via enum bijection\n congr 1; ext ω\n -- Show: s.sum (fun i => (p i - q i) * Z i ω) = ∑ k : Fin n, (p' k - q' k) * ξ k ω\n simp only [p', q', ξ]\n -- Now: s.sum (fun i => (p i - q i) * Z i ω) = ∑ k : Fin n, (p (enum k).val - q (enum k).val) * Z (enum k).val ω\n symm\n rw [Finset.sum_bij'\n (fun (k : Fin n) (_ : k ∈ Finset.univ) => (enum k).val)\n (fun (i : ℕ) (hi : i ∈ s) => enum.symm ⟨i, hi⟩)]\n · intro k _; exact (enum k).property\n · intro i hi; simp\n · intro i hi; simp\n · intro k hk; simp [OrderIso.symm_apply_apply]\n · intro i hi; simp\n _ = ∫ ω, (∑ k : Fin n, p' k * ξ k ω - ∑ k : Fin n, q' k * ξ k ω) ^ 2 ∂μ := by\n congr 1; ext ω\n simp only [Finset.sum_sub_distrib, sub_mul]\n _ ≤ 2 * (σSq ^ (1/2 : ℝ)) ^ 2 * (1 - ρ) * (⨆ k : Fin n, |p' k - q' k|) := h_bound\n _ = 2 * σSq * (1 - ρ) * (⨆ k : Fin n, |p' k - q' k|) := by\n congr 1\n rw [← Real.sqrt_eq_rpow, Real.sq_sqrt hσSq_nonneg]\n _ = (∫ ω, (Z 0 ω - Z 1 ω)^2 ∂μ) * (⨆ k : Fin n, |p' k - q' k|) := by\n rw [← h_diff_sq]\n _ = (∫ ω, (Z 0 ω - Z 1 ω)^2 ∂μ) * (s.sup' hs fun i => |p i - q i|) := by\n -- Supremum reindexing via enum: ⨆ k : Fin n, |p' k - q' k| = s.sup' hs fun i => |p i - q i|\n congr 1\n simp only [p', q']\n -- Prove equality using le_antisymm\n apply le_antisymm\n · -- Forward: ⨆ k ≤ s.sup'\n -- For each k, (enum k).val ∈ s, so |p (enum k).val - q (enum k).val| ≤ s.sup'\n -- Need Nonempty (Fin n) for ciSup_le\n have : Nonempty (Fin n) := by\n have h_card_pos : 0 < n := Finset.card_pos.mpr hs\n exact Fin.pos_iff_nonempty.mp h_card_pos\n apply ciSup_le\n intro k\n have hk_in_s : (enum k).val ∈ s := (enum k).property\n exact Finset.le_sup' (fun i => |p i - q i|) hk_in_s\n · -- Backward: s.sup' ≤ ⨆ k\n -- For each i ∈ s, enum.symm ⟨i, hi⟩ gives k : Fin n with (enum k).val = i\n apply Finset.sup'_le\n intro i hi\n have : i = (enum (enum.symm ⟨i, hi⟩)).val := by simp\n rw [this]\n exact le_ciSup (f := fun k => |(p ∘ Subtype.val ∘ enum) k - (q ∘ Subtype.val ∘ enum) k|)\n (Finite.bddAbove_range _) (enum.symm ⟨i, hi⟩)\n","line":74,"end_line":795,"proof_status":"formalized"} | |
| {"id":"lem:cdf_mono","label":"cdf_mono","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":[],"nlp_text":"The limiting function \\(\\alpha (t, \\omega )\\) is monotone in \\(t\\) for a.e. \\(\\omega \\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaL2.cdf_from_alpha_mono","latex_link":"sect0004.html#lem:cdf_mono","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaL2.cdf_from_alpha_mono","lean_decl_name":"Exchangeability.DeFinetti.ViaL2.cdf_from_alpha_mono","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaL2/DirectingMeasureCore.lean","lean4_code":"/-- F(ω,·) is monotone nondecreasing. -/\nlemma cdf_from_alpha_mono\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n (X : ℕ → Ω → ℝ) (hX_contract : Contractable μ X)\n (hX_meas : ∀ i, Measurable (X i))\n (hX_L2 : ∀ i, MemLp (X i) 2 μ)\n (ω : Ω) :\n Monotone (cdf_from_alpha X hX_contract hX_meas hX_L2 ω) := fun s t hst =>\n (ProbabilityTheory.stieltjesOfMeasurableRat\n (alphaIicRat X hX_contract hX_meas hX_L2)\n (measurable_alphaIicRat X hX_contract hX_meas hX_L2)\n ω).mono hst\n","line":68,"end_line":79,"proof_status":"formalized"} | |
| {"id":"lem:directing_measure_isProb_L2","label":"directing_measure_isProb_L2","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["lem:cdf_mono","lem:cdf_bounds"],"nlp_text":"The Stieltjes measure constructed from the limiting CDF is a probability measure a.e.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaL2.directing_measure_isProbabilityMeasure","latex_link":"sect0004.html#lem:directing_measure_isProb_L2","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaL2.directing_measure_isProbabilityMeasure","lean_decl_name":"Exchangeability.DeFinetti.ViaL2.directing_measure_isProbabilityMeasure","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaL2/DirectingMeasureCore.lean","lean4_code":"/-- The directing measure is a probability measure.\n\nThis is now trivial because `directing_measure` is defined via `stieltjesOfMeasurableRat.measure`,\nwhich automatically has an `IsProbabilityMeasure` instance from mathlib. -/\nlemma directing_measure_isProbabilityMeasure\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n (X : ℕ → Ω → ℝ) (hX_contract : Contractable μ X)\n (hX_meas : ∀ i, Measurable (X i))\n (hX_L2 : ∀ i, MemLp (X i) 2 μ)\n (ω : Ω) :\n IsProbabilityMeasure (directing_measure X hX_contract hX_meas hX_L2 ω) :=\n ProbabilityTheory.instIsProbabilityMeasure_stieltjesOfMeasurableRat\n (measurable_alphaIicRat X hX_contract hX_meas hX_L2) ω\n","line":304,"end_line":316,"proof_status":"formalized"} | |
| {"id":"thm:conditionallyIID_of_contractable_L2","label":"conditionallyIID_of_contractable_L2","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["lem:directing_measure_isProb_L2","thm:condIndep_extension","def:conditionallyIID","thm:weighted_sums_L1"],"nlp_text":"If \\((X_n)\\) is contractable, then it is conditionally i.i.d.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.conditionallyIID_of_contractable_viaL2","latex_link":"sect0004.html#thm:conditionallyIID_of_contractable_L2","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.conditionallyIID_of_contractable_viaL2","lean_decl_name":"Exchangeability.DeFinetti.conditionallyIID_of_contractable_viaL2","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/TheoremViaL2.lean","lean4_code":"/-- **Contractable implies conditionally i.i.d.** (direct statement).\n\nThis is sometimes called the \"contractable de Finetti\" theorem.\n\n**Proof**: Via L² bounds (Kallenberg Lemma 1.2) + CommonEnding.\n\n**Reference**: Kallenberg (2005), page 27, \"Second proof\".\n-/\ntheorem conditionallyIID_of_contractable_viaL2\n [StandardBorelSpace Ω]\n (μ : Measure Ω) [IsProbabilityMeasure μ]\n (X : ℕ → Ω → ℝ) (hX_meas : ∀ i, Measurable (X i))\n (hContract : Contractable μ X)\n (hX_L2 : ∀ i, MemLp (X i) 2 μ) :\n ConditionallyIID μ X := by\n exact (deFinetti_RyllNardzewski_equivalence_viaL2 μ X hX_meas hX_L2).mp hContract |>.2\n","line":127,"end_line":142,"proof_status":"formalized"} | |
| {"id":"thm:deFinetti","label":"deFinetti","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["thm:conditionallyIID_of_contractable_L2","thm:conditionallyIID_of_contractable_Koopman","thm:conditionallyIID_of_contractable_martingale","thm:exchangeable_of_conditionallyIID","thm:contractable_of_exchangeable"],"nlp_text":"For an infinite sequence \\((X_n)_{n \\in \\mathbb {N}}\\) of random variables taking values in a standard Borel space \\(\\alpha \\) (with \\(\\alpha \\) nonempty), the following are equivalent: \\((X_n)\\) is contractable \\((X_n)\\) is exchangeable \\((X_n)\\) is conditionally i.i.d. (i.e., there exists a directing kernel \\(\\nu \\)) Remark: The martingale proof constructs \\(\\nu \\) from the tail \\(\\sigma \\)-algebra \\(\\mathcal{T}\\) via \\(\\nu (\\omega )(B) = \\mathbb {E}[\\mathbf{1}_{X_0 \\in B} \\mid \\mathcal{T}](\\omega )\\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.deFinetti_RyllNardzewski_equivalence","latex_link":"sect0006.html#thm:deFinetti","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.deFinetti_RyllNardzewski_equivalence","lean_decl_name":"Exchangeability.DeFinetti.deFinetti_RyllNardzewski_equivalence","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/TheoremViaMartingale.lean","lean4_code":"/-- **Kallenberg Theorem 1.1 (via martingale):** Three-way equivalence.\n\nThis is the full de Finetti-Ryll-Nardzewski equivalence for sequences on standard Borel spaces:\nContractable ↔ Exchangeable ↔ Conditionally i.i.d.\n\n**Proof structure:**\n- Contractable → ConditionallyIID: Via reverse martingale convergence (this file)\n- ConditionallyIID → Exchangeable: From ConditionallyIID.lean\n- Exchangeable → Contractable: From Contractability.lean\n\n**Reference**: Kallenberg (2005), Theorem 1.1 (pages 26-28).\n-/\ntheorem deFinetti_RyllNardzewski_equivalence\n [StandardBorelSpace Ω]\n {α : Type*} [MeasurableSpace α] [StandardBorelSpace α] [Nonempty α]\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n (X : ℕ → Ω → α) (hX_meas : ∀ i, Measurable (X i)) :\n Contractable μ X ↔ Exchangeable μ X ∧ ConditionallyIID μ X := by\n constructor\n · intro hContract\n -- Contractable → ConditionallyIID (our main theorem)\n have hCIID := conditionallyIID_of_contractable X hX_meas hContract\n -- ConditionallyIID → Exchangeable\n have hExch := exchangeable_of_conditionallyIID hX_meas hCIID\n exact ⟨hExch, hCIID⟩\n · intro ⟨hExch, _⟩\n -- Exchangeable → Contractable\n exact contractable_of_exchangeable hExch hX_meas\n","line":126,"end_line":153,"proof_status":"formalized"} | |
| {"id":"lem:blockAvg_tendsto","label":"blockAvg_tendsto","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["thm:birkhoff_condexp","def:blockAvg"],"nlp_text":"For a shift-invariant measure, block averages converge in \\(L^1\\) to the conditional expectation given the shift-invariant \\(\\sigma \\)-algebra: \\(\\int |A_{m,n,k}(f) - \\mathbb {E}[f \\circ \\pi _0 \\mid \\mathcal{I}]| \\, d\\mu \\to 0\\) as \\(n \\to \\infty \\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaKoopman.blockAvg_tendsto_condExp","latex_link":"sect0004.html#lem:blockAvg_tendsto","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaKoopman.blockAvg_tendsto_condExp","lean_decl_name":"Exchangeability.DeFinetti.ViaKoopman.blockAvg_tendsto_condExp","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaKoopman/BlockAverage.lean","lean4_code":"/-- Block averages converge in L¹ to conditional expectation.\n\nFor each fixed k, as n → ∞:\n`∫ |blockAvg m n k f ω - μ[f(ω₀) | mSI] ω| dμ → 0`\n\nThis follows from the Cesàro convergence theorem since blockAvg at position k\nis a Cesàro average starting at coordinate k*n, and by `condexp_precomp_iterate_eq`,\nthe target CE is the same regardless of the starting position. -/\nlemma blockAvg_tendsto_condExp\n (hσ : MeasurePreserving shift μ μ) (m : ℕ) (k : Fin m)\n {f : α → ℝ} (hf : Measurable f) (hf_bd : ∃ C, ∀ x, |f x| ≤ C) :\n Tendsto (fun n =>\n ∫ ω, |blockAvg m (n + 1) k f ω - μ[(fun ω => f (ω 0)) | mSI] ω| ∂μ)\n atTop (𝓝 0) := by\n -- Key insight: blockAvg m (n+1) k f ω = (A n) (shift^[k*(n+1)] ω)\n -- where A n is the standard Cesàro average.\n\n -- Define the standard Cesàro average and conditional expectation target\n let A := fun n : ℕ => fun ω : Ω[α] =>\n (1 / ((n + 1) : ℝ)) * (Finset.range (n + 1)).sum (fun j => f (ω j))\n let Y := fun ω : Ω[α] => μ[(fun ω' => f (ω' 0)) | mSI] ω\n\n -- The offset depends on n: offset_n = k.val * (n + 1)\n let offset := fun n : ℕ => k.val * (n + 1)\n\n -- Key fact 1: blockAvg = A ∘ shift^[offset]\n have h_blockAvg_eq : ∀ n, ∀ ω, blockAvg m (n + 1) k f ω = A n (shift^[offset n] ω) := by\n intro n ω\n -- blockAvg m (n+1) k f ω = (1/(n+1)) * ∑_{j ∈ range(n+1)} f(ω(k.val*(n+1) + j))\n -- = (1/(n+1)) * ∑_{j ∈ range(n+1)} f((shift^[k.val*(n+1)] ω) j)\n -- = A n (shift^[offset n] ω)\n -- Use blockAvg_eq_cesaro_shifted which establishes this connection\n rw [blockAvg_eq_cesaro_shifted (Nat.succ_pos n)]\n -- Align coercions: ↑n.succ = ↑n + 1 as reals, and n.succ = n + 1 as naturals\n simp only [Nat.succ_eq_add_one, Nat.cast_add, Nat.cast_one]\n -- Now definitionally equal since offset n = k.val * (n + 1)\n rfl\n\n -- Key fact 2: Y is shift-invariant (CE w.r.t. mSI is constant on shift orbits)\n have hf_int : Integrable (fun ω : Ω[α] => f (ω 0)) μ :=\n let ⟨C, hC⟩ := hf_bd\n integrable_of_bounded_measurable (hf.comp (measurable_pi_apply 0)) C fun ω => hC (ω 0)\n\n have h_Y_shift_inv : ∀ p : ℕ, (fun ω => Y (shift^[p] ω)) =ᵐ[μ] Y := by\n intro p\n -- CE[f(ω₀) | mSI] is mSI-measurable, and for mSI-measurable functions,\n -- f ∘ shift^[p] = f pointwise (by shiftInvariantSigma_measurable_shift_eq)\n --\n -- Step 1: Y is mSI-measurable\n have hY_meas : Measurable[mSI] Y := stronglyMeasurable_condExp.measurable\n -- Step 2: By induction on p, Y ∘ shift^[p] = Y pointwise\n have h_eq : ∀ p : ℕ, (fun ω => Y (shift^[p] ω)) = Y := by\n intro p\n induction p with\n | zero =>\n -- shift^[0] = id, so (fun ω => Y (id ω)) = Y\n rfl\n | succ p ih =>\n ext ω\n -- shift^[p+1] = shift ∘ shift^[p]\n simp only [Function.iterate_succ', Function.comp_apply]\n -- Y (shift (shift^[p] ω)) = Y ω\n -- First use ih: Y (shift^[p] ω') = Y ω' for all ω'\n -- So we need: Y (shift (shift^[p] ω)) = Y (shift^[p] ω) = Y ω\n have h := shiftInvariantSigma_measurable_shift_eq Y hY_meas\n -- h : (fun ω => Y (shift ω)) = Y\n -- So Y (shift ω') = Y ω' for all ω'\n calc Y (shift (shift^[p] ω))\n _ = Y (shift^[p] ω) := congrFun h (shift^[p] ω)\n _ = Y ω := congrFun ih ω\n -- Step 3: Pointwise equality implies a.e. equality\n exact EventuallyEq.of_eq (h_eq p)\n\n -- Reduce to standard Cesàro convergence via measure-preserving substitution\n have h_eq : ∀ n, ∫ ω, |blockAvg m (n + 1) k f ω - Y ω| ∂μ = ∫ ω, |A n ω - Y ω| ∂μ := by\n intro n\n -- Step 1: Substitute blockAvg = A ∘ shift^[offset]\n have h1 : ∫ ω, |blockAvg m (n + 1) k f ω - Y ω| ∂μ =\n ∫ ω, |A n (shift^[offset n] ω) - Y ω| ∂μ := by\n congr 1; ext ω; rw [h_blockAvg_eq]\n -- Step 2: Use Y shift-invariance: Y ω = Y (shift^[offset n] ω) a.e.\n have h2 : ∫ ω, |A n (shift^[offset n] ω) - Y ω| ∂μ =\n ∫ ω, |A n (shift^[offset n] ω) - Y (shift^[offset n] ω)| ∂μ := by\n apply integral_congr_ae\n filter_upwards [h_Y_shift_inv (offset n)] with ω hω\n rw [hω]\n -- Step 3: Apply measure-preserving substitution\n have h_pres := hσ.iterate (offset n)\n have h3 : ∫ ω, |A n (shift^[offset n] ω) - Y (shift^[offset n] ω)| ∂μ =\n ∫ ω, |A n ω - Y ω| ∂μ := by\n -- Use integral substitution under measure-preserving map\n -- ∫ F(T ω) dμ = ∫ F dμ when T is measure-preserving\n --\n -- Define F := fun ω => |A n ω - Y ω|\n -- Then LHS = ∫ (F ∘ shift^[offset n]) dμ = ∫ F d(μ.map shift^[offset n]) = ∫ F dμ\n -- The last step uses h_pres.map_eq : μ.map shift^[offset n] = μ\n --\n -- Strategy from CesaroConvergence.lean:\n -- 1. Use integral_map_of_stronglyMeasurable to relate ∫ F dν and ∫ (F ∘ T) dμ\n -- 2. Use h_pres.map_eq to get ν = μ\n have h_smeas : StronglyMeasurable (fun ω : Ω[α] => |A n ω - Y ω|) := by\n -- A n is measurable (Cesàro average = const * finite sum of measurable functions)\n have hA_meas : Measurable (A n) := by\n simp only [A]\n apply Measurable.const_mul\n apply Finset.measurable_sum\n intro j _\n exact hf.comp (measurable_pi_apply j)\n -- Y is the conditional expectation, measurable via shiftInvariantSigma_le\n have hY_meas : Measurable Y :=\n stronglyMeasurable_condExp.measurable.mono (shiftInvariantSigma_le (α := α)) le_rfl\n exact (continuous_abs.measurable.comp (hA_meas.sub hY_meas)).stronglyMeasurable\n -- Rewrite using integral_map_of_stronglyMeasurable\n rw [← integral_map_of_stronglyMeasurable h_pres.measurable h_smeas, h_pres.map_eq]\n rw [h1, h2, h3]\n\n -- Apply L1_cesaro_convergence_bounded\n rw [show (fun n => ∫ ω, |blockAvg m (n + 1) k f ω - Y ω| ∂μ) =\n (fun n => ∫ ω, |A n ω - Y ω| ∂μ) from funext h_eq]\n exact L1_cesaro_convergence_bounded hσ f hf hf_bd\n","line":138,"end_line":257,"proof_status":"formalized"} | |
| {"id":"lem:product_blockAvg_L1","label":"product_blockAvg_L1","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["lem:blockAvg_tendsto","lem:integral_prod_blockAvg"],"nlp_text":"Products of block averages converge in L\\(^1\\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaKoopman.product_blockAvg_L1_convergence","latex_link":"sect0004.html#lem:product_blockAvg_L1","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaKoopman.product_blockAvg_L1_convergence","lean_decl_name":"Exchangeability.DeFinetti.ViaKoopman.product_blockAvg_L1_convergence","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"./paper/NOTES.md","lean4_code":"lemma product_blockAvg_L1_convergence {m : ℕ} (fs : Fin m → α → ℝ) ... :\n Tendsto (fun n => ∫ ω, |∏ i, blockAvg n (fs i) ω - ∏ i, μ[fs i | mSI] ω| ∂μ)\n atTop (nhds 0)\n\n-- Step 4: Conditional expectation factorizes products\n","line":167,"end_line":171,"proof_status":"formalized"} | |
| {"id":"thm:condexp_product_factorization","label":"condexp_product_factorization","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["lem:product_blockAvg_L1","lem:condexp_lag_const"],"nlp_text":"For contractable sequences, the conditional expectation of a product of indicators factors as a product of conditional expectations.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaKoopman.condexp_product_factorization_contractable","latex_link":"sect0004.html#thm:condexp_product_factorization","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaKoopman.condexp_product_factorization_contractable","lean_decl_name":"Exchangeability.DeFinetti.ViaKoopman.condexp_product_factorization_contractable","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"./paper/NOTES.md","lean4_code":"lemma condexp_product_factorization_contractable {m : ℕ} (fs : Fin m → α → ℝ) ... :\n μ[∏ i, fs i | mSI] =ᵐ[μ] ∏ i, μ[fs i | mSI]\n```\n\n### Quantified Impact\n\n| Aspect | Textbook Approach | Actual Implementation |\n|--------|------------------|----------------------|\n| **MET usage** | L² convergence | L² convergence (same) |\n| **Factorization** | Koopman spectral theory | Contractability + telescoping |\n| **Dependencies** | Koopman isometry, projection characterization | CE properties + contractability |\n| **Core factorization LOC** | ~500 (estimated) | ~90 (self-contained) |\n| **Status** | Would need spectral infrastructure | Complete |\n\n### Formalization-Driven Discovery\n\nThis reformulation was discovered **because** of the type mismatch:\n- Lean's type system made the full Koopman approach difficult (ambient L² vs. sub-σ-algebra)\n- Forced exploration of alternatives for the factorization step\n- Found that contractability gives factorization directly, avoiding Koopman-to-CE bridge\n\n**Lesson**: Type systems can guide toward simpler proof structures, not just verify existing ones.\n\n---\n\n## Storyline 3: Equation Archeology\n\n### The Problem: Unexplained Calculation Chains\n\nKallenberg (2005) presents calculation chains like:\n\n```\nE[f(X_{n+1}) | X_1,...,X_n] = E[E[f(X_{n+1}) | σ(X_1,X_2,...)] | X_1,...,X_n] (1.2a)\n = E[α(X_1,X_2,...) | X_1,...,X_n] (1.2b)\n = α(X_1,...,X_n) (1.2c)\n```\n\nEach step is \"obvious to experts\" but:\n- No justification provided\n- General principle unstated\n- Conditions for validity implicit\n\n### The Solution: Formalized Lemmas as Explanations\n\n| Step | Math Justification | Lean Lemma | Signature |\n|------|-------------------|------------|-----------|\n| (1.2a)→(1.2b) | Tower property | `MeasureTheory.condExp_condExp_of_le` | `m₁ ≤ m₂ → μ[μ[f\\|m₂]\\|m₁] =ᵐ[μ] μ[f\\|m₁]` |\n| (1.2b)→(1.2c) | α defined as CE | (definition unfolding) | - |\n| (1.2c)→(1.2d) | Measurable ⟹ fixed point | `MeasureTheory.condExp_of_stronglyMeasurable` | `StronglyMeasurable[m] f → μ[f\\|m] =ᵐ[μ] f` |\n\n","line":172,"end_line":221,"proof_status":"formalized"} | |
| {"id":"thm:conditionallyIID_of_contractable_Koopman","label":"conditionallyIID_of_contractable_Koopman","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["thm:condexp_product_factorization","thm:condIndep_extension","def:conditionallyIID","lem:indicator_product_bridge_contractable"],"nlp_text":"If \\((X_n)\\) is contractable, then it is conditionally i.i.d. This proof uses the Mean Ergodic Theorem via the Koopman operator on L\\(^2\\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.conditionallyIID_of_contractable_viaKoopman","latex_link":"sect0004.html#thm:conditionallyIID_of_contractable_Koopman","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.conditionallyIID_of_contractable_viaKoopman","lean_decl_name":"Exchangeability.DeFinetti.conditionallyIID_of_contractable_viaKoopman","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/TheoremViaKoopman.lean","lean4_code":"/-- **Contractable implies conditionally i.i.d.** (via Koopman).\n\n**Reference**: Kallenberg (2005), page 26, \"First proof\".\n\n**Proof**: Follows directly from the equivalence theorem.\n-/\ntheorem conditionallyIID_of_contractable_viaKoopman\n (μ : Measure Ω) [IsProbabilityMeasure μ]\n (X : ℕ → Ω → ℝ) (hX_meas : ∀ i, Measurable (X i))\n (hContract : Contractable μ X)\n (hX_L2 : ∀ i, MemLp (X i) 2 μ) :\n ConditionallyIID μ X := by\n exact ((deFinetti_RyllNardzewski_equivalence_viaKoopman μ X hX_meas hX_L2).mp hContract).2\n","line":218,"end_line":230,"proof_status":"formalized"} | |
| {"id":"lem:condexp_lag_const","label":"condexp_lag_const","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["def:shiftInvariantSigma","def:exchangeable"],"nlp_text":"For exchangeable sequences, the conditional expectation of a product does not depend on the lag between coordinates.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaKoopman.condexp_lag_constant_from_exchangeability","latex_link":"sect0004.html#lem:condexp_lag_const","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaKoopman.condexp_lag_constant_from_exchangeability","lean_decl_name":"Exchangeability.DeFinetti.ViaKoopman.condexp_lag_constant_from_exchangeability","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaKoopman/InfraLagConstancy.lean","lean4_code":"/-- **Lag-constancy from exchangeability via transpositions** (Kallenberg's approach).\n\nFor EXCHANGEABLE measures μ on path space, the conditional expectation\nCE[f(ω₀)·g(ω_{k+1}) | ℐ] equals CE[f(ω₀)·g(ω_k) | ℐ] for k ≥ 1.\n\n**Key insight**: This uses EXCHANGEABILITY (not just stationarity). The proof is:\n1. Let τ be the transposition swapping indices k and k+1\n2. Exchangeability gives: Measure.map (reindex τ) μ = μ\n3. Since k ≥ 1, τ fixes 0: τ(0) = 0\n4. Therefore: CE[f(ω₀)·g(ω_{k+1}) | ℐ] = CE[(f∘τ)(ω₀)·(g∘τ)(ω_{k+1}) | ℐ]\n = CE[f(ω₀)·g(ω_k) | ℐ]\n\n**Why k ≥ 1 is required (CRITICAL)**:\n- When k=0, τ = swap(0, 1) does NOT fix 0 (τ sends 0 ↦ 1)\n- So (f∘τ)(ω₀) = f(ω₁) ≠ f(ω₀), breaking the argument\n- Counterexample for k=0: i.i.d. Bernoulli(1/2):\n * CE[ω₀·ω₁ | ℐ] = E[ω₀]·E[ω₁] = 1/4\n * CE[ω₀² | ℐ] = E[ω₀²] = 1/2 (since ω₀ ∈ {0,1})\n * These are NOT equal!\n\n**Why stationarity alone is NOT enough**: Stationary non-exchangeable processes\n(Markov chains, AR processes) can have lag-dependent conditional correlations.\nThe transposition trick requires the FULL permutation invariance of exchangeability. -/\nlemma condexp_lag_constant_from_exchangeability\n {α : Type*} [MeasurableSpace α] [StandardBorelSpace α]\n {μ : Measure (ℕ → α)} [IsProbabilityMeasure μ]\n (hExch : ∀ π : Equiv.Perm ℕ, Measure.map (Exchangeability.reindex π) μ = μ)\n (f g : α → ℝ)\n (hf_meas : Measurable f) (hf_bd : ∃ C, ∀ x, |f x| ≤ C)\n (hg_meas : Measurable g) (hg_bd : ∃ C, ∀ x, |g x| ≤ C)\n (k : ℕ) (hk : 0 < k) :\n μ[(fun ω => f (ω 0) * g (ω (k + 1))) | shiftInvariantSigma (α := α)]\n =ᵐ[μ]\n μ[(fun ω => f (ω 0) * g (ω k)) | shiftInvariantSigma (α := α)] := by\n -- Define the transposition τ = swap k (k+1)\n let τ := Equiv.swap k (k + 1)\n -- Define the two functions\n let F := fun ω : ℕ → α => f (ω 0) * g (ω (k + 1))\n let G := fun ω : ℕ → α => f (ω 0) * g (ω k)\n -- Key fact 1: F ∘ reindex τ = G\n have hFG : F ∘ Exchangeability.reindex τ = G := product_reindex_swap_eq f g k hk\n -- Key fact 2: μ.map (reindex τ) = μ (exchangeability)\n have hμ_inv : Measure.map (Exchangeability.reindex τ) μ = μ := hExch τ\n -- Key fact 3: reindex τ is measurable\n have hτ_meas : Measurable (Exchangeability.reindex (α := α) τ) :=\n Exchangeability.measurable_reindex (α := α) (π := τ)\n -- Both F and G are integrable (bounded measurable on probability space)\n obtain ⟨Cf, hCf⟩ := hf_bd\n obtain ⟨Cg, hCg⟩ := hg_bd\n have hF_meas : Measurable F := (hf_meas.comp (measurable_pi_apply 0)).mul\n (hg_meas.comp (measurable_pi_apply (k + 1)))\n have hG_meas : Measurable G := (hf_meas.comp (measurable_pi_apply 0)).mul\n (hg_meas.comp (measurable_pi_apply k))\n have hF_bd : ∀ ω, ‖F ω‖ ≤ Cf * Cg := fun ω => by\n simp only [Real.norm_eq_abs]\n calc |F ω| = |f (ω 0) * g (ω (k + 1))| := rfl\n _ = |f (ω 0)| * |g (ω (k + 1))| := abs_mul _ _\n _ ≤ Cf * Cg := mul_le_mul (hCf _) (hCg _) (abs_nonneg _)\n (le_trans (abs_nonneg _) (hCf (ω 0)))\n have hG_bd : ∀ ω, ‖G ω‖ ≤ Cf * Cg := fun ω => by\n simp only [Real.norm_eq_abs]\n calc |G ω| = |f (ω 0) * g (ω k)| := rfl\n _ = |f (ω 0)| * |g (ω k)| := abs_mul _ _\n _ ≤ Cf * Cg := mul_le_mul (hCf _) (hCg _) (abs_nonneg _)\n (le_trans (abs_nonneg _) (hCf (ω 0)))\n have hF_int : Integrable F μ := Integrable.of_bound hF_meas.aestronglyMeasurable (Cf * Cg)\n (Filter.Eventually.of_forall hF_bd)\n have hG_int : Integrable G μ := Integrable.of_bound hG_meas.aestronglyMeasurable (Cf * Cg)\n (Filter.Eventually.of_forall hG_bd)\n -- Strategy: Show ∫_s F = ∫_s G for all s ∈ mSI, then μ[F|mSI] = μ[G|mSI]\n have h_int_eq : ∀ s, MeasurableSet[shiftInvariantSigma (α := α)] s → μ s < ⊤ →\n ∫ ω in s, F ω ∂μ = ∫ ω in s, G ω ∂μ := fun s hs _ => by\n have hs_inv : isShiftInvariant (α := α) s := (mem_shiftInvariantSigma_iff (α := α)).mp hs\n exact setIntegral_eq_of_reindex_eq τ hμ_inv F G hFG hF_meas s hs_inv.1\n (reindex_swap_preimage_shiftInvariant k s hs_inv)\n -- Show ∫_s (F - G) = 0 for all s ∈ mSI, then use helper lemma\n have h_diff_zero : ∀ s, MeasurableSet[shiftInvariantSigma (α := α)] s → μ s < ⊤ →\n ∫ ω in s, (F - G) ω ∂μ = 0 := fun s hs hμs => by\n simp only [Pi.sub_apply, integral_sub hF_int.integrableOn hG_int.integrableOn,\n h_int_eq s hs hμs, sub_self]\n exact condExp_ae_eq_of_setIntegral_diff_eq_zero hF_int hG_int h_diff_zero\n","line":443,"end_line":523,"proof_status":"formalized"} | |
| {"id":"thm:monotone_class","label":"monotone_class","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["lem:pi_system"],"nlp_text":"The monotone class theorem allows extending from indicators to measurable functions.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.CommonEnding.monotone_class_theorem","latex_link":"sect0005.html#thm:monotone_class","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.CommonEnding.monotone_class_theorem","lean_decl_name":"Exchangeability.DeFinetti.CommonEnding.monotone_class_theorem","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/CommonEnding.lean","lean4_code":"/-- **FMP 1.1: Monotone Class Theorem (Sierpiński)** = Dynkin's π-λ theorem.\n\nLet 𝒞 be a π-system and 𝒟 a λ-system in some space Ω such that 𝒞 ⊆ 𝒟.\nThen σ(𝒞) ⊆ 𝒟.\n\n**Proof outline** (Kallenberg):\n1. Assume 𝒟 = λ(𝒞) (smallest λ-system containing 𝒞)\n2. Show 𝒟 is a π-system (then it's a σ-field)\n3. Two-step extension:\n - Fix B ∈ 𝒞, define 𝒜_B = {A : A ∩ B ∈ 𝒟}, show 𝒜_B is λ-system ⊇ 𝒞\n - Fix A ∈ 𝒟, define ℬ_A = {B : A ∩ B ∈ 𝒟}, show ℬ_A is λ-system ⊇ 𝒞\n\n**Mathlib version**: `MeasurableSpace.induction_on_inter`\n\nMathlib's version is stated as an induction principle: if a predicate C holds on:\n- The empty set\n- All sets in the π-system 𝒞\n- Is closed under complements\n- Is closed under countable disjoint unions\n\nThen C holds on all measurable sets in σ(𝒞).\n\n**Definitions in mathlib**:\n- `IsPiSystem`: A collection closed under binary non-empty intersections\n (Mathlib/MeasureTheory/PiSystem.lean)\n- `DynkinSystem`: A structure containing ∅, closed under complements and\n countable disjoint unions (Mathlib/MeasureTheory/PiSystem.lean)\n- `induction_on_inter`: The π-λ theorem as an induction principle\n (Mathlib/MeasureTheory/PiSystem.lean)\n\nThis theorem is now a direct wrapper around mathlib's `induction_on_inter`.\n-/\ntheorem monotone_class_theorem\n {Ω' : Type*} {m : MeasurableSpace Ω'} {C : ∀ s : Set Ω', MeasurableSet s → Prop}\n {s : Set (Set Ω')} (h_eq : m = MeasurableSpace.generateFrom s)\n (h_inter : IsPiSystem s)\n (empty : C ∅ .empty)\n (basic : ∀ t (ht : t ∈ s), C t <| h_eq ▸ .basic t ht)\n (compl : ∀ t (htm : MeasurableSet t), C t htm → C tᶜ htm.compl)\n (iUnion : ∀ f : ℕ → Set Ω', Pairwise (fun i j => Disjoint (f i) (f j)) →\n ∀ (hf : ∀ i, MeasurableSet (f i)), (∀ i, C (f i) (hf i)) →\n C (⋃ i, f i) (MeasurableSet.iUnion hf))\n {t : Set Ω'} (htm : MeasurableSet t) :\n C t htm := by\n -- Direct application of mathlib's π-λ theorem (induction_on_inter)\n exact MeasurableSpace.induction_on_inter h_eq h_inter empty basic compl iUnion t htm\n","line":618,"end_line":663,"proof_status":"formalized"} | |
| {"id":"thm:condIndep_extension","label":"condIndep_extension","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["thm:monotone_class"],"nlp_text":"Conditional independence on indicators extends to the full product \\(\\sigma \\)-algebra.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.CommonEnding.conditional_iid_from_directing_measure","latex_link":"sect0005.html#thm:condIndep_extension","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.CommonEnding.conditional_iid_from_directing_measure","lean_decl_name":"Exchangeability.DeFinetti.CommonEnding.conditional_iid_from_directing_measure","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/CommonEnding.lean","lean4_code":"theorem conditional_iid_from_directing_measure\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n (X : ℕ → Ω → α)\n (hX_meas : ∀ i, Measurable (X i))\n (ν : Ω → Measure α)\n (hν_prob : ∀ ω, IsProbabilityMeasure (ν ω))\n (hν_meas : ∀ s, MeasurableSet s → Measurable (fun ω => ν ω s))\n (h_bridge : ∀ {m : ℕ} (k : Fin m → ℕ), Function.Injective k → ∀ (B : Fin m → Set α),\n (∀ i, MeasurableSet (B i)) →\n ∫⁻ ω, ∏ i : Fin m,\n ENNReal.ofReal ((B i).indicator (fun _ => (1 : ℝ)) (X (k i) ω)) ∂μ\n = ∫⁻ ω, ∏ i : Fin m, ν ω (B i) ∂μ) :\n ConditionallyIID μ X := by\n -- Proof roadmap following Kallenberg's argument:\n --\n -- STEP 1: Package ν as satisfying the ConditionallyIID definition\n -- The definition requires: ∃ ν, (∀ ω, IsProbabilityMeasure (ν ω)) ∧\n -- (∀ B, MeasurableSet B → Measurable (fun ω => ν ω B)) ∧\n -- ∀ m k, StrictMono k → Measure.map (fun ω i => X (k i) ω) μ =\n -- μ.bind (fun ω => Measure.pi fun _ => ν ω)\n use ν, hν_prob, hν_meas\n\n intro m k hk_strict -- hk_strict : StrictMono k gives injectivity for h_bridge\n\n -- STEP 2: Show the finite-dimensional distributions match\n -- Need: Measure.map (fun ω => fun i : Fin m => X (k i) ω) μ\n -- = μ.bind (fun ω => Measure.pi fun _ : Fin m => ν ω)\n --\n -- Strategy: Use measure_eq_of_agree_on_pi_system with rectangles as the π-system\n\n -- Define the two measures we want to prove equal\n let μ_map := Measure.map (fun ω i => X (k i) ω) μ\n let μ_bind := μ.bind fun ω => Measure.pi fun _ : Fin m => ν ω\n\n -- Both are probability measures (via helpers)\n have h_map_prob : IsProbabilityMeasure μ_map :=\n map_coords_isProbabilityMeasure X hX_meas m k\n\n have h_bind_prob : IsProbabilityMeasure μ_bind :=\n bind_pi_isProbabilityMeasure ν hν_prob hν_meas m\n\n -- Define the π-system of measurable rectangles\n let C : Set (Set (Fin m → α)) := {S | ∃ (B : Fin m → Set α),\n (∀ i, MeasurableSet (B i)) ∧ S = {x | ∀ i, x i ∈ B i}}\n\n -- Show C is a π-system (already proved)\n have hC_pi : IsPiSystem C := rectangles_isPiSystem\n\n -- Show C generates the product σ-algebra (already proved)\n have hC_gen : (inferInstance : MeasurableSpace (Fin m → α)) =\n MeasurableSpace.generateFrom C := rectangles_generate_pi_sigma\n\n -- Apply measure_eq_of_agree_on_pi_system\n apply measure_eq_of_agree_on_pi_system μ_map μ_bind C hC_pi hC_gen\n\n -- Show both measures agree on rectangles\n intro S hS\n -- S is a rectangle, so S = {x | ∀ i, x i ∈ B i} for some B\n obtain ⟨B, hB_meas, rfl⟩ := hS\n\n -- LHS: μ_map {x | ∀ i, x i ∈ B i}\n have lhs_eq : μ_map {x | ∀ i, x i ∈ B i} = μ {ω | ∀ i, X (k i) ω ∈ B i} := by\n have hB := rectangle_as_pi_measurable m B hB_meas\n exact map_coords_apply X hX_meas m k _ hB\n\n -- RHS: μ_bind {x | ∀ i, x i ∈ B i}\n have rhs_eq : μ_bind {x | ∀ i, x i ∈ B i} =\n ∫⁻ ω, (Measure.pi fun i : Fin m => ν ω) {x | ∀ i, x i ∈ B i} ∂μ := by\n have hB := rectangle_as_pi_measurable m B hB_meas\n exact bind_pi_apply ν hν_prob hν_meas m _ hB\n\n -- Both equal by fidi_eq_avg_product\n rw [lhs_eq, rhs_eq]\n\n -- Apply fidi_eq_avg_product using the bridging hypothesis\n exact fidi_eq_avg_product X hX_meas ν hν_prob hν_meas m k B hB_meas\n (h_bridge (k := k) hk_strict.injective (B := B) hB_meas)\n","line":540,"end_line":616,"proof_status":"formalized"} | |
| {"id":"thm:conditionallyIID_of_contractable_martingale","label":"conditionallyIID_of_contractable_martingale","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["thm:condIndep_extension","def:conditionallyIID","lem:block_coord_condIndep","lem:directingMeasure_measurable","lem:directingMeasure_isProb"],"nlp_text":"If \\((X_n)\\) is contractable, then it is conditionally i.i.d. The directing kernel \\(\\nu (\\omega )(B) = \\mathbb {E}[\\mathbf{1}_{X_0 \\in B} \\mid \\mathcal{T}](\\omega )\\) is constructed from the tail \\(\\sigma \\)-algebra.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.conditionallyIID_of_contractable","latex_link":"sect0004.html#thm:conditionallyIID_of_contractable_martingale","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.conditionallyIID_of_contractable","lean_decl_name":"Exchangeability.DeFinetti.conditionallyIID_of_contractable","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/TheoremViaMartingale.lean","lean4_code":"/-- **Contractable ⇒ Conditionally i.i.d.** (via martingale).\n\nThis is the core result proved using reverse martingale convergence.\nThe proof constructs the directing measure ν from the tail σ-algebra\nand verifies the finite-dimensional product formula.\n\n**Proof strategy:**\n1. Define ν := directingMeasure X (constructed from tail σ-algebra)\n2. Collect three key facts: ν is probability, measurable, satisfies conditional law\n3. Apply finite_product_formula for strictly monotone selections\n4. Package as ConditionallyIID\n\n**Reference**: Kallenberg (2005), page 27-28, \"Third proof\".\n-/\ntheorem conditionallyIID_of_contractable\n [StandardBorelSpace Ω]\n {α : Type*} [MeasurableSpace α] [StandardBorelSpace α] [Nonempty α]\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n (X : ℕ → Ω → α) (hX_meas : ∀ i, Measurable (X i))\n (hContract : Contractable μ X) :\n ConditionallyIID μ X := by\n -- Directing measure from the tail σ-algebra\n let ν := directingMeasure (μ := μ) X hX_meas\n exact ⟨ν,\n directingMeasure_isProb X hX_meas,\n directingMeasure_measurable_eval X hX_meas,\n fun m k hk => finite_product_formula X hContract hX_meas ν\n (directingMeasure_isProb X hX_meas)\n (directingMeasure_measurable_eval X hX_meas)\n (fun n B hB => conditional_law_eq_directingMeasure X hContract hX_meas n B hB)\n m k hk⟩\n","line":56,"end_line":86,"proof_status":"formalized"} | |
| {"id":"def:conditionallyIID","label":"conditionallyIID","background_color":"#B0ECA3","border_color":"green","kind":"box","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":[],"nlp_text":"A sequence \\((X_n)_{n \\in \\mathbb {N}}\\) is conditionally i.i.d. with respect to measure \\(\\mu \\) if there exists a probability kernel \\(\\nu : \\Omega \\to \\mathrm{Measure}(\\alpha )\\) such that for any strictly monotone \\(k : \\mathrm{Fin}(m) \\to \\mathbb {N}\\), the joint distribution of \\((X_{k(0)}, \\ldots , X_{k(m-1)})\\) equals the mixture \\(\\mu .\\mathrm{bind}(\\omega \\mapsto \\nu (\\omega )^{\\otimes m})\\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.ConditionallyIID","latex_link":"sect0002.html#def:conditionallyIID","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.ConditionallyIID","lean_decl_name":"Exchangeability.ConditionallyIID","kind_description":"definitions","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"./paper/NOTES.md","lean4_code":"def ConditionallyIID (μ : Measure Ω) (X : ℕ → Ω → α) : Prop :=\n ∃ ν : Ω → Measure α,\n (∀ ω, IsProbabilityMeasure (ν ω)) ∧\n (∀ B, MeasurableSet B → Measurable (fun ω => ν ω B)) ∧\n ∀ m (k : Fin m → ℕ), StrictMono k →\n Measure.map (fun ω i => X (k i) ω) μ =\n μ.bind (fun ω => Measure.pi fun _ => ν ω)\n```\n\n### The Equivalence Chain\n\n```\n easy (permutation extension)\nExchangeable ←――――――――――――――――――――――――――――――――――→ Contractable\n ↓\n ↓ hard (3 proofs)\n ↓\n easy (kernel factorization) ↓\nExchangeable ←――――――――――――――――――――――――――――――――― ConditionallyIID\n```\n\nKey theorems:\n- `contractable_of_exchangeable` (Contractability.lean:486) - uses `exists_perm_extending_strictMono`\n- `exchangeable_of_conditionallyIID` (ConditionallyIID.lean:243) - direct from i.i.d. symmetry\n- `conditionallyIID_of_contractable` - **the hard direction** (3 independent proofs)\n\n### Why Contractability is \"Right\" for Formalization\n\n**1. Simpler Quantification**\n\nExchangeable quantifies over all permutations σ : Equiv.Perm (Fin n):\n- Permutation group structure\n- Need to handle composition, identity, inverses\n- Potentially complex reasoning about group actions\n\nContractable quantifies over strictly monotone functions k : Fin m → ℕ:\n- Just a function with a property\n- No group structure needed\n- StrictMono is a simple predicate\n\n**2. Direct Connection to Subsequences**\n\nContractability directly states: \"all strictly increasing subsequences have the same distribution\"\n\nThis matches:\n- Statistical sampling (select items 1, 3, 5, ... vs. 2, 4, 6, ...)\n- Thinning of point processes\n- Subsampling in time series\n\n","line":391,"end_line":439,"proof_status":"formalized"} | |
| {"id":"thm:exchangeable_of_conditionallyIID","label":"exchangeable_of_conditionallyIID","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["def:conditionallyIID","def:exchangeable"],"nlp_text":"If \\((X_n)\\) is conditionally i.i.d., then it is exchangeable.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.exchangeable_of_conditionallyIID","latex_link":"sect0003.html#thm:exchangeable_of_conditionallyIID","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.exchangeable_of_conditionallyIID","lean_decl_name":"Exchangeability.exchangeable_of_conditionallyIID","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/ConditionallyIID.lean","lean4_code":"/--\n**Main theorem:** Conditionally i.i.d. sequences are exchangeable.\n\n**Statement:** If `X` is conditionally i.i.d., then it is exchangeable (invariant\nunder finite permutations).\n\n**Proof strategy:**\n1. By `ConditionallyIID`, the law of `(X_0, ..., X_{n-1})` is `μ.bind(λω. ν(ω)^n)`\n (using the identity function, which is strictly monotone)\n2. Show that permuting coordinates after sampling from this mixture gives the same measure\n3. Use `pi_comp_perm` to show that permuting a product measure `ν^n` gives `ν^n` back\n4. Use `bind_map_comm` to push the permutation through the bind operation\n5. Therefore the law of `(X_{σ(0)}, ..., X_{σ(n-1)})` equals the law of `(X_0, ..., X_{n-1})`\n\n**Intuition:** Permuting the indices doesn't change the distribution because:\n- We're still integrating over the same random measure `ν`\n- For each fixed `ν`, permuting i.i.d. samples gives the same distribution (by `pi_comp_perm`)\n\n**Mathematical significance:** This proves one direction of de Finetti's theorem.\nThe converse (exchangeable ⇒ conditionally i.i.d.) is the deep content of de Finetti's\nrepresentation theorem and requires constructing the de Finetti measure from the\ntail σ-algebra.\n\nThis is the \"easy\" direction because we're given the mixing measure `ν` explicitly.\n-/\ntheorem exchangeable_of_conditionallyIID {μ : Measure Ω} {X : ℕ → Ω → α}\n (hX_meas : ∀ i, Measurable (X i)) (hX : ConditionallyIID μ X) :\n Exchangeable μ X := by\n intro n σ\n obtain ⟨ν, hν_prob, hν_meas_coe, hν_eq⟩ := hX\n have h_id : Measure.map (fun ω i => X i.val ω) μ =\n μ.bind (fun ω => Measure.pi fun _ : Fin n => ν ω) :=\n hν_eq n (fun i => i.val) (fun _ _ => id)\n have hXvec_meas : Measurable (fun ω => fun i : Fin n => X i.val ω) :=\n measurable_pi_lambda _ (fun i => hX_meas i.val)\n have hperm_meas : Measurable (fun f : Fin n → α => f ∘ σ) :=\n measurable_pi_lambda _ (fun i => measurable_pi_apply (σ i))\n calc Measure.map (fun ω i => X (σ i).val ω) μ\n = Measure.map (fun f => f ∘ σ) (Measure.map (fun ω i => X i.val ω) μ) :=\n (Measure.map_map hperm_meas hXvec_meas).symm\n _ = Measure.map (fun f => f ∘ σ) (μ.bind (fun ω => Measure.pi fun _ : Fin n => ν ω)) := by\n rw [h_id]\n _ = μ.bind (fun ω => Measure.map (fun f => f ∘ σ) (Measure.pi fun _ : Fin n => ν ω)) :=\n MeasureTheory.Measure.bind_map_comm\n (measurable_measure_pi ν hν_prob hν_meas_coe) hperm_meas\n _ = μ.bind (fun ω => Measure.pi fun _ : Fin n => ν ω) := by\n simp_rw [MeasureTheory.Measure.pi_comp_perm σ]\n _ = Measure.map (fun ω i => X i.val ω) μ := h_id.symm\n","line":207,"end_line":254,"proof_status":"formalized"} | |
| {"id":"lem:tailSigma_eq_iInf","label":"tailSigma_eq_iInf","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["def:futureFiltration","def:tailSigma"],"nlp_text":"\\(\\mathcal{T} = \\bigwedge _{m=0}^{\\infty } \\mathcal{F}_m\\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.tailSigma_eq_iInf_rev","latex_link":"sect0002.html#lem:tailSigma_eq_iInf","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.tailSigma_eq_iInf_rev","lean_decl_name":"Exchangeability.DeFinetti.ViaMartingale.tailSigma_eq_iInf_rev","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaMartingale/RevFiltration.lean","lean4_code":"@[simp]\nlemma tailSigma_eq_iInf_rev (X : ℕ → Ω → α) :\n tailSigma X = ⨅ m, revFiltration X m := rfl\n","line":65,"end_line":67,"proof_status":"formalized"} | |
| {"id":"lem:block_coord_condIndep","label":"block_coord_condIndep","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["lem:tail_factorization"],"nlp_text":"Coordinates are conditionally independent given the tail \\(\\sigma \\)-algebra.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.block_coord_condIndep","latex_link":"sect0004.html#lem:block_coord_condIndep","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.block_coord_condIndep","lean_decl_name":"Exchangeability.DeFinetti.ViaMartingale.block_coord_condIndep","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaMartingale/Factorization.lean","lean4_code":"/-- **Correct conditional independence from contractability (Kallenberg Lemma 1.3).**\n\nFor contractable X and r < m, the past block σ(X₀,...,X_{r-1}) and the single coordinate\nσ(X_r) are conditionally independent given the far future σ(θ_{m+1} X).\n\n**Mathematical statement:**\n```\nσ(X₀,...,X_{r-1}) ⊥⊥_{σ(θ_{m+1} X)} σ(X_r)\n```\n\n**Why this is correct:**\nBy contractability, deleting coordinate r doesn't change the joint distribution:\n```\n(X₀,...,X_{r-1}, θ_{m+1} X) =ᵈ (X₀,...,X_{r-1}, X_r, θ_{m+1} X)\n```\nwith σ(θ_{m+1} X) ⊆ σ(X_r, θ_{m+1} X).\n\nBy Kallenberg's Lemma 1.3: if (U, η) =ᵈ (U, ζ) and σ(η) ⊆ σ(ζ), then U ⊥⊥_η ζ.\nTaking U = (X₀,...,X_{r-1}), η = θ_{m+1} X, ζ = (X_r, θ_{m+1} X) gives the result.\n\n**This replaces the old broken `coordinate_future_condIndep` which incorrectly claimed\nY ⊥⊥_{σ(Y)} Y.**\n\n---\n\n**SIMPLIFIED PROOF PATH (using Kallenberg 1.3 infrastructure):**\n\nThe proof now uses `condExp_Xr_indicator_eq_of_contractable` which directly applies\nKallenberg 1.3 with the true contraction structure:\n- W = shiftRV X (m+1) (far future)\n- W' = (U, W) where U = firstRMap X r (first r coords)\n- Contraction: σ(W) ⊆ σ(U, W) = σ(W')\n- Pair law: (X_r, W) =^d (X_r, W') from contractability\n\nThis gives: E[1_{X_r ∈ B} | σ(U, W)] = E[1_{X_r ∈ B} | σ(W)]\nwhich is the indicator characterization of X_r ⊥⊥ U | W.\n\nThe old finite-level approximation approach is now deprecated. -/\nlemma block_coord_condIndep\n {Ω α : Type*} [MeasurableSpace Ω] [StandardBorelSpace Ω]\n [MeasurableSpace α] [StandardBorelSpace α]\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n (X : ℕ → Ω → α)\n (hX : Contractable μ X)\n (hX_meas : ∀ n, Measurable (X n))\n {r m : ℕ} (hrm : r < m) :\n ProbabilityTheory.CondIndep\n (futureFiltration X m) -- conditioning: σ(θ_{m+1} X)\n (firstRSigma X r) -- past block: σ(X₀,...,X_{r-1})\n (MeasurableSpace.comap (X r) inferInstance) -- single coord: σ(X_r)\n (futureFiltration_le X m hX_meas) -- witness: σ(θ_{m+1} X) ≤ ambient\n μ := by\n -- ═══════════════════════════════════════════════════════════════════════════════\n -- SIMPLIFIED PROOF using Kallenberg 1.3 infrastructure (condExp_Xr_indicator_eq_of_contractable)\n -- ═══════════════════════════════════════════════════════════════════════════════\n --\n -- This bypasses the old finite-level approximation which used the broken chain:\n -- condexp_indicator_eq_on_join_of_triple_law → condExp_eq_of_triple_law\n -- → condIndep_of_triple_law_INVALID\n --\n -- Instead, we use the correct Kallenberg 1.3 approach with true contraction:\n -- condExp_Xr_indicator_eq_of_contractable (at infinite level)\n --\n -- ═══════════════════════════════════════════════════════════════════════════════\n\n -- We use the \"indicator projection\" criterion for conditional independence.\n apply Exchangeability.Probability.condIndep_of_indicator_condexp_eq\n · exact firstRSigma_le_ambient X r hX_meas\n · intro s hs; rcases hs with ⟨t, ht, rfl⟩; exact (hX_meas r) ht\n\n -- For each H = (X r)⁻¹(B), prove the projection identity:\n -- μ[1_H | firstRSigma X r ⊔ futureFiltration X m] =ᵐ[μ] μ[1_H | futureFiltration X m]\n rintro H ⟨B, hB, rfl⟩\n\n -- Translate to the form expected by condExp_Xr_indicator_eq_of_contractable\n -- The σ-algebras match definitionally:\n -- - firstRSigma X r = comap (fun ω i => X i ω) inferInstance\n -- - futureFiltration X m = comap (shiftRV X (m+1)) inferInstance\n -- The goal becomes: μ[1_{(X r)⁻¹(B)} | comap U ⊔ comap W] =ᵐ[μ] μ[1_{(X r)⁻¹(B)} | comap W]\n -- which is exactly what condExp_Xr_indicator_eq_of_contractable provides.\n\n -- The goal after applying condIndep_of_indicator_condexp_eq is:\n -- μ[Set.indicator ((X r) ⁻¹' B) (fun _ => 1) | firstRSigma X r ⊔ futureFiltration X m]\n -- =ᵐ[μ] μ[Set.indicator ((X r) ⁻¹' B) (fun _ => 1) | futureFiltration X m]\n --\n -- This matches condExp_Xr_indicator_eq_of_contractable with:\n -- - Y = X r\n -- - U = (fun ω i => X i ω) (definitionally = firstRMap X r)\n -- - W = shiftRV X (m+1) (definitionally = futureFiltration generator)\n --\n -- The σ-algebra identities needed:\n -- - firstRSigma X r = comap U inferInstance ✓\n -- - futureFiltration X m = comap W inferInstance ✓\n --\n -- Thus the result follows from condExp_Xr_indicator_eq_of_contractable.\n exact condExp_Xr_indicator_eq_of_contractable hX hX_meas (Nat.le_of_lt hrm) hB\n","line":49,"end_line":144,"proof_status":"formalized"} | |
| {"id":"lem:cesaro_L2","label":"cesaro_L2","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["lem:kallenberg_L2_bound"],"nlp_text":"Block averages converge in L\\(^2\\) to the conditional expectation given the tail.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaL2.cesaro_to_condexp_L2","latex_link":"sect0004.html#lem:cesaro_L2","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaL2.cesaro_to_condexp_L2","lean_decl_name":"Exchangeability.DeFinetti.ViaL2.cesaro_to_condexp_L2","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaL2/CesaroConvergence.lean","lean4_code":"/-- **Cesàro averages converge in L² to a tail-measurable limit.**\n\nThis is the elementary L² route to de Finetti (Kallenberg's \"second proof\"):\n1. Kallenberg L² bound → Cesàro averages are Cauchy in L²\n2. Completeness of L² → limit α_f exists\n3. Block averages A_{N,n} are σ(X_{>N})-measurable → α_f is tail-measurable\n4. Tail measurability + L² limit → α_f = E[f(X_1) | tail σ-algebra]\n\n**No Mean Ergodic Theorem, no martingales** - just elementary L² space theory! -/\nlemma cesaro_to_condexp_L2\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n {X : ℕ → Ω → ℝ} (hX_contract : Exchangeability.Contractable μ X)\n (hX_meas : ∀ i, Measurable (X i))\n (f : ℝ → ℝ) (hf_meas : Measurable f) (hf_bdd : ∀ x, |f x| ≤ 1) :\n ∃ (α_f : Ω → ℝ), MemLp α_f 2 μ ∧\n AEStronglyMeasurable[TailSigma.tailSigma X] α_f μ ∧\n Tendsto (fun n => eLpNorm (blockAvg f X 0 n - α_f) 2 μ) atTop (𝓝 0) ∧\n α_f =ᵐ[μ] μ[(f ∘ X 0) | TailSigma.tailSigma X] := by\n -- Kallenberg's second proof (elementary L² approach)\n\n -- Define Z_i := f(X_i) - E[f(X_0)] (centered variables)\n let Z := fun i ω => f (X i ω) - ∫ ω', f (X 0 ω') ∂μ\n\n -- Step 1: Show {A_{0,n}}_n is Cauchy in L² using Kallenberg bound\n -- For any m, m' and large n: ‖A_{m,n} - A_{m',n}‖_L² ≤ C_f/√n\n -- Setting m=m'=0 with different n values: need to relate A_{0,n} and A_{0,n'}\n\n -- Step 1: Show block averages form a Cauchy sequence in L²\n -- Extracted to helper lemma to reduce proof complexity and isolate timeout source\n have hCauchy := blockAvg_cauchy_in_L2 hX_contract hX_meas f hf_meas hf_bdd\n\n -- Step 2: Extract L² limit using completeness of Hilbert space\n -- Lp(2, μ) is complete (Hilbert space), so Cauchy sequence converges\n have ⟨α_f, hα_memLp, hα_limit⟩ : ∃ α_f, MemLp α_f 2 μ ∧\n Tendsto (fun n => eLpNorm (blockAvg f X 0 n - α_f) 2 μ) atTop (𝓝 0) := by\n -- Apply cauchy_complete_eLpNorm to get L² limit\n\n -- Step 1: Show each blockAvg is in L²\n have hblockAvg_memLp : ∀ n, n > 0 → MemLp (blockAvg f X 0 n) 2 μ := by\n intro n hn_pos\n -- blockAvg is bounded since f is bounded\n apply memLp_two_of_bounded\n · -- Measurable: blockAvg is a finite sum of measurable functions\n show Measurable (fun ω => (n : ℝ)⁻¹ * (Finset.range n).sum (fun k => f (X (0 + k) ω)))\n exact Measurable.const_mul (Finset.measurable_sum _ fun k _ =>\n hf_meas.comp (hX_meas (0 + k))) _\n intro ω\n -- |blockAvg f X 0 n ω| ≤ 1 since |f| ≤ 1\n show |(n : ℝ)⁻¹ * (Finset.range n).sum (fun k => f (X (0 + k) ω))| ≤ 1\n calc |(n : ℝ)⁻¹ * (Finset.range n).sum (fun k => f (X (0 + k) ω))|\n = (n : ℝ)⁻¹ * |(Finset.range n).sum (fun k => f (X (0 + k) ω))| := by\n rw [abs_mul, abs_inv, abs_of_nonneg]\n exact Nat.cast_nonneg n\n _ ≤ (n : ℝ)⁻¹ * (Finset.range n).sum (fun k => |f (X (0 + k) ω)|) := by\n apply mul_le_mul_of_nonneg_left\n · exact Finset.abs_sum_le_sum_abs _ _\n · exact inv_nonneg.mpr (Nat.cast_nonneg n)\n _ ≤ (n : ℝ)⁻¹ * (Finset.range n).sum (fun k => 1) := by\n apply mul_le_mul_of_nonneg_left\n · apply Finset.sum_le_sum\n intro k _\n exact hf_bdd (X (0 + k) ω)\n · exact inv_nonneg.mpr (Nat.cast_nonneg n)\n _ = (n : ℝ)⁻¹ * n := by simp\n _ = 1 := by\n field_simp [Nat.pos_iff_ne_zero.mp hn_pos]\n\n -- For n = 0, handle separately\n have hblockAvg_memLp_all : ∀ n, MemLp (blockAvg f X 0 n) 2 μ := by\n intro n\n by_cases hn : n > 0\n · exact hblockAvg_memLp n hn\n · -- n = 0 case: blockAvg is just the constant 0 function\n have : n = 0 := by omega\n subst this\n -- When n=0, Finset.range 0 is empty, so sum = 0\n -- blockAvg f X 0 0 = 0⁻¹ * 0, which we treat as the zero function\n have h_eq : blockAvg f X 0 0 = fun ω => (0 : ℝ) := by\n ext ω\n simp [blockAvg, Finset.range_zero, Finset.sum_empty]\n rw [h_eq]\n -- Constant 0 function is in L² (bounded by 1)\n apply memLp_two_of_bounded (M := 1) measurable_const\n intro ω\n norm_num\n\n -- Step 2-5: Extract L² limit from Cauchy sequence\n --\n -- IMPLEMENTATION PLAN:\n --\n -- CHALLENGE: hCauchy is in classical ε-N form (∀ ε > 0, ∃ N, ...),\n -- but cauchy_complete_eLpNorm needs a bound sequence B : ℕ → ℝ≥0∞ with\n -- the condition ∀ N n m, N ≤ n → N ≤ m → eLpNorm (f n - f m) < B N\n --\n -- SOLUTION APPROACH (Subsequence method):\n --\n -- Step 2: Define geometric bound sequence\n -- let B : ℕ → ℝ≥0∞ := fun k => (1/2)^(k+1)\n --\n -- Step 3: Prove summability\n -- have hB_sum : (∑' i, B i) ≠ ∞ := by\n -- Use ENNReal.tsum_geometric_two\n -- ∑_{k=0}^∞ (1/2)^(k+1) = (1/2) · 2 = 1\n --\n -- Step 4: Extract thresholds using Classical.choose\n -- For each k, use hCauchy with ε = B k to get M_k\n -- have hM : ∀ k, ∃ M, ∀ n n', n ≥ M → n' ≥ M → eLpNorm (blockAvg n - blockAvg n') < B k\n -- let M_seq := fun k => Classical.choose (hM k)\n --\n -- Step 5: Build strictly increasing subsequence\n -- let n_k : ℕ → ℕ := Nat.rec (max 1 (M_seq 0)) (fun k' n_prev => max (n_prev + 1) (M_seq (k'+1)))\n -- This ensures: n_k < n_{k+1}, n_k ≥ M_seq k, n_k ≥ k (monotone + growth + threshold)\n --\n -- Step 6: Verify subsequence Cauchy condition\n -- have h_subseq_cau : ∀ N n m, N ≤ n → N ≤ m →\n -- eLpNorm (blockAvg (n_k n) - blockAvg (n_k m)) < B N\n -- Proof: n_k n ≥ n_k N ≥ M_seq N and n_k m ≥ M_seq N (by monotonicity)\n -- So apply hM_spec N (n_k n) (n_k m)\n --\n -- Step 7: Apply cauchy_complete_eLpNorm to subsequence\n -- obtain ⟨α_f_subseq, h_memLp, h_subseq_lim⟩ :=\n -- cauchy_complete_eLpNorm (hp := ...) (fun k => hblockAvg_memLp_all (n_k k)) hB_sum h_subseq_cau\n --\n -- Step 8: Show full sequence converges to same limit\n -- For any ε > 0:\n -- (a) Find N₁ s.t. for n ≥ N₁: eLpNorm (blockAvg n - blockAvg n') < ε/2 for all n' ≥ N₁\n -- (b) Find N₂ s.t. eLpNorm (blockAvg (n_k N₂) - α_f_subseq) < ε/2\n -- (c) Let N = max N₁ N₂, pick n ≥ N. Then n_k N ≥ n_k N₂ ≥ N₁ (growth), so:\n -- eLpNorm (blockAvg n - α_f_subseq)\n -- ≤ eLpNorm (blockAvg n - blockAvg (n_k N)) + eLpNorm (blockAvg (n_k N) - α_f_subseq)\n -- < ε/2 + ε/2 = ε\n --\n -- KEY MATHLIB LEMMAS:\n -- - ENNReal.tsum_geometric_two : ∑_{k=0}^∞ (1/2)^k = 2\n -- - Classical.choose and Classical.choose_spec : Extract witnesses from existentials\n -- - cauchy_complete_eLpNorm : Completeness of Lp spaces with bound sequence\n -- - Nat induction patterns for building recursive sequences\n --\n -- ALTERNATIVE SIMPLER APPROACH (if available):\n -- Search mathlib for a direct \"Cauchy in L² metric implies convergence\" result\n -- that doesn't require the specific bound sequence format.\n --\n -- Note: implement one of these approaches\n\n -- IMPLEMENTATION: Option A (CompleteSpace approach)\n -- Work in Lp ℝ 2 μ throughout, use completeness directly\n\n -- Step 1: Define sequence in L² space\n let u : ℕ → Lp ℝ 2 μ := fun n =>\n if hn : n > 0 then\n (hblockAvg_memLp n hn).toLp (blockAvg f X 0 n)\n else\n 0 -- n = 0 case\n\n -- Step 2: Prove sequence is Cauchy\n -- Use the simpler approach: dist = norm = eLpNorm.toReal\n have hCauchySeq : CauchySeq u := by\n rw [Metric.cauchySeq_iff]\n intro ε hε\n obtain ⟨N, hN⟩ := hCauchy (ENNReal.ofReal ε) (by simp [hε])\n use max N 1 -- Ensure N is at least 1\n intro n hn m hm\n -- For n, m ≥ max N 1, both are > 0, so we can unfold u\n have hn_pos : n > 0 := Nat.lt_of_lt_of_le (Nat.zero_lt_one) (Nat.le_trans (Nat.le_max_right N 1) hn)\n have hm_pos : m > 0 := Nat.lt_of_lt_of_le (Nat.zero_lt_one) (Nat.le_trans (Nat.le_max_right N 1) hm)\n have hn' : n ≥ N := Nat.le_trans (Nat.le_max_left N 1) hn\n have hm' : m ≥ N := Nat.le_trans (Nat.le_max_left N 1) hm\n simp only [u, dif_pos hn_pos, dif_pos hm_pos]\n -- Use dist = (eLpNorm ...).toReal and the fact that toLp preserves eLpNorm\n rw [dist_comm, dist_eq_norm, Lp.norm_def]\n -- Now goal is: eLpNorm (toLp m - toLp n) 2 μ).toReal < ε\n -- Use MemLp.toLp_sub to rewrite the difference\n rw [← (hblockAvg_memLp m hm_pos).toLp_sub (hblockAvg_memLp n hn_pos)]\n -- Now: (eLpNorm (coeFn (toLp (blockAvg m - blockAvg n))) 2 μ).toReal < ε\n -- coeFn of toLp is ae-equal to original, so eLpNorms are equal\n rw [eLpNorm_congr_ae (((hblockAvg_memLp m hm_pos).sub (hblockAvg_memLp n hn_pos)).coeFn_toLp)]\n -- Now: (eLpNorm (blockAvg m - blockAvg n) 2 μ).toReal < ε\n -- Use toReal_lt_of_lt_ofReal: if a < ofReal b then a.toReal < b\n exact ENNReal.toReal_lt_of_lt_ofReal (hN hm' hn')\n\n -- Step 3: Extract limit from completeness\n haveI : CompleteSpace (Lp ℝ 2 μ) := by infer_instance\n obtain ⟨α_L2, h_tendsto⟩ := cauchySeq_tendsto_of_complete hCauchySeq\n\n -- Step 4: Extract representative function\n -- α_L2 : Lp ℝ 2 μ is an ae-equivalence class\n -- In Lean 4, Lp coerces to a function type automatically\n let α_f : Ω → ℝ := α_L2\n\n -- Properties of α_f (using theorems, not fields)\n have hα_meas : StronglyMeasurable α_f := Lp.stronglyMeasurable α_L2\n have hα_memLp : MemLp α_f 2 μ := Lp.memLp α_L2\n\n have hα_limit : Tendsto (fun n => eLpNorm (blockAvg f X 0 n - α_f) 2 μ) atTop (𝓝 0) := by\n -- Use Lp.tendsto_Lp_iff_tendsto_eLpNorm': Tendsto f (𝓝 f_lim) ↔ Tendsto (eLpNorm (f - f_lim)) (𝓝 0)\n -- h_tendsto : Tendsto u atTop (𝓝 α_L2)\n rw [Lp.tendsto_Lp_iff_tendsto_eLpNorm'] at h_tendsto\n -- h_tendsto : Tendsto (fun n => eLpNorm (↑(u n) - ↑α_L2) 2 μ) atTop (𝓝 0)\n -- Need to show this equals eLpNorm (blockAvg n - α_f) eventually\n refine h_tendsto.congr' ?_\n filter_upwards [eventually_ge_atTop 1] with n hn\n have hn_pos : n > 0 := Nat.zero_lt_of_lt hn\n simp only [u, dif_pos hn_pos, α_f]\n -- Show: eLpNorm (↑(toLp (blockAvg n)) - ↑α_L2) 2 μ = eLpNorm (blockAvg n - ↑↑α_L2) 2 μ\n refine eLpNorm_congr_ae ?_\n filter_upwards [(hblockAvg_memLp n hn_pos).coeFn_toLp] with ω hω\n simp only [Pi.sub_apply, hω]\n\n -- Close the existential proof\n use α_f, hα_memLp, hα_limit\n\n -- Now α_f, hα_memLp, and hα_limit are in scope from the pattern match\n -- Provide the witness and the 4-tuple of proofs\n use α_f\n refine ⟨hα_memLp, ?_, hα_limit, ?_⟩\n\n -- Step 3: Show α_f is tail-measurable\n -- Use condexpL2 projection approach: α_L2 is fixed by projection ⟹ tail-measurable\n · -- Tail measurability via continuous projection\n -- IMPLEMENTATION APPROACH (from documentation):\n --\n -- GOAL: Measurable[TailSigma.tailSigma X] α_f\n --\n -- STRATEGY: Closedness of measurable subspaces in L²\n --\n -- Step 1: σ-algebra measurability of block averages\n -- For each N, define m_ge N := σ(X_N, X_{N+1}, ...)\n -- Claim: blockAvg f X N n is Measurable[m_ge N]\n -- Proof: blockAvg f X N n = (1/n) * ∑_{j<n} f(X_{N+j})\n -- Each f(X_{N+j}) is Measurable[σ(X_{N+j})] ≤ Measurable[m_ge N]\n -- So sum and scalar mult preserve this\n --\n -- Step 2: Decreasing sequence property\n -- Note: σ(X_{≥k}) ⊆ σ(X_{≥N}) for all k ≥ N\n -- So if g is Measurable[σ(X_{≥k})], then g is also Measurable[σ(X_{≥N})]\n --\n -- Step 3: Closed subspace property\n -- KEY LEMMA NEEDED: The set S_N := {h ∈ L² | Measurable[m_ge N] h}\n -- is a closed subspace of L²\n --\n -- This is because:\n -- - condexpL2 : L² → S_N is a continuous linear projection\n -- - Range of continuous projection is closed\n -- - See: Range of condExpL2 is closed (implicit in definition)\n --\n -- Step 4: Limit argument\n -- Fix N. For all n ≥ N:\n -- blockAvg f X 0 n uses X_0, ..., X_{n-1}\n -- Since n ≥ N, this includes X_N, ..., X_{n-1}\n -- But wait - blockAvg f X 0 n uses X_0, ..., X_{N-1} too!\n --\n -- CORRECTION: Use diagonal sequence\n -- Define g_k := blockAvg f X k n_k for suitable n_k\n -- Then g_k is Measurable[σ(X_{≥k})] and g_k → α_L2 in L²\n --\n -- For fixed N and all k ≥ N:\n -- g_k is Measurable[σ(X_{≥k})] ⊆ Measurable[σ(X_{≥N})]\n -- So (g_k)_{k≥N} ⊆ S_N\n --\n -- Since S_N is closed and g_k → α_L2, we have α_L2 ∈ S_N\n -- Therefore α_L2 is Measurable[σ(X_{≥N})] for all N\n --\n -- Step 5: Tail σ-algebra is intersection\n -- TailSigma.tailSigma X = ⋂_N σ(X_{≥N})\n -- Since α_L2 is Measurable[σ(X_{≥N})] for all N,\n -- we have α_L2 is Measurable[TailSigma.tailSigma X]\n --\n -- Step 6: Transfer to representative\n -- Have: α_f =ᵐ α_L2 and Measurable[TailSigma.tailSigma X] α_L2\n -- Need: Measurable[TailSigma.tailSigma X] α_f\n --\n -- This follows from: Measurability is preserved under ae-modification\n -- when we have a specific representative\n --\n -- INFRASTRUCTURE NEEDED:\n -- 1. Lemma: blockAvg f X m n is Measurable[σ(X_m, ..., X_{m+n-1})]\n -- 2. Lemma: Closed subspace property of {h : Measurable[m] h}\n -- 3. Lemma: Intersection of σ-algebras and measurability\n -- 4. Lemma: Transfer measurability via ae-equality\n --\n -- STATUS: This is a substantial proof requiring careful handling of\n -- sub-σ-algebras and closedness in L². The infrastructure\n -- may not be readily available in current mathlib.\n --\n -- ALTERNATIVE: Use existing results about conditional expectation\n -- and measurability of limits in Lp spaces if available\n\n -- Use the helper lemma that proves tail measurability from L² convergence\n exact tail_measurability_of_blockAvg f hf_meas hf_bdd hX_meas α_f hα_memLp hα_limit\n\n -- Step 4: Identify α_f = E[f(X_1)|tail] using tail-event integrals\n -- For any tail event A:\n -- E[f(X_1) 1_A] = E[f(X_j) 1_A] for any j (by exchangeability + tail invariance)\n -- = lim_{n→∞} (1/n) ∑ E[f(X_j) 1_A] (average over large block)\n -- = lim_{n→∞} E[A_{0,n} 1_A] (by linearity)\n -- = E[α_f 1_A] (by L² convergence)\n -- Therefore α_f is the conditional expectation\n · -- Identification as conditional expectation\n -- IMPLEMENTATION PLAN (from user guidance):\n --\n -- GOAL: α_f =ᵐ[μ] μ[(f ∘ X 0) | TailSigma.tailSigma X]\n --\n -- STRATEGY: Show equal set integrals on tail events, then invoke uniqueness\n --\n -- KEY UNIQUENESS LEMMA TO USE:\n -- MeasureTheory.ae_eq_of_forall_setIntegral_eq_of_sigmaFinite'\n -- from MeasureTheory.Function.ConditionalExpectation.Unique\n --\n -- Signature (roughly):\n -- If f, g are AEStronglyMeasurable' m and have equal integrals on all\n -- m-measurable sets (with [SigmaFinite (μ.trim hm)]), then f =ᵐ[μ] g\n --\n -- So we must prove: ∀ A ∈ TailSigma.tailSigma X,\n -- ∫ x in A, (f ∘ X 0) x ∂μ = ∫ x in A, α_f x ∂μ\n --\n -- PROOF STRUCTURE:\n --\n -- Part (i): Exchangeability moves indices under tail events\n -- - For a tail set A and any j:\n -- ∫ x in A, (f ∘ X j) x ∂μ = ∫ x in A, (f ∘ X 0) x ∂μ\n -- - Reason: finite permutation σ with σ(0)=j preserves law of whole sequence\n -- - Tail sets invariant under finite permutations\n -- - So joint law of (1_A, X_j) equals that of (1_A, X_0)\n -- - Therefore set integrals are equal\n --\n -- Implementation approach:\n -- - Use measure-preserving equivalence (see Constructions.Pi for pattern)\n -- - Or: directly from exchangeability definition (invariance under finite perms)\n -- - Key: \"set integral under measure preserving equivalence\" + A invariant\n --\n -- Part (ii): Pass to block averages and take L² limit\n -- - From (i): ∫_A ( (1/n) ∑_{j<n} f∘X j ) dμ = ∫_A f∘X 0 dμ\n -- - LHS = ∫_A blockAvg f X 0 n dμ\n -- - Need to show: ∫_A blockAvg f X 0 n dμ → ∫_A α_f dμ as n→∞\n --\n -- How to get set-integral convergence from L² convergence:\n --\n -- METHOD 1 (Hölder on sets - RECOMMENDED):\n -- For any measurable A with μ A < ∞:\n -- |∫_A (g_n - α_f) dμ| ≤ (μ A)^{1/2} * ‖g_n - α_f‖₂ → 0\n -- by Cauchy-Schwarz / Hölder with p=q=2\n --\n -- Mathlib location: MeasureTheory.Integral.MeanInequalities\n -- (Look for Hölder inequality for set integrals)\n --\n -- One-line proof once you have the setup:\n -- apply norm_setIntegral_le_of_norm_le_const_ae\n -- or similar Hölder variant\n --\n -- METHOD 2 (Dominated convergence on the set):\n -- With uniform bound + IsFiniteMeasure, can use dominated convergence\n -- But Hölder is more direct here\n --\n -- Either way: ∫_A blockAvg f X 0 n ∂μ → ∫_A α_f ∂μ\n --\n -- Part (iii): Invoke uniqueness lemma\n -- Now we have:\n -- - ∫_A α_f ∂μ = ∫_A f∘X 0 ∂μ for all tail A\n -- - AEStronglyMeasurable'[TailSigma.tailSigma X] α_f μ (from Sorry #3)\n -- - AEStronglyMeasurable'[TailSigma.tailSigma X] (f ∘ X 0) (easy)\n --\n -- Set up for uniqueness lemma:\n -- have hm : TailSigma.tailSigma X ≤ m0 := ... -- ambient σ-algebra\n -- haveI : SigmaFinite (μ.trim hm) := inferInstance\n -- -- from IsFiniteMeasure μ (trimming preserves finiteness)\n --\n -- apply MeasureTheory.ae_eq_of_forall_setIntegral_eq_of_sigmaFinite'\n -- hm\n -- (integrability of f ∘ X 0 on sets)\n -- (integrability of α_f on sets)\n -- (set integral equality proven above)\n -- (tail_aesm from Sorry #3)\n -- (stronglyMeasurable_condExp for conditional expectation)\n --\n -- MATHLIB HOOKS NEEDED:\n -- - MeasureTheory.ae_eq_of_forall_setIntegral_eq_of_sigmaFinite'\n -- (uniqueness lemma)\n -- - MeasureTheory.Integral.MeanInequalities\n -- (Hölder for L² → set integral convergence)\n -- - Measure.Trim\n -- (to get SigmaFinite on trimmed measure from IsFiniteMeasure)\n -- - Measure-preserving equivalences in Constructions.Pi\n -- (for exchangeability → set integral equality)\n --\n -- IMPLEMENTATION STRUCTURE:\n --\n -- Step (i): Exchangeability implies equal set integrals on tail events\n -- Claim: ∀ A ∈ tailSigma, ∀ j, ∫_A f(X_j) dμ = ∫_A f(X_0) dμ\n -- Proof: Use Exchangeability.Contractable + tail invariance under permutations\n -- Alternative: Use condExp_shift_eq_condExp axiom from ShiftInvariance.lean\n --\n -- Step (ii): Block averages have constant set integral on tail events\n -- Claim: ∀ A ∈ tailSigma, ∫_A blockAvg_n dμ = ∫_A f(X_0) dμ for all n\n -- Proof: blockAvg_n = (1/n) ∑_{j<n} f(X_j), use linearity + Step (i)\n --\n -- Step (iii): L² convergence → set integral convergence\n -- Claim: ∫_A blockAvg_n dμ → ∫_A α_f dμ as n → ∞\n -- Proof: Use tendsto_setIntegral_of_L1' with L² → L¹ conversion\n --\n -- Step (iv): Combine for set integral equality\n -- From (ii): ∫_A blockAvg_n dμ = ∫_A f(X_0) dμ (constant)\n -- From (iii): ∫_A blockAvg_n dμ → ∫_A α_f dμ\n -- Therefore: ∫_A α_f dμ = ∫_A f(X_0) dμ for all tail A\n --\n -- Step (v): Apply uniqueness lemma\n -- Use ae_eq_of_forall_setIntegral_eq_of_sigmaFinite' with:\n -- - α_f is AEStronglyMeasurable[tailSigma] (from Sorry #3)\n -- - μ[f ∘ X 0 | tail] is AEStronglyMeasurable[tailSigma] (by defn of condexp)\n -- - Equal integrals on all tail sets (Step iv)\n --\n -- INFRASTRUCTURE REQUIREMENTS:\n -- 1. Contractable/Exchangeable → set integral invariance on tail events\n -- Key: Use condExp_shift_eq_condExp axiom from ShiftInvariance.lean\n -- ∫_A f(X_j) dμ = ∫ 1_A · μ[f(X_j)|tail] dμ = ∫ 1_A · μ[f(X_0)|tail] dμ = ∫_A f(X_0) dμ\n -- 2. L² → set integral convergence (Hölder: |∫_A g dμ| ≤ μ(A)^{1/2} · ‖g‖₂)\n -- Use: tendsto_setIntegral_of_L1 or norm_setIntegral_le_of_norm_le_const_ae\n -- 3. Uniqueness: ae_eq_of_forall_setIntegral_eq_of_sigmaFinite\n --\n -- === PROOF STRUCTURE ===\n -- Goal: α_f =ᵐ[μ] μ[(f ∘ X 0) | TailSigma.tailSigma X]\n -- Strategy: Show equal set integrals on tail events, then invoke uniqueness\n --\n -- Key lemmas used:\n -- 1. setIntegral_comp_shift_eq: ∫_A f(X_k) = ∫_A f(X_0) for tail sets A\n -- 2. ae_eq_condExp_of_forall_setIntegral_eq: uniqueness of conditional expectation\n -- 3. tendsto_setIntegral_of_L1': L² → L¹ → set integral convergence\n --\n -- Step 1: Sub-σ-algebra condition\n -- Step 2: Set up SigmaFinite for trimmed measure\n -- Step 3: Show integrability conditions\n -- Step 4: Show set integral equality via:\n -- (a) ∫_A blockAvg_n = ∫_A f(X_0) (by setIntegral_comp_shift_eq + linearity)\n -- (b) ∫_A blockAvg_n → ∫_A α_f (by L² → set integral convergence)\n -- Step 5: Apply uniqueness lemma\n\n -- The key relationship: TailSigma.tailSigma X = tailProcess X\n -- This follows from the re-export in BlockAverages.lean\n\n -- Step 1: Sub-σ-algebra condition\n have hm : TailSigma.tailSigma X ≤ (inferInstance : MeasurableSpace Ω) :=\n TailSigma.tailSigma_le X hX_meas\n\n -- Step 2: SigmaFinite for trimmed measure (automatic for probability measures)\n haveI h_finite : IsFiniteMeasure (μ.trim hm) := by\n constructor\n rw [trim_measurableSet_eq hm MeasurableSet.univ]\n exact measure_lt_top μ Set.univ\n haveI : SigmaFinite (μ.trim hm) := @IsFiniteMeasure.toSigmaFinite _ _ _ h_finite\n\n -- Step 3: Integrability of f ∘ X 0 (bounded function on probability space)\n have hfX0_int : Integrable (f ∘ X 0) μ := by\n -- Bounded functions on probability spaces are integrable\n have h_memLp2 : MemLp (f ∘ X 0) 2 μ := by\n apply MemLp.of_bound (hf_meas.comp (hX_meas 0)).aestronglyMeasurable 1\n filter_upwards with ω\n simp only [Real.norm_eq_abs, Function.comp_apply]\n exact hf_bdd (X 0 ω)\n -- MemLp 2 → MemLp 1 on probability spaces (since 1 ≤ 2)\n have h_memLp1 : MemLp (f ∘ X 0) 1 μ := h_memLp2.mono_exponent one_le_two\n exact memLp_one_iff_integrable.mp h_memLp1\n\n -- Apply uniqueness lemma: ae_eq_condExp_of_forall_setIntegral_eq\n -- This shows α_f = condExp if they have equal set integrals and α_f is tail-measurable\n apply ae_eq_condExp_of_forall_setIntegral_eq hm hfX0_int\n\n -- Condition 1: α_f is integrable on finite-measure tail sets\n · intro s hs hμs\n exact (hα_memLp.integrable one_le_two).integrableOn\n\n -- Condition 2: Set integrals are equal\n · intro A hA hμA\n -- Convert MeasurableSet from TailSigma.tailSigma to tailProcess\n -- (They are definitionally equal via the re-export in BlockAverages.lean)\n have hA_tail : MeasurableSet[Exchangeability.Tail.tailProcess X] A := hA\n\n -- Step (a): Show ∫_A f(X k) = ∫_A f(X 0) for all k using setIntegral_comp_shift_eq\n have h_shift_eq : ∀ k, ∫ ω in A, f (X k ω) ∂μ = ∫ ω in A, f (X 0 ω) ∂μ :=\n fun k => Exchangeability.Tail.ShiftInvariance.setIntegral_comp_shift_eq X hX_contract hX_meas f hf_meas hA_tail hfX0_int k\n\n -- Step (b): Show ∫_A blockAvg n = ∫_A f(X 0) for all n > 0\n -- blockAvg f X 0 n ω = (1/n) * ∑ k : Fin n, f (X k ω)\n -- By linearity: ∫_A (1/n * ∑ f(X k)) = (1/n) * ∑ ∫_A f(X k) = (1/n) * n * ∫_A f(X 0) = ∫_A f(X 0)\n have h_blockAvg_eq : ∀ n > 0, ∫ ω in A, blockAvg f X 0 n ω ∂μ = ∫ ω in A, f (X 0 ω) ∂μ := by\n intro n hn\n -- Each f ∘ X k is integrable (bounded function on probability space)\n have hfXk_int : ∀ k, Integrable (fun ω => f (X k ω)) μ := fun k => by\n have h_memLp2 : MemLp (fun ω => f (X k ω)) 2 μ := by\n apply MemLp.of_bound (hf_meas.comp (hX_meas k)).aestronglyMeasurable 1\n filter_upwards with ω\n simp only [Real.norm_eq_abs]\n exact hf_bdd (X k ω)\n exact (h_memLp2.mono_exponent one_le_two).integrable le_rfl\n -- Unfold blockAvg: blockAvg f X 0 n ω = (n:ℝ)⁻¹ * ∑_{k∈range n} f(X (0+k) ω)\n -- For m = 0, this is (n:ℝ)⁻¹ * ∑_{k∈range n} f(X k ω)\n simp only [blockAvg, zero_add]\n -- Rewrite using scalar multiplication\n have h_scalar : ∫ ω in A, (↑n : ℝ)⁻¹ * ∑ k ∈ Finset.range n, f (X k ω) ∂μ =\n (↑n : ℝ)⁻¹ * ∫ ω in A, ∑ k ∈ Finset.range n, f (X k ω) ∂μ := by\n simp_rw [← smul_eq_mul]\n exact MeasureTheory.integral_smul _ _\n rw [h_scalar]\n -- Sum pullout: ∫_A (∑ ...) = ∑ ∫_A ...\n rw [MeasureTheory.integral_finset_sum _ (fun k _ => (hfXk_int k).integrableOn.integrable)]\n -- Apply shift invariance: ∑ ∫_A f(X k) = ∑ ∫_A f(X 0) = n * ∫_A f(X 0)\n simp_rw [h_shift_eq]\n rw [Finset.sum_const, Finset.card_range, nsmul_eq_mul]\n -- Simplify: n⁻¹ * (n * ∫_A f(X 0)) = ∫_A f(X 0) (since n > 0)\n field_simp\n\n -- Step (c): Show ∫_A blockAvg n → ∫_A α_f using L² convergence\n -- Use Hölder: |∫_A (g - h)| ≤ μ(A)^(1/2) * ‖g - h‖₂\n -- L² convergence + bounded measure gives set integral convergence\n have h_setInt_tendsto : Tendsto (fun n => ∫ ω in A, blockAvg f X 0 n ω ∂μ)\n atTop (𝓝 (∫ ω in A, α_f ω ∂μ)) := by\n -- Need MemLp for each blockAvg n (bounded functions on probability spaces)\n have h_blockAvg_memLp : ∀ n, MemLp (blockAvg f X 0 n) 2 μ := fun n => by\n apply MemLp.of_bound (blockAvg_measurable f X hf_meas hX_meas 0 n).aestronglyMeasurable 1\n filter_upwards with ω\n simp only [Real.norm_eq_abs, blockAvg]\n -- |n⁻¹ * ∑ f(X k)| ≤ n⁻¹ * n = 1\n rw [abs_mul, abs_of_nonneg (inv_nonneg.mpr (Nat.cast_nonneg n))]\n calc (n : ℝ)⁻¹ * |(Finset.range n).sum (fun k => f (X (0 + k) ω))|\n ≤ (n : ℝ)⁻¹ * n := by\n apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr (Nat.cast_nonneg n))\n calc |(Finset.range n).sum (fun k => f (X (0 + k) ω))|\n ≤ (Finset.range n).sum (fun k => |f (X (0 + k) ω)|) :=\n Finset.abs_sum_le_sum_abs _ _\n _ ≤ (Finset.range n).sum (fun _ => 1) := by\n apply Finset.sum_le_sum; intro k _\n simp only [zero_add]; exact hf_bdd (X k ω)\n _ = n := by simp only [Finset.sum_const, Finset.card_range, nsmul_one]\n _ ≤ 1 := by by_cases hn : n = 0 <;> simp [hn]\n -- Use auxiliary lemma\n have hA_meas : MeasurableSet A := hm A hA\n exact tendsto_setIntegral_of_L2_tendsto hA_meas h_blockAvg_memLp hα_memLp hα_limit\n\n -- Step (d): Combine: constant sequence converges to unique limit\n -- From (b): the sequence ∫_A blockAvg n is eventually constant at ∫_A f(X 0)\n -- From (c): it converges to ∫_A α_f\n -- Therefore ∫_A α_f = ∫_A f(X 0)\n have h_const : ∀ᶠ n in atTop, ∫ ω in A, blockAvg f X 0 n ω ∂μ = ∫ ω in A, f (X 0 ω) ∂μ := by\n filter_upwards [eventually_gt_atTop 0] with n hn\n exact h_blockAvg_eq n hn\n -- The limit of an eventually constant sequence equals that constant\n have h_lim_eq_const : Tendsto (fun n => ∫ ω in A, blockAvg f X 0 n ω ∂μ)\n atTop (𝓝 (∫ ω in A, f (X 0 ω) ∂μ)) := by\n apply tendsto_const_nhds.congr'\n filter_upwards [h_const] with n hn\n exact hn.symm\n exact tendsto_nhds_unique h_setInt_tendsto h_lim_eq_const\n\n -- Condition 3: α_f is tail-measurable\n · exact tail_measurability_of_blockAvg f hf_meas hf_bdd hX_meas α_f hα_memLp hα_limit\n","line":2310,"end_line":2862,"proof_status":"formalized"} | |
| {"id":"lem:cesaro_L1","label":"cesaro_L1","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["lem:cesaro_L2"],"nlp_text":"Block averages converge in L\\(^1\\) to the conditional expectation given the tail.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaL2.cesaro_to_condexp_L1","latex_link":"sect0004.html#lem:cesaro_L1","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaL2.cesaro_to_condexp_L1","lean_decl_name":"Exchangeability.DeFinetti.ViaL2.cesaro_to_condexp_L1","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaL2/CesaroConvergence.lean","lean4_code":"/-- **L¹ version via L² → L¹ conversion.**\n\nFor bounded functions on probability spaces, L² convergence implies L¹ convergence\n(by Cauchy-Schwarz: ‖f‖₁ ≤ ‖f‖₂ · ‖1‖₂ = ‖f‖₂).\n\nThis gives the L¹ convergence needed for the rest of the ViaL2 proof. -/\nlemma cesaro_to_condexp_L1\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n {X : ℕ → Ω → ℝ} (hX_contract : Exchangeability.Contractable μ X)\n (hX_meas : ∀ i, Measurable (X i))\n (f : ℝ → ℝ) (hf_meas : Measurable f) (hf_bdd : ∀ x, |f x| ≤ 1) :\n ∀ ε > 0, ∃ (M : ℕ), ∀ (m : ℕ), m ≥ M →\n ∫ ω, |(1 / (m : ℝ)) * ∑ i : Fin m, f (X i ω) -\n (μ[(f ∘ X 0) | TailSigma.tailSigma X] ω)| ∂μ < ε := by\n -- Get L² convergence from cesaro_to_condexp_L2\n obtain ⟨α_f, hα_L2, hα_tail, hα_conv, hα_eq⟩ := cesaro_to_condexp_L2 hX_contract hX_meas f hf_meas hf_bdd\n\n intro ε hε\n\n -- Convert L² convergence to L¹ convergence\n -- On probability spaces: ‖f - g‖₁ ≤ ‖f - g‖₂ (by Cauchy-Schwarz with ‖1‖₂ = 1)\n -- So L² → 0 implies L¹ → 0\n\n -- Available from cesaro_to_condexp_L2:\n -- • α_f : Ω → ℝ - the L² limit\n -- • hα_L2 : MemLp α_f 2 μ - α_f is in L²\n -- • hα_tail : Measurable[TailSigma.tailSigma X] α_f - α_f is tail-measurable\n -- • hα_conv : Tendsto (fun n => eLpNorm (blockAvg f X 0 n - α_f) 2 μ) atTop (𝓝 0)\n -- • hα_eq : α_f =ᵐ[μ] μ[f ∘ X 0 | TailSigma.tailSigma X]\n\n -- STEP 1: Convert eLpNorm convergence to plain integral form\n -- eLpNorm g 2 μ = (∫ |g|² ∂μ)^(1/2), so squaring both sides and using continuity\n -- First, show that each difference is in L²\n have h_diff_memLp : ∀ n, MemLp (fun ω => blockAvg f X 0 n ω - α_f ω) 2 μ := by\n intro n\n have h_blockAvg_memLp : MemLp (blockAvg f X 0 n) 2 μ := by\n apply MemLp.of_bound (blockAvg_measurable f X hf_meas hX_meas 0 n).aestronglyMeasurable 1\n exact ae_of_all μ (fun ω => (Real.norm_eq_abs _).le.trans (blockAvg_abs_le_one f X hf_bdd 0 n ω))\n exact h_blockAvg_memLp.sub hα_L2\n\n have hL2_integral : Tendsto (fun n => ∫ ω, (blockAvg f X 0 n ω - α_f ω)^2 ∂μ) atTop (𝓝 0) := by\n -- Define gn := blockAvg f X 0 n - α_f for notational convenience\n -- Goal: Tendsto (fun n => ∫ ω, (gn ω)² ∂μ) atTop (𝓝 0)\n -- From hα_conv: Tendsto (fun n => eLpNorm gn 2 μ) atTop (𝓝 0)\n\n -- Step 1: Convert ENNReal convergence to ℝ via ENNReal.tendsto_toReal\n have h_toReal : Tendsto (fun n => (eLpNorm (blockAvg f X 0 n - α_f) 2 μ).toReal) atTop (𝓝 0) := by\n rw [← ENNReal.toReal_zero]\n exact (ENNReal.tendsto_toReal ENNReal.zero_ne_top).comp hα_conv\n\n -- Step 2: Square using Tendsto.pow (0² = 0)\n have h_sq : Tendsto (fun n => (eLpNorm (blockAvg f X 0 n - α_f) 2 μ).toReal ^ 2) atTop (𝓝 0) := by\n have h_zero_sq : (0 : ℝ) ^ 2 = 0 := by norm_num\n rw [← h_zero_sq]\n exact h_toReal.pow 2\n\n -- Step 3: Relate squared toReal to integral of squared function\n -- Key identity: For MemLp g 2 μ real-valued:\n -- (eLpNorm g 2 μ).toReal² = ∫ g² dμ\n suffices h_eq : ∀ n, (eLpNorm (blockAvg f X 0 n - α_f) 2 μ).toReal ^ 2 =\n ∫ ω, (blockAvg f X 0 n ω - α_f ω)^2 ∂μ by\n simp_rw [← h_eq]\n exact h_sq\n\n -- Prove the equality for each n using MemLp.eLpNorm_eq_integral_rpow_norm\n intro n\n have hgn_memLp : MemLp (blockAvg f X 0 n - α_f) 2 μ := h_diff_memLp n\n -- Use MemLp.eLpNorm_eq_integral_rpow_norm:\n -- eLpNorm g 2 μ = ENNReal.ofReal ((∫ a, ‖g a‖ ^ 2 ∂μ) ^ (1/2))\n have hp_ne_zero : (2 : ENNReal) ≠ 0 := by norm_num\n have hp_ne_top : (2 : ENNReal) ≠ ⊤ := by norm_num\n have h_eq_ofReal := MemLp.eLpNorm_eq_integral_rpow_norm hp_ne_zero hp_ne_top hgn_memLp\n simp only [ENNReal.toReal_ofNat, inv_eq_one_div] at h_eq_ofReal\n -- Now: eLpNorm g 2 μ = ENNReal.ofReal ((∫ a, ‖g a‖² ∂μ)^(1/2))\n -- Taking toReal: (eLpNorm g 2 μ).toReal = (∫ a, ‖g a‖² ∂μ)^(1/2) (for nonneg integral)\n -- First, establish the integral is nonneg (needed for ofReal/toReal)\n -- Note: Use (2 : ℝ) to match MemLp.eLpNorm_eq_integral_rpow_norm which uses p.toReal\n have h_integral_nonneg : 0 ≤ ∫ a, ‖(blockAvg f X 0 n - α_f) a‖ ^ (2 : ℝ) ∂μ :=\n integral_nonneg (fun _ => Real.rpow_nonneg (norm_nonneg _) _)\n -- Key: (eLpNorm g 2 μ).toReal² = ∫ g² dμ\n -- Compute step by step\n have h_sqrt_nonneg : 0 ≤ (∫ a, ‖(blockAvg f X 0 n - α_f) a‖ ^ (2 : ℝ) ∂μ) ^ (1 / 2 : ℝ) :=\n Real.rpow_nonneg h_integral_nonneg _\n -- Step 1: First show (eLpNorm ...).toReal = (∫...)^(1/2)\n have h_toReal_eq : (eLpNorm (blockAvg f X 0 n - α_f) 2 μ).toReal =\n (∫ a, ‖(blockAvg f X 0 n - α_f) a‖ ^ (2 : ℝ) ∂μ) ^ (1 / 2 : ℝ) := by\n rw [h_eq_ofReal]\n exact ENNReal.toReal_ofReal h_sqrt_nonneg\n -- Step 2: Square both sides: toReal² = ((∫...)^(1/2))² = ∫...\n calc (eLpNorm (blockAvg f X 0 n - α_f) 2 μ).toReal ^ 2\n = ((∫ a, ‖(blockAvg f X 0 n - α_f) a‖ ^ (2 : ℝ) ∂μ) ^ (1 / 2 : ℝ)) ^ 2 := by rw [h_toReal_eq]\n _ = (∫ a, ‖(blockAvg f X 0 n - α_f) a‖ ^ (2 : ℝ) ∂μ) ^ (1 / 2 * 2 : ℝ) := by\n rw [← Real.rpow_natCast, ← Real.rpow_mul h_integral_nonneg]\n norm_cast\n _ = (∫ a, ‖(blockAvg f X 0 n - α_f) a‖ ^ (2 : ℝ) ∂μ) := by norm_num\n _ = ∫ ω, (blockAvg f X 0 n ω - α_f ω) ^ 2 ∂μ := by\n apply integral_congr_ae\n filter_upwards with a\n -- LHS: ‖(f - g) a‖ ^ (2:ℝ), RHS: (f a - g a) ^ 2\n -- Step 1: Convert ‖x‖^(2:ℝ) → |x|^2 (natural power)\n rw [Real.rpow_two, Real.norm_eq_abs]\n -- Step 2: |x|^2 = x^2 (sq_abs), then unfold Pi.sub\n simp only [sq_abs, Pi.sub_apply]\n\n -- STEP 2: Apply L2_tendsto_implies_L1_tendsto_of_bounded\n have hf_meas : ∀ n, Measurable (blockAvg f X 0 n) := by\n intro n\n exact blockAvg_measurable f X hf_meas hX_meas 0 n\n\n have hf_blockAvg_bdd : ∃ M, ∀ n ω, |blockAvg f X 0 n ω| ≤ M := by\n use 1\n intro n ω\n exact blockAvg_abs_le_one f X hf_bdd 0 n ω\n\n have hL1_conv : Tendsto (fun n => ∫ ω, |blockAvg f X 0 n ω - α_f ω| ∂μ) atTop (𝓝 0) :=\n Exchangeability.Probability.IntegrationHelpers.L2_tendsto_implies_L1_tendsto_of_bounded\n (fun n => blockAvg f X 0 n) α_f hf_meas hf_blockAvg_bdd hα_L2 hL2_integral\n\n -- STEP 3: Convert Tendsto to ∃ M, ∀ m ≥ M form using metric convergence\n rw [Metric.tendsto_atTop] at hL1_conv\n obtain ⟨M, hM⟩ := hL1_conv ε hε\n use M\n intro m hm\n\n -- STEP 4-5: Use a.e. equality and apply convergence bound\n -- hM states: dist (∫|blockAvg m - α_f|) 0 < ε\n -- Goal: ∫|(1/m)*∑ f(X i) - μ[f∘X 0|tail]| < ε\n -- These are equal by (a) blockAvg definition and (b) α_f =ᵐ μ[f∘X 0|tail]\n\n convert hM m hm using 1\n simp only [Real.dist_eq, sub_zero]\n -- Remove outer absolute value (integral of |...| is non-negative)\n rw [abs_of_nonneg]\n swap\n · apply integral_nonneg\n intro ω\n exact abs_nonneg _\n -- Show ∫|blockAvg m - α_f| = ∫|(1/m)*∑ - μ[f∘X 0|tail]|\n apply integral_congr_ae\n filter_upwards [hα_eq] with ω hω_eq\n -- blockAvg f X 0 m ω = (m : ℝ)⁻¹ * ∑ k ∈ Finset.range m, f (X k ω)\n -- which equals 1/m * ∑ i : Fin m, f (X i ω)\n rw [hω_eq]\n show _ = |blockAvg f X 0 m ω - _|\n congr 1\n -- Unfold blockAvg definition and convert between sum representations\n simp only [blockAvg, zero_add, one_div]\n -- Convert sum over Fin m to sum over Finset.range m\n congr 2\n exact (Finset.sum_range (fun i => f (X i ω))).symm\n","line":2864,"end_line":3013,"proof_status":"formalized"} | |
| {"id":"def:futureFiltration","label":"futureFiltration","background_color":"#B0ECA3","border_color":"green","kind":"box","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":[],"nlp_text":"The future filtration at level \\(m\\) is \\(\\mathcal{F}_m = \\sigma (X_{m+1}, X_{m+2}, \\ldots )\\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.futureFiltration","latex_link":"sect0002.html#def:futureFiltration","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.futureFiltration","lean_decl_name":"Exchangeability.DeFinetti.ViaMartingale.futureFiltration","kind_description":"definitions","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":true,"found_in_mathlib4v4.22.0":false,"source_repo":"remote_github","source_path":"https://raw.githubusercontent.com/cameronfreer/exchangeability/aec253b69aaabbd93dd82fe1a7d9bbf34cf90ab5/Exchangeability/DeFinetti/ViaMartingale/FutureFiltration.lean","lean4_code":"/-- Future reverse filtration: 𝔽ᶠᵘᵗₘ = σ(θ_{m+1} X). -/\nabbrev futureFiltration (X : ℕ → Ω → α) (m : ℕ) : MeasurableSpace Ω :=\n MeasurableSpace.comap (shiftRV X (m + 1)) inferInstance","line":42,"end_line":44,"proof_status":"formalized"} | |
| {"id":"lem:tailSigma_le_futureFiltration","label":"tailSigma_le_futureFiltration","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["def:futureFiltration","def:tailSigma"],"nlp_text":"For all \\(m\\): \\(\\mathcal{T} \\le \\mathcal{F}_m\\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.tailSigma_le_futureFiltration","latex_link":"sect0002.html#lem:tailSigma_le_futureFiltration","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.tailSigma_le_futureFiltration","lean_decl_name":"Exchangeability.DeFinetti.ViaMartingale.tailSigma_le_futureFiltration","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaMartingale/FutureFiltration.lean","lean4_code":"/-- Tail σ-algebra is sub-σ-algebra of future filtration. -/\n@[nolint unusedArguments]\nlemma tailSigma_le_futureFiltration {Ω α : Type*} [MeasurableSpace Ω] [MeasurableSpace α]\n (X : ℕ → Ω → α) (m : ℕ) :\n tailSigma X ≤ futureFiltration X m :=\n iInf_le_of_le (m + 1) le_rfl\n","line":85,"end_line":90,"proof_status":"formalized"} | |
| {"id":"lem:futureFiltration_antitone","label":"futureFiltration_antitone","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["def:futureFiltration"],"nlp_text":"The future filtration is antitone: \\(m \\le n\\) implies \\(\\mathcal{F}_n \\le \\mathcal{F}_m\\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.futureFiltration_antitone","latex_link":"sect0002.html#lem:futureFiltration_antitone","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.futureFiltration_antitone","lean_decl_name":"Exchangeability.DeFinetti.ViaMartingale.futureFiltration_antitone","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaMartingale/FutureFiltration.lean","lean4_code":"/-- The future filtration is decreasing (antitone). -/\nlemma futureFiltration_antitone (X : ℕ → Ω → α) :\n Antitone (futureFiltration X) := fun _ _ hmn =>\n revFiltration_antitone X (Nat.succ_le_succ hmn)\n","line":52,"end_line":55,"proof_status":"formalized"} | |
| {"id":"lem:contractable_dist_eq","label":"contractable_dist_eq","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["def:futureFiltration","def:contractable"],"nlp_text":"For a contractable sequence, the joint distribution of \\((X_k, \\theta _{m+1} X)\\) equals that of \\((X_m, \\theta _{m+1} X)\\) for all \\(k \\le m\\), where \\(\\theta _n\\) is the shift operator.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.contractable_dist_eq","latex_link":"sect0004.html#lem:contractable_dist_eq","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.contractable_dist_eq","lean_decl_name":"Exchangeability.DeFinetti.ViaMartingale.contractable_dist_eq","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaMartingale/FutureRectangles.lean","lean4_code":"/-- Helper lemma: contractability gives the key distributional equality.\n\nIf `X` is contractable, then for any `k ≤ m`:\n```\n(X_m, θ_{m+1} X) =^d (X_k, θ_{m+1} X)\n```\nwhere `θ_{m+1} X` drops the first coordinate and keeps the *future* tail\n`ω ↦ (n ↦ X(m + 1 + n) ω)`. -/\nlemma contractable_dist_eq\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n {X : ℕ → Ω → α} (hX : Contractable μ X) (hX_meas : ∀ n, Measurable (X n))\n (k m : ℕ) (hk : k ≤ m) :\n Measure.map (fun ω => (X m ω, shiftRV X (m + 1) ω)) μ\n = Measure.map (fun ω => (X k ω, shiftRV X (m + 1) ω)) μ := by\n apply measure_ext_of_future_rectangles\n intro r B hB C hC\n exact contractable_dist_eq_on_rectangles_future hX hX_meas k m hk r B hB C hC\n","line":384,"end_line":400,"proof_status":"formalized"} | |
| {"id":"lem:condExp_indicator_eq","label":"condExp_indicator_eq","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["lem:contractable_dist_eq"],"nlp_text":"For contractable sequences and \\(k \\le m\\): \\(\\mathbb {E}[\\mathbf{1}_{X_k \\in B} \\mid \\mathcal{F}_m] = \\mathbb {E}[\\mathbf{1}_{X_m \\in B} \\mid \\mathcal{F}_m]\\) a.s.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.condExp_indicator_eq_of_contractable","latex_link":"sect0004.html#lem:condExp_indicator_eq","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.condExp_indicator_eq_of_contractable","lean_decl_name":"Exchangeability.DeFinetti.ViaMartingale.condExp_indicator_eq_of_contractable","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaMartingale/PairLawEquality.lean","lean4_code":"/-- **Conditional expectation drop-info via true contraction (Kallenberg 1.3).**\n\nThis is the CORRECT version that uses the contraction structure σ(W) ⊆ σ(W')\nrather than the broken triple-law approach.\n\nGiven contractability of X, for r < m:\n- U = (X_0, ..., X_{r-1}) (first r coordinates)\n- W = shiftRV X (m+1) (far future)\n- W' = consRV (X r) W (X_r consed onto far future)\n\nWe have:\n1. σ(W) ⊆ σ(W') via comap_le_comap_consRV\n2. (U, W) =^d (U, W') via pair_law_eq_of_contractable\n\nBy Kallenberg Lemma 1.3 (condExp_indicator_eq_of_law_eq_of_comap_le):\n E[1_{U∈A} | σ(W')] = E[1_{U∈A} | σ(W)]\n\nSince σ(W') = σ(X_r, W), this gives:\n E[1_{U∈A} | σ(X_r, W)] = E[1_{U∈A} | σ(W)]\n\nwhich is exactly U ⊥⊥ X_r | W in indicator form.\n-/\n@[nolint unusedArguments]\nlemma condExp_indicator_eq_of_contractable\n {Ω α : Type*} [MeasurableSpace Ω] [MeasurableSpace α]\n [StandardBorelSpace α]\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n {X : ℕ → Ω → α}\n (hContr : Contractable μ X)\n (hX_meas : ∀ n, Measurable (X n))\n {r m : ℕ} (hrm : r ≤ m)\n {A : Set (Fin r → α)} (hA : MeasurableSet A) :\n let U := fun ω : Ω => (fun i : Fin r => X i ω)\n let W := shiftRV X (m+1)\n let W' := consRV (fun ω => X r ω) W\n μ[Set.indicator (U ⁻¹' A) (fun _ => (1 : ℝ)) | MeasurableSpace.comap W' inferInstance]\n =ᵐ[μ]\n μ[Set.indicator (U ⁻¹' A) (fun _ => (1 : ℝ)) | MeasurableSpace.comap W inferInstance] := by\n -- Define the key random variables\n let U := fun ω : Ω => (fun i : Fin r => X i ω)\n let W := shiftRV X (m+1)\n let W' := consRV (fun ω => X r ω) W\n\n -- Measurability\n have hU : Measurable U := by measurability\n have hW : Measurable W := measurable_pi_lambda _ fun n => hX_meas (m + 1 + n)\n have hW' : Measurable W' := measurable_pi_lambda _ fun\n | 0 => hX_meas r\n | n + 1 => hX_meas (m + 1 + n)\n\n -- Apply Kallenberg 1.3 with pair law and contraction σ(W) ⊆ σ(W')\n exact condExp_indicator_eq_of_law_eq_of_comap_le U W W' hU hW hW'\n (pair_law_eq_of_contractable hContr hX_meas r m hrm)\n (comap_le_comap_consRV (fun ω => X r ω) W) hA\n","line":277,"end_line":330,"proof_status":"formalized"} | |
| {"id":"def:shiftInvariantSigma","label":"shiftInvariantSigma","background_color":"#B0ECA3","border_color":"green","kind":"box","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":[],"nlp_text":"The shift-invariant \\(\\sigma \\)-algebra consists of sets \\(S\\) such that \\(\\theta ^{-1}(S) = S\\) where \\(\\theta \\) is the shift operator.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaKoopman.shiftInvariantSigmaℤ","latex_link":"sect0002.html#def:shiftInvariantSigma","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaKoopman.shiftInvariantSigmaℤ","lean_decl_name":"Exchangeability.DeFinetti.ViaKoopman.shiftInvariantSigmaℤ","kind_description":"definitions","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaKoopman/InfraCore.lean","lean4_code":"/-- Shift-invariant σ-algebra on the two-sided path space.\n\nThis is defined directly as the sub-σ-algebra of measurable shift-invariant sets.\n-/\ndef shiftInvariantSigmaℤ : MeasurableSpace (Ωℤ[α]) where\n MeasurableSet' := fun s => IsShiftInvariantℤ (α := α) s\n measurableSet_empty := by\n refine ⟨MeasurableSet.empty, ?_⟩\n simp\n measurableSet_compl := by\n intro s hs\n obtain ⟨hs_meas, hs_eq⟩ := hs\n refine ⟨hs_meas.compl, ?_⟩\n simp [Set.preimage_compl, hs_eq]\n measurableSet_iUnion := by\n intro f hf\n refine ⟨MeasurableSet.iUnion fun n => (hf n).1, ?_⟩\n simp only [Set.preimage_iUnion]\n ext ω\n simp only [Set.mem_iUnion, Set.mem_preimage]\n constructor\n · intro ⟨i, hi⟩\n use i\n -- hi : shiftℤ ω ∈ f i\n -- By (hf i), f i is shift-invariant: shiftℤ ω ∈ f i ↔ ω ∈ f i\n have := isShiftInvariantℤ_iff (f i)\n exact (this.1 (hf i)).2 ω |>.1 hi\n · intro ⟨i, hi⟩\n use i\n -- hi : ω ∈ f i\n -- By (hf i), f i is shift-invariant: shiftℤ ω ∈ f i ↔ ω ∈ f i\n have := isShiftInvariantℤ_iff (f i)\n exact (this.1 (hf i)).2 ω |>.2 hi\n","line":201,"end_line":233,"proof_status":"formalized"} | |
| {"id":"lem:koopman_condexp_comm","label":"koopman_condexp_comm","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["def:shiftInvariantSigma"],"nlp_text":"The conditional expectation operator onto the shift-invariant subspace commutes with the Koopman operator.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaKoopman.condexpL2_koopman_comm","latex_link":"sect0004.html#lem:koopman_condexp_comm","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaKoopman.condexpL2_koopman_comm","lean_decl_name":"Exchangeability.DeFinetti.ViaKoopman.condexpL2_koopman_comm","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaKoopman/KoopmanCommutation.lean","lean4_code":"/-- **Part B (Shift Equivariance)**: Conditional expectation commutes with Koopman operator. -/\nlemma condexpL2_koopman_comm (f : Lp ℝ 2 μ) :\n condexpL2 (μ := μ) (koopman shift hσ f) = condexpL2 (μ := μ) f := by\n classical\n set P := condexpL2 (μ := μ)\n set U := koopman shift hσ\n let S := fixedSubspace hσ\n have h_range : Set.range P = (S : Set (Lp ℝ 2 μ)) := range_condexp_eq_fixedSubspace hσ\n have hPf_mem : P f ∈ S := by\n have : P f ∈ Set.range P := ⟨f, rfl⟩\n simpa [P, h_range] using this\n have h_fix : ∀ g ∈ S, U g = g := fun g hg => (mem_fixedSubspace_iff (μ := μ) (α := α) hσ g).1 hg\n set r := f - P f\n -- Step 1: r = f - Pf is orthogonal to S\n have h_r_orth : ∀ g ∈ S, @inner ℝ (Lp ℝ 2 μ) _ r g = 0 := fun g hg =>\n orthogonal_complement_of_condexpL2 hσ f g hg\n -- Step 2: Ur is also orthogonal to S (isometry preserves orthogonality)\n have h_r_orth_after : ∀ g ∈ S, @inner ℝ (Lp ℝ 2 μ) _ (U r) g = 0 := fun g hg =>\n koopman_preserves_orthogonality_to_fixed_subspace hσ r g h_r_orth h_fix hg\n -- Step 3: P(Ur) ∈ S and P(Ur) ⊥ S, hence P(Ur) = 0\n have hPUr_mem : P (U r) ∈ S := by\n have : P (U r) ∈ Set.range P := ⟨U r, rfl⟩\n simpa [P, h_range] using this\n have hPUr_orth : ∀ g ∈ S, @inner ℝ (Lp ℝ 2 μ) _ (P (U r)) g = 0 := by\n intro g hg\n -- ⟨P(Ur), g⟩ = ⟨Ur, Pg⟩ = ⟨Ur, g⟩ = 0 (since g ∈ S means Pg = g)\n have hPg : P g = g := condexpL2_fixes_fixedSubspace hσ hg\n have h_sym : @inner ℝ (Lp ℝ 2 μ) _ (P (U r)) g\n = @inner ℝ (Lp ℝ 2 μ) _ (U r) (P g) := by\n unfold P condexpL2\n exact MeasureTheory.inner_condExpL2_left_eq_right shiftInvariantSigma_le\n rw [h_sym, hPg]\n exact h_r_orth_after g hg\n have hPUr_zero : P (U r) = 0 := zero_from_subspace_and_orthogonal hσ (P (U r)) hPUr_mem hPUr_orth\n -- Step 4: P(Uf) = P(U(Pf) + Ur) = P(U(Pf)) + P(Ur) = P(Pf) + 0 = Pf\n -- f = Pf + r by construction (r = f - Pf)\n have hf_decomp : f = P f + r := by\n rw [add_comm]\n exact (sub_add_cancel f (P f)).symm\n -- U is linear: U(f) = U(Pf + r) = U(Pf) + U(r)\n have hUf_decomp : U f = U (P f) + U r := by\n conv_lhs => rw [hf_decomp]\n exact U.map_add (P f) r\n -- U(Pf) = Pf since Pf ∈ S (fixed)\n have hPUf_eq : P (U (P f)) = P (P f) := by rw [h_fix (P f) hPf_mem]\n -- P(P f) = P f by idempotence\n have hPP_eq : P (P f) = P f := by\n have h_idem := condexpL2_idem (μ := μ)\n exact congrFun (congrArg DFunLike.coe h_idem) f\n calc\n P (U f) = P (U (P f) + U r) := by rw [hUf_decomp]\n _ = P (U (P f)) + P (U r) := P.map_add (U (P f)) (U r)\n _ = P (P f) + 0 := by rw [hPUf_eq, hPUr_zero]\n _ = P f := by rw [add_zero, hPP_eq]\n","line":169,"end_line":222,"proof_status":"formalized"} | |
| {"id":"thm:birkhoff_condexp","label":"birkhoff_condexp","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["lem:koopman_condexp_comm"],"nlp_text":"Birkhoff averages converge in L\\(^2\\) to the conditional expectation given the shift-invariant \\(\\sigma \\)-algebra.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaKoopman.birkhoffAverage_tendsto_condexp","latex_link":"sect0004.html#thm:birkhoff_condexp","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaKoopman.birkhoffAverage_tendsto_condexp","lean_decl_name":"Exchangeability.DeFinetti.ViaKoopman.birkhoffAverage_tendsto_condexp","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaKoopman/KoopmanCommutation.lean","lean4_code":"/-- Main theorem: Birkhoff averages converge in L² to conditional expectation.\n\nThis combines:\n1. The Mean Ergodic Theorem (MET) giving convergence to orthogonal projection\n2. The identification proj = condexp via range_condexp_eq_fixedSubspace\n-/\ntheorem birkhoffAverage_tendsto_condexp (f : Lp ℝ 2 μ) :\n Tendsto (fun n => birkhoffAverage ℝ (koopman shift hσ) (fun f => f) n f)\n atTop (𝓝 (condexpL2 (μ := μ) f)) := by\n -- Step 1: Get convergence to projection P onto fixedSpace from MET\n classical\n -- Use the canonical mean ergodic projection from `InvariantSigma`\n let P := metProjectionShift (μ := μ) hσ\n have hP_tendsto := metProjectionShift_tendsto (μ := μ) hσ f\n have hP_fixed : ∀ g ∈ fixedSubspace hσ, P g = g :=\n fun g hg => metProjectionShift_fixes_fixedSubspace (μ := μ) hσ hg\n\n -- Step 2: Show P = condexpL2 using the factored lemmas\n have hP_eq : P = condexpL2 (μ := μ) := by\n -- Both P and condexpL2 are orthogonal projections onto the fixed subspace\n -- Use uniqueness of symmetric idempotent projections with the same range\n have h_range_P : Set.range P = (fixedSubspace hσ : Set (Lp ℝ 2 μ)) :=\n metProjectionShift_range_fixedSubspace (μ := μ) hσ\n have h_range_condexp : Set.range (condexpL2 (μ := μ)) =\n (fixedSubspace hσ : Set (Lp ℝ 2 μ)) := range_condexp_eq_fixedSubspace hσ\n have hQ_fixes : ∀ g ∈ fixedSubspace hσ, condexpL2 (μ := μ) g = g :=\n fun g hg => condexpL2_fixes_fixedSubspace (hσ := hσ) hg\n have hP_idem : P.comp P = P := metProjectionShift_idem (μ := μ) hσ\n have hQ_idem : (condexpL2 (μ := μ)).comp (condexpL2 (μ := μ)) = condexpL2 (μ := μ) :=\n condexpL2_idem (μ := μ)\n have hP_sym : P.IsSymmetric := metProjectionShift_isSymmetric (μ := μ) hσ\n have hQ_sym : (condexpL2 (μ := μ)).IsSymmetric := by\n intro f g\n unfold condexpL2\n exact MeasureTheory.inner_condExpL2_left_eq_right shiftInvariantSigma_le\n haveI : (fixedSubspace hσ).HasOrthogonalProjection := by\n have hclosed := fixedSubspace_closed hσ\n have : CompleteSpace (fixedSubspace hσ) := hclosed.completeSpace_coe\n exact Submodule.HasOrthogonalProjection.ofCompleteSpace (fixedSubspace hσ)\n exact orthogonalProjections_same_range_eq P (condexpL2 (μ := μ)) (fixedSubspace hσ)\n h_range_P h_range_condexp hP_fixed hQ_fixes hP_idem hQ_idem hP_sym hQ_sym\n\n -- Step 3: Conclude using equality\n rw [← hP_eq]\n exact hP_tendsto\n","line":59,"end_line":103,"proof_status":"formalized"} | |
| {"id":"lem:perm_extension","label":"perm_extension","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":[],"nlp_text":"Any strictly increasing function \\(k : \\mathrm{Fin}(m) \\to \\mathbb {N}\\) with range contained in \\(\\{ 0, \\ldots , n-1\\} \\) extends to a permutation of \\(\\{ 0, \\ldots , n-1\\} \\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.exists_perm_extending_strictMono","latex_link":"sect0003.html#lem:perm_extension","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.exists_perm_extending_strictMono","lean_decl_name":"Exchangeability.exists_perm_extending_strictMono","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/Contractability.lean","lean4_code":"/--\nAny strictly increasing function can be extended to a permutation.\n\n**Statement:** Given a strictly increasing `k : Fin m → ℕ` with all values `< n`\nand `m ≤ n`, there exists a permutation `σ : Perm (Fin n)` such that\n`σ(i) = k(i)` for all `i < m`.\n\n**Intuition:** We want to build a permutation that \"realizes\" the selection `k`\nas the image of the first `m` positions. Since `k` is strictly increasing, it's\ninjective, so its image has cardinality `m`. We can extend this to a full\npermutation by arbitrarily pairing up the remaining elements.\n\n**Construction outline:**\n1. **Domain partition:** `{0,...,m-1}` ∪ `{m,...,n-1}` = `Fin n`\n2. **Codomain partition:** `{k(0),...,k(m-1)}` ∪ `complement` = `Fin n`\n3. Map first `m` positions to `k`-values: `σ(i) = k(i)` for `i < m`\n4. Extend arbitrarily to remaining positions using `Equiv.extendSubtype`\n\nThis is the key combinatorial lemma enabling `contractable_of_exchangeable`:\nany strictly increasing subsequence can be realized via a permutation.\n-/\nlemma exists_perm_extending_strictMono {m n : ℕ} (k : Fin m → ℕ)\n (hk_mono : StrictMono k) (hk_bound : ∀ i, k i < n) (hmn : m ≤ n) :\n ∃ (σ : Equiv.Perm (Fin n)), ∀ (i : Fin m),\n (σ ⟨i.val, Nat.lt_of_lt_of_le i.isLt hmn⟩).val = k i := by\n classical\n -- Embed `Fin m` into `Fin n` via the initial segment.\n let ι : Fin m → Fin n := fun i => ⟨i.val, Nat.lt_of_lt_of_le i.isLt hmn⟩\n let p : Fin n → Prop := fun x => x.val < m\n let q : Fin n → Prop := fun x => ∃ i : Fin m, x = ⟨k i, hk_bound i⟩\n have hι_mem : ∀ i : Fin m, p (ι i) := fun i => i.isLt\n let kFin : Fin m → Fin n := fun i => ⟨k i, hk_bound i⟩\n have hk_mem : ∀ i : Fin m, q (kFin i) := fun i => ⟨i, rfl⟩\n haveI : DecidablePred p := fun x => inferInstance\n haveI : DecidablePred q := fun x => inferInstance\n -- Equivalence between the first `m` coordinates and `Fin m`.\n let e_dom : {x : Fin n // p x} ≃ Fin m :=\n { toFun := fun x => ⟨x.1.val, x.2⟩\n , invFun := fun i => ⟨ι i, by\n dsimp [p, ι]\n exact i.isLt⟩\n , left_inv := by\n rintro ⟨x, hx⟩\n ext; simp [ι]\n , right_inv := by\n intro i\n cases i with\n | mk i hi =>\n simp [ι] }\n -- Equivalence between the image of `k` and `Fin m`.\n -- For injectivity of k, we use that it's strictly monotone\n have hk_inj : Function.Injective kFin :=\n fun i j hij => hk_mono.injective (Fin.ext_iff.mp hij)\n let e_cod : Fin m ≃ {x : Fin n // q x} :=\n { toFun := fun i => ⟨kFin i, hk_mem i⟩\n , invFun := fun y => Classical.choose y.2\n , left_inv := by\n intro i\n have h_spec := Classical.choose_spec (hk_mem i)\n have : k (Classical.choose (hk_mem i)) = k i := by\n simpa [kFin] using (Fin.ext_iff.mp h_spec).symm\n exact hk_mono.injective this\n , right_inv := by\n rintro ⟨y, hy⟩\n apply Subtype.ext\n simp only [kFin]\n exact (Classical.choose_spec hy).symm }\n -- Equivalence between the subtypes describing the first `m` coordinates and the image of `k`.\n let e : {x : Fin n // p x} ≃ {x : Fin n // q x} := e_dom.trans e_cod\n -- Extend this equivalence to a permutation of `Fin n`.\n let σ : Equiv.Perm (Fin n) := Equiv.extendSubtype e\n have hσ_apply : ∀ i : Fin m, σ (ι i) = kFin i := by\n intro i\n have h_apply := Equiv.extendSubtype_apply_of_mem (e:=e) (x:=ι i) (hι_mem i)\n dsimp [σ, e, Equiv.trans, e_dom, e_cod, ι, Fin.castLEEmb, kFin] at h_apply\n simpa using h_apply\n refine ⟨σ, fun i => ?_⟩\n have hσ_val : (σ (ι i)).val = k i := by simpa [kFin] using congrArg Fin.val (hσ_apply i)\n simpa [ι] using hσ_val\n","line":292,"end_line":370,"proof_status":"formalized"} | |
| {"id":"thm:contractable_of_exchangeable","label":"contractable_of_exchangeable","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["lem:perm_extension","def:contractable"],"nlp_text":"If \\((X_n)\\) is exchangeable, then it is contractable.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.contractable_of_exchangeable","latex_link":"sect0003.html#thm:contractable_of_exchangeable","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.contractable_of_exchangeable","lean_decl_name":"Exchangeability.contractable_of_exchangeable","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"./paper/NOTES.md","lean4_code":"theorem contractable_of_exchangeable (hX : Exchangeable μ X) : Contractable μ X := by\n intro m k hk\n -- Any strictly monotone k extends to a permutation σ\n obtain ⟨σ, hσ⟩ := exists_perm_extending_strictMono k hk ...\n -- Apply exchangeability to σ\n exact hX ...\n```\n\nThe key lemma `exists_perm_extending_strictMono` does all the work, and it's a clean combinatorial fact.\n\n**4. Avoids Infinite Permutation Groups**\n\nFullyExchangeable uses `Equiv.Perm ℕ` (infinite permutations):\n- More complex mathematical object\n- Harder to work with in Lean\n- `Equiv.Perm ℕ` has different properties than `Equiv.Perm (Fin n)`\n\nContractability only uses finite selections, avoiding this entirely.\n\n### The Conceptual Insight\n\nDe Finetti's theorem is really about **subsequence consistency**:\n- If you pick any strictly increasing subsequence, it looks the same\n- This consistency implies a deeper structure (conditional i.i.d.)\n\nContractability makes this insight **explicit** in the definition.\nExchangeability **encodes** it through permutation invariance.\n\n","line":446,"end_line":473,"proof_status":"formalized"} | |
| {"id":"lem:directingMeasure_measurable","label":"directingMeasure_measurable","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["def:tailSigma"],"nlp_text":"The directing measure \\(\\omega \\mapsto \\nu (\\omega )(B)\\) is measurable for each Borel \\(B\\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.directingMeasure_measurable_eval","latex_link":"sect0004.html#lem:directingMeasure_measurable","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.directingMeasure_measurable_eval","lean_decl_name":"Exchangeability.DeFinetti.ViaMartingale.directingMeasure_measurable_eval","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaMartingale/DirectingMeasure.lean","lean4_code":"/-- `directingMeasure` evaluates measurably on measurable sets.\n\nUses: `Kernel.measurable_coe` and `Measure.map_apply`. -/\nlemma directingMeasure_measurable_eval\n {Ω : Type*} [MeasurableSpace Ω] [StandardBorelSpace Ω]\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n {α : Type*} [MeasurableSpace α] [StandardBorelSpace α] [Nonempty α]\n (X : ℕ → Ω → α) (hX : ∀ n, Measurable (X n)) :\n ∀ (B : Set α), MeasurableSet B →\n Measurable (fun ω => directingMeasure (μ := μ) X hX ω B) := by\n intro B hB\n classical\n have hS : MeasurableSet ((X 0) ⁻¹' B) := (hX 0) hB\n let κ := ProbabilityTheory.condExpKernel μ (tailSigma X)\n simp only [directingMeasure, Measure.map_apply (hX 0) hB]\n exact (ProbabilityTheory.Kernel.measurable_coe κ hS).mono (tailSigma_le X hX) le_rfl\n","line":60,"end_line":75,"proof_status":"formalized"} | |
| {"id":"thm:weighted_sums_L1","label":"weighted_sums_L1","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["lem:cesaro_L1"],"nlp_text":"The weighted sums of indicators converge in L\\(^1\\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaL2.weighted_sums_converge_L1","latex_link":"sect0004.html#thm:weighted_sums_L1","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaL2.weighted_sums_converge_L1","lean_decl_name":"Exchangeability.DeFinetti.ViaL2.weighted_sums_converge_L1","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaL2/MainConvergence.lean","lean4_code":"/-- **Weighted sums converge in L¹ for contractable sequences.**\n\nFor a contractable sequence X and bounded measurable f, the Cesàro averages\n`(1/m) * ∑_{i<m} f(X_{n+i+1})` converge in L¹ to a limit α : Ω → ℝ that does not depend on n.\n\nThis is the key convergence result needed for de Finetti's theorem via the L² approach.\nThe proof uses L² contractability bounds to show the averages form a Cauchy sequence in L¹. -/\ntheorem weighted_sums_converge_L1\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n (X : ℕ → Ω → ℝ) (hX_contract : Contractable μ X)\n (hX_meas : ∀ i, Measurable (X i))\n (hX_L2 : ∀ i, MemLp (X i) 2 μ)\n (f : ℝ → ℝ) (hf_meas : Measurable f)\n (hf_bdd : ∃ M, ∀ x, |f x| ≤ M) :\n ∃ (alpha : Ω → ℝ), -- SINGLE alpha, not a sequence!\n Measurable alpha ∧ MemLp alpha 1 μ ∧\n -- The weighted sums converge to alpha in L¹ (for ANY starting index n)\n (∀ n, ∀ ε > 0, ∃ M : ℕ, ∀ m : ℕ, m ≥ M →\n ∫ ω, |(1/(m:ℝ)) * ∑ k : Fin m, f (X (n + k.val + 1) ω) - alpha ω| ∂μ < ε) := by\n classical\n\n -- Define the moving averages A n m\n let A : ℕ → ℕ → Ω → ℝ :=\n fun n m ω => (1 / (m : ℝ)) * ∑ k : Fin m, f (X (n + k.val + 1) ω)\n\n -- A n m is measurable for all n, m\n have hA_meas : ∀ n m, Measurable (A n m) := by\n intro n m\n simp only [A]\n apply Measurable.const_mul\n apply Finset.measurable_sum\n intro k _\n exact hf_meas.comp (hX_meas _)\n\n -- A n m is in L¹ for all n, m (bounded measurable on probability space)\n have hA_memLp : ∀ n m, MemLp (A n m) 1 μ := by\n intro n m\n obtain ⟨M, hM⟩ := hf_bdd\n -- On probability spaces, the integral of |A n m| is bounded by M\n -- since |A n m ω| ≤ M for all ω and μ is a probability measure\n have hA_ae_bdd : ∀ᵐ ω ∂μ, ‖A n m ω‖ ≤ M := by\n filter_upwards with ω\n simp only [A, Real.norm_eq_abs]\n -- Average of values bounded by M is bounded by M\n calc |(1 / (m : ℝ)) * ∑ k : Fin m, f (X (n + k.val + 1) ω)|\n ≤ (1 / (m : ℝ)) * ∑ k : Fin m, |f (X (n + k.val + 1) ω)| := by\n classical\n by_cases hm : m = 0\n · simp [hm]\n · have hm_pos : 0 < (m : ℝ) := by exact_mod_cast Nat.pos_of_ne_zero hm\n have h_inv_pos : 0 < 1 / (m : ℝ) := by\n exact div_pos (by norm_num) hm_pos\n have h_abs_sum :\n |∑ k : Fin m, f (X (n + k.val + 1) ω)|\n ≤ ∑ k : Fin m, |f (X (n + k.val + 1) ω)| :=\n Finset.abs_sum_le_sum_abs\n (fun k : Fin m => f (X (n + k.val + 1) ω))\n Finset.univ\n have h_inv_abs : |1 / (m : ℝ)| = 1 / (m : ℝ) :=\n abs_of_pos h_inv_pos\n calc\n |(1 / (m : ℝ)) * ∑ k : Fin m, f (X (n + k.val + 1) ω)|\n = (1 / (m : ℝ)) *\n |∑ k : Fin m, f (X (n + k.val + 1) ω)| := by\n simp [abs_mul]\n _ ≤ (1 / (m : ℝ)) *\n ∑ k : Fin m, |f (X (n + k.val + 1) ω)| := by\n exact\n (mul_le_mul_of_nonneg_left h_abs_sum\n (le_of_lt h_inv_pos))\n _ ≤ (1 / (m : ℝ)) * ∑ k : Fin m, M := by\n classical\n by_cases hm : m = 0\n · simp [hm]\n · have h_inv_nonneg : 0 ≤ 1 / (m : ℝ) := by\n have hm_pos : 0 < (m : ℝ) := by exact_mod_cast Nat.pos_of_ne_zero hm\n exact le_of_lt (div_pos (by norm_num) hm_pos)\n have h_sum_le :\n ∑ k : Fin m, |f (X (n + k.val + 1) ω)|\n ≤ ∑ k : Fin m, M := by\n refine Finset.sum_le_sum ?_\n intro k _\n exact hM _\n exact (mul_le_mul_of_nonneg_left h_sum_le h_inv_nonneg)\n _ ≤ M := by\n classical\n by_cases hm : m = 0\n · have hM_nonneg : 0 ≤ M :=\n (le_trans (abs_nonneg _) (hM 0))\n simp [hm, hM_nonneg]\n · have : (1 / (m : ℝ)) * ∑ k : Fin m, M = M := by\n simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin]\n field_simp [Nat.cast_ne_zero.mpr hm]\n ring\n rw [this]\n exact MemLp.of_bound (hA_meas n m).aestronglyMeasurable M hA_ae_bdd\n\n -- A n m is also in L² (bounded functions on probability spaces)\n have hA_memLp_two : ∀ n m, MemLp (A n m) 2 μ := by\n intro n m\n obtain ⟨M, hM⟩ := hf_bdd\n have hA_ae_bdd : ∀ᵐ ω ∂μ, ‖A n m ω‖ ≤ M := by\n filter_upwards with ω\n simp only [A, Real.norm_eq_abs]\n -- Same bound as L¹ case\n classical\n by_cases hm : m = 0\n · simp [hm]; exact le_trans (abs_nonneg _) (hM 0)\n · calc |(1 / (m : ℝ)) * ∑ k : Fin m, f (X (n + k.val + 1) ω)|\n ≤ (1 / (m : ℝ)) * ∑ k : Fin m, |f (X (n + k.val + 1) ω)| := by\n have hm_pos : 0 < (m : ℝ) := Nat.cast_pos.mpr (Nat.pos_of_ne_zero hm)\n rw [abs_mul, abs_of_pos (div_pos zero_lt_one hm_pos)]\n exact mul_le_mul_of_nonneg_left\n (Finset.abs_sum_le_sum_abs _ _) (le_of_lt (div_pos zero_lt_one hm_pos))\n _ ≤ (1 / (m : ℝ)) * ∑ k : Fin m, M := by\n gcongr; exact hM _\n _ = M := by\n simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin]\n field_simp [Nat.cast_ne_zero.mpr hm]\n ring\n exact MemLp.of_bound (hA_meas n m).aestronglyMeasurable M hA_ae_bdd\n\n -- Covariance structure of f ∘ X\n have hfX_contract' : Contractable μ (fun n ω => f (X n ω)) :=\n L2Helpers.contractable_comp X hX_contract hX_meas f hf_meas\n\n have hfX_meas' : ∀ i, Measurable fun ω => f (X i ω) := by\n intro i\n exact hf_meas.comp (hX_meas i)\n\n have hfX_L2' : ∀ i, MemLp (fun ω => f (X i ω)) 2 μ := by\n intro i\n obtain ⟨M, hM⟩ := hf_bdd\n apply MemLp.of_bound (hfX_meas' i).aestronglyMeasurable M\n filter_upwards with ω\n simp [Real.norm_eq_abs]\n exact hM (X i ω)\n\n -- **Phase 2: Compute covariance structure once and pass to both lemmas**\n -- This eliminates the need to prove Cf = Cf_tail (they're the same by construction!)\n obtain ⟨Cf, mf, σSqf, ρf, hCf_def, hCf_nonneg, hmean, hvar, hcov, hσSq_nn, hρ_bd1, hρ_bd2⟩ :=\n get_covariance_constant X hX_contract hX_meas hX_L2 f hf_meas hf_bdd\n\n -- Apply l2_bound_two_windows_uniform with the shared covariance structure\n have h_window_bound :=\n l2_bound_two_windows_uniform X hX_contract hX_meas hX_L2 f hf_meas hf_bdd\n Cf mf σSqf ρf hCf_def hCf_nonneg hmean hvar hcov hσSq_nn ⟨hρ_bd1, hρ_bd2⟩\n\n let Y : ℕ → Ω → ℝ := fun t ω => f (X t ω)\n\n -- Long average vs tail average bound with the same constant Cf\n -- ✅ Both lemmas now use the SAME Cf by construction → no proof needed!\n have h_long_tail_bound :\n ∀ {n m k : ℕ}, 0 < k → k ≤ m →\n ∫ ω,\n ((1 / (m : ℝ)) * ∑ i : Fin m, f (X (n + i.val + 1) ω) -\n (1 / (k : ℝ)) *\n ∑ i : Fin k, f (X (n + (m - k) + i.val + 1) ω))^2 ∂μ\n ≤ Cf / k := by\n intro n m k hk hkm\n -- Apply l2_bound_long_vs_tail with the shared covariance structure\n -- No more existential unpacking, no more sorry - just a direct bound!\n exact l2_bound_long_vs_tail X hX_contract hX_meas hX_L2 f hf_meas hf_bdd\n Cf mf σSqf ρf hCf_def hCf_nonneg hmean hvar hcov hσSq_nn ⟨hρ_bd1, hρ_bd2⟩\n n m k hk hkm\n\n -- Step 1: For n=0, show (A 0 m)_m is Cauchy in L² hence L¹\n have hA_cauchy_L2_0 : ∀ ε > 0, ∃ N, ∀ m ℓ, m ≥ N → ℓ ≥ N →\n eLpNorm (fun ω => A 0 m ω - A 0 ℓ ω) 2 μ < ENNReal.ofReal ε := by\n intro ε hε\n\n -- 3-segment decomposition strategy:\n -- For m, ℓ ≥ 2N with k = N, decompose ‖A 0 m - A 0 ℓ‖₂ via triangle inequality:\n -- ‖A 0 m - A 0 ℓ‖₂ ≤ ‖A 0 m - A (m-k) k‖₂ + ‖A (m-k) k - A (ℓ-k) k‖₂ + ‖A (ℓ-k) k - A 0 ℓ‖₂\n --\n -- Each segment bounded by √(Cf/k):\n -- - Segments 1 & 3: h_long_tail_bound (long avg vs tail avg) → ∫ (...)² ≤ Cf/k\n -- - Segment 2: h_window_bound (two equal-size windows) → ∫ (...)² ≤ Cf/k\n --\n -- Total bound: 3√(Cf/k) < ε\n -- Required: k > 9Cf/ε²\n\n let k := Nat.ceil (9 * Cf / (ε ^ 2)) + 1\n have hk_pos : 0 < k := Nat.succ_pos _\n\n -- Require m, ℓ ≥ 2k to ensure k ≤ m and k ≤ ℓ\n refine ⟨2 * k, ?_⟩\n intro m ℓ hm hℓ\n\n have hk_le_m : k ≤ m := by omega\n have hk_le_ℓ : k ≤ ℓ := by omega\n\n -- Segment 1: ‖A 0 m - A (m-k) k‖₂² ≤ Cf/k\n have h1 : ∫ ω, (A 0 m ω - A (m - k) k ω)^2 ∂μ ≤ Cf / k := by\n have h := @h_long_tail_bound 0 m k hk_pos hk_le_m\n convert h using 2\n ext ω\n simp only [A]\n congr 2 <;> (congr 1; apply Finset.sum_congr rfl; intro i _; congr; omega)\n\n -- Segment 2: ‖A (m-k) k - A (ℓ-k) k‖₂² ≤ Cf/k\n have h2 : ∫ ω, (A (m - k) k ω - A (ℓ - k) k ω)^2 ∂μ ≤ Cf / k := by\n simpa only [A] using @h_window_bound (m - k) (ℓ - k) k hk_pos\n\n -- Segment 3: ‖A (ℓ-k) k - A 0 ℓ‖₂² ≤ Cf/k\n have h3 : ∫ ω, (A (ℓ - k) k ω - A 0 ℓ ω)^2 ∂μ ≤ Cf / k := by\n have h_sq : ∫ ω, (A 0 ℓ ω - A (ℓ - k) k ω)^2 ∂μ ≤ Cf / k := by\n have h := @h_long_tail_bound 0 ℓ k hk_pos hk_le_ℓ\n convert h using 2\n ext ω\n simp only [A]\n congr 2 <;> (congr 1; apply Finset.sum_congr rfl; intro i _; congr; omega)\n have : ∀ ω, (A (ℓ - k) k ω - A 0 ℓ ω)^2 = (A 0 ℓ ω - A (ℓ - k) k ω)^2 := by\n intro ω; ring\n simp_rw [this]; exact h_sq\n\n -- Convert to eLpNorm bounds\n have h1_norm : eLpNorm (fun ω => A 0 m ω - A (m - k) k ω) 2 μ\n ≤ ENNReal.ofReal (Real.sqrt (Cf / k)) := by\n apply L2Helpers.eLpNorm_two_from_integral_sq_le\n · exact (hA_memLp_two 0 m).sub (hA_memLp_two (m - k) k)\n · apply div_nonneg hCf_nonneg; exact Nat.cast_nonneg k\n · exact h1\n\n have h2_norm : eLpNorm (fun ω => A (m - k) k ω - A (ℓ - k) k ω) 2 μ\n ≤ ENNReal.ofReal (Real.sqrt (Cf / k)) := by\n apply L2Helpers.eLpNorm_two_from_integral_sq_le\n · exact (hA_memLp_two (m - k) k).sub (hA_memLp_two (ℓ - k) k)\n · apply div_nonneg hCf_nonneg; exact Nat.cast_nonneg k\n · exact h2\n\n have h3_norm : eLpNorm (fun ω => A (ℓ - k) k ω - A 0 ℓ ω) 2 μ\n ≤ ENNReal.ofReal (Real.sqrt (Cf / k)) := by\n apply L2Helpers.eLpNorm_two_from_integral_sq_le\n · exact (hA_memLp_two (ℓ - k) k).sub (hA_memLp_two 0 ℓ)\n · apply div_nonneg hCf_nonneg; exact Nat.cast_nonneg k\n · exact h3\n\n -- Apply triangle inequality and combine\n calc eLpNorm (fun ω => A 0 m ω - A 0 ℓ ω) 2 μ\n = eLpNorm (fun ω => (A 0 m ω - A (m - k) k ω) +\n (A (m - k) k ω - A (ℓ - k) k ω) +\n (A (ℓ - k) k ω - A 0 ℓ ω)) 2 μ := by\n congr 1; ext ω; ring\n _ ≤ eLpNorm (fun ω => A 0 m ω - A (m - k) k ω) 2 μ +\n eLpNorm (fun ω => A (m - k) k ω - A (ℓ - k) k ω) 2 μ +\n eLpNorm (fun ω => A (ℓ - k) k ω - A 0 ℓ ω) 2 μ := by\n -- Apply triangle inequality twice: ‖f + g + h‖ ≤ ‖f + g‖ + ‖h‖ ≤ ‖f‖ + ‖g‖ + ‖h‖\n have h_decomp : (fun ω => (A 0 m ω - A (m - k) k ω) +\n (A (m - k) k ω - A (ℓ - k) k ω) +\n (A (ℓ - k) k ω - A 0 ℓ ω)) =\n fun ω => ((A 0 m ω - A (m - k) k ω) +\n (A (m - k) k ω - A (ℓ - k) k ω)) +\n (A (ℓ - k) k ω - A 0 ℓ ω) := by\n ext ω; ring\n rw [h_decomp]\n calc eLpNorm (fun ω => ((A 0 m ω - A (m - k) k ω) +\n (A (m - k) k ω - A (ℓ - k) k ω)) +\n (A (ℓ - k) k ω - A 0 ℓ ω)) 2 μ\n ≤ eLpNorm (fun ω => (A 0 m ω - A (m - k) k ω) +\n (A (m - k) k ω - A (ℓ - k) k ω)) 2 μ +\n eLpNorm (fun ω => A (ℓ - k) k ω - A 0 ℓ ω) 2 μ := by\n apply eLpNorm_add_le\n · exact ((hA_meas 0 m).sub (hA_meas (m - k) k)).add\n ((hA_meas (m - k) k).sub (hA_meas (ℓ - k) k)) |>.aestronglyMeasurable\n · exact (hA_meas (ℓ - k) k).sub (hA_meas 0 ℓ) |>.aestronglyMeasurable\n · norm_num\n _ ≤ eLpNorm (fun ω => A 0 m ω - A (m - k) k ω) 2 μ +\n eLpNorm (fun ω => A (m - k) k ω - A (ℓ - k) k ω) 2 μ +\n eLpNorm (fun ω => A (ℓ - k) k ω - A 0 ℓ ω) 2 μ := by\n gcongr\n apply eLpNorm_add_le\n · exact (hA_meas 0 m).sub (hA_meas (m - k) k) |>.aestronglyMeasurable\n · exact (hA_meas (m - k) k).sub (hA_meas (ℓ - k) k) |>.aestronglyMeasurable\n · norm_num\n _ ≤ ENNReal.ofReal (3 * Real.sqrt (Cf / k)) := by\n -- Each term bounded by √(Cf/k), so sum bounded by 3√(Cf/k)\n calc eLpNorm (fun ω => A 0 m ω - A (m - k) k ω) 2 μ +\n eLpNorm (fun ω => A (m - k) k ω - A (ℓ - k) k ω) 2 μ +\n eLpNorm (fun ω => A (ℓ - k) k ω - A 0 ℓ ω) 2 μ\n ≤ ENNReal.ofReal (Real.sqrt (Cf / k)) +\n ENNReal.ofReal (Real.sqrt (Cf / k)) +\n ENNReal.ofReal (Real.sqrt (Cf / k)) := by\n gcongr\n _ = ENNReal.ofReal (3 * Real.sqrt (Cf / k)) := by\n set r : ℝ := Real.sqrt (Cf / k)\n have hr_nonneg : 0 ≤ r := Real.sqrt_nonneg _\n -- Add three ofReal r terms\n calc ENNReal.ofReal r + ENNReal.ofReal r + ENNReal.ofReal r\n = (ENNReal.ofReal r + ENNReal.ofReal r) + ENNReal.ofReal r := by\n rfl\n _ = ENNReal.ofReal (r + r) + ENNReal.ofReal r := by\n rw [ENNReal.ofReal_add hr_nonneg hr_nonneg]\n _ = ENNReal.ofReal ((r + r) + r) := by\n have h2r : 0 ≤ r + r := by linarith\n rw [ENNReal.ofReal_add h2r hr_nonneg]\n _ = ENNReal.ofReal (3 * r) := by\n congr 1; ring\n _ < ENNReal.ofReal ε := by\n -- Show 3√(Cf/k) < ε using k > 9Cf/ε²\n have hε_pos : 0 < ε := hε\n -- First establish k > 9Cf/ε²\n have h_k_large : 9 * Cf / ε ^ 2 < (k : ℝ) := by\n have h_ceil : 9 * Cf / ε ^ 2 ≤ Nat.ceil (9 * Cf / ε ^ 2) := Nat.le_ceil _\n have h_succ : (Nat.ceil (9 * Cf / ε ^ 2) : ℝ) < k := by\n simp only [k]\n norm_cast\n omega\n linarith\n -- Now show Cf/k < ε²/9\n have h_frac : Cf / k < ε ^ 2 / 9 := by\n have hk_pos_real : 0 < (k : ℝ) := Nat.cast_pos.mpr hk_pos\n have h_nine_pos : (0 : ℝ) < 9 := by norm_num\n by_cases hCf_zero : Cf = 0\n · rw [hCf_zero]\n simp only [zero_div]\n exact div_pos (sq_pos_of_pos hε_pos) h_nine_pos\n · have hCf_pos : 0 < Cf := by\n rcases hCf_nonneg.lt_or_eq with h | h\n · exact h\n · exact absurd h.symm hCf_zero\n have h_denom : 0 < 9 * Cf / ε ^ 2 := by\n apply div_pos\n · exact mul_pos h_nine_pos hCf_pos\n · exact sq_pos_of_pos hε_pos\n have h_eq : Cf / (9 * Cf / ε ^ 2) = ε ^ 2 / 9 := by field_simp\n calc Cf / k < Cf / (9 * Cf / ε ^ 2) := div_lt_div_of_pos_left hCf_pos h_denom h_k_large\n _ = ε ^ 2 / 9 := h_eq\n -- So √(Cf/k) < ε/3\n have h_sqrt : Real.sqrt (Cf / k) < ε / 3 := by\n have h_bound : Cf / k < (ε / 3) ^ 2 := by\n calc Cf / k < ε ^ 2 / 9 := h_frac\n _ = (ε / 3) ^ 2 := by ring\n have hε3_pos : 0 < ε / 3 := by linarith\n rw [← Real.sqrt_sq (le_of_lt hε3_pos)]\n exact Real.sqrt_lt_sqrt (div_nonneg hCf_nonneg (Nat.cast_nonneg k)) h_bound\n -- Therefore 3√(Cf/k) < ε\n have h_real : 3 * Real.sqrt (Cf / k) < ε := by\n calc 3 * Real.sqrt (Cf / k)\n < 3 * (ε / 3) := mul_lt_mul_of_pos_left h_sqrt (by norm_num : (0 : ℝ) < 3)\n _ = ε := by ring\n -- Lift to ENNReal\n exact ENNReal.ofReal_lt_ofReal_iff hε_pos |>.mpr h_real\n\n have hA_cauchy_L1_0 : ∀ ε > 0, ∃ N, ∀ m ℓ, m ≥ N → ℓ ≥ N →\n eLpNorm (fun ω => A 0 m ω - A 0 ℓ ω) 1 μ < ENNReal.ofReal ε := by\n intro ε hε\n rcases hA_cauchy_L2_0 ε hε with ⟨N, hN⟩\n refine ⟨N, fun m ℓ hm hℓ => ?_⟩\n calc eLpNorm (fun ω => A 0 m ω - A 0 ℓ ω) 1 μ\n ≤ eLpNorm (fun ω => A 0 m ω - A 0 ℓ ω) 2 μ := by\n apply eLpNorm_le_eLpNorm_of_exponent_le\n · norm_num\n · exact (hA_meas 0 m).sub (hA_meas 0 ℓ) |>.aestronglyMeasurable\n _ < ENNReal.ofReal ε := hN m ℓ hm hℓ\n\n -- Step 2: Completeness of L¹ gives α₀ as the limit of the base averages.\n have h_exist_alpha_0 :\n ∃ alpha_0 : Ω → ℝ, Measurable alpha_0 ∧ MemLp alpha_0 1 μ ∧\n (∀ ε > 0, ∃ M, ∀ m ≥ M,\n eLpNorm (fun ω => A 0 m ω - alpha_0 ω) 1 μ < ENNReal.ofReal ε) := by\n classical\n -- View the base averages as a sequence in L¹.\n let F : ℕ → Lp ℝ 1 μ := fun m => (hA_memLp 0 m).toLp (A 0 m)\n -- Show this sequence is Cauchy.\n have hCauchy : CauchySeq F := by\n rw [Metric.cauchySeq_iff]\n intro ε hε\n obtain ⟨N, hN⟩ := hA_cauchy_L1_0 ε hε\n refine ⟨N, fun m hm ℓ hℓ => ?_⟩\n have hdist :\n dist (F m) (F ℓ) =\n ENNReal.toReal (eLpNorm (fun ω => A 0 m ω - A 0 ℓ ω) 1 μ) := by\n simpa [F] using\n L2Helpers.dist_toLp_eq_eLpNorm_sub (hA_memLp 0 m) (hA_memLp 0 ℓ)\n have hfin :\n eLpNorm (fun ω => A 0 m ω - A 0 ℓ ω) 1 μ ≠ ⊤ :=\n (MemLp.sub (hA_memLp 0 m) (hA_memLp 0 ℓ)).eLpNorm_ne_top\n have hbound := hN m ℓ hm hℓ\n have hlt :\n ENNReal.toReal (eLpNorm (fun ω => A 0 m ω - A 0 ℓ ω) 1 μ) < ε :=\n L2Helpers.toReal_lt_of_lt_ofReal hfin (le_of_lt hε) hbound\n simpa [hdist]\n -- Since L¹ is complete, the sequence converges to some `G`.\n rcases CompleteSpace.complete (show Cauchy (atTop.map F) from hCauchy) with ⟨G, hG⟩\n have hG' : Tendsto F atTop (𝓝 G) := hG\n -- Choose a measurable representative of `G`.\n let alpha : Ω → ℝ := (Lp.aestronglyMeasurable G).mk G\n have h_alpha_ae : G =ᵐ[μ] alpha :=\n (Lp.aestronglyMeasurable G).ae_eq_mk\n have halpha_meas : Measurable alpha :=\n (Lp.aestronglyMeasurable G).measurable_mk\n have halpha_mem : MemLp alpha 1 μ :=\n MemLp.ae_eq h_alpha_ae (Lp.memLp G)\n refine ⟨alpha, halpha_meas, halpha_mem, ?_⟩\n -- Convert convergence in L¹ to convergence of raw functions.\n intro ε hε\n obtain ⟨M, hM⟩ := Metric.tendsto_atTop.mp hG' ε hε\n refine ⟨M, fun m hm => ?_⟩\n have hdist_lt : dist (F m) G < ε := hM m hm\n have hdist :\n dist (F m) G =\n ENNReal.toReal (eLpNorm (fun ω => A 0 m ω - G ω) 1 μ) := by\n simpa [F] using\n L2Helpers.dist_toLp_eq_eLpNorm_sub (hA_memLp 0 m) (Lp.memLp G)\n have hfin :\n eLpNorm (fun ω => A 0 m ω - G ω) 1 μ ≠ ⊤ :=\n (MemLp.sub (hA_memLp 0 m) (Lp.memLp G)).eLpNorm_ne_top\n have htoReal :\n ENNReal.toReal (eLpNorm (fun ω => A 0 m ω - G ω) 1 μ) < ε := by\n simpa [hdist] using hdist_lt\n -- Relate the difference with `alpha` via the a.e. equality.\n have h_sub :\n (fun ω => A 0 m ω - alpha ω) =ᵐ[μ]\n fun ω => A 0 m ω - G ω := by\n filter_upwards [h_alpha_ae] with ω hω\n simp [A, hω]\n have h_eq :\n eLpNorm (fun ω => A 0 m ω - alpha ω) 1 μ =\n eLpNorm (fun ω => A 0 m ω - G ω) 1 μ :=\n (eLpNorm_congr_ae h_sub).trans rfl\n -- Convert the real inequality to one in `ℝ≥0∞`.\n have h_lt :\n eLpNorm (fun ω => A 0 m ω - G ω) 1 μ\n < ENNReal.ofReal ε := by\n have h_ofReal :\n ENNReal.ofReal (ENNReal.toReal\n (eLpNorm (fun ω => A 0 m ω - G ω) 1 μ)) < ENNReal.ofReal ε :=\n ENNReal.ofReal_lt_ofReal_iff hε |>.mpr htoReal\n rw [ENNReal.ofReal_toReal hfin] at h_ofReal\n exact h_ofReal\n rw [h_eq]\n exact h_lt\n\n obtain ⟨alpha_0, halpha_0_meas, halpha_0_mem, halpha_0_conv⟩ := h_exist_alpha_0\n\n -- Step 3: KEY - Prove alpha_0 works for ALL starting indices n\n -- For any n, show A n m → alpha_0 using the uniform two-window bound\n have halpha_0_univ : ∀ n, ∀ ε > 0, ∃ M, ∀ m ≥ M,\n eLpNorm (fun ω => A n m ω - alpha_0 ω) 1 μ < ENNReal.ofReal ε := by\n intro n ε hε\n -- Triangle inequality: ‖A n m - alpha_0‖₁ ≤ ‖A n m - A 0 m‖₂ + ‖A 0 m - alpha_0‖₁\n -- Term 1: ‖A n m - A 0 m‖₂ bounded by l2_bound_two_windows, goes to 0 as m → ∞\n -- Term 2: ‖A 0 m - alpha_0‖₁ → 0 as m → ∞ by halpha_0_conv\n\n have hε2_pos : 0 < ε / 2 := by linarith\n\n -- Get M₁ such that ‖A 0 m - alpha_0‖₁ < ε/2 for m ≥ M₁\n rcases halpha_0_conv (ε / 2) hε2_pos with ⟨M₁, hM₁⟩\n\n -- Get uniform bound constant (already computed above, reuse it)\n -- Note: Cf, mf, σSqf, ρf are already in scope from line 2186\n\n -- Choose M₂ large enough that √(Cf/M₂) < ε/2\n -- This means Cf/M₂ < ε²/4, so M₂ > 4Cf/ε²\n have hε_sq_pos : 0 < (ε / 2) ^ 2 := pow_pos hε2_pos 2\n\n let M₂ := Nat.ceil (4 * Cf / (ε ^ 2)) + 1\n\n -- Define M as max of M₁, M₂, and 2*n+1 to ensure m is large\n -- For A n m vs A 0 m: we use indices {n+1,...,n+m} vs {1,...,m}\n -- These overlap when n < m, so we can't directly use disjoint windows\n -- Instead, wait for m large enough that we can use a different approach\n let M := max (max M₁ M₂) (2 * n + 1)\n\n use M\n intro m hm\n have hm₁ : M₁ ≤ m := by\n calc M₁ ≤ max M₁ M₂ := le_max_left M₁ M₂\n _ ≤ M := le_max_left _ _\n _ ≤ m := hm\n have hm₂ : M₂ ≤ m := by\n calc M₂ ≤ max M₁ M₂ := le_max_right M₁ M₂\n _ ≤ M := le_max_left _ _\n _ ≤ m := hm\n have hmn : n < m := by\n calc n < 2 * n + 1 := by omega\n _ ≤ M := le_max_right _ _\n _ ≤ m := hm\n\n -- Apply triangle inequality\n have h_triangle : eLpNorm (fun ω => A n m ω - alpha_0 ω) 1 μ ≤\n eLpNorm (fun ω => A n m ω - A 0 m ω) 1 μ +\n eLpNorm (fun ω => A 0 m ω - alpha_0 ω) 1 μ := by\n -- Use eLpNorm triangle: ‖f - h‖ ≤ ‖f - g‖ + ‖g - h‖\n -- This follows from the fact that (f - h) = (f - g) + (g - h)\n have h_decomp : (fun ω => A n m ω - alpha_0 ω) =\n fun ω => (A n m ω - A 0 m ω) + (A 0 m ω - alpha_0 ω) := by\n ext ω; ring\n rw [h_decomp]\n -- Apply eLpNorm_add_le from Mathlib\n apply eLpNorm_add_le\n · exact (hA_meas n m).sub (hA_meas 0 m) |>.aestronglyMeasurable\n · exact (hA_meas 0 m).sub halpha_0_meas |>.aestronglyMeasurable\n · norm_num\n\n -- Bound term 2\n have h_term2 : eLpNorm (fun ω => A 0 m ω - alpha_0 ω) 1 μ < ENNReal.ofReal (ε / 2) := by\n apply hM₁; exact hm₁\n\n -- Bound term 1 using L² → L¹ and l2_bound_two_windows\n have h_term1 : eLpNorm (fun ω => A n m ω - A 0 m ω) 1 μ < ENNReal.ofReal (ε / 2) := by\n -- Use l2_bound_two_windows to bound ∫ (A n m - A 0 m)² ≤ Cf / m\n by_cases hm_pos : 0 < m\n · -- Use the uniform two-window L² bound (valid even for overlapping windows)\n have h_bound_sq' : ∫ ω, (A n m ω - A 0 m ω)^2 ∂μ ≤ Cf / m := by\n simpa [A] using h_window_bound n 0 m hm_pos\n have h_L2 : eLpNorm (fun ω => A n m ω - A 0 m ω) 2 μ ≤\n ENNReal.ofReal (Real.sqrt (Cf / m)) := by\n apply L2Helpers.eLpNorm_two_from_integral_sq_le\n · exact (hA_memLp_two n m).sub (hA_memLp_two 0 m)\n · exact div_nonneg hCf_nonneg (Nat.cast_nonneg m)\n · exact h_bound_sq'\n -- Use L² → L¹\n calc eLpNorm (fun ω => A n m ω - A 0 m ω) 1 μ\n ≤ eLpNorm (fun ω => A n m ω - A 0 m ω) 2 μ := by\n apply eLpNorm_le_eLpNorm_of_exponent_le\n · norm_num\n · exact (hA_meas n m).sub (hA_meas 0 m) |>.aestronglyMeasurable\n _ ≤ ENNReal.ofReal (Real.sqrt (Cf / m)) := h_L2\n _ < ENNReal.ofReal (ε / 2) := by\n apply ENNReal.ofReal_lt_ofReal_iff hε2_pos |>.mpr\n apply L2Helpers.sqrt_div_lt_half_eps_of_nat hCf_nonneg hε\n exact hm₂\n · -- m = 0 case is trivial or doesn't occur\n simp at hm\n omega\n\n -- Combine\n calc eLpNorm (fun ω => A n m ω - alpha_0 ω) 1 μ\n ≤ eLpNorm (fun ω => A n m ω - A 0 m ω) 1 μ +\n eLpNorm (fun ω => A 0 m ω - alpha_0 ω) 1 μ := h_triangle\n _ < ENNReal.ofReal (ε / 2) + ENNReal.ofReal (ε / 2) := by\n exact ENNReal.add_lt_add h_term1 h_term2\n _ = ENNReal.ofReal ε := by\n rw [← ENNReal.ofReal_add hε2_pos.le hε2_pos.le]; norm_num\n\n -- Step 4: Package the result - alpha_0 is our answer!\n refine ⟨alpha_0, halpha_0_meas, halpha_0_mem, ?_⟩\n\n -- Convert eLpNorm convergence to integral convergence\n intro n ε hε\n rcases halpha_0_univ n ε hε with ⟨M, hM⟩\n refine ⟨M, fun m hm => ?_⟩\n have h_elpnorm := hM m hm\n -- Convert eLpNorm 1 to integral\n have h_memLp : MemLp (fun ω => A n m ω - alpha_0 ω) 1 μ := by\n apply MemLp.sub\n · exact hA_memLp n m\n · exact halpha_0_mem\n rw [MemLp.eLpNorm_eq_integral_rpow_norm one_ne_zero ENNReal.coe_ne_top h_memLp] at h_elpnorm\n simp only [ENNReal.toReal_one, Real.rpow_one] at h_elpnorm\n norm_num at h_elpnorm\n rw [ENNReal.ofReal_lt_ofReal_iff hε] at h_elpnorm\n convert h_elpnorm using 1\n","line":54,"end_line":608,"proof_status":"formalized"} | |
| {"id":"lem:pi_system","label":"pi_system","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":[],"nlp_text":"Measures on product spaces are determined by their finite-dimensional marginals.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.measure_eq_of_fin_marginals_eq","latex_link":"sect0005.html#lem:pi_system","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.measure_eq_of_fin_marginals_eq","lean_decl_name":"Exchangeability.measure_eq_of_fin_marginals_eq","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/Core.lean","lean4_code":"/--\nFinite measures with matching finite-dimensional marginals are equal.\n\nIf two finite measures on `ℕ → α` induce the same distribution on each\nfinite-dimensional projection `Fin n → α`, then they are equal. This is a\nconsequence of the π-system uniqueness theorem applied to prefix cylinders.\n\n**Mathematical content:** This is a Kolmogorov extension-type result showing\nthat infinite-dimensional measures are determined by their finite marginals.\n\n**Proof structure:** The proof decomposes into three steps:\n1. Measures agree on total mass (via 1-dimensional marginal)\n2. Measures agree on all prefix cylinders (direct from marginals)\n3. Apply π-system uniqueness to extend agreement to all measurable sets\n-/\n@[nolint unusedArguments]\ntheorem measure_eq_of_fin_marginals_eq {μ ν : Measure (ℕ → α)}\n [IsFiniteMeasure μ] [IsFiniteMeasure ν]\n (h : ∀ n (S : Set (Fin n → α)) (_hS : MeasurableSet S),\n Measure.map (prefixProj (α:=α) n) μ S =\n Measure.map (prefixProj (α:=α) n) ν S) : μ = ν := by\n classical\n apply MeasureTheory.ext_of_generate_finite (C:=prefixCylinders (α:=α))\n · simp [generateFrom_prefixCylinders (α:=α)]\n · exact isPiSystem_prefixCylinders (α:=α)\n · exact prefixCylinders_eq_of_fin_marginals_eq (α:=α) h\n · exact totalMass_eq_of_fin_marginals_eq (α:=α) h\n","line":320,"end_line":346,"proof_status":"formalized"} | |
| {"id":"def:blockAvg_L2","label":"blockAvg_L2","background_color":"#B0ECA3","border_color":"green","kind":"box","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":[],"nlp_text":"The block average \\(A_n = \\frac{1}{n}\\sum _{i=0}^{n-1} f(X_i)\\) for bounded measurable \\(f\\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaL2.blockAvg","latex_link":"sect0004.html#def:blockAvg_L2","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaL2.blockAvg","lean_decl_name":"Exchangeability.DeFinetti.ViaL2.blockAvg","kind_description":"definitions","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaL2/BlockAvgDef.lean","lean4_code":"/-- **Block Cesàro average** of a function along a sequence.\n\nFor a function `f : α → ℝ` and sequence `X : ℕ → Ω → α`, the block average\nstarting at index `m` with length `n` is:\n\n A_{m,n}(ω) := (1/n) ∑_{k=0}^{n-1} f(X_{m+k}(ω))\n\nThis is the building block for Kallenberg's L² convergence proof. -/\ndef blockAvg (f : α → ℝ) (X : ℕ → Ω → α) (m n : ℕ) (ω : Ω) : ℝ :=\n (n : ℝ)⁻¹ * (Finset.range n).sum (fun k => f (X (m + k) ω))\n","line":37,"end_line":46,"proof_status":"formalized"} | |
| {"id":"def:exchangeable","label":"exchangeable","background_color":"#B0ECA3","border_color":"green","kind":"box","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":[],"nlp_text":"A sequence \\((X_n)_{n \\in \\mathbb {N}}\\) of random variables is exchangeable with respect to measure \\(\\mu \\) if for every \\(n \\in \\mathbb {N}\\) and every permutation \\(\\sigma \\) of \\(\\{ 0, \\ldots , n-1\\} \\), the joint distribution of \\((X_{\\sigma (0)}, \\ldots , X_{\\sigma (n-1)})\\) equals that of \\((X_0, \\ldots , X_{n-1})\\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.Exchangeable","latex_link":"sect0002.html#def:exchangeable","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.Exchangeable","lean_decl_name":"Exchangeability.Exchangeable","kind_description":"definitions","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"./paper/NOTES.md","lean4_code":"def Exchangeable (μ : Measure Ω) (X : ℕ → Ω → α) : Prop :=\n ∀ n (σ : Equiv.Perm (Fin n)),\n Measure.map (fun ω i => X (σ i) ω) μ =\n Measure.map (fun ω i => X i ω) μ\n\n-- Contractable: strictly monotone subsequence invariance\n","line":379,"end_line":384,"proof_status":"formalized"} | |
| {"id":"def:contractable","label":"contractable","background_color":"#B0ECA3","border_color":"green","kind":"box","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["def:exchangeable"],"nlp_text":"A sequence \\((X_n)_{n \\in \\mathbb {N}}\\) is contractable with respect to measure \\(\\mu \\) if for all \\(m \\in \\mathbb {N}\\) and all strictly increasing functions \\(k, k' : \\mathrm{Fin}(m) \\to \\mathbb {N}\\), the joint distribution of \\((X_{k(0)}, \\ldots , X_{k(m-1)})\\) equals that of \\((X_{k'(0)}, \\ldots , X_{k'(m-1)})\\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.Contractable","latex_link":"sect0002.html#def:contractable","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.Contractable","lean_decl_name":"Exchangeability.Contractable","kind_description":"definitions","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"./paper/NOTES.md","lean4_code":"def Contractable (μ : Measure Ω) (X : ℕ → Ω → α) : Prop :=\n ∀ m (k : Fin m → ℕ), StrictMono k →\n Measure.map (fun ω i => X (k i) ω) μ =\n Measure.map (fun ω i => X i.val ω) μ\n\n-- ConditionallyIID: mixture of i.i.d. with random directing measure\n","line":385,"end_line":390,"proof_status":"formalized"} | |
| {"id":"lem:integral_prod_blockAvg","label":"integral_prod_blockAvg","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["def:contractable","def:blockAvg"],"nlp_text":"For contractable sequences, integrals of products factor through block averages.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaKoopman.integral_prod_eq_integral_blockAvg","latex_link":"sect0004.html#lem:integral_prod_blockAvg","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaKoopman.integral_prod_eq_integral_blockAvg","lean_decl_name":"Exchangeability.DeFinetti.ViaKoopman.integral_prod_eq_integral_blockAvg","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaKoopman/BlockAverage.lean","lean4_code":"/-- Averaging over all choice functions yields product of block averages.\n\nFor any bounded measurable fs : Fin m → α → ℝ:\n`∫ ∏ᵢ fᵢ(ωᵢ) dμ = ∫ ∏ᵢ blockAvg m n i fᵢ ω dμ`\n\nThis is proved by:\n1. For each j : Fin m → Fin n, contractability gives ∫ ∏ fᵢ(ωᵢ) = ∫ ∏ fᵢ(ω(ρⱼ(i)))\n2. Sum over all j and divide by n^m to get block averages\n-/\n@[nolint unusedArguments]\nlemma integral_prod_eq_integral_blockAvg\n (_hσ : MeasurePreserving shift μ μ)\n (hContract : ∀ (m' : ℕ) (k : Fin m' → ℕ), StrictMono k →\n Measure.map (fun ω i => ω (k i)) μ = Measure.map (fun ω (i : Fin m') => ω i.val) μ)\n {m n : ℕ} (hn : 0 < n)\n (fs : Fin m → α → ℝ)\n (hfs_meas : ∀ i, Measurable (fs i))\n (hfs_bd : ∀ i, ∃ C, ∀ x, |fs i x| ≤ C) :\n ∫ ω, (∏ i : Fin m, fs i (ω i.val)) ∂μ =\n ∫ ω, (∏ i : Fin m, blockAvg m n i (fs i) ω) ∂μ := by\n -- The proof uses averaging over all choice functions j : Fin m → Fin n.\n --\n -- Key steps:\n -- 1. For each j, blockInjection m n j is strictly monotone\n -- 2. By contractability, ∫ ∏ fᵢ(ωᵢ) = ∫ ∏ fᵢ(ω(ρⱼ(i))) for each j\n -- 3. The integral is independent of j, so we can average over all j\n -- 4. (1/n^m) * ∑_j ∏ fᵢ(ω(ρⱼ(i))) = ∏ blockAvg_i\n --\n -- The key observation is that for fixed ω and i:\n -- (1/n^m) * ∑_{j : Fin m → Fin n} f_i(ω(i*n + j(i)))\n -- = (1/n^m) * n^{m-1} * ∑_{l=0}^{n-1} f_i(ω(i*n + l))\n -- = (1/n) * ∑_{l=0}^{n-1} f_i(ω(i*n + l))\n -- = blockAvg m n i (f_i) ω\n --\n -- The product distributes because each f_i depends only on j(i), and the\n -- coordinates j(i) for different i are independent in the sum.\n\n -- Step 1: For each j : Fin m → Fin n, contractability gives equal integrals\n have h_each_j : ∀ j : Fin m → Fin n,\n ∫ ω, (∏ i : Fin m, fs i (ω i.val)) ∂μ =\n ∫ ω, (∏ i : Fin m, fs i (ω (blockInjection m n j i.val))) ∂μ := by\n intro j\n -- blockInjection is strictly monotone\n have h_mono : StrictMono (blockInjection m n j) := blockInjection_strictMono m n hn j\n -- Define k(i) = blockInjection m n j i for i : Fin m\n let k : Fin m → ℕ := fun i => blockInjection m n j i.val\n -- k is strictly monotone (restriction of strictly monotone function to Fin m)\n have hk_mono : StrictMono k := fun _ _ hii' => h_mono hii'\n -- Apply contractability\n exact integral_prod_reindex_of_contractable hContract fs hfs_meas hfs_bd hk_mono\n\n -- Step 2: Key algebraic identity - product of block averages equals averaged sum\n -- Using Fintype.prod_sum: ∏ i, ∑ k, f i k = ∑ φ, ∏ i, f i (φ i)\n --\n -- The identity is:\n -- ∏ i, blockAvg m n i (fs i) ω = (1/n)^m * ∑_{j : Fin m → Fin n} ∏ i, fs i (ω(i*n + j(i)))\n --\n -- Proof:\n -- 1. blockAvg m n i (fs i) ω = (1/n) * ∑_{k=0}^{n-1} fs i (ω(i*n + k))\n -- 2. ∏ i, (1/n) * ∑_k f_i(k) = ∏ i, ∑_k (1/n) * f_i(k) (pull scalar into sum)\n -- 3. ∏ i, ∑_k g_i(k) = ∑_φ ∏ i, g_i(φ(i)) (Fintype.prod_sum)\n -- 4. ∑_φ ∏ i, (1/n) * f_i(φ(i)) = ∑_φ (1/n)^m * ∏ i, f_i(φ(i)) (factor out)\n -- 5. = (1/n)^m * ∑_φ ∏ i, f_i(φ(i))\n\n -- Step 3: LHS is constant in j, so equals average over all j\n -- Since h_each_j says LHS = RHS(j) for each j, and LHS doesn't depend on j:\n -- n^m * LHS = ∑_j LHS = ∑_j RHS(j)\n have h_card : Fintype.card (Fin m → Fin n) = n^m := by simp [Fintype.card_fin]\n\n -- Case n = 0: vacuously true (no choice functions exist)\n -- Case m = 0: both sides are ∫ 1 dμ = 1\n\n -- The averaging argument:\n -- LHS = (1/n^m) * ∑_j ∫ ∏ fᵢ(ω(blockInjection)) dμ (since LHS is constant in j)\n -- = (1/n^m) * ∫ ∑_j ∏ fᵢ(ω(blockInjection)) dμ (Fubini - finite sum)\n -- = ∫ (1/n^m) * ∑_j ∏ fᵢ(ω(i*n + j(i))) dμ\n -- = ∫ ∏ blockAvg_i dμ (algebraic identity)\n\n -- Step 4: The key algebraic identity\n -- For each ω, we need to show:\n -- ∏ i, blockAvg m n i (fs i) ω = (1/n^m) * ∑_{j : Fin m → Fin n} ∏ i, fs i (ω(i*n + j(i)))\n --\n -- This follows from Fintype.prod_sum and the definition of blockAvg:\n -- ∏ i, ((1/n) * ∑_{k ∈ range n} fs i (ω(i*n + k)))\n -- = (1/n)^m * ∏ i, ∑_{k ∈ range n} fs i (ω(i*n + k))\n -- = (1/n)^m * ∑_{φ : Fin m → Fin n} ∏ i, fs i (ω(i*n + φ(i))) (by Fintype.prod_sum)\n\n have h_prod_blockAvg_eq : ∀ ω, ∏ i : Fin m, blockAvg m n i (fs i) ω =\n (1 / (n : ℝ)^m) * ∑ j : Fin m → Fin n, ∏ i : Fin m, fs i (ω (i.val * n + (j i).val)) := by\n intro ω\n -- The proof uses Fintype.prod_sum to distribute product over sums:\n -- ∏ i, ∑_k f i k = ∑_φ ∏ i, f i (φ i)\n --\n -- Applied to blockAvg:\n -- ∏ i, (1/n) * ∑_{k=0}^{n-1} fs i (ω(i*n + k))\n -- = (1/n)^m * ∏ i, ∑_{k=0}^{n-1} fs i (ω(i*n + k))\n -- = (1/n)^m * ∑_{φ : Fin m → Fin n} ∏ i, fs i (ω(i*n + φ(i)))\n\n -- Step 1: Unfold blockAvg using the non-zero block size\n simp_rw [blockAvg_pos_n hn]\n\n -- Step 2: Pull (1/n) out of each factor\n -- ∏ i, (1/n) * (∑_j ...) = (∏ i, (1/n)) * ∏ i, (∑_j ...)\n -- = (1/n)^m * ∏ i, (∑_j ...)\n have h_factor : ∏ i : Fin m, (1 / (n : ℝ)) * (Finset.range n).sum (fun j => fs i (ω (i.val * n + j))) =\n (1 / (n : ℝ))^m * ∏ i : Fin m, (Finset.range n).sum (fun j => fs i (ω (i.val * n + j))) := by\n -- Use Finset.prod_mul_distrib: ∏ i, f i * g i = (∏ i, f i) * (∏ i, g i)\n rw [Finset.prod_mul_distrib]\n -- Now: (∏ i, 1/n) * (∏ i, ∑_j ...) = (1/n)^m * (∏ i, ∑_j ...)\n congr 1\n -- (∏ i, 1/n) = (1/n)^m\n rw [Finset.prod_const, Finset.card_fin]\n\n rw [h_factor]\n -- Goal: (1/n)^m * ∏ i, (∑_{j ∈ range n} ...) = (1/n^m) * ∑_φ ∏ i, ...\n\n -- Step 3: Convert from Finset.range n to Fin n\n -- ∑ j ∈ Finset.range n, f j = ∑ j : Fin n, f j.val (by Fin.sum_univ_eq_sum_range)\n have h_range_to_fin : ∀ i : Fin m, (Finset.range n).sum (fun j => fs i (ω (i.val * n + j))) =\n ∑ j : Fin n, fs i (ω (i.val * n + j.val)) := by\n intro i\n conv_lhs => rw [← Fin.sum_univ_eq_sum_range (fun j => fs i (ω (i.val * n + j))) n]\n\n simp_rw [h_range_to_fin]\n\n -- Step 4: Apply Fintype.prod_sum: ∏ i, ∑ j, f i j = ∑ φ, ∏ i, f i (φ i)\n rw [Fintype.prod_sum]\n\n -- Goal: (1/n)^m * ∑ φ, ∏ i, f i (φ i) = (1/n^m) * ∑ φ, ∏ i, f i (φ i)\n -- Just need (1/n)^m = 1/(n^m)\n congr 1\n rw [one_div, one_div, inv_pow]\n\n -- Step 5: Combine h_each_j with h_prod_blockAvg_eq\n -- By h_each_j: ∀ j, ∫ ∏ fs(ωᵢ) = ∫ ∏ fs(ω(i*n + j(i)))\n -- Sum over j: n^m * ∫ ∏ fs(ωᵢ) = ∑_j ∫ ∏ fs(ω(i*n + j(i)))\n -- By Fubini: = ∫ ∑_j ∏ fs(ω(i*n + j(i)))\n -- By h_prod_blockAvg_eq: = ∫ n^m * ∏ blockAvg\n -- Divide by n^m: ∫ ∏ fs(ωᵢ) = ∫ ∏ blockAvg\n\n -- RHS: ∫ ∏ blockAvg = ∫ (1/n^m) * ∑_j ∏ fs(ω(i*n + j(i))) (by h_prod_blockAvg_eq)\n simp_rw [h_prod_blockAvg_eq]\n\n -- ∫ (1/n^m) * ∑_j ... = (1/n^m) * ∫ ∑_j ...\n rw [integral_const_mul]\n\n -- ∫ ∑_j ... = ∑_j ∫ ... (Fubini for finite sum)\n rw [integral_finset_sum]\n · -- Goal: ∫ ∏ fs(ωᵢ) = (1/n^m) * ∑_j ∫ ∏ fs(ω(i*n + j(i)))\n --\n -- By h_each_j: each ∫ ∏ fs(ω(i*n + j(i))) = ∫ ∏ fs(ωᵢ)\n -- (using blockInjection_val_lt: blockInjection m n j i.val = i*n + j(i))\n -- So: ∑_j ∫ ∏ fs(ω(i*n + j(i))) = n^m * ∫ ∏ fs(ωᵢ)\n -- Thus: (1/n^m) * n^m * ∫ ∏ fs(ωᵢ) = ∫ ∏ fs(ωᵢ)\n\n have h_each_term : ∀ j : Fin m → Fin n,\n ∫ ω, ∏ i : Fin m, fs i (ω (i.val * n + (j i).val)) ∂μ =\n ∫ ω, ∏ i : Fin m, fs i (ω i.val) ∂μ := by\n intro j\n -- Use h_each_j and blockInjection_val_lt\n rw [h_each_j j]\n -- The integrands match because blockInjection m n j i.val = i.val * n + (j i).val\n congr 1\n ext ω\n apply Finset.prod_congr rfl\n intro i _\n rw [blockInjection_val_lt]\n\n rw [Finset.sum_congr rfl (fun j _ => h_each_term j)]\n rw [Finset.sum_const, Finset.card_univ, h_card, nsmul_eq_mul]\n\n -- Goal: ∫ ∏ fs(ωᵢ) = (1/n^m) * (n^m * ∫ ∏ fs(ωᵢ))\n have hn_ne_zero : (n : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hn.ne'\n have hn_pow_ne_zero : (n : ℝ)^m ≠ 0 := pow_ne_zero m hn_ne_zero\n rw [Nat.cast_pow]\n field_simp\n\n -- Integrability: bounded measurable functions on prob space are integrable\n intro j _\n -- Get bound constants for each fs\n choose Cs hCs using hfs_bd\n -- Define the integrand for clarity\n let F : Ω[α] → ℝ := fun a => ∏ i : Fin m, fs i (a (i.val * n + (j i).val))\n -- Measurability: product of measurable functions is measurable\n have h_meas : Measurable F :=\n Finset.measurable_prod _ (fun i _ => (hfs_meas i).comp (measurable_pi_apply _))\n -- Apply Integrable.of_bound\n refine Integrable.of_bound h_meas.aestronglyMeasurable (∏ i : Fin m, |Cs i|) ?_\n filter_upwards with a\n rw [Real.norm_eq_abs]\n -- Bound: |∏ fs i (...)| = ∏ |fs i (...)| ≤ ∏ |Cs i|\n show |F a| ≤ _\n simp only [F]\n rw [Finset.abs_prod]\n apply Finset.prod_le_prod\n · intro i _; exact abs_nonneg _\n · intro i _; exact le_trans (hCs i _) (le_abs_self _)\n","line":309,"end_line":505,"proof_status":"formalized"} | |
| {"id":"lem:indicator_product_bridge_contractable","label":"indicator_product_bridge_contractable","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["def:contractable"],"nlp_text":"For contractable sequences, indicator products satisfy the bridge condition.","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.indicator_product_bridge_contractable","latex_link":"sect0004.html#lem:indicator_product_bridge_contractable","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.indicator_product_bridge_contractable","lean_decl_name":"Exchangeability.DeFinetti.indicator_product_bridge_contractable","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaKoopman.lean","lean4_code":"/-- Bridge condition for contractable measures: extends from StrictMono to Injective.\n\nThis is the key technical step connecting contractability to `conditional_iid_from_directing_measure`.\nThe proof uses that any injective function on Fin m can be sorted to a StrictMono one.\nThen contractability reduces to consecutive indices, and product commutativity handles reordering.\n\n**Proof sketch**:\n1. Sort k to get ρ : Fin m → ℕ (StrictMono) and σ : Fin m ≃ Fin m with k = ρ ∘ σ\n2. ∏ i, indicator(B i)(ω(k i)) = ∏ j, indicator(B(σ⁻¹ j))(ω(ρ j)) (reorder)\n3. By contractability: ∫ ... dμ at ρ-indices = ∫ ... dμ at consecutive indices\n4. By condexp_product_factorization_contractable: = ∫ ∏ j, (∫ indicator(B(σ⁻¹ j)) dν) dμ\n5. = ∫ ∏ i, ν(B i) dμ (by product commutativity)\n-/\nlemma indicator_product_bridge_contractable\n {μ : Measure (Ω[α])} [IsProbabilityMeasure μ] [StandardBorelSpace α]\n (hσ : MeasurePreserving shift μ μ)\n (hContract : ∀ (m : ℕ) (k : Fin m → ℕ), StrictMono k →\n Measure.map (fun ω i => ω (k i)) μ = Measure.map (fun ω (i : Fin m) => ω i.val) μ)\n (m : ℕ) (k : Fin m → ℕ) (hk : Function.Injective k) (B : Fin m → Set α)\n (hB_meas : ∀ i, MeasurableSet (B i)) :\n ∫⁻ ω, ∏ i : Fin m, ENNReal.ofReal ((B i).indicator (fun _ => (1 : ℝ)) (ω (k i))) ∂μ\n = ∫⁻ ω, ∏ i : Fin m, (ν (μ := μ) ω) (B i) ∂μ := by\n classical\n -- Handle m = 0 trivially (empty products are 1)\n rcases Nat.eq_zero_or_pos m with rfl | hm_pos\n · simp only [Finset.univ_eq_empty, Finset.prod_empty]\n -- For m > 0, we proceed by sorting k\n -- Step 1: Get σ : Perm (Fin m) such that ρ := fun i => k (σ i) is StrictMono\n obtain ⟨σ, hρ_mono⟩ := injective_implies_strictMono_perm k hk\n -- Define ρ := k ∘ σ (the sorted version of k)\n let ρ : Fin m → ℕ := fun i => k (σ i)\n -- Step 2: Product reindexing lemmas (k i = ρ (σ⁻¹ i) by definition)\n have h_lhs_reindex : ∀ ω : Ω[α],\n ∏ i, (B i).indicator (fun _ => (1 : ℝ)) (ω (k i)) =\n ∏ j, (B (σ j)).indicator (fun _ => (1 : ℝ)) (ω (ρ j)) := fun ω =>\n (Equiv.prod_comp σ (fun i => (B i).indicator (fun _ => (1 : ℝ)) (ω (k i)))).symm\n have h_rhs_reindex : ∀ ω : Ω[α],\n ∏ i, (ν (μ := μ) ω) (B i) = ∏ j, (ν (μ := μ) ω) (B (σ j)) := fun ω =>\n (Equiv.prod_comp σ (fun i => (ν (μ := μ) ω) (B i))).symm\n -- Step 3: Use contractability to reduce from ρ-indices to consecutive indices\n have h_contr_ρ := hContract m ρ hρ_mono\n -- Step 4: For consecutive indices, apply the existing factorization\n let fs_σ : Fin m → α → ℝ := fun j => (B (σ j)).indicator (fun _ => 1)\n have hfs_meas : ∀ j, Measurable (fs_σ j) := fun j =>\n Measurable.indicator measurable_const (hB_meas (σ j))\n have hfs_bd : ∀ j, ∃ C, ∀ x, |fs_σ j x| ≤ C := fun j => ⟨1, fun x => by\n by_cases h : x ∈ B (σ j) <;> simp [fs_σ, h]⟩\n -- Use conditional expectation factorization\n have h_ν_eq_ce : ∀ j, (fun ω => ∫ x, fs_σ j x ∂(ν (μ := μ) ω)) =ᵐ[μ]\n μ[fun ω' => fs_σ j (ω' 0) | mSI] := by\n intro j\n have hfj_int : Integrable (fun ω' => fs_σ j (ω' 0)) μ := by\n obtain ⟨C, hC⟩ := hfs_bd j\n apply Integrable.of_bound\n ((hfs_meas j).comp (measurable_pi_apply 0)).aestronglyMeasurable C\n exact ae_of_all μ (fun ω => (Real.norm_eq_abs _).trans_le (hC (ω 0)))\n have h_ce := condExp_ae_eq_integral_condExpKernel (shiftInvariantSigma_le (α := α)) hfj_int\n filter_upwards [h_ce] with ω hω\n calc ∫ x, fs_σ j x ∂(ν (μ := μ) ω)\n = ∫ y, fs_σ j (y 0) ∂(condExpKernel μ mSI ω) := integral_ν_eq_integral_condExpKernel ω (hfs_meas j)\n _ = μ[fun ω' => fs_σ j (ω' 0) | mSI] ω := hω.symm\n have h_prod_ae : (fun ω => ∏ j : Fin m, ∫ x, fs_σ j x ∂(ν (μ := μ) ω)) =ᵐ[μ]\n (fun ω => ∏ j : Fin m, μ[fun ω' => fs_σ j (ω' 0) | mSI] ω) := by\n have h_all := ae_all_iff.mpr h_ν_eq_ce\n filter_upwards [h_all] with ω hω\n exact Finset.prod_congr rfl (fun j _ => hω j)\n have h_fact := condexp_product_factorization_contractable hσ hContract fs_σ hfs_meas hfs_bd\n -- Tower property and consecutive-index result\n have h_consec : ∫ ω, (∏ j : Fin m, fs_σ j (ω j.val)) ∂μ =\n ∫ ω, (∏ j : Fin m, ∫ x, fs_σ j x ∂(ν (μ := μ) ω)) ∂μ := by\n have h_lhs_tower : ∫ ω, (∏ j : Fin m, fs_σ j (ω j.val)) ∂μ =\n ∫ ω, μ[(fun ω' => ∏ j : Fin m, fs_σ j (ω' j.val)) | mSI] ω ∂μ := by\n symm; apply integral_condExp (shiftInvariantSigma_le (α := α))\n rw [h_lhs_tower]\n apply integral_congr_ae\n filter_upwards [h_fact, h_prod_ae] with ω h_fact_ω h_prod_ω\n rw [h_fact_ω, ← h_prod_ω]\n have h_ind_integral : ∀ j ω, ∫ x, fs_σ j x ∂(ν (μ := μ) ω) = ((ν (μ := μ) ω) (B (σ j))).toReal :=\n fun j ω => integral_indicator_one (hB_meas (σ j))\n -- Step 5: Integral at ρ-indices equals integral at consecutive indices\n have h_ρ_to_consec : ∫ ω, ∏ j, fs_σ j (ω (ρ j)) ∂μ = ∫ ω, ∏ j, fs_σ j (ω j.val) ∂μ := by\n have hρ_meas : Measurable (fun (ω : Ω[α]) (j : Fin m) => ω (ρ j)) :=\n measurable_pi_lambda _ (fun j => measurable_pi_apply (ρ j))\n have hconsec_meas : Measurable (fun (ω : Ω[α]) (j : Fin m) => ω j.val) :=\n measurable_pi_lambda _ (fun j => measurable_pi_apply j.val)\n have hg_meas : Measurable (fun ω' : Fin m → α => ∏ j, fs_σ j (ω' j)) :=\n Finset.measurable_prod Finset.univ (fun j _ => (hfs_meas j).comp (measurable_pi_apply j))\n calc ∫ ω, ∏ j, fs_σ j (ω (ρ j)) ∂μ\n = ∫ ω', (fun ω'' => ∏ j, fs_σ j (ω'' j)) ω' ∂(Measure.map (fun ω j => ω (ρ j)) μ) := by\n rw [integral_map hρ_meas.aemeasurable hg_meas.aestronglyMeasurable]\n _ = ∫ ω', (fun ω'' => ∏ j, fs_σ j (ω'' j)) ω' ∂(Measure.map (fun ω j => ω j.val) μ) := by\n rw [h_contr_ρ]\n _ = ∫ ω, ∏ j, fs_σ j (ω j.val) ∂μ := by\n rw [integral_map hconsec_meas.aemeasurable hg_meas.aestronglyMeasurable]\n -- Define auxiliary functions for lintegral conversion\n let F_ρ : Ω[α] → ℝ := fun ω => ∏ j, fs_σ j (ω (ρ j))\n let G : Ω[α] → ℝ := fun ω => ∏ j, ((ν (μ := μ) ω) (B (σ j))).toReal\n have hF_nonneg : ∀ ω, 0 ≤ F_ρ ω := fun ω =>\n Finset.prod_nonneg (fun j _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _)\n have hF_bd : ∀ ω, F_ρ ω ≤ 1 := fun ω => by\n apply Finset.prod_le_one (fun j _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _)\n intro j _\n by_cases h : ω (ρ j) ∈ B (σ j)\n · simp only [Set.indicator_of_mem h]; norm_num\n · simp only [Set.indicator_of_notMem h]; norm_num\n have hF_int : Integrable F_ρ μ := by\n apply Integrable.of_bound (C := 1)\n · exact (Finset.measurable_prod Finset.univ (fun j _ =>\n (hfs_meas j).comp (measurable_pi_apply (ρ j)))).aestronglyMeasurable\n · exact ae_of_all μ (fun ω => by simp [Real.norm_eq_abs, abs_of_nonneg (hF_nonneg ω), hF_bd ω])\n have hG_nonneg : ∀ ω, 0 ≤ G ω := fun ω =>\n Finset.prod_nonneg (fun j _ => ENNReal.toReal_nonneg)\n have hG_bd : ∀ ω, G ω ≤ 1 := fun ω => by\n apply Finset.prod_le_one (fun j _ => ENNReal.toReal_nonneg)\n intro j _\n haveI : IsProbabilityMeasure (ν (μ := μ) ω) := ν_isProbabilityMeasure (μ := μ) ω\n exact ENNReal.toReal_le_of_le_ofReal (by linarith : (0 : ℝ) ≤ 1)\n (prob_le_one.trans_eq ENNReal.ofReal_one.symm)\n have hG_int : Integrable G μ := by\n apply Integrable.of_bound (C := 1)\n · exact (Finset.measurable_prod Finset.univ (fun j _ =>\n (ν_eval_measurable (hB_meas (σ j))).ennreal_toReal)).aestronglyMeasurable\n · exact ae_of_all μ (fun ω => by simp [Real.norm_eq_abs, abs_of_nonneg (hG_nonneg ω), hG_bd ω])\n -- Chain of equalities\n calc ∫⁻ ω, ∏ i, ENNReal.ofReal ((B i).indicator (fun _ => (1 : ℝ)) (ω (k i))) ∂μ\n = ∫⁻ ω, ∏ j, ENNReal.ofReal ((B (σ j)).indicator (fun _ => (1 : ℝ)) (ω (ρ j))) ∂μ := by\n congr 1; funext ω\n rw [← ENNReal.ofReal_prod_of_nonneg (fun i _ =>\n Set.indicator_nonneg (fun _ _ => zero_le_one) _)]\n rw [← ENNReal.ofReal_prod_of_nonneg (fun j _ =>\n Set.indicator_nonneg (fun _ _ => zero_le_one) _)]\n congr 1\n exact h_lhs_reindex ω\n _ = ∫⁻ ω, ENNReal.ofReal (F_ρ ω) ∂μ := by\n congr 1; funext ω\n rw [ENNReal.ofReal_prod_of_nonneg (fun j _ => Set.indicator_nonneg (fun _ _ => zero_le_one) _)]\n _ = ENNReal.ofReal (∫ ω, F_ρ ω ∂μ) :=\n (ofReal_integral_eq_lintegral_ofReal hF_int (ae_of_all μ hF_nonneg)).symm\n _ = ENNReal.ofReal (∫ ω, ∏ j, fs_σ j (ω j.val) ∂μ) := by rw [h_ρ_to_consec]\n _ = ENNReal.ofReal (∫ ω, G ω ∂μ) := by\n congr 1\n rw [h_consec]\n apply integral_congr_ae\n filter_upwards with ω\n simp only [G]; congr 1; ext j; exact h_ind_integral j ω\n _ = ∫⁻ ω, ENNReal.ofReal (G ω) ∂μ :=\n ofReal_integral_eq_lintegral_ofReal hG_int (ae_of_all μ hG_nonneg)\n _ = ∫⁻ ω, ∏ j, ENNReal.ofReal (((ν (μ := μ) ω) (B (σ j))).toReal) ∂μ := by\n congr 1; funext ω\n rw [ENNReal.ofReal_prod_of_nonneg (fun j _ => ENNReal.toReal_nonneg)]\n _ = ∫⁻ ω, ∏ j, (ν (μ := μ) ω) (B (σ j)) ∂μ := by\n congr 1; funext ω; congr 1; ext j\n haveI : IsProbabilityMeasure (ν (μ := μ) ω) := ν_isProbabilityMeasure (μ := μ) ω\n exact ENNReal.ofReal_toReal (measure_ne_top _ _)\n _ = ∫⁻ ω, ∏ i, (ν (μ := μ) ω) (B i) ∂μ := by\n congr 1; funext ω; conv_rhs => rw [h_rhs_reindex ω]\n","line":478,"end_line":633,"proof_status":"formalized"} | |
| {"id":"lem:pair_law_eq","label":"pair_law_eq","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["def:contractable"],"nlp_text":"For a contractable sequence and \\(k \\le m\\), the joint distribution of \\((X_k, X_{m+1}, X_{m+2}, \\ldots )\\) equals that of \\((X_m, X_{m+1}, X_{m+2}, \\ldots )\\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.pair_law_eq_of_contractable","latex_link":"sect0004.html#lem:pair_law_eq","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.pair_law_eq_of_contractable","lean_decl_name":"Exchangeability.DeFinetti.ViaMartingale.pair_law_eq_of_contractable","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaMartingale/PairLawEquality.lean","lean4_code":"/-- **Key lemma:** Contractability gives pair-law equality `(U, W) =^d (U, W')`.\n\nGiven a contractable sequence X:\n- `U` is the first r coordinates: `(X 0, ..., X (r-1))`\n- `W` is the future tail from m+1: `shiftRV X (m+1)`\n- `W'` is X_r consed onto W: `consRV (X r) (shiftRV X (m+1))`\n\nThen `(U, W) =^d (U, W')` because both arise from strictly increasing\nsubsequences of the same length (via φ₀ and φ₁).\n\nThis is the pair-law hypothesis needed for Kallenberg 1.3.\n\n**Proof strategy:**\n1. Embed (Fin r → α) × (ℕ → α) into (ℕ → α) via concatenation\n2. Show (U, W) and (U, W') map to reindexings of X via φ₀ and φ₁\n3. By contractability, these reindexings have equal finite marginals\n4. By π-system uniqueness, the embedded measures are equal\n5. Pull back to show (U, W) =^d (U, W') -/\nlemma pair_law_eq_of_contractable [IsProbabilityMeasure μ]\n {X : ℕ → Ω → α} (hContr : Contractable μ X) (hX : ∀ n, Measurable (X n))\n (r m : ℕ) (hr : r ≤ m) :\n let U := fun ω : Ω => (fun i : Fin r => X i ω)\n let W := shiftRV X (m+1)\n let W' := consRV (fun ω => X r ω) W\n Measure.map (fun ω => (U ω, W ω)) μ =\n Measure.map (fun ω => (U ω, W' ω)) μ := by\n intro U W W'\n\n -- Concatenation map: glue prefix (Fin r → α) and tail (ℕ → α) into (ℕ → α)\n let concat : (Fin r → α) × (ℕ → α) → (ℕ → α) := fun ⟨u, w⟩ n =>\n if h : n < r then u ⟨n, h⟩ else w (n - r)\n\n -- Split map: extract prefix and tail from (ℕ → α)\n let split : (ℕ → α) → (Fin r → α) × (ℕ → α) := fun f =>\n (fun i => f i.val, fun n => f (r + n))\n\n -- split ∘ concat = id\n have h_split_concat : ∀ p : (Fin r → α) × (ℕ → α), split (concat p) = p := fun ⟨u, w⟩ => by\n simp only [split, concat, Prod.mk.injEq]\n constructor\n · ext i\n have hi : (i : ℕ) < r := i.isLt\n simp only [hi, dite_true, Fin.eta]\n · ext n\n have h : ¬(r + n < r) := Nat.not_lt.mpr (Nat.le_add_right r n)\n simp only [h, dite_false, Nat.add_sub_cancel_left]\n\n -- Measurability of concat\n have h_concat_meas : Measurable concat := by\n rw [measurable_pi_iff]; intro n\n by_cases hn : n < r\n · simp only [concat, hn, dite_true]\n exact (measurable_pi_apply (⟨n, hn⟩ : Fin r)).comp measurable_fst\n · simp only [concat, hn, dite_false]\n exact (measurable_pi_apply (n - r : ℕ)).comp measurable_snd\n\n -- Measurability of split\n have h_split_meas : Measurable split := Measurable.prod\n (measurable_pi_iff.mpr fun i => measurable_pi_apply i.val)\n (measurable_pi_iff.mpr fun n => measurable_pi_apply (r + n))\n\n -- Define concatenated sequences\n let seq0 : Ω → ℕ → α := fun ω => concat (U ω, W ω)\n let seq1 : Ω → ℕ → α := fun ω => concat (U ω, W' ω)\n\n -- seq0 ω n = X (φ₀ n) ω\n have h_seq0 : ∀ ω n, seq0 ω n = X (phi0 r m n) ω := fun ω n => by\n simp only [seq0, concat, U, W, shiftRV, phi0]\n by_cases hn : n < r\n · simp only [hn, dite_true, ite_true]\n · simp only [hn, dite_false, ite_false]\n congr 1; omega\n\n -- seq1 ω n = X (φ₁ n) ω\n have h_seq1 : ∀ ω n, seq1 ω n = X (phi1 r m n) ω := fun ω n => by\n simp only [seq1, concat, U, W, W', consRV, shiftRV, phi1]\n by_cases hn : n < r\n · have hle : n ≤ r := Nat.le_of_lt hn\n simp only [hn, dite_true, hle, ite_true]\n · simp only [hn, dite_false]\n by_cases hn' : n = r\n · subst hn'; simp only [Nat.sub_self, le_refl, ite_true]\n · have hgt : r < n := Nat.lt_of_le_of_ne (Nat.not_lt.mp hn) (Ne.symm hn')\n simp only [Nat.not_le.mpr hgt, ite_false]\n -- Goal: (consRV (X r) (shiftRV X (m+1))) ω (n - r) = X (n + (m - r)) ω\n -- Since r < n, n - r = succ k for some k\n obtain ⟨k, hk⟩ := Nat.exists_eq_add_of_lt hgt\n subst hk\n -- n = r + k + 1, so (r + k + 1) - r = k + 1\n -- match on (k+1) gives X (m + 1 + k) ω\n -- need: m + 1 + k = (r + k + 1) + (m - r)\n have h_idx_eq : (r + k + 1) - r = k + 1 := by omega\n have h_final : m + 1 + k = (r + k + 1) + (m - r) := by omega\n conv_lhs => simp only [consRV, shiftRV, h_idx_eq]\n conv_rhs => rw [← h_final]\n\n -- Measurability of seq0 and seq1\n have hU_meas : Measurable U := measurable_pi_iff.mpr fun i => hX i.val\n have hW_meas : Measurable W := measurable_pi_iff.mpr fun n => hX (m + 1 + n)\n have hW'_meas : Measurable W' := by\n simp only [W']\n rw [measurable_pi_iff]; intro n\n match n with\n | 0 => exact hX r\n | n' + 1 => exact hX (m + 1 + n')\n\n have hseq0_meas : Measurable seq0 := h_concat_meas.comp (hU_meas.prodMk hW_meas)\n have hseq1_meas : Measurable seq1 := h_concat_meas.comp (hU_meas.prodMk hW'_meas)\n\n -- Finite marginals agree by contractability\n have h_marginals : ∀ k (S : Set (Fin k → α)), MeasurableSet S →\n Measure.map (prefixProj (α := α) k) (Measure.map seq0 μ) S =\n Measure.map (prefixProj (α := α) k) (Measure.map seq1 μ) S := fun k S hS => by\n rw [Measure.map_map (measurable_prefixProj (α := α)) hseq0_meas,\n Measure.map_map (measurable_prefixProj (α := α)) hseq1_meas]\n -- prefixProj k ∘ seq0 = fun ω i => X (φ₀ i) ω\n have hcomp0 : prefixProj (α := α) k ∘ seq0 = fun ω (i : Fin k) => X (phi0 r m i) ω :=\n funext fun ω => funext fun i => h_seq0 ω i\n have hcomp1 : prefixProj (α := α) k ∘ seq1 = fun ω (i : Fin k) => X (phi1 r m i) ω :=\n funext fun ω => funext fun i => h_seq1 ω i\n rw [hcomp0, hcomp1]\n -- Both φ₀ and φ₁ are strictly increasing, so by contractability equal distribution\n exact congrArg (· S) (hContr.allStrictMono_eq k\n (fun i : Fin k => phi0 r m i.val) (fun i : Fin k => phi1 r m i.val)\n (fun i j hij => phi0_strictMono r m hr hij) (fun i j hij => phi1_strictMono r m hr hij))\n\n -- Measures on ℕ → α are equal by π-system uniqueness (need probability instances)\n haveI : IsProbabilityMeasure (Measure.map seq0 μ) := Measure.isProbabilityMeasure_map hseq0_meas.aemeasurable\n haveI : IsProbabilityMeasure (Measure.map seq1 μ) := Measure.isProbabilityMeasure_map hseq1_meas.aemeasurable\n have h_seq_eq : Measure.map seq0 μ = Measure.map seq1 μ :=\n Exchangeability.measure_eq_of_fin_marginals_eq_prob (α := α) h_marginals\n\n -- Pull back via split\n have h0 : Measure.map (fun ω => (U ω, W ω)) μ = Measure.map (split ∘ seq0) μ :=\n congrArg (Measure.map · μ) <| funext fun ω => (h_split_concat (U ω, W ω)).symm\n have h1 : Measure.map (fun ω => (U ω, W' ω)) μ = Measure.map (split ∘ seq1) μ :=\n congrArg (Measure.map · μ) <| funext fun ω => (h_split_concat (U ω, W' ω)).symm\n rw [h0, h1]\n -- Use Measure.map_map to factor through seq0/seq1\n rw [← Measure.map_map h_split_meas hseq0_meas, ← Measure.map_map h_split_meas hseq1_meas]\n rw [h_seq_eq]\n","line":135,"end_line":275,"proof_status":"formalized"} | |
| {"id":"def:blockAvg","label":"blockAvg","background_color":"#B0ECA3","border_color":"green","kind":"box","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":[],"nlp_text":"The block average \\(A_{m,n,k}(f)(\\omega ) = \\frac{1}{n} \\sum _{j=0}^{n-1} f(\\omega _{k \\cdot n + j})\\) averages \\(f\\) over the \\(k\\)-th block of size \\(n\\) (indices \\([kn, kn+n)\\)). For \\(n = 0\\), the block average is defined as \\(0\\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaKoopman.blockAvg","latex_link":"sect0004.html#def:blockAvg","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaKoopman.blockAvg","lean_decl_name":"Exchangeability.DeFinetti.ViaKoopman.blockAvg","kind_description":"definitions","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaL2/BlockAvgDef.lean","lean4_code":"/-- **Block Cesàro average** of a function along a sequence.\n\nFor a function `f : α → ℝ` and sequence `X : ℕ → Ω → α`, the block average\nstarting at index `m` with length `n` is:\n\n A_{m,n}(ω) := (1/n) ∑_{k=0}^{n-1} f(X_{m+k}(ω))\n\nThis is the building block for Kallenberg's L² convergence proof. -/\ndef blockAvg (f : α → ℝ) (X : ℕ → Ω → α) (m n : ℕ) (ω : Ω) : ℝ :=\n (n : ℝ)⁻¹ * (Finset.range n).sum (fun k => f (X (m + k) ω))\n","line":37,"end_line":46,"proof_status":"formalized"} | |
| {"id":"lem:directingMeasure_isProb","label":"directingMeasure_isProb","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":["def:tailSigma"],"nlp_text":"The directing measure \\(\\nu (\\omega )(B) = \\mathbb {E}[\\mathbf{1}_{X_0 \\in B} \\mid \\mathcal{T}](\\omega )\\) is a probability measure for a.e. \\(\\omega \\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.directingMeasure_isProb","latex_link":"sect0004.html#lem:directingMeasure_isProb","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.directingMeasure_isProb","lean_decl_name":"Exchangeability.DeFinetti.ViaMartingale.directingMeasure_isProb","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaMartingale/DirectingMeasure.lean","lean4_code":"/-- The directing measure is (pointwise) a probability measure.\n\nUses: `isProbability_condExpKernel` and map preserves probability. -/\nlemma directingMeasure_isProb\n {Ω : Type*} [MeasurableSpace Ω] [StandardBorelSpace Ω]\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n {α : Type*} [MeasurableSpace α] [StandardBorelSpace α] [Nonempty α]\n (X : ℕ → Ω → α) (hX : ∀ n, Measurable (X n)) :\n ∀ ω, IsProbabilityMeasure (directingMeasure (μ := μ) X hX ω) :=\n fun _ => Measure.isProbabilityMeasure_map (hX 0).aemeasurable\n","line":77,"end_line":86,"proof_status":"formalized"} | |
| {"id":"lem:cdf_bounds","label":"cdf_bounds","background_color":"white","border_color":"green","kind":"ellipse","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":[],"nlp_text":"The limiting function \\(\\alpha (t, \\omega )\\) is a.e. in \\([0,1]\\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaL2.cdf_from_alpha_bounds","latex_link":"sect0004.html#lem:cdf_bounds","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaL2.cdf_from_alpha_bounds","lean_decl_name":"Exchangeability.DeFinetti.ViaL2.cdf_from_alpha_bounds","kind_description":"theorems and lemmas","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/DeFinetti/ViaL2/DirectingMeasureCore.lean","lean4_code":"/-- Bounds 0 ≤ F ≤ 1 (pointwise in ω,t). -/\nlemma cdf_from_alpha_bounds\n {μ : Measure Ω} [IsProbabilityMeasure μ]\n (X : ℕ → Ω → ℝ) (hX_contract : Contractable μ X)\n (hX_meas : ∀ i, Measurable (X i))\n (hX_L2 : ∀ i, MemLp (X i) 2 μ)\n (ω : Ω) (t : ℝ) :\n 0 ≤ cdf_from_alpha X hX_contract hX_meas hX_L2 ω t\n ∧ cdf_from_alpha X hX_contract hX_meas hX_L2 ω t ≤ 1 := by\n -- The stieltjesOfMeasurableRat construction produces a function with limits 0 at -∞ and 1 at +∞.\n -- By monotonicity, all values are in [0,1].\n let f := ProbabilityTheory.stieltjesOfMeasurableRat\n (alphaIicRat X hX_contract hX_meas hX_L2)\n (measurable_alphaIicRat X hX_contract hX_meas hX_L2)\n ω\n have h_tendsto_bot : Filter.Tendsto (f ·) Filter.atBot (𝓝 0) :=\n ProbabilityTheory.tendsto_stieltjesOfMeasurableRat_atBot\n (measurable_alphaIicRat X hX_contract hX_meas hX_L2) ω\n have h_tendsto_top : Filter.Tendsto (f ·) Filter.atTop (𝓝 1) :=\n ProbabilityTheory.tendsto_stieltjesOfMeasurableRat_atTop\n (measurable_alphaIicRat X hX_contract hX_meas hX_L2) ω\n have h_mono : Monotone (f ·) := f.mono\n constructor\n · -- Lower bound: f(t) ≥ 0\n -- For any s < t, f(s) ≤ f(t) by monotonicity.\n -- As s → -∞, f(s) → 0, so 0 ≤ f(t).\n -- Proof by contradiction: if f(t) < 0, pick ε = -f(t)/2 > 0.\n -- Then eventually f(s) ∈ (-ε, ε), so f(s) > -ε = f(t)/2.\n -- But also f(s) ≤ f(t) for s ≤ t, contradicting f(s) > f(t)/2 > f(t).\n by_contra h_neg\n push_neg at h_neg\n -- f(t) < 0, so ε := -f(t)/2 > 0\n set ε := -cdf_from_alpha X hX_contract hX_meas hX_L2 ω t / 2 with hε_def\n have hε_pos : 0 < ε := by simp [hε_def]; linarith\n -- Eventually f(s) ∈ (-ε, ε)\n have h_nhds : Set.Ioo (-ε) ε ∈ 𝓝 (0 : ℝ) := Ioo_mem_nhds (by linarith) hε_pos\n have h_preimage := h_tendsto_bot h_nhds\n rw [Filter.mem_map, Filter.mem_atBot_sets] at h_preimage\n obtain ⟨N, hN⟩ := h_preimage\n -- Take s = min N t, then s ≤ N and s ≤ t\n let s := min N t\n have hs_le_N : s ≤ N := min_le_left N t\n have hs_le_t : s ≤ t := min_le_right N t\n -- f(s) ∈ (-ε, ε)\n have hs_in : f s ∈ Set.Ioo (-ε) ε := hN s hs_le_N\n simp only [Set.mem_Ioo] at hs_in\n -- f(s) ≤ f(t) by monotonicity\n have hs_mono : f s ≤ f t := h_mono hs_le_t\n -- Connect f t with cdf_from_alpha\n have h_eq_t : (f : ℝ → ℝ) t = cdf_from_alpha X hX_contract hX_meas hX_L2 ω t := rfl\n -- Now we have: f(s) > -ε = f(t)/2 and f(s) ≤ f(t) < 0\n have h1 : f s > -ε := hs_in.1\n have h2 : -ε = cdf_from_alpha X hX_contract hX_meas hX_L2 ω t / 2 := by\n simp [hε_def]; ring\n -- f(s) > f(t)/2 and f(s) ≤ f(t) < 0\n -- If f(t) < 0, then f(t)/2 > f(t), so f(s) > f(t)/2 > f(t) contradicts f(s) ≤ f(t).\n have h_contra : cdf_from_alpha X hX_contract hX_meas hX_L2 ω t / 2 >\n cdf_from_alpha X hX_contract hX_meas hX_L2 ω t := by linarith\n linarith [h1, h2, hs_mono, h_eq_t, h_contra]\n · -- Upper bound: f(t) ≤ 1\n -- Similar argument: for any s > t, f(t) ≤ f(s) by monotonicity.\n -- As s → +∞, f(s) → 1, so f(t) ≤ 1.\n by_contra h_gt\n push_neg at h_gt\n -- f(t) > 1, so ε := (f(t) - 1)/2 > 0\n set ε := (cdf_from_alpha X hX_contract hX_meas hX_L2 ω t - 1) / 2 with hε_def\n have hε_pos : 0 < ε := by simp [hε_def]; linarith\n -- Eventually f(s) ∈ (1-ε, 1+ε)\n have h_nhds : Set.Ioo (1 - ε) (1 + ε) ∈ 𝓝 (1 : ℝ) := Ioo_mem_nhds (by linarith) (by linarith)\n have h_preimage := h_tendsto_top h_nhds\n rw [Filter.mem_map, Filter.mem_atTop_sets] at h_preimage\n obtain ⟨N, hN⟩ := h_preimage\n -- Take s = max N t, then s ≥ N and s ≥ t\n let s := max N t\n have hs_ge_N : N ≤ s := le_max_left N t\n have hs_ge_t : t ≤ s := le_max_right N t\n -- f(s) ∈ (1-ε, 1+ε)\n have hs_in : f s ∈ Set.Ioo (1 - ε) (1 + ε) := hN s hs_ge_N\n simp only [Set.mem_Ioo] at hs_in\n -- f(t) ≤ f(s) by monotonicity\n have hs_mono : f t ≤ f s := h_mono hs_ge_t\n -- Connect f t with cdf_from_alpha\n have h_eq_t : (f : ℝ → ℝ) t = cdf_from_alpha X hX_contract hX_meas hX_L2 ω t := rfl\n -- f(s) < 1 + ε = 1 + (f(t) - 1)/2 = (f(t) + 1)/2\n have h1 : f s < 1 + ε := hs_in.2\n have h2 : 1 + ε = (cdf_from_alpha X hX_contract hX_meas hX_L2 ω t + 1) / 2 := by\n simp [hε_def]; ring\n -- f(t) ≤ f(s) < (f(t) + 1)/2\n -- So f(t) < (f(t) + 1)/2, which means 2*f(t) < f(t) + 1, i.e., f(t) < 1.\n -- But we assumed f(t) > 1, contradiction.\n linarith [h1, h2, hs_mono, h_eq_t, h_gt]\n","line":103,"end_line":193,"proof_status":"formalized"} | |
| {"id":"def:tailSigma","label":"tailSigma","background_color":"#B0ECA3","border_color":"green","kind":"box","dep_graph_url":"https://cameronfreer.github.io/exchangeability/blueprint/dep_graph_document.html","dependencies":[],"nlp_text":"The tail \\(\\sigma \\)-algebra of a sequence \\((X_n)\\) is \\(\\mathcal{T} = \\bigcap _{n=0}^{\\infty } \\sigma (X_n, X_{n+1}, \\ldots )\\).","doc_url":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.tailSigma","latex_link":"sect0002.html#def:tailSigma","lean_link":"https://cameronfreer.github.io/exchangeability/docs/find/#doc/Exchangeability.DeFinetti.ViaMartingale.tailSigma","lean_decl_name":"Exchangeability.DeFinetti.ViaMartingale.tailSigma","kind_description":"definitions","status_from_color":"formalized","lookup_in_mathlib4v4.22.0":false,"found_in_mathlib4v4.22.0":false,"source_repo":"exchangeability","source_path":"Exchangeability/Ergodic/ShiftInvariantSigma.lean","lean4_code":"/-- The tail σ-algebra generated by the iterates of the left shift on path space. -/\ndef tailSigma : MeasurableSpace (Ω[α]) :=\n ⨅ n : ℕ, MeasurableSpace.comap (fun ω => (shift^[n]) ω) inferInstance\n","line":50,"end_line":52,"proof_status":"formalized"} | |