leanprover / leanprover/lean4

Compilation of large inductive type definition takes ~20mins

Open
#6,820 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P-low
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

Prerequisites
Description

Consider the following Lean 4 source files: src.zip

  • Sorts.lean contains a large mutual block of circular inductive and structure declarations.
  • Rewrite.lean contains an even larger dependent inductive type declaration.

On my system, Sorts.lean takes 2 mins, and Rewrite.lean takes 20 mins to compile, and both require setting maxHeartbeats to a large number. I'd like to confirm whether these compilation times are expected for definitions of this complexity, or something that indicate a bug or inefficiency in the compiler.

Context

The source files have been auto-generated from KEVM, the K Framework definition of the EVM.

Steps to Reproduce

Download source, unzip, then make.

Versions

Lean version: 4.16.0-nightly-2025-01-28

OS version: 22.04.5 LTS (Jammy Jellyfish)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Download and unzip src.zip, then inspect Sorts.lean and Rewrite.lean, focusing on the large mutual and dependent inductive declarations. Run make with the reported Lean nightly version and compare compilation times and heartbeat requirements. Done means determining whether the behavior is expected for these definitions or identifying a compiler inefficiency to investigate.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.