Goal
Upgrade the Verity toolchain and its EVMYulLean dependency from Lean 4.24.0 to Lean 4.30.0, while preserving kernel/trust guarantees and using the upgrade to improve maintainability, proof automation, dependency hygiene, and executable performance.
Priority: deliberately last in the current roadmap. Do not start this while the authorized existing Verity PR drain or roadmap lanes A–H are blocked by unfinished integration work.
Current baseline
- Verity pins
leanprover/lean4:v4.24.0, Mathlib v4.24.0, Batteries v4.24.0, and lfglabs-dev/EVMYulLean at 38d53df8b4488d5322894619ea8385fcbb2e6f5d.
- Static inventory on current
main: 386 Lean files / about 279k lines. The largest proof files are about 33k, 30k, 11k, and 8k lines, so migration failures may have wide compile fan-out.
NethermindEth/EVMYulLean main still pins Lean/Mathlib 4.22.0. The LFG fork is already on 4.24.0 and contains downstream verification hooks; its current main is two commits ahead of Verity's pin.
- EVMYulLean is comparatively small: 66 Lean files / about 11.4k lines.
Relevant Lean 4.25–4.30 changes
Primary release notes:
Migration-sensitive changes
-
Lean 4.29 transparency / instance behavior
isDefEq no longer raises transparency while comparing implicit arguments.
simp/dsimp no longer simplify typeclass instances by default.
@[implicit_reducible] and the improved inferInstanceAs are the intended fixes for legitimate alias transport; the project-wide backward.isDefEq.respectTransparency=false option should only be a temporary diagnostic, never the final migration state.
- Audit semireducible type aliases and hand-written transported instances.
-
inferInstanceAs behavior
- EVMYulLean has 10 uses across
EvmYul/Wheels.lean, EvmYul/UInt256.lean, EvmYul/Data/Stack.lean, and EvmYul/Yul/Ast.lean.
- Decide explicitly whether
Identifier, Blob, Stack, and similar wrappers are representational aliases (abbrev) or abstraction boundaries (real wrapper structures). Avoid relying on accidental definitional unfolding.
-
Stricter noncomputable semantics and universe inference
- Lean 4.29 may require additional
noncomputable annotations.
- Recursive predicates and universe levels that appeared only in constructor fields may need explicit annotations.
-
Native computation trust reporting changed
- From Lean 4.29,
native_decide/bv_decide produce one generated axiom per computation instead of reporting the single Lean.trustCompiler axiom.
- Verity has hundreds of textual
native_decide occurrences in tests/witnesses and a fixed builtin allowlist in scripts/check_axioms.py that currently names Lean.trustCompiler.
- Update the axiom parser/classifier, trust reports, tests,
AXIOMS.md, AUDIT.md, and TRUST_ASSUMPTIONS.md together. Fail closed: recognize generated native-computation axioms structurally and report their exact users; do not add an unrestricted wildcard allowlist.
-
Metaprogramming/module changes
- Lean 4.30 makes theorems opaque in essentially all contexts and re-enables axiom dependency data under the module system.
- Verity's generated
PrintAxioms.lean contains a custom recursive environment walker over env.checked.get.find?. Revalidate it against 4.30 and prefer a small wrapper around supported Lean axiom APIs if possible.
- No direct uses of the renamed
isStructureLike/compileDecl APIs were found in the initial static scan, but custom command elaborators still need compilation testing.
-
Lake and FFI changes
- EVMYulLean has custom Lake targets for C FFI libraries and four
@[extern] ByteArray functions. Rebuild and execute those paths; compilation success alone is not enough to establish ABI/runtime correctness.
- Lean 4.30's Lake cache overhaul changes artifact materialization/download behavior and adds staged transfers,
fixedToolchain, parallel transfers, and on-demand restoration.
Opportunities after the minimal port
These should be follow-up PRs, not mixed into the version-bump PR.
Verity
- Trust audit cleanup: replace brittle custom axiom traversal where supported 4.30 APIs suffice; add
leanchecker as an independent CI validation layer.
- Import/API boundaries: both repositories currently use only plain imports (initial scan: ~1,262 in Verity and ~364 in the LFG EVMYulLean fork), with no real module-system visibility boundaries. Introduce
module, public/private/meta imports, public section, assert_not_imported, and assert_not_exists incrementally around stable leaf APIs.
- Dependency minimization: run
lake shake module-by-module, starting with proof API leaves and generated audit modules. Do not perform a whole-tree import rewrite in one PR.
- Proof automation: pilot user-defined
grind attributes, [grind norm], [grind unfold], +locals, higher-order Miller-pattern matching, and sym => on one repetitive semantics family. Verity currently has about 10k textual simp and 1k omega occurrences, but broad replacement without benchmarks would be risky.
- Symbolic simulation: evaluate Lean 4.28's symbolic simulation framework as a reusable VC/symbolic-execution layer for the IR/Yul semantics. Start with one isolated straight-line fragment and compare proof term size, elaboration time, and maintainability against the current bespoke bridge lemmas.
- Concrete evaluation: pilot the expanded kernel-oriented
cbv tactic for concrete compiler/interpreter smoke goals where it can replace fragile unfolding scripts or trusted native computation.
- File decomposition: split the 30k+ line proof modules along stable semantic interfaces only after the port is green. Use module visibility and dependency assertions to prevent the split from creating a larger accidental public API.
- Executable performance: benchmark the completed LCNF backend and user borrow annotations on the compiler/CLI and metaprogramming paths.
ReaderT already benefits globally; add explicit @& only after profiling shows reference-count pressure. These changes may improve executable runtime/binary size, not necessarily proof elaboration.
- Build performance: adopt the 4.30 cache features in the dedicated Verity workspace, with exact-toolchain isolation and before/after clean/incremental build measurements.
EVMYulLean
- Port the maintained LFG fork first, then decide whether to upstream the clean 4.30 port to
NethermindEth/EVMYulLean (which currently jumps from 4.22 rather than 4.24).
- Resolve the 10 transported-instance sites explicitly instead of using the global backward-compatibility option.
- Keep the existing borrowed
@& ByteArray FFI arguments and benchmark the 4.30 backend; verify SHA-256, Keccak, Blake2, and zero-byte-array runtime behavior against known vectors.
- Add import visibility and
lake shake incrementally; the small codebase is a good pilot before attempting the same discipline in Verity.
- Consider
grind/cbv only where they remove repetitive proofs in UInt256, stack, and Yul size lemmas; do not add automation merely because it is new.
Proposed implementation sequence
- Capture reproducible 4.24 baselines for both repos: clean build, tests, axiom report, build time, peak RSS, artifact/binary size.
- Upgrade
lfglabs-dev/EVMYulLean to Lean/Mathlib 4.30.0 in a dedicated branch.
- Inventory compile failures. A localized backward transparency option may be used temporarily to classify failures, but the final diff must remove it.
- Fix Lake/FFI and instance/alias issues; run
lake build, conform/Yul tests, and known-vector FFI tests.
- Update Verity to Lean/Mathlib/Batteries 4.30.0 and pin the green EVMYulLean commit.
- Repair source and proofs without semantic refactors. Regenerate and validate
PrintAxioms.lean; update all trust-boundary documents in the same PR.
- Run
make check, Python and Foundry tests, full lake build, generated trust reports, and an independent leanchecker pass.
- Compare 4.24 vs 4.30 clean/incremental build time, peak RSS, audit runtime, CLI runtime, and binary size. Do not claim a performance gain without measurements.
- Land follow-up refactor PRs separately: trust audit API, imports/modules, one automation pilot, one symbolic-simulation pilot, then large-file decomposition.
Acceptance criteria
Explicit non-goals for the version-bump PR
- No broad proof rewrite to
grind.
- No whole-repository module/import conversion.
- No simultaneous redesign of Verity semantics.
- No upstream publication claim until the fork port, Verity integration, trust audit, and runtime checks are all complete.
Goal
Upgrade the Verity toolchain and its EVMYulLean dependency from Lean 4.24.0 to Lean 4.30.0, while preserving kernel/trust guarantees and using the upgrade to improve maintainability, proof automation, dependency hygiene, and executable performance.
Priority: deliberately last in the current roadmap. Do not start this while the authorized existing Verity PR drain or roadmap lanes A–H are blocked by unfinished integration work.
Current baseline
leanprover/lean4:v4.24.0, Mathlibv4.24.0, Batteriesv4.24.0, andlfglabs-dev/EVMYulLeanat38d53df8b4488d5322894619ea8385fcbb2e6f5d.main: 386 Lean files / about 279k lines. The largest proof files are about 33k, 30k, 11k, and 8k lines, so migration failures may have wide compile fan-out.NethermindEth/EVMYulLeanmainstill pins Lean/Mathlib 4.22.0. The LFG fork is already on 4.24.0 and contains downstream verification hooks; its currentmainis two commits ahead of Verity's pin.Relevant Lean 4.25–4.30 changes
Primary release notes:
Migration-sensitive changes
Lean 4.29 transparency / instance behavior
isDefEqno longer raises transparency while comparing implicit arguments.simp/dsimpno longer simplify typeclass instances by default.@[implicit_reducible]and the improvedinferInstanceAsare the intended fixes for legitimate alias transport; the project-widebackward.isDefEq.respectTransparency=falseoption should only be a temporary diagnostic, never the final migration state.inferInstanceAsbehaviorEvmYul/Wheels.lean,EvmYul/UInt256.lean,EvmYul/Data/Stack.lean, andEvmYul/Yul/Ast.lean.Identifier,Blob,Stack, and similar wrappers are representational aliases (abbrev) or abstraction boundaries (real wrapper structures). Avoid relying on accidental definitional unfolding.Stricter
noncomputablesemantics and universe inferencenoncomputableannotations.Native computation trust reporting changed
native_decide/bv_decideproduce one generated axiom per computation instead of reporting the singleLean.trustCompileraxiom.native_decideoccurrences in tests/witnesses and a fixed builtin allowlist inscripts/check_axioms.pythat currently namesLean.trustCompiler.AXIOMS.md,AUDIT.md, andTRUST_ASSUMPTIONS.mdtogether. Fail closed: recognize generated native-computation axioms structurally and report their exact users; do not add an unrestricted wildcard allowlist.Metaprogramming/module changes
PrintAxioms.leancontains a custom recursive environment walker overenv.checked.get.find?. Revalidate it against 4.30 and prefer a small wrapper around supported Lean axiom APIs if possible.isStructureLike/compileDeclAPIs were found in the initial static scan, but custom command elaborators still need compilation testing.Lake and FFI changes
@[extern]ByteArray functions. Rebuild and execute those paths; compilation success alone is not enough to establish ABI/runtime correctness.fixedToolchain, parallel transfers, and on-demand restoration.Opportunities after the minimal port
These should be follow-up PRs, not mixed into the version-bump PR.
Verity
leancheckeras an independent CI validation layer.module, public/private/meta imports,public section,assert_not_imported, andassert_not_existsincrementally around stable leaf APIs.lake shakemodule-by-module, starting with proof API leaves and generated audit modules. Do not perform a whole-tree import rewrite in one PR.grindattributes,[grind norm],[grind unfold],+locals, higher-order Miller-pattern matching, andsym =>on one repetitive semantics family. Verity currently has about 10k textualsimpand 1komegaoccurrences, but broad replacement without benchmarks would be risky.cbvtactic for concrete compiler/interpreter smoke goals where it can replace fragile unfolding scripts or trusted native computation.ReaderTalready benefits globally; add explicit@&only after profiling shows reference-count pressure. These changes may improve executable runtime/binary size, not necessarily proof elaboration.EVMYulLean
NethermindEth/EVMYulLean(which currently jumps from 4.22 rather than 4.24).@& ByteArrayFFI arguments and benchmark the 4.30 backend; verify SHA-256, Keccak, Blake2, and zero-byte-array runtime behavior against known vectors.lake shakeincrementally; the small codebase is a good pilot before attempting the same discipline in Verity.grind/cbvonly where they remove repetitive proofs inUInt256, stack, and Yul size lemmas; do not add automation merely because it is new.Proposed implementation sequence
lfglabs-dev/EVMYulLeanto Lean/Mathlib 4.30.0 in a dedicated branch.lake build, conform/Yul tests, and known-vector FFI tests.PrintAxioms.lean; update all trust-boundary documents in the same PR.make check, Python and Foundry tests, fulllake build, generated trust reports, and an independentleancheckerpass.Acceptance criteria
make check, tests, and full Lean build are green on 4.30.backward.*compatibility option remains.sorry,admit, project axiom, or silently widened native-computation allowlist.AXIOMS.md,AUDIT.md, andTRUST_ASSUMPTIONS.mdmatch the 4.30 native-computation and checker semantics.Explicit non-goals for the version-bump PR
grind.