File size: 2,547 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
import OAI.Computability.PerfectCompleteness.Foundations.WholeCutGrouping

namespace OAI

section

namespace PerfectCompleteness.CutCallExtension

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

noncomputable section

variable {branch : Nat → Nat} {n t : Nat} {C : Type*} [Fintype C]
  (slots : RecursiveSpaces.Slots branch (n + 1) → Fin t → MixedSupport.Slot)
  (rows : Nat → Nat)

abbrev Extended := CutChildGrouping.Raw (C := Option C) slots rows

def original (x : Extended (C := C) slots rows) :
    CutChildGrouping.Raw (C := C) slots rows :=
  fun i => (fun c => (x i).1 (some c), (x i).2)

def fresh (x : Extended (C := C) slots rows) : H slots :=
  UniformChildSum.recursiveSum (LeafDomain slots) (fun i => (x i).1 none)

def observe (x : Extended (C := C) slots rows) :
    CutChildGrouping.Assembled (C := C) slots rows × H slots :=
  (CutChildGrouping.assemble slots rows (original slots rows x), fresh slots rows x)

def splitAssembled : CutChildGrouping.Assembled (C := Option C) slots rows →ₗ[F2]
    CutChildGrouping.Assembled (C := C) slots rows × H slots where
  toFun x := ((fun c => x.1 (some c), x.2), x.1 none)
  map_add' _ _ := rfl
  map_smul' _ _ := rfl

omit [Fintype C] in
theorem splitAssembled_surjective : Function.Surjective
    (splitAssembled (C := C) slots rows) := by
  rintro ⟨⟨old, arrays⟩, extra⟩
  refine ⟨(fun c => match c with | none => extra | some c => old c, arrays), ?_⟩
  rfl

omit [Fintype C] in
@[simp] theorem split_assemble (x : Extended (C := C) slots rows) :
    splitAssembled slots rows (CutChildGrouping.assemble slots rows x) =
      observe slots rows x := rfl

theorem observe_law :
    (CutChildGrouping.rawLaw (C := Option C) slots rows).pushforward
        (observe slots rows) =
      (FiniteDistribution.uniform (CutChildGrouping.Assembled (C := C) slots rows)).product
        (FiniteDistribution.uniform (H slots)) := by
  change (CutChildGrouping.rawLaw (C := Option C) slots rows).pushforward
    (fun x => splitAssembled slots rows (CutChildGrouping.assemble slots rows x)) = _
  rw [← FiniteDistribution.pushforward_comp, CutChildGrouping.assemble_law,
    UniformLinearImage.uniform_pushforward_linearMap
      (splitAssembled slots rows) (splitAssembled_surjective slots rows)]
  exact WholeCutSampler.uniform_product.symm

theorem call_count : Fintype.card (Option C) = Fintype.card C + 1 :=
  Fintype.card_option

end
end PerfectCompleteness.CutCallExtension

end

end OAI