Constant-frame two-stage catalytic vertex equality #
In CslibFrontier.Computability.Catalytic.Comparison, eqTest compares two ℓ-digit vectors over
ZMod (2 ^ k) in eight single-endpoint visits while restoring a borrowed register and accumulator,
provided the caller retains the initial k-bit accumulator across the forward call (or starts it at
zero). When n-bit identifiers (n = O(B)) are chunked into q₁ ≈ log₂ B-bit digits, that
accumulator has k₁ = Θ(log B) bits; keeping k₁ clean local bits in every suspended recursive
frame is too large at constant slack d = O(1).
In Lemma 9.9 and Lemma 11.9 of [OAI26e], short log₂ B-bit keys are instead compared
with only constant local frame data across four single-endpoint excursions by toggling a shared
B-bit table (Cslib.Catalytic.keyTest over ZMod 2). Any excursion that returns to the caller
and restores the shared catalytic memory, with return value independent of the incoming catalytic
contents, composes across repeated and nested visits.
This module combines two deterministic sum-of-squares stages (addSqDist) with keyTest into an
exact, deterministic, salt-free 64-excursion equality procedure for n-bit natural identifiers:
- Stage 1 (
4visits per signed call). Splitx, y < 2 ^ nintoℓ₁ = ⌈n / q₁⌉chunks ofq₁ = max 1 ⌊log₂ B⌋bits (natChunkVec).addSqDist (±1)shifts a sharedk₁-bit accumulatorz₁overZMod (2 ^ k₁)(k₁ = 2 · q₁ + ⌊log₂ ℓ₁⌋ + 1) by± ∑ᵢ (xᵢ - yᵢ)²while restoring its borrowedℓ₁-word register. Becauseℓ₁ · (2 ^ q₁ - 1)² < 2 ^ k₁, the shifted valuez₁'equalsz₁iffx = y. - Stage 2 (
16visits per signed call). AlternateStage 1 (+1)andStage 1 (-1)four times soz₁alternatesz₁, z₁', z₁, z₁'without storingz₁locally. Feed those fourk₁-bit values, split intoℓ₂ = ⌈k₁ / q₂⌉chunks ofq₂ = max 1 ⌊q₁ / 2⌋bits, into an inneraddSqDist (±1)overZMod (2 ^ k₂). Whenn ≤ C_N · B,ℓ₂ ≤ ⌊log₂ (C_N + 1)⌋ + 11is bounded by a constant independent ofB, sok₂ ≤ 2 · q₂ + O(1) ≤ log₂ B + O(1)and2 ^ k₂ = O(B). - Stage 3 (
64visits total). AlternateStage 2 (+1)andStage 2 (-1)four times so the inner accumulator alternatesz₂, z₂', z₂, z₂', and applykeyTest 1on a shared tableW : ZMod (2 ^ k₂) → ZMod 2, adding1into a single localZMod 2bit iffx = yand restoring all three catalytic components(T₁, T₂, W).
Across all 64 excursions the caller retains only the phase in Fin 64 and one result bit in
ZMod 2 (7 local bits total, card_vertexLocalFrame), while the shared restored catalytic state
VertexCatState B n occupies vertexCatBits B n ≤ vertexCatLinearConst C_N * (B + 1) bits
whenever n ≤ C_N * B (card_vertexCatState, vertexCatBits_le).
Like Catalytic.Comparison, this module formalizes the stepwise single-endpoint excursion contract,
nested-excursion restoration invariance, and exact state-cardinality bit budgets; it is not a native
Turing-machine space certificate.
Main definitions #
Cslib.Catalytic.ExcursionProc: a deterministicm-visit single-endpoint comparison procedure, withrun,runExcursions, and combinatorsmapState,liftFst,precomp,append,liftAlternating.Cslib.Catalytic.sqDistProc,Cslib.Catalytic.keyTestProc:addSqDistandkeyTestpackaged as4-visitExcursionProcs.Cslib.Catalytic.natChunkVec: fixed-length base-2 ^ qchunk extraction viaCslib.Radix.digit.Cslib.Catalytic.outerChunkBits,Cslib.Catalytic.outerDigits,Cslib.Catalytic.outerAccBits,Cslib.Catalytic.innerChunkBits,Cslib.Catalytic.innerDigits,Cslib.Catalytic.innerAccBits: explicit bit-width parameters for the two-stage reduction.Cslib.Catalytic.OuterRegState,Cslib.Catalytic.InnerRegState,Cslib.Catalytic.KeyTableState: the Stage-1 and Stage-2 registers with their accumulators, and the Stage-3ZMod 2key table.Cslib.Catalytic.VertexCatState,Cslib.Catalytic.VertexLocalFrame: the shared catalytic memory and the7-bit local frameFin 64 × ZMod 2.Cslib.Catalytic.stageOneSqDistProc,Cslib.Catalytic.twoStageSqDistProc: the4-visit Stage-1 and16-visit Stage-2 sum-of-squares procedures.Cslib.Catalytic.vertexStateEquiv: the reassociation separating the shared catalyst from the local result bit.Cslib.Catalytic.vertexEqProc,Cslib.Catalytic.catalyticVertexEq: the64-excursion restoring equality procedure and its Boolean wrapper.Cslib.Catalytic.vertexCatBits,Cslib.Catalytic.vertexCatLinearConst: exact catalytic bit count and explicit linear constant forn ≤ C_N * B.
Main results #
Cslib.Catalytic.ExcursionProc.runExcursions_eq_run: excursion invariance for restoring, catalyst-independent endpoint callbacks (allowing nested restoring calls).Cslib.Catalytic.ExcursionProc.run_liftAlternating: four-block forward/inverse lifting executes an alternating4-visit outer procedure on the unshifted and shifted readouts while restoring the inner state.Cslib.Catalytic.run_vertexEqProc_chunk,Cslib.Catalytic.run_vertexEqProc,Cslib.Catalytic.runExcursions_vertexEqProc,Cslib.Catalytic.catalyticVertexEq_eq: unconditional restoration for allx, y : ℕand exact equality detection for allx, y < 2 ^ nunder arbitrary initial catalytic contents.Cslib.Catalytic.card_vertexLocalFrame:Fintype.card VertexLocalFrame = 2 ^ 7.Cslib.Catalytic.card_vertexCatState:Fintype.card (VertexCatState B n) = 2 ^ vertexCatBits B n.Cslib.Catalytic.innerDigits_le:n ≤ C_N * B → innerDigits B n ≤ Nat.log 2 (C_N + 1) + 11.Cslib.Catalytic.vertexCatBits_le:n ≤ C_N * B → vertexCatBits B n ≤ vertexCatLinearConst C_N * (B + 1).
References #
- H. Buhrman, R. Cleve, M. Koucký, B. Loff and F. Speelman, Computing with a full memory: catalytic space
- OpenAI, Exact Derandomization of Logarithmic Space: L = RL = BPL,
Section 9.6, Lemma 9.9 (
lem:fp-catalytic) and Section 11.4, Lemma 11.9 (lem:ctrl-equality) for the excursion restoration principle andZMod 2key test; the two-stage deterministicaddSqDist+keyTestcomposition and bit-budget bounds here are original to cslib-frontier.
Stepwise single-endpoint excursion procedures #
A deterministic m-visit single-endpoint comparison procedure on values of type α with state
S. At phase p : Fin m, side p = false visits the left endpoint x and side p = true visits
the right endpoint y; step p v s updates the state from the single visited value v alone.
Endpoint selector at phase
p:falsevisitsx,truevisitsy.- step : Fin m → α → S → S
State update at phase
pgiven the visited endpoint value.
Direct execution on fixed endpoints x and y across phases 0, …, m - 1.
Execution through an endpoint-excursion callback visit : Bool → Cat → α × Cat sharing
catalytic state Cat while holding only (p : Fin m, st.2 : Loc) in the caller's local frame
across each excursion.
Excursion invariance (Lemma 9.9 nested-excursion contract): if visit false returns x,
visit true returns y, and both restore any incoming catalytic state cat (even when visit
internally invokes nested restoring procedures on cat), then runExcursions equals run x y.
Transport an excursion procedure along an equivalence of states e : S₁ ≃ S₂.
Lift a procedure on S to S × Θ, acting on the first component and leaving Θ untouched.
Precompose a pure state transformation f : S → S onto phase 0 of a nonempty procedure,
adding no extra endpoint visits.
Concatenate an m₁-visit procedure followed by an m₂-visit procedure.
Lift a 4-visit alternating procedure Q : ExcursionProc 4 β Θ (visiting a, b, a, b) along
a forward procedure P_fwd and its inverse P_inv on S, reading a = π s in the unshifted
state and b = π (P_fwd.run x y s) in the shifted state across four blocks.
Four-block forward/inverse lifting: when P_inv undoes P_fwd on (x, y) and Q
alternates ![false, true, false, true], liftAlternating restores s and executes Q on the
unshifted readout π s and shifted readout π (P_fwd.run x y s).
addSqDist and keyTest as 4-visit excursion procedures #
Cslib.Catalytic.addSqDist packaged as a 4-visit single-endpoint ExcursionProc, encoding
each visited endpoint by enc : α → Fin ℓ → R.
Cslib.Catalytic.keyTest packaged as a 4-visit single-endpoint ExcursionProc.
Fixed-length binary-chunk encoding of natural numbers #
Extract ℓ base-2 ^ q chunks of a natural number x, least-significant chunk first.
Two-stage bit-width parameterization and 64-excursion vertex equality #
Number of outer chunks ℓ₁ = ⌈n / q₁⌉ covering an n-bit identifier.
Bit-width k₁ of the Stage-1 sum-of-squares accumulator over ZMod (2 ^ k₁).
Number of inner chunks ℓ₂ = ⌈k₁ / q₂⌉ covering the k₁-bit Stage-1 accumulator.
Bit-width k₂ of the Stage-2 sum-of-squares accumulator (and log₂ of the Stage-3 table).
Stage-1 catalytic register and accumulator state ((ℓ₁ + 1) · k₁ bits).
Stage-2 catalytic register and accumulator state ((ℓ₂ + 1) · k₂ bits).
Stage-3 catalytic ZMod 2 key table (2 ^ k₂ bits).
Full shared catalytic memory (T₁, T₂, W) restored by vertexEqProc and
catalyticVertexEq.
Stage-1 4-visit procedure adding c₁ times the outer chunk squared distance to T₁.2.
Stage-2 16-visit procedure lifting the inner chunk squared distance along stageOneSqDistProc
and its inverse.
State reassociation separating the shared catalyst VertexCatState B n from the 1-bit local
accumulator ZMod 2.
The 64-excursion catalytic vertex-equality procedure. On endpoints x, y < 2 ^ n, it
restores any incoming catalytic state cat : VertexCatState B n and adds 1 : ZMod 2 into the
local result bit iff x = y.
Boolean catalytic vertex equality via single-endpoint excursions. Initializes the local
result bit to 0 : ZMod 2, runs the 64 excursions through visit, and returns the equality
decision together with the restored catalytic state.
Exactness and exact restoration #
Unconditional restoration and chunk-equality characterization of vertexEqProc: for all
B n x y : ℕ (without any range bound on x or y), vertexEqProc restores cat and adds 1
to s₀ iff x and y agree on their first outerDigits B n base-2 ^ outerChunkBits B
chunks.
Direct correctness and restoration of vertexEqProc: for all B n : ℕ, all x, y < 2 ^ n,
and any initial catalytic contents cat and local bit s₀ : ZMod 2, vertexEqProc restores cat
and adds if x = y then 1 else 0 to s₀.
Excursion correctness and restoration of vertexEqProc: under any restoring,
catalyst-independent excursion callback visit for x, y < 2 ^ n, runExcursions restores cat
and adds if x = y then 1 else 0 to s₀.
Exactness and restoration of catalyticVertexEq: for all B n : ℕ, all x, y < 2 ^ n,
every restoring catalyst-independent callback visit, and arbitrary initial catalytic state cat₀,
catalyticVertexEq returns (decide (x = y), cat₀). In particular, it satisfies the same
restoring catalyst-independent contract for outer callers.
Explicit local-frame and catalytic bit-budget accounting #
Total bit count of the shared catalytic state VertexCatState B n.
Explicit closed-form linear coefficient bounding vertexCatBits B n by
vertexCatLinearConst C_N * (B + 1) whenever n ≤ C_N * B.
Constant local frame (7 bits). The caller's local frame across all 64 excursions has
cardinality 2 ^ 7, independent of B and n.
Exact catalytic bit count. The shared catalytic state VertexCatState B n has cardinality
2 ^ vertexCatBits B n.
Constant Stage-2 chunk count. When n ≤ C_N * B, the number of inner chunks
innerDigits B n is bounded by Nat.log 2 (C_N + 1) + 11, independently of B.
O(B) catalytic bit budget. Whenever n ≤ C_N * B, the total number of shared catalytic
bits satisfies vertexCatBits B n ≤ vertexCatLinearConst C_N * (B + 1).