import OAI.Analysis.FiniteFactor.Coupling.Limit import OAI.Analysis.FiniteFactor.Coupling.Infinite namespace OAI namespace FiniteFactor open MeasureTheory Filter Finset open scoped Topology ENNReal noncomputable section namespace CouplingParameters /-- The source coordinates, retaining the block and the position in that block. -/ abbrev BlockCoordinate (m : ℕ → ℕ) := Σ s : ℕ, Fin (m s) def blockPrefix (m : ℕ → ℕ) (n : ℕ) : Finset (BlockCoordinate m) := (Finset.range n).sigma (fun _ => Finset.univ) theorem mem_blockPrefix (m : ℕ → ℕ) (n : ℕ) (i : BlockCoordinate m) : i ∈ blockPrefix m n ↔ i.1 < n := by simp [blockPrefix] theorem blockPrefix_mono (m : ℕ → ℕ) : Monotone (blockPrefix m) := by intro n k hnk i hi exact (mem_blockPrefix m k i).2 (lt_of_lt_of_le ((mem_blockPrefix m n i).1 hi) hnk) theorem blockPrefix_cover (m : ℕ → ℕ) (J : Finset (BlockCoordinate m)) : ∃ n, J ⊆ blockPrefix m n := by refine ⟨J.sup (fun i => i.1) + 1, fun i hi => ?_⟩ exact (mem_blockPrefix m _ i).2 (Nat.lt_succ_of_le (Finset.le_sup (f := fun i => i.1) hi)) theorem blockPrefix_energy (p : ℕ → CouplingParameters) (m : ℕ → ℕ) (hm : ∀ s, (p s).m = (m s : ℝ)) (j : ℕ) (htag : ∀ s, (p s).tagged = decide (s=j)) (hκ : Summable (fun s => (p s).kappa^2)) (right : BlockCoordinate m → Bool) (n : ℕ) : (∫ x, prefixDensity (fun i : BlockCoordinate m => p i.1) right (blockPrefix m n) x ^ 2 ∂Measure.infinitePi (fun _ : BlockCoordinate m => unitIntervalMeasure)) ≤ Real.exp (20*(2*(∑' s, (p s).kappa^2)+1)) := by apply (prefixDensity_energy _ right _).trans apply Real.exp_le_exp.mpr have heq : (∑ i ∈ blockPrefix m n, 20*(2*(p i.1).kappa^2/(p i.1).m + (p i.1).tagMass)) = 20 * ∑ s ∈ Finset.range n, (p s).m * (2*(p s).kappa^2/(p s).m + (p s).tagMass) := by rw [blockPrefix, Finset.sum_sigma] simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] rw [Finset.mul_sum] apply Finset.sum_congr rfl intro s _ rw [hm s] ring rw [heq] exact mul_le_mul_of_nonneg_left (uniform_block_budget p j htag hκ (Finset.range n)) (by norm_num) theorem infinite_block_source_density (p : ℕ → CouplingParameters) (m : ℕ → ℕ) (hm : ∀ s, (p s).m = (m s : ℝ)) (j : ℕ) (htag : ∀ s, (p s).tagged = decide (s=j)) (hκ : ∀ s, (p s).kappa = sourceKappa s) (right : BlockCoordinate m → Bool) : ∃ g : (BlockCoordinate m → ℝ) → ℝ, MemLp g 2 (Measure.infinitePi (fun _ : BlockCoordinate m => unitIntervalMeasure)) ∧ (∀ᵐ x ∂Measure.infinitePi (fun _ : BlockCoordinate m => unitIntervalMeasure), 0 ≤ g x) ∧ (∫ x, g x ^ 2 ∂Measure.infinitePi (fun _ : BlockCoordinate m => unitIntervalMeasure)) ≤ Real.exp (20*(2*(∑' s, sourceKappa s ^ 2)+1)) ∧ Measure.infinitePi (fun i : BlockCoordinate m => (p i.1).selectedLaw true (right i)) = (Measure.infinitePi (fun _ : BlockCoordinate m => unitIntervalMeasure)).withDensity (fun x => ENNReal.ofReal (g x)) := by apply infiniteEndpoint_density_of_prefix_bound _ right (blockPrefix m) (blockPrefix_mono m) (blockPrefix_cover m) intro n have hs : Summable (fun s => (p s).kappa^2) := by simpa only [hκ] using sourceKappa_sq_summable simpa only [hκ] using blockPrefix_energy p m hm j htag hs right n /-- Actual augmented law on the block-indexed coordinates. -/ def blockProductCoupling (p : ℕ → CouplingParameters) (m : ℕ → ℕ) : Measure (BlockCoordinate m → Fin 6 × (ℝ × ℝ)) := Measure.infinitePi (fun i => (p i.1).labelledCoupling) instance blockProductCoupling_probability (p : ℕ → CouplingParameters) (m : ℕ → ℕ) : IsProbabilityMeasure (blockProductCoupling p m) := by unfold blockProductCoupling; infer_instance def blockProductEndpoint {m : ℕ → ℕ} (right : BlockCoordinate m → Bool) (ω : BlockCoordinate m → Fin 6 × (ℝ × ℝ)) (i : BlockCoordinate m) : ℝ := endpoint (right i) (ω i).2 theorem blockProductEndpoint_law (p : ℕ → CouplingParameters) (m : ℕ → ℕ) (right : BlockCoordinate m → Bool) : (blockProductCoupling p m).map (blockProductEndpoint right) = Measure.infinitePi (fun i : BlockCoordinate m => (p i.1).selectedLaw true (right i)) := by unfold blockProductCoupling blockProductEndpoint rw [Measure.infinitePi_map_pi _ (f := fun (i : BlockCoordinate m) (z : Fin 6 × (ℝ × ℝ)) => endpoint (right i) z.2) (fun i => (endpoint_measurable (right i)).comp measurable_snd)] simp_rw [labelled_endpoint_density] rfl /-- The density belongs to the actual law of the selected endpoint map, rather than only to an abstract measure with matching finite moments. -/ theorem blockProductEndpoint_L2_density (p : ℕ → CouplingParameters) (m : ℕ → ℕ) (hm : ∀ s, (p s).m = (m s : ℝ)) (j : ℕ) (htag : ∀ s, (p s).tagged = decide (s=j)) (hκ : ∀ s, (p s).kappa = sourceKappa s) (right : BlockCoordinate m → Bool) : ∃ g : (BlockCoordinate m → ℝ) → ℝ, MemLp g 2 (Measure.infinitePi (fun _ : BlockCoordinate m => unitIntervalMeasure)) ∧ (∀ᵐ x ∂Measure.infinitePi (fun _ : BlockCoordinate m => unitIntervalMeasure), 0 ≤ g x) ∧ (∫ x, g x ^ 2 ∂Measure.infinitePi (fun _ : BlockCoordinate m => unitIntervalMeasure)) ≤ Real.exp (20*(2*(∑' s, sourceKappa s ^ 2)+1)) ∧ (blockProductCoupling p m).map (blockProductEndpoint right) = (Measure.infinitePi (fun _ : BlockCoordinate m => unitIntervalMeasure)).withDensity (fun x => ENNReal.ofReal (g x)) := by rw [blockProductEndpoint_law] exact infinite_block_source_density p m hm j htag hκ right end CouplingParameters end end FiniteFactor end OAI