File size: 9,457 Bytes
9b6e014
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
import Mathlib
import OAI.Probability.BinarySweep.FiniteLaws.LinearEvenMoment
import OAI.Probability.BinarySweep.Conditional.ConditionalAverage
import OAI.Probability.BinarySweep.GridBounds.GridSplitSweep

namespace OAI

noncomputable section

section

open scoped BigOperators Classical

namespace BinaryCoordinateSweeps.GridSplit
variable {m n h : ℕ} (bits : Fin (m+n) → ℕ) (H : PathFamily bits h)

@[simp] lemma left_join (x : GridSlot (leftBits bits)) (y : GridSlot (rightBits bits)) :
    leftSlot bits (joinSlot bits x y)=x := by funext i; simp [leftSlot,joinSlot]
@[simp] lemma right_join (x : GridSlot (leftBits bits)) (y : GridSlot (rightBits bits)) :
    rightSlot bits (joinSlot bits x y)=y := by funext i; simp [rightSlot,joinSlot]
@[simp] lemma join_left_right (x : GridSlot bits) :
    joinSlot bits (leftSlot bits x) (rightSlot bits x)=x := (slotEquiv bits).symm_apply_apply x

def rowFreeEquiv (t : Fin (m+1)) : FreeSlot H (leftTime t) ≃
    Σy : GridSlot (rightBits bits), FreeSlot (rowFamily bits H y) t where
  toFun x := ⟨rightSlot bits x.val,⟨leftSlot bits x.val,by
    rintro ⟨a,ha⟩
    let k := (Fintype.equivFin (RowLabels bits H (rightSlot bits x.val))).symm a
    apply x.property
    refine ⟨k.val,?_⟩
    apply (slotEquiv bits).injective
    apply Prod.ext
    · exact ha
    · exact (rightSlot_leftTime bits H t k.val).trans k.property⟩⟩
  invFun yx := ⟨joinSlot bits yx.2.val yx.1,by
    rintro ⟨k,hk⟩
    have he := congrArg (slotEquiv bits) hk
    have hr : rightSlot bits (H.position 0 k)=yx.1 := by
      rw [←rightSlot_leftTime bits H t k]
      exact (congrArg Prod.snd he).trans (congrArg Prod.snd ((slotEquiv bits).apply_symm_apply (yx.2.val,yx.1)))
    apply yx.2.property
    refine ⟨Fintype.equivFin (RowLabels bits H yx.1) ⟨k,hr⟩,?_⟩
    simp only [rowFamily,Equiv.symm_apply_apply]
    exact (congrArg Prod.fst he).trans (congrArg Prod.fst ((slotEquiv bits).apply_symm_apply (yx.2.val,yx.1)))⟩
  left_inv x := by
    apply Subtype.ext
    exact (slotEquiv bits).symm_apply_apply x.val
  right_inv yx := by
    rcases yx with ⟨y,x⟩
    have he := (slotEquiv bits).apply_symm_apply (x.val,y)
    apply Sigma.ext (congrArg Prod.snd he)
    have hr : rightSlot bits (joinSlot bits x.val y)=y := congrArg Prod.snd he
    apply (Subtype.heq_iff_coe_eq (by
      intro a
      change a∉Set.range ((rowFamily bits H (rightSlot bits (joinSlot bits x.val y))).position t) ↔ _
      rw [hr])).mpr
    exact congrArg Prod.fst he

