Hello everybody!
First, a fast introduction. I’m a physics and laptop science trainer in France, not a Go skilled. I wrote a bit of Go code a couple of years ago for a telemetry undertaking involving an electrical go-kart, however that’s about it!
Lately, two articles caught my consideration:
I discovered the Go crew’s place notably fascinating. Contributors can use AI, however they continue to be chargeable for verifying their work, and the Go crew evaluations submissions line by line.
That is smart, particularly for a compiler. But it surely additionally made me marvel: might AI brokers assist examine the correctness of Go itself, offered their findings are independently verifiable?
So I made a decision to experiment!
Introducing go-in-lean
go-in-lean is an experimental open-source undertaking impressed by julia-in-lean.
The undertaking is basically developed with AI coding brokers, combining:
-
AI brokers to discover Go’s supply code, construct formal fashions, generate Lean proofs, and examine potential bugs.
-
Lean 4 to confirm properties of normal library capabilities and compiler SSA optimizations.
-
Differential and metamorphic testing to check anticipated conduct in opposition to precise Go implementations.
-
QEMU on my private homelab to check ARM, MIPS, RISC-V, PowerPC, s390x, and different architectures.
-
Human overview to validate findings earlier than reporting them upstream.
How is it completely different from julia-in-lean?
Miles Cranmer’s undertaking already makes use of AI brokers, formal proofs, and differential testing. I’m constructing on that methodology, however exploring a couple of extra instructions:
-
Compiler internals: investigating SSA rewrite guidelines and architecture-specific optimizations, past normal library capabilities.
-
Bit-precise reasoning: utilizing Lean’s
BitVecandbv_decideto confirm fixed-width integer operations, with express auditing of the extra proof assumptions. -
Cross-architecture testing: working QEMU-based fuzzing campaigns on my homelab, with no need bodily {hardware} for each goal structure.
The QEMU half turned out to be notably helpful. Some compiler bugs solely seem on particular architectures.
Early outcomes
The experiment has already uncovered a number of reproducible Go compiler miscompilations, together with architecture-specific points, reported upstream.
A number of examples:
In fact, proving a property of a Lean mannequin doesn’t show the correctness of the particular Go implementation. Each suspected bug should be reproduced, and QEMU testing has its limitations.
Why am I sharing this?
I’m within the methodology as a lot because the bugs themselves.
Can AI brokers assist us examine complicated software program exterior our main areas of experience, whereas formal strategies, reproducible testing, and human overview assist set up confidence within the outcomes?
I’m actually studying loads about Go and its compiler alongside the best way, and I’d admire suggestions from individuals who know them significantly better than I do.
Suggestions, criticism, and contributions are very welcome!

