Top
Best
New

Posted by nicolas-siplis 12 hours ago

Bend – A language that blocks AI mistakes via proof, on CPU and GPU(bend-lang.com)
446 points | 209 comments
LightMachine 11 hours ago|
Hi, I'm the author.

HN staff: someone posted before me. Could we change the title to "Bend - a language that blocks AI mistakes via proof and runs on GPUs"?

Everyone: feel free to ask any question, but I'd be highly appreciative if you could be a bit civilized and respectful this time. I've worked on this for 1 year, nearly 16h/day, 7 days a week, and I'm giving it for free. You need not to use it. So, I'd be thankful if you could point occasional failures politely rather than throwing me in a lava pit.

Thank you!

pdpi 11 hours ago||
Don't know whether this is a common outcome, but I tried the "remove the walls" example, and the result was... scary. It completely changed the game so that movement is now diagonal, and made the arbitrary decision that up/down move you on the positive diagonal, and left/right move you on the negative diagonal.

The problem, of course, is that having only the one single "you can't win" law is severely underspecified, but the solution was too clever by half, and highlights the problem with this approach — every program will be under-specified, because, at some point, writing the laws becomes a bigger problem than writing the code itself.

This becomes a real issue because the combination of underspecified but rigid laws pushes the aI towards this sort of "creative" solution that matches the letter but not spirit of the law. In this case, the issue was obvious, but I seriously worry about what sort of shenanigans will occur in less obvious cases.

LightMachine 10 hours ago|||
Exactly, "you can't win" is grossly under-specified. The goal of the demo is just to show that laws can't be broken. Yet, if that's your only law, the AI can do whatever to protect it - including changing how the character moves, or even removing the flag entirely!

So, yes, that's the issue with laws: they only protect what you remember to write. They're not a silver bullet. But they can still be incredibly useful, because it takes a small law to protect against entire classes of bug, covering your entire codebase. For example:

LAW: "the sum of all balances in this contract must be zero"

This one liner would have prevented Ethereum's infamous "The DAO" hack, where millions were stolen and almost undermined the entire project. But if your laws are under-specifying or ill-specifying your intents, Bend can't do anything to protect you.

skissane 9 hours ago||
Thought about automated discovery of laws in an existing codebase?

If you can find a law which the existing code obeys, and show it to a human, and if they agree, save it. And maybe the AI could make a decent guess as to what kind of laws would appeal to a human versus which wouldn't – a simple law identifying a fundamental constraint the system obeys is good, something really complicated or constraining something coincidentally true isn't

Or some kind of measure of coverage? you'd never want 100% – then your laws would become so complex you couldn't follow or maintain them – but if it is very low, that can be a signal to increase it

drfloyd51 7 hours ago||
Discover the laws in a current code base?

They are usually in the “tests” folder.

So anything capable of extracting unit tests is extracting “laws”.

One might consider the test name the text of a law. And the AI fills in the details.

skissane 6 hours ago||
I don’t think that’s right.

Unit tests check whether a specific code module is implemented correctly given its (implicit) specification.

Good “laws” are independent of the structure of the code.

Tests may be a useful source for inferring what the laws are, but much of the actual content of the tests aren’t “laws” at all.

serf 3 hours ago||
I think the premise is more that if one is given a grouping/constellation of unit tests that one can derive generalized laws by looking at what behavior those tests were checking for or against.

if there are a dozen unit tests trying to determine if some regex can escape a sensitive area, then one can derive a generalized 'don't let the regex escape from here' type rule -- or at least you could theoretically. I'm sure in reality that'd be a big minefield much like harness self-skill-writing has been.

tonic_note 10 hours ago||||
Yeah all of these attempts to try and control AI outputs by using language fail to grasp that language is itself the problem. It is a closed system with no ground truth. Words only point to other words in an endless self-referential chain. There is no "closure" in language, ambiguity cannot be erased.

