24 comments

  • thesecretsquad1 hour ago
    I&#x27;m not half as smart as most of the people on HN and I don&#x27;t know much about formal verification, so maybe this is a dumb question....<p>My understanding of this is: You write a &quot;contract&quot; 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&#x27;s logically consistent. Then you build the implementation and the implementation can be proven to abide by the contract (or not).<p>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 &quot;you built the thing right&quot;, but &quot;you didn&#x27;t build the right thing&quot;.<p>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.<p>My question then is: Assuming everything I just said isn&#x27;t nonsense, aren&#x27;t we still in the same place as before? Someone needs to know how to specify (and program) the right behavior?
    • iamwil1 hour ago
      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&#x27;re right that it proves the protocol, but not necessarily the implementation.<p>A not-quite-there way to close the gap is that you can generate traces from the spec&#x2F;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.
    • kettlecorn27 minutes ago
      It helps substantially because it disentangles subjective and objective programming.<p>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.<p>Once you&#x27;ve established what you want fulfilling that is an objective task.<p>Today&#x27;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.
    • pratzc071 hour ago
      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 &quot;what&quot; not the &quot;how&quot; you still need someone who understands the requirement but they don&#x27;t have to get every single edge case right. If a model writes both the implementation and the proof, the checker doesn&#x27;t care who wrote them. Human review shrinks from &quot;read all the generated code&quot; to &quot;read the spec&quot;.
      • Joker_vD27 minutes ago
        &gt; The spec is far smaller than the implementation.<p>That heavily depends on what problem you&#x27;re trying to solve. The very example from TFA is quite illustrative:<p><pre><code> contract ReplaceElement { function replace(words: &amp;mutable Slice&lt;UInt64&gt;, index: UInt64, value: UInt64) -&gt; UInt64 requires index &lt; words.len ensures result == old(words[index]) and snapshot(words) == update(old(snapshot(words)), index, value) terminates effects { read(words), write(words) } } implementation InlineReplaceElement of ReplaceElement { function replace(words: &amp;mutable Slice&lt;UInt64&gt;, index: UInt64, value: UInt64) -&gt; UInt64 { let previous = words[index] words[index] = value previous } } </code></pre> Or take, for instance, this spec in English prose: &quot;given a predicate that returns true or false for each value, and a list of values, `filter` returns a new list that contains exactly the values in the original for which the predicate returned true&quot;. I guarantee you that turning this into the Truss contract would produce a significantly larger amount of code that the implementation that would consist of just the following 5 lines, modified accordingly:<p><pre><code> result := []{} for _, v := range list { if predicate(v) { result = append(result, v) } } return result </code></pre> And of course, please note that the spec I&#x27;ve given is defective: it doesn&#x27;t say anything about the order of the elements in the resulting list, or the presence&#x2F;absence of duplicates. Also, you probably will have to insist on the predicate being a pure or at least a repeatable (reproducible?) function — I don&#x27;t know how you&#x27;ll spec `filter` when it&#x27;s given a non-idempotent predicate.
    • ahussain1 hour ago
      I would assume that the contract is much more concise than the implementation to satisfy that contract. Therefore, it&#x27;s much easier for a human or AI to maintain.<p>It&#x27;s a bit like writing and maintaining a declarative SQL query (new-style) vs writing a query planner (old-style programming).
    • andoando1 hour ago
      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?<p>There is also something excellent formal code produces: modularity
  • grahamlee3 hours ago
    Difficulty: no existing model is trained on Truss. They have been trained on examples of design by contract in other languages (Ada, Eiffel, Java etc) and would do a better job with those and with contract-enforcement rules. Or even with grammar-constrained output and those languages.<p>Source: I also tried writing an agent-optimized language (for concision and adaptability, not correctness), then I measured.
    • spankalee2 hours ago
      This is not my experience at all. LLMs universal translation abilities let them pick up new languages really easily, especially if they borrow from existing languages and are consistent.<p>I&#x27;ve been building a new programming language, Zena [1], for a year and modern Claude and Gemini have absolutely no problem generating the code with about a 300-line skill: <a href="https:&#x2F;&#x2F;github.com&#x2F;elematic&#x2F;zena&#x2F;blob&#x2F;main&#x2F;skills&#x2F;zena&#x2F;SKILL.md?plain=1" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;elematic&#x2F;zena&#x2F;blob&#x2F;main&#x2F;skills&#x2F;zena&#x2F;SKILL...</a><p>(I also happen to be adding contracts and formal verification for gen AI, maybe similar to Truss, but that targets Wasm for sandboxing).<p>[1]: <a href="https:&#x2F;&#x2F;zena-lang.dev&#x2F;" rel="nofollow">https:&#x2F;&#x2F;zena-lang.dev&#x2F;</a>
    • brightball2 hours ago
      I saw a talk this year from one of the Pony Lang folks talking about this exact problem and how they essentially taught Pony to Claude.<p><a href="https:&#x2F;&#x2F;carolina.codes&#x2F;speakers&#x2F;2026&#x2F;redvers-davies" rel="nofollow">https:&#x2F;&#x2F;carolina.codes&#x2F;speakers&#x2F;2026&#x2F;redvers-davies</a><p>It was really interesting. Pony is also deeply underrated.
      • btown1 hour ago
        That&#x27;s a great talk, and it has a resonant quote: &quot;If you let your LLM us a general purpose language, your LLM has to solve all those hard problems instead. Good languages make the illegal impossible.&quot;<p>I think there&#x27;s some truth here: linters and compilers for general purpose languages are only so powerful, and LLMs will always be tempted to use patterns they&#x27;ve seen before when they&#x27;re knee-deep in a language they <i>think</i> they understand how to use for your problem. Restricting them to think about problems from first principles in languages with clear <i>and</i> enforced guidelines about data sharing, ownership, traceability, etc. can be very powerful.<p>Direct link to talk: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=oU5sV1ljTzs" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=oU5sV1ljTzs</a>
    • malloc20481 hour ago
      <i>raise hand</i><p>Here someone else who tried to write a coding agent optimized programming language, but I asked it to optimize for cost. Using less tokens is an obvious one but while working on it the actual engineer (LLM) decided that saving on tokens would be marginal savings compared to being able to write the same quality code by a cheaper model. But it never found out how.<p>After a couple of hours seeing benchmarks in which it lost from Python on pretty much everything, it told me to give up. I did.
      • mikece55 minutes ago
        Maybe the answer isn&#x27;t to create a new language for AI, but add to Python the things that Claude tells me makes other languages better for some things, like type safety and a try compilation step to find errors way ahead of runtime.<p>(Or did I just describe something that has been done eleven times already?)
        • freeone300044 minutes ago
          `ty` and `mypy` are efforts to add this to python. It&#x27;s fairly inconsistent because of the vast library of python code that doesn&#x27;t use it, much like early typescript. Unlike typescript, however, there&#x27;s not the huge push right now to adopt because python coders are happy where they are.
    • capv3 hours ago
      +1. You cannot teach AI a new programming language with prompts. In order to be efficient the language has to be in its &quot;brain&quot;, i.e., AI&#x27;s neural network has to be trained on large number of samples.
      • amterp54 minutes ago
        &gt; You cannot teach AI a new programming language with prompts<p>Incorrect. I built my own programming language [0] and agents just look up the docs and write it with great success. It helps to have static linting&#x2F;analysis of course, but they always do just fine writing Rad despite it being very small.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;amterp&#x2F;rad" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;amterp&#x2F;rad</a>
      • rfgplk3 hours ago
        They already have been trained, on other languages that provide similar-enough constructs to translate over to the new language. Same principle as how a C++ developer can write Rust after looking at a few syntax examples.<p>For instance:<p><pre><code> contract ReplaceElement { function replace(words: &amp;mutable Slice&lt;UInt64&gt;, index: UInt64, value: UInt64) -&gt; UInt64 requires index &lt; words.len ensures result == old(words[index]) and snapshot(words) == update(old(snapshot(words)), index, value) terminates effects { read(words), write(words) } } </code></pre> This is _extremely_ similar to JS&#x2F;Rust&#x2F;Java style syntax mixed with common forms from general ALGOL descendant languages. LLMs should have no trouble writing this whatsoever.
        • cyanydeez3 hours ago
          you don&#x27;t want anything thats extremely close; you want something that is dissimilar and users very cogent keywords.<p>Similarity shits up context very quickly.
    • latentsea2 hours ago
      If any such language gets adoption or even seems like a promising direction, I think in this day and age it should be trivial for the labs to RLVR it into the model with synthetic data.<p>Edit: if you use local models you could probably fine-tune or do a LoRA for it yourself.
    • rfgplk3 hours ago
      Incorrect. Models can actually adapt to new syntax quite easily, even with zero training material. Of course that does depend on how truly novel your syntax &amp;&amp; constructs are, but generally speaking if you don&#x27;t deviate too-too far from conventional wisdom you should be fine. My language is quite exotic in fact and frontier LLMs have no trouble writing it, as long as you supply a .bnf file.
      • DonaldPShimoda3 hours ago
        It&#x27;s funny: if we were talking about programming languages generally, I would pop in to say something about how syntax really doesn&#x27;t matter and a language having &quot;exotic&quot; syntax is almost entirely irrelevant. But since LLMs <i>only</i> interact with syntax, it&#x27;s interesting that they are seemingly able to adapt to novel syntax fairly well.
      • dom962 hours ago
        They do fine even with completely novel syntax. I built a programming language designed to be hard for LLMs[1] with syntax that no other programming language uses and most can get the hang of it pretty quickly.<p>1 - <a href="https:&#x2F;&#x2F;killswitch-lang.org" rel="nofollow">https:&#x2F;&#x2F;killswitch-lang.org</a>
      • six_seven2 hours ago
        Dumb question maybe (IANAAIPowerUser)- this new teaching will now always occupy some part of the working context right? As a result of that 1) Do you have smaller usable context? 2) Does the model over-use the new teachings?
  • alexanderabakah2 hours ago
    Great idea, but I believe AI you can&#x27;t make an ML model efficient just through prompts. You must train the model with the language and vast samples of code written in that language. Even with python which is ubiquitous, something models struggle with optimization or smart algorithms it hasn&#x27;t seen during training.<p>I guess the best way will be to improve on existing languages by adding the contracts and verification methods on top of them.
  • sureglymop2 hours ago
    Maybe I am finally getting old but I remember `truss` as a sort of `strace` alternative.
    • onedognight2 hours ago
      MocOS still ships `dtruss`, but it’s hobbled compared to Linux’s `strace`.
  • npalli33 minutes ago
    Declaring the contract, provider etc. in quasi-Rust? No thanks. I think there should be better ways to do that.
  • abeppu2 hours ago
    Proofs about program correctness are great but I don&#x27;t think this even really attempts to argue why a new language is needed or what this does better than other systems in the space. The only other language mentioned in this project page is Rust as &quot;a small step&quot;, but doesn&#x27;t mention F*, Dafny, Idris, Verus, CakeML etc. I think basically all of these have some greater burdens for authors which previously made them realistic for only some projects, but now that we can have agents deal with those headaches, maybe they should expect to see broader use.
    • miffy90055 minutes ago
      it&#x27;s interesting you mentioned Dafny, as after taking a look myself, I see the method specification syntax that Truss uses, has keywords like ensures and requires which is straight up from Dafny, which itself is a Microsoft Research language made by a person who worked on SpecSharp (basically contracts for .NET). I couldn&#x27;t find a connection between Truss&#x27;s author and Microsoft, so I do wonder if he maybe got an LLM to design the syntax, which then included prior art from Microsoft etc.
  • wavemode1 hour ago
    How does this differ from just plain Lean?
  • irdc1 hour ago
    Considering LLM performance tends to depend on how well a particular language was represented in its training set[0], is this even going to work?<p>0. <a href="https:&#x2F;&#x2F;esolang-bench.vercel.app&#x2F;" rel="nofollow">https:&#x2F;&#x2F;esolang-bench.vercel.app&#x2F;</a>
    • ModernMech55 minutes ago
      That paper is benchmarking esolangs, which are meant to demonstrate concepts, not to be usable —- some of them try to be as unusable as possible. So it’s the pathological case.
      • irdc23 minutes ago
        But that&#x27;s usability from a human perspective; an LLM shouldn&#x27;t be bothered by it.
  • Kuyawa2 hours ago
    I&#x27;ve been beating this drum for some time, this is the way forward
  • mathisfun1231 hour ago
    This doesn&#x27;t work without a formal spec for the target ISA.
  • deathhawk1 hour ago
    [dead]
  • rahen2 hours ago
    Original commit two days ago with +663,934 lines of Rust. Eight commits. Already reposted six times on HN since then.<p>I&#x27;m not sure I want to bother with something where the only human involvement was generating the hype.
    • ModernMech36 minutes ago
      Assuming the human is even doing the hype. I think if the author isn’t actively participating in the discussion they tried so hard to get going, we can (or should) just assume they’re a bot.
  • pwdisswordfishq3 hours ago
    Named for having the lifespan of an iceberg lettuce?
    • nmstoker1 hour ago
      Great name for their test suite!
    • Lio22 minutes ago
      There&#x27;s got be a bad with <i>cache</i> joke in there somewhere.
    • louthy2 hours ago
      Each program takes 49 days to run, and then never runs again having destroyed the computer that it was running on.
    • ltrg1 hour ago
      Had to actually read the comments to find this after Ctrl-F &quot;liz&quot;, Ctrl-F &quot;brit&quot; failed me.
    • phoghed3 hours ago
      Named for how you have to respond to people at work questioning wtf you’re doing. “We got this bro. Truss”
  • ivanjermakov52 minutes ago
    &gt; Traditional programming language: Optimize for human editing, Optimize for convenience, Minimize human authoring time<p>Nothing is better than a fresh load of false dichotomy.
  • meitham1 hour ago
    Lovely idea, but I reckon the lettuce on my shelf will probably outlast this language!
  • joshheitzman1 hour ago
    &gt; optimized for agent-written software<p>Benchmarks or it wasn&#x27;t optimized.<p>I followed the link, poked around, and couldn&#x27;t find any benchmarks results.
  • pmkary1 hour ago
    If it ain&#x27;t gonna formal verify, it ain&#x27;t gonna rhyme (just as demonstrated)
  • semiinfinitely1 hour ago
    so the idea is to invent a new programming language that agents have not been trained on for trillions of tokens, and somehow they&#x27;re supposed to be better at it than all the languages they <i>have been</i> trained on for trillions of tokens??
  • IshKebab1 hour ago
    The trouble is: a) if you want formally verified software you can write it in Lean - AI is extremely good at that, and b) why should I use your 3 day old vibe coded language when I can just as easily make one myself?
  • acedTrex3 hours ago
    Its hard to hate a project more than this to be honest. What an anti human way to think.
    • nonethewiser59 minutes ago
      Why does that bother you? Its a programming language for an AI, of course it&#x27;s not for humans.
    • IKnowMazin1 hour ago
      Agreed
  • ordesign1 hour ago
    [dead]
  • theturtle2 hours ago
    [dead]
  • Incipient1 hour ago
    We&#x27;ve had a few similar formally verifiable, contract based, provable languages appear recently.<p>Isn&#x27;t that whole concept covered by a test suite? The language can&#x27;t know what you want to do, so you have to write a contact&#x2F;rule&#x2F;etc for it - in the same way you&#x27;d write a test?
    • qayxc1 hour ago
      No. Tests can only uncover the presence of errors, never their absence. Ideally, pre conditions, post conditions, and invariants are part of every function. Nothing new really. Languages like Eiffel have been doing this for decades, but everything old is new again, I guess.