Documentation

Complexity.Computability.Machines.Turing.MultiTape.Complexity.LogSpace.InductiveCounting.Routines

Native controller routines for inductive counting #

The certificates charge the full encoded arguments and apply to every state, including malformed register contents. Width is supplied in unary: writing the binary register bound 2 ^ width then takes only linear space in that argument.

Unary conversion and fixed-list dispatch adapt the corresponding native tidy-calculus proofs.

Main results #

References #

Converting a unary counter to binary needs only linear space.

Binary powers of two from unary exponents, without an exponential unary intermediate.

Reading the finite instruction label as its fixed natural code.

Reading the predicate flag.

Reading the final-scan flag.

A fixed register projection preserves the common budget.

theorem Turing.InductiveCounting.phaseCases_budget {α : Type} {enc : α ↪ List Bool} {S : α → ℕ} {β : Type} {encB : β ↪ List Bool} {s : α → Cslib.InductiveCounting.State} (hs : MultiTapeTM.ComputableTidilyInSpace s enc encState S) (F : Cslib.InductiveCounting.Phase → α → β) (hF : ∀ (p : Cslib.InductiveCounting.Phase), MultiTapeTM.ComputableTidilyInSpace (F p) enc encB S) (hin : MultiTapeTM.BigOLe (fun (a : α) => (enc a).length) S) :
MultiTapeTM.ComputableTidilyInSpace (fun (a : α) => F (s a).phase a) enc encB S

Case distinction on the finite phase, retaining an arbitrary common budget.

theorem Turing.InductiveCounting.state_budget {α : Type} {enc : α ↪ List Bool} {S : α → ℕ} {s : α → Cslib.InductiveCounting.State} (hp : MultiTapeTM.ComputableTidilyInSpace (fun (a : α) => phaseCode (s a).phase) enc MultiTapeTM.encNat S) (hround : MultiTapeTM.ComputableTidilyInSpace (fun (a : α) => (s a).round) enc MultiTapeTM.encNat S) (hcount : MultiTapeTM.ComputableTidilyInSpace (fun (a : α) => (s a).count) enc MultiTapeTM.encNat S) (htarget : MultiTapeTM.ComputableTidilyInSpace (fun (a : α) => (s a).target) enc MultiTapeTM.encNat S) (hnext : MultiTapeTM.ComputableTidilyInSpace (fun (a : α) => (s a).nextCount) enc MultiTapeTM.encNat S) (hcandidate : MultiTapeTM.ComputableTidilyInSpace (fun (a : α) => (s a).candidate) enc MultiTapeTM.encNat S) (hselected : MultiTapeTM.ComputableTidilyInSpace (fun (a : α) => (s a).selected) enc MultiTapeTM.encNat S) (hremaining : MultiTapeTM.ComputableTidilyInSpace (fun (a : α) => (s a).remaining) enc MultiTapeTM.encNat S) (hcurrent : MultiTapeTM.ComputableTidilyInSpace (fun (a : α) => (s a).current) enc MultiTapeTM.encNat S) (hguess : MultiTapeTM.ComputableTidilyInSpace (fun (a : α) => (s a).guess) enc MultiTapeTM.encNat S) (hbits : MultiTapeTM.ComputableTidilyInSpace (fun (a : α) => (s a).bits) enc MultiTapeTM.encNat S) (hhit : MultiTapeTM.ComputableTidilyInSpace (fun (a : α) => (s a).hit) enc MultiTapeTM.encBool S) (hfinal : MultiTapeTM.ComputableTidilyInSpace (fun (a : α) => (s a).finalScan) enc MultiTapeTM.encBool S) (hin : MultiTapeTM.BigOLe (fun (a : α) => (enc a).length) S) :

Constructing a state from its finite label, ten binary registers and two flags.

Reading the round register preserves the common budget.

Reading the count register preserves the common budget.

Reading the target register preserves the common budget.

Reading the nextCount register preserves the common budget.

Reading the candidate register preserves the common budget.

Reading the selected register preserves the common budget.