Imo LLM researchers would benefit a lot by reading what continental philosophers have said on the topic of language. Barthes, Sarte, Deluze, Derrida, et. Al have a lot to say that explains why we're running into the same problems over and over.

fortzi 10 hours ago|||
Natural language is ambiguous. Specifying exactly what you want in a way that is truly verifiable is the act of coding.
frank00001 4 hours ago||
Start printing the t-shirts!
shakna 1 hour ago||
You mean t-shirts of this comic, from 2016?

[0] https://www.commitstrip.com/en/2016/08/25/a-very-comprehensi...

corv 8 hours ago||||
Bend would make Dijkstra happy even when proof checking can’t verify if the laws are what was actually meant.

I actually think Asimov is more instructive here, while Gödel and Tarski tell us the tool can’t prove itself…

Nonetheless, it is a worthwhile endeavor and I hope more rigorous practices like this catch on.

krapp 9 hours ago||||
I think LLM researchers understand how LLMs work and what the limits of using natural language as an interface are. The problem is everyone else thinks they're basically magic, expecting them to be infinitely intuitive but also strictly deterministic, like the computer from Star Trek.
cindyllm 9 hours ago|||
[dead]
konart 10 hours ago||||
> writing the laws becomes a bigger problem than writing the code itself.

But that's how it is anyway, no?

Defining clear boundaries and clear goals is the hardest part. If you get those right everything else is rather trivial.

holden_nelson 9 hours ago||||
I got the same result when I tried the "remove the walls" example. I followed up by telling it to reimplement up/down/left/right movement without reinserting the walls and it basically made the square with the flag "unenterable". Like with a force field.

Respectfully I'm not sure if I share your worry though. You would have the same problem if you wrote extremely thorough / exhaustive unit tests or extremely precise types and didn't allow the LLM to amend them. You're basically shrinking the state space of what is considered a "correct" program per your spec. That the LLM has to get extremely creative to break your program is a _feature_; in my experience, an LLM does not have to get creative at all to break a typical program written in an enterprise setting, and that's unfortunate.

pixl97 10 hours ago||||
Heh, We're writing Asimov in real life after been warned to decades.
abraxas 10 hours ago||||
> writing the laws becomes a bigger problem than writing the code itself.

Of course because at its limit programming is basically defining desired behaviour under all circumstances and logical conditions.

thomasfromcdnjs 10 hours ago|||
Well described the problem scope.

I wonder if harness-hooks + Jev (equivalents) could semantically lint for `sloppy_law` etc when ever they are edited

rao-v 11 hours ago|||
Hey Victor! Been following you since HVM/Kind, partly because I'm moderately unhappy with the state of out of the box automatic parallelism in modern languages!

Do you plan to invest in profile guided optimization or autotuning in Bend2 - using runtime profiles / cost models to make decisions around SIMD vs. multicore vs. GPU parallelization?

Bend2's model might give you a really nice view into available parallelization. Heck I can imagine integrating an LLM to profile and optimize in an absurdly expensive `-O7` optimization mode one day!

LightMachine 10 hours ago||
Hi. Yes and of course, I plan to invest in everything that makes Bend better. The language is, in theory, capable of parallelizing perfectly in any setup. Currently, though, only a very simple scheduler is shipped, and you must still tune it manually. We're a small team, but we're not stopping here, and I hope I can make it grow to the point where that kind of tooling becomes part of the ecosystem.
gslepak 11 hours ago|||
Amazing work, one question regarding the guide, it states:

> That same file is the CPU program and the GPU kernel: clang builds it for the host, Metal or CUDA builds it for the device, so a `!` runs the exact same code on either chip.

What exactly is this saying? The guide doesn't really explicitly define `!`, and it's unclear from this sentence whether it's saying that, "clang builds it for the host and Metal, and CUDA builds it for the device", or if it's saying, "clang builds it for the host, Metal, and CUDA, and builds it for the device", or something else entirely.

LightMachine 11 hours ago||
I will improve that phrasing, thanks.

