The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V13. General topology

Mathlib.Topology.Continuous

68 declarations and 2 deprecated aliases. Mathlib docs · Source

Continuity in topological spaces

For topological spaces X and Y, a function f : X → Y and a point x : X, ContinuousAt f x means f is continuous at x, and global continuity is Continuous f. There is also a version of continuity PContinuous for partially defined functions.

Tags

continuity, continuous function

Function with dense range

theorem continuous_def E0 #

∀ {X : Type u_1} {Y : Type u_2} {x : TopologicalSpace X} {x_1 : TopologicalSpace Y} {f : X → Y},
  Continuous f ↔ ∀ (s : Set Y), IsOpen s → IsOpen (f ⁻¹' s)

theorem IsOpen.preimage E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y},
  Continuous f → ∀ {t : Set Y}, IsOpen t → IsOpen (f ⁻¹' t)

theorem Equiv.continuous_symm_iff E0 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] (e : X ≃ Y),
  Continuous ⇑e.symm ↔ IsOpenMap ⇑e

theorem Equiv.isOpenMap_symm_iff E0 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] (e : X ≃ Y),
  IsOpenMap ⇑e.symm ↔ Continuous ⇑e

theorem continuous_congr E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f g : X → Y},
  (∀ (x : X), f x = g x) → (Continuous f ↔ Continuous g)

theorem Continuous.congr E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f g : X → Y},
  Continuous f → (∀ (x : X), f x = g x) → Continuous g

theorem ContinuousAt.tendsto E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y} {x : X},
  ContinuousAt f x → Filter.Tendsto f (nhds x) (nhds (f x))

theorem continuousAt_def E0 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y} {x : X},
  ContinuousAt f x ↔ ∀ A ∈ nhds (f x), f ⁻¹' A ∈ nhds x

theorem continuousAt_congr E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y} {x : X}
  {g : X → Y}, f =ᶠ[nhds x] g → (ContinuousAt f x ↔ ContinuousAt g x)

theorem ContinuousAt.congr E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y} {x : X}
  {g : X → Y}, ContinuousAt f x → f =ᶠ[nhds x] g → ContinuousAt g x

theorem ContinuousAt.preimage_mem_nhds E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y} {x : X}
  {t : Set Y}, ContinuousAt f x → t ∈ nhds (f x) → f ⁻¹' t ∈ nhds x

theorem ContinuousAt.eventually_mem E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y} {x : X},
  ContinuousAt f x → ∀ {s : Set Y}, s ∈ nhds (f x) → ∀ᶠ (y : X) in nhds x, f y ∈ s

If f x ∈ s ∈ 𝓝 (f x) for continuous f, then f y ∈ s near x.

This is essentially Filter.Tendsto.eventually_mem, but infers in more cases when applied.

theorem not_continuousAt_of_tendsto E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y} {l₁ : Filter X}
  {l₂ : Filter Y} {x : X},
  Filter.Tendsto f l₁ l₂ → ∀ [l₁.NeBot], l₁ ≤ nhds x → Disjoint (nhds (f x)) l₂ → ¬ContinuousAt f x

If a function f tends to somewhere other than 𝓝 (f x) at x, then f is not continuous at x

theorem ClusterPt.map E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y} {x : X}
  {lx : Filter X} {ly : Filter Y}, ClusterPt x lx → ContinuousAt f x → Filter.Tendsto f lx ly → ClusterPt (f x) ly

theorem preimage_interior_subset_interior_preimage E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y} {t : Set Y},
  Continuous f → f ⁻¹' interior t ⊆ interior (f ⁻¹' t)

See also interior_preimage_subset_preimage_interior.

theorem continuous_iff_preimage_interior_subset_interior_preimage E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y},
  Continuous f ↔ ∀ (s : Set Y), f ⁻¹' interior s ⊆ interior (f ⁻¹' s)

theorem continuous_id E2 #

∀ {X : Type u_1} [inst : TopologicalSpace X], Continuous id

theorem continuous_id' E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X], Continuous fun x ↦ x

