@@ -126,10 +126,31 @@ scoped elab:max "IsImmersionAt%" ppSpace F:term:arg ppSpace nt:term:arg ppSpace
126126 let eF ← Term.elabTerm F none
127127 let ne ← Term.elabTermEnsuringType nt q(WithTop ℕ∞)
128128 let ef ← ensureIsFunction <|← Term.elabTerm f none
129+ -- TODO: can I elaborate x as the type of the domain of f instead?
129130 let ex ← Term.elabTerm x none
130131 let (srcI, tgtI) ← findModels ef none
131132 mkAppM ``IsImmersionAt #[eF, srcI, tgtI, ne, ef, ex]
132133
134+ -- TODO: avoid the need for a type ascription here by inferring the type of x from f
135+ -- TODO: add analogous tests for the other elaborators, and fix the same bug!
136+ /--
137+ error: Application type mismatch: The argument
138+ x
139+ has type
140+ ?m.37
141+ of sort `Type ?u.15648` but is expected to have type
142+ M
143+ of sort `Type u_12` in the application
144+ IsImmersionAt F I J n f x
145+ ---
146+ info: {x | sorry} : Set ?m.37
147+ -/
148+ #guard_msgs in
149+ #check {x | IsImmersionAt% F n f x}
150+ /-- info: {x | IsImmersionAt F I J n f x} : Set M -/
151+ #guard_msgs in
152+ #check {x : M | IsImmersionAt% F n f x}
153+
133154lemma mk_of_charts (equiv : (E × F) ≃L[𝕜] E'') (domChart : OpenPartialHomeomorph M H)
134155 (codChart : OpenPartialHomeomorph N G)
135156 (hx : x ∈ domChart.source) (hfx : f x ∈ codChart.source)
@@ -300,7 +321,8 @@ def IsImmersion (f : M → N) : Prop := ∀ x, IsImmersionAt F I J n f x
300321open Lean Elab Meta Qq in
301322/-- `IsImmersion% F n f` elaborates to `IsImmersion F I J n f`,
302323trying to determine `I` and `J` from the local context. -/
303- scoped elab :max "IsImmersion% " F:term:arg ppSpace nt:term:arg ppSpace f:term:arg : term => do
324+ scoped elab :max "IsImmersion%" ppSpace F:term:arg ppSpace nt:term:arg ppSpace
325+ f:term:arg : term => do
304326 let eF ← Term.elabTerm F none
305327 let ne ← Term.elabTermEnsuringType nt q(WithTop ℕ∞)
306328 let ef ← ensureIsFunction <|← Term.elabTerm f none
@@ -309,10 +331,12 @@ scoped elab:max "IsImmersion% " F:term:arg ppSpace nt:term:arg ppSpace f:term:ar
309331
310332namespace IsImmersion
311333
334+ open Manifold
335+
312336variable {f g : M → N}
313337
314338/-- If `f` is an immersion, it is an immersion at each point. -/
315- lemma isImmersionAt (h : IsImmersion% F n f) (x : M) : IsImmersionAt F I J n f x := h x
339+ lemma isImmersionAt (h : IsImmersion F I J n f) (x : M) : IsImmersionAt F I J n f x := h x
316340
317341/-- If `f = g` and `f` is an immersion, so is `g`. -/
318342theorem congr (h : IsImmersion F I J n f) (heq : f = g) : IsImmersion F I J n g :=
0 commit comments