def columnFreeEquiv (t : Fin (n+1)) : FreeSlot H (rightTime t) ≃
    Σx : GridSlot (leftBits bits), FreeSlot (columnFamily bits H x) t where
  toFun y := ⟨leftSlot bits y.val,⟨rightSlot bits y.val,by
    rintro ⟨a,ha⟩
    let k := (Fintype.equivFin (ColumnLabels bits H (leftSlot bits y.val))).symm a
    apply y.property
    refine ⟨k.val,?_⟩
    apply (slotEquiv bits).injective
    apply Prod.ext
    · exact (leftSlot_rightTime bits H t k.val).trans k.property
    · exact ha⟩⟩
  invFun xy := ⟨joinSlot bits xy.1 xy.2.val,by
    rintro ⟨k,hk⟩
    have he := congrArg (slotEquiv bits) hk
    have hl : leftSlot bits (H.position (rightTime (m:=m) 0) k)=xy.1 := by
      rw [←leftSlot_rightTime bits H t k]
      exact (congrArg Prod.fst he).trans (congrArg Prod.fst ((slotEquiv bits).apply_symm_apply (xy.1,xy.2.val)))
    apply xy.2.property
    refine ⟨Fintype.equivFin (ColumnLabels bits H xy.1) ⟨k,hl⟩,?_⟩
    simp only [columnFamily,Equiv.symm_apply_apply]
    exact (congrArg Prod.snd he).trans (congrArg Prod.snd ((slotEquiv bits).apply_symm_apply (xy.1,xy.2.val)))⟩
  left_inv y := by
    apply Subtype.ext
    exact (slotEquiv bits).symm_apply_apply y.val
  right_inv xy := by
    rcases xy with ⟨x,y⟩
    have he := (slotEquiv bits).apply_symm_apply (x,y.val)
    apply Sigma.ext (congrArg Prod.fst he)
    have hl : leftSlot bits (joinSlot bits x y.val)=x := congrArg Prod.fst he
    apply (Subtype.heq_iff_coe_eq (by
      intro a
      change a∉Set.range ((columnFamily bits H (leftSlot bits (joinSlot bits x y.val))).position t) ↔ _
      rw [hl])).mpr
    exact congrArg Prod.snd he

abbrev RowSamples := ∀y, ConditionalChoices (rowFamily bits H y)
abbrev ColumnSamples := ∀x, ConditionalChoices (columnFamily bits H x)

def rowRemaining (g : RowSamples bits H) : FreeSlot H 0 ≃ FreeSlot H (rightTime (m:=m) 0) :=
  (rowFreeEquiv bits H 0).trans ((Equiv.sigmaCongrRight (fun y =>
    remainingBijection (rowFamily bits H y) (g y).val (g y).property)).trans
    (rowFreeEquiv bits H (Fin.last m)).symm)

def columnRemaining (g : ColumnSamples bits H) :
    FreeSlot H (rightTime (m:=m) 0) ≃ FreeSlot H (Fin.last (m+n)) :=
  (columnFreeEquiv bits H 0).trans ((Equiv.sigmaCongrRight (fun x =>
    remainingBijection (columnFamily bits H x) (g x).val (g x).property)).trans
    (columnFreeEquiv bits H (Fin.last n)).symm)

@[simp] lemma rowRemaining_val (g : RowSamples bits H) (a : FreeSlot H 0) :
    (rowRemaining bits H g a).val = joinSlot bits
      (gridSweep (leftBits bits) (g (rightSlot bits a.val)).val (leftSlot bits a.val))
      (rightSlot bits a.val) := rfl

@[simp] lemma columnRemaining_val (g : ColumnSamples bits H)
    (a : FreeSlot H (rightTime (m:=m) 0)) :
    (columnRemaining bits H g a).val = joinSlot bits (leftSlot bits a.val)
      (gridSweep (rightBits bits) (g (leftSlot bits a.val)).val (rightSlot bits a.val)) := rfl

lemma remainingBijection_split (g : ConditionalChoices H) :
    remainingBijection H g.val g.property =
      (rowRemaining bits H ((conditionalChoicesEquiv bits H g).1)).trans
        (columnRemaining bits H ((conditionalChoicesEquiv bits H g).2)) := by
  apply Equiv.ext
  intro a
  apply Subtype.ext
  change gridSweep bits g.val a.val =
    (columnRemaining bits H ((conditionalChoicesEquiv bits H g).2)
      (rowRemaining bits H ((conditionalChoicesEquiv bits H g).1) a)).val
  rw [columnRemaining_val,rowRemaining_val,left_join,right_join]
  apply (slotEquiv bits).injective
  have he := Equiv.congr_fun (gridSweep_split bits g.val) (slotEquiv bits a.val)
  simpa [conditionalChoicesEquiv,Equiv.permCongr_apply,rowPerm,columnPerm,
    slotEquiv] using he

end BinaryCoordinateSweeps.GridSplit

end

open scoped BigOperators Classical

