This PR generates `.ctorIdx` functions for all inductive types, not just enumeration types. This can be a building block for other constructions (`BEq`, `noConfusion`) that are size-efficient even for large inductives. It also renames it from `.toCtorIdx` to `.ctorIdx`, which is the more idiomatic naming. The old name exists as an alias, with a deprecation attribute to be added after the next stage0 update. These functions can arguably compiled down to a rather efficient tag lookup, rather than a `case` statement. This is future work (but hopefully near future). For a fair number of basic types the compiler is not able to compile a function using `casesOn` until further definitions have been defined. This therefore (ab)uses the `genInjectivity` flag and `gen_injective_theorems%` command to also control the generation of this construct. For (slightly) more efficient kernel reduction one could use `.rec` rather than `.casesOn`. I did not do that yet, also because it complicates compilation.
72 lines
2.2 KiB
Text
72 lines
2.2 KiB
Text
{"textDocument": {"uri": "file:///completionFallback.lean"},
|
|
"position": {"line": 14, "character": 14}}
|
|
{"items":
|
|
[{"label": "noConfusionType",
|
|
"kind": 3,
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionFallback.lean"},
|
|
"position": {"line": 14, "character": 14}},
|
|
"id": {"const": {"declName": "Direction.noConfusionType"}},
|
|
"cPos": 0}},
|
|
{"label": "left",
|
|
"kind": 4,
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionFallback.lean"},
|
|
"position": {"line": 14, "character": 14}},
|
|
"id": {"const": {"declName": "Direction.left"}},
|
|
"cPos": 0}},
|
|
{"label": "right",
|
|
"kind": 4,
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionFallback.lean"},
|
|
"position": {"line": 14, "character": 14}},
|
|
"id": {"const": {"declName": "Direction.right"}},
|
|
"cPos": 0}},
|
|
{"label": "up",
|
|
"kind": 4,
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionFallback.lean"},
|
|
"position": {"line": 14, "character": 14}},
|
|
"id": {"const": {"declName": "Direction.up"}},
|
|
"cPos": 0}},
|
|
{"label": "down",
|
|
"kind": 4,
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionFallback.lean"},
|
|
"position": {"line": 14, "character": 14}},
|
|
"id": {"const": {"declName": "Direction.down"}},
|
|
"cPos": 0}}],
|
|
"isIncomplete": true}
|
|
{"textDocument": {"uri": "file:///completionFallback.lean"},
|
|
"position": {"line": 28, "character": 30}}
|
|
{"items":
|
|
[{"label": "mk",
|
|
"kind": 4,
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionFallback.lean"},
|
|
"position": {"line": 28, "character": 30}},
|
|
"id": {"const": {"declName": "CustomAnd.mk"}},
|
|
"cPos": 0}},
|
|
{"label": "hb",
|
|
"kind": 23,
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionFallback.lean"},
|
|
"position": {"line": 28, "character": 30}},
|
|
"id": {"const": {"declName": "CustomAnd.hb"}},
|
|
"cPos": 0}},
|
|
{"label": "ha",
|
|
"kind": 23,
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionFallback.lean"},
|
|
"position": {"line": 28, "character": 30}},
|
|
"id": {"const": {"declName": "CustomAnd.ha"}},
|
|
"cPos": 0}}],
|
|
"isIncomplete": false}
|