File size: 6,900 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
146
147
148
149
150
151
152
153
154
155
156
import Mathlib.LinearAlgebra.Dimension.Finrank
import OAI.Computability.PerfectCompleteness.Algebra.EvaluationMatrix
import OAI.Computability.PerfectCompleteness.Algebra.UniformLinearImage
import OAI.Computability.PerfectCompleteness.Foundations.HierarchicalArrays

namespace OAI


namespace PerfectCompleteness.NodeEmbedding

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

noncomputable section

variable {branch : Nat → Nat} {n t : Nat}

abbrev NumberedDomain (slots : RecursiveSpaces.Slots branch n → Fin t → MixedSupport.Slot) :=
  MixedSupport.Assignment (TreeCanonical.numberedSlots slots)

abbrev NodeH (slots : RecursiveSpaces.Slots branch n → Fin t → MixedSupport.Slot)
    (node : Nodes branch n) := H (nodeSlots slots node)

variable (slots : RecursiveSpaces.Slots branch n → Fin t → MixedSupport.Slot)
  (node : Nodes branch n)

def numberedRestriction : NumberedDomain slots → Domain (nodeSlots slots node) :=
  restrictNode slots node ∘ (TreeCanonical.assignmentEquiv slots).symm

theorem numberedRestriction_surjective : Function.Surjective (numberedRestriction slots node) :=
  (restrictNode_surjective slots node).comp (TreeCanonical.assignmentEquiv slots).symm.surjective

theorem pullback_injective :
    Function.Injective (PointwiseSpaces.pullback F2 (numberedRestriction slots node)) :=
  PointwiseSpaces.pullback_injective _ (numberedRestriction_surjective slots node)

def RowSpace : Submodule F2 (NumberedDomain slots → F2) :=
  (NodeH slots node).map (PointwiseSpaces.pullback F2 (numberedRestriction slots node))

def equiv : NodeH slots node ≃ₗ[F2] RowSpace slots node :=
  Submodule.equivMapOfInjective
    (PointwiseSpaces.pullback F2 (numberedRestriction slots node))
    (pullback_injective slots node) (NodeH slots node)

def embed : NodeH slots node →ₗ[F2] RowSpace slots node :=
  (equiv slots node).toLinearMap

@[simp] theorem equiv_apply (f : NodeH slots node) (x : NumberedDomain slots) :
    (equiv slots node f).val x = f.val (numberedRestriction slots node x) := rfl

@[simp] theorem embed_apply (f : NodeH slots node) (x : NumberedDomain slots) :
    (embed slots node f).val x = f.val (numberedRestriction slots node x) := rfl

theorem embed_injective : Function.Injective (embed slots node) :=
  (equiv slots node).injective

theorem embed_surjective : Function.Surjective (embed slots node) :=
  (equiv slots node).surjective

theorem finrank_eq :
    Module.finrank F2 (RowSpace slots node) = Module.finrank F2 (NodeH slots node) :=
  (equiv slots node).finrank_eq.symm

theorem card_eq : Nat.card (RowSpace slots node) = Nat.card (NodeH slots node) :=
  (Nat.card_congr (equiv slots node).toEquiv).symm

theorem uniform_embed [Fintype (NodeH slots node)] [Fintype (RowSpace slots node)] :
    (FiniteDistribution.uniform (NodeH slots node)).pushforward (embed slots node) =
      FiniteDistribution.uniform (RowSpace slots node) :=
  UniformLinearImage.uniform_pushforward_linearMap (embed slots node)
    (embed_surjective slots node)

def rowsEquiv (ℓ : Nat) :
    (Fin ℓ → NodeH slots node) ≃ₗ[F2] (Fin ℓ → RowSpace slots node) :=
  LinearEquiv.piCongrRight (fun _ : Fin ℓ => equiv slots node)

@[simp] theorem rowsEquiv_apply (ℓ : Nat) (f : Fin ℓ → NodeH slots node) (i : Fin ℓ) :
    rowsEquiv slots node ℓ f i = embed slots node (f i) := rfl