It just means that Bend compiles to a single .c file, and that file compiles to either Metal or CUDA, via macros, depending on your target. This shouldn't be relevant to most users. It is just a way I found to keep the file small and reuse as much code as possible, rather than rewriting the runtime 3 times (once for C, once for Metal, once for CUDA).

didibus 1 hour ago|||
Sorry for not knowing, but in the AI world that we are in, I need to learn more about the creator behind a project to trust it. Something that can help me know why the creator is qualified to deliver on the promises being made, that I can trust their judgement and decision, that they know what they are doing and don't need AI to tell them what/how to do it, and that they are committed long term to the project. Do you think you could share a bit about you that would give me some answers on those?
killerstorm 11 minutes ago|||
A lot of information here:

https://gist.github.com/VictorTaelin/77fd5a2a8a4a07e1da6157e...

https://github.com/victortaelin

dgf18 58 minutes ago|||
[dead]
ble 11 hours ago|||
I like the idea of a language intended from the start to be proved and it seems very compelling given coding agents. It's a good idea that others don't see coming -- so expect it to be frequently misunderstood and even verbally abused!
TimTheTinker 11 hours ago|||
Hi author :wave:

I'm confused - could you explain how the board/flag animation relates to Bend's compile time checking? Is it actually a direct demonstration of Bend running a check?

LightMachine 11 hours ago||
The check is happening in between the animations. When the AI edits the code, Bend will check if all laws still hold, mathematically so. If not, the AI repeats, until that's the case. So, the animations just show what happens to the app with and without Bend's involvement.
avodonosov 11 hours ago|||
Could you recommed literature (preferrably a single book) that does not require prior knowledge and allows to fully understand the logical foundation of it?

(Why it is done the way it is, what problems are solved by affinity, why closure can be called at most once, how a function that never returns can prove anything, and everything else)

LightMachine 10 hours ago||
There isn't a single book that covers all of it... Bend's theory touches various domains (dependent types, substructural types, termination). And then there's the runtime, compiler, GPU kernels...

If you mean about the type theory specifically, "Type Theory and Formal Proof by Nederpelt and Geuvers" is a good introduction. Not sure what I'd recommend on linear types, no book I know of is very introductory? Perhaps "Idris 2: Quantitative Type Theory in Practice", which is a language with similar foundations to Bend, and the author wrote a book on it (and inspired myself!)

alew1 5 hours ago|||
Does Bend have linear types? I didn't see anything on them in a quick skim of the GUIDE file.
LightMachine 5 hours ago||
the entire language is based on linear types! it says so in the GUIDE yes
alew1 1 hour ago||
Ah, thanks, was looking at the readme instead of the guide
avodonosov 10 hours ago|||
Thank you.
holden_nelson 9 hours ago|||
Just wanted to say this is really, really cool, and impressive stuff. Looking forward to reading your papers and playing with it. Thanks for working hard on it and sharing it with us.
hei-lima 10 hours ago|||
Congrats, Victor!

É ótimo ver um brasileiro criando algo tão único!

LightMachine 10 hours ago||
obrigado amg
pasteleft 5 hours ago|||
Thank you for adding a 5-line AGENTS.md. Other projects force you to install skills or MCP even when they're just doing the same thing.
mathisfun123 10 hours ago|||
what happened to your other project? HVM?
LightMachine 10 hours ago||
Surprise - HVM has been reimplemented in Bend 2.

You can find it on Bend's demo directory in our GitHub.

Don't tell anyone though!

mathisfun123 10 hours ago||
i'm asking you what happened to HVM that it needed to be reimplemented as Bend.
LightMachine 10 hours ago||
It didn't "need to", it just evolves by rewrites as I learn (the project is fairly small) so in the latest rewrite I choose Bend!
mmoustafa 11 hours ago|||
honestly just Bend is a great HN title, you can describe it more concretely on the homepage
davidw 10 hours ago|||
Speaking of lava, you should do a presentation to the local tech group if you're ever here in Bend, Oregon...
greenlimetea 9 hours ago||
[dead]
shantnutiwari 4 minutes ago||
Yeah, but this assumes the llm will follow the "Laws". I find llms routinely ignore steering docs etc, even outright instructions. Like "Dont use python", next line it is trying to use Python.

