You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Lean.Replay: mutual block replayed before constants used only in a later type's signature #16133
Environment.replay (used by leanchecker --from-export) can add a mutual inductive block before constants that only the types of its non-first members depend on. Valid exports are then rejected with unknown constant.
mutualinductiveA : Prop where
| mk : A
inductiveAB : Bool → Prop where
end
The export contains Bool (before the block), and the module compiles. The failure depends on hash order, so it is deterministic for a given name but not for all of them. Renaming A/AB to P/PB, Q/QB, Foo/FooB or Mut/MutB makes it pass, while Even, Good, X and Y fail.
In src/Lean/Replay.lean, the .inductInfo case:
replays the used constants of the constant it started from (via replayConstant);
replays the used constants of every constructor in the block;
never replays those of the other members' types (ci.type for ci ∈ all).
When replay reaches the block through A, nothing has pulled Bool in yet. AB has no constructor mentioning it, and the kernel then sees AB : Bool → Prop.
A fix would be to replay each member's type dependencies before addDecl:
for ci in all do
replayConstants ci.getUsedConstantsAsSet
lean4lean --import has the same copy (Lean4Lean/Replay.lean) and fails the same way. Running leanchecker MA on the .olean passes, because Init is already loaded.
Similar in kind to #15853: replay order missing a dependency.
Activity
fix: replay type dependencies of all mutual inductive members in `Ker…