File size: 8,619 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 166 167 168 169 170 171 172 173 | import OAI.Computability.PerfectCompleteness.Construction.SourceQuestionCutSplit
import OAI.Computability.PerfectCompleteness.Decoding.DecoderSourcePullback
import OAI.Computability.PerfectCompleteness.Decoding.FixedDecoderCleanRateLemmas
import OAI.Computability.PerfectCompleteness.Foundations.WholeArrayInteriorExteriorLemmas
import OAI.Computability.PerfectCompleteness.Machines.WholeArrayInteriorOwnInputLaw
import OAI.Computability.PerfectCompleteness.Sampling.CutSamplerReplayTransportLemmas
namespace OAI
section
namespace PerfectCompleteness.StoppedCleanGeometry
noncomputable section
open scoped Classical
open RecursiveSpaces DescendantSpaces TreeSourceSpaces HierarchicalArrays
open UniqueGamesTheorem.Foundations.Games
variable {branch : Nat → Nat}
def descendant : {N j i : Nat} → (p : Path branch N (j + 1)) →
(q : Path branch (j + 1) (i + 1)) → i < j →
HierarchicalFrozenTables.LowerNodes (WholeArrayInteriorExterior.upperNode p) (i + 1)
| _, _, _, .refl _, q, hij =>
⟨⟨WholeArrayInteriorExterior.upperNode q,
(WholeArrayInteriorExterior.upperNode_height q).trans_lt (Nat.succ_lt_succ hij)⟩,
WholeArrayInteriorExterior.upperNode_height q⟩
| _, _, _, .step _ p, q, hij => descendant p q hij
theorem lowerNode_descendant : {N j i : Nat} → (p : Path branch N (j + 1)) →
(q : Path branch (j + 1) (i + 1)) → (hij : i < j) →
HierarchicalLeftDecoder.LowerNode (WholeArrayInteriorExterior.upperNode p) (i + 1)
(descendant p q hij) = WholeArrayInteriorExterior.upperNode (p.append q)
| _, _, _, .refl _, _, _ => rfl
| N + 1, _, _, .step child p, q, hij =>
congrArg (fun node : Nodes branch N =>
(Sum.inr (child, node) : Nodes branch (N + 1))) (lowerNode_descendant p q hij)
variable {N j i : Nat} (p : Path branch N (j + 1))
(q : Path branch (j + 1) (i + 1)) (hij : i < j)
def cut : OwnInputReference.Cut (WholeArrayInteriorExterior.upperNode p)
(HierarchicalLeftDecoder.LowerNode (WholeArrayInteriorExterior.upperNode p) (i + 1)
(descendant p q hij)) :=
DecoderSourcePullback.selectedCut (WholeArrayInteriorExterior.upperNode p) (i + 1)
(descendant p q hij)
@[simp] theorem lowerHeight :
Nodes.height (HierarchicalLeftDecoder.LowerNode
(WholeArrayInteriorExterior.upperNode p) (i + 1) (descendant p q hij)) = i + 1 :=
CleanDecoderContext.lowerHeight (WholeArrayInteriorExterior.upperNode p) (descendant p q hij)
theorem fullPath_spec : {N j i : Nat} → (p : Path branch N (j + 1)) →
(q : Path branch (j + 1) (i + 1)) → (hij : i < j) →
(⟨Nodes.height (HierarchicalLeftDecoder.LowerNode
(WholeArrayInteriorExterior.upperNode p) (i + 1) (descendant p q hij)),
WholeArrayInteriorOwnInputLaw.fullPath (WholeArrayInteriorExterior.upperNode p)
(HierarchicalLeftDecoder.LowerNode (WholeArrayInteriorExterior.upperNode p) (i + 1)
(descendant p q hij)) (cut p q hij)⟩ : Σ height, Path branch N height) =
⟨i + 1, p.append q⟩
| _, _, _, .refl _, q, _ => WholeArrayInteriorExterior.upperNode_spec q
| N + 1, _, _, .step child p, q, hij =>
congrArg (fun z : Σ height, Path branch N height =>
(⟨z.1, Path.step child z.2⟩ : Σ height, Path branch (N + 1) height))
(fullPath_spec p q hij)
private theorem append_cast_heq {N a b c : Nat} (pref : Path branch N a)
(suffix : Path branch a b) (h : b = c) :
HEq (pref.append (h ▸ suffix)) (pref.append suffix) := by
cases h
rfl
theorem cleanPath_eq :
CleanRecordDecoderInput.path (WholeArrayInteriorExterior.upperNode p)
(descendant p q hij) (cut p q hij) = p.append q := by
apply eq_of_heq
exact (append_cast_heq (Nodes.path (WholeArrayInteriorExterior.upperNode p))
(cut p q hij).path
(CleanDecoderContext.lowerHeight (WholeArrayInteriorExterior.upperNode p)
(descendant p q hij))).trans ((Sigma.mk.inj (fullPath_spec p q hij)).2)
def firstLeaf (hbranch : ∀ k, 0 < branch k) : (height : Nat) → Slots branch height
| 0 => ()
| height + 1 => (⟨0, hbranch height⟩, firstLeaf hbranch height)
section Fixed
variable {δ : ℚ} {hδ : 0 < δ} (parameters : FixedParameters.Parameters δ hδ)
(input : List Bool) {N j i : Nat}
(p : Path (FixedParameters.branch parameters) N (j + 1))
(q : Path (FixedParameters.branch parameters) (j + 1) (i + 1))
abbrev OutsideQuestions := SourceQuestionCutSplit.OutsideQuestions (p.append q)
(FixedRows.sourceLength parameters.plan hδ)
(PCPSource.normalizedFormula (BinaryLanguage.totalRename input)).clauses.length
def fixedOutside (external : OutsideQuestions parameters input p q) :=
sourceSlots (PCPSource.clauseFamily (BinaryLanguage.totalRename input))
(PreliminarySampler.endpoints
(SourceQuestionCutSplit.join (p.append q) (fun _ _ => 0) external))
def placeholder : Slots (FixedParameters.branch parameters) (i + 1) →
Fin (FixedRows.sourceLength parameters.plan hδ) → MixedSupport.Slot :=
fun _ _ => SourceKeys.slot (PCPSource.clauseFamily (BinaryLanguage.totalRename input)) (.clause 0)
theorem fixedOutside_at (external : OutsideQuestions parameters input p q)
(leaf : SourceQuestionCutSplit.OutsideLeaf (p.append q))
(coordinate : Fin (FixedRows.sourceLength parameters.plan hδ)) :
fixedOutside parameters input p q external leaf.val coordinate =
SourceKeys.slot (PCPSource.clauseFamily (BinaryLanguage.totalRename input))
(.clause (external leaf coordinate)) := by
unfold fixedOutside sourceSlots PreliminarySampler.endpoints
rw [SourceQuestionCutSplit.join_outside]
abbrev Exterior (external : OutsideQuestions parameters input p q) :=
WholeCutGrouping.Exterior (FixedRows.rows parameters.plan) (FixedRows.repeats parameters.plan)
(p.append q) (fixedOutside parameters input p q external)
variable (hij : i < j) (external : OutsideQuestions parameters input p q)
def filledExteriorEquiv : Exterior parameters input p q external ≃
CleanPhysicalReplay.Exterior (FixedRows.rows parameters.plan) (FixedRows.repeats parameters.plan)
(p.append q) (fixedOutside parameters input p q external)
(placeholder parameters input (i := i)) :=
WholeCutExteriorTransport.equiv (FixedRows.rows parameters.plan) (FixedRows.repeats parameters.plan)
(p.append q) (fixedOutside parameters input p q external)
(CutSlotAssembly.fill (p.append q) (fixedOutside parameters input p q external)
(placeholder parameters input (i := i)))
(fun leaf hleaf => (CutSlotAssembly.fill_outside (p.append q)
(fixedOutside parameters input p q external) (placeholder parameters input (i := i))
leaf hleaf).symm)
def exteriorEquiv : Exterior parameters input p q external ≃
CleanPhysicalReplay.Exterior (FixedRows.rows parameters.plan) (FixedRows.repeats parameters.plan)
(CleanRecordDecoderInput.path (WholeArrayInteriorExterior.upperNode p)
(descendant p q hij) (cut p q hij)) (fixedOutside parameters input p q external)
(placeholder parameters input (i := i)) :=
(filledExteriorEquiv parameters input p q external).trans
(Equiv.cast (congrArg (fun path : Path (FixedParameters.branch parameters) N (i + 1) =>
CleanPhysicalReplay.Exterior (FixedRows.rows parameters.plan) (FixedRows.repeats parameters.plan)
path (fixedOutside parameters input p q external)
(placeholder parameters input (i := i)))
(cleanPath_eq p q hij).symm))
theorem exteriorEquiv_law :
(FiniteDistribution.uniform (Exterior parameters input p q external)).pushforward
(exteriorEquiv parameters input p q hij external) = FiniteDistribution.uniform _ := by
rw [← FiniteDistribution.transport_eq_pushforward]
exact UniformConditioning.uniform_transport (exteriorEquiv parameters input p q hij external)
def geometry (exterior : Exterior parameters input p q external) :
FixedDecoderCleanRate.Geometry parameters N i (WholeArrayInteriorExterior.upperNode p)
(descendant p q hij) where
designated := fun _ => firstLeaf (FixedParameters.branch_pos parameters) i
cut := cut p q hij
outside := fixedOutside parameters input p q external
placeholder := placeholder parameters input
exterior := exteriorEquiv parameters input p q hij external exterior
theorem geometry_path (exterior : Exterior parameters input p q external) :
CleanRecordDecoderInput.path (WholeArrayInteriorExterior.upperNode p) (descendant p q hij)
(geometry parameters input p q hij external exterior).cut = p.append q :=
cleanPath_eq p q hij
end Fixed
end
end PerfectCompleteness.StoppedCleanGeometry
end
end OAI
|