As AI coding increasingly shifts toward formal verification as its foundation, I've started converting some of my tests into formal verifications and running them.
Over the past few days, I've been working by first laying down a formal specification as a skeleton for parts of existing code, then verifying whether the detailed implementation is correct within that constrained degree of freedom.
Looking at the stacks currently in vogue, the approach is to use a verifier like Verus on Rust source code to specify the functional correctness of unsafe boundaries and core algorithms, then hand off complex mathematical invariants that automated solvers can't handle to a Proof Assistant like Lean or Rocq.
To put it in fundamental terms, it's all about how you carve up the search space.
In my mental model, I think of it as the act of framing a structure among the countless paths that pass through a vast space.
Giving an AI a blank slate and telling it to "write bug-free code" is like searching for a needle in an infinite state space. What humans ultimately do is dig a channel through the space they can navigate, that is, through a space with an inexhaustible flow of water, and direct it toward where they want it to go.
In the end, the core concept is the boundary. Because the structure of most programs changes depending on where you draw the boundary, you could argue that the essence of programming is dividing boundaries.
I've been drawing those boundaries and then filling in the code, but I wonder if that's really the right way to go.
Programming is the act of delineating invisible boundaries in the air, that is, defining an abstract search space; creating the constraints that shape it is what a Proof Assistant is used for.
Perhaps the core of programming now lies less in filling the tank with the water of implementation and more in checking the shape of the tank itself to ensure the water doesn't rise into a completely different form.
That said, this level of testing would be unnecessary for a CRUD application. I'm taking on various challenges while building my own compiler, though I have no idea whether it will ever be finished.
Lately, I've come to think of coding as being like bonsai. Once you turn an AI Agent loose, it starts growing infinitely, so you create tests and proof tools to trim the shapes it branches into.
I was terrible at math in college. Well, I was never good at math, but once I had a career and started working through math by writing it as code, it became familiar enough that I can at least understand roughly what form a result should take.
If I had learned this way from the start, I wouldn't have wandered around so lost.