8000 feat: `refine f ..` and `refine { a := 1, .. }` by kmill · Pull Request #5525 · leanprover/lean4 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: refine f .. and refine { a := 1, .. } #5525

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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kmill
Copy link
Collaborator
@kmill kmill commented Sep 29, 2024

Adds a list of "ellipsis metavariables" to the elaborator state. Missing arguments or fields using the .. notation elaborate to natural metavariables that are then added to this list. Tactics like refine can then choose to convert unassigned ellipsis metavariables into synthetic opaque metavariables, allowing them to become new goals.

The metavariables are named using the parameter name or the field name. This naming is deferred until they become actual goals to make use of the current goal tag.

The feature does not work for .. that occurs under binders, for example in refine fun _ => { .. }. The issue is that the natural metavariables become assigned during abstraction to applications of metavariables. We could consider supporting this in the future. If we see an ellipsis metavariable is assigned to ?m a b c, we could create a synthetic opaque metavariable from the original ellipsis metavariable and delay assign it to ?m.

Note: this feature is can be compared to the Lean 3 mathlib tactic refine_struct, however it does not provide any special handling for default values or autoparams, or for doing light reduction of projections in the resulting goal states.

Closes #1938

@kmill kmill marked this pull request as ready for review September 29, 2024 20:40
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Sep 29, 2024
@leanprover-community-bot
Copy link
Collaborator

Mathlib CI status (docs):

  • ❗ Mathlib CI can not be attempted yet, as the nightly-testing-2024-09-29 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-mathlib, Mathlib CI should run now. (2024-09-29 20:45:59)

@kmill kmill added the awaiting-review Waiting for someone to review the PR label Sep 29, 2024
@kmill kmill marked this pull request as draft September 29, 2024 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review Waiting for someone to review the PR toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC] Create named goals for omitted fields in structure instances using .. syntax
2 participants
0