News for hackers. Stuff that matters.
Re:Prediction: AI will make formal verification go mainstream by gizmo686 on Tuesday December 16, 2025 @11:15PM (#46298180)
A limited form of formal verification is already mainstream. It is called type systems. The industry in general has been slowly moving to encode more invariants into the type system, because every invariant that is in the type system is something you can stop thinking about until the type checker yells at you.

A lot of libraries document invariants that are either not checked at all, only at runtime, or somewhere in between. For instance, the requirement that a collection not be modified during interaction. Or that two region of memory do not overlap, or that a variable is not modified without owning a lock. These are all things that, in principle, can be formally verified.

No one claims that good type systems prevent buggy software. But, they do seem to improve programmer productivity.

For LLMs, there is an added benefit. If you can formally specify what you want, you can make that specification your entire program. Then have an LLM driven compiler produce a provably correct implementation. This is a novel programming paradigm that has never before been possible; although every "declarative" language is an attempt to approximate it.

Re:Prediction: AI will make formal verification go mainstream by devin on Tuesday December 16, 2025 @11:43PM (#46298358)
> No one claims that good type systems prevent buggy software. But, they do seem to improve programmer productivity.

They really don’t. How did you arrive at such a conclusion?

Re:Prediction: AI will make formal verification go mainstream by Permik on Wednesday December 17, 2025 @12:10AM (#46298499)
Not that I can answer for OP but as a personal anecdote; I've never been more productive than writing in Rust, it's a goddamn delight. Every codebase feels like it would've been my own and you can get to speed from 0 to 100 in no time.
Re:Prediction: AI will make formal verification go mainstream by leoedin on Wednesday December 17, 2025 @03:11AM (#46299428)
Yeah, I’ve been working mainly in rust for the last few years. The compile time checks are so effective that run time bugs are rare. Like you can refactor half the codebase and not run the app for a week, and when you do it just works. I’ve never had that experience in other languages.
Re:Prediction: AI will make formal verification go mainstream by mplewis on Wednesday December 17, 2025 @12:06AM (#46298478)
Through empirical evidence? Do you think that the vast majority of software devs moved to typing for no reason?
Re:Prediction: AI will make formal verification go mainstream by avmich on Wednesday December 17, 2025 @01:06AM (#46298769)
It's a bad reason. A lot of best practices are temporary blindnesses, comparable, in some sense, with supposed love to BASIC before or despite Dijkstra. So, yes, it's possible there is no good reason. Though I don't think it's the case here.
Re:Prediction: AI will make formal verification go mainstream by wolvesechoes on Wednesday December 17, 2025 @02:30AM (#46299196)
> Do you think that the vast majority of software devs moved to typing for no reason?

It is quite clear that this industry is mostly driven by hype and fades, not by empirical studies.

Empirical evidence in favor of a claim that static typing and complex type systems reduce bugs or improve productivity is highly inconclusive at best

Re:Prediction: AI will make formal verification go mainstream by gf000 on Wednesday December 17, 2025 @04:01AM (#46299723)
We don't actually have empirical evidence on the topic, surprisingly.

It's just people's hunches.

Re:Prediction: AI will make formal verification go mainstream by JumpCrisscross on Wednesday December 17, 2025 @04:19AM (#46299833)
I feel like the terms logical, empirical, rational and objective are used interchangeably by the general public, with one being in vogue at a time.
Re:Prediction: AI will make formal verification go mainstream by kreetx on Wednesday December 17, 2025 @01:55AM (#46298994)
Some type systems (e.g, Haskell) are closing in in becoming formal verification languages themselves.
Re:Prediction: AI will make formal verification go mainstream by rixed on Wednesday December 17, 2025 @02:33AM (#46299210)
And one can see how quickly they became mainstream...
Re:Prediction: AI will make formal verification go mainstream by egwor on Wednesday December 17, 2025 @02:53AM (#46299324)
I think that’s because the barrier to entry for a beginner is much higher than say python.
Re:Prediction: AI will make formal verification go mainstream by qrobit on Wednesday December 17, 2025 @03:24AM (#46299498)
I would argue that the barrier to entry is on par with python for a person with no experience, but you need much more time with Haskell to become proficient in it. In python, on the other hand, you can learn the basics and these will get you pretty far
Re:Prediction: AI will make formal verification go mainstream by jonathanstrange on Wednesday December 17, 2025 @04:19AM (#46299832)
IMHO, these strong type systems are just not worth it for most tasks.

As an example, I currently mostly write GUI applications for mobile and desktop as a solo dev. 90% of my time is spent on figuring out API calls and arranging layouts. Most of the data I deal with are strings with their own validation and formatting rules that are complicated and at the same time usually need to be permissive. Even at the backend all the data is in the end converted to strings and integers when it is put into a database. Over-the-wire serialization also discards with most typing (although I prefer protocol buffers to alleviate this problem a bit).

Strong typing can be used in between those steps but the added complexity from data conversions introduces additional sources of error, so in the end the advantages are mostly nullified.

Re:Prediction: AI will make formal verification go mainstream by baq on Wednesday December 17, 2025 @04:41AM (#46299958)
> Most of the data I deal with are strings with their own validation and formatting rules that are complicated and at the same time usually need to be permissive

this is exactly where a good type system helps: you have an unvalidated string and a validated string which you make incompatible at the type level, thus eliminating a whole class of possible mistakes. same with object ids, etc.

don't need haskell for this, either: https://brightinventions.pl/blog/branding-flavoring/

Re:Prediction: AI will make formal verification go mainstream by jonathanstrange on Wednesday December 17, 2025 @08:38AM (#46301807)
That's neat, I was about to ask which languages support that since the vast majority don't. I didn't know that you can do that in Typescript.
Re:Prediction: AI will make formal verification go mainstream by Mekaniko on Saturday December 20, 2025 @07:45AM (#46335768)
Any language with an type system really...

Even OOP : if you have a string class, you can have a String_Formated_For_API subtype.

Just extends String, and add some checking.

But now the type checker "knows" it can print() a String_Formated_For_API just fine but not call_API(string).

Re:Prediction: AI will make formal verification go mainstream by Byamarro on Wednesday December 17, 2025 @04:34AM (#46299923)
I blame syntax. It's too unorthodox nowadays. Historical reasons don't matter all that much, everything mainstream is a C-family memember
Re:Prediction: AI will make formal verification go mainstream by azkalam on Wednesday December 17, 2025 @07:27AM (#46301201)
Python has a reputation for being good for beginners so it's taught to beginners so it has a reputation for being good for beginners.
Re:Prediction: AI will make formal verification go mainstream by int_19h on Monday December 22, 2025 @04:07AM (#46352434)
Given that it's the AI doing the coding, it would be pretty quickly so long as it's decent at Haskell. Which it already is, surprisingly so actually for such a niche language. It doesn't necessarily write great code, but it's good enough, and the straightjacket type system makes it very hard for the model to sneak in creative hacks like using globals, or trip itself with mutable state.
Re:Prediction: AI will make formal verification go mainstream by Shocka1 on Thursday December 18, 2025 @11:35AM (#46314926)
Piggybacking off your comment, I just completed a detailed research paper where I compared Haskell to C# with an automated trading strategy. I have many years of OOP and automated trading experience, but struggled a bit at first implementing in Haskell syntax. I attempted to stay away from LLMs, but ended up using them here and there to get the syntax right.

Haskell is actually a pretty fun language, although it doesn't fly off my fingers like C# or C++ does. I think a really great example of the differences is displayed in the recursive Fibonacci sequence.

In C#:

    public int Fib(int n)
    {
        if (n <= 1)
            return n;
        else
            return Fib(n - 1) + Fib(n - 2);
    }
In Haskell:

    fib :: Integer -> Integer
    fib n
      | n <= 1    = n
      | otherwise = fib (n - 1) + fib (n - 2)
As you might know, this isn't even scratching the surface of the Haskell language, but it does a good job highlighting the syntax differences.
Re:Prediction: AI will make formal verification go mainstream by mrsmrtss on Friday December 19, 2025 @07:54AM (#46325283)
When using switch expression in C#, they are a lot more similar:

    public int Fib(int n) => n switch
    {
        <= 1 => n,
        _    => Fib(n - 1) + Fib(n - 2)
    };
Re:Prediction: AI will make formal verification go mainstream by blub on Wednesday December 17, 2025 @02:22AM (#46299153)
> No one claims that good type systems prevent buggy software. But, they do seem to improve programmer productivity.

To me it seems they reduce productivity. In fact, for Rust, which seems to match the examples you gave about locks or regions of memory the common wisdom is that it takes longer to start a project, but one reaps the benefits later thanks to more confidence when refactoring or adding code.

However, even that weaker claim hasn’t been proven.

In my experience, the more information is encoded in the type system, the more effort is required to change code. My initial enthusiasm for the idea of Ada and Spark evaporated when I saw how much ceremony the code required.

Re:Prediction: AI will make formal verification go mainstream by teiferer on Wednesday December 17, 2025 @02:28AM (#46299188)
> In my experience, the more information is encoded in the type system, the more effort is required to change code.

I would tend to disagree. All that information encoded in the type system makes explicit what is needed in any case and is otherwise only carried informally in peoples' heads by convention. Maybe in some poorly updated doc or code comment where nobody finds it. Making it explicit and compiler-enforced is a good thing. It might feel like a burden at first, but you're otherwise just closing your eyes and ignoring what can end up important. Changed assumptions are immediately visible. Formal verification just pushes the boundary of that.

Re:Prediction: AI will make formal verification go mainstream by blub on Wednesday December 17, 2025 @03:37AM (#46299577)
In practice it would be encoded in comments, automated tests and docs, with varying levels of success.

It’s actually similar to tests in a way: they provide additional confidence in the code, but at the same time ossify it and make some changes potentially more difficult. Interestingly, they also make some changes easier, as long as not too many types/tests have to be adapted.

Re:Prediction: AI will make formal verification go mainstream by gf000 on Wednesday December 17, 2025 @03:59AM (#46299712)
Constraints Liberate, Liberties Constrain. (I also recommend watching the presentation with the same title)
Re:Prediction: AI will make formal verification go mainstream by estebank on Wednesday December 17, 2025 @11:59AM (#46302085)
This reads to me like an argument for better refactoring tools, not necessarily for looser type systems. Those tools could range from mass editing tools, IDEs changing signatures in definitions when changing the callers and vice versa, to compiler modes where the language rules are relaxed.
Re:Prediction: AI will make formal verification go mainstream by jbritton on Wednesday December 17, 2025 @06:10PM (#46306889)
I was thinking about C++ and if you change your mind about whether some member function or parameter should be const, it can be quite the pain to manually refactor. And good refactoring tools can make this go away. Maybe they already have, I haven’t programmed C++ for several years.
Re:Prediction: AI will make formal verification go mainstream by jappgar on Wednesday December 17, 2025 @07:21AM (#46301152)
It is definitely harder to refactor Haskell than it is Typescript. Both are "safe" but one is slightly safer, and much harder to work with.
Re:Prediction: AI will make formal verification go mainstream by dnautics on Wednesday December 17, 2025 @08:40AM (#46301826)
> All that information encoded in the type system makes explicit what is needed in any case and is otherwise only carried informally in peoples' heads by convention

this is, in fact better for llms, they are better at carrying information and convention in their kv cache than they are in having to figure out the actual types by jumping between files and burning tokens in context/risking losing it on compaction (or getting it wrong and having to do a compilation cycle).

if a typed language lets a developer fearlessly build a semantically inconsistent or confusing private API, then llms will perform poorer at them even though correctness is more guaranteed.

Re:Prediction: AI will make formal verification go mainstream by gf000 on Wednesday December 17, 2025 @03:56AM (#46299696)
> but one reaps the benefits later thanks to more confidence when refactoring or adding code.

To be honest, I believe it makes refactoring/maintenance take longer. Sure, safer, but this is not a one-time only price.

E.g. you decide to optimize this part of the code and only return a reference or change the lifetime - this is an API-breaking change and you have to potentially recursively fix it. Meanwhile GC languages can mostly get away with a local-only change.

Don't get me wrong, in many cases this is more than worthwhile, but I would probably not choose rust for the n+1th backend crud app for this and similar reasons.

Re:Prediction: AI will make formal verification go mainstream by zozbot234 on Wednesday December 17, 2025 @04:47AM (#46299989)
The choice of whether to use GC is completely orthogonal to that of a type system. On the contrary, being pointed at all the places that need to be recursively fixed during a refactoring is a huge saving in time and effort.
Re:Prediction: AI will make formal verification go mainstream by gf000 on Wednesday December 17, 2025 @05:30AM (#46300293)
I was talking about a type system with affine types, as per the topic was Rust specifically.

I compared it to a statically typed language with a GC - where the runtime takes care of a property that Rust has to do statically, requiring more complexity.

Re:Prediction: AI will make formal verification go mainstream by lukan on Wednesday December 17, 2025 @02:36AM (#46299224)
"In my experience, the more information is encoded in the type system, the more effort is required to change code."

Have you seen large js codebases? Good luck changing anything in it, unless they are really, really well written, which is very rare. (My own js code is often a mess)

When you can change types on the fly somewhere hidden in code ... then this leads to the opposite of clarity for me. And so lots of effort required to change something in a proper way, that does not lead to more mess.

Re:Prediction: AI will make formal verification go mainstream by blub on Wednesday December 17, 2025 @03:33AM (#46299548)
There’s two types of slowdown at play:

a) It’s fast to change the code, but now I have failures in some apparently unrelated part of the code base. (Javascript) and fixing that slows me down.

b) It’s slow to change the code because I have to re-encode all the relationships and semantic content in the type system (Rust), but once that’s done it will likely function as expected.

Depending on project, one or the other is preferable.

Re:Prediction: AI will make formal verification go mainstream by sothatsit on Wednesday December 17, 2025 @03:58AM (#46299703)
Or: I’m not going to do this refactor at all, even though it would improve the codebase, because it will be near impossible to ensure everything is correct after making so many changes.

To me, this has been one of the biggest advantages of both tests and types. They provide confidence to make changes without needing to be scared of unintended breakages.

Re:Prediction: AI will make formal verification go mainstream by skydhash on Wednesday December 17, 2025 @08:41AM (#46301842)
There's a tradeoff point somewhere where it makes sense to go with one or another. You can write a lot of codes in bash and Elisp without having to care about the type of whatever you're manipulating. Because you're handling one type and encoding the actual values in a typesytem would be very cumbersome. But then there are other domain which are fairly known, so the investment in encoding it in a type system does pay off.
Re:Prediction: AI will make formal verification go mainstream by wolvesechoes on Wednesday December 17, 2025 @02:42AM (#46299255)
Soon a lot of people will go out of the way and try to convince you that Rust is most productive language, functions having longer signatures than their bodies is actually a virtue, and putting .clone(), Rc<> or Arc<> everywhere to avoid borrow-checker complaints makes Rust easier and faster to write than languages that doesn't force you to do so.

Of course it is a hyperbole, but sadly not that large.

Re:Prediction: AI will make formal verification go mainstream by el_pollo_diablo on Wednesday December 17, 2025 @05:01AM (#46300081)
Capturing invariants in the type system is a two-edged sword.

At one end of the spectrum, the weakest type systems limit the ability of an IDE to do basic maintenance tasks (e.g. refactoring).

At the other end of the spectrum, dependent type and especially sigma types capture arbitrary properties that can be expressed in the logic. But then constructing values in such types requires providing proofs of these properties, and the code and proofs are inextricably mixed in an unmaintainable mess. This does not scale well: you cannot easily add a new proof on top of existing self-sufficient code without temporarily breaking it.

Like other engineering domains, proof engineering has tradeoffs that require expertise to navigate.

Re:Prediction: AI will make formal verification go mainstream by GTP on Wednesday December 17, 2025 @06:22AM (#46300733)
In my opinion, programming languages with a loose type system or no explicit type system only appear to foster productivity, because it is way easier to end up with undetected mistakes that can bite later, sometimes much later. Maybe some people argue that then it is someone else's problem, but even in that case we can agree that the overall quality suffers.
Re:Prediction: AI will make formal verification go mainstream by elbear on Wednesday December 17, 2025 @03:12AM (#46299434)
> No one claims that good type systems prevent buggy software.

That's exactly what languages with advanced type systems claim. To be more precise, they claim to eliminate entire classes of bugs. So they reduce bugs, they don't eliminate them completely.

Re:Prediction: AI will make formal verification go mainstream by bonesss on Wednesday December 17, 2025 @03:37AM (#46299580)
No nulls, no nullability bombs.

Forcing devs to pre-fix/avoid bugs before the compiler will allow the app means the programs are more correct as a group.

Wrong, incomplete, insufficient, unhelpful, unimpressive, and dumb are all still very possible. But more correct than likely in looser systems.

Re:Prediction: AI will make formal verification go mainstream by fc417fc802 on Wednesday December 17, 2025 @09:42PM (#46308376)
> No nulls, no nullability bombs.

I hate this meme. Null indicates something. If you disallow null that same state gets encoded in some other way. And if you don't properly check for that state you get the exact same class of bug. The desirable type system feature here is the ability to statically verify that such a check has occurred every time a variable is accessed.

Another example is bounds checking. Languages that stash the array length somewhere and verify against it on access eliminate yet another class of bug without introducing any programmer overhead (although there generally is some runtime overhead).

Re:Prediction: AI will make formal verification go mainstream by yencabulator on Thursday December 18, 2025 @01:30PM (#46316597)
The whole point of "no nullability bombs" is to make it obvious in the type system when the value might be not present, and force that to be handled.

Javascript:

  let x = foo();
  if (x.bar) { ... } // might blow up
Typescript:

  let x = foo(); // type of x is Foo | undefined
  if (x === undefined) { ...; return; } // I am forced to handle this
  if (x.bar) { ... } // this is now safe, as Typescript knows x can only be a Foo now
(Of course, languages like Rust do that cleaner, since they don't have to be backwards-compatible with old Javascript. But I'm using Typescript in hopes of a larger audience.)
Re:Prediction: AI will make formal verification go mainstream by kazinator on Wednesday December 17, 2025 @04:25AM (#46299876)
If you eliminate the odd integers from consideration, you've eliminated an entire class of integers. yet, the set of remaining integers is of the same size as the original.
Re:Prediction: AI will make formal verification go mainstream by moi2388 on Wednesday December 17, 2025 @08:02AM (#46301489)
No, because integers in computing are generally finite.
Re:Prediction: AI will make formal verification go mainstream by petesergeant on Wednesday December 17, 2025 @04:55AM (#46300049)
Peak HN gnomism. While the set of possible errors may be infinite, their distribution is not uniform.
Re:Prediction: AI will make formal verification go mainstream by tmtvl on Wednesday December 17, 2025 @01:06PM (#46303156)
There cannot be infinite bugs in a limited program.
Re:Prediction: AI will make formal verification go mainstream by Hercuros on Wednesday December 17, 2025 @04:04PM (#46305480)
How do you count how many bugs a program has? If I replace the Clang code base by a program that always outputs a binary that prints hello world, how many bugs is that? Or if I replace it with a program that exits immediately?

Maybe another example is compiler optimisations: if we say that an optimising compiler is correct if it outputs the most efficient (in number of executed CPU instructions) output program for the every input program, then every optimising compiler is buggy. You can always make it less buggy by making more of the outputs correct, but you can never satisfy the specification on ALL inputs because of undecidability.

Re:Prediction: AI will make formal verification go mainstream by kazinator on Wednesday December 17, 2025 @02:36PM (#46304423)
Programs are not limited; the number of Turing machines is countably infinite.

When you say things like "eliminate a class of bugs", that is played out in the abstraction: an infinite subset of that infinity of machines is eliminated, leaving an infinity.

How you then sample from that infinity in order to have something which fits on your actual machine is a separate question.

Re:Prediction: AI will make formal verification go mainstream by gls2ro on Wednesday December 17, 2025 @01:39PM (#46303613)
Because the number of state where a program can be is so huge (when you consider everything that can influence how a program runs and the context where and when it runs) it is for the current computation power practically infinite but yes it is theoretically finite and can even be calculated.
Re:Prediction: AI will make formal verification go mainstream by skissane on Wednesday December 17, 2025 @03:22AM (#46299487)
> For LLMs, there is an added benefit. If you can formally specify what you want, you can make that specification your entire program. Then have an LLM driven compiler produce a provably correct implementation. This is a novel programming paradigm that has never before been possible; although every "declarative" language is an attempt to approximate it.

The problem is there is always some chance a coding agent will get stuck and be unable to produce a conforming implementation in a reasonable amount of time. And then you are back in a similar place to what you were with those pre-LLM solutions - needing a human expert to work out how to make further progress.

Re:Prediction: AI will make formal verification go mainstream by GTP on Wednesday December 17, 2025 @06:15AM (#46300668)
With the added issue that now the expert is working with code they didn't write, and that could be in general be harder to understand than human-written code. So they could find it easier to just throw it away and start from scratch.
Re:Prediction: AI will make formal verification go mainstream by Marazan on Wednesday December 17, 2025 @04:19AM (#46299835)
> For LLMs, there is an added benefit. If you can formally specify what you want, you can make that specification your entire program. Then have an LLM driven compiler produce a provably correct implementation. This is a novel programming paradigm that has never before been possible; although every "declarative" language is an attempt to approximate it.

That is not novel and every declarative language precisely embodies it.

Re:Prediction: AI will make formal verification go mainstream by naasking on Wednesday December 17, 2025 @12:14PM (#46302368)
I think most existing declarative languages still require the programmer to specify too many details to get something usable. For instance, Prolog often requires the use of 'cut' to get reasonable performance for some problems.