Atelier des rouesLab FR

Comparing block codes with shared information

2/4 Reusable result, originality uncertain AI-assisted literature assessment · one reading

I present a finite coding bench with round-trip checks and comparisons of headers, ranks, and compressed streams; its counterexamples show that matching symbol counts alone does not predict file size. Cover’s enumerative source encoding already ranks and unranks constrained sequences, including those with empirical Markov properties; Witten, Neal, and Cleary describe practical arithmetic coding. Jiang et al.’s uShuffle preserves k-let counts for sampling, not compression. The useful fragment is comparing costs on declared profiles. Small examples, ideal fraction-based lengths, and an excluded shared dictionary do not establish a useful general-purpose compressor.

Thomas M. Cover, Enumerative source encoding · Ian H. Witten, Radford M. Neal et John G. Cleary, Arithmetic Coding for Data Compression · Minghui Jiang, James Anderson, Joel Gillespie et Martin Mayne, uShuffle: A useful tool for shuffling biological sequences while preserving the k-let counts

How I rate results

I choose between raw and segmented streams. Which format still saves bytes after the selector?

I send one bit followed by the payload and pad the last byte. The decoder knows the word count. I check both modes including 256 short profiles. For weights 4 and 16 alternating every word I select raw and send 129 bytes. For runs of eight I select segmentation and send 99 bytes. The same bit fits into padding or creates a new byte depending on alignment.

I will price transmission of the word count as well. AT.EX21.02 · Try the experiment

Cover

Choosing boundaries in a code

I encode 32 words of 32 bits. What does it cost to switch between raw segments and constant-weight ranks?

I minimize bits over every segment end and admissible mode. I transmit mode and length, then weight for enumerative segments. I decode the stream and check the minimum by enumeration on 64 small profiles. For weights 4 and 16 alternating every word I obtain 129 bytes, against 140 for fixed-weight runs and 128 for raw data. With runs of four I measure 105 versus 104 bytes for the fixed-run format.

I will price a stream-level selector including its header. AT.EX20.02 · Change the inputs.

Cover

Comparing block codes with shared information

Amortize a histogram

At weight 16 one block takes five bytes, while eight take 31 bytes against 32 raw. The first strict saving occurs at seven blocks. I check all 256 eight-bit words and 1,056 stream configurations. Interactive experiment · AT.EX18.02

I return to the question that motivated the wheels. For n symbols from an alphabet of size K, I can transmit the histogram and the circular multiset order. The XI pilot shared n and K outside the stream. I now compare four decodable streams with the same eight-byte header carrying method, alphabet size, word length and payload length.

The same ideal distribution

There are H = C(n+K−1,K−1) histograms and M = n!/∏cᵢ! arrangements of this histogram. Uniform choices at both stages give a word mass of 1/(HM). Starting every symbol count at one and updating it after each observation gives a product of conditional probabilities equal to ∏cᵢ! (K−1)!/(n+K−1)!, exactly 1/(HM). This classical add-one identity makes rounding a measurable distinction between the two codes. Cover · Witten, Neal and Cleary

Experiment and counterexample

I checked all ternary words of lengths zero through six across four formats, 4,372 decodes. For 256 symbols from an alphabet of four, the complete sizes in bytes for packed fixed width, enumerative, adaptive arithmetic and zlib level 9 are 72, 28, 27, 58 on the biased sample. A periodic word gives 72, 74, 74, 23. Shuffling exactly those symbols gives 72, 74, 74, 118. Holding the histogram fixed isolates an ordering effect that the type-class model cannot capture.

The arithmetic implementation uses exact fractions as a size reference. A throughput comparison requires a finite-precision implementation. My next test would charge for training a first-order model on held-out blocks. The reported zlib version is 1.2.13.

Reproduce

After extracting the kit I run python experience.py with Python 3.10 or newer and compare its output with resultats.json.

Control from XII

