File size: 4,856 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
import OAI.Computability.PerfectCompleteness.Decoding.LeftDecoder
import OAI.Computability.PerfectCompleteness.Foundations.TupleIndexEmitterLemmas

namespace OAI


namespace PerfectCompleteness.AffineDecoderMeeting

noncomputable section

open scoped BigOperators Classical
open UniqueGamesTheorem.Foundations.Games
open UniqueGamesTheorem.Integration.BinaryLinear (F2)

section Product

variable {L R : Type*} [Fintype L] [Fintype R]

theorem product_probability_lower
    (left : FiniteDistribution L) (right : FiniteDistribution R)
    (event : L × R → Bool) (good : R → Bool) (p : ℝ)
    (hpoint : ∀ y, good y = true →
      p ≤ left.probability (fun x => event (x, y))) :
    p * right.probability good ≤ (left.product right).probability event := by
  rw [UsefulAdvice.product_probability_advice_first]
  change p * (∑ y, if good y then right.weight y else 0) ≤
    ∑ y, right.weight y * left.probability (fun x => event (x, y))
  rw [Finset.mul_sum]
  apply Finset.sum_le_sum
  intro y _
  by_cases hy : good y = true
  · rw [ite_eq_left hy, mul_comm p]
    exact mul_le_mul_of_nonneg_left (hpoint y hy) (right.nonnegative y)
  · rw [ite_eq_right hy, mul_zero]
    exact mul_nonneg (right.nonnegative y) (left.probability_nonnegative _)

end Product

section Algebra

variable {H H' : Type*} [AddCommGroup H] [Module F2 H]
  [AddCommGroup H'] [Module F2 H']
  (i : H' →ₗ[F2] H) (B : Submodule F2 H)
  (C : Submodule F2 (Module.Dual F2 (H ⧸ B)))
  (center : Module.Dual F2 H)

def nativeQ : Submodule F2 (Module.Dual F2 H') :=
  (PulledColumnSpace.pulled B C).map i.dualMap

def nativeCenter : Module.Dual F2 H' := i.dualMap center

theorem candidate_mem_nativeCoset (q : PulledColumnSpace.Candidates B C center) :
    i.dualMap q.val - nativeCenter i center ∈ nativeQ i B C := by
  change i.dualMap q.val - i.dualMap center ∈
    (PulledColumnSpace.pulled B C).map i.dualMap
  rw [← map_sub]
  exact Submodule.mem_map_of_mem q.property

theorem exists_candidate_of_mem_nativeCoset (decoded : Module.Dual F2 H')
    (hdecoded : decoded - nativeCenter i center ∈ nativeQ i B C) :
    ∃ q : PulledColumnSpace.Candidates B C center, i.dualMap q.val = decoded := by
  obtain ⟨q, hq, heq⟩ := Submodule.mem_map.mp hdecoded
  refine ⟨PulledColumnSpace.candidateEquiv B C center ⟨q, hq⟩, ?_⟩
  change i.dualMap (center + q) = decoded
  rw [map_add, heq]
  change i.dualMap center + (decoded - i.dualMap center) = decoded
  abel

theorem nativeCoset_iff_exists_candidate (decoded : Module.Dual F2 H') :
    decoded - nativeCenter i center ∈ nativeQ i B C ↔
      ∃ q : PulledColumnSpace.Candidates B C center, i.dualMap q.val = decoded := by
  constructor
  · exact exists_candidate_of_mem_nativeCoset i B C center decoded
  · rintro ⟨q, rfl⟩
    exact candidate_mem_nativeCoset i B C center q

theorem finrank_nativeQ_le [FiniteDimensional F2 H] :
    Module.finrank F2 (nativeQ i B C) ≤ Module.finrank F2 C := by
  calc
    Module.finrank F2 (nativeQ i B C) ≤
        Module.finrank F2 (PulledColumnSpace.pulled B C) :=
      Submodule.finrank_map_le i.dualMap (PulledColumnSpace.pulled B C)
    _ = Module.finrank F2 C := PulledColumnSpace.finrank_pulled B C

end Algebra


variable {H H' : Type*} [AddCommGroup H] [Module F2 H]
  [AddCommGroup H'] [Module F2 H']
  [FiniteDimensional F2 H] [FiniteDimensional F2 H']

local instance leftDualFintype : Fintype (Module.Dual F2 H) :=
  LeftDecoder.dualFintype (V := H)

local instance nativeDualFintype : Fintype (Module.Dual F2 H') :=
  LeftDecoder.dualFintype (V := H')

variable (i : H' →ₗ[F2] H) (B : Submodule F2 H)
  (C : Submodule F2 (Module.Dual F2 (H ⧸ B)))
  (center : Module.Dual F2 H)

omit [FiniteDimensional F2 H'] in
theorem native_point_probability_lower {r : Nat}
    (hC : Module.finrank F2 C ≤ r) (decoded : Module.Dual F2 H')
    (hdecoded : decoded - nativeCenter i center ∈ nativeQ i B C) :
    1 / (2 : ℝ) ^ r ≤ (LeftDecoder.affineLaw B C center).probability
      (fun q => decide (i.dualMap q = decoded)) := by
  apply LeftDecoder.affineLaw_success_lower B C center hC
  obtain ⟨q, hq⟩ := exists_candidate_of_mem_nativeCoset i B C center decoded hdecoded
  exact ⟨q, decide_eq_true hq⟩

theorem meeting_probability_lower {r : Nat}
    (hC : Module.finrank F2 C ≤ r)
    (right : FiniteDistribution (Module.Dual F2 H')) :
    (1 / (2 : ℝ) ^ r) * right.probability
      (fun decoded => decide (decoded - nativeCenter i center ∈ nativeQ i B C)) ≤
      ((LeftDecoder.affineLaw B C center).product right).probability
        (fun pair => decide (i.dualMap pair.1 = pair.2)) := by
  apply product_probability_lower
  intro decoded hdecoded
  exact native_point_probability_lower i B C center hC decoded (of_decide_eq_true hdecoded)


end
end PerfectCompleteness.AffineDecoderMeeting

end OAI