Skip to main content
VeriGraph

AI writes the code. Mathematics proves it.

VeriGraph (VG-IR) is an AI-native programming system. Instead of fragile text files tested on a handful of examples, programs are canonical dataflow graphs identified by BLAKE3 hashes and paired with formal contracts. SMT solvers prove every contract for all possible inputs before a single native ARM64, x86_64 or WebAssembly binary is emitted.

@aurora · WebAssembly 320 × 180 RGBA pixels · static frame (reduced motion) ∀ pixel: alpha == 255 · 86/86 obligations proven · 0 runtime guards
A complete verified node in 13 lines examples/quickstart.vgs

Hover or focus any highlighted clause below to inspect what the compiler checks and proves.

NODE @add_sat [intent: "Add two bytes, saturating at 255"] {
  SIGNATURE: (a: u8, b: u8) -> (u8);
  EFFECTS: [];
  CONTRACT {
    POST: result >= a && result >= b && (a + b <= 255 ==> result == a + b);
  }
  BODY {
    %0 = ADD.sat(a, b);
    RETURN(%0);
  }
}
Interactive annotation

Select any underlined token in @add_sat to see how VG-Sym eliminates implicit overflow and proves behavior across all 65,536 byte pairs.

SMT obligations proven for this site
740 / 740
verified VG-Sym nodes in 8 modules
95
WebAssembly binaries running in your browser
18
residual runtime checks in proven binaries
0

Why unit tests are not enough for AI code.

Language models generate plausible code in seconds, including subtle edge-case bugs that slip past dozens of unit tests. VeriGraph replaces hope with mathematical refutation and proof.

Pedagogical analogy · Testing a bridge vs proving statics

Driving five trucks across a bridge only shows it did not collapse under those five trucks. Writing equations of structural mechanics proves the bridge holds every load up to its rated limit—or pinpoints the exact beam that buckles first.

Classic LLM code + unit tests

Sampled confidence
  • 5 tests check 5 points out of 18,446,744,073,709,551,616 pairs of 32-bit integers.
  • Silent integer wraparound, division by zero, and IEEE-754 NaN propagation hide in extreme inputs.
  • Compiler errors are unstructured prose; failed runs dump stack traces without minimal root causes.
  • Packages are pulled by name: a version bump can silently alter behavior.

VeriGraph + SMT solvers (Z3, Bitwuzla, cvc5)

Universal proof
  • vg verify proves obligations across 100% of inputs satisfying PRE—or returns a concrete counterexample.
  • Every counterexample is replayed bit-for-bit in vg-interp (ADR 0006): zero solver hallucinations.
  • vg explain narrows failures to a ≤5-op causal slice plus the exact condition needed to fix it.
  • Once proven, vg build erases runtime assertions (0 residual guards) and emits LLVM machine code.

Interactive proof sandbox · Overflow-free midpoint vs naive average

Classic binary search had a famous bug for twenty years: (a + b) / 2 overflows 32-bit integers when a + b ≥ 2³². Test VeriGraph's verified WASM binary (midpoint.wasm) against naive 32-bit arithmetic right here:

Naive 32-bit ((a + b) >>> 1) —
Verified @midpoint (midpoint.wasm) —

midpoint.wasm · 5/5 obligations proven by Z3 in 19 ms · POST: result == (a + b) / 2 · 0 runtime guards

Also running live in WebAssembly: @add_sat (add_sat.wasm)

Move both u8 sliders (0..255) to verify saturating byte addition in real WASM:

@add_sat(a, b) 255

add_sat.wasm · 5/5 obligations proven by Z3 · BLAKE3 df7cb4d95efea306…

Inside a VeriGraph module: every line has a formal role.

VG-Sym is the prefix-checkable text projection that AI agents write and humans review; VG-IR is its canonical binary DAG. Click or tab through the 8 annotated regions of examples/audio_limiter.vgs to see how contracts, capabilities, learnable parameters and Mesh queries fit together.

examples/audio_limiter.vgs 19/19 obligations proven · node_hash 7ddf55ff…
module audio_limiter;

@MESH_QUERY @sha256 {
  signature: (Slice<u8>) -> (Array<u8, 32>);
  effects: [];
  post: result == spec:sha256(arg0);
}

