Pairing binary strings #
This file defines the low-level self-delimiting pairing codec used by machine inputs throughout Complexitylib. It deliberately has no dependency on the machine or complexity-class layers, so parsers and encoders can reuse it without introducing an import cycle.
Encode a pair of binary strings as a single binary string.
Each bit of x is doubled (false ↦ [false, false], true ↦ [true, true]),
followed by the separator [false, true], followed by y verbatim.
This encoding is injective and computable in linear time.
Equations
- Complexity.pair x y = Complexity.delimit x ++ y