lean4
lean4 copied to clipboard
chore: use binderIdent consistently in grammar
This PR normalizes usage of binderIdent vs ident across the lean grammar. To construct this PR I reviewed every occurrence of ident to determine whether (1) it is introducing a new binding and (2) it would make sense to be allowed to use _ with the meaning of introducing an unnamed (hygienic automatically named) variable, especially in cases where the unused variables linter might fire.
Currently the PR does not compile because there will be some staging and other bugfixing regarding the use and implementation of the _ part of these commands. Before proceeding I would like a thumbs-up regarding all (or a subset of) the grammar changes proposed here. In the examples below each occurrence of _x represents an ident that would be allowed to be _ under the proposal.
{ _x // e }by intros _xby rename a => _xby injection e with _xby injections _xby have' _x := eby generalize _x : e = _xby cases _x : etermination_by' _x => edecreasing_by _x => tacinitialize _x : e <- enotation "foo" _x => emacro "foo" _x:cat : cat => ematch _x : e with | _x@pat => elet _x y := e; ehave _x y := e; e
Additionally, places which used ident <|> hole for binders were changed to use binderIdent. This decreases the amount of ad-hoc special casing required in programs consuming and constructing lean syntax like mathport. (Unfortunately there is still some conversion required to go from binderIdent to term, since the _ case is represented differently in each case.)