NODE @limit_frame [intent: "Limit a 512x2 stereo frame and digest it", export] {
  SIGNATURE: (frame: Tensor<f32, [512, 2]>) -> (Tensor<f32, [512, 2]>, Array<u8, 32>);
  EFFECTS: [];
  CONTRACT {
    PRE:  forall(i in 0..512, c in 0..2) { is_finite(frame[i, c]) };
    POST: forall(i in 0..512, c in 0..2) {
            result.0[i, c] >= -1.0 && result.0[i, c] <= 1.0
            && ((frame[i, c] >= 0.0) == (result.0[i, c] >= 0.0))
          } && result.1 == spec:sha256(as_bytes(result.0));
    COST: heap_bytes == 0 && arena_bytes == 0;
    BUDGET: latency_p99_us <= 500;
  }
  LEARNABLE {
    knee: f32 in [0.5, 0.99];
  }
  BODY {
    %0 = SIMD_MAP(@soft_knee, frame, knee);
    %1 = AS_BYTES(%0);
    %2 = CALL_HASH(@sha256, %1);
    RETURN(%0, %2);
  }
}

From a plain-English request to three verified binaries.

Watch how an AI agent and the vg toolchain collaborate. Every box position and Bezier edge below is computed live in your browser by layout.wasm (@layout, 196/196 obligations proven). Click any step—or pause the animation at any moment.

VeriGraph: typed dataflow graphs proven by SMT solvers before compilation to ARM64, x86_64 and WebAssembly
layout.wasm (@layout) · 196/196 obligations proven (19 nodes) · every box stays inside the viewBox

When a proof fails: the soft-knee NaN story.

Here is a real bug that passes ordinary unit tests yet fails in production. In examples/soft_knee_draft.vgs, the author wrote u = t / (1 + t) to compress audio peaks smoothly into [-1, 1]. Algebraically, t / (1 + t) is always in [0, 1). In 32-bit IEEE-754 floating point, it is a trap.

Causal 5-op failure slice extracted by vg explain (@soft_knee/POST.0)
  1. Input x = -3.4028235e38, knee = 0.5
    → PRE holds (x is finite!)
  2. %0 FABS(x)
    → 3.4028235e38
  3. %4 FDIV(%2, %3) // (|x| - 0.5) / 0.5
    → +inf ← IEEE-754 overflow!
  4. %6 FDIV(%4, %5) // +inf / (1 + inf)
    → NaN ← inf / inf is undefined!
  5. %12 FCLAMP(%11, -1.0, 1.0)
    → NaN ← IEEE minimum/clamp propagates NaN!

Synthesized vg-telemetry condition: “the obligation holds iff %4 is finite” · Replayed in vg-interp: concrete

1-line IEEE-754 repair

The one-line mathematical repair

Rewrite u = t / (1 + t) as u = 1.0 - 1.0 / (1.0 + t). When %4 overflows to +inf, 1.0 + inf is +inf, 1.0 / +inf is 0.0 (exact IEEE-754!), and 1.0 - 0.0 = 1.0. Bitwuzla then proves all 6/6 obligations across all 4.29 billion f32 bit patterns in 111 ms.

// Buggy draft (examples/soft_knee_draft.vgs):
%6 = FDIV(%4, %5);          // +inf / +inf => NaN!

// Proven repair (examples/audio_limiter.vgs):
%6 = FDIV(1.0:f32, %5);     // 1.0 / +inf  => 0.0
%7 = FSUB(1.0:f32, %6);     // 1.0 - 0.0   => 1.0 (proven!)

Live Dual-WASM Lab · Break knee_draft.wasm vs proven knee.wasm

Both curves below are computed live by real VeriGraph WebAssembly binaries: knee.wasm (proven, 16/16 obligations) and knee_draft.wasm (compiled with --unverified). Drag knee or click an extreme f32 input:

━━ Proven @knee_curve (knee.wasm) ╌╌ Unverified draft (knee_draft.wasm)
Repaired @knee_curve (knee.wasm) —
Buggy draft @draft_curve (knee_draft.wasm) —

grid.wasm (12/12 proven) + knee.wasm (16/16 proven, 0 guards) vs knee_draft.wasm (--unverified)

One graph, every tool around it.

VeriGraph is not just a verifier: it is a complete 12-crate Rust workspace, a 15-command CLI, an 8-tool MCP server for AI agents, an Antigravity IDE / VS Code extension, a contract-indexed package registry (VG-Mesh) and a C/Rust lifter (OmniLift).

Interactive 12-crate architecture map (laid out live by @layout)

Click or hover any crate in the DAG to highlight its dependencies and inspect what it owns:

