Native Turing-machine certificates for explicit-stack recursion #
The pure explicit-stack depth-first recursion scheme (Cslib.Algorithms.StackRecursion.Scheme,
Invariant, State, Scheme.Loop, Scheme.Eval, Scheme.step, Scheme.run) is defined
without any machine model in CslibFrontier.Algorithms.Recursion.StackScheme.
The native certificate (Scheme.certificate). The leaf step is an arbitrary native
certificate; the other components are polynomial-time (Scheme.PolyTime). One fixed machine runs
the stack machine for a natively computed number fuel a of steps (NativeCertificate.iterate)
and returns the register. When 2 * n - 1 ≤ fuel a the result is y (Scheme.run_eq_some). If
every node, frame and value on the derivation has encoded length at most F and every leaf is
evaluated within time TL and space SL, the time is at most fuel a + 1 times
K ((h + 1) (F + 1)) ^ K + TL and the workspace at most K ((h + 1) (F + 1)) ^ K + SL, up to
the cost of computing the fuel and the root and of the binary clock, for one constant K of the
scheme (Scheme.certificate_le). Only the stack is kept, so the workspace grows with the depth,
not with the number of nodes. The number of nodes of a recursion tree is bounded in
CslibFrontier/Foundations/Data/Nat/RecursionTree.lean.
This is the depth-first evaluation of the recursion in the proof of Theorem D.1 of [OAI26k] (Appendix D.4.7, p. 64), which keeps one sum over mode tuples and one product over groups per stack level. The scheme is generic: the recursion of Appendix D.4 is one instance, with its leaves evaluated by direct summation.
Main definitions #
Cslib.Algorithms.StackRecursion.Scheme.encState: list-and-option encoding of stack states.Cslib.Algorithms.StackRecursion.Scheme.PolyTime: polynomial-time non-leaf components.Cslib.Algorithms.StackRecursion.Scheme.stepCertificate,Cslib.Algorithms.StackRecursion.Scheme.leafCost: one-step native certificate and pending-leaf cost.Cslib.Algorithms.StackRecursion.Scheme.certificate: one native machine for the clocked run.
Main results #
Cslib.Algorithms.StackRecursion.Scheme.exists_stepCertificate_le: one step costs a polynomial in the state length plus the leaf certificate at a pending leaf.Cslib.Algorithms.StackRecursion.Scheme.length_encState_le: encoded length bound on good states.Cslib.Algorithms.StackRecursion.Scheme.certificate_le: timefuel + 1times a polynomial in(h + 1) * (F + 1)plus the leaf time, and workspace a polynomial plus the leaf space.
References #
- OpenAI, The Exponential Time Hypothesis is False, Appendix D.4.7 (p. 64).
The native machine #
The polynomial-time components of a scheme: everything but the leaf step.
The leaf test.
- start : Turing.MultiTapeTM.ComputableInPolyTime R.start encX encA
The initial accumulator.
- next : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : X × A) => R.next p.1 p.2) (Turing.MultiTapeTM.encPair encX encA) (Turing.MultiTapeTM.encOption encX)
Child generation.
- absorb : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : (X × A) × Y) => R.absorb p.1.1 p.1.2 p.2) (Turing.MultiTapeTM.encPair (Turing.MultiTapeTM.encPair encX encA) encY) encA
Absorbing a child's value.
- finish : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : X × A) => R.finish p.1 p.2) (Turing.MultiTapeTM.encPair encX encA) encY
The value of a call.
One step of the machine: the leaf certificate on a pending leaf, and a polynomial-time step otherwise.
The cost of one step: a polynomial in the state length, plus the leaf certificate at a pending leaf.
The native machine for the clocked run: one fixed machine, from native certificates for the fuel and the root.
A good state is at most 5 (H + 1) (F + 1) long when the nodes, frames and values it holds
are at most F long.
The resources of the native machine. There is one constant K such that, for any fuel
and root certificates, if the root has a derivation with N nodes and at most H open calls
whose nodes, frames and values are at most F long, and whose leaves are evaluated by the leaf
certificate within time TL and space SL, then the time is at most the cost of the fuel and the
root plus fuel + 1 times K ((H + 1) (F + 1)) ^ K + TL (and the cost of the binary clock), and
the workspace is at most the cost of the fuel and the root plus K ((H + 1) (F + 1)) ^ K + SL.
The bounds hold for any fuel; with 2 * N - 1 ≤ fuel the result is the value
(run_eq_some).