LLM notice
Most of this repo is written by an LLM. If this offends, close the tab and move on.
This readme is written by a human.
News
Updated 2026-11-29: See NEWS.md for human-written summary of changes. Development is ongoing.
Overview
This is an experiment in trying to answer the question "what should programming languages look like in the LLM era?" Meaning: a time when LLMs are the target program-writing audience, and also the threat model, and also the language implementers.
Some characteristics:
- Low level, imperative, linear typed with MVS-ish simplified borrows, no panic or UB
- Lots of extra fiddly typing disciplines
- Finite time & space bounds, no heap
- Interface/implementation split, with contracts and specs
- Typestates, session types, unit checking, information flow control, etc. etc.
- Implemented as a deep embedded DSL in Lean 4
- Each definition elaborated to a Core term and a related Lean function (and some other stuff)
- Core term denotation then auto-proved extensionally equal to Lean function
- Lean used for specifying and proving correctness properties of either object (vcgen, grind, etc.)
- Lean used for anything higher order or polymorphic
- Core term used for the algorithmic, monomorphic inner programs
- Proofs about space, time, linearity etc. use Core term
- Core term compiled independently of normal Lean compilation path
- Verified compilation through a sequence of lowerings with memory refinement and forward simulation proofs relating each layer's semantics. The compiler is written as a Lean function from Core terms to loadable OS object-file bytes: no LLVM or host toolchains are involved.
Ignorance caveat
I cannot say with high confidence how close to reality any of the above characteristics are.
This repo wasn't just written by an LLM to save time, but also because I literally couldn't have written it myself. Most of the theorems much less proofs are over my head. I'm trying to understand what is here, and part of this exploration is the question of how to relate to work I'm guiding while not fully understanding what it's doing. I expect this phenomenon to get worse.
I did do the following with the LLM:
- Asked for, and discussed the implementation of, all of the above characteristics.
- Had it do random differential testing between several pairs:
- Core term translations and the Lean functions.
- Executions and the computed cost models.
- The machine environment model and qemu emulator / host machine states.
- Had it do mutation testing at each stage of the lowering.
- Had it do rounds of skeptical self-review and criticism about proof style, content, vacuity and triviality, etc. from the perspective of a person who believes LLMs only produce useless lies.
- Read a decent portion of the output for a couple days to convince myself it wasn't all lies.
I know all this has the distinct smell of writing "don't make mistakes" in the prompt, and for that I apologize. It is truly unclear to me how to do QA on something I substantially don't understand. I am trying my best.
I am not providing this as a suggestion for anyone to rush out and use (it's slow and generates bad code) or even necessarily spend any of their precious time on earth trying to review for correctness. I will keep doing that part myself. I offer it more as a sketch, perhaps a provocation to other PL people who know this landscape better than me to try something similar but better, and mainly just a concrete answer to a question I keep getting asked.
Navigation
Implementation
- Design docs: doc/design/README.md
- Codebase & theorem tour: doc/guide/tour.md
- Status of work and claims: doc/status.md
- Roadmap: doc/roadmap.md
Language
- Language surface reference: doc/reference/surface.md
- Language tutorial: doc/guide/tutorial.md
Note: the tutorial is messy, and the worked example in it quite trivial. The language is mostly meaningful in terms of its restrictions and missing features; there's nothing exciting about it from an expressivity perspective. I wouldn't bother reading it unless you're morbidly curious, it reads mostly like Lean do-notation with some Rust-isms thrown in. Humans aren't the target audience for writing Millipede programs anyways.
If you're just wondering what it looks like, here's a snippet from the library:
mp def ByteBuf.readFrom (b : &mut ByteBuf cap) (fd : UInt64) requires ByteBuf.Inv cap b ensures ByteBuf.Inv cap b' : UInt64 := do let n := b.len let r := ByteBuf.sysRead fd (&mut b.bytes[n..cap]) if r <= cap -! n then b.len := n +! r r else r
There's now a more involved example in Examples/Httpd.
There should really be nothing surprising in the language.
Prior art
Tons. There's really nothing new here besides:
- LLM attackers increasing the urgency of adopting more rigorous techniques.
- LLM programmers reducing the cost of adopting those techniques, including proof-writing.
- LLM compiler-writers reducing the cost of proving the compilers themselves correct.
When costs change, it can change which techniques make sense.
Cost and complexity
I bought 1 month of "ultra" time on Anthropic's platform, which is USD $200. I intend to let this run until the end of that month. If the project shows promising results within that month, I may consider extending the subscription.
First week was used for initial experiments and setup, with Fable 5.2 driving Opus 5.5 agents driving Lean on a macbook air M4 laptop.
Second week used (and subsequent weeks will likely continue to use) Opus 5.5 driving Opus and Sonnet agents driving Lean on a wider dual-Xeon workstation, able to make faster progress with more parallel work streams.
Human supervision / intervention time is about 6 hours a week. Mostly I just check in at the beginning and end of each day.
The codebase currently weighs in at roughly:
- 100kloc of Lean
- 4000-ish definitions
- 5000-ish theorems
- 22kloc of comments
- 25kloc of tests