MLIR dialect for the Timbda-0 Verse calculus, with continuation passing SSA construction proved in Rocq + extracted to OCaml
https://www.cs.uoregon.edu/research/summerschool/summer26/_lectures/SPJ_Verse-figures.pdf#page=15
- Rocq Prover 68.1%
- OCaml 15.7%
- Shell 7.5%
- C++ 6%
- Makefile 2.7%
|
|
||
|---|---|---|
| examples | ||
| media | ||
| mlir | ||
| proof | ||
| src | ||
| tests | ||
| .gitignore | ||
| Makefile | ||
| README.md | ||
litany
An MLIR dialect for Timbda-0, the calculus in Figure 19 of the OPLSS 2026 Verse notes, with continuation passing SSA construction proved in Rocq and extracted to OCaml
Build with Rocq 9.2, OCaml 5.5 and LLVM/MLIR 19:
make MLIR=/usr/lib/llvm-19
make check MLIR=/usr/lib/llvm-19
Example
Each lambda becomes an MLIR region with its parameter as a block argument, as this example shows:
cat examples/Showcase.tim
_build/litany examples/Showcase.tim | _build/litany-opt
make -B _build/Target.vo
| Syntax | Meaning |
|---|---|
int |
Identity graph on ℤ |
:e |
Range of a graph |
f x |
Application |
e | e |
Choice |
fail |
Empty set |
lambda (x := domain). body |
Lambda, also written λ or \ |
Range binds tightest, then left associative application, then choice
Translation validation
litany --validate checks canonicalised and CSE'd modules against their source, after Necula's Translation Validation for an Optimizing Compiler (PLDI 2000), so the C++ folds need no trust
Here 17 operations become 6:
_build/litany examples/Redundant.tim | _build/litany-opt --canonicalize --cse --canonicalize > /tmp/redundant.mlir
_build/litany --validate examples/Redundant.tim /tmp/redundant.mlir
Swapping the operands still passes the MLIR verifier, but validation rejects it:
sed 's/"timbda.apply"(%0, %arg0)/"timbda.apply"(%arg0, %0)/' /tmp/redundant.mlir > /tmp/swapped.mlir
_build/litany --validate examples/Redundant.tim /tmp/swapped.mlir