21 comments

  • hresvelgr 1 hour ago
    "Beware of bugs in the above code; I have only proved it correct, not tried it." — Donald Knuth

    Formal correctness does not guarantee desired function. People have written TLA+ specs for their software[1] and not have it materially improve the quality or reliability. You cannot just throw formal verification at a problem.

    I am very much of the opinion that crap code is an issue of organisation and aesthetics, and that can be automated. This is something that is enforced by frameworks, and despite the popular consensus that LLMs are good at frameworks because of training data, I make another argument that LLMs are good at them because frameworks massively restrict the possibility space of code that can exist and enforce a consistent organisation and aesthetic. The solution as I see it is to make more restrictive frameworks that have a higher chance of producing desired functionality, then afterward we can worry about correctness.

    [1] https://jepsen.io/analyses/particledb-1.1.4

    • latentsea 34 minutes ago
      Quite ironically I see formal methods being extremely key to your central argument. That is, the design should be started by modelling with some formal language that then gets expanded into an implementation. I fully agree about massively restricting the possibility space of code as being why they work. I've found that to basically be the only thing that produces consistently good results in the face of all the non-determinism. The entire codebase doesn't fit into the context window though, but formal models of it can act as some form of lossy compression that helps it fit into the context window better. I think formal methods definitely have a role to play, as to do anything that restricts what the valid moves are like frameworks and fitness functions etc.
    • vikramkr 32 minutes ago
      The same limitation is true of every other method of verifying and validating software too. You can have 100% unit test coverage and still have nothing work. It's another tool in the toolkit and a pretty powerful one
      • alphanumeric0 2 minutes ago
        The "it's not a silver bullet, thus not worth mentioning ever again" argument is getting tiresome.
    • FridgeSeal 38 minutes ago
      > People have written TLA+ specs for their software[1] and not have it materially improve the quality or reliability

      Given how vibe coded the rest of that whole DB appears to be, and the number of holes the Jepsen test found, I’m not terribly sure I’d trust, or use it as an example of “used formal methods”.

      A better example would be the AWS S3 team who used TLA+ to formally verify their permissions model, especially around whether something was publicly accessible.

    • behnamoh 5 minutes ago
      > Formal correctness does not guarantee desired function. People have written TLA+ specs for their software[1] and not have it materially improve the quality or reliability.

      Boris said they heavily use TLA+ for Claude Code and they've noticed an improvement. Comparing CC with 6 months ago, it has indeed improved in terms of reliability and screen flicker, etc.

    • ggm 41 minutes ago
      Our first year CS Pascal lecturer in '79 used to quip "I've compiled this but not run it" and I used to think this was savage but I now see he was simply repeating the mantra. The Fortran I did on cards in '76 they insisted we run, and learn the cost of sloppy code in the debug cycle through batch processing cycle costs.
    • remywang 18 minutes ago
      > ParticleDB’s home page advertised that ParticleDB was “formally proven” with a TLA+ proof. However, during our collaboration no TLA+ specification was available. It is unclear what properties might be proven, or whether they described ParticleDB as built.

      That link is a pretty weak strawman. Also TLA+ is special in that it (usually) does not directly verify the implementation but a model of it.

    • globular-toast 23 minutes ago
      Frameworks often lead to crap code because people don't recognise when they're doing something the framework isn't good at. Do we expect LLMs to be better? So far they're a lot worse and will happily churn out reams of code that would make even the worst programmer stop in their tracks questioning whether this is right.
  • aenis 9 minutes ago
    30 years ago, my then boss, a PhD in industrial automation theory, told me formal verification of even simple systems is impossible due to the practically infinite number of states systems can occupy. I have been thinking about this a lot over the years, and I still think this is the case, even more so than before with the bloat that introduces insanely fuzzy edges to any state graph. I wonder if there is really any chance of this becoming a viable concept for systems more complex than a tic-tac-toe game.
    • Retr0id 6 minutes ago
      It's possible to design with verifiability in mind (e.g. something like seL4)
  • JacobAsmuth 51 minutes ago
    Sounds like you'd be interested in Qed! The web framework I'm building which compiles lean to native js for the frontend and rust for backend, using prorobuf for communication between the two.

    I reimplemented the entirety of the css grammar and fully verified the data model, hydration/dehydration pipeline, and can even formally prove accessibility properties at compile time (e.g. contrast > 4.5).

    I'm currently working on reimplementing the full sql grammar to allow you to formally verify your queries (and even row level security policies!) at compile time.

    https://github.com/JacobAsmuth/qed

    • robin_reala 30 minutes ago
      I’d be wary of saying “formally prove accessibility”. Leaving aside the problems of computing contrast over differing surfaces (e.g. a gradient, and image or an animated surface) on a responsive site at build time, accessibility is a vastly bigger subject than just colour contrast and focusing purely on compliance to a set of rules isn’t going to get you very far.

      Or rather, zero problem with accessibility linting, but don’t oversell it.

  • porcoda 16 minutes ago
    Dafny, SPARK Ada, Why3, Verus, Frama-C, TLA+, etc. are all sort of in this direction for different languages and styles of verification. It is nice to see them getting attention now that LLMs make them digestible for a broader set of programmers. I'm not sure one can start with a goal of creating a "mainstream" language that is verification-oriented. Mainstreamness comes from adoption. I'd look at those past languages (like the ones I listed), and ask "why did these not go mainstream" or "why did they not see broad adoption", and try some new ideas to address their gaps to see if a new one will catch on. But the "mainstream" part seems backwards as the goal - if it’s verifiable, ergonomic, flexible, and accessible, maybe it will go mainstream.
  • unignorant 22 minutes ago
    I've been working on something similar that compiles to WebAssembly without GC and can give a proof/verification layer (though demonstrated with Bend rather than Lean). Unlike the author's approach, it has a C-like type system combined with Racket-style metaprogramming that allows for the higher-level layers (e.g., memory safe languages, dependently typed languages) to be defined defined as importable libraries. This allowed the core to be really small (<12k LOC), flexibility for future experimentation on the right kind of verifier, and enabled an initial self-bootstrap.

    I won't share a link here as I tend to dislike replies that advertise personal projects, but I thought this difference in approach might be interesting to the author or others (I went through a somewhat similar evolution to the author in my thinking).

  • Snibz 19 minutes ago
    I don't really understand this sudden obsession in the industry with formal verification
    • lz400 9 minutes ago
      I think it's simple to understand. Most code is now written by LLMs and the bottleneck is verification. If with a few more tokens thrown at TLA+, Lean, etc. we can achieve _guaranteed_ correctness, it's an amazing deal. I'm not saying it's possible or even that it works that way, but that's the dream.
      • DangIsATyrant 2 minutes ago
        Engineers would rather make their own jobs obsolete than have to code review AI code it seems.
    • lioeters 12 minutes ago
      Au contraire, it's both horrifying and impressive that so much of the software industry has grown for decades without formal verification. With the accelerated production ("productivity") of machine-generated code, we're at a threshold where it will become impossible to manage the complexity unless we change our ways.
    • protocolture 17 minutes ago
      1. It sounds cool.

      2. ????

      3. Post Human Singularity or something

  • hedonhermdev 33 minutes ago
    https://github.com/verus-lang/verus

    The lab I worked with for my thesis used Verus for our formally verified Operating System written in Rust. https://mars-research.github.io/doc/2023-kisv-atmo.pdf

    • freakynit 27 minutes ago
      So, we write formal "code" to verify target "code"? How does this help?
  • grohan 10 minutes ago
    Formal verification is not a silver bullet! I am afraid AI has positioned it as the ultimate red herring (and nerd-snipe).

    I recommend reading Cantwell Smith's "The Limits of Correctness" https://dl.acm.org/doi/pdf/10.1145/379486.379512

    The TL;DR is that proofs only show that the program matches a spec, not that the spec matches the world. The gap between "what you can model" and "the real world" is generally too large for formal methods to be useful (outside of narrow domains, where they are highly useful).

    In other words, computing is closer to an empirical science than a formal one.

  • FullGarden_S 13 minutes ago
    We do not need a full-on theorem prover for achieving this.

    Something like ZFC axioms is good enough.

    • 0815beck 3 minutes ago
      this doesnt even make sense.... what do you mean
  • lioeters 34 minutes ago
    Related project I saw recently:

    > TScert: a sound core for TypeScript. An independent checker, whose soundness is proved in Lean

    https://github.com/cristianoc/TScert

  • skybrian 26 minutes ago
    Perhaps Zena is worth looking at since it also targets WebAssembly GC?

    https://zena-lang.dev/

  • Qasaur 7 minutes ago
    The author’s proposal reminds me of the JavaScript framework craze. Industrial-scale formal verification does not require a new language unless your specification involves exotic types which are not supported by any of the mainstream languages. There is still lots of work to be done of course, but projects like Rust’s Verus and Aeneas already provide a clean and modular interface to plug in a formal methods layer, like Lean, without needing to reinvent the wheel.

    Seamless formal verification requires a native formal specification to verify against. In my view, focusing work on formally modelling existing languages (like Rust) or at least a Cartesian closed category subset is far more encouraging to mainstream adoption of formal methods than trying to convince the industry to adopt a new language.

  • 0815beck 7 minutes ago
    "i want to formally verify the program" should be met with the same reaction as "i want to prove that this is true", namely WHAT, what exactly do you want to prove
  • pjmlp 33 minutes ago
    This will never take off without the proper incentives to make companies actually care.

    Management would rather have vibe coding as the next step, following on cheap offshoring, than anything else, and the recent meltdowns aren't going to deter them, without liability in place.

  • agnishom 35 minutes ago
    How will having a formally verifiable mainstream language save us?
    • m00dy 33 minutes ago
      probably won't. But, it will keep some people busy for sometime.
  • light_hue_1 6 minutes ago
    If Haskell would finally give up on the disaster that is laziness (and by extension GHC) and pivot to formal verification, this could be the killer app.

    Much of what the author wants already exists!

  • aloisdg 14 minutes ago
    F*?
  • globular-toast 27 minutes ago
    Is it part of the joke that the first two links in the post are 404s?
  • JodieBenitez 30 minutes ago
    Yet another article claiming software quality is "nose-diving" because of AI, while we're piling [insert anything]2root exploits based on decades of real human sloppiness. Meanwhile, in-house software keeps getting better.
  • protocolture 17 minutes ago
    > fully embrace formal verification, all the way down to the foundations of our civilizational software stack.

    I am getting so tired of LLMs being used as leverage for people to basically thrust their random viewpoint and make it all philosophical.

    "LLMs mean my thing is best and everyone needs to do it or become post-civilizational transhuman paperclips"

    I almost wish the stupid AI safety sex cult could convince Sanders and Trump to nuke us back to the stone age if only to save us from the onslaught of low-quality bad faith takes.

  • conrs 7 minutes ago
    [dead]