In-place multi-head machines #
An in-place machine has one writable tape whose cells are exactly the n input cells, a finite
tape alphabet Γ, h heads sharing those n cells, and a finite control Q. Moves past 0 or
n - 1 clamp at the boundary (Move.apply), and when multiple heads write to the same cell in one
step, the highest head index wins (writeHeads). Because native Turing.Cfg has a read-only
input, separate unbounded work tapes, and a write-only output, this fixed-length shared-tape
configuration map is formalized as a standalone finite dynamical system rather than an instance of
Turing.Cfg/Turing.Action.
This module defines configurations (w, p, q) with w : Fin n → Γ, p : Fin h → Fin n, and
q : Q, the one-step map Machine.step, and the finite set reach M n of configurations
reachable from initial configurations M.init x (x : BitString n). It proves the configuration
count |Γ|^n * n^h * |Q| (card_config), the bounds on (reach M n).card
(reach_card_le_configs, reach_card_le_time under a halting-time bound, and
reach_card_le_round for a machine that returns to an initial configuration every τ steps), and
the conditional halting characterization after |Γ|^n * n^h * |Q| steps under absorbing halting
states (iterate_card_halting): the configuration at step |Γ|^n * n^h * |Q| is halting if and
only if the run ever halts, and equals the halting configuration whenever one is reached
(non-halting runs may continue cycling).
The circuit theorems (inplace_fixed_power, inplace_fixed_power_optimized,
inplace_configs_optimized, inplace_time_optimized, inplace_halting) apply
fixed_power_encoded to the forward-invariant reachable set reach M n, assuming an encoding
e : Config Q Γ n h → BitString w injective on reach M n, a circuit c computing M.step on
e '' reach M n, and a circuit ι computing x ↦ e (M.init x) (charging c.size and ι.size
rather than compiling M.δ into gates). In inplace_halting, the circuit outputs the encoded
configuration after |Γ|^n * n^h * |Q| steps together with the semantic halting equivalence, not a
separately costed single-bit halting test. Finally, for a machine whose rounds of τ steps realize
P : BitString m → BitString m, round_lower_bound_of_hard and round_bounds_of_hard transfer
any circuit lower bound for P^[T] to the (τ * T)-th step of M via an explicit output-wire
projection tape : Fin m → Fin w satisfying ∀ x, e (M.init x) ∘ tape = x.
Main definitions #
Cslib.Circuits.Boolean.Iteration.InPlace.Move: clamped head moves (left,stay,right).Cslib.Circuits.Boolean.Iteration.InPlace.Machine: an in-place multi-head machine.Cslib.Circuits.Boolean.Iteration.InPlace.Config: machine configuration(w, p, q).Cslib.Circuits.Boolean.Iteration.InPlace.reach: configurations reachable from initial inputs.
Main results #
Cslib.Circuits.Boolean.Iteration.InPlace.reach_card_le_configs,Cslib.Circuits.Boolean.Iteration.InPlace.reach_card_le_time,Cslib.Circuits.Boolean.Iteration.InPlace.reach_card_le_round: reachable configuration bounds.Cslib.Circuits.Boolean.Iteration.InPlace.iterate_card_halting: afterFintype.card (Config Q Γ n h)steps under absorbing halting states, the configuration is halting iff the run ever halts, and equals the halting configuration when it does.Cslib.Circuits.Boolean.Iteration.InPlace.inplace_fixed_power_optimized,Cslib.Circuits.Boolean.Iteration.InPlace.inplace_configs_optimized,Cslib.Circuits.Boolean.Iteration.InPlace.inplace_time_optimized,Cslib.Circuits.Boolean.Iteration.InPlace.inplace_halting: square-root circuit bounds for in-place machines.Cslib.Circuits.Boolean.Iteration.InPlace.round_lower_bound_of_hard,Cslib.Circuits.Boolean.Iteration.InPlace.round_bounds_of_hard: transfer of round lower bounds and matching reachable-state upper bounds.
References #
- Adapted from lean/Proofs/InPlace.lean in S. Schlesinger, Square-root circuit bounds for iterated functions.
An in-place machine with h heads. The transition reads the state, the symbols under the
heads, and for each head whether it is on the first and on the last cell. It returns the new
state, a symbol to write under each head, and a move for each head.
The transition function returning the next state, written symbols, and head moves.
- start : Q
The initial control state.
- halting : Q → Prop
The halting predicate on control states.
- embed : Bool → Γ
The input map from
{0, 1}intoΓ.
Instances For
Reachable configurations are covered by the first B steps from every input.
Under a halting-time bound t, at most 2 ^ n * (t + 1) configurations are reachable.
Running τ * m steps of a machine with rounds of length τ runs m rounds.
A machine that returns to an initial configuration every τ steps reaches at most
2 ^ n * τ configurations.
Under absorbing halting states, the configuration after |Γ|^n * n^h * |Q| steps is halting
if and only if the run ever halts, and equals any halting configuration reached along the run.
The integer budget is monotone in the storage count.
The real budget is monotone in the storage count.
Every fixed power on the initial configurations, with any upper bound R on the number of
reachable configurations in the storage term. The initial-encoding circuit ι is charged.
The square-root form, with any upper bound R on the number of reachable configurations.
The alphabet bound: the storage term is the number of configurations.
The time bound: under absorbing halting states and a halting time t, the storage term is
2 ^ n * (t + 1).
Halting, the halting state, and the final configuration of a machine that need not halt:
one circuit returns the encoding of the configuration after |Γ|^n * n^h * |Q| steps. It is a
halting configuration exactly when the run halts, and it is then the final configuration.
A machine whose rounds of τ steps apply a map P : BitString m → BitString m, and whose
encoding exposes the input word of an initial configuration as a projection, inherits any circuit
lower bound for P^[T]: if every circuit computing P^[T] has size strictly greater than q,
then every circuit computing the (τ * T)-th step from M.init has size strictly greater than
q.
Both sides for a round machine: any circuit lower bound q for P^[T] transfers to the
(τ * T)-th step of M, while every step T' has a circuit within the reachable-set upper bound
2 ^ m * τ, given an encoded step circuit.