Documentation

Complexitylib.Circuits.BarringtonCodeGenerator

Bitstring-level Barrington code generator #

barringtonCompileCode is the exact total function targeted by the remaining uniformity proof. On a canonical postfix formula code it emits the canonical code of barringtonCompile formula barringtonTargetBase; malformed inputs map to the empty string.

This module proves the complete extensional specification independently of a machine implementation: output decoding recovers the executable program, its evaluation matches the source formula, and its instruction count is at most 4 ^ depth. The next layer must realize this particular function in FL.

Main results #

theorem Complexity.formula_variable_le_code_length (formula : BoolFormula) (index : ℕ) (hindex : index ∈ formula.vars) :
index ≤ (FormulaCode.encode formula).length

Every variable referenced by a formula is at most its canonical code length.

@[simp]

On canonical formula input, the generator emits exactly the canonical encoding of the executable Barrington compiler's result.

Decoding generated code recovers the executable compiler's program.

Exact generated-code length on canonical formula input.

Serialized generated output is bounded by the Barrington instruction bound times the source-code length needed for each terminated-unary variable field.

Bitstring-level constructive Barrington theorem. On the canonical code of a formula, the generated code decodes to the compiled program, which has exact formula semantics through the fixed target barringtonTargetBase (stated here only to be nonidentity; it is a 5-cycle by barringtonTargetBase_spec) and instruction count at most 4 ^ depth.