logoalt Hacker News

thesecretsquad • today at 8:59 PM • 6 replies • view on HN

I'm not half as smart as most of the people on HN and I don't know much about formal verification, so maybe this is a dumb question....

My understanding of this is: You write a "contract" that defines the specification for some functionality, including inputs, outputs, preconditions, post-conditions, etc. and the contract can be formally verified by some proof checker that says it's logically consistent. Then you build the implementation and the implementation can be proven to abide by the contract (or not).

But somebody has to write the contract (either a person or AI). If the contact specifies behavior that is logically consistent as far as a proof checker is concerned, but the behavior is defined incorrectly, you could have a situation where "you built the thing right", but "you didn't build the right thing".

So someone still needs to make sure the contracts are specifying the correct behavior. Once you know you have, then I suppose the formal verification is good because everybody (people and AI) know that it guarantees its behavior.

My question then is: Assuming everything I just said isn't nonsense, aren't we still in the same place as before? Someone needs to know how to specify (and program) the right behavior?


Replies

odyssey7 • today at 10:59 PM

The product person should be able to work with the AI agent to make a high-level specification — after all, they will need to communicate that intent at some point.

I’m not sure where software engineers would take over, but given a sufficient spec, the system ought to be a direct translation of that spec. Ideally the spec itself should compile to realize system.

iamwil • today at 9:35 PM

It is a gap, but the spec is often declarative, on what needs to be true, rather than imperative, about all the exact steps. Hence, less prone to error. You're right that it proves the protocol, but not necessarily the implementation.

A not-quite-there way to close the gap is that you can generate traces from the spec/proof, a sequence of states and events that must hold true. and then you can use that trace to replay back in tests, and if the implementation is correct, then it should mirror the trace.

➕ show 1 reply
kettlecorn • today at 10:16 PM

It helps substantially because it disentangles subjective and objective programming.

Like if you want a program that sorts a list that is a subjective goal because you could just as easily choose a shuffled list, or a different sorting, or any other sort of list ordering.

Once you've established what you want fulfilling that is an objective task.

Today's programming languages entangle subjectivity and objectivity together, and better decoupling them means we can automate the objective parts which dramatically reduces the programming left over for humans.

pratzc07 • today at 9:13 PM

The spec is far smaller than the implementation. For example take the TimSort case whose implementation in Java and Python had a bug that was there for years until someone tried to formally prove it correct. I also think many valuable properties do not need specific domain judgement like never crashes, no out of bounds access, no data races etc. A spec says "what" not the "how" you still need someone who understands the requirement but they don't have to get every single edge case right. If a model writes both the implementation and the proof, the checker doesn't care who wrote them. Human review shrinks from "read all the generated code" to "read the spec".

➕ show 1 reply
ahussain • today at 9:13 PM

I would assume that the contract is much more concise than the implementation to satisfy that contract. Therefore, it's much easier for a human or AI to maintain.

It's a bit like writing and maintaining a declarative SQL query (new-style) vs writing a query planner (old-style programming).

andoando • today at 9:12 PM

Were already trusting LLMs to write code, which means it has to translate the human language to both system requirements and make sure the implementation fits those requirements. Why not remove half the problem?

There is also something excellent formal code produces: modularity