Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.BlockComputation.QueryReplayProvidersCorrect

Correct provider-window assembly #

The raw combiner preserves canonical buffers and selects the same blocks as the semantic entering window. Checked labels must all succeed, including labels at unused provider ports.

theorem Turing.MultiTapePTM.BlockComputation.QueryReplay.Providers.canonical_combine {k : ℕ} {Q : Type} (b : ℕ) (ports : PortMap k) (previous : RawResult k Q) (providers : ProviderValues k Q) (hprevious : Load.CanonicalWindows b previous) (hproviders : ∀ (h : Fin k) (d : Fin 3), Load.CanonicalWindows b (providers h d)) :
Load.CanonicalWindows b (combine (b, ports, previous, providers))

Assembling valid provider blocks preserves the loader's canonical explicit buffers.

theorem Turing.MultiTapePTM.BlockComputation.QueryReplay.Providers.toView_combine {k : ℕ} {Q : Type} (b : ℕ) [NeZero b] (ports : PortMap k) (previous : RawResult k Q) (providers : ProviderValues k Q) (hprevious : Load.CanonicalWindows b previous) (hproviders : ∀ (h : Fin k) (d : Fin 3), Load.CanonicalWindows b (providers h d)) :
RawResult.toView b (combine (b, ports, previous, providers)) = ((RawResult.toView b previous).1, fun (h : Fin k) (d : Fin 3) (r : ZMod b) => match ports h d with | none => none | some p => (RawResult.toView b (providers h d)).2 h p r)

Interpreting the native result gives exactly the selected semantic entering windows.

theorem Turing.MultiTapePTM.BlockComputation.QueryReplay.Providers.Labels.combine_of_parse {k : ℕ} {Q : Type} {s : ℕ} (e : Q ≃ Fin s) (b : ℕ) (ports : PortMap k) (previousWord : List Bool) (providerWords : ProviderWords k) (previous : RawResult k Q) (providers : ProviderValues k Q) (hprevious : Encoding.NativeChecked.parse e (b, previousWord) = some previous) (hproviders : ∀ (h : Fin k) (d : Fin 3), Encoding.NativeChecked.parse e (b, providerWords h d) = some (providers h d)) :
combine e (b, ports, previousWord, providerWords) = some (Providers.combine (b, ports, previous, providers))

Successful checked parsing of every supplied label gives the assembled raw windows. The condition includes provider words whose selected port is absent.

The semantic schedule chooses the last earlier interval containing each entering block, then reads that block at its port in the provider's window. A never visited block is blank. This finite map specifies the native assembler's input; computing it is a caller operation.

theorem Turing.MultiTapePTM.BlockComputation.QueryReplay.Providers.toView_combine_enteringWindow {k : ℕ} {Q : Type} {q : ℕ} (machine : MultiTapePTM k Bool Q) (b : ℕ) [NeZero b] (σ : Schedule k q) (i : Fin q) (previous : RawResult k Q) (providers : ProviderValues k Q) (hprevious : Load.CanonicalWindows b previous) (hproviders : ∀ (h : Fin k) (d : Fin 3), Load.CanonicalWindows b (providers h d)) :
RawResult.toView b (combine (b, portMap σ i, previous, providers)) = ((RawResult.toView b previous).1, enteringWindow machine b σ i fun (h : Fin k) (d : Fin 3) => some (RawResult.toView b (providers h d)))

With the schedule's provider ports, native assembly reconstructs exactly the functional block gate's entering window. The preceding control record is retained. All provider values here have already succeeded; checking that condition belongs to the checked-label wrapper.