An Anecdote Against Slop Artifacts
An Anecdote Against Slop Artifacts
Aug 14, 2026
This is a cautionary tale.
Act I
My latest paper “Verifying Exact Samplers for Continuous<br>Distributions with a Discrete Program Logic” involved quite a lot of<br>proof work. In that paper we showed how you can use program logic<br>techniques to prove stuff about a particular implementation of real<br>numbers (lazy bitstreams), and we formally verified it using the<br>Iris framework in Rocq.
The core “program logic” nugget at the heart of this paper is<br>really simple and elegant; of course, this is because Joe went “wolf<br>mode” and cooked this part of the project over a single weekend. My<br>main contribution to the paper was exploring how far this trick<br>could get us, in the end scaling all the way up to verified<br>implementations of cool and counterintuitive sampling<br>algorithms.
In particular, I spent a couple months hacking on this idea, and<br>of course, going completely insane in the process. Through tears I<br>verified the existence of, and absolute convergence of, and<br>commutation of, ten thousand different Riemann integrals in Rocq,<br>working around the scant and inconsistent support for them in our<br>analysis libraries. I was not a heavy user of AI at the time–this<br>mental torture was sourced organically. As an effect (aside from<br>forgetting the feeling of joy) but I knew pretty much every line of<br>this repository inside and out.
Act II
Because of our weird representation of real numbers our<br>adequacy theorem, the main metatheorem relevant for<br>correctness of program logics, had to be stated in a somewhat<br>nonstandard way. The statement is more or less as follows:
Theorem Adequacy .
Let e be a program, and mu be a proper<br>distribution over R.
Let P/2^Q be any dyadic rational number.
Suppose you prove HasDistribution(e, mu) (the main<br>“judgment” of our logic).
Suppose that IsLessThanDyadic(e, P/2^Q) terminates<br>with probability 1.
Then, the probability that<br>IsLessThanDyadic(e, P/2^Q) returns true is<br>equal to cfd(mu)(P/2^Q)
All of the weirdness has to do with<br>IsLessThanDyadic, a necessary layer for simulating real<br>numbers in a language that doesn’t have them. The program<br>IsLessThanDyadic works by iteratively comparing<br>approximations of the real number returned by e against<br>approximations of P/2^Q. For example, if<br>P/2^Q is the dyadic binary number<br>b0.110111..., the program will iteratively compare<br>increasingly finer approximations of e against it,<br>until the first comparison that decides which side that<br>e lands on:
b0.0 ?
b0.10 ?
b0.110 ?
b0.1100 ?
and on and on
Of course, when e is randomly sampled from a<br>sufficiently nice probability distribution like the Gaussian, the<br>chance that it exactly equals P/2^Q is zero, so a<br>simple inductive argument justifies that the obvious implementation<br>of IsLessThanDyadic really will terminate with<br>probability 1 as required. And it’s easy to justify to yourself (and<br>inside our logic) that this process will output true if<br>e and false if<br>P/2^Q . By appealing to some elementary measure<br>theory, the fact that we know<br>IsLessThanDyadic(e, P/2^Q) for every dyadic number<br>P/2^Q is enough to characterize the cumulative density<br>function of e over the entire real line, and so the<br>proofs we carry out inside our logic are the real stuff.
Our final artifact includes random sampling algorithms for the<br>real-valued, honest-to-god Gaussian and Laplace distributions, and a<br>library of verified arithmetic complete enough to fill an<br>unverified hole in prior work. At the time we submitted I was super<br>proud of this result, especially given how much work I’d put in to<br>making every little detail of the math come together.
The reviewers agreed it was cool, and it was accepted. Yay!
Act III
While our adequacy theorem is nice, that fourth bullet point is<br>sort of weird, and we highlighted in our paper that a separate tool<br>such as Total Eris would have no issue demonstrating that<br>IsLessThanDyadic(e, P/2^Q) terminates with probability<br>1 in Rocq. Come rebuttal time we decided to actually sit down and do<br>it, at least for the uniform sampler over [0,1]. So<br>there I was, sitting in a hotel room in Providence, hacking away on<br>a Total Eris proof when I realized
Act FUckfuckfuckfuckfuckfu
Our implementation of IsLessThanDyadic was NOT<br>comparing increasingly more precise approximations of<br>P/2^Q. Due to a sign error in our code, it was checking<br>the outcome of e against increasingly coarser<br>approximations of our dyadic:
0 ?
0 ?
0 ?
0 ?
And on and on forever, haha, uh oh, I’m in danger
Worse than just being unprovable, the program actually just plain<br>did not terminate!
Why did the proof checker still accept this? Well, Eris is a<br>partial correctness logic, so it trivially accepts anything<br>about nonterminating programs (indeed, partial correctness is<br>necessary for the logic’s main trick to work). Loeb induction, the<br>principle we use to verify properties about<br>IsLessThanDyadic in Iris, simply assumes that your<br>program is in a terminating...