File size: 7,974 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
157
158
159
160
161
162
163
164
165
import OAI.Computability.PerfectCompleteness.Construction.ChildCallNumbering
import OAI.Computability.PerfectCompleteness.Foundations.DependentPredictionDifferenceLemmas
import OAI.Computability.PerfectCompleteness.Foundations.MultiplicationFormInjectiveLemmas
import OAI.Computability.PerfectCompleteness.Sampling.RationalFiniteLawLemmas

namespace OAI

section

namespace PerfectCompleteness.ChildCallNumberingLaws

noncomputable section

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

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

def liftedLaw (rows : Nat → Nat)
    {slots projected : Slots branch n → Fin t → MixedSupport.Slot}
    (p : ∀ s k, MixedSupport.Projection (slots s k) (projected s k)) :
    FiniteDistribution (ChildCallNumbering.Raw (C := C) rows slots) :=
  (FiniteDistribution.uniform (ChildCallNumbering.Raw (C := C) rows projected)).pushforward
    (ChildCallNumbering.pullback rows p)

theorem liftedLaw_numbered (rows : Nat → Nat)
    {slots projected : Slots branch n → Fin t → MixedSupport.Slot}
    (p : ∀ s k, MixedSupport.Projection (slots s k) (projected s k)) :
    (liftedLaw (C := C) rows p).pushforward (ChildCallNumbering.equiv rows slots) =
      ChildBlockProjection.liftedLaw (Fintype.card C) rows p := by
  unfold liftedLaw ChildBlockProjection.liftedLaw
  rw [← ChildCallNumbering.uniform_equiv (C := C) rows projected]
  rw [FiniteDistribution.pushforward_comp, FiniteDistribution.pushforward_comp]
  congr 1

def mixtureLaw {Z : Type*} [Fintype Z] (rows : Nat → Nat)
    (slots : Slots branch n → Fin t → MixedSupport.Slot)
    (projected : Z → Slots branch n → Fin t → MixedSupport.Slot)
    (p : ∀ z s k, MixedSupport.Projection (slots s k) (projected z s k))
    (choiceLaw : FiniteDistribution Z) :
    FiniteDistribution (ChildCallNumbering.Raw (C := C) rows slots) :=
  choiceLaw.mixture (fun z => liftedLaw rows (p z))

theorem mixtureLaw_numbered {Z : Type*} [Fintype Z] (rows : Nat → Nat)
    (slots : Slots branch n → Fin t → MixedSupport.Slot)
    (projected : Z → Slots branch n → Fin t → MixedSupport.Slot)
    (p : ∀ z s k, MixedSupport.Projection (slots s k) (projected z s k))
    (choiceLaw : FiniteDistribution Z) :
    (mixtureLaw (C := C) rows slots projected p choiceLaw).pushforward
        (ChildCallNumbering.equiv rows slots) =
      ChildBlockProjection.mixtureLaw (Fintype.card C) rows slots projected p choiceLaw := by
  simp only [mixtureLaw, FiniteDistribution.pushforward_mixture,
    liftedLaw_numbered, ChildBlockProjection.mixtureLaw]

variable {I : Type*} [Fintype I] [DecidableEq I]
  {Z : I → Type*} [∀ i, Fintype (Z i)]

def replacementLaws (rows : Nat → Nat)
    (slots : I → Slots branch n → Fin t → MixedSupport.Slot)
    (projected : (i : I) → Z i → Slots branch n → Fin t → MixedSupport.Slot)
    (p : ∀ i z s k, MixedSupport.Projection (slots i s k) (projected i z s k))
    (choiceLaw : (i : I) → FiniteDistribution (Z i)) :
    (i : I) → FiniteDistribution (ChildCallNumbering.Raw (C := C) rows (slots i)) :=
  fun i => mixtureLaw rows (slots i) (projected i) (p i) (choiceLaw i)

def number (rows : Nat → Nat)
    (slots : I → Slots branch n → Fin t → MixedSupport.Slot)
    (x : (i : I) → ChildCallNumbering.Raw (C := C) rows (slots i)) :
    (i : I) → ChildBlockCardinality.Raw (Fintype.card C) rows (slots i) :=
  fun i => ChildCallNumbering.equiv rows (slots i) (x i)

def unnumber (rows : Nat → Nat)
    (slots : I → Slots branch n → Fin t → MixedSupport.Slot)
    (x : (i : I) → ChildBlockCardinality.Raw (Fintype.card C) rows (slots i)) :
    (i : I) → ChildCallNumbering.Raw (C := C) rows (slots i) :=
  fun i => (ChildCallNumbering.equiv rows (slots i)).symm (x i)

