Lemire Formally Verifies SIMD Base64 Codec Memory Safety in Lean 4

lemire · x · 2026-11-22

Daniel Lemire says he is increasingly formally verifying his high-performance code. It is early days, but he argues that adding formal proofs on top of extensive testing and validation could be a game changer.

His example is the phpbase64 repo: it ports simdutf's base64 decoders (SSSE3, AVX2, AVX-512 VBMI, NEON) into PHP's ext/standard/base64.c (php-src PR #25476) and includes a Lean 4 proof that the encoders and decoders never read or write outside their buffers, with tight bounds. The repo ships the PR code, a new test, AVX-512 VBMI build support, the full patch, and the Lean 4 development under formal/base64safety/.

Original post →

More from coding & agent

coding & agent channel →