Seems to me the llm will just try to work around the "laws"

mccoyb 7 hours ago||
My read on this, after ingesting a good amount of content on the history, is:

- this Bend is not really related to the old Bend (only in name)

- this Bend doesn't really have anything to do with interaction combinators

- this Bend is a QTT, with a change to affinity which enforces a good performance property for GPUs

- the "higher order at comptime" is neat, reminds me of Andras Kovacs' work on 2ltt and staging in dependently typed languages.

- this Bend is likely to be good at "balanced recursive computations on ADT", and can parallelize them ... but won't be as good as CUDA or e.g. Futhark on dense rectangular array computations

- performance needs improvement in the scheduler, to possibly help with balanced work (looking at the n queens and symbolic regression numbers)?

How are you going to handle search or synthesis over irregular structures (SupaGen)?

snthpy 4 minutes ago||
What?

Thanks for pointing this out. I'm only reading these comments because i liked the interaction combinator Bend language.

Pivots are cool but why reuse the name and cause confusion? What is the old Bend called now?

sigbottle 7 hours ago||
aww man. I remember following victor in college. I mean pivots gotta pivot, and this is probably a better one for business, but always thought the interaction combinator framework was cool
plastic041 7 hours ago||
This project's repo has 20K stars with only 500 forks, with less than 300 issues(including closed). Something's not right.

Compared to other programming languages:

- Gleam: 22K stars, 1K forks, 3K issues

- V: 38K stars, 2.3K forks, 11K issues

- Ruby: 23K stars, 5.6 forks, 19K issues

- Zig: 43K stars, 3K forks, 14K issues

It got 16K stars just in 4 months too. https://www.star-history.com/?repos=bendlang%2Fbend

Also how would anyone trust this? I've never seen a programming language that doesn't have 1) changelogs 2) way to download older versions 3) commit history.

I don't understand why the author thought deleting the commit history was a good idea. Imagine seeing this project for the first time. It's a repo with 20K stars, but no commits, and suspiciously few issues and PRs. It doesn't look legitimate.

---

I'm not familiar with academic procedures, but a pdf on a repo, written by Fable and has no reviews, doesn't seem like a proper 'paper' to me.

cedws 7 hours ago||
GitHub stars have been botted to hell for a long time now. I don't know how the farms acquire so many accounts, last time I tried to register a GitHub account I had to jump through so many hoops. The platform needs an overhaul, starting with requiring a valid payment method for the social features.
0x69420 7 hours ago|||
victor's legit and people have been excited about his work for years; squashing the history was just a bit of an optics oopsie on his part. the star to fork ratio makes perfect sense for something like bend.

- fstar: 3k stars, 267 forks

- coalton: 1.8k stars, 111 forks

- carp: 6k stars, 267 forks

- c3: 5.8k stars, 400 forks

when something is novel/young (not having had time to grow large and accumulate issues in the vein of "1 doc page out of 1000 is worded incorrectly") and (as of yet) niche (innate barrier to entry for contribution because you have to learn from square 1 what all the moving parts look like), you don't see the same activity patterns on public source hosts as with a general-purpose language.

plastic041 6 hours ago||
About forks alone I get it, but look at their issues.

- fstar: 2K issues, stars-issue ratio: 0.6.

- coalton: 700 issues, ratio: 0.4

- carp: 450 issues, ratio: 0.08

- c3: 1.9K issues. ratio: 0.3

Bend has 300 issues for 20K stars so ratio is about 0.02. Maybe their followers starred the repo as a fan activity? It could explain too many stars and too few forks/issues/prs.

