This PR adds support for `structure` in `mutual` blocks, allowing inductive types defined by `inductive` and `structure` to be mutually recursive. The limitations are (1) that the parents in the `extends` clause must be defined before the `mutual` block and (2) mutually recursive classes are not allowed (a limitation shared by `class inductive`). There are also improvements to universe level inference for inductive types and structures. Breaking change: structure parents now elaborate with the structure in scope (fix: use qualified names or rename the structure to avoid shadowing), and structure parents no longer elaborate with autoimplicits enabled. Internally, this is a large refactor of both the `inductive` and `structure` commands. Common material is now in `Lean.Elab.MutualInductive`, and each command plugs into this mutual inductive elaboration framework with the logic specific to the respective command. For example, `structure` has code to add projections after the inductive types are added to the environment. Closes #4182
22 lines
585 B
Text
22 lines
585 B
Text
{"textDocument": {"uri": "file:///533.lean"},
|
|
"position": {"line": 4, "character": 10}}
|
|
{"items":
|
|
[{"sortText": "0",
|
|
"label": "F",
|
|
"kind": 6,
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///533.lean"},
|
|
"position": {"line": 4, "character": 10}},
|
|
"id": {"fvar": {"id": "_uniq.7"}},
|
|
"cPos": 0}},
|
|
{"sortText": "1",
|
|
"label": "Foo",
|
|
"kind": 6,
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///533.lean"},
|
|
"position": {"line": 4, "character": 10}},
|
|
"id": {"fvar": {"id": "_uniq.3"}},
|
|
"cPos": 0}}],
|
|
"isIncomplete": true}
|