omit [Fintype I] [DecidableEq I] in
@[simp] theorem unnumber_number (rows : Nat → Nat)
    (slots : I → Slots branch n → Fin t → MixedSupport.Slot)
    (x : (i : I) → ChildCallNumbering.Raw (C := C) rows (slots i)) :
    unnumber rows slots (number rows slots x) = x := by
  funext i
  exact (ChildCallNumbering.equiv rows (slots i)).symm_apply_apply (x i)

omit [Fintype I] [DecidableEq I] in
@[simp] theorem number_unnumber (rows : Nat → Nat)
    (slots : I → Slots branch n → Fin t → MixedSupport.Slot)
    (x : (i : I) → ChildBlockCardinality.Raw (Fintype.card C) rows (slots i)) :
    number rows slots (unnumber (C := C) rows slots x) = x := by
  funext i
  exact (ChildCallNumbering.equiv rows (slots i)).apply_symm_apply (x i)

theorem uniform_product_numbered (rows : Nat → Nat)
    (slots : I → Slots branch n → Fin t → MixedSupport.Slot) :
    (FiniteProduct.law (fun i => FiniteDistribution.uniform
      (ChildCallNumbering.Raw (C := C) rows (slots i)))).pushforward (number rows slots) =
      FiniteProduct.law (fun i => FiniteDistribution.uniform
        (ChildBlockCardinality.Raw (Fintype.card C) rows (slots i))) := by
  unfold number
  rw [FiniteProduct.pushforward_map]
  congr 1
  funext i
  exact ChildCallNumbering.uniform_equiv rows (slots i)

theorem conditional_product_numbered (rows : Nat → Nat)
    (slots : I → Slots branch n → Fin t → MixedSupport.Slot)
    (projected : (i : I) → Z i → Slots branch n → Fin t → MixedSupport.Slot)
    (p : ∀ i z s k, MixedSupport.Projection (slots i s k) (projected i z s k))
    (choiceLaw : (i : I) → FiniteDistribution (Z i)) (mask : I → Bool) :
    (FiniteProduct.law (fun i => if mask i then
      replacementLaws (C := C) rows slots projected p choiceLaw i else
      FiniteDistribution.uniform (ChildCallNumbering.Raw (C := C) rows (slots i)))).pushforward
        (number rows slots) =
      FiniteProduct.law (fun i => if mask i then
        ChildBlockProjection.replacementLaws (Fintype.card C) rows slots projected p choiceLaw i else
        FiniteDistribution.uniform (ChildBlockCardinality.Raw (Fintype.card C) rows (slots i))) := by
  unfold number
  rw [FiniteProduct.pushforward_map]
  congr 1
  funext i
  cases mask i with
  | false =>
      simp only [Bool.false_eq_true, ite_false]
      exact ChildCallNumbering.uniform_equiv rows (slots i)
  | true =>
      simp only [ite_true]
      exact mixtureLaw_numbered rows (slots i) (projected i) (p i) (choiceLaw i)

theorem markedLaw_numbered (rows : Nat → Nat)
    (slots : I → Slots branch n → Fin t → MixedSupport.Slot)
    (projected : (i : I) → Z i → Slots branch n → Fin t → MixedSupport.Slot)
    (p : ∀ i z s k, MixedSupport.Projection (slots i s k) (projected i z s k))
    (choiceLaw : (i : I) → FiniteDistribution (Z i))
    (β : ℝ) (hβ : 0 ≤ β) (hβ' : β ≤ 1) :
    (SparseReplacement.markedLaw
      (fun i => FiniteDistribution.uniform (ChildCallNumbering.Raw (C := C) rows (slots i)))
      (replacementLaws rows slots projected p choiceLaw) β hβ hβ').pushforward
        (fun z => (z.1, number rows slots z.2)) =
      SparseReplacement.markedLaw
        (fun i => FiniteDistribution.uniform
          (ChildBlockCardinality.Raw (Fintype.card C) rows (slots i)))
        (ChildBlockProjection.replacementLaws (Fintype.card C) rows slots projected p choiceLaw)
        β hβ hβ' := by
  apply SigmaObservation.eq_of_probability_eq
  intro event
  rw [FiniteDistribution.probability_pushforward]
  unfold SparseReplacement.markedLaw
  rw [CleanConditioning.probability_kernelJoint, CleanConditioning.probability_kernelJoint]
  apply Finset.sum_congr rfl
  intro mask _
  apply congrArg (fun x : ℝ =>
    (FiniteProduct.law (fun _ : I => ProjectionPosterior.bernoulli β hβ hβ')).weight mask * x)
  have h := congrArg (fun μ => μ.probability (fun x => event (mask, x)))
    (conditional_product_numbered (C := C) rows slots projected p choiceLaw mask)
  simpa only [FiniteDistribution.probability_pushforward] using h

end
end PerfectCompleteness.ChildCallNumberingLaws

end

end OAI