Reading the remaining register preserves the common budget.

Reading the current register preserves the common budget.

Reading the guess register preserves the common budget.

Reading the bits register preserves the common budget.

Halt detection reads only the finite phase.

Acceptance detection reads only the finite phase.

A unary width can also be used as a binary register in the same budget.

The complete register bound, with unary width, uses linear space on all inputs.

theorem Turing.InductiveCounting.instruction_budget {α : Type} {enc : α ↪ List Bool} {S N width source : α → ℕ} {s : α → Cslib.InductiveCounting.State} {answer choice : α → Bool} (hN : MultiTapeTM.ComputableTidilyInSpace N enc MultiTapeTM.encNat S) (hw : MultiTapeTM.ComputableTidilyInSpace width enc MultiTapeTM.encNat S) (hsource : MultiTapeTM.ComputableTidilyInSpace source enc MultiTapeTM.encNat S) (hs : MultiTapeTM.ComputableTidilyInSpace s enc encState S) (hanswer : MultiTapeTM.ComputableTidilyInSpace answer enc MultiTapeTM.encBool S) (hchoice : MultiTapeTM.ComputableTidilyInSpace choice enc MultiTapeTM.encBool S) (hin : MultiTapeTM.BigOLe (fun (a : α) => (enc a).length) S) :
MultiTapeTM.ComputableTidilyInSpace (fun (a : α) => Cslib.InductiveCounting.instruction (N a) (width a) (source a) (s a) (answer a) (choice a)) enc encState S

A native certificate for the underlying local instruction, with no validity assumption.

The candidate cost is a fixed arithmetic expression in the supplied parameters.

The target cost uses a fixed number of binary arithmetic operations.

The round cost uses a fixed number of binary arithmetic operations.

The full progress measure is computed in the common budget on arbitrary states.

All ten storage checks are executable within the budget, including on malformed states.

theorem Turing.InductiveCounting.advance_budget {α : Type} {enc : α ↪ List Bool} {S N width source : α → ℕ} {s : α → Cslib.InductiveCounting.State} {answer choice : α → Bool} (hN : MultiTapeTM.ComputableTidilyInSpace N enc MultiTapeTM.encNat S) (hw : MultiTapeTM.ComputableTidilyInSpace width enc MultiTapeTM.encUnary S) (hsource : MultiTapeTM.ComputableTidilyInSpace source enc MultiTapeTM.encNat S) (hs : MultiTapeTM.ComputableTidilyInSpace s enc encState S) (hanswer : MultiTapeTM.ComputableTidilyInSpace answer enc MultiTapeTM.encBool S) (hchoice : MultiTapeTM.ComputableTidilyInSpace choice enc MultiTapeTM.encBool S) (hin : MultiTapeTM.BigOLe (fun (a : α) => (enc a).length) S) :
MultiTapeTM.ComputableTidilyInSpace (fun (a : α) => Cslib.InductiveCounting.advance (N a) (width a) (source a) (s a) (answer a) (choice a)) enc encState S

One checked controller step: this certificate includes both the complete storage test and the comparison of the old and new ranks. Width is unary, so the bound remains linear on all arguments, without any register-validity hypothesis.

theorem Turing.InductiveCounting.initial_budget {α : Type} {enc : α ↪ List Bool} {S N source : α → ℕ} (hN : MultiTapeTM.ComputableTidilyInSpace N enc MultiTapeTM.encNat S) (hsource : MultiTapeTM.ComputableTidilyInSpace source enc MultiTapeTM.encNat S) (hin : MultiTapeTM.BigOLe (fun (a : α) => (enc a).length) S) :

Initializing the controller includes its source-range check.

Tagged binary data for one edge or bad-vertex request.

Instances For

    An oracle request stores its tag and at most two binary vertices.

    Instances For

      The explicit request, including the finite-phase and final-scan selection.

      Full routine inputs: N, unary width, source, state, answer and choice.

      Instances For

        An unconditional native linear-space certificate for the complete checked routine.