Fair-bit and bounded-prefix oracle query machines #
coinMachine emits a single fair bit in one step. queryTakePTM op realizes the primitive
bounded-prefix oracle call on an encoded pair encPair encBits encUnary (q, limit): it unframes q
into channel op's query buffer, submits the query once, copies at most limit reply bits while
scanning the unary limit, and rewinds the input head.
Main definitions #
Turing.MultiTapePTM.coinMachine: one-step fair-bit emitter.Turing.MultiTapePTM.queryTakePTM: tidy machine forList.take limit <$> query (op, q).
Main results #
Turing.MultiTapePTM.computesTidily_coinMachine: tidy specification ofcoinMachine.Turing.MultiTapePTM.computesTidily_queryTakePTM: tidy specification ofqueryTakePTM.
References #
Adapts the probabilistic oracle machines of the cslib crypto branch at
5ff69ca93402e7c947208dc56396d6d86203ccd8 to the tidy-machine conventions of
crei:crei/tidy-universal @7f7c0696.
Fair-bit machine #
One-state machine that emits a single fair bit and halts without moving any head.
Instances For
coinMachine tidily computes encBool <$> sample (uniform Bool) in 1 step.
Bounded-prefix query machine #
Control states of queryTakeCore: read frame marker, read framed query bit, submit query,
and copy reply bits while scanning the unary limit.
- marker : QueryTakeState
- bit : QueryTakeState
- submit : QueryTakeState
- copyReply : QueryTakeState
Instances For
Unframe the query word from the input into channel op, submit the query, and copy at most
limit reply bits while scanning the unary suffix.
Instances For
Run queryTakeCore op and then rewind the input head to position 1.
Instances For
Configuration of queryTakeCore at 0-based input index idx ≤ x.length.
Instances For
Scanning List.replicate remLimit true in state .copyReply appends (answer.drop pos).take remLimit to out and halts at the right boundary in remLimit + 1 steps.
Scanning frame rem in state .marker appends rem to channel op's query buffer and
submits the accumulated query in 2 * rem.length + 2 steps, entering .copyReply.
queryTakePTM op tidily computes List.take limit <$> query (op, q) on
encPair encBits encUnary (q, limit) in 4 * q.length + 2 * limit + 6 steps.