LightMachine 6 hours ago|||
The project got a lot of attention at launch, but it wasn't really ready to be used back then. There were too many limitations, like u24 numbers (yes), 2 GB memory limit, pervasive strictness (if-then-else executed both branches). It was just not practical.I think (hope) that explains a lot of it. But honestly there is also my own failure into making the language actually be used, rather than just a viral moment :( I hope it will be different this time!
LightMachine 5 hours ago||
commit history is back now!
0x69420 6 hours ago||||
victor has courted a very llm-enjoyer audience and such people are famously prone to hype (which is kinda brutal in its own way cause the language itself is cool and i dont wanna make it sound like im taking away from that). but yeah, fan activity as you put it easily accounts for the missing order of magnitude, if you like.
debo_ 6 hours ago|||
This obsession over GitHub stars is quite bizarre.
LightMachine 6 hours ago|||
I honestly had no idea people would be so upset about commit history. I just wanted to avoid leaking sensitive info, that's all. I'm running through the commits to ensure nothing personal leaks and I plan on putting the history back.

Also Bend's stars came on the V1 launch. This is V2. It already had 20k before.

plastic041 6 hours ago||
> Also Bend's stars came on the V1 launch. This is V2. It already had 20k before.

This is the reason you should not reomve your commit history. How would anyone know that there were V1, and it was already popular?

If you need to remove sensitive data, you should use tools like git-filter-repo.

- https://docs.github.com/en/authentication/keeping-your-accou...

- https://github.com/newren/git-filter-repo

LightMachine 6 hours ago||
Commit history is back!
meghanto 7 hours ago||
Gotta say, having followed Taelin on this project since mid 2023, this was not the response I expected when this language first dropped.

It's interesting how cosmetics drive discussion, and how HN comments are weirdly divided in a very dismissive or skeptical camp and those acting incredulous and offended at the reaction of the former.