theorem uniform_rowsEquiv (ℓ : Nat)
    [Fintype (NodeH slots node)] [Fintype (RowSpace slots node)] :
    (FiniteDistribution.uniform (Fin ℓ → NodeH slots node)).pushforward
        (rowsEquiv slots node ℓ) =
      FiniteDistribution.uniform (Fin ℓ → RowSpace slots node) :=
  UniformLinearImage.uniform_pushforward_linearMap
    (rowsEquiv slots node ℓ).toLinearMap (rowsEquiv slots node ℓ).surjective

theorem squareSpace_eq :
    PointwiseSpaces.squareSpace (RowSpace slots node) =
      (PointwiseSpaces.squareSpace (NodeH slots node)).map
        (PointwiseSpaces.pullback F2 (numberedRestriction slots node)) :=
  (PointwiseSpaces.squareSpace_map_pullback
    (numberedRestriction slots node) (NodeH slots node)).symm

theorem embed_mul (f g : NodeH slots node) :
    (embed slots node f).val * (embed slots node g).val =
      PointwiseSpaces.pullback F2 (numberedRestriction slots node) (f.val * g.val) := rfl

def RootRowSpace : Submodule F2 (NumberedDomain slots → F2) :=
  (H slots).map (PointwiseSpaces.pullback F2 (TreeCanonical.assignmentEquiv slots).symm)

theorem rowSpace_le_root (hbranch : ∀ k < n, 0 < branch k) :
    RowSpace slots node ≤ RootRowSpace slots := by
  intro f hf
  obtain ⟨g, hg, rfl⟩ := Submodule.mem_map.mp hf
  have hroot : PointwiseSpaces.pullback F2 (restrictNode slots node) g ∈ H slots :=
    DescendantSpaces.space_descendant_le (Nodes.path node) (LeafDomain slots) hbranch
      (Submodule.mem_map_of_mem hg)
  exact Submodule.mem_map.mpr
    ⟨PointwiseSpaces.pullback F2 (restrictNode slots node) g, hroot, rfl⟩

theorem squareSpace_le_root (hbranch : ∀ k < n, 0 < branch k)
    (hproper : Nodes.height node < n) :
    PointwiseSpaces.squareSpace (RowSpace slots node) ≤ RootRowSpace slots := by
  rw [squareSpace_eq]
  intro f hf
  obtain ⟨g, hg, rfl⟩ := Submodule.mem_map.mp hf
  have hroot : PointwiseSpaces.pullback F2 (restrictNode slots node) g ∈ H slots :=
    DescendantSpaces.descendant_square_le_space (Nodes.path node) (LeafDomain slots)
      hbranch hproper (Submodule.mem_map_of_mem hg)
  exact Submodule.mem_map.mpr
    ⟨PointwiseSpaces.pullback F2 (restrictNode slots node) g, hroot, rfl⟩


variable {slots} {rows : Nat → Nat}

def embeddedRows (arrays : Arrays slots rows) (node : Nodes branch n) :
    Fin (rows (Nodes.height node)) → RowSpace slots node :=
  fun i => embed slots node (arrays node i)

@[simp] theorem embeddedRows_apply (arrays : Arrays slots rows) (node : Nodes branch n)
    (i : Fin (rows (Nodes.height node))) (x : NumberedDomain slots) :
    (embeddedRows arrays node i).val x =
      (TreeCanonical.numberedFunction slots (fullJoint arrays) x).1 node i := rfl

def matrix (arrays : Arrays slots rows) (node : Nodes branch n) :
    Module.Dual F2 (RowSpace slots node) →ₗ[F2] Block rows node :=
  EvaluationMatrix.ofRows (RowSpace slots node) (embeddedRows arrays node)

@[simp] theorem matrix_evaluate (arrays : Arrays slots rows) (node : Nodes branch n)
    (x : NumberedDomain slots) :
    EvaluationMatrix.evaluate (RowSpace slots node) (matrix arrays node) x =
      (TreeCanonical.numberedFunction slots (fullJoint arrays) x).1 node := rfl

theorem evaluation_comp_embed (x : NumberedDomain slots) :
    (EvaluationMatrix.evaluation (RowSpace slots node) x).comp (embed slots node) =
      EvaluationMatrix.evaluation (NodeH slots node) (numberedRestriction slots node x) := by
  ext f
  rfl

end
end PerfectCompleteness.NodeEmbedding

end OAI