Encodings of whole circuit families #
This module adds the length-zero wrapper around the positive-arity circuit codec. A leading tag distinguishes the explicit empty-input answer from an ordinary encoded circuit.
Encode the member of an AND/OR circuit family at input length n.
The zero-length member is the tag false followed by its explicit answer.
Positive lengths use the tag true followed by the ordinary circuit code.
Equations
Instances For
The length-zero member encodes as the false tag followed by the explicit answer bit.
A positive-length member encodes as the true tag followed by its circuit's code.
Evaluate a tagged family code on a variable-length input.
The zero tag is accepted only for the empty input and must carry exactly one answer bit. The positive tag is accepted only for a nonempty input and delegates to the exact-arity circuit evaluator.
Equations
- Complexity.CircuitCode.evalFamilyCode [false, answer] input = if input.isEmpty = true then some answer else none
- Complexity.CircuitCode.evalFamilyCode (true :: circuitCode) input = if input.isEmpty = true then none else Complexity.CircuitCode.evalCode input.length circuitCode input
- Complexity.CircuitCode.evalFamilyCode code input = if input.isEmpty = true then none else none
Instances For
On a nonempty input, successful evaluation is exactly a positive tag carrying a canonical, topologically well-formed circuit code.
Tagged family encoding handles the explicit empty-input bit and agrees with the typed circuit at every positive input length.
Machine-facing list form of evalFamilyCode_encodeAt: selecting the member
at the supplied input's length agrees with CircuitFamily.evalList.
The length-zero tagged code has exactly two bits: the tag and the answer.
A positive-length tagged code is one bit (the tag) longer than the underlying circuit code.