What it is
A small language with a compiler with a correctness theorem
The Pancake compiler, ported
The Pancake compiler was originally verified in HOL4. Flapjack is bringing the compiler and proofs about it to Lean.
Easy for AI agents to write
Pancake is a small, low-level language with simple rules. That makes it a good target for code written by AI agents.
A fragment of Pancake to RISC-V
A path covering a fragment of Pancake source is implemented. Some features of Pancake, such as floating point, are missing. All stages except initial steps (the Pancake parser and AST conversion) are associated with a correctness theorem. The software is open source under the BSD-3-Clause License.
The same path to MIPS32, for Ziren
A MIPS32 backend targets the Ziren zkVM, with its own correctness theorem stated against Ziren's Lean model of MIPS32. Its output has been run only on that model, and not yet on Ziren itself.
The machine code does what the Pancake program does
with result r and an I/O trace, the machine code terminates too, with the same result r and the same I/O trace.
and runs forever, the machine code diverges too with the same I/O trace.
You reason about the Pancake program, and the theorem carries that reasoning down to the machine code.
Small print. For the correctness theorem to work fully, the stack size of the Pancake program needs to be statically determined, and must be small enough. Otherwise, the theorem leaves the possibility that the machine code runs out of resources while the source doesn't. Some other limitations are documented in SOUNDNESS.md; that list is not exhaustive. The exact Lean statement needs to be examined. The exact statements (RISC-V, MIPS32) are rather big and is in Lean, including all definitions directly or indirectly referred to, as interpreted by parser and elaborator of Lean. Flapjack's RISC-V model is different from the authoritative Sail RISC-V model. For MIPS32, the guarantee ends at Ziren's executable Lean model of MIPS32r2, which is checked against QEMU test vectors but not proved correct; the startup frame, FFI stubs and a Ziren guest runtime are not verified. The MIPS32 output has not been tested on Ziren itself yet. See MIPS32.md. Nobody has examined the Lean statement as far as we know. Lean statements accepted by Lean as theorems might not be true. Flapjack is distributed "as is" under the BSD-3 Clause License.
Status
What's on the plate
Get in touch
Who to talk to
zkVM guest programs
Contact zkSecurity
If you want to use Flapjack to build guest programs for zkVMs, you can talk to zkSecurity.
Other uses · ARM · x86
Contact Flamingo Ponderado
For any other use, or if you need another target such as ARM or x86, send an email.
hello@flamingoponderado.com