File size: 4,243 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
import OAI.Computability.PerfectCompleteness.Algebra.FixedRankContradiction
import OAI.Computability.PerfectCompleteness.Decoding.FixedDecoderCleanRateLemmas

namespace OAI

section

namespace PerfectCompleteness.DecoderRankSplit

noncomputable section

open scoped BigOperators Classical
open TreeSourceSpaces HierarchicalArrays
open UniqueGamesTheorem.Foundations.Games

abbrev F2 := ZMod 2

variable {branch rows repeats : Nat → Nat} {n h t v m : Nat} [NeZero m]
  {upper : Nodes branch n} {d : HierarchicalFrozenTables.LowerNodes upper (h + 1)}
  (S : CleanDecoderRate.Setup branch rows repeats n h t v m upper d)

def meeting (x : CleanDecoderRate.Sample S) (answer : CleanDecoderPairLaw.Pair S x) : Bool :=
  decide (answer.2 = DecoderSourcePullback.upperTarget
    (CleanDecoderOddLists.fullProjection (CleanDecoderPairLaw.context S x)
      (CleanDecoderPairLaw.occurrences S x)) upper answer.1)

variable (hbranch : ∀ k < n, 0 < branch k)

def nativeRank (x : CleanDecoderRate.Sample S)
    (answer : CleanDecoderPairLaw.Pair S x) : Nat :=
  OddListExtraction.formRank
    (H (CleanDecoderOddLists.leftNative (CleanDecoderPairLaw.context S x)
      (CleanDecoderPairLaw.leftOwn S x)))
    (CleanLeftDecoder.form
      (CleanDecoderContext.leftExposed (CleanDecoderPairLaw.context S x)) upper (h + 1)
      hbranch d (CleanDecoderPairLaw.leftOwn S x) answer.1)

def low (s : Nat) (x : CleanDecoderRate.Sample S)
    (answer : CleanDecoderPairLaw.Pair S x) : Bool :=
  decide (nativeRank S hbranch x answer ≤ s)

def highAgrees (s : Nat) (x : CleanDecoderRate.Sample S)
    (answer : CleanDecoderPairLaw.Pair S x) : Bool :=
  meeting S x answer && !(low S hbranch s x answer)

@[simp] theorem highAgrees_eq_true (s : Nat) (x : CleanDecoderRate.Sample S)
    (answer : CleanDecoderPairLaw.Pair S x) :
    highAgrees S hbranch s x answer = true ↔
      s < nativeRank S hbranch x answer ∧ meeting S x answer = true := by
  simp [highAgrees, low, and_comm]

private theorem decide_and_comm (P Q : Prop) [Decidable P] [Decidable Q] :
    (decide P && decide Q) = decide (Q ∧ P) := by
  by_cases hP : P <;> by_cases hQ : Q <;> simp [hP, hQ]

theorem meeting_low (s : Nat) (x : CleanDecoderRate.Sample S)
    (answer : CleanDecoderPairLaw.Pair S x) :
    (meeting S x answer && low S hbranch s x answer) =
      CleanDecoderPairLaw.pairAgrees S hbranch s x answer :=
  decide_and_comm
    (answer.2 = DecoderSourcePullback.upperTarget
      (CleanDecoderOddLists.fullProjection (CleanDecoderPairLaw.context S x)
        (CleanDecoderPairLaw.occurrences S x)) upper answer.1)
    (nativeRank S hbranch x answer ≤ s)

theorem probability_split
    (μ : FiniteDistribution (Σ x : CleanDecoderRate.Sample S, CleanDecoderPairLaw.Pair S x))
    (s : Nat) :
    μ.probability (fun z => meeting S z.1 z.2) =
      μ.probability (fun z => CleanDecoderPairLaw.pairAgrees S hbranch s z.1 z.2) +
      μ.probability (fun z => highAgrees S hbranch s z.1 z.2) := by
  have hsplit := FixedRankContradiction.probability_split μ
    (fun z => meeting S z.1 z.2) (fun z => low S hbranch s z.1 z.2)
  simpa only [meeting_low, highAgrees] using hsplit

variable (σ : KeyStrategy.Strategy (TreeCanonical.locationCount branch n t))
  (useful : (record : CleanDecoderRate.Record S) →
    CleanLeftDecoder.Useful (CleanDecoderContext.leftExposed (CleanDecoderRate.context S record))
      upper (h + 1))
  (r : Nat) (ρ : ℝ) (A : ManyGoodRows.RowMap (Block rows upper) r)
  (W : Submodule F2 (OwnInputReference.UpperVector rows upper))
  (a : OwnInputReference.LowerVector rows (HierarchicalLeftDecoder.LowerNode upper (h + 1) d))
  (threshold : ℝ)

theorem pair_probability_split (s cube : Nat) (hcube : 0 < cube) :
    (CleanDecoderPairLaw.pairLaw S σ useful r ρ A W a threshold cube hcube).probability
      (fun z => meeting S z.1 z.2) =
    (CleanDecoderPairLaw.pairLaw S σ useful r ρ A W a threshold cube hcube).probability
      (fun z => CleanDecoderPairLaw.pairAgrees S hbranch s z.1 z.2) +
    (CleanDecoderPairLaw.pairLaw S σ useful r ρ A W a threshold cube hcube).probability
      (fun z => highAgrees S hbranch s z.1 z.2) :=
  probability_split S hbranch _ s

end
end PerfectCompleteness.DecoderRankSplit

end

end OAI