Tool · Mining
Freivalds' check
Catch a wrong matrix product without redoing it
What it does
A prover hands you A, B and a claimed product C. Switch it between honest and a cheater (one cell quietly off by a little). Instead of multiplying A·B yourself, pick a random vector r of 0s and 1s and compare A·(B·r) with C·r.
How to read it
- B·r, then A·(B·r), then C·r: three matrix-times-vector products, n² multiply-accumulates each.
- If the two columns differ anywhere, C is wrong. That’s proof, not luck.
- If they match, C might still be wrong: a single bad cell in column j hides whenever r has a 0 at position j. That happens half the time, so k passing checks in a row leave at most a 1 in 2ᵏ chance of a cheat. 10 random rounds shows how fast that shrinks.
- The cost box compares 3n² per check with n³ to redo the product. At toy sizes the saving is small; at n = 8,192 one check is about 2,700 times cheaper.
Pearl specifics
This is intuition for why checking can be far cheaper than doing. Pearl does not use Freivalds’ check. A winning ticket is proven with a zero-knowledge certificate (a STARK wrapped in two Plonky2 layers, about 60 KB) that shows the ticket came from the committed matrices with the right noise, and nodes verify it in milliseconds without seeing A or B.
What’s simplified
Small matrices (3, 4 or 6 wide) with entries from −5 to 5, and a cheater who changes exactly one cell. Freivalds’ bound of ½ per check holds for any wrong C; with one bad cell it is exactly ½.
Under the hood
Runs entirely in your browser. Products come from matMul in src/lib/miner.ts (unit-tested with the toy miner’s
denoising identity); random vectors come from your browser’s cryptographic generator.