Changelog

leanprover/lean4 · · 13 commits

Lean gets faster parsing and safer Lake

Major parser, matcher, and Lake fixes land alongside several string-proof and interpreter speedups.

Module headers can now be parsed from an offset (ejgallego38a5743)

Lean.Parser.parseHeader now accepts a starting byte position, so tools can parse headers inside larger source buffers while preserving source locations and leading whitespace. This removes a workaround for embedded regions like Verso and adds regression coverage for UTF-8 offsets.

Equation generation for match h : e is much faster (leodemoura1ded69e)

The match compiler now strips discriminant equality proofs before proving conditional equations, avoiding expensive work when value-pattern matches are applied to Eq.refl proofs. This cuts heartbeat use dramatically for large String pattern matches and makes equation generation scale much better.

String literal disequality proofs got cheaper (leodemoura4add57c, leodemoura4f60629)

Lean now builds and checks String-inequality proofs with lighter-weight kernel terms, first by simplifying the proof construction and then by traversing both strings in one pass when checking character differences. These changes speed up simp, cbv, and generated match equations that rely on String patterns.

Imported parsers are evaluated lazily on first use (Kha6650592)

Parser declarations imported from other modules are no longer fully evaluated during import; they’re wrapped in thunks and compiled only when actually needed. That reduces import overhead and build instructions, especially for large dependency graphs.

Interpreter skips native-symbol lookups for non-native modules (Kha9180032)

Lean now avoids probing native initializers and symbols for modules that have no native code, which speeds up module import and interpretation. On large builds like Mathlib, this trims a measurable chunk of build work.

Lake cache writes and downloads are now safer (tydeud3ba418, tydeu4b6cc39, tydeu23a047a, tydeu1617621, tydeubba62c2)

Lake gained multiple correctness fixes around caching and builds: downloads now stage to temporary files before publishing, artifact writes are made atomic, stale traces are cleared before builds, concurrent source edits can now fail the build instead of poisoning the store, and unpacking .ltar archives now clears stale .hash files too. These changes close several race conditions and cache-corruption paths.

Other misc changes

  • Refactored shared discrimination-tree lookup code.
  • Updated stage0.
  • Misc Lake job-wrapping/logging fixes.