Language

Go

A garbage-collected language with built-in concurrency, common in network services and cloud infrastructure.

What do you want to prove about your Go code?

Where proofs can attach

Toolchains that verify Go directly, and those that verify what it compiles to. A proof about compiled code also relies on the compiler that produced it.

  1. Compiled from Languages that compile to Go
    Dafny verification language
    • to Go via Dafny compiler (Go backend) trusted
  2. Your code
  3. Machine code Proofs here are about the binary itself
    • from Go via gc (the Go compiler) trusted
    • from Go via gc (the Go compiler) trusted
    • from Go via gc (the Go compiler) trusted

Verify Go directly

Ranked by stage, feature coverage and trust.

Toolchain Stage Trust Effort Feature coverage
Gobra

Add specifications as comments to Go code; Gobra translates it to the Viper verifier, which proves memory safety, race freedom and your contracts.

Stage 1 · Usable Trust: Checker partial, Semantics weak, Frontend partial, Binary gap weak, Escape hatches partial 0/5 Auto-active 9/14full, 5 partial

Verify the compiled code

These prove facts about what the compiler produced, not about your source.

Toolchain Stage Trust Effort Path
s2n-bignum

Prove hand-written x86-64 or Arm64 assembly correct in HOL Light, on the exact bytes of the built object file; used for AWS's cryptography code.

Stage 1 · Usable Trust: Checker strong, Semantics partial, Frontend strong, Binary gap strong, Escape hatches strong 4/5 Interactive x86-64 (gc (the Go compiler), trusted)
Islaris

Prove Arm or RISC-V machine code correct in Rocq, against the full official Sail ISA models, using Isla symbolic execution and an Iris separation logic.

Stage 0 · Research Trust: Checker partial, Semantics strong, Frontend partial, Binary gap strong, Escape hatches partial 2/5 Interactive AArch64 (gc (the Go compiler), trusted)
LNSym

Prove Armv8 (AArch64) machine code correct in Lean 4 by symbolic simulation over a hand-written model; aimed at AWS-LC cryptographic routines.

Stage 0 · Research Trust: Checker strong, Semantics partial, Frontend partial, Binary gap strong, Escape hatches partial 2/5 Interactive AArch64 (gc (the Go compiler), trusted)

Write new verified code that becomes Go

You write in a verification language; its compiler emits the code.

Toolchain Stage Trust Effort Path
Dafny

Write programs in Dafny with specifications; the verifier proves them through Boogie and Z3, then Dafny compiles the code to C#, Java, Go, JavaScript or Python.

Stage 1 · Usable Trust: Checker partial, Semantics partial, Frontend strong, Binary gap weak, Escape hatches partial 1/5 Auto-active from Dafny: Go (Dafny compiler (Go backend), trusted)

Feature coverage

Which language features each toolchain handles. Hover or focus a mark for the note and source. Toolchains on compiled code are shown for common features only.

Feature Gobra s2n-bignum via x86-64 Islaris via AArch64 LNSym via AArch64
Common features
Machine integersFixed-width integer arithmetic, overflow and bit operations. Gobra, Machine integers: Partial.Without --overflow (the default) Gobra treats bounded integers as mathematical integers, so it neither checks overflow nor models wrap-around. The tutorial also says support for some integer types such as rune is very limited.
Source
s2n-bignum, Machine integers: Unknown. Islaris, Machine integers: Unknown. LNSym, Machine integers: Unknown.
Floating pointIEEE 754 floating-point arithmetic, including rounding and NaNs. Gobra, Floating point: Partial.Basic float32/float64 arithmetic appears in the regression tests; how closely IEEE 754 is modeled is not documented.
Source
s2n-bignum, Floating point: Unknown. Islaris, Floating point: Unknown. LNSym, Floating point: Unknown.
Heap and pointersDynamically allocated memory, pointers or references, and aliasing. Gobra, Heap and pointers: Supported.Pointers and heap access use permissions (acc predicates), including fractional and quantified permissions.
Source
s2n-bignum, Heap and pointers: Unknown. Islaris, Heap and pointers: Unknown. LNSym, Heap and pointers: Unknown.
Arrays and buffersIndexed memory such as arrays, slices, vectors and byte buffers. Gobra, Arrays and buffers: Supported.Arrays and slices are supported.
Source
s2n-bignum, Arrays and buffers: Unknown. Islaris, Arrays and buffers: Unknown. LNSym, Arrays and buffers: Unknown.
LoopsUnbounded loops, which need invariants or bounds to verify. Gobra, Loops: Supported.Loop invariants; decreases clauses for termination.
Source
s2n-bignum, Loops: Unknown. Islaris, Loops: Unknown. LNSym, Loops: Unknown.
RecursionFunctions that call themselves, directly or through others. Gobra, Recursion: Supported.
Source
s2n-bignum, Recursion: Unknown. Islaris, Recursion: Unknown. LNSym, Recursion: Unknown.
Higher-order codeFunction pointers, closures and callbacks. Gobra, Higher-order code: Supported.Closures are specified with specification types and proved to satisfy them.
Source
s2n-bignum, Higher-order code: Unknown. Islaris, Higher-order code: Unknown. LNSym, Higher-order code: Unknown.
Threads and shared memoryConcurrent threads with locks, atomics or message passing. Gobra, Threads and shared memory: Supported.Goroutines, channels and sync.Mutex, with permissions passed between goroutines.
Source
s2n-bignum, Threads and shared memory: Unknown. Islaris, Threads and shared memory: Unknown. LNSym, Threads and shared memory: Unknown.
I/O and system callsFiles, network, system calls and foreign-function calls. Gobra, I/O and system calls: Partial.Some packages (for example net, fmt, time) have trusted specification stubs; other I/O needs hand-written specifications.
Source
s2n-bignum, I/O and system calls: Unknown. Islaris, I/O and system calls: Unknown. LNSym, I/O and system calls: Unknown.
Standard librarySpecifications or models for the language's standard library. Gobra, Standard library: Partial.Specification stubs exist for a few packages (bytes, encoding/binary, errors, fmt, net, strconv, strings, sync, time); they are assumed, not verified.
Source
s2n-bignum, Standard library: Unknown. Islaris, Standard library: Unknown. LNSym, Standard library: Unknown.
Go-specific features
Goroutines and channelsLightweight threads communicating over channels. Gobra, Goroutines and channels: Supported.go statements and channels are verified with predicates that say which permissions travel with each message.
Source
· · ·
InterfacesInterface types and dynamic dispatch. Gobra, Interfaces: Supported.Interfaces with specifications and implementation proofs. Gobra tracks whether interface values are comparable, because comparing incomparable values panics in Go.
Source
· · ·
Slices and mapsBuilt-in slices and hash maps. Gobra, Slices and maps: Supported.Slices and maps are covered by the regression suite.
Source
· · ·
defer, panic and recoverDeferred calls and panic recovery. Gobra, defer, panic and recover: Partial.defer is supported (regression tests); support for panic and recover is not documented.
Source
· · ·

Supported Partial Not supported Unknown

Formal semantics of Go

Models that proofs about Go can be stated against. See formal semanticsFormal semantics. A precise, mathematical definition of what programs in a language do..

None in the index yet.

Compilers from Go

What each compilation step preserves, and whether it is proved.

ToViaAssuranceWhat does not carry over
x86-64 gc (the Go compiler) trusted Specifications Goroutine scheduling and the garbage collector become runtime code.
AArch64 gc (the Go compiler) trusted Specifications Goroutine scheduling and the garbage collector become runtime code.
RISC-V gc (the Go compiler) trusted Specifications Goroutine scheduling and the garbage collector become runtime code.
esc