lean4 icon indicating copy to clipboard operation
lean4 copied to clipboard

fix: make `elabAsElim` aware of explicit motive arguments

Open kmill opened this issue 1 year ago • 4 comments

Some eliminators (such as False.rec) have an explicit motive argument. The elabAsElim elaborator assumed that all motives are implicit.

If the explicit motive argument is _, then it uses the elab-as-elim procedure, and otherwise it falls back to the standard app elaborator.

Furthermore, if an explicit elaborator is not provided, it falls back to treating the elaborator as being implicit, which is convenient for writing h.rec rather than h.rec _. Rationale: for False.rec, this simulates it having an implicit motive, and also motives are generally not going to be available in the expected type.

Closes #4347

kmill avatar Jul 24 '24 05:07 kmill

Just based off the PR description: did you consider the alternative of making all motives implicit? Or is there a good reason to make them explicit it some cases?

nomeata avatar Jul 24 '24 05:07 nomeata

Mathlib CI status (docs):

@nomeata Yes, and that's a good question that's worth discussing here. First, there's Leo's comment about how eliminators like False.rec come from the kernel, and so we should fix the elaborator. Second, user eliminators do sometimes have explicit motives for whatever reason.

kmill avatar Jul 24 '24 07:07 kmill

Thanks, these are good points. Ah, and I should have followed the link to the issue to find it out myself :-)

nomeata avatar Jul 24 '24 08:07 nomeata