Combining circuit codes on shared inputs #
appendCode n c d runs both codes on the same n inputs, keeping the outputs of c before
those of d. It shifts the gate references of d past the gates of c, while preserving its
input references. On codes of circuits, the result is the code of Circuit.append.
appendCodes combines any list of blocks by repeated append; each block is relocated by the
number of preceding gates. bundleCode uses a fixed block size and agrees with appendCodes
when its blocks have that size. All three constructors are computable in polynomial time
with binary layout parameters.
compCode n d c instead feeds c's output wires to d's inputs. Its polynomial-time constructor
performs binary-indexed lookup and gate relocation, and agrees exactly with Circuit.comp.
Main definitions #
Cslib.Circuits.Program.appendWireCode: wire numbers under program continuation.Cslib.Circuits.Boolean.appendCode: combine raw codes on shared inputs.Cslib.Circuits.Boolean.appendCodes: combine raw blocks of varying sizes on shared inputs.Cslib.Circuits.Boolean.bundleCode: combine equal-sized raw blocks on shared inputs.Cslib.Circuits.Boolean.compCode: compose raw circuit codes through their output wires.
Main results #
Cslib.Circuits.Program.code_append: code of program continuation.Cslib.Circuits.Boolean.appendCode_code: agreement with typed circuit append.Cslib.Circuits.Boolean.length_appendCode: additive gate count.Cslib.Circuits.Boolean.computableInPolyTime_appendCode: constructor efficiency.Cslib.Circuits.Boolean.appendCodes_code: agreement with arbitrary typed output families.Cslib.Circuits.Boolean.computableInPolyTime_appendCodes: varying-size constructor efficiency, including arbitrary binary wire indices.Cslib.Circuits.Boolean.bundleCode_eq_foldl_appendCode: bundling agrees with repeated append.Cslib.Circuits.Boolean.computableInPolyTime_bundleCode: bundling efficiency.Cslib.Circuits.Boolean.exists_circuit_bundleCode: raw bundles realize typed output families.Cslib.Circuits.Boolean.compCode_code: agreement with typed sequential composition.Cslib.Circuits.Boolean.computableInPolyTime_compCode: sequential constructor efficiency.
References #
Numbering a continued wire agrees with the raw wire-number map.
Retain an input wire, or shift a gate wire past offset preceding gates.
Instances For
The outputs of combined codes are the two output lists in order, on every input.
Shifting wire numbers is polynomial-time with all quantities encoded in binary.
Relocating a circuit-code block is polynomial-time with binary offsets.
Combining circuit codes is polynomial-time, including binary input and wire counts.
Combining arbitrary raw blocks is polynomial-time in their complete encodings. Input and wire numbers are binary; no uniform block-size or well-formedness premise is needed.
Combining single-output circuit codes agrees exactly with Circuit.pi, with no restriction
on the gate counts of its components.
Bundling raw blocks is polynomial-time in their encodings and binary layout parameters.
Resolve a composed wire in polynomial time, including binary output lookup and offsets.
Construct sequential circuit codes in polynomial time. All wire indices and input counts are binary; list lengths, input lookup, gate relocation and the whole output code are charged.