Fil-C -> Haskell compiler with a Lean 4 checker that validates generated modules against the typed C syntax tree
  • Lean 72.9%
  • OCaml 15%
  • Haskell 6%
  • C 3.9%
  • Shell 2%
  • Other 0.2%
Find a file
sneeker 332accc133 Merge pull request #2 from rasidency/develop
split integration into dune rules + replay the differential past faults
2026-11-21 21:43:21 +00:00
.github/workflows ci(verification): run runtest, integration and release as parallel jobs 2026-11-21 17:52:00 +00:00
assets build(project): import compiler baseline 2026-06-01 21:59:00 +00:00
examples build(project): import compiler baseline 2026-06-01 21:59:00 +00:00
proof test(runtime): keep replaying differential scripts past a fault 2026-11-21 19:49:00 +00:00
runtime feat(runtime): preserve atomic pointer snapshots across byte stores 2026-11-20 19:47:00 +00:00
src fix(process): defer signals to checkpoints so cleanup always reaps the child 2026-11-21 11:52:00 +00:00
test test(runtime): keep replaying differential scripts past a fault 2026-11-21 19:49:00 +00:00
tools test(integration): give each scenario its own dune rule 2026-11-21 18:58:00 +00:00
.dockerignore build(release): ship the checker and its reproducible fixtures 2026-11-21 07:56:00 +00:00
.gitattributes build(github): count lean proof sources in language statistics 2026-11-17 08:39:00 +00:00
.gitignore build(project): import compiler baseline 2026-06-01 21:59:00 +00:00
Containerfile build(container): build the proofs before copying the compiler sources 2026-11-21 17:08:00 +00:00
dune test(integration): give each scenario its own dune rule 2026-11-21 18:58:00 +00:00
dune-project build(project): import compiler baseline 2026-06-01 21:59:00 +00:00
heresy.opam build(project): import compiler baseline 2026-06-01 21:59:00 +00:00
lake-manifest.json build(project): import compiler baseline 2026-06-01 21:59:00 +00:00
lakefile.toml test(runtime): replay random heap scripts against the lean effect model 2026-11-21 14:33:00 +00:00
lean-toolchain build(project): import compiler baseline 2026-06-01 21:59:00 +00:00
README.md docs(verification): summarise the compiler and its checked semantics 2026-11-21 09:26:00 +00:00

heresy

heresy is an OCaml compiler that translates Fil-C into standalone Haskell. A Lean 4 checker reconstructs the lowering from the typed C syntax tree and checks the generated module before GHC compiles it.

Build and run

With the toolchain pinned in the Containerfile, compile the expression machine and run it on an arithmetic expression. The machine prints the stack instructions it executes and finishes with Result: 11:

export FILCC=/path/to/filc/build/bin/clang
lake build certificate
mkdir -p build
dune exec --profile release -- heresy examples/machine.c \
  --certificate .lake/build/bin/certificate --build build/machine
./build/machine '3+4*2'

Verification

A pointer carries an allocation identity alongside its numeric address. Copying a struct copies the identities of its pointer fields, so freeing a pointee invalidates aliases in both copies even though their stored address bytes are intact.

For accepted programmes, Lean proves that the typed source model and the lowered action model agree on completed observations, including exit status and stdout.

A separate native backend emits a 132-byte x86-64 Linux executable for a closed integer expression and proves its exit status in the machine model.

Run the differential suite against native Fil-C:

dune runtest --profile release