theorem Continuous.comp E2 #

∀ {X : Type u_1} {Y : Type u_2} {Z : Type u_3} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y]
  [inst_2 : TopologicalSpace Z] {f : X → Y} {g : Y → Z}, Continuous g → Continuous f → Continuous (g ∘ f)

theorem Continuous.comp' E1 #

∀ {X : Type u_1} {Y : Type u_2} {Z : Type u_3} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y]
  [inst_2 : TopologicalSpace Z] {f : X → Y} {g : Y → Z}, Continuous g → Continuous f → Continuous fun x ↦ g (f x)

theorem Continuous.iterate E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {f : X → X}, Continuous f → ∀ (n : ℕ), Continuous f^[n]

theorem ContinuousAt.comp E1 #

∀ {X : Type u_1} {Y : Type u_2} {Z : Type u_3} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y]
  [inst_2 : TopologicalSpace Z] {f : X → Y} {x : X} {g : Y → Z},
  ContinuousAt g (f x) → ContinuousAt f x → ContinuousAt (g ∘ f) x

theorem ContinuousAt.comp' E1 #

∀ {X : Type u_1} {Y : Type u_2} {Z : Type u_3} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y]
  [inst_2 : TopologicalSpace Z] {f : X → Y} {g : Y → Z} {x : X},
  ContinuousAt g (f x) → ContinuousAt f x → ContinuousAt (fun x ↦ g (f x)) x

theorem ContinuousAt.comp_of_eq E0 #

∀ {X : Type u_1} {Y : Type u_2} {Z : Type u_3} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y]
  [inst_2 : TopologicalSpace Z] {f : X → Y} {x : X} {y : Y} {g : Y → Z},
  ContinuousAt g y → ContinuousAt f x → f x = y → ContinuousAt (g ∘ f) x

See note [comp_of_eq lemmas]

theorem Continuous.tendsto E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y},
  Continuous f → ∀ (x : X), Filter.Tendsto f (nhds x) (nhds (f x))

theorem Continuous.tendsto' E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y},
  Continuous f → ∀ (x : X) (y : Y), f x = y → Filter.Tendsto f (nhds x) (nhds y)

A version of Continuous.tendsto that allows one to specify a simpler form of the limit. E.g., one can write continuous_exp.tendsto' 0 1 exp_zero.

theorem Continuous.continuousAt E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y} {x : X},
  Continuous f → ContinuousAt f x

theorem continuous_iff_continuousAt E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y},
  Continuous f ↔ ∀ (x : X), ContinuousAt f x

theorem continuousAt_const E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {x : X} {y : Y},
  ContinuousAt (fun x ↦ y) x

theorem continuous_const E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {y : Y}, Continuous fun x ↦ y

theorem Filter.EventuallyEq.continuousAt E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y} {x : X} {y : Y},
  (f =ᶠ[nhds x] fun x ↦ y) → ContinuousAt f x

theorem continuous_of_const E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y},
  (∀ (x y : X), f x = f y) → Continuous f

theorem continuousAt_id E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {x : X}, ContinuousAt id x

theorem continuousAt_id' E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] (y : X), ContinuousAt (fun x ↦ x) y

theorem ContinuousAt.iterate E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {x : X} {f : X → X},
  ContinuousAt f x → f x = x → ∀ (n : ℕ), ContinuousAt f^[n] x

theorem continuous_iff_isClosed E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y},
  Continuous f ↔ ∀ (s : Set Y), IsClosed s → IsClosed (f ⁻¹' s)

theorem IsClosed.preimage E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y},
  Continuous f → ∀ {t : Set Y}, IsClosed t → IsClosed (f ⁻¹' t)

theorem mem_closure_image E0 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y} {s : Set X}
  {x : X}, ContinuousAt f x → x ∈ closure s → f x ∈ closure (f '' s)

