File size: 5,936 Bytes
2f887db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import Mathlib.Algebra.BigOperators.Expect
import Mathlib.LinearAlgebra.Prod
import OAI.Computability.PerfectCompleteness.Algebra.BilinearGramCompressionLemmas
import OAI.Computability.PerfectCompleteness.Algebra.UniformLinearImage
import OAI.Computability.UniqueGames.Games.FinishBoundsLemmas

namespace OAI

section

namespace PerfectCompleteness.MatrixRowQuotientLaw

noncomputable section

open scoped BigOperators
open UniqueGamesTheorem.Foundations.Games
open MatrixRowQuotient

variable {𝕜 H K : Type*} [Field 𝕜]
  [AddCommGroup H] [Module 𝕜 H] [AddCommGroup K] [Module 𝕜 K]

def projectMatrixLinear (W : Submodule 𝕜 H) :
    (Module.Dual 𝕜 H →ₗ[𝕜] K) →ₗ[𝕜] (Module.Dual 𝕜 (H ⧸ W) →ₗ[𝕜] K) where
  toFun := projectMatrix W
  map_add' X Y := by
    apply LinearMap.ext
    intro q
    rfl
  map_smul' a X := by
    apply LinearMap.ext
    intro q
    rfl

@[simp] theorem projectMatrixLinear_apply (W : Submodule 𝕜 H)
    (X : Module.Dual 𝕜 H →ₗ[𝕜] K) :
    projectMatrixLinear W X = projectMatrix W X := rfl

def jointProjection (W : Submodule 𝕜 H) :
    ((Module.Dual 𝕜 H →ₗ[𝕜] K) × H) →ₗ[𝕜]
      ((Module.Dual 𝕜 (H ⧸ W) →ₗ[𝕜] K) × (H ⧸ W)) :=
  (projectMatrixLinear W).prodMap W.mkQ

@[simp] theorem jointProjection_apply (W : Submodule 𝕜 H)
    (p : (Module.Dual 𝕜 H →ₗ[𝕜] K) × H) :
    jointProjection W p = (projectMatrix W p.1, W.mkQ p.2) := rfl

theorem jointProjection_surjective (W : Submodule 𝕜 H) :
    Function.Surjective (jointProjection (K := K) W) := by
  rintro ⟨X, h⟩
  obtain ⟨Y, hY⟩ := projectMatrix_surjective W X
  obtain ⟨g, hg⟩ := W.mkQ_surjective h
  exact ⟨(Y, g), Prod.ext hY hg⟩

theorem uniform_product {A B : Type*} [Fintype A] [Fintype B]
    [Nonempty A] [Nonempty B] :
    (FiniteDistribution.uniform A).product (FiniteDistribution.uniform B) =
      FiniteDistribution.uniform (A × B) := by
  apply FiniteDistribution.eq_of_weight_eq
  intro p
  change (1 / (Fintype.card A : ℝ)) * (1 / (Fintype.card B : ℝ)) =
    1 / (Fintype.card (A × B) : ℝ)
  simp only [Fintype.card_prod, Nat.cast_mul, one_div, mul_inv]

variable (W : Submodule 𝕜 H)
  [Fintype H] [Fintype (H ⧸ W)]
  [Fintype (Module.Dual 𝕜 H →ₗ[𝕜] K)]
  [Fintype (Module.Dual 𝕜 (H ⧸ W) →ₗ[𝕜] K)]

theorem uniform_jointProjection :
    (FiniteDistribution.uniform ((Module.Dual 𝕜 H →ₗ[𝕜] K) × H)).pushforward
        (jointProjection W) =
      FiniteDistribution.uniform ((Module.Dual 𝕜 (H ⧸ W) →ₗ[𝕜] K) × (H ⧸ W)) :=
  UniformLinearImage.uniform_pushforward_linearMap
    (jointProjection W) (jointProjection_surjective W)

theorem independent_uniform_jointProjection :
    ((FiniteDistribution.uniform (Module.Dual 𝕜 H →ₗ[𝕜] K)).product
      (FiniteDistribution.uniform H)).pushforward (jointProjection W) =
    (FiniteDistribution.uniform (Module.Dual 𝕜 (H ⧸ W) →ₗ[𝕜] K)).product
      (FiniteDistribution.uniform (H ⧸ W)) := by
  rw [uniform_product, uniform_product]
  exact uniform_jointProjection W

