Skip to content
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

feat: allow explicit mode with field notation #5528

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

kmill
Copy link
Collaborator

@kmill kmill commented Sep 30, 2024

Now one can write @x.f, @(x).f, @x.1, @(x).1, and so on.

This fixes an issue where structure instance update notation (like {x with a := a'}) could fail if the field a had a type with implicit, optional, or auto parameters.

Closes #5406

Now one can write `@x.f`, `@(x).f`, `@x.1`, `@(x).1`, and so on.

This fixes an issue where structure instance update notation (like `{x with a := a'}`) could fail if the field `a` had a type with implicit, optional, or auto parameters.

Closes leanprover#5406.
@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 30, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Sep 30, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Sep 30, 2024
@leanprover-community-bot leanprover-community-bot added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Sep 30, 2024
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Sep 30, 2024

Mathlib CI status (docs):

@digama0
Copy link
Collaborator

digama0 commented Sep 30, 2024

isn't this ambiguous? If x : {a : A} -> Foo a and Foo.f {a' : A} : Foo a' -> {b : B} -> R, does @x.f introduce a or a'/b as explicit?

@kmill
Copy link
Collaborator Author

kmill commented Sep 30, 2024

@digama0 The current precedence rules have @x.f parse as @ applied to x.f. Same for @(x).f, it's @ applied to (x).f. On the other hand, (@x).f is @ applied to x.

Dot notation doesn't work when x is a function, so (@x).f isn't useful as an interpretation.

@kmill kmill added this pull request to the merge queue Oct 9, 2024
Merged via the queue into leanprover:master with commit 79930af Oct 9, 2024
16 checks passed
@leanprover-community-bot leanprover-community-bot added builds-mathlib CI has verified that Mathlib builds against this PR and removed breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan labels Oct 9, 2024
mathlib-bors bot pushed a commit to leanprover-community/mathlib4 that referenced this pull request Oct 10, 2024
[lean4#5528](leanprover/lean4#5528) fixes some issues with how structure instance notation expands, which breaks `OrderIso.mapSetOfMaximal`. This PR manually expands the spread notation. For the curious, this definition is making use of both the implicit lambda feature and implicit arguments in `map_rel_iff' := f.map_rel_iff`. Concretely, this is equivalent to `map_rel_iff' {_ _} := f.map_rel_iff _ _` where the `_`'s don't match up.
Vierkantor pushed a commit to leanprover-community/mathlib4 that referenced this pull request Oct 11, 2024
[lean4#5528](leanprover/lean4#5528) fixes some issues with how structure instance notation expands, which breaks `OrderIso.mapSetOfMaximal`. This PR manually expands the spread notation. For the curious, this definition is making use of both the implicit lambda feature and implicit arguments in `map_rel_iff' := f.map_rel_iff`. Concretely, this is equivalent to `map_rel_iff' {_ _} := f.map_rel_iff _ _` where the `_`'s don't match up.
@alreadydone
Copy link
Contributor

Dot notation doesn't work when x is a function

What do you mean? (web editor)

import Mathlib.Logic.Function.Defs
variable {α β} (f : α → β)
#check f.Injective

@kmill
Copy link
Collaborator Author

kmill commented Dec 13, 2024

@alreadydone Discussion about that here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builds-mathlib CI has verified that Mathlib builds against this 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.

Structure update notation falls over optional parameters
4 participants