Native code for circuit families on disjoint inputs #
parallelFamilyCode n m codes runs an arbitrary list of n-input, m-output circuit codes on
consecutive disjoint input blocks and concatenates their output blocks. The fold mirrors
Circuit.parallelFamily: it retains each member's internal sharing and never compiles a truth
table.
Main definitions #
Cslib.Circuits.Boolean.parallelFamilyCode: raw code for a list of disjoint-input circuits.
Main results #
Cslib.Circuits.Boolean.parallelFamilyCode_code: exact agreement withCircuit.parallelFamilyfor every finite family.Cslib.Circuits.Boolean.computableInPolyTime_parallelFamilyCodeStep: polynomial-time generation of the fold step used by the compiler.
These code-composition results are original infrastructure.
theorem Cslib.Circuits.Boolean.computableInPolyTime_parallelFamilyCodeStep :
Turing.MultiTapeTM.ComputableInPolyTime
(fun (p : ((ℕ × ℕ) × ℕ × List (Op × List ℕ) × List ℕ) × List (Op × List ℕ) × List ℕ) =>
parallelFamilyCodeStep p.1.1 p.1.2 p.2)
(Turing.MultiTapeTM.encPair
(Turing.MultiTapeTM.encPair (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary)
(Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary encCode))
encCode)
(Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary encCode)
The compiler's single extension step is polynomial-time computable under the fold encoding.
theorem Cslib.Circuits.Boolean.foldl_parallelFamilyCodeStep_code {k n m : ℕ} (cs : Fin k → Circuit signature n m) :
Folding the shared extension step over a typed family records its length and produces exactly the typed parallel-family code.
theorem Cslib.Circuits.Boolean.parallelFamilyCode_code {k n m : ℕ} (cs : Fin k → Circuit signature n m) :
parallelFamilyCode n m (List.ofFn fun (j : Fin k) => (cs j).code) = (Circuit.parallelFamily cs).code
Compiling the codes of a typed finite family gives exactly the code of its disjoint-input parallel composition, including the empty family.