Documentation

Complexity.Computability.Circuit.Boolean.Layered.Compile.PolyTime

Polynomial-time compilation into consecutive layers #

The certificates follow the actual raw compiler: compute the depth table and selected-output maximum, then generate both microlevels at each depth. The input count and internal enumeration counters are unary; source wire references and emitted node references are binary. Every layer, node, delimiter and output selector is included in the output encoding.

The construction is uniform in the input count, gate count and number of designated outputs. It is polynomial-time on all raw code, without a well-formedness or promised-depth hypothesis.

Main results #

References #

Decide whether a unary-numbered wire is already available, then emit its binary copy index.

Prepare the first intermediate, retaining binary source references.

Prepare the second intermediate, retaining the binary source reference.

theorem Cslib.Circuits.Boolean.Layered.computableInPolyTime_finish {α : Type} {input : α ↪ List Bool} {inputCount gateCount gateIndex : α → ℕ} {op : α → Op} (hn : Turing.MultiTapeTM.ComputableInPolyTime inputCount input Turing.MultiTapeTM.encUnary) (hg : Turing.MultiTapeTM.ComputableInPolyTime gateCount input Turing.MultiTapeTM.encUnary) (hj : Turing.MultiTapeTM.ComputableInPolyTime gateIndex input Turing.MultiTapeTM.encUnary) (hop : Turing.MultiTapeTM.ComputableInPolyTime op input encOp) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => finish (inputCount a) (gateCount a) (gateIndex a) (op a)) input encNode

Finish a gate, computing scratch positions in unary before emitting binary indices.

Generate a preparation layer, charging the complete framed node list.

Generate a finishing layer, including copies and all cleared scratch slots.

Generate both microlevels at every computed unary depth, charging their full encoding.

theorem Cslib.Circuits.Boolean.Layered.computableInPolyTime_compile {α : Type} {input : α ↪ List Bool} {inputCount : α → ℕ} {code : α → List (Op × List ℕ) × List ℕ} (hn : Turing.MultiTapeTM.ComputableInPolyTime inputCount input Turing.MultiTapeTM.encUnary) (hcode : Turing.MultiTapeTM.ComputableInPolyTime code input encCode) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => compile (inputCount a) (code a)) input encCompiled

Compile arbitrary raw code in native polynomial time. The input count is unary; all source references and output selectors are binary. Depth computation and the entire emitted schedule are included, with no validity premise or fixed input/output arity.