Datasets:

ArXiv:
License:
File size: 3,747 Bytes
bf6216d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
module

public import PFR.Mathlib.Probability.Independence.Basic
public import PFR.ForMathlib.Pair

public section

open MeasureTheory ProbabilityTheory

namespace ProbabilityTheory.iIndepFun

variable {Ω : Type*} [MeasureSpace Ω]
  {G : Type*} [hG : MeasurableSpace G]

variable {Z₁ Z₂ Z₃ : Ω → G} (h_indep : iIndepFun ![Z₁, Z₂, Z₃])

include h_indep

lemma reindex_three_abc :
    iIndepFun ![Z₁, Z₂, Z₃] := h_indep

lemma reindex_three_acb :
    iIndepFun ![Z₁, Z₃, Z₂] := by
  let σ : Fin 3 ≃ Fin 3 :=
  { toFun := ![0, 2, 1]
    invFun := ![0, 2, 1]
    left_inv i := by fin_cases i <;> rfl
    right_inv i := by fin_cases i <;> rfl }
  refine .of_precomp σ.symm.surjective ?_
  convert h_indep using 1
  ext i
  fin_cases i <;> rfl

lemma reindex_three_bac :
    iIndepFun ![Z₂, Z₁, Z₃] := by
  let σ : Fin 3 ≃ Fin 3 :=
  { toFun := ![1, 0, 2]
    invFun := ![1, 0, 2]
    left_inv i := by fin_cases i <;> rfl
    right_inv i := by fin_cases i <;> rfl }
  refine .of_precomp σ.symm.surjective ?_
  convert h_indep using 1
  ext i
  fin_cases i <;> rfl

lemma reindex_three_bca :
    iIndepFun ![Z₂, Z₃, Z₁] := by
  let σ : Fin 3 ≃ Fin 3 :=
  { toFun := ![1, 2, 0]
    invFun := ![2, 0, 1]
    left_inv i := by fin_cases i <;> rfl
    right_inv i := by fin_cases i <;> rfl }
  refine .of_precomp σ.symm.surjective ?_
  convert h_indep using 1
  ext i
  fin_cases i <;> rfl

lemma reindex_three_cab :
    iIndepFun ![Z₃, Z₁, Z₂] := by
  let σ : Fin 3 ≃ Fin 3 :=
  { toFun := ![2, 0, 1]
    invFun := ![1, 2, 0]
    left_inv i := by fin_cases i <;> rfl
    right_inv i := by fin_cases i <;> rfl }
  refine .of_precomp σ.symm.surjective ?_
  convert h_indep using 1
  ext i
  fin_cases i <;> rfl

lemma reindex_three_cba :
    iIndepFun ![Z₃, Z₂, Z₁] := by
  let σ : Fin 3 ≃ Fin 3 :=
  { toFun := ![2, 1, 0]
    invFun := ![2, 1, 0]
    left_inv i := by fin_cases i <;> rfl
    right_inv i := by fin_cases i <;> rfl }
  refine .of_precomp σ.symm.surjective ?_
  convert h_indep using 1
  ext i
  fin_cases i <;> rfl

private abbrev κ : Fin 2 → Type
  | 0 => Fin 1
  | 1 => Fin 2

private def κ_equiv : (Σ i, κ i) ≃ Fin 3 where
  toFun := fun x ↦ match x with
    | Sigma.mk 0 _ => 0
    | Sigma.mk 1 ⟨0, _⟩ => 1
    | Sigma.mk 1 ⟨1, _⟩ => 2
  invFun := ![Sigma.mk 0 ⟨0, zero_lt_one⟩,
    Sigma.mk 1 ⟨0, zero_lt_two⟩, Sigma.mk 1 ⟨1, one_lt_two⟩]
  left_inv := by rintro ⟨i, j⟩; fin_cases i <;> fin_cases j <;> rfl
  right_inv i := by fin_cases i <;> rfl

private instance fintype_kappa : ∀ (i : Fin 2), Fintype (κ i)
  | 0 | 1 => inferInstanceAs (Fintype (Fin _))

variable (G) in
private abbrev self_or_prod : Fin 2 → Type _
  | 0 => G
  | 1 => G × G

lemma pair_last_of_three
    (hZ₁ : Measurable Z₁) (hZ₂ : Measurable Z₂) (hZ₃ : Measurable Z₃) :
    IndepFun Z₁ (⟨Z₂, Z₃⟩) := by
  have T := iIndepFun.pi' (m := fun _ _ ↦ hG) ?_ (h_indep.precomp κ_equiv.injective); swap
  · rintro ⟨i, j⟩; fin_cases i <;> fin_cases j <;> assumption
  -- apply to this pair of independent variables the function mapping the latter pair (as
  -- a function on `Fin 2`) to the same pair, but in the product space sense.
  -- It retains independence, proving the conclusion.
  let phi_third : ∀ (i : Fin 2), (κ i → G) → (self_or_prod G i)
    | 0 => (fun f ↦ f ⟨0, zero_lt_one⟩)
    | 1 => (fun f ↦ (f ⟨0, zero_lt_two⟩, f ⟨1, one_lt_two⟩))
  let M i : MeasurableSpace (self_or_prod G i) := by match i with | 0 | 1 => infer_instance
  have := T.comp phi_third
  refine (this ?_).indepFun (i := 0) (j := 1) zero_ne_one
  intro i
  match i with
  | 0 | 1 => fun_prop

end ProbabilityTheory.iIndepFun