I also supply the edited Markov-type ranking and unranking routines. The control verifies all identities on 256 binary words. I run python temoin_xii.py and compare with controle-xii.json.

My XIII control

I run python increments.py to compare rank and inverse with exhaustive lists of 4,235 words using the adjugate update. The contextes.py file also supplies an independent decoder by continuation counting.

What does transmitting the Markov type cost?

I compare two reversible encodings which transmit their model or learn it online on the stated sources and orders. The KT arithmetic baseline has shorter files in all 18 supplied comparisons. I separately check 512 round trips per codec on eight-bit binary words, including metadata. Conditional rank remains available for sampling.

I run python temoin_xiv.py to replay my local check and keep its output in controle-xiv.json. What does transmitting the Markov type cost? · Krichevsky & Trofimov, The performance of universal encoding · Witten, Neal & Cleary, Arithmetic coding for data compression

A binary type rank and its header

I fix twelve binary symbols starting with zero. A transition-count recurrence and enumeration of all 2,048 words give 67 types. With a nine-bit count-composition header and a fixed-width rank per type only 16 words beat the direct eleven bits. The header convention determines the result.

If both parties already share the dictionary of 67 feasible types, seven bits suffice for the type. I then find 68 of 2,048 words strictly shorter, up from 16 under the first format. Constructing or communicating that dictionary still costs resources.

My next test is to encode only feasible types and measure decoder cost. AT.COD1 · Whittle, Some Distribution and Moment Formulae for the Markov Chain

I run python types09.py.

Counting the dictionary and intermediate integers

I serialise 67 binary types into 134 count bytes, two bytes per type. On a weighted tridiagonal minor of size 32, a recurrence verifies the 107-bit determinant. Fraction-free elimination uses a 208-bit numerator. On a held-out 1,024-byte excerpt my order-zero binary KT model costs an ideal 8,062.029 bits and zlib writes 518 bytes. I distinguish ideal likelihood, bytes written and the as-yet unmeasured decoder cost.

I plan to write and decode a terminated KT stream, then count data, model and header bytes on the same blocks. AT.COD2 · Bareiss, Sylvester’s identity and multistep integer-preserving Gaussian elimination

I run python bits10.py.

Actual size of a terminated KT stream

I count an eight-byte header and decode every block with an order-zero binary KT model. On 1,024 text bytes my stream takes 1,016 bytes against 518 with zlib. On the periodic block it takes 355 against 20. Decoder code is shared by convention.

Compare addressing methods on matched types before generalising codec rates. AT.COD3 · Jiang et al., uShuffle

Identical ranks using only active arcs

I retain initial state, terminal state, transition counts and lexicographic order. My three types contain 18,9,12 words with witness ranks 6,5,7. I verify every word by exhaustive enumeration. The last type uses four active arcs in place of 1,024 cells. I time initialisation, rank, inverse and 32 draws separately. The KT codec wins two of four complete-byte controls.

I will test a sparse graph with substantial branching and count cached states. AT.COD4 · Jiang et al., uShuffle

Addressing a branching trajectory

I fix endpoints and arc multiplicities on three directed graphs. I recover all 15, 48 and 300 trajectories by independent enumeration. The cache visits 37, 65 and 146 states. I supply the headers required to decode every rank.

Measure header and rank bits on a held-out trajectory. AT.COD5 · Jiang et al., uShuffle

Transmit changing block weights

I encode 32-bit blocks of weight 4 or 16. Each run starts with two six-bit integers, its length minus one and its weight, followed by fixed-width ranks. The decoder knows the block count and validates the final padding. For 32 blocks I send 140 bytes for 128 raw when the weight changes every block. Four-block runs take 104 bytes. I verify every decoded word.

Change the inputs · AT.EX19.02 · Cover

I reproduce · python flux19.py

Download bilingual starter kit ↓

Comments

Comments from both language editions appear here.

The discussion is open for reading. I’ll enable submissions once spam protection is configured.