Rendered at 19:03:31 GMT+0000 (Coordinated Universal Time) with Cloudflare Workers.
thesecretsquad 4 days ago [-]
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?
iamwil 4 days 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'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.
finiteloop 4 days ago [-]
I am the Truss author. In Truss, the proof associated with a program explicitly proves it meets the contract. You're right the contract is declarative, and the proof is what proves the compliance of the imperative code to the contract.
gpm 3 days ago [-]
The spec is also nice in that higher level abstractions check they're using the lower level ones according to actual specified behaviour not intended behaviour.
E.g. with a normal programming language a bug in the hash-map internals that rarely returns the wrong element is undectable. With a spec, if the spec says it can ever return the wrong element, I'm going to run head first into that when I try and prove that my pathfinding algorithm using that hashmap for memoization is correct.
rsrsrs86 3 days ago [-]
I don’t need to specify all steps, you need to know what correct means in your system. Then you find the steps to get there. The spec for a sorting algorithm says that the output is a permutation and that no element at I > J is smaller than the element at J. This is true for any sorting algorithm no matter the steps ie quick sort merge sort will have different steps but same spec
dominotw 4 days ago [-]
> spec is often declarative
ppl always come with weird workarounds to put in loops and if conditions and then throw it all away to use a general purpose programming languge
drfloyd51 4 days ago [-]
Maybe try not doing that?
cjfd 4 days ago [-]
You are not in the same place because the specification does not have to run on a computer. For instance, it could be horribly slow if it were actually executed. In the realm of optimization formal specification really shines because it is the situation where something relatively simple can be specified but the implementation is very complex. Furthermore, a specification does not in all case have to specify everything but instead can specify the essential properties that a system has. For instance, a permission system could have the property that a user who lacks a certain permission can never obtain information that he does not have the right to see but the detail of how that is implemented are not in the specifications. Also, for instance, specify that a system cannot crash or leak memory.
In situations where the specification is as complex as the program one should really wonder if one is doing the right thing.
kettlecorn 4 days ago [-]
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 4 days 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 "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".
Joker_vD 4 days ago [-]
> The spec is far smaller than the implementation.
That heavily depends on what problem you're trying to solve. The very example from TFA is quite illustrative:
contract ReplaceElement {
function replace(words: &mutable Slice<UInt64>, index: UInt64, value: UInt64) -> UInt64
requires index < 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: &mutable Slice<UInt64>, index: UInt64, value: UInt64) -> UInt64 {
let previous = words[index]
words[index] = value
previous
}
}
Or take, for instance, this spec in English prose: "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". 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:
result := []{}
for _, v := range list {
if predicate(v) { result = append(result, v) }
}
return result
And of course, please note that the spec I've given is defective: it doesn't say anything about the order of the elements in the resulting list, or the presence/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't know how you'll spec `filter` when it's given a non-idempotent predicate.
hansvm 3 days ago [-]
Yes, but there's an implicit assumption that many parts of the contract are easier to understand than the corresponding code.
Take sorting as an example. Verifying any one instance is easy even in something like Python
all(a<=b for a,b in zip(L,L[1:]))
Which wasn't really made for the task. If you have theorem proving as part of your contracts then that just gives you extra confidence above and beyond however else you're verifying them. Note that this is much easier to understand even if you don't know Python than a typical sorting algorithm.
I've personally never seen a contract system properly handle business rules well (the set of rules is usually about as verbose and we'll abstracted as the top-level code implementing them, and bugs are typically exactly the issue you posed, that the rules were improperly specified), so I'm skeptical of this approach.
rsrsrs86 3 days ago [-]
My MSc is a spec for a business system. It’s a state machine in Alloy. For accounting. Basically it is free of a lot of accounting errors. It is painful to write such a spec. Very much so. But it pays off handsomely. Throwing my thesis in an LLM generates amazing software. It took two years to write so yep that’s not something you can do easily. On the other hand asking an LLM to write a spec given the natural language version of the thesis say yields a terrible Alloy model! So it pays off if your software is mission critical
hansvm 3 days ago [-]
I think my point is that for business logic I often see code like
Getting the spec right is not just equally hard to getting the code right; it's equally hard in _exactly_ the same ways.
And that doesn't invalidate the use of specs and formal verification. I use them a lot, especially any time I touch nontrivial concurrent code (which is most concurrent code).
It also doesn't invalidate it for any specific use case (accounting seems like a classic example where there are known invariants which are easy to prove and harder to get right).
As a new language tailored for LLMs though, the presence of specs doesn't seem to me like it'll solve enough of the normal classes of errors to pay for its complexity budget. It doesn't seem, by itself, like the next big thing. Without some solution to that "business logic" problem I mentioned, which very well might include formal methods as a component, my baseline prediction would be a resounding lack of notable success for the project on almost any axis the author cares about. I'm happy to be proven wrong of course; I really do like when people succeed, especially with clever new ideas; but my normal optimism is wavering here.
seanmcdirmid 4 days ago [-]
You can write a contract in natural language also and get more expressiveness, or do both. I think this language (formal contracts only) is a bit ambitious or maybe just not general yet? Regardless, you (humans and LLMs) can actually reason about contract correctness in terms of whether it is over or under specified, and if it is well grounded. It is also easier to make informal judgements (again, by humans or LLMs) about building the right thing compared to looking at implementation code. Lastly, when you do find bugs, you can reason about them at the contract level and figure out who to blame and what to fix more quickly (via contract improvements and then implementation alignment). So we are in a better place than before where we only have implementation code as a source of truth (aka vibe coding).
threethirtytwo 4 days ago [-]
It’s like how type checking proves your program to be correct in terms of types.
Similar to that concept but applied to more than just types.
In fact specifications can be written in the form of types. So for example:
Func(int, int) -> int
Is saying this function takes two integers and the output has to be an integer. That is part of a specification.
You can also write:
Func(int + N, int + M) -> int + M + N
And that’s the sort of thing formal verification is. But it also sort of changes the way you program because you have to build your program from smaller pieces that are axiomatic.
For my explanation you can understand the specification part but writing a program that can be proved to fit the specifications automatically (via the axioms) is harder to illustrate. It’s all very mathy.
gregwebs 4 days ago [-]
Yes, you could say the same things about types, tests, or any other verification (testing) technique. They are all tools in a toolbox. Traditionally contracts and proofs have not been well integrated with the language and the cost benefit analysis hasn't been that great compared to other techniques, at least for most projects. We will see more efforts like this one that are trying to change the cost/benefit by integrating with the programming language.
rsrsrs86 3 days ago [-]
Verification is only meaningful with respect to specification, so yeah, either you know what properties to prove, or trust the LLM to come up with the properties you should know. On the other hand it helps a lot in implementing things according to spec
odyssey7 4 days ago [-]
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.
sirsinsalot 4 days ago [-]
Isn't code that works a sufficient spec? By works I mean, meets the stakeholder requirements as they understand them.
odyssey7 3 days ago [-]
Yes, but usually that’s only readable by software engineers, and mixes up the intent (essential complexity) with implementation details (accidental complexity).
In practice, that framing also loses the distinction between expected and actual system behaviors; bugs are impossible by definition because — that’s the spec!
We’re in need of a high-level specification language that suits a product person in partnership with an LLM. Say goodbye to lengthy requirements documents and hello to very rapid implementations — high-fidelity system implementations at the speed at which product can request them.
Maybe software engineers would have a role connecting some of the lower-level pieces or maybe it would completely displace jobs for many of us. As inconvenient as that would be, the purpose of computing is to build useful systems, and a process that does that an order of magnitude better than what we do today would be the right thing to do in the long run. It might even create more demand for software engineers, in that paradoxical way that innovation sometimes works. Hard to say.
ahussain 4 days ago [-]
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 4 days 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?
There is also something excellent formal code produces: modularity
Muromec 4 days ago [-]
>My question then is: Assuming everything I just said isn't nonsense, aren't we still in the same place as before?
You have a point, but the missing piece is the context size needed to iteratively write said contract.
Another angle to look at it -- we already do something like this (TDD) and it works, even if the classic argument says you can have bugs and gaps in your tests
Yes you can, but you can also have good and helpful tests. Also type systems while not being tests are from the same general area -- they express constraints which can be wrong.
Yet another angle to look at it -- it's easier to write a lot of declarative stateless code plus a small library solving general case of the statefullness than writing ton of stateful imperative code. From the correctness standpoint of course.
Add: contract being smaller than implementation is mentioned here, but it's a correlated metric to what I mean above. Even if the contract is longer, it could in theory allow refining different desired properties and their interactions in separate context windows. The contract being longer will also mean it specifies the behaviour in more details.
seanmcdirmid 4 days ago [-]
SDD is different from TDD though. Tests are just a parallel interpretation of the spec in SDD (parallel to the implementation being tested), while in TDD tests are considered a source of truth instead of the implementation (in SDD the spec is the source of truth).
isodev 4 days ago [-]
Correct. Formal verification is indeed mostly vibes slopbros are currently swapping as a buzzword.
The hard part was never expressing the intent in a given language. The hard part is (and always has been) coming up with that intent in the first place.
The concept presented here is soemthing we do anyway in both OO and functional languages. Some syntaxes are more imperative and others are more declarative but nothing ever stops you from shipping behaviours or even tests as a package.
srinivaspadmana 3 days ago [-]
[dead]
wscottco 3 days ago [-]
[dead]
grahamlee 4 days 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.
Source: I also tried writing an agent-optimized language (for concision and adaptability, not correctness), then I measured.
spankalee 4 days 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.
They pick it up but they don't write idiomatic code. As in they write it like they write the languages they are most familiar with. Trying to teach them to use the special features of your language (the entire point of writing it) is not trivial.
burcsahinoglu 4 days ago [-]
Same experience here. I've been building LLMLL, another language no model was trained on. We built small fixtures meant to bait a subtly wrong implementation past its contract and ran them through Claude Opus, gpt-5.5 and Gemini. Across 69 attempts there were zero wrong fills.
Sounds like we overlap a lot. LLMLL has requires/ensures contracts too, and the SMT check you have planned for @verify already runs there over a decidable fragment. Anything outside that fragment is marked asserted or tested, not proven. It compiles to Haskell today, with WASM/WASI on the roadmap as the sandbox. Happy to compare notes.
4 days ago [-]
brightball 4 days 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.
It was really interesting. Pony is also deeply underrated.
btown 4 days ago [-]
That's a great talk, and it has a resonant quote: "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."
I think there'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've seen before when they're knee-deep in a language they think they understand how to use for your problem. Restricting them to think about problems from first principles in languages with clear and enforced guidelines about data sharing, ownership, traceability, etc. can be very powerful.
Did you perform experiments also with formal verified Java? Which tools did you use?
rfgplk 4 days 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 && constructs are, but generally speaking if you don'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.
dom96 4 days 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.
It's funny: if we were talking about programming languages generally, I would pop in to say something about how syntax really doesn't matter and a language having "exotic" syntax is almost entirely irrelevant. But since LLMs only interact with syntax, it's interesting that they are seemingly able to adapt to novel syntax fairly well.
six_seven 4 days 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?
malloc2048 4 days ago [-]
raise hand
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.
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.
mikece 4 days ago [-]
Maybe the answer isn'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.
(Or did I just describe something that has been done eleven times already?)
freeone3000 4 days ago [-]
`ty` and `mypy` are efforts to add this to python. It's fairly inconsistent because of the vast library of python code that doesn't use it, much like early typescript. Unlike typescript, however, there's not the huge push right now to adopt because python coders are happy where they are.
its_luis_serran 2 days ago [-]
[dead]
capv 4 days ago [-]
+1. You cannot teach AI a new programming language with prompts. In order to be efficient the language has to be in its "brain", i.e., AI's neural network has to be trained on large number of samples.
amterp 4 days ago [-]
> You cannot teach AI a new programming language with prompts
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/analysis of course, but they always do just fine writing Rad despite it being very small.
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.
For instance:
contract ReplaceElement {
function replace(words: &mutable Slice<UInt64>, index: UInt64, value: UInt64) -> UInt64
requires index < words.len
ensures result == old(words[index])
and snapshot(words) == update(old(snapshot(words)), index, value)
terminates
effects { read(words), write(words) }
}
This is _extremely_ similar to JS/Rust/Java style syntax mixed with common forms from general ALGOL descendant languages. LLMs should have no trouble writing this whatsoever.
cyanydeez 4 days ago [-]
you don't want anything thats extremely close; you want something that is dissimilar and users very cogent keywords.
Similarity shits up context very quickly.
jeremyjh 4 days ago [-]
I don’t see a need for a new language when we already have Lean - which is a general purpose language that is mostly Haskell but strict and dependently typed (which is far easier to reason about than - for example - all the wizardry behind Servant).
Where it’s not fast enough there is Rust with Aeneas.
nigeltao 3 days ago [-]
For the github.com/google/wuffs language, I've had people send pull requests implementing Brotli and WebP-Lossy in Wuffs, with AI assistance, despite there not being large corpus of existing Wuffs code for the AI to train on.
finiteloop 4 days ago [-]
I am the Truss author. I was worried about this, but with modern models and some specific design considerations of Truss (i.e., its syntax is not exotic), I have not found this to be a meaningful issue. The entire standard library (https://github.com/finiteloop/truss/tree/main/library) was created with GPT 6.2 Sol and it was relatively efficient, and I didn't have to baby sit it very much other than on design issues.
latentsea 4 days 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.
Edit: if you use local models you could probably fine-tune or do a LoRA for it yourself.
sixdimensional 4 days ago [-]
Not hard to fine tune a model though on a specific new language.... even a small one can be pretty effective when fine tuned.
segmondy 4 days ago [-]
Try harder.
alexanderabakah 4 days ago [-]
Great idea, but I believe AI you can'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't seen during training.
I guess the best way will be to improve on existing languages by adding the contracts and verification methods on top of them.
jatora 4 days ago [-]
Well your belief is entirely wrong, because LLM's have shown time and again that they generalize to new languages easily.
alexanderabakah 4 days ago [-]
[dead]
browningstreet 4 days ago [-]
I’m fine with the languages we have for AI programming, but what I wish we had was a more deterministic, operational plane of some kind.
I went around and around today because Claude wrote to obsidian in the wrong folder even though the obsidian vault path was in the env variables. It writes to obsidian 20 times a day and suddenly it writes to a path outside the vault path. The content never synced.
It claimed it went from recall and didn’t check the environment variables. I pointed out that each process wrote successfully to the correct path and it retorted that each effort is a new effort and had nothing to do with previous successful efforts.
These situations require more and more deterministic instructions in AGENTS.md but then it’ll find another way to escape the instructions. It’s an endless digressive evasive cycle.
ivan_gammel 3 days ago [-]
what you describe requires tooling, not instructions. CC can build a tool for scoped markdown editing in 2-3 days with a few confirmations from you, and won’t fail after that.
browningstreet 3 days ago [-]
i get that, and i have lots of scripts that partner with my LLMs for repetitive tasks.
but .. a collection of scripts, with a datastore.. starting to feel like a framework.
ivan_gammel 1 days ago [-]
And this is ok. As soon as your process stabilizes and becomes more deterministic, it is better to switch to algorithmic processing.
abeppu 4 days ago [-]
Proofs about program correctness are great but I don'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 "a small step", but doesn'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.
miffy900 4 days ago [-]
it'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), which itself took the `ensure` and `require` keywords from Eiffel.
I couldn't find a connection between Truss'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.
trealira 3 days ago [-]
Maybe he did, or maybe he was just inspired by prior art. Programming languages rip off each other all the time. Java and C#, for instance, ripped off a lot of C++ syntax.
miffy900 3 days ago [-]
yes obviously - im not saying that's a bad thing. just that from my view, it looks like the author's delegated so much work to the LLM that they themselves don't know the ultimate provenance of much of their own language.
this is a big tell i've noticed with new programming languages these days. 1 - they're increasingly being built using LLMs, with the AI doing more and more design work, not just implementation, and 2 - the human author never acknowledges prior art, because they didn't bother to survey the existing landscape, so they present it, as if this is some new novel thing that's never been done before.
it's one thing to copy from another without attribution, another to independently discover or build the same or similar thing as another, but this is something entirely: to direct an agent to build a language for you, and it copies from prior art and you yourself are unaware of how much was copied and where it came from.
trealira 3 days ago [-]
That's a good point. Your concern seems justified.
I don't know why you would even want to use an LLM for making a programming language to that extent. First, why then do you even want to make one if you're not the main designer anymore? You generally only make a programming language if you have a super novel idea or something frustrates you about other programming languages. Second, there are just so many resources on making your own programming language, including resources on making a proof language, that there's little benefit to using AI anyway; it just seems wasteful.
finiteloop 4 days ago [-]
I am the Truss author. This is always the right and correct question for any new language, and as with most new languages, part of the rationale is "because I wanted to make it."
But more substantively, part of the thesis of Truss is composition of verification:
> When you bind Map to a provider like InlineMap, Truss uses the supplied evidence in package.proof to independently verify its conformance, a simple validation process that can be an order of magnitude faster than constructing the proof itself.
>
> This approach enables formal verification to scale with large code bases, pushing the majority of the work of formal verification to package authors; when you publish a package, you spend as many tokens generating proofs as you do writing the code, and the programs depending on your package don’t need to recreate your efforts.
By (1) explicitly tying the proofs to the language (as opposed to proving independent code, which can stray from what was proven), (2) making the contract claims the basis of proof composition, (3) tying this all together in the packaging system, I have a hypothesis it will make scaling verification more practical, especially in very large codebases.
gf000 3 days ago [-]
So you "accept" a proof at package publish time and then go with that?
Also, aren't function composition known to be bad-behaving, and unfortunately just because you can prove something about f and something about g, f(g) may be prohibitively expensive to prove again? Do you have an idea how common it is?
sureglymop 4 days ago [-]
Maybe I am finally getting old but I remember `truss` as a sort of `strace` alternative.
onedognight 4 days ago [-]
MocOS still ships `dtruss`, but it’s hobbled compared to Linux’s `strace`.
BoxOfRain 3 days ago [-]
For me, Liz Truss ruined all the other trusses.
elviejo 4 days ago [-]
If you wanted Eiffel Contracts why didn't you go directly to the source?
Eiffel Software still exist has proof verifier with autoproof and many tools that make working with high quality code very easy.
wavemode 4 days ago [-]
How does this differ from just plain Lean?
bill10 4 days ago [-]
The programing languages over the years have been optimized for human to write (and then performance). But AI might not care whether it is easy to write or not, just give it enough data to train. So what is to be optimized for agents? Optimized for easier review by human, or optimized for easier functional verification, or something else?
barelysapient 2 days ago [-]
I like the idea. But it seems this could be adopted to most statically typed languages without writing an entirely new language.
deterministic 17 hours ago [-]
Has the Truss compiler been proven correct in Lean or any other verification tool?
Also, the syntax seems quite verbose compared with Lean, Lean is by now the most trusted verification tool on the planet, and LLM’s write excellent Lean and proofs, so what would be the benefit of using Truss compared with Lean?
npalli 4 days ago [-]
Declaring the contract, provider etc. in quasi-Rust? No thanks. I think there should be better ways to do that.
4 days ago [-]
Kuyawa 4 days ago [-]
I've been beating this drum for some time, this is the way forward
mathisfun123 4 days ago [-]
This doesn't work without a formal spec for the target ISA.
irdc 4 days 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?
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.
irdc 4 days ago [-]
But that's usability from a human perspective; an LLM shouldn't be bothered by it.
ModernMech 4 days ago [-]
That's a valid hypothesis, but according the paper apparently they are bothered by writing these languages to some degree compared to others, so is that due to lack of training data or lack of intrinsic unusability?
My hypothesis is that if LLMs are intelligent, they should benefit from usability the same way humans do. Maybe not to the same degree, but more usable languages for humans should be more usable for LLMs compared to pathological unusability. Perhaps you can get around unusability with enough data, or maybe you can get away with fewer training data by being more usable.
Some of these esolanguages might be pathological for LLMs because they require them to engage in thinking they're actually structurally bad at -- Befunge-98 executes in two spatial dimensions, while LLMs process a linear stream of tokens; Whitespace encodes instructions entirely through spaces, tabs, and newlines, potentially confounding tokenizers; Shakespeare uses theatrical dialogue but resembles neither conventional code nor authentic dialogue; Brainfuck effectively requires the LLM to simulate execution while generating code.
So the really interesting question to me at this point is: how much can you change Python or another language that is mainstream before you see the kind of dropoff performance you see with the esolangs? I dunno.
There, they let the LLM write Python code which then wrote the esocode, which at least shows the LLMs understand the assignment. But that doesn't really resolve the question we have.
kamk3 4 days ago [-]
No, esolangs are convoluted because they require entire paradigm shifts of thinking. All mainstream languages are more or less the same, if-then-else, just in different ways, match statements, gotos, monads, whatever. Even if it might not be as strong in a less common one, it can still get a general idea and map it's abstract knowledge on to the new language. I've even seen some complains from people writing in Clojure that "the LLM just defaults back into Python-isms", which doesn't mean that the LLM is bad at the language, just not optimized to it's strengths, like a skilled programmer who's just learning the language. Esolangs require working in entire state machines, it's completely foreign to intellect in general, it's like seeing the world in Game of Life cells, it's just way too much cognitive overhead, for man or machine. That's why some esolangs are so complicated we have to engineer a mathematical solution just to write a simple program in them. You don't need to do that for a mainstream, human-readable language. That's why they're esoteric. Hidden knowledge.
gagan2020 3 days ago [-]
Unpopular opinion,
C is such language that we should target.
- It is Optimize for correctness.
- Small language footprint means easier for human verification.
- Closer to hardware means greater speed.
Memory management should be handled by some library.
trealira 3 days ago [-]
C isn't optimized for correctness, just terseness. It's matched in speed by Rust, C++, and Ada, as well as Zig, Hare, etc. And it's basically impossible to formally verify complicated C software.
It can't even natively handle SIMD instructions, so in most cases you can't write the most efficient code with it.
And we a long history of how well "small language footprint means easier human verification" works.
mehmetkose 4 days ago [-]
what if we could rewrite friendfeed with truss?
deathhawk 4 days ago [-]
[dead]
vfgcees 3 days ago [-]
[dead]
rahen 4 days ago [-]
Original commit two days ago with +663,934 lines of Rust. Eight commits. Already reposted six times on HN since then.
I'm not sure I want to bother with something where the only human involvement was generating the hype.
ModernMech 4 days 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.
pwdisswordfishq 4 days ago [-]
Named for having the lifespan of an iceberg lettuce?
nmstoker 4 days ago [-]
Great name for their test suite!
louthy 4 days ago [-]
Each program takes 49 days to run, and then never runs again having destroyed the computer that it was running on.
4 days ago [-]
ltrg 4 days ago [-]
Had to actually read the comments to find this after Ctrl-F "liz", Ctrl-F "brit" failed me.
Lio 4 days ago [-]
There's got be a bad with cache joke in there somewhere.
phoghed 4 days ago [-]
Named for how you have to respond to people at work questioning wtf you’re doing. “We got this bro. Truss”
meitham 4 days ago [-]
Lovely idea, but I reckon the lettuce on my shelf will probably outlast this language!
ivanjermakov 4 days ago [-]
> Traditional programming language: Optimize for human editing, Optimize for convenience, Minimize human authoring time
Nothing is better than a fresh load of false dichotomy.
ivan_gammel 3 days ago [-]
This is an interesting attempt, but it looks like a niche language for a small subset of tasks (exactly the kind shown in examples). LLM can handle it, sure. However, as we have seen many times before with languages focused on correctness, it all breaks on the environment. I/O, clock, concurrency etc. And everything breaks on domain analysis, unspecified expectations from users, unclear regulatory requirements etc. And of course if you want to build something big, it’s better if you have good tooling supporting large whitespace-preserving edits. For any agentic language it is a must have today.
So, I would expect Truss or similar language to own library side, crypto, parsers etc, but I would not choose it for enterprise or consumer app development.
joshheitzman 4 days ago [-]
> optimized for agent-written software
Benchmarks or it wasn't optimized.
I followed the link, poked around, and couldn't find any benchmarks results.
IshKebab 4 days 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?
dofm 4 days ago [-]
Endless comedy for Brits in the naming here.
Can it do maths?
protocolture 4 days ago [-]
>Truss
How quickly can it unseat the UK government?
semiinfinitely 4 days 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're supposed to be better at it than all the languages they have been trained on for trillions of tokens??
pmkary 4 days ago [-]
If it ain't gonna formal verify, it ain't gonna rhyme (just as demonstrated)
librasteve 4 days ago [-]
bit of a bad choice of name (if your in the UK)
acedTrex 4 days ago [-]
Its hard to hate a project more than this to be honest. What an anti human way to think.
nonethewiser 4 days ago [-]
Why does that bother you? Its a programming language for an AI, of course it's not for humans.
IKnowMazin 4 days ago [-]
Agreed
bitwize 4 days ago [-]
LLMs are a bet to the tune of trillions of dollars against humans. The bet seems to be paying off.
ghanshyam_skile 3 days ago [-]
[dead]
tobi007-del 4 days ago [-]
[dead]
ordesign 4 days ago [-]
[dead]
blusl0918 4 days ago [-]
[dead]
kubawolski 4 days ago [-]
[dead]
theturtle 4 days ago [-]
[dead]
Incipient 4 days ago [-]
We've had a few similar formally verifiable, contract based, provable languages appear recently.
Isn't that whole concept covered by a test suite? The language can't know what you want to do, so you have to write a contact/rule/etc for it - in the same way you'd write a test?
qayxc 4 days 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.
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?
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.
E.g. with a normal programming language a bug in the hash-map internals that rarely returns the wrong element is undectable. With a spec, if the spec says it can ever return the wrong element, I'm going to run head first into that when I try and prove that my pathfinding algorithm using that hashmap for memoization is correct.
ppl always come with weird workarounds to put in loops and if conditions and then throw it all away to use a general purpose programming languge
In situations where the specification is as complex as the program one should really wonder if one is doing the right thing.
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.
That heavily depends on what problem you're trying to solve. The very example from TFA is quite illustrative:
Or take, for instance, this spec in English prose: "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". 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: And of course, please note that the spec I've given is defective: it doesn't say anything about the order of the elements in the resulting list, or the presence/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't know how you'll spec `filter` when it's given a non-idempotent predicate.Take sorting as an example. Verifying any one instance is easy even in something like Python
Which wasn't really made for the task. If you have theorem proving as part of your contracts then that just gives you extra confidence above and beyond however else you're verifying them. Note that this is much easier to understand even if you don't know Python than a typical sorting algorithm.I've personally never seen a contract system properly handle business rules well (the set of rules is usually about as verbose and we'll abstracted as the top-level code implementing them, and bugs are typically exactly the issue you posed, that the rules were improperly specified), so I'm skeptical of this approach.
And that doesn't invalidate the use of specs and formal verification. I use them a lot, especially any time I touch nontrivial concurrent code (which is most concurrent code).
It also doesn't invalidate it for any specific use case (accounting seems like a classic example where there are known invariants which are easy to prove and harder to get right).
As a new language tailored for LLMs though, the presence of specs doesn't seem to me like it'll solve enough of the normal classes of errors to pay for its complexity budget. It doesn't seem, by itself, like the next big thing. Without some solution to that "business logic" problem I mentioned, which very well might include formal methods as a component, my baseline prediction would be a resounding lack of notable success for the project on almost any axis the author cares about. I'm happy to be proven wrong of course; I really do like when people succeed, especially with clever new ideas; but my normal optimism is wavering here.
Similar to that concept but applied to more than just types.
In fact specifications can be written in the form of types. So for example:
Is saying this function takes two integers and the output has to be an integer. That is part of a specification.You can also write:
And that’s the sort of thing formal verification is. But it also sort of changes the way you program because you have to build your program from smaller pieces that are axiomatic.For my explanation you can understand the specification part but writing a program that can be proved to fit the specifications automatically (via the axioms) is harder to illustrate. It’s all very mathy.
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.
In practice, that framing also loses the distinction between expected and actual system behaviors; bugs are impossible by definition because — that’s the spec!
We’re in need of a high-level specification language that suits a product person in partnership with an LLM. Say goodbye to lengthy requirements documents and hello to very rapid implementations — high-fidelity system implementations at the speed at which product can request them.
Maybe software engineers would have a role connecting some of the lower-level pieces or maybe it would completely displace jobs for many of us. As inconvenient as that would be, the purpose of computing is to build useful systems, and a process that does that an order of magnitude better than what we do today would be the right thing to do in the long run. It might even create more demand for software engineers, in that paradoxical way that innovation sometimes works. Hard to say.
It's a bit like writing and maintaining a declarative SQL query (new-style) vs writing a query planner (old-style programming).
There is also something excellent formal code produces: modularity
You have a point, but the missing piece is the context size needed to iteratively write said contract.
Another angle to look at it -- we already do something like this (TDD) and it works, even if the classic argument says you can have bugs and gaps in your tests Yes you can, but you can also have good and helpful tests. Also type systems while not being tests are from the same general area -- they express constraints which can be wrong.
Yet another angle to look at it -- it's easier to write a lot of declarative stateless code plus a small library solving general case of the statefullness than writing ton of stateful imperative code. From the correctness standpoint of course.
Add: contract being smaller than implementation is mentioned here, but it's a correlated metric to what I mean above. Even if the contract is longer, it could in theory allow refining different desired properties and their interactions in separate context windows. The contract being longer will also mean it specifies the behaviour in more details.
The hard part was never expressing the intent in a given language. The hard part is (and always has been) coming up with that intent in the first place.
The concept presented here is soemthing we do anyway in both OO and functional languages. Some syntaxes are more imperative and others are more declarative but nothing ever stops you from shipping behaviours or even tests as a package.
Source: I also tried writing an agent-optimized language (for concision and adaptability, not correctness), then I measured.
I'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: https://github.com/elematic/zena/blob/main/skills/zena/SKILL...
(I also happen to be adding contracts and formal verification for gen AI, maybe similar to Truss, but that targets Wasm for sandboxing).
[1]: https://zena-lang.dev/
Sounds like we overlap a lot. LLMLL has requires/ensures contracts too, and the SMT check you have planned for @verify already runs there over a decidable fragment. Anything outside that fragment is marked asserted or tested, not proven. It compiles to Haskell today, with WASM/WASI on the roadmap as the sandbox. Happy to compare notes.
https://carolina.codes/speakers/2026/redvers-davies
It was really interesting. Pony is also deeply underrated.
I think there'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've seen before when they're knee-deep in a language they think they understand how to use for your problem. Restricting them to think about problems from first principles in languages with clear and enforced guidelines about data sharing, ownership, traceability, etc. can be very powerful.
Direct link to talk: https://www.youtube.com/watch?v=oU5sV1ljTzs
1 - https://killswitch-lang.org
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.
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.
(Or did I just describe something that has been done eleven times already?)
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/analysis of course, but they always do just fine writing Rad despite it being very small.
[0] https://github.com/amterp/rad
For instance:
This is _extremely_ similar to JS/Rust/Java style syntax mixed with common forms from general ALGOL descendant languages. LLMs should have no trouble writing this whatsoever.Similarity shits up context very quickly.
Where it’s not fast enough there is Rust with Aeneas.
Edit: if you use local models you could probably fine-tune or do a LoRA for it yourself.
I guess the best way will be to improve on existing languages by adding the contracts and verification methods on top of them.
I went around and around today because Claude wrote to obsidian in the wrong folder even though the obsidian vault path was in the env variables. It writes to obsidian 20 times a day and suddenly it writes to a path outside the vault path. The content never synced.
It claimed it went from recall and didn’t check the environment variables. I pointed out that each process wrote successfully to the correct path and it retorted that each effort is a new effort and had nothing to do with previous successful efforts.
These situations require more and more deterministic instructions in AGENTS.md but then it’ll find another way to escape the instructions. It’s an endless digressive evasive cycle.
but .. a collection of scripts, with a datastore.. starting to feel like a framework.
I couldn't find a connection between Truss'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.
this is a big tell i've noticed with new programming languages these days. 1 - they're increasingly being built using LLMs, with the AI doing more and more design work, not just implementation, and 2 - the human author never acknowledges prior art, because they didn't bother to survey the existing landscape, so they present it, as if this is some new novel thing that's never been done before.
it's one thing to copy from another without attribution, another to independently discover or build the same or similar thing as another, but this is something entirely: to direct an agent to build a language for you, and it copies from prior art and you yourself are unaware of how much was copied and where it came from.
I don't know why you would even want to use an LLM for making a programming language to that extent. First, why then do you even want to make one if you're not the main designer anymore? You generally only make a programming language if you have a super novel idea or something frustrates you about other programming languages. Second, there are just so many resources on making your own programming language, including resources on making a proof language, that there's little benefit to using AI anyway; it just seems wasteful.
But more substantively, part of the thesis of Truss is composition of verification:
> When you bind Map to a provider like InlineMap, Truss uses the supplied evidence in package.proof to independently verify its conformance, a simple validation process that can be an order of magnitude faster than constructing the proof itself. > > This approach enables formal verification to scale with large code bases, pushing the majority of the work of formal verification to package authors; when you publish a package, you spend as many tokens generating proofs as you do writing the code, and the programs depending on your package don’t need to recreate your efforts.
By (1) explicitly tying the proofs to the language (as opposed to proving independent code, which can stray from what was proven), (2) making the contract claims the basis of proof composition, (3) tying this all together in the packaging system, I have a hypothesis it will make scaling verification more practical, especially in very large codebases.
Also, aren't function composition known to be bad-behaving, and unfortunately just because you can prove something about f and something about g, f(g) may be prohibitively expensive to prove again? Do you have an idea how common it is?
Also, the syntax seems quite verbose compared with Lean, Lean is by now the most trusted verification tool on the planet, and LLM’s write excellent Lean and proofs, so what would be the benefit of using Truss compared with Lean?
0. https://esolang-bench.vercel.app/
My hypothesis is that if LLMs are intelligent, they should benefit from usability the same way humans do. Maybe not to the same degree, but more usable languages for humans should be more usable for LLMs compared to pathological unusability. Perhaps you can get around unusability with enough data, or maybe you can get away with fewer training data by being more usable.
Some of these esolanguages might be pathological for LLMs because they require them to engage in thinking they're actually structurally bad at -- Befunge-98 executes in two spatial dimensions, while LLMs process a linear stream of tokens; Whitespace encodes instructions entirely through spaces, tabs, and newlines, potentially confounding tokenizers; Shakespeare uses theatrical dialogue but resembles neither conventional code nor authentic dialogue; Brainfuck effectively requires the LLM to simulate execution while generating code.
So the really interesting question to me at this point is: how much can you change Python or another language that is mainstream before you see the kind of dropoff performance you see with the esolangs? I dunno.
The authors of that study you linked did a followup: https://esolang-metaprogramming.vercel.app
There, they let the LLM write Python code which then wrote the esocode, which at least shows the LLMs understand the assignment. But that doesn't really resolve the question we have.
C is such language that we should target.
- It is Optimize for correctness. - Small language footprint means easier for human verification. - Closer to hardware means greater speed.
Memory management should be handled by some library.
It can't even natively handle SIMD instructions, so in most cases you can't write the most efficient code with it.
And we a long history of how well "small language footprint means easier human verification" works.
I'm not sure I want to bother with something where the only human involvement was generating the hype.
Nothing is better than a fresh load of false dichotomy.
Benchmarks or it wasn't optimized.
I followed the link, poked around, and couldn't find any benchmarks results.
Can it do maths?
How quickly can it unseat the UK government?
Isn't that whole concept covered by a test suite? The language can't know what you want to do, so you have to write a contact/rule/etc for it - in the same way you'd write a test?