Hacker News new | ask | show | jobs
by latentsea 4 days ago
Interesting. I work in bog standard LOB SaaS type businesses my whole career, so zero practical experience with formal methods, but a growing interest in them due to how I see the industry trending towards them. Can I ask... in your case, what is $dayjob related to that you find yourself operating this way already? Finance? Aerospace? Just curious...

> You must not write implementation before having all conjectures stated -- otherwise the implementation will bias your thinking, and you will try to prove properties of your implementation instead of what you needed.

Most software engineers don't really have a background in it, and tbh I kinda don't know where to start, and have heard that right now if you're already experienced with formal methods then you can get great results out of approaches like this with LLMs, but if you just vibecode up the Lean or TLA+ etc then you're not going to get out of it what you were expecting. I suspect your statement here is exactly the kind of thing that makes all the difference, but I don't know how to know what the other things that make the difference are. Any other pointers?

3 comments

You might find some of my previous comments useful.

On Formal Methods Thinking/Levels and (In)Formal Methods - https://news.ycombinator.com/item?id=50478624

On Design By Contract (DbC) - https://news.ycombinator.com/item?id=50108540

On Combining Tests and Proofs with Contracts - https://news.ycombinator.com/item?id=50108206

On Correctness-by-Construction - https://news.ycombinator.com/item?id=49613696

Note that the above is based on using classical logic predicates to "steer" the program through its "state space". This is the more fundamental and "simpler" approach since it uses only First-Order Logic.

Another way is to use the Type System (constructive logic, dependent types in Lean4 etc.) to embed the above directly into the program types. This is harder since you need Typed Lambda Calculus, Higher-Order Logic and need to think quite differently. For this you can read Types and Programming Languages by Benjamin Pierce and/or any number of lambda calculus books. The Curry-Howard Correspondence helps you understand this if you have some idea of the above state space approach.

Finally, if you want to know/study the whole of above you need to read Understanding Formal Methods by Jean-Francois Monin - https://news.ycombinator.com/item?id=50506655

It is all overwhelming at first if you are completely new to it so use it as a roadmap. Survey all of the above to get a grip on the jargon, notation and application and then choose your approach/logic/tool based on your interests/needs.

I studied from this during my University days: https://www.cs.cmu.edu/~rwh/courses/clogic/www/handouts/curr...
Nice. I have heard of this though i have not yet read it.

My current favourite are Helmut Brandl's writings - https://hbr.github.io/Lambda-Calculus/index.html particularly his 100-page Typed Lambda Calculus/Calculus of Constructions.

Thanks, appreciate this!
You can use 'lightweight' formal methods too like Alloy or Forge https://forge-fm.github.io/book/2026/index.html
> Can I ask... in your case, what is $dayjob related to that you find yourself operating this way already? Finance? Aerospace? Just curious...

Nothing so critical.

My first serious full-time job was at ScyllaDB, where I worked on distributed database system core. My main area of interest (carried over from University) were distributed algorithms. There, formal methods are basically necessary; if you design a distributed algorithm and don't use formal methods, you *will* fuck up. In ScyllaDB I used TLA+.

Today I have a different job but my passion for formal methods didn't go away.

I updated my HN profile with link to my website, you can look me up.

Oooh that makes sense. Databases are one area I have definitely heard such methods being used. I remember seeing a talk on TLA+ by the CosmosDB people and thinking it was really cool.
Yes. But formal methods, especially right now with agentic AI, are, I believe, a fucking superpower, no matter what you're doing. Even if I wrote a simple CRUD web app, I would start with a formal Lean contract. (And producing such a contract with my Elenxis tool + frontier model is trivial.)

Imagine all software you build is bug-free from the start. No technical debt, ever.

I even made https://github.com/kbr-/kotlean so I could make Android apps in Lean.
Neat. Actually... while I have you here... what do you make of https://lanyon.ai/?
Nice find. I like it. I'm doing something similar for myself right now, actually. A compiled formal DSL for reasoning and so on (I call it "Cognitive Calculus" and I even have a compiler...)

They still use a language model to propose ideas though, and I have a particularly strong opinion on language models (or, as I like calling them since 2 days ago -- "well-formatted shit predictors"): https://news.ycombinator.com/item?id=50659297

Also, they are a business, so they'll probably want to sell you this stuff. I want to give it away for free (just give me a month).

They also have this footnote at the end: ``` Of course, the question of what constitutes a “mistake” is highly context-sensitive. It is perhaps more accurate to say that it is mathematically impossible for Lanyon ever to commit a misformalization. Every implementation will always match the specification, and every proof will always match the implementation, 100% of the time. In this sense, Lanyon guarantees perfect syntactic correctness. The issue of semantic correctness (i.e. how to guarantee that the formal specification actually matches the user’s natural language intent) remains an open area of research for us, spanning psychology, linguistics, philosophy, and agent harness development. We hope to have more to say about this soon. ```

for that, see Elenxis. Although Elenxis is still using a LLM as a module, and LLM can be misaligned, so it's not a complete solution. I do have some mathematical theory though for doing this well, and want to develop it further

I'm onboard with this vision, and fully in agreement.