Test "other/inductive-undeclared-universe"
Expected: ✋ reject · Size: 2.6 KB · Lines: 42 · lean4export: 3.1.0 · Lean: 4.34.1 · 📄 Declaration
An inductive type whose type mentions a universe parameter it does not declare.
The export declares, in this order:
inductive U : Sort uwith constructorsU.a U.b : Uand its recursor intoProp, withlevelParams: []everywhere:uis not a parameter of the block;def P.{u} : Sort u := U, which does declareu, so the freeuin the type ofUis read asP's own parameter;theorem pa : P.{0} := U.aandtheorem pb : P.{0} := U.b.
At u := 0 the type U becomes a proposition with two distinct proofs.
The elimination restriction still holds (the recursor only eliminates into
Prop), so this file does not lead to False, but every declaration after
U is checked against a type that has no fixed universe.
A checker must reject U itself: the universe parameters occurring in the
types of an inductive block and its constructors must be among the block's
levelParams, exactly as for definitions, theorems and axioms.
Nanoda, nanoclo and nanobruijn accepted this export, while the official
kernel rejected it with invalid reference to undefined universe level
parameter 'u'. Found by differential
fuzzing of export checkers against the official kernel.