What I expected instead was a lot more discussion about use cases, benchmarking, possibilities, limitations (that aren't about git history) and the scope of future development.

x-complexity 1 hour ago||
> What I expected instead was a lot more discussion about use cases, benchmarking, possibilities, limitations (that aren't about git history) and the scope of future development.

HN had an Eternal September. Such discussions have been drowned out by the rest of the mob.

generalizations 5 hours ago|||
That crowd is moved to X these days, in my experience. HN became mostly the folks who didn't notice.
QwenGlazer9000 4 hours ago||
You can find everything on X, from dumpster fires to peak intellectual, everything in between.
generalizations 2 hours ago||
Less so, here.
mathisfun123 4 hours ago||
hn is just a bunch of wannabes these days. It's still a decent link aggregator but the discussions are exceptionally weak <shrug>
neuroticnews25 1 hour ago||
Every place I ever join is declared a shadow of its former self shortly after, it's like a curse.
svachalek 11 hours ago||
Cool idea. I tried using it to port a little meeting fixer cron job I vibe coded, it seemed a natural fit as its essentially trying to satisfy invariants in my calendar.

It basically succeeded but Claude (Opus 5) did have some complaints:

'Base ships one arithmetic law, U32.add_comm. There is no order theory. About 60 of PROOF.bend's 163 lines are cmp_refl, and_false, and_comm, le_max_l, le_max_r, add_succ — facts you'd assume exist. You'd write them once per project and never again, but budget for them.'

'Base's Nat.max is unusable in a proof. It's Bool.pick(Nat, Nat.is_lt(a,b), b, a), and a proof can't case on a computed value. I wrote a structurally recursive nat_max so it unfolds in lockstep with Nat.cmp.'

'The law I most wanted: "no two output plans overlap." I didn't state it. It needs the sortedness of collapse's input as a hypothesis, and Base's List.sort ships no sortedness law — so getting there means proving merge sort correct first. That's the honest measure of the gap between "provable in principle" and "provable this afternoon."'

I've got basically a minor in CS so I'm a dummy when it comes to proofs. I don't know if this is valuable feedback or simply Claude misunderstanding something.

LightMachine 10 hours ago||
Problem is the stdlib is very small so proving even simple theorems still takes a lot more effort (for the AI) than in Lean. We need a mathlib!
RomanKornev 11 hours ago||
> LAWS.bend

I like the law idea, but what i found they end up doing is they just modify the law itself to fit the new feature they are working on, which defeats the point.

Which means some laws needs to be frozen. But not all laws, otherwise you can't add or modify anything. So the judgement is still on the human part, and we're back to meatbags being the bottleneck.

I've seen some success adding these proof-like checks to CI every time agents do something irrational. I definitely think it should be part of every codebase.

There's also https://code-contracts.cc/ which co-locates code and proofs together.

LightMachine 10 hours ago|
Yeah, you want to at least read what the AI is putting on LAWS.bend. It is substantially smaller than the codebase. Ultimately LAWS.bend makes you need to read astronomically less code. Not zero code.
garrisonj 11 hours ago||
The issue is I’ll have to vibecode all the laws and the laws could be wrong.
foota 11 hours ago||
Jokes aside, I think the idea is that the law is simple to code, the proof that it holds is where the agent is responsible. This probably becomes less true though as you try to express more complicated laws.
pixl97 10 hours ago||
Heh, it's like we all need to collectively read I, Robot yet again, and the myriad of SF books on the subjects. Black and white quickly dithers to grey.
burner420042 9 hours ago||
Indeed

Robots are logical, but not rational.

Jolter 2 hours ago||
LLM driven agents aren’t even that.
drdrey 8 hours ago|||
writing specs is hard. For instance the easiest way to comply with "player should never reach the flag" is to disable movement completely, so then you have to specify "player should never reach the flag while still being allowed to move" and so on (liveness). It's not practical for most programs
futurisold 11 hours ago|||
Words of wisdom.
LightMachine 11 hours ago||
true
tyushk 11 hours ago||
Victor Taelin's work (HVM) got me interested in interaction combinators as a compilation target. I'm now working on an implementation as part of my Uni research. Cool to see Bend 2.0 release!
etiamz 11 hours ago|
Then you might be interested in Marc Thatcher's recent PhD thesis dedicated to interaction nets [1]. A great exposition of interaction nets through multiplicative linear logic's proof nets, and several novel contributions like productivity analysis for interaction nets.

[1] https://hdl.handle.net/10779/uos.32024301

jwpapi 10 hours ago|
I’m missing an actual explanation of how that works.

I feel like we all had the idea, but how is all possible move sequences proven ?

What if the possible scenarios are too big to proof or test.

Like on a 2 dimensional game it’s easy, but you could make it multidimensional and introduce an unlimited amount of special rules, (if on a prime number dimension on 3 but not more prime numbers you are allowed to jump to another prime numbers with 3 but not less coordinates)

How is bend protecting it? I was checkin github and the paper, but I was not motivated enough. I feel like an actual explanation of how proofing works is missing.

For Lean I understand how it works, here not.

LightMachine 10 hours ago||
You can prove infinitely many cases by induction.

It works like this: if you prove that a property about natural numbers holds for 0, and if you also prove that, assuming the property holds for N, it also holds for N+1; then, you can conclude the property holds for every N, up to infinity. This is a bit of a mouthful, but the logic holds.

Induction is the one trick that makes all of mathematics (as we know it) possible, and it also applies to software. So, for example, to prove that no move leads to an invalid state, we prove that the initial state is valid, and then prove that, given a valid state, applying any event won't return an invalid state.

And that's it actually.

Of course, once you have an app with hundreds of actions, proving that no action leads to an invalid state requires a lot of these "induction arguments". But not infinitely many, because there is a finite amount of "infinite paths" that a real software can take. So, that's what the AI does. It proves, by induction, that none of these "infinite paths" that an app can take leads to an invalid state. And this convinces the compiler that invalid states are impossible.

Theorem proving in Bend is a dance between the prover (the model) and the compiler (the checker); a machine trying to convince another machine about properties of infinite states. And that's is kinda poetic, don't you think?

developedby 10 hours ago||
If your game is big, then your proof will need to be huge. It works basically the same as Lean.
More comments...