Tidy combinators for probabilistic oracle machines #
This module lifts the deterministic tidy-machine combinators (comp, append, and branch/ite)
to MultiTapePTM specifications in RunsWords and ComputesTidily, re-exporting the foundational
phase specifications (RunsWords) and word-redirection combinators (Tidy/Redirect). Every
combinator preserves the exact joint distribution of tape words, emitted output and external oracle
state, and maintains clean query buffers at phase boundaries.
Main definitions #
Turing.MultiTapePTM.tidyComp: sequential composition of tidy probabilistic machines.Turing.MultiTapePTM.appendPTM: concatenate the outputs of two tidy probabilistic machines.Turing.MultiTapePTM.branch: branch on whether a work tape is blank without executing the unselected branch.Turing.MultiTapePTM.itePTM: tidy case distinction on a work tape word.
Main results #
Turing.MultiTapePTM.ComputesTidily.comp: tidy sequential composition.Turing.MultiTapePTM.ComputesTidily.append: tidy output concatenation.Turing.MultiTapePTM.ComputesTidily.ite: tidy conditional execution.
References #
Adapts the deterministic tidy-machine combinators of Christian Reitwiessner's
crei:crei/tidy-universal @7f7c0696 (Combinators/Comp, Combinators/Append, and Combinators/Ite)
to the probabilistic oracle machines of the cslib crypto branch at
5ff69ca93402e7c947208dc56396d6d86203ccd8.
Run tm₁ with its output written to work tape Fin.natAdd (max k₁ k₂) 0, then run tm₂
reading its input from that tape (using mark on the last work tape), and finally clear that
tape.
Instances For
If tm₁ computes prog₁ tidily on x in t₁ steps with outputs of length at most l, and
tm₂ computes prog₂ w tidily on every supported output w of prog₁ in t₂ steps, then
tm₂.tidyComp tm₁ mark computes prog₁ >>= prog₂ tidily on x in t₁ + t₂ + 4 * l + 9 steps.
Unconditional tidy sequential composition using h₁.length_output_le.
Run tm₁ and then tm₂ on the same input, both padded to max k₁ k₂ work tapes.
Instances For
If tm₁ computes prog₁ tidily in t₁ steps and tm₂ computes prog₂ w₁ tidily in t₂
steps on the same input x, then appendPTM tm₁ tm₂ computes
prog₁ >>= fun w₁ => (fun w₂ => w₁ ++ w₂) <$> prog₂ w₁ tidily in t₁ + t₂ steps.
Prepend a deterministically computed prefix word before a tidy probabilistic computation.
Read the cell under the head of work tape i, moving no head and writing nothing, then run
tm₁ if the cell is not blank and tm₂ if it is.
Instances For
If branch i tm₁ tm₂ acts on f q by mapping tm's actions through f, then its clocked
run from Config.mapState f cfg maps tm's clocked run through Config.mapState f.
When tape i is empty, branch i tm₁ tm₂ transitions in 1 step to tm₂ and never executes
tm₁.
When tape i is non-empty, branch i tm₁ tm₂ transitions in 1 step to tm₁ and never
executes tm₂.
Run tmc with its output on a new last work tape, then tm₁ if that word is non-empty and
tm₂ otherwise, and clear the tape.
Instances For
If tmc computes the test word w from x tidily, tm₁ computes prog₁ tidily when
w ≠ [] and tm₂ computes prog₂ tidily when w = [], then itePTM tmc tm₁ tm₂ computes
if w = [] then prog₂ else prog₁ tidily within the bounds of tmc plus those of the active
branch, never executing the unselected branch.