-
Notifications
You must be signed in to change notification settings - Fork 449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The motive argument to False.rec
is explicit but elaboration does not use a supplied positional argument as the motive
#4347
Labels
bug
Something isn't working
Comments
@kmill Thanks. Let's go with option 2. |
@leodemoura If you have time, can you explain briefly why this seems more reasonable to you? |
@faenuccio This is an elaboration issue. |
kmill
added a commit
to kmill/lean4
that referenced
this issue
Jul 24, 2024
Some eliminators (such as `False.rec`) have an explicit motive argument. The `elabAsElim` elaborator assumed that all motives are implicit. Closes leanprover#4347
kmill
added a commit
to kmill/lean4
that referenced
this issue
Jul 29, 2024
Some eliminators (such as `False.rec`) have an explicit motive argument. The `elabAsElim` elaborator assumed that all motives are implicit. Closes leanprover#4347
github-merge-queue bot
pushed a commit
that referenced
this issue
Jul 29, 2024
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
One normally expects the motive argument for eliminators to be implicit, but for
False.rec
it is explicit. This interacts in a confusing way with the app eliminator since this explicit argument does not make use of the supplied positional arguments.Context
This question has come up a couple times recently: Zulip discussion 1 and discussion 2
Steps to Reproduce
As one can see, the type of
False.rec
isIt has an explicit argument for the motive.
However, using
False.rec
with an explicit motive throws an error:This is because it's being elaborated as an eliminator, which causes the elaborator to solve for the motive and ignore that it's a positional argument.
The expected behavior is for explicit arguments to be filled positionally from supplied arguments.
A workaround is to write
@False.rec (fun _ => Nat) h
instead to disable elaborating as an eliminator.Versions
4.8.0-rc2
Discussion
These are some potential solutions:
False.rec
is implicit._
if it is meant to be solved for. Ifx : False
, thenx.rec
on its own should be the same asFalse.rec _ x
.They are not mutually exclusive, and even if the first is implemented, the second could still be useful for user
@[elab_as_elim]
declarations.Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
The text was updated successfully, but these errors were encountered: