← All projects
Project record1 mention
Originally shared on Hacker News

Lean 4 formatter

A production-worthy code formatter for the Lean 4 programming language, configurable in the style of clang-format. It handles Lean's partial elaboration with backtracking and can already format important open source Lean libraries; mathlib4 remains the hardest case.

Last shared
01 / The problem

What it addresses

Formatting mathlib4 has no viable plan yet, since it would likely require per-directory quirks files, which is probably a nonstarter.

02 / Source history

Shared over time

Each entry reflects what was shared on that date. Details may have changed since then.

  1. Lean 4 formatter

    A production-worthy code formatter for the Lean 4 programming language, configurable in the style of clang-format. It handles Lean's partial elaboration with backtracking and can already format important open source Lean libraries; mathlib4 remains the hardest case.

    Problem: Formatting mathlib4 has no viable plan yet, since it would likely require per-directory quirks files, which is probably a nonstarter.

    Posted by @reinitctxoffset · Original source ↗

    Source text · @reinitctxoffset · · Source ↗

    Production-worthy formatter for lean4. Right now it copes with important open source libraries on the model of clang-format's configuration, which is a real trick given the partial elaboration you need (with backtracking). But that works. mathlib4 is the final boss, I don't currently even have a plan without per-directory quirks files which is probably a nonstarter.