theorem Continuous.closure_preimage_subset E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y},
  Continuous f → ∀ (t : Set Y), closure (f ⁻¹' t) ⊆ f ⁻¹' closure t

theorem Continuous.frontier_preimage_subset E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y},
  Continuous f → ∀ (t : Set Y), frontier (f ⁻¹' t) ⊆ f ⁻¹' frontier t

theorem Set.MapsTo.closure E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y} {s : Set X}
  {t : Set Y}, Set.MapsTo f s t → Continuous f → Set.MapsTo f (closure s) (closure t)

If a continuous map f maps s to t, then it maps closure s to closure t.

theorem image_closure_subset_closure_image E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y} {s : Set X},
  Continuous f → f '' closure s ⊆ closure (f '' s)

See also IsClosedMap.closure_image_eq_of_continuous.

theorem closure_image_closure E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y} {s : Set X},
  Continuous f → closure (f '' closure s) = closure (f '' s)

theorem closure_subset_preimage_closure_image E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y} {s : Set X},
  Continuous f → closure s ⊆ f ⁻¹' closure (f '' s)

theorem nonempty_preimage_closure_image E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y},
  Continuous f → ∀ (t : Set X), t.Nonempty → (f ⁻¹' closure (f '' t)).Nonempty

theorem continuous_iff_image_closure_subset_closure_image E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y},
  Continuous f ↔ ∀ (s : Set X), f '' closure s ⊆ closure (f '' s)

theorem map_mem_closure E0 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y} {s : Set X}
  {x : X} {t : Set Y}, Continuous f → x ∈ closure s → Set.MapsTo f s t → f x ∈ closure t

theorem Set.MapsTo.closure_left E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y} {s : Set X}
  {t : Set Y}, Set.MapsTo f s t → Continuous f → IsClosed t → Set.MapsTo f (closure s) t

If a continuous map f maps s to a closed set t, then it maps closure s to t.