namespace BinaryCoordinateSweeps.GridSplit
open Irrep Representation

variable {m n h : ℕ} (bits : Fin (m+n) → ℕ) (H : PathFamily bits h)

def rowReference : FreeSlot H 0 ≃ FreeSlot H (rightTime (m:=m) 0) :=
  (rowFreeEquiv bits H 0).trans ((Equiv.sigmaCongrRight (fun y =>
    freeIdentification (rowFamily bits H y))).trans
    (rowFreeEquiv bits H (Fin.last m)).symm)

def columnReference : FreeSlot H (rightTime (m:=m) 0) ≃ FreeSlot H (Fin.last (m+n)) :=
  (columnFreeEquiv bits H 0).trans ((Equiv.sigmaCongrRight (fun x =>
    freeIdentification (columnFamily bits H x))).trans
    (columnFreeEquiv bits H (Fin.last n)).symm)

def rowRelative (g : RowSamples bits H) : Equiv.Perm (FreeSlot H 0) :=
  (rowRemaining bits H g).trans (rowReference bits H).symm

def columnRelative (g : ColumnSamples bits H) : Equiv.Perm (FreeSlot H (rightTime (m:=m) 0)) :=
  (columnRemaining bits H g).trans (columnReference bits H).symm

def framePermutation : Equiv.Perm (FreeSlot H 0) :=
  ((rowReference bits H).trans (columnReference bits H)).trans (freeIdentification H).symm

theorem remainingPerm_factor (g : ConditionalChoices H) :
    remainingPerm H g.val g.property = framePermutation bits H *
      (rowReference bits H).symm.permCongr
        (columnRelative bits H ((conditionalChoicesEquiv bits H g).2)) *
      rowRelative bits H ((conditionalChoicesEquiv bits H g).1) := by
  unfold remainingPerm
  rw [remainingBijection_split]
  apply Equiv.ext
  intro x
  simp [framePermutation,rowRelative,columnRelative,Equiv.permCongr_apply]

variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [FiniteDimensional ℂ V]
  (ρ : Representation ℂ (Equiv.Perm (FreeSlot H 0)) V)

def rowAverage (z : ℝ) : V →ₗ[ℂ] V :=
  ∑g : RowSamples bits H,
    ((∏y, conditionalChoiceWeight (rowFamily bits H y) z (g y)):ℂ) • ρ (rowRelative bits H g)

def columnAverage (z : ℝ) : V →ₗ[ℂ] V :=
  ∑g : ColumnSamples bits H,
    ((∏x, conditionalChoiceWeight (columnFamily bits H x) z (g x)):ℂ) •
      ρ ((rowReference bits H).symm.permCongr (columnRelative bits H g))

omit [FiniteDimensional ℂ V] in
theorem groupAverage_split (z : ℝ) :
    groupAverage ρ (fun a => (conditionalGroupLaw H z a:ℂ)) =
      ρ (framePermutation bits H) * columnAverage bits H ρ z * rowAverage bits H ρ z := by
  rw [groupAverage_conditional,← Equiv.sum_comp (conditionalChoicesEquiv bits H).symm]
  simp_rw [conditionalChoiceWeight_split,remainingPerm_factor,
    Equiv.apply_symm_apply,map_mul,Complex.ofReal_mul]
  rw [Fintype.sum_prod_type]
  unfold columnAverage rowAverage
  simp only [Finset.mul_sum,Finset.sum_mul,smul_mul_assoc,mul_smul_comm,
    Finset.smul_sum,smul_smul,Complex.ofReal_prod]

theorem conditional_evenMoment_split (z : ℝ) (q : ℕ)
    (hρ : ∀g v, ‖ρ g v‖=‖v‖) :
    evenMoment q (groupAverage ρ (fun a => (conditionalGroupLaw H z a:ℂ))) =
      evenMoment q (columnAverage bits H ρ z * rowAverage bits H ρ z) := by
  rw [groupAverage_split,mul_assoc]
  apply evenMoment_unitary_left
  rw [unitary_rep_adjoint ρ hρ,←map_mul,inv_mul_cancel,map_one]

end BinaryCoordinateSweeps.GridSplit

end

end OAI