private theorem expect_prod {A B : Type*} [Fintype A] [Fintype B]
    (f : A × B → ℝ) :
    (𝔼 p : A × B, f p) = 𝔼 a : A, 𝔼 b : B, f (a, b) := by
  simpa only [Finset.univ_product_univ] using
    Finset.expect_product (Finset.univ : Finset A) (Finset.univ : Finset B) f

theorem expect_project_matrix_increment
    (f : (Module.Dual 𝕜 (H ⧸ W) →ₗ[𝕜] K) → (H ⧸ W) → ℝ) :
    (𝔼 X : Module.Dual 𝕜 H →ₗ[𝕜] K, 𝔼 h : H,
      f (projectMatrix W X) (W.mkQ h)) =
    𝔼 X : Module.Dual 𝕜 (H ⧸ W) →ₗ[𝕜] K, 𝔼 h : H ⧸ W, f X h := by
  have he := congrArg
    (fun μ : FiniteDistribution ((Module.Dual 𝕜 (H ⧸ W) →ₗ[𝕜] K) × (H ⧸ W)) =>
      μ.expectation (fun p => f p.1 p.2)) (uniform_jointProjection W)
  rw [FiniteDistribution.expectation_pushforward,
    FiniteDistribution.expectation_uniform, FiniteDistribution.expectation_uniform] at he
  have he' :
      (𝔼 p : (Module.Dual 𝕜 H →ₗ[𝕜] K) × H,
        f (projectMatrix W p.1) (W.mkQ p.2)) =
      𝔼 p : (Module.Dual 𝕜 (H ⧸ W) →ₗ[𝕜] K) × (H ⧸ W), f p.1 p.2 := by
    simpa only [Fintype.expect_eq_sum_div_card, jointProjection_apply] using he
  simpa only [expect_prod] using he'

theorem rankOne_pair_law (a : K) :
    ((FiniteDistribution.uniform (Module.Dual 𝕜 H →ₗ[𝕜] K)).product
      (FiniteDistribution.uniform H)).pushforward
        (fun p => (projectMatrix W p.1,
          projectMatrix W (p.1 + (Module.Dual.eval 𝕜 H p.2).smulRight a))) =
    ((FiniteDistribution.uniform (Module.Dual 𝕜 (H ⧸ W) →ₗ[𝕜] K)).product
      (FiniteDistribution.uniform (H ⧸ W))).pushforward
        (fun p => (p.1, p.1 + (Module.Dual.eval 𝕜 (H ⧸ W) p.2).smulRight a)) := by
  have he := congrArg
    (fun μ : FiniteDistribution ((Module.Dual 𝕜 (H ⧸ W) →ₗ[𝕜] K) × (H ⧸ W)) =>
      μ.pushforward (fun p =>
        (p.1, p.1 + (Module.Dual.eval 𝕜 (H ⧸ W) p.2).smulRight a)))
    (independent_uniform_jointProjection W)
  rw [FiniteDistribution.pushforward_comp] at he
  simpa only [jointProjection_apply, project_rankOne] using he

theorem expect_project_rankOne_pair (a : K)
    (f : (Module.Dual 𝕜 (H ⧸ W) →ₗ[𝕜] K) →
      (Module.Dual 𝕜 (H ⧸ W) →ₗ[𝕜] K) → ℝ) :
    (𝔼 X : Module.Dual 𝕜 H →ₗ[𝕜] K, 𝔼 h : H,
      f (projectMatrix W X)
        (projectMatrix W (X + (Module.Dual.eval 𝕜 H h).smulRight a))) =
    𝔼 X : Module.Dual 𝕜 (H ⧸ W) →ₗ[𝕜] K, 𝔼 h : H ⧸ W,
      f X (X + (Module.Dual.eval 𝕜 (H ⧸ W) h).smulRight a) := by
  simpa only [project_rankOne] using expect_project_matrix_increment W
    (fun X h => f X (X + (Module.Dual.eval 𝕜 (H ⧸ W) h).smulRight a))

end
end PerfectCompleteness.MatrixRowQuotientLaw

end

end OAI