Repolode
bendlang

bendlang/bend

A programming language that uses laws and proofs to make AI-written code verifiable, and compiles to fast parallel CPU and GPU code.

Stars
24,879
Forks
797
Open issues
124
Last commit
8 hours ago

What is it?

Bend is a programming language aimed at making AI-generated code checkable. Developers write laws in a LAWS.bend file that state rules the program must never break, and the compiler requires a machine-checked proof that those laws hold whenever the code is edited. Its syntax is Python-like with dependent types.

Bend also targets performance. It compiles to C, Metal, CUDA and JavaScript, and it parallelizes divide-and-conquer code automatically across CPU cores or GPU threads without explicit threads, locks or kernels. The project includes a proof checker that is intended to handle theorem files much faster than existing proof assistants.

The language is young and marked as such: Bend 2 is not compatible with Bend 1 or HVM, there is no type inference, no debugger, and the compiler is not yet fully audited. Installation is a single shell script and the project targets Linux and macOS, with Windows only through WSL.

Key features

  • 01Laws in LAWS.bend declare rules that edits must preserve, enforced by proof.
  • 02Automatic parallel execution of divide-and-conquer code on CPU cores and GPUs.
  • 03Compiles to C, Metal, CUDA and JavaScript targets.
  • 04Dependent type system with Python-like syntax.
  • 05Built-in proof checker with a kernel formalized in Lean.
  • 06Guide available via the bend guide command.

Use cases

  • Back-end services where AI agents edit code and invariants must never break.
  • Parallel numeric or divide-and-conquer workloads running on GPUs without writing CUDA kernels.
  • Checking mathematical proof files faster than conventional proof assistants.
  • Experimenting with dependently typed programming and verified AI-generated code.

Quick start

  1. 1

    Run the official install script from the README

  2. 2

    Tell your AI agent to use Bend by adding the AGENTS.md instructions from the README

  3. 3

    Run the proof check before committing

    bend PROOF.bend

Things to know

  • Bend is young and the compiler has known bugs, so expect breakage.
  • Bend works best on Linux or macOS, and Windows is not supported except through WSL.
  • Compiling to native binaries requires clang 14 or newer, and GPU features need newer tools.
  • Bend 2 is a new language, and Bend 1 programs and HVM do not carry over.

In collections

Topics

FAQ

What is bend?
A programming language that uses laws and proofs to make AI-written code verifiable, and compiles to fast parallel CPU and GPU code. Bend is a programming language aimed at making AI-generated code checkable. Developers write laws in a LAWS.bend file that state rules the program must never break, and the compiler requires a machine-checked proof that those laws hold whenever the code is edited. Its syntax is Python-like with dependent types.
Is bend free to use? What license does it have?
bend is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is bend still maintained?
Actively maintained. The last commit to bend was on Nov 7, 2026.
What can I use bend for?
Back-end services where AI agents edit code and invariants must never break. Parallel numeric or divide-and-conquer workloads running on GPUs without writing CUDA kernels. Checking mathematical proof files faster than conventional proof assistants. Experimenting with dependently typed programming and verified AI-generated code.
How do I install bend?
Run the official install script from the README Tell your AI agent to use Bend by adding the AGENTS.md instructions from the README Run the proof check before committing: bend PROOF.bend
Where can I get bend?
The source code and installation instructions are on GitHub: https://github.com/bendlang/bend

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects