feat: refine f ..
and refine { a := 1, .. }
#5525
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 likerefine
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 inrefine 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