Every frame drawn by a custom 2D renderer written in Bend 2.0.38. Credit: Kevin Ngo (@kevin_t_ngo) on X →
Why AI Coding Agents Prefer Bend 2
“Just found out about Bend, so I had Claude make an explainer on why agents might prefer it. Every frame was drawn in Bend. Claude built a custom renderer in Bend to make the video.”
-
Human Laws, Agent Proofs (
LAWS.bend→PROOF.bend): Humans specify invariants inLAWS.bendwhile coding agents synthesize implementation andPROOF.bend. If$ bend PROOF.bendfails to verify, the change cannot land. - 0.38 s Verification Loop on Apple M4 Max: Checking 3,200 generic instantiations completes in 0.38 s in Bend 2 compared to 6.0 s in Rocq, 19.2 s in Lean 4, and > 5 min in Agda and Isabelle -- fast enough to run after every agent edit.
-
Implicit Side-by-Side Parallelism:
Writing two independent calls side by side (
a b = pow2(p) pow2(p)) automatically parallelizes across cores without threads, locks, or data races. - Custom Renderer Written in Bend: Claude built a custom functional frame renderer directly in Bend 2 to draw and animate every frame of this 2-minute breakdown.
Current target: Bend 2.0.39, updated October 27, 2026. Read the release milestones and source evidence.
🧬 What is Bend? Architecture & 17-Language Comparison Matrix
Bend is a statically typed functional language combining dependent equality proofs (LAWS.bend → PROOF.bend checked in 0.38 s), affine ownership with counted sharing (&), and balanced parallel execution (!) across multi-core CPUs and GPUs via BendRT. Select any language below to read the dedicated engineering benchmark and proof comparison on bend2.org.
| Language | Execution & Memory | CPU Parallelism | Sharing & Effects | Correctness Checks | GPU Execution |
|---|---|---|---|---|---|
| Bend → | C via BendRT; affine ownership + & counted sharing. |
Explicit balanced forks (!) on 128x128 Task Cube. |
Disjoint owned forks; IO runs on host. |
Dependent types & explicit proofs of LAWS.bend (0.38 s). |
Same Bend functions via ! on Metal or CUDA. |
| Lean 4 → | Native C compilation; reference counting. | Explicit Task futures on runtime thread pool. |
Persistent values; IO tasks use channels/mutexes. |
Dependent types, Mathlib, and tactics (simp, omega). |
External libraries or native FFI bindings. |
| Rust → | Native LLVM code; affine ownership & borrowing. | OS threads or Rayon work-stealing pools. |
Borrowed slices, channels, or Arc<Mutex<T>>. |
Send/Sync & borrow checker; Verus/Kani for proofs. |
Separate GPU crates (wgpu, CUDA); threads stay on CPU. |
| Python → | Interpreter; reference counting & cyclic GC. | Processes, C extensions, or free-threaded 3.13t+. | Shared objects needing locks or IPC serialization. | Dynamic checks; external mypy/pyright typing. |
Dispatches C++/CUDA kernels via PyTorch/JAX/Triton. |
| CUDA & Metal → | Device SIMT kernels; manual global/shared SRAM. | Separate host OpenMP or C++ thread pools. | Explicit DMA transfers, barriers, and atomics. | Static C++ types; manual barrier & race auditing. | Direct hardware control of grids, blocks, and warps. |
| Mojo → | MLIR/LLVM native code; owned values & deterministic destruction. | Explicit parallelize tasks on work-stealing pool + SIMD. |
Mutable-reference exclusivity; explicit device buffers. | Static types, traits & @parameter; no proof checker. |
User-written GPU kernels exposing DeviceContext & blocks. |
| C (ISO C11) → | Native AOT machine code; manual heap pointers. | pthreads or OpenMP loop pragmas. |
Unrestricted shared memory; manual locks/atomics. | Nominal types; external CBMC/Frama-C verification. | Separate OpenCL, OpenMP target, or CUDA kernels. |
| C++ (C++20/23) → | Native code; RAII, templates, and smart pointers. | std::jthread, parallel STL, and TBB work stealing. |
Shared mutable memory, atomics, and mutexes. | concepts & static_assert; no dependent proofs. |
stdpar, SYCL, Kokkos, or CUDA C++ toolchains. |
| Go → | Native code with concurrent mark-sweep GC. | M:N work-stealing scheduler for goroutines. |
Typed channels (chan) and sync.Mutex. |
Interfaces & generics; runtime -race detector. |
Requires CGo FFI bindings to CUDA/Metal. |
| Haskell (GHC) → | Native code with lazy evaluation and GC. | Pure par sparks and green runtime threads. |
Pure values share freely; MVar and STM for effects. |
Type classes & GADTs; permits nontermination. | Embedded array DSLs (Accelerate); par runs on CPU. |
| OCaml 5 / Elixir / Erlang → | OCaml native GC domains; BEAM per-process heaps. | OCaml Domainslib; BEAM preemptive actor schedulers. |
Immutable sharing or share-nothing actor messages. | GADTs/modules (OCaml) or Dialyzer specs (BEAM). | External Nx/XLA bindings or C FFI stubs. |
| Java (HotSpot) → | JVM bytecode, JIT compilation, and G1/ZGC. | OS threads, ForkJoinPool work stealing, virtual threads. |
Shared mutable heap; locks, atomics, concurrent maps. | Nominal generics & runtime bounds/cast checks. | TornadoVM / Babylon or JNI; ForkJoinPool stays on CPU. |
| C# (.NET) → | CLR RyuJIT compilation with GC and value structs. | Task Parallel Library (TPL) work-stealing pool. | Shared heap with Span<T>, locks, and atomics. |
Nullable reference checks; no dependent proof kernel. | ILGPU / ComputeSharp or native P/Invoke bindings. |
| TypeScript → | V8 / Bun JIT compilation with garbage collection. | Single-threaded event loop + explicit Web Workers. | Message passing or SharedArrayBuffer + Atomics. |
Erased structural types; no kernel proof verifier. | WebGPU compute shaders written in WGSL. |
| JavaScript → | V8 / JSC JIT with generational garbage collection. | Async event loop + isolated Worker threads. | Structured clone messages or SharedArrayBuffer. |
Dynamic runtime checks only. | WebGL / WebGPU shaders written in GLSL/WGSL. |
| Julia & MATLAB → | LLVM JIT multiple dispatch with garbage collection. | Threads.@threads and task-based multithreading. |
Shared mutable arrays; manual race prevention. | Dynamic multiple dispatch with type annotations. | Native array/kernel programming via CUDA.jl/Metal.jl. |
| Swift → | LLVM AOT compilation with deterministic ARC. | Structured concurrency (async let, TaskGroup). |
Strict actor isolation and Sendable checking. |
Compile-time data-race safety; no theorem proving. | Separate Metal Shading Language (.metal) kernels. |
| AWS Cedar → | Rust policy evaluator over immutable entity stores. | Host thread pool invoking stateless policy checks. | Pure read-only entity/context evaluation. | Formally verified in Lean 4 + SMT cedar symcc. |
CPU-only authorization policy engine. |
Verification Framework Comparison
Compare complementary tools, not interchangeable guarantees. Requirements traceability, acceptance tests, model checking, and theorem proving address different questions. No tool alone establishes regulatory compliance.
7 tools shown
Runtime Execution includes application or test execution, not model exploration. Theorem Proving includes TLA+ with TLAPS. Bend targets version 2.0.39. With JavaScript unavailable, all tools remain readable.
| Tool and source | Assurance artifact | Execution | Formal proof scope | Requirements traceability | Developer workflow |
|---|---|---|---|---|---|
| StrictDoc | Structured requirements and evidence links | Documentation tooling, not an application runtime | No theorem prover | Requirement relationships and source links | Text-based specifications and generated documentation |
| Bend | Typed programs, laws, and proof terms | CPU, CUDA, Metal, and JavaScript targets | Checked laws; kernel adequacy for closed, live equality proofs | External traceability system needed | Code and proofs in the same language; implementation correspondence still needs testing |
| Gherkin | Observable acceptance examples | Requires a runner and step definitions | Examples are not universal proofs | Tags can reference requirement identifiers | Human-readable Given, When, Then scenarios |
| TLA+ | Mathematical state-machine specification | TLC explores model states, not production code | TLC checks models; TLAPS supports deductive proofs | External evidence links needed | Specify transitions and assumptions before implementation |
| Alloy | Relational constraints and counterexamples | Analyzer explores structures and temporal models | Bounded analysis is not an unrestricted theorem proof | External evidence links needed | Explore structures and inspect counterexamples within declared scopes |
| DOORS | Managed requirements, baselines, and review records | Requirements management, not an application runtime | No built-in theorem proof guarantee | Multi-level traceability and change management | Enterprise requirements modules and controlled baselines |
| Cucumber | Executed acceptance examples and results | Runs step definitions against an implementation | Passing examples are not universal proofs | Scenario tags and reports can link evidence | Bind Gherkin steps to real application behavior in CI |
Read the full verification stack guide. Browser agents can query evaluate_verification_stack through WebMCP for advisory combinations, not certification decisions.
⚡ What the Benchmarks Show (Apple M4 Max)
This Bend 2.0.39 guide retains historical Apple M4 Max measurements dated 2026-09-17, without a hand-written CUDA comparison. These results were not rerun for 2.0.39. Compare GPU, multi-core CPU, and native baselines below:
| Workload | 1 CPU Thread (SEQ-CPU) |
Parallel CPU (PAR-CPU) |
GPU (PAR-GPU) |
Native C -O3 (1T) |
Takeaway (When Bend Wins vs. Loses) |
|---|---|---|---|---|---|
| Game of Life | 7.803 s | 0.647 s | 0.063 s | 6.776 s | GPU wins (123.9x vs 1T, 10.3x vs PAR-CPU): regular data-parallel cellular grid. |
| Lexer | 2.144 s | 0.198 s | 1.075 s | 1.036 s | GPU loses (0.18x vs PAR-CPU, slower than 1T C): branch-heavy state machine diverges GPU warps. |
| HAMT Hashmap | 2.741 s | 0.238 s | 0.521 s | 0.622 s | 1T Bend loses (0.23x vs C, 4.4x slower; 3.1x slower than TS 0.892 s): tree pointer-chasing vs flat arrays. |
| N-Queens & Symbolic Reg. | 5.406 s / 3.014 s | 0.455 s / 0.266 s | 0.933 s / 0.529 s | 3.599 s / 2.208 s | GPU loses (0.49x to 0.50x vs PAR-CPU, 2.0x slower): irregular backtracking trees belong on CPU. See full analysis → |
📦 Curated Ecosystem Directory
Verified tools, libraries, formal proof specifications, and applications satisfying the Three-Prong Curation Standard.
📖 Architecture & Developer Guides
Practical walk-throughs for getting started, running benchmarks, verifying proofs, and designing lock-free data structures.
Bend 2.0.39 release evidence covering proof adequacy and Metal fixes. Separate development results cover host memory reuse, JavaScript channels, and native writes.
Complete technical guide to Bend: pure functions, dependent types, LAWS.bend and PROOF.bend verification in 0.38 s, affine ownership, implicit CPU/GPU parallelism, 16 Apple M4 Max benchmarks, and a 17-language comparison matrix.
Technical comparison of Modular’s Mojo (MLIR, SIMD tensors, explicit GPU kernels, Python interop) and Bend (BendTT 0.38 s formal proofs, affine Task Cube, and automatic CPU/GPU tree parallelism).
Anthropic and Theorem proved 239 OSS-Fuzz entry points in 180 million lines of Rocq, taking 30 minutes to hours of CPU time per proof check. Here is why Bend 2 was engineered from first principles to solve every bottleneck in that pipeline.
Why HigherOrderCO wrote the Bend 2 compiler in TypeScript, how TypeScript on V8/Bun compares to Bend 2 across all 16 Apple M4 Max benchmarks, and how to embed Bend 2 as a verified .mjs oracle in Vitest and Bun.
Comparing Swift 6 (Structured Concurrency, Actors, ARC reference counting) and Bend 2 on Apple Silicon M4 Max across CPU/GPU unified memory and formal verification.
An architectural and empirical comparison of Bend 2 and Rust across Apple M4 Max CPU/GPU benchmarks, DevSecOps policy latency, Rayon work-stealing vs. the BendRT Task Cube, and proptest vs. LAWS.bend.
A technical comparison of Bend 2 and Python (CPython 3.14, PEP 703 NoGIL, Numba, JAX, and PyTorch) across recursive trees, GPU simulations, symbolic regression, and proof-blocked AI.
Head-to-head comparison of Bend 2 (v2.0.38) and Lean 4 across proof-checking latency (0.38 s vs 19.2 s), 16 Apple M4 Max runtime benchmarks, and using Bend 2 as a dual-target (native + JS) differential test engine.
Comparing Julia (CUDA.jl, SymbolicRegression.jl, LLVM JIT) and MATLAB (gpuArray) against Bend 2 (BendSR, nbody, tree-matmul, 2 MB RSS, and 0.38 s proofs).
An execution-level comparison of JavaScript (V8, JavaScriptCore, Web Workers, SharedArrayBuffer) and Bend 2 (BendRT Task Cube and zero-dependency JS target) across 16 Apple M4 Max benchmarks.
Comparing Java 21+ (HotSpot JVM, Project Loom virtual threads, ForkJoinPool, TornadoVM, and JML) against Bend 2’s 64-bit word runtime, GPU offloading, and 0.38 s formal proof checker.
An architectural comparison of GHC Haskell (par/pseq, Strategies, Accelerate, LiquidHaskell) and Bend 2 (BendTT affine dependent types and the BendRT 128x128 Task Cube).
An engineering comparison of Go (goroutines, GMP scheduler, channels) and Bend 2 (BendRT Task Cube, algebraic datatypes, and 0.38 s proofs), plus how Go services call Bend 2 kernels.
Comparing Elixir/Erlang (BEAM preemptive actors, OTP supervision, Nx) and OCaml 5 (Multicore domains, Flambda2) against Bend 2’s 128x128 Task Cube and 0.38 s proof checker.
When to write raw CUDA C++ or Metal Shading Language kernels vs. compiling Bend 2 (bend -o), explaining the GPU Bimodality Law across all 16 Apple M4 Max benchmarks.
An architectural comparison of C# 13 / .NET 9 (CLR, Task Parallel Library, PLINQ, Span, and ILGPU) against Bend 2’s 64-bit word runtime, GPU offloading, and 0.38 s proof checker.
Comparing C++20/23 (std::execution, OpenMP, Kokkos, and CUDA C++) against Bend 2’s 128x128 Task Cube and BendTT dependent proofs across CPU and GPU workloads.
An empirical comparison of Bend 2 (v2.0.38) and AWS Cedar (cedar-policy) across authorization latency (3.11 ms vs 9.57 ms), recursive DAG policy evaluation, Lean 4 formal proofs, and the Rust + Cedar + Bend 2 automation triad.
How Bend 2 compiles to a single C11 file (bend -o prog.c), how it compares to clang -O3 across all 16 Apple M4 Max benchmarks, and when to choose C vs. Bend 2.
An empirical engineering guide to Bend 2 (v2.0.38): where interaction combinators and 0.38 s inductive proofs win, where flat-array C/Rust or PyTorch beat it, and how to use Bend 2 as a formal test engine and differential oracle.
Why formal theorem proving in Bend 2 does not obsolete requirements traceability, and how StrictDoc, Gherkin, and Bend 2 form a unified validation and verification pipeline.
Empirical hardware benchmarks comparing Bend 2 (v2.0.34) native compilation, single-file Rust, and Python on DevSecOps policy gates.