Functorial (@functorialdev) header
Functorial (@functorialdev) profile picture

Spec engineering with mathematical precision

Seattle, United States
Joined November 2026
Photo by Functorial (@functorialdev)Photo by Functorial (@functorialdev)Photo by Functorial (@functorialdev)
Kubernetes APF can remove a queue while a finished request still holds seats, and the server can panic when that request's timer fires. We specified "empty" in Lean, proved a model of the fixed code, and generated a fix that matches the PR byte for byte: functorial.inc/blog/2026/ver…
1
1
1
7
14,898
Agreed, you cannot delegate the writing of the spec to an LLM
Reasons I'm extremely skeptical about formal verification taking off: 1. Simpler, cheaper alternatives like enforcing invariants via the type system itself 2. Writing the specification / contract that gets verified is much harder than it sounds for complex, important things - and not something you can delegate to an LLM. 3. Are you going to verify that the formal verification actually verifies what you think it's verifying? Same problem as reading reams of LLM-authored unit tests.
2
137
5/ The proofs are about a model of the Go code, and the post lists what we proved, checked and trust. Code and proofs: github.com/Functorial-Inc/k8…
6
4/ Finally we generated the Go fix from the specification. It is byte-for-byte identical to the fix in Sai krishna Bodapati's PR, and the naive meaning of "empty" regenerates the buggy code.
1
13
3/ We wrote the strict meaning in Lean and proved that a model of the fixed code keeps the promise in every reachable state. Then we replayed 608 recordings of the real Go code through the model, and the checker rejected exactly the 80 runs where the bug happened.
1
17
2/ The Go interface promises APF won't discard a queue "unless and until it is undesired and empty". The code checks that nothing is waiting or executing, and never checks for a request that has finished but still holds seats. The bug comes down to what "empty" means.
1
21
1/ Kubernetes APF has an open bug: the API server can remove a queue while a finished request still holds seats in it, and it can panic when that request's timer fires. The post shows how we specified the fix in Lean and generated it from the spec. 🧵 functorial.inc/blog/2026/ver…
1
1
1
75
Functorial retweeted
Spec engineering will be the next big thing in 2027
At Functorial, we are betting that the future of software will be specification engineering, where the attention of human engineers will be spent almost entirely on one thing: getting the spec right. Get the spec right, and sleep at night.
1
1
30
Replying to @khoiiiind
This is required reading, great share!
1
134
At Functorial, we are betting that the future of software will be specification engineering, where the attention of human engineers will be spent almost entirely on one thing: getting the spec right. Get the spec right, and sleep at night.
1
2
30
1,905