File size: 5,904 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
141
142
143
144
145
import OAI.Computability.PerfectCompleteness.Algebra.UniformLinearImage
import OAI.Computability.PerfectCompleteness.Decoding.ChildBlockProjection

namespace OAI

section

namespace PerfectCompleteness.ChildCallNumbering

open RecursiveSpaces TreeSourceSpaces HierarchicalArrays PointwiseSpaces
open UniqueGamesTheorem.Foundations.Games
open scoped Classical

noncomputable section

variable {C : Type*} [Fintype C] {branch : Nat → Nat} {n t : Nat}

abbrev Raw (rows : Nat → Nat) (slots : Slots branch n → Fin t → MixedSupport.Slot) :=
  (C → squareSpace (H slots)) × Arrays slots rows

instance rawFintype (rows : Nat → Nat)
    (slots : Slots branch n → Fin t → MixedSupport.Slot) :
    Fintype (Raw (C := C) rows slots) := Fintype.ofFinite _

instance rawNonempty (rows : Nat → Nat)
    (slots : Slots branch n → Fin t → MixedSupport.Slot) :
    Nonempty (Raw (C := C) rows slots) := ⟨(fun _ => 0, fun _ _ => 0)⟩

def equiv (rows : Nat → Nat) (slots : Slots branch n → Fin t → MixedSupport.Slot) :
    Raw (C := C) rows slots ≃ₗ[F2]
      ChildBlockCardinality.Raw (Fintype.card C) rows slots where
  toFun x := (fun k => x.1 ((Fintype.equivFin C).symm k), x.2)
  invFun x := (fun c => x.1 (Fintype.equivFin C c), x.2)
  left_inv x := by
    apply Prod.ext
    · funext c
      simp only [Equiv.symm_apply_apply]
    · rfl
  right_inv x := by
    apply Prod.ext
    · funext k
      simp only [Equiv.apply_symm_apply]
    · rfl
  map_add' x y := rfl
  map_smul' c x := rfl

@[simp] theorem equiv_calls (rows : Nat → Nat)
    (slots : Slots branch n → Fin t → MixedSupport.Slot)
    (x : Raw (C := C) rows slots) (k : Fin (Fintype.card C)) :
    (equiv rows slots x).1 k = x.1 ((Fintype.equivFin C).symm k) := rfl

@[simp] theorem equiv_arrays (rows : Nat → Nat)
    (slots : Slots branch n → Fin t → MixedSupport.Slot)
    (x : Raw (C := C) rows slots) : (equiv rows slots x).2 = x.2 := rfl

@[simp] theorem equiv_symm_calls (rows : Nat → Nat)
    (slots : Slots branch n → Fin t → MixedSupport.Slot)
    (x : ChildBlockCardinality.Raw (Fintype.card C) rows slots) (c : C) :
    ((equiv (C := C) rows slots).symm x).1 c = x.1 (Fintype.equivFin C c) := rfl

@[simp] theorem equiv_symm_arrays (rows : Nat → Nat)
    (slots : Slots branch n → Fin t → MixedSupport.Slot)
    (x : ChildBlockCardinality.Raw (Fintype.card C) rows slots) :
    ((equiv (C := C) rows slots).symm x).2 = x.2 := rfl

def pullback (rows : Nat → Nat)
    {slots projected : Slots branch n → Fin t → MixedSupport.Slot}
    (p : ∀ s k, MixedSupport.Projection (slots s k) (projected s k)) :
    Raw (C := C) rows projected →ₗ[F2] Raw (C := C) rows slots where
  toFun x := (fun c => ChildBlockProjection.squarePullback p (x.1 c),
    ChildBlockProjection.arraysPullback rows p x.2)
  map_add' x y := by
    apply Prod.ext
    · funext c
      exact map_add (ChildBlockProjection.squarePullback p) (x.1 c) (y.1 c)
    · exact map_add (ChildBlockProjection.arraysPullback rows p) x.2 y.2
  map_smul' a x := by
    apply Prod.ext
    · funext c
      exact map_smul (ChildBlockProjection.squarePullback p) a (x.1 c)
    · exact map_smul (ChildBlockProjection.arraysPullback rows p) a x.2

omit [Fintype C] in
@[simp] theorem pullback_calls (rows : Nat → Nat)
    {slots projected : Slots branch n → Fin t → MixedSupport.Slot}
    (p : ∀ s k, MixedSupport.Projection (slots s k) (projected s k))
    (x : Raw (C := C) rows projected) (c : C) :
    (pullback rows p x).1 c = ChildBlockProjection.squarePullback p (x.1 c) := rfl

omit [Fintype C] in
@[simp] theorem pullback_arrays (rows : Nat → Nat)
    {slots projected : Slots branch n → Fin t → MixedSupport.Slot}
    (p : ∀ s k, MixedSupport.Projection (slots s k) (projected s k))
    (x : Raw (C := C) rows projected) :
    (pullback rows p x).2 = ChildBlockProjection.arraysPullback rows p x.2 := rfl

theorem equiv_pullback (rows : Nat → Nat)
    {slots projected : Slots branch n → Fin t → MixedSupport.Slot}
    (p : ∀ s k, MixedSupport.Projection (slots s k) (projected s k))
    (x : Raw (C := C) rows projected) :
    equiv rows slots (pullback rows p x) =
      ChildBlockProjection.rawPullback (Fintype.card C) rows p
        (equiv rows projected x) := rfl

omit [Fintype C] in
theorem pullback_cast (rows : Nat → Nat)
    {slots target projected : Slots branch n → Fin t → MixedSupport.Slot}
    (h : slots = target)
    (p : ∀ s k, MixedSupport.Projection (slots s k) (projected s k))
    (x : Raw (C := C) rows projected) :
    cast (congrArg (Raw (C := C) rows) h) (pullback rows p x) =
      pullback rows
        (cast (congrArg
          (fun ss : Slots branch n → Fin t → MixedSupport.Slot =>
            ∀ s k, MixedSupport.Projection (ss s k) (projected s k)) h) p) x := by
  cases h
  rfl

theorem uniform_equiv (rows : Nat → Nat)
    (slots : Slots branch n → Fin t → MixedSupport.Slot) :
    (FiniteDistribution.uniform (Raw (C := C) rows slots)).pushforward
        (equiv (C := C) rows slots) =
      FiniteDistribution.uniform (ChildBlockCardinality.Raw (Fintype.card C) rows slots) :=
  UniformLinearImage.uniform_pushforward_linearMap
    (equiv (C := C) rows slots).toLinearMap (equiv (C := C) rows slots).surjective

theorem card_le (rows : Nat → Nat)
    (slots : Slots branch n → Fin t → MixedSupport.Slot) :
    Fintype.card (Raw (C := C) rows slots) ≤
      ChildBlockCardinality.bound branch n t (Fintype.card C) rows := by
  calc
    Fintype.card (Raw (C := C) rows slots) =
        Fintype.card (ChildBlockCardinality.Raw (Fintype.card C) rows slots) :=
      Fintype.card_congr (equiv (C := C) rows slots).toEquiv
    _ ≤ _ := by
      simpa only [Nat.card_eq_fintype_card] using
        ChildBlockCardinality.card_le (Fintype.card C) rows slots

end
end PerfectCompleteness.ChildCallNumbering

end

end OAI