Don't Be Such a Perfectionist
Imagine a slider of code quality, from 0 to 100. Untested, untyped code is 0. Vericoding (code with machine-checked proofs that it meets its specification) is 100. Somewhere in between is tested code. Known broken code is negative.
Functional programmers famously don't finish anything that isn't a compiler for their new pet language. But functional programming is better. Yes, it really is. Yet functional programmers reap fewer benefits than randos in Rust who use pattern matching.
A lot of why is because a program in a functional language seems perfectable so functional programmers put all their energy into that instead of saying something is good enough and just shipping it.
People who use theorem provers like Lean and Rocq have this bad. There, it really is perfectable, so historically people have wasted even more loads of time on proofs than anything product facing.
This is just silly. There's numbers between 0 and 100. If you need someone to permit you, then let it be me. It's ok to ship software that's just sorta good enough. Use the AI to improve it.
Use unit tests. Upgrade them to property tests. Add differential testing if you're working against known software. Add proofs as you can, and upgrade them later (see Quinn Dougherty and coauthors’ FVAPPS paper). Proofs do organize your code and you should use them as a skeleton, but don't get stuck on them. If the post was a slogan, it's "don't get stuck".
sorry-friendly programming
Tomas Skrivan, the creator of SciLean, suggested a sorry-like tactic that would define a test. I’d use sorry itself aggressively while prototyping: it’s a placeholder for a proof that hasn’t been written yet. You still gain incremental progress because you can use the placeholders to fit code together without the burden of actually making it work (YET).
This is just a call to do what we've always done: start cheap and work your way up.
It's not the case that either it’s slop or we’ve written a formal spec and a machine has checked that the code meets it. I like the idea of starting at 100, using proof statements to guide a whole autonomous design, but I think we’re really underrating 80.
Lightweight verification can find power-grid bugs for tens of dollars; a prototype semantics is still the wrong tool for a flight controller.
Lean on Lanes does this to give Lean a (real) standard library by differentially testing against Go's standard library. That's a project which understands moving fast and improving the code as you go along.
A lot of unit tests are really property tests. A property test is a helluva lot cheaper than a full proof but tests almost as many code paths in most stuff, most of the time. The overuse of "most" is on purpose.
A differential test gets at it another way. When you port existing software, you can use it as an oracle. Your goal implicitly shifts to "copy this program". In practice, you'll find bugs in it, ESPECIALLY when you start trying to add proofs. If both implement the same misunderstanding and you don't want to patch that: YOLO. It's ok.
Differential tests are a great way to modularize the original codebase because once it's in a prover, you can use the proofs to pick apart its behavior and dissect its implementation. And with AI, it's so easy. Prompt "copy X software in lean using differential testing". Build something awesome with that1.
Oath’s Lean model of Linux is built the same way: test the model against instrumented Linux, then prove things about the mirror.
AI proposes and Lean disposes. You can and should use whatever combination of untrusted search, trustworthy checks, and an oracle is useful. Unit test, property test, differential test, or a theorem.
External solvers without certificates
(For the experts): yes, external solvers without certificates are fine. If you really need a result to be checked, use the AI as the 'expensive' pass, turning each SAT step into a proof step. So what if it's huge? Just more tokens to build a more principled solution, in the vein of the incremental theme.
Suppose an SMT solver gives you a schedule for a dozen jobs. You can check the schedule directly against your constraints, then use it. You don’t need a certificate that explains how the solver found it. If it reports unsat instead, there’s no schedule to check. If you act on that answer without a certificate, you’re trusting the solver and your encoding. That can still be fine. Maybe you’re deciding whether to try a different schedule, and getting it wrong costs a minute. If you’re going to discard the only viable plan on the strength of that answer, you might want something better.
If the answer didn’t arrive with a certificate, you don't have to throw the answer away or discount it. Sometimes you just need an answer for the next decision. Be clear about what you’re trusting. Keith Adler makes the same point about Lean itself: a clean build means the kernel accepted the proof, not that humans have checked the math. Even #print axioms trusts the same kernel that said the proof went through. You can change the deal later.
This is a continuum. Pick points along it that suit your needs. There’s a lot of useful ground between an example that passes and a proof.
So start with slop if that lets you find out what you’re building. Then add tests that would have caught any mistakes made. Use generated cases to look for mistakes you haven’t made yet. When two implementations are cheap enough to keep around, let them disagree. Save small counterexamples. You now have tests, a reference, and a better idea what the specification should be. That work doesn't have to be thrown away when a proof shows up.
If it's undoable or you're the only user, maybe ship at 40. Don't be such a perfectionist.
Try a stable sort. With input
↩︎[(2, A), (1, B), (2, C)], both[(1, B), (2, A), (2, C)]and[(1, B), (2, C), (2, A)]are sorted. A property test checks that equal keys keep their original order; a differential test checks that the entire output agrees with a simple stable insertion sort. Only the first output passes either check.