Interactive 12-crate architecture map (laid out live by @layout)
vg-smt crates/* · Rust 2024 workspace · layout computed by @layout

Encodes graphs and contracts into SMT-LIB2 bitvectors, IEEE-754 floats and arrays over long-lived solver pipes. Includes concrete pre-screening, content-addressed proof caching, non-vacuity and well-definedness (.wd) checks.

One Rust binary (`vg`) orchestrates assembling, hashing, static checking, multi-solver verification, causal explanation, reference execution, cross-compilation, registry queries and legacy lifting.

vg · recorded toolchain session
All 15 commands of the vg binary (recorded from ./target/release/vg)
Command What it does
vg asm FILE.vgs [--root DIR] [--keep-debug] assemble into DIR/.vg/objects and pin labels in DIR/vg.lock
vg disasm (HASH | FILE.vgir) [--root DIR] print VG-Sym for a node and everything it calls
vg hash FILE... print node, body and contract hashes (.vgs or .vgir)
vg check FILE.vgs parse, canonicalize, type- and effect-check (JSON)
vg verify FILE.vgs [--mode edit|ci|release] [--timeout MS] [--detail 0|1|2] prove every obligation; release needs two solvers (JSON)
vg explain FILE.vgs OBLIGATION [--timeout MS] the failure report of one obligation, and its prose
vg run FILE.vgs @NODE JSON run a node in vg-interp; JSON maps parameter names to values
vg build FILE.vgs @NODE [--target TRIPLE]... [-o DIR] [--timeout MS] [--unverified] [--emit-llvm] verify, then compile (default target: aarch64-apple-darwin)
vg lift FILE FUNCTION [--lang c|rust] [--root DIR] lift a C or Rust function with Alive2 and fuzzing (JSON)
vg mesh publish FILE.vgs [--root DIR] publish the module's nodes to DIR/.vg/mesh (ingestion gate)
vg mesh query QUERY.json [--root DIR] candidates for a docs/09 MeshContractQuery
vg mesh resolve FILE.vgs [--root DIR] bind each @MESH_QUERY, pin it in vg.lock, fetch its nodes
vg mesh serve [--root DIR] [--addr HOST:PORT] the registry's HTTP API (default 127.0.0.1:7878)
vg loop (DIR | PROMPT.md) [--model M] [--rounds N] [--replay SCRIPT] [-o DIR] the hosted loop: a model writes nodes, a grader judges them
vg mcp serve the eight docs/15 tools over MCP stdio

Three more verified programs running live in your browser.

JavaScript on this page computes none of the signals, hashes, checksums or fractals below: it packs your inputs into little-endian bytes, runs the real wasm32-wasip1 binaries compiled by `vg build`, and renders their stdout.

Lab 1 · Stereo Audio Limiter + WebAudio synthesis (tone.wasm → limiter.wasm)

Adjust input drive (up to 6× clipping!) and the learnable knee. `tone.wasm` synthesizes a 512-sample stereo A-major chord, `peak.wasm` measures its peak, and `limiter.wasm` (`examples/audio_limiter.vgs`) clamps every sample smoothly into [-1, 1] while computing the frame's 32-byte SHA-256 digest.

Input peak (@peak)—
Output peak (POST ≤ 1.0)—
Frame SHA-256 (result.1)—

Lab 2 · VG-Mesh SHA-256 (sha256.wasm) & OmniLift zlib CRC-32 (crc32.wasm)

Type any UTF-8 text or pick a standard test vector. `sha256.wasm` (55/55 obligations proven against FIPS 180-4) and `crc32.wasm` (lifted directly from `zlib/crc32.c` by `vg lift`, 59/59 obligations proven) compute both digests in WebAssembly:

@sha256_impl (FIPS 180-4) —
@crc32_z (lifted from zlib C) —

Lab 3 · Compositional contracts: Safe Mandelbrot Explorer (zoom.wasm → render.wasm)

Click anywhere on the fractal to zoom in (Shift+click to zoom out). `@zoom`'s POST proves the returned view stays inside `[-2.5, 1.5] × [-1.5, 1.5]` with bounded positive scale—the exact PRE `@render` demands. Try the red button to bypass `@zoom` and send `scale = 0.05` directly to `render.wasm`!

—

Center Re-0.50000
Center Im0.00000
Scale / px1.250e-2
WASM render—

This website is itself a verified VeriGraph program.

Every easing curve (`@motion`), diagram layout (`@layout`), donut wedge (`@donut`) and bar chart (`@bar_chart`) on this page is computed by VeriGraph nodes compiled to WebAssembly. Inspect the proof ledger recorded by `build-wasm.sh`:

Proven obligations by kind (@donut)

Proven obligations by kind (@donut)
740 proven
  • POST217
  • CALL110
  • NONVACUOUS95
  • FOLD70
  • INDEX60
  • GEN49
  • PRE30
  • other109

By SMT solver & evidence (@bar_chart)

bitwuzla 503
z3 152
concrete pre-screen 85
8 verified animation curves (@motion: f(0) == 0.0 && f(1) == 1.0 bit-exact)
Inspect all 18 WebAssembly binaries, BLAKE3 hashes and proof closures
Inspect all 18 WebAssembly binaries, BLAKE3 hashes and proof closures
Binary Root node Closure Proven BLAKE3 (artifact) Size Guards
aurora.wasm @aurora 9 86/86 981e634726a3d8… 29 KB 0
motion.wasm @motion 14 117/117 2330741b27d4f2… 25.9 KB 0
bar_chart.wasm @bar_chart 7 44/44 42d3f17ab515ce… 27.2 KB 0
donut.wasm @donut 9 60/60 0a1eafb7d7a6c7… 29.8 KB 0
zoom.wasm @zoom 2 13/13 bb710b9d95468e… 26 KB 0
render.wasm @render 5 26/26 4d0d4cdcd47131… 26.1 KB 0
layout.wasm @layout 19 196/196 71f303f052390c… 30 KB 0
grid.wasm @grid 2 12/12 d26718bee08b17… 26 KB 0
knee.wasm @knee_curve 2 16/16 07c71e77c55619… 26.3 KB 0
tone.wasm @tone 4 22/22 006705b11c820a… 26.5 KB 0
peak.wasm @peak 2 10/10 ae2697f94d4cb4… 25.7 KB 0
knee_draft.wasm @draft_curve — --unverified 1e8cc229bb2efb… 40.9 KB 0
sha256.wasm @sha256_impl 8 55/55 d2c89310b66341… 32.1 KB 0
limiter.wasm @limit_frame 3 19/19 161eabc2203954… 28.7 KB 0
crc32.wasm @crc32_z 10 59/59 2a27c83f7e0a66… 28.3 KB 0
add_sat.wasm @add_sat 1 5/5 bbfa58d39c5336… 25.3 KB 0
midpoint.wasm @midpoint 1 5/5 dc21ad60dd5def… 25.3 KB 0
sum4.wasm @sum4 2 10/10 9b266fe756776c… 25.3 KB 0

Honest engineering status (ROADMAP gates G0–G8)

VeriGraph's non-negotiable rule (AGENTS.md §2): never fake a result or mark a gate passed without owner approval. Here is the exact status recorded in the repository:

Honest engineering status (ROADMAP gates G0–G8)
Gate Scope Recorded status
G0 · Scaffold 12-crate workspace, macOS ARM64 & Linux x86_64 CI, spec & errata Criteria hold · awaiting owner approval
G1 · Core IR .vgir round-trip, 56 alpha-equivalence families, 1h fuzzing Criteria hold · awaiting owner approval
G2 · Types & Interp 87 negative type/effect tests, 28,398 conformance vectors Criteria hold · awaiting owner approval
G3 · Verification Known-good/bad suites, 0 surviving mutants, audio limiter Criteria hold · awaiting owner approval
G4 · Codegen & RT 1,000 diff programs pass; blend 0.78× & crc32 1.00× C Open: 3 kernel ratios > 1.20× & Linux sandbox host run
G5 · Agent Loop vg mcp (8 tools), vg-decode (23 µs p99), 30 tasks ready Open: paid API 30-task benchmark run
G6 · Telemetry ≤5-op causal slices on 60/60 seeded bugs, vg explain Criteria hold · awaiting owner approval
G7 · VG-Mesh 421 µs p99 query on 100,000 nodes, tamper rejection Criteria hold · awaiting owner approval
G8 · OmniLift zlib crc32 & adler32, C & Rust SHA-256 in one spec class Criteria hold · awaiting owner approval

Check your understanding · 3 quick questions

1. What can you conclude when `vg check module.vgs` returns `"ok": true`?

2. Why did `u = t / (1 + t)` fail verification in `@soft_knee` while `1 - 1 / (1 + t)` succeeded?

3. What happens if an AI agent calls `vg_build` over `vg mcp` on a node with an `unknown` solver obligation?