theorem Filter.Tendsto.lift'_closure E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y},
  Continuous f →
    ∀ {l : Filter X} {l' : Filter Y}, Filter.Tendsto f l l' → Filter.Tendsto f (l.lift' closure) (l'.lift' closure)

theorem tendsto_lift'_closure_nhds E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {f : X → Y},
  Continuous f → ∀ (x : X), Filter.Tendsto f ((nhds x).lift' closure) ((nhds (f x)).lift' closure)

theorem Function.Surjective.denseRange E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {α : Type u_4} {f : α → X}, Function.Surjective f → DenseRange f

A surjective map has dense range.

theorem denseRange_id E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X], DenseRange id

theorem denseRange_iff_closure_range E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {α : Type u_4} {f : α → X}, DenseRange f ↔ closure (Set.range f) = Set.univ

theorem DenseRange.closure_range E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {α : Type u_4} {f : α → X}, DenseRange f → closure (Set.range f) = Set.univ

theorem denseRange_subtypeVal E0 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {p : X → Prop}, DenseRange Subtype.val ↔ Dense {x | p x}

theorem Dense.denseRange_subtypeVal E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {s : Set X}, Dense s → DenseRange Subtype.val

theorem Continuous.range_subset_closure_image_dense E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {s : Set X} {f : X → Y},
  Continuous f → Dense s → Set.range f ⊆ closure (f '' s)

theorem DenseRange.dense_image E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {s : Set X} {f : X → Y},
  DenseRange f → Continuous f → Dense s → Dense (f '' s)

The image of a dense set under a continuous map with dense range is a dense set.

theorem DenseRange.subset_closure_image_preimage_of_isOpen E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {α : Type u_4} {f : α → X} {s : Set X},
  DenseRange f → IsOpen s → s ⊆ closure (f '' f ⁻¹' s)

If f has dense range and s is an open set in the codomain of f, then the image of the preimage of s under f is dense in s.

theorem DenseRange.dense_of_mapsTo E1 #

∀ {X : Type u_1} {Y : Type u_2} [inst : TopologicalSpace X] [inst_1 : TopologicalSpace Y] {s : Set X} {f : X → Y},
  DenseRange f → Continuous f → Dense s → ∀ {t : Set Y}, Set.MapsTo f s t → Dense t

If a continuous map with dense range maps a dense set to a subset of t, then t is a dense set.

theorem DenseRange.comp E1 #

∀ {Y : Type u_2} {Z : Type u_3} [inst : TopologicalSpace Y] [inst_1 : TopologicalSpace Z] {α : Type u_4} {g : Y → Z}
  {f : α → Y}, DenseRange g → DenseRange f → Continuous g → DenseRange (g ∘ f)

Composition of a continuous map with dense range and a function with dense range has dense range.

theorem DenseRange.nonempty_iff E0 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {α : Type u_4} {f : α → X}, DenseRange f → (Nonempty α ↔ Nonempty X)

theorem DenseRange.nonempty E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {α : Type u_4} {f : α → X} [h : Nonempty X], DenseRange f → Nonempty α

def DenseRange.some E1 #

{X : Type u_1} → [inst : TopologicalSpace X] → {α : Type u_4} → {f : α → X} → DenseRange f → X → α

Given a function f : X → Y with dense range and y : Y, returns some x : X.

theorem DenseRange.exists_mem_open E1 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {α : Type u_4} {f : α → X} {s : Set X},
  DenseRange f → IsOpen s → s.Nonempty → ∃ a, f a ∈ s

theorem DenseRange.mem_nhds E0 #

∀ {X : Type u_1} [inst : TopologicalSpace X] {x : X} {α : Type u_4} {f : α → X} {s : Set X},
  DenseRange f → s ∈ nhds x → ∃ a, f a ∈ s

def LibraryNote.continuity_lemma_statement E1 #

Batteries.Util.LibraryNote

The library contains many lemmas stating that functions/operations are continuous. There are many ways to formulate the continuity of operations. Some are more convenient than others. Note: for the most part this note also applies to other properties (Measurable, Differentiable, ContinuousOn, ...).

The traditional way

As an example, let's look at addition (+) : M → M → M. We can state that this is continuous in different definitionally equal ways (omitting some typing information)

  • Continuous (fun p ↦ p.1 + p.2);
  • Continuous (Function.uncurry (+));
  • Continuous ↿(+). (↿ is notation for recursively uncurrying a function)

However, lemmas with this conclusion are not nice to use in practice because

  1. They confuse the elaborator. The following example fails, because of limitations in the elaboration process.
variable {M : Type*} [Add M] [TopologicalSpace M] [ContinuousAdd M]
example : Continuous (fun x : M ↦ x + x) :=
  continuous_add.comp _

-- This example used to fail, but would be accepted if you wrote is as
-- `continuous_add.comp (continuous_id.prodMk continuous_id :)`.
example : Continuous (fun x : M ↦ x + x) :=
  continuous_add.comp (continuous_id.prodMk continuous_id)
  1. If the operation has more than 2 arguments, they are impractical to use, because in your application the arguments in the domain might be in a different order or associated differently.

The convenient way

A much more convenient way to write continuity lemmas is like Continuous.add:

Continuous.add {f g : X → M} (hf : Continuous f) (hg : Continuous g) :
  Continuous (f + g)

The conclusion can be Continuous (fun x ↦ f x + g x), which is definitionally equal. This has the following advantages

  • It supports projection notation, so is shorter to write.
  • Continuous.add _ _ is recognized correctly by the elaborator and gives useful new goals.
  • It works generally, since the domain is a variable. (Having a domain Y × Z would be less convenient in general.)

As an example for a unary operation, we have Continuous.neg.

Continuous.neg {f : X → G} (hf : Continuous f) : Continuous (-f)

For unary functions, the elaborator is not confused when applying the traditional lemma (like continuous_neg), but it's still convenient to have the short version available (compare hf.neg.neg.neg with continuous_neg.comp <| continuous_neg.comp <| continuous_neg.comp hf).

As a harder example, consider an operation of the following type:

def strans {x : F} (γ γ' : Path x x) (t₀ : I) : Path x x

The precise definition is not important, only its type. The correct continuity principle for this operation is something like this:

{f : X → F} {γ γ' : ∀ x, Path (f x) (f x)} {t₀ s : X → I}
  (hγ : Continuous ↿γ) (hγ' : Continuous ↿γ')
  (ht : Continuous t₀) (hs : Continuous s) :
  Continuous (fun x ↦ strans (γ x) (γ' x) (t x) (s x))

Note that all arguments of strans are indexed over X, even the basepoint x, and the last argument s that arises since Path x x has a coercion to I → F. The paths γ and γ' (which are unary functions from I) become binary functions in the continuity lemma.

Summary

  • Make sure that your continuity lemmas are stated in the most general way, and in a convenient form. That means that:
    • The conclusion has a variable X as domain (not something like Y × Z);
    • Wherever possible, all point arguments c : Y are replaced by functions c : X → Y;
    • All n-ary function arguments are replaced by n+1-ary functions (f : Y → Z becomes f : X → Y → Z);
    • All (relevant) arguments have continuity assumptions, and perhaps there are additional assumptions needed to make the operation continuous;
    • The function in the conclusion is fully applied.
  • These remarks are mostly about the format of the conclusion of a continuity lemma. In assumptions it's fine to state that a function with more than 1 argument is continuous using ↿ or Function.uncurry.

Functions with discontinuities

In some cases, you want to work with discontinuous functions, and in certain expressions they are still continuous. For example, consider the fractional part of a number, Int.fract : ℝ → ℝ. In this case, you want to add conditions to when a function involving fract is continuous, so you get something like this: (assumption hf could be weakened, but the important thing is the shape of the conclusion)

lemma ContinuousOn.comp_fract {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y]
    {f : X → ℝ → Y} {g : X → ℝ} (hf : Continuous ↿f) (hg : Continuous g) (h : ∀ s, f s 0 = f s 1) :
    Continuous (fun x ↦ f x (fract (g x)))

With ContinuousAt you can be even more precise about what to prove in case of discontinuities, see e.g. ContinuousAt.comp_div_cases.

def LibraryNote.comp_of_eq_lemmas E1 #

Batteries.Util.LibraryNote

Lean's elaborator has trouble elaborating applications of lemmas that state that the composition of two functions satisfy some property at a point, like ContinuousAt.comp / ContDiffAt.comp and ContMDiffWithinAt.comp. The reason is that a lemma like this looks like ContinuousAt g (f x) → ContinuousAt f x → ContinuousAt (g ∘ f) x. Since Lean's elaborator elaborates the arguments from left-to-right, when you write hg.comp hf, the elaborator will try to figure out both f and g from the type of hg. It tries to figure out f just from the point where g is continuous. For example, if hg : ContinuousAt g (a, x) then the elaborator will assign f to the function Prod.mk a, since in that case f x = (a, x). This is undesirable in most cases where f is not a variable. There are some ways to work around this, for example by giving f explicitly, or to force Lean to elaborate hf before elaborating hg, but this is annoying. Another better solution is to reformulate composition lemmas to have the following shape ContinuousAt g y → ContinuousAt f x → f x = y → ContinuousAt (g ∘ f) x. This is even useful if the proof of f x = y is rfl. The reason that this works better is because the type of hg doesn't mention f. Only after elaborating the two ContinuousAt arguments, Lean will try to unify f x with y, which is often easy after having chosen the correct functions for f and g. Here is an example that shows the difference:

example [TopologicalSpace X] [TopologicalSpace Y] {x₀ : X} (f : X → X → Y)
    (hf : ContinuousAt (Function.uncurry f) (x₀, x₀)) :
    ContinuousAt (fun x ↦ f x x) x₀ :=
  -- hf.comp (continuousAt_id.prod continuousAt_id) -- type mismatch
  -- hf.comp_of_eq (continuousAt_id.prod continuousAt_id) rfl -- works

Deprecated aliases

NameNew nameSince
Dense.denseRange_valDense.denseRange_subtypeVal2026-11-10
denseRange_subtype_valdenseRange_subtypeVal2026-11-10