feat: reduce mutual inductive declarations to a single inductive type This PR collapses a mutual inductive block to one inductive family, on the Lean side, and declares the block over it, so that the kernel checks a single inductive type and nothing else. The types of a block differ only in which of them a constructor returns, and the kernel already insists they share their parameters and their universe. `Lean.Meta.MutualGen` generates an enumeration `Idx` with one constructor per type carrying that type's indices, and the block becomes one `M : ∀ params, Idx params → Sort u` whose constructors are the block's. `Tᵢ` is then `M params (Idx.mkᵢ params indices)`, its constructors are the model's, and `Tᵢ.rec` is `M.rec` at a motive dispatching through `Idx.rec`. A computation rule fires at a constructor, whose index is a literal `Idx.mkᵢ`, so the dispatch iota-reduces and every rule of the block holds definitionally over the model: unlike the nested case, nothing has to be proved. Lean 3 did the same reduction with `PSum` and `PSigma`, and had to pad the minor premises with `PUnit` because its recursors took only their own component's; Lean 4 recursors take the whole block's, in the order the model's own recursor wants them. `Lean.Meta.certifyInductive` is the single entry point the kernel calls. The two generators compose without being composed: the model `NestedGen` builds is a mutual block, so declaring it comes back through the same entry point and is reduced in turn. `add_inductive_fn` is then reduced to the single type it is now ever asked to check. Gone with the block are the same-universe and matching-parameter checks across types, the rule that mutually inductive predicates eliminate only into `Prop`, the family index threaded through occurrence checking and recursor construction, the K-target exclusion for mutual declarations, and the loops in every step; `rec_info` existed to be one per type and becomes plain members. A constructor's fields are now split into recursive and non-recursive in one place, which the recursor's type and its computation rules both take rather than each deciding for itself. `add_inductive_fn` goes from 534 lines to 398, and the file from 1010 to 830. Co-Authored-By: Claude <noreply@anthropic.com>
This is the repository for Lean 4.
See Install Lean.
Please read our Contribution Guidelines first.
See Building Lean.