
Skynet will be formally verified
Formal verification is one of the strongest tools in a suite of the modern engineer, and it proves that code matches its specification. But nobody checks that the specification matches the world around it. What can go wrong with the introduction of AI?
Formal verification is one of the strongest tools in software engineering. We use it to prove that the most critical parts of our analysis tools are mathematically correct, and we also use it for our customers. And this month a mathematician used AI to write a machine-checked proof of the Riemann hypothesis. Results like this make people expect the same certainty from proofs of AI-generated code. This expectation will not hold, and we will explain why.
What may a proof prove?
In mathematics, a proof proves that some property holds for any input. It is no different from software, where we prove that some property holds for all correct inputs. No case can be forgotten under any circumstance.
However, unlike mathematics, software is not virtual: it runs on real hardware and within the boundaries of the operating system. Many layers of abstraction. In fact, even a simple operation brings side effects, for example, the timing of the operation. Let's illustrate it with a game where the algorithm is fully verified, but it still allows one to "hack" the system by using a side-channel attack.
Curiously, it is just the tip of the iceberg. Is it possible to prove that the execution takes less than 20 ms (for example)? Remember that the CPU clock affects timing proportionally; therefore, the prover has to take physical properties into account, too! That is an insane number of properties to verify!
What does AI add to the field?
Mathematicians give AI a chance to prepare actual proofs. A validator checks them through a very sophisticated yet quite mechanical process, through a calculus of computations.
We, engineers, give AI a chance to prepare proofs for our programs in a pure vacuum. How many layers exist in a C# application? Let us briefly explain:
- C#
- IL
- Target machine code
So, while proving C#, we need to prove that this C# application is correct... then that it is transformed into an equally correct IL program... then that it is transformed into equally correct machine code. With every layer down, we lose precious semantics, which is pretty much the same as the mathematical apparatus. At the highest level, we operate on theorems with rich "tooling", while at the lowest level we need to prove that a sum actually sums, for all sequences.
And then we add the operating system, which is many times bigger than any application.
Do you remember what we started with? It was AI. So the AI, as well as we living humans, has to deal with so many levels of abstraction that the proof will not be a mere 250,000 pages long. It will be much, much more insane.
There will be no human alive who will read it.
At the same time, the AI currently cannot calculate 5 + 7 reliably without external tooling. The AI cannot reliably change the color of a button without a browser, screenshots and image analysis.
And yet we push it to the limit when we ask it to apply a statistical apparatus to the task of register and memory manipulation at scale.
Let's hope that the tooling is good enough. What else is there to say?
Conclusion
There is an old joke whose source we don't know, so we will retell it:
From the dissertation: "If you've read this far, I'll buy you a bottle of whisky. Just contact me to claim your prize."
The bottle is still mine after a few years.
It fully applies to AI. There will be surprises. More surprises than we expect.
The rush to formal methods is a good thing, and the economic and technical reasons behind it are easy to understand. The trouble is that trust in a proof spreads to the AI that produced it. That AI is statistical, poorly controlled and poorly understood, and it creates an almost religious belief that this time everything, everything in the world, will be fixed.
And it will be "safe".
Every bug will get a fix, every fix will get a proof, and every test will be green. Nobody will read these, because reading is the work we gave away to the same statistical AI.
If anybody were to destroy humanity through software, the surface to work with would be huge. This brings up one thought, which hopefully won't become a prediction:
Skynet will be formally verified.