Binary numbers on enumerated positions #
What an encoder of binary numbers needs, once and for all. An encoded
universe lays its bit positions out as the image of an enumeration
e : Fin N → A that is injective, hits exactly the positions, and reflects
the order (DescriptiveComplexity.BinEnum). Then
- the rank of a position is its index (
DescriptiveComplexity.BinEnum.bitRank_eq); - the decoded number is the plain sum of place values
(
DescriptiveComplexity.BinEnum.binNum_eq_sum); - a set of positions carrying the
Nat.testBitdigits of a number that fits decodes to that number (DescriptiveComplexity.BinEnum.binNum_eq_of_testBit).
The last statement is the one an encoding's faithfulness proof uses: the
encoder writes w.testBit p at the position of index p, and the abstract
semantics reads w back. Whatever else the universe holds – items, vertices,
facts – plays no part.
The positions of a universe, enumerated in increasing order: the enumeration is injective, its range is the set of positions, and it reflects the order.
- injective : Function.Injective e
Distinct indices are distinct positions.
The positions are exactly the enumerated elements.
The order of the positions is the order of their indices.
Instances For
Dependency graph
The rank of a position is its index.
Dependency graph
The decoded number is the sum of the place values of its bits.
Dependency graph
The decoding. A set of positions carrying the binary digits of a number
that fits in N positions decodes to that number.
Dependency graph
On the universe Fin N, ordered as usual and with every element a
position, the Nat.testBit digits of a number below 2 ^ N decode to it.