CuNi use case · Proven (primitives and roundtrips)

Codecs: the decoder is provably the same decoder everywhere

A codec is a contract between an encoder and a decoder that may never meet: different machines, different languages, different decades. Lossless means lossless — one bit of disagreement and the data is corrupt. There is no "close enough" in a decoder.

Open Studio Back to CuNi

The failure mode

An arithmetic decoder reimplemented in JavaScript for a web player disagrees with the Rust encoder on a single edge-case interval. One file in ten thousand decodes to garbage. Support calls it "a corrupt file." It isn't — it is a divergent decoder, and it was divergent from the day it shipped.

What CuNi proves today: proven (codec laws)

Real codec primitives as CuNi laws: op dispatch, the never-expand guarantee (keep(raw,coded)), zero packing, arithmetic-coding encode/decode roundtrips, and 4 KiB tile laws. Each encodes and decodes; cuni check proves identical stdout across the catalog. The never-expand law is load-bearing: it is the property the whole product's trust rests on.

What it does not claim

The laws cover primitives and roundtrips. PCC's full production pipeline — MATCH, BWT, CMAQ, LZ — lives in the lab's Rust tree, not in CuNi laws. A whole-codec, bit-exact-across-targets proof does not exist yet.

What is next

Port the production codec stages into CuNi laws one stage at a time, each gated by cuni check --all. The falsifiable milestone is crisp: the PCC decode path, proven byte-identical on all 53 targets, on the never-expand law and the full test corpus. See the compressor itself at /pcc.

More CuNi use cases

CuNi overview PCC