Bend is a new language that blocks AI coding mistakes with math

Bend forces AI agents to mathematically prove their code works before shipping. It runs at C speed on CPUs and GPUs without manual locks.

Tools ยท Source: Hacker News

What happened

Bend is a new programming language built specifically for a future where humans stop writing and reading code. We are entering an era where AI agents build the world around us. But natural language prompts are too ambiguous for complex software. AI agents make mistakes and hallucinate logic. Bend solves this problem by introducing mathematical proofs to the development workflow. It forces the AI to prove its code works before anything gets shipped to production.

The workflow relies on strict rules defined by the developer. You declare your absolute constraints in a file called LAWS.bend. For example, you can state that a specific sequence of moves in a game must never lead to victory. The AI agent writes the feature code and must also write a mathematical proof in PROOF.bend. The Bend compiler uses a proof checker based on affine dependent type theory. It verifies the proof in one second at most. If the AI breaks the law, the code is blocked. Merging a bug becomes mathematically impossible.

Beyond safety, Bend is engineered for raw speed. It uses Python syntax but compiles directly to native code. On a single core, it runs nearly as fast as C. The real magic happens with parallelization. Bend requires no manual threads, locks, or custom kernels. It automatically splits the work and spreads the calls over every available core. The same binary can run on sixteen CPU cores or thousands of GPU cores.

Key facts

Why it matters

The transition to AI-generated code has a major bottleneck. Founders and engineers spend countless hours reviewing pull requests from agents to catch subtle bugs. Bend shifts the entire paradigm from manual code review to automated law enforcement. You only need to define your business logic constraints once. The compiler becomes an impenetrable wall against AI hallucinations. This allows teams to trust autonomous agents with critical backend systems. You no longer have to read the code the AI writes. You only need to trust the math.

The secondary effect on performance engineering is equally massive. Writing custom CUDA kernels for GPUs or managing complex thread locks on CPUs is a highly specialized skill. It slows down development and introduces race conditions. Bend abstracts this complexity entirely. An AI agent can write simple logic that immediately scales. The Bend runtime automatically handles the parallelization. This drastically lowers the barrier to entry for building high-performance applications on Linux and macOS.

For builders

Enforce rules with mathematical certainty

Founders can stop manually reviewing every line of AI-generated code. You define your core constraints in the LAWS file once. The compiler acts as an absolute gatekeeper against AI hallucinations and logic errors. If the math does not prove the law holds, the agent must retry.

Achieve native GPU speed without custom kernels

Engineers building compute-heavy backend systems save massive amounts of development time. Bend automatically spreads workloads across multiple CPU cores and GPUs. You get incredible native speed without ever managing threads, locks, or writing complex CUDA code.

Integrate proofs directly into agent workflows

Tooling builders can easily add Bend to their existing autonomous agents. You just add a few lines to your AGENTS file instructing the AI to use Bend and check proofs before committing. This creates a self-correcting loop where the agent fixes its own bugs.

My take

Trusting AI to write production code without strict guardrails is a disaster waiting to happen. Natural language is too sloppy for complex logic. Bend is exactly what we need right now. It forces agents to prove their work mathematically instead of just guessing. I will be adding this to my agent workflows immediately.

Original reporting: Hacker News. This is my rewrite and opinion.

More AI news for builders