[Merged by Bors] - chore(Geometry/Manifold): avoid some underscore soup - #42205
[Merged by Bors] - chore(Geometry/Manifold): avoid some underscore soup#42205grunweg wants to merge 3 commits into
Conversation
grunweg
commented
Jul 28, 2026
PR summary ddb9a51c5eImport changes for modified filesNo significant changes to the import graph Import changes for all files
|
| haveI := h.singletonChartedSpace; ContMDiff I I n e := by | ||
| have := h.isManifold_singleton (I := I) (n := ω) | ||
| rw [@contMDiff_iff _ _ _ _ _ _ _ _ _ _ h.singletonChartedSpace] | ||
| rw [@contMDiff_iff] |
There was a problem hiding this comment.
The underscores/specifying the instance is no longer required (but removing the @ would break the proof).
There was a problem hiding this comment.
I thought that rw [x] and rw [@x] are equivalent if x is a theorem. Are you sure of this?
There was a problem hiding this comment.
yes i also tested this
There was a problem hiding this comment.
Aha, very interesting! It turn out that the rewrite does work successfully, but it unnecessarily logs an error message.
I wrote a little tactic combinator that erases logged messages, and using this, we see that the rewrite did work:
import Mathlib
open Topology ContDiff
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
{E : Type*}
[NormedAddCommGroup E] [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H]
{I : ModelWithCorners 𝕜 E H} {M : Type*} [TopologicalSpace M]
variable {e : M → H} (h : IsOpenEmbedding e) {n : ℕ∞ω}
elab "withoutErrors" tac:tactic : tactic => do
Lean.Elab.Tactic.evalTactic tac
modifyThe Lean.Core.State fun s => { s with messages := {} }
lemma contMDiff_isOpenEmbedding' [Nonempty M] :
haveI := h.singletonChartedSpace; ContMDiff I I n e := by
have := h.isManifold_singleton (I := I) (n := ω)
withoutErrors rw [contMDiff_iff] -- succeeds!
sorry
There was a problem hiding this comment.
This is a bug in the elaboration part of rw. It is trying to syntesize an instance that it doesn't need to synthesize anymore.
There was a problem hiding this comment.
So, the current code is correct - and rw throwing an error is a bug in rw (i.e., out of scope for this PR)?
There was a problem hiding this comment.
Indeed.
Maybe calling it a bug is phrased too strongly, but I think it would be better if this worked without the @. I've tried to fix this in leanprover/lean4#14593
There was a problem hiding this comment.
💡 Thanks for clarifying.
Inspired by #42205. I searched for ` _ _ _]` in vscode and manually went through all ~25 and see if they could be removed (and in some cases some minor style improvement). For ` _ _]` it is already over 100, so that work ought to be automatised Co-authored-by: Batixx <s59fpern@uni-bonn.de>
|
Thanks, this PR looks good to me maintainer merge |
|
🚀 Pull request has been placed on the maintainer queue by JovanGerb. |
|
Pull request successfully merged into master. Build succeeded:
|