File size: 2,502 Bytes
4a56cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import OAI.Analysis.FiniteFactor.Coupling.Marginals
import Mathlib.Probability.ProductMeasure

namespace OAI

namespace FiniteFactor
open MeasureTheory
open scoped ENNReal
noncomputable section
namespace CouplingParameters

/-- The augmented countable product retains each coordinate's label and pair. -/
abbrev CouplingSample := β„• β†’ Fin 6 Γ— (ℝ Γ— ℝ)

def productCoupling (p : β„• β†’ CouplingParameters) : Measure CouplingSample :=
  Measure.infinitePi (fun i => (p i).labelledCoupling)

instance productCoupling_probability (p : β„• β†’ CouplingParameters) :
    IsProbabilityMeasure (productCoupling p) := by
  unfold productCoupling
  infer_instance

def productEndpoint (right : β„• β†’ Bool) (Ο‰ : CouplingSample) (i : β„•) : ℝ :=
  endpoint (right i) (Ο‰ i).2

theorem productEndpoint_measurable (right : β„• β†’ Bool) : Measurable (productEndpoint right) := by
  apply Measurable.of_eval
  intro i
  exact (endpoint_measurable (right i)).comp (measurable_snd.comp (measurable_pi_apply i))

theorem labelled_endpoint_density (p : CouplingParameters) (right : Bool) :
    p.labelledCoupling.map (fun z => endpoint right z.2) =
      unitIntervalMeasure.withDensity (fun t => ENNReal.ofReal (p.endpointDensity right t)) := by
  rw [← p.coupling_endpoint_density]
  unfold coupling
  rw [Measure.map_map (endpoint_measurable right) measurable_snd]
  rfl

/-- Every coordinatewise choice of endpoint marginals is exactly its product
law, including the mixed prefixes used in biased-identity. -/
theorem productEndpoint_law (p : β„• β†’ CouplingParameters) (right : β„• β†’ Bool) :
    (productCoupling p).map (productEndpoint right) =
      Measure.infinitePi (fun i => unitIntervalMeasure.withDensity
        (fun t => ENNReal.ofReal ((p i).endpointDensity (right i) t))) := by
  unfold productCoupling productEndpoint
  rw [Measure.infinitePi_map_pi (fun i => (p i).labelledCoupling)
    (f := fun i (z : Fin 6 Γ— (ℝ Γ— ℝ)) => endpoint (right i) z.2) (fun i => (endpoint_measurable (right i)).comp measurable_snd)]
  simp_rw [labelled_endpoint_density]

/-- Independence is recorded as the exact finite-cylinder product formula. -/
theorem productCoupling_cylinder (p : β„• β†’ CouplingParameters) (I : Finset β„•)
    (S : β„• β†’ Set (Fin 6 Γ— (ℝ Γ— ℝ))) (hS : βˆ€ i ∈ I, MeasurableSet (S i)) :
    productCoupling p (Set.pi (I : Set β„•) S) = ∏ i ∈ I, (p i).labelledCoupling (S i) :=
  Measure.infinitePi_pi _ hS

end CouplingParameters
end
end FiniteFactor

end OAI