File size: 4,921 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 | import OAI.Computability.PerfectCompleteness.Sampling.CutSamplerKeyLocalityLemmas
namespace OAI
section
namespace PerfectCompleteness.LowerCutScalar
open RecursiveSpaces DescendantSpaces RecursiveSampler TerminalCalls
noncomputable section
universe u w
variable {branch : Nat → Nat} {n m : Nat}
abbrev Values (𝕜 : Type w) [Field 𝕜] (repeats : Nat → Nat)
(p : Path branch n (m + 1)) (A : Slots branch n → Type u) :=
TerminalIndex repeats p → space 𝕜 branch (m + 1) (p.family A)
def reconstruct (𝕜 : Type w) [Field 𝕜] (repeats : Nat → Nat) :
{n m : Nat} → (p : Path branch n (m + 1)) → (A : Slots branch n → Type u) →
Values 𝕜 repeats p A → CutTerminalSplit.ExteriorTape 𝕜 repeats p A →
space 𝕜 branch n A
| _, _, .refl _, _, values, _ => values ()
| n + 1, _, .step i p, A, values, exterior =>
RecursiveSampler.combine 𝕜 A i (repeats (n + 1))
(fun j => exterior ⟨.inl j, not_isTerminal_ordinary repeats i p j⟩)
(fun h => reconstruct 𝕜 repeats p (childFamily A i)
(fun terminal => values ((h, false), terminal))
(CutSamplerReplayGrouping.subExterior 𝕜 repeats i p A (h, false) exterior))
(fun h => reconstruct 𝕜 repeats p (childFamily A i)
(fun terminal => values ((h, true), terminal))
(CutSamplerReplayGrouping.subExterior 𝕜 repeats i p A (h, true) exterior))
@[simp] theorem reconstruct_refl (𝕜 : Type w) [Field 𝕜] (repeats : Nat → Nat)
(A : Slots branch (m + 1) → Type u)
(values : Values 𝕜 repeats (.refl (m + 1)) A)
(exterior : CutTerminalSplit.ExteriorTape 𝕜 repeats (.refl (m + 1)) A) :
reconstruct 𝕜 repeats (.refl (m + 1)) A values exterior = values () := rfl
theorem reconstruct_step (𝕜 : Type w) [Field 𝕜] (repeats : Nat → Nat)
(i : Fin (branch n)) (p : Path branch n (m + 1))
(A : Slots branch (n + 1) → Type u)
(values : Values 𝕜 repeats (.step i p) A)
(exterior : CutTerminalSplit.ExteriorTape 𝕜 repeats (.step i p) A) :
reconstruct 𝕜 repeats (.step i p) A values exterior =
RecursiveSampler.combine 𝕜 A i (repeats (n + 1))
(fun j => exterior ⟨.inl j, not_isTerminal_ordinary repeats i p j⟩)
(fun h => reconstruct 𝕜 repeats p (childFamily A i)
(fun terminal => values ((h, false), terminal))
(CutSamplerReplayGrouping.subExterior 𝕜 repeats i p A (h, false) exterior))
(fun h => reconstruct 𝕜 repeats p (childFamily A i)
(fun terminal => values ((h, true), terminal))
(CutSamplerReplayGrouping.subExterior 𝕜 repeats i p A (h, true) exterior)) := rfl
theorem reconstruct_splitTape (𝕜 : Type w) [Field 𝕜]
(repeats : Nat → Nat) (p : Path branch n (m + 1)) :
∀ (A : Slots branch n → Type u)
(tape : CutSamplerRefinement.Tape 𝕜 repeats p A),
reconstruct 𝕜 repeats p A
(fun terminal => UniformChildSum.recursiveSum (p.family A)
((CutTerminalSplit.splitTape 𝕜 repeats p A tape).1 terminal))
(CutTerminalSplit.splitTape 𝕜 repeats p A tape).2 =
CutSamplerRefinement.evaluate 𝕜 repeats p A tape := by
induction n generalizing m with
| zero =>
have h := p.height_le
omega
| succ n ih =>
cases p with
| refl =>
intro A tape
rfl
| step i p =>
intro A tape
rw [reconstruct_step, CutSamplerLocality.evaluate_step]
apply congrArg₂ (RecursiveSampler.combine 𝕜 A i (repeats (n + 1))
(fun j => tape (.inl j)))
· funext h
rw [CutSamplerReplayGrouping.subExterior_splitTape]
simp_rw [CutTerminalZero.splitTape_terminal_step]
exact ih p (childFamily A i)
(CutSamplerLocality.subTape 𝕜 repeats i p A tape h false)
· funext h
rw [CutSamplerReplayGrouping.subExterior_splitTape]
simp_rw [CutTerminalZero.splitTape_terminal_step]
exact ih p (childFamily A i)
(CutSamplerLocality.subTape 𝕜 repeats i p A tape h true)
theorem reconstruct_join (𝕜 : Type w) [Field 𝕜] (repeats : Nat → Nat)
(p : Path branch n (m + 1)) (A : Slots branch n → Type u)
(terminal : CutTerminalSplit.TerminalTape 𝕜 repeats p A)
(exterior : CutTerminalSplit.ExteriorTape 𝕜 repeats p A) :
reconstruct 𝕜 repeats p A
(fun call => UniformChildSum.recursiveSum (p.family A) (terminal call)) exterior =
CutSamplerRefinement.evaluate 𝕜 repeats p A
((CutTerminalSplit.splitTape 𝕜 repeats p A).symm (terminal, exterior)) := by
simpa only [Equiv.apply_symm_apply] using
reconstruct_splitTape 𝕜 repeats p A
((CutTerminalSplit.splitTape 𝕜 repeats p A).symm (terminal, exterior))
end
end PerfectCompleteness.LowerCutScalar
end
end OAI
|