Polynomial-time operations on layered Boolean circuits #
Node tags and binary wire indices are read from their actual encoding. Lookups use the binary index calculus, which bounds an index before converting it to unary. Invalid references retain the specified fallback without running for time proportional to the numerical index.
Main results #
Cslib.Circuits.Boolean.Layered.computableInPolyTime_nodeCode: read a node's code.Cslib.Circuits.Boolean.Layered.computableInPolyTime_nodeConst,computableInPolyTime_nodeCopy,computableInPolyTime_nodeNand: construct nodes.Cslib.Circuits.Boolean.Layered.computableInPolyTime_nodeEval: evaluate one node.Cslib.Circuits.Boolean.Layered.computableInPolyTime_evalLayer: evaluate one layer.Cslib.Circuits.Boolean.Layered.computableInPolyTime_select: select ordered outputs.Cslib.Circuits.Boolean.Layered.computableInPolyTime_outputWidth: compute the final row width in unary, retaining the input width for an empty schedule.
Read the two tag bits and two binary wire indices without changing the encoding.
Construct a constant node.
Construct a copy node, preserving the binary wire index.
Construct a NAND node, preserving both binary wire indices.
Node evaluation is polynomial in the encoded input, including invalid binary wire indices.
Evaluate a computed layer, preserving the raw bit-string output encoding.
Free output selection is polynomial even for malformed binary indices.
Read the last layer's length, or retain the computed input width for an empty schedule.