Zulip Chat Archive

Stream: Is there code for X?

Topic: Shifted limits


Michael Stoll (Dec 19 2023 at 22:23):

I'm looking for something like

import Mathlib

example (f : โ„‚ โ†’ โ„‚) : Tendsto f (๐“[โ‰ ] 1) (๐“ 1) โ†” Tendsto (fun z โ†ฆ f (1 + z)) (๐“[โ‰ ] 0) (๐“ 1) := by
  sorry

but have difficulties finding it.

Jireh Loreaux (Dec 19 2023 at 22:28):

Isn't this just an application of docs#Filter.Tendsto.comp ?

Michael Stoll (Dec 19 2023 at 22:29):

I guess so. I think I was looking for something involving comp, but may have mistyped (it is getting late ...).

Michael Stoll (Dec 19 2023 at 22:37):

Is there a tactic that clears Tendsto (fun x โ†ฆ 1 - x) (๐“[โ‰ ] 1) (๐“[โ‰ ] 0)?

Jireh Loreaux (Dec 19 2023 at 23:06):

Hmm... perhaps I led you astray. This works though:

import Mathlib

open Topology Filter

example (f : โ„‚ โ†’ โ„‚) : Tendsto f (๐“[โ‰ ] 1) (๐“ 1) โ†” Tendsto (fun z โ†ฆ f (1 + z)) (๐“[โ‰ ] 0) (๐“ 1) := by
  rw [โ† Function.comp, โ† tendsto_map'_iff]
  congr!
  simpa using (Homeomorph.addLeft (1 : โ„‚)).toPartialHomeomorph.map_nhdsWithin_eq
    (Set.mem_univ 0) ({0}แถœ) |>.symm

The first two lines get it down to the essence of the argument.

Patrick Massot (Dec 19 2023 at 23:22):

That toPartialHomeomorph.map_nhdsWithin_eq is really ugly. If the lemma is missing for homeomorphisms then it should be added.

Jireh Loreaux (Dec 19 2023 at 23:56):

Indeed, I think it's missing. If I can get to it, I'll PR, but i'm quite busy at the moment.

Jireh Loreaux (Dec 19 2023 at 23:59):

I guess we have docs#Set.LeftInvOn.map_nhdsWithin_eq, but that's not really better.

Jireh Loreaux (Dec 20 2023 at 00:04):

Oh, I guess we have docs#Embedding.map_nhdsWithin_eq. So the above can be written:

import Mathlib

open Topology Filter

example (f : โ„‚ โ†’ โ„‚) : Tendsto f (๐“[โ‰ ] 1) (๐“ 1) โ†” Tendsto (fun z โ†ฆ f (1 + z)) (๐“[โ‰ ] 0) (๐“ 1) := by
  rw [โ† Function.comp, โ† tendsto_map'_iff]
  congr!
  simpa using (Homeomorph.addLeft (1 : โ„‚)).embedding.map_nhdsWithin_eq ({0}แถœ) 0 |>.symm

which I think is fine.

Michael Stoll (Dec 20 2023 at 13:30):

Michael Stoll said:

Is there a tactic that clears Tendsto (fun x โ†ฆ 1 - x) (๐“[โ‰ ] 1) (๐“[โ‰ ] 0)?

I'm still stuck at this. To un-#xy:

import Mathlib

local notation "ฮ“" => Complex.Gamma

open Complex Topology Filter Metric in
lemma tendsto_sub_one_mul_Gamma_one_sub_nhds_one :
    Tendsto (fun x โ†ฆ (x - 1) * ฮ“ (1 - x)) (๐“[โ‰ ] 1) (๐“ (-1)) := by
  conv =>
    enter [1, x]
    rw [show (x - 1) * ฮ“ (1 - x) = - ((1 - x) * ฮ“ (1 - x)) by ring]
  refine (tendsto_self_mul_Gamma_nhds_zero.comp ?_).neg
  convert tendsto_map
  sorry -- goal is `๐“[โ‰ ] 0 = map (fun x โ†ฆ 1 - x) (๐“[โ‰ ] 1)`

Michael Stoll (Dec 20 2023 at 13:34):

This should be easy, but trying to use docs#Embedding.map_nhdsWithin_eq together with some docs#Homeomorph gave me trouble, because I could not identify the homeomorphism with the function...

Michael Stoll (Dec 20 2023 at 14:05):

Here is another one that should be easy, but which I found tricky:

lemma dist_one (m : โ„•) : dist (m : โ„‚) 1 < 1 โ†” m = 1 := by
  refine โŸจfun H โ†ฆ ?_, fun H โ†ฆ by simp [H]โŸฉ
  rwa [dist_eq, โ† Int.cast_one, โ† Int.cast_Nat_cast, โ† Int.cast_sub, โ† int_cast_abs, โ† Int.cast_abs,
      โ† Int.cast_one (R := โ„), Int.cast_lt, Int.abs_lt_one_iff, sub_eq_zero, โ† Nat.cast_one,
      Int.ofNat_inj] at H

Ruben Van de Velde (Dec 20 2023 at 14:34):

Needs more lemmas!

import Mathlib

open Complex

lemma Nat.dist_eq_dist (m n : โ„•) : Dist.dist m n = Nat.dist m n := by
  rw [Nat.dist_eq, Nat.dist_eq_max_sub_min, โ† max_sub_min_eq_abs']
  simp

lemma dist_nat_cast' (m n : โ„•) : dist (m : โ„‚) n = dist m n := by
  rw [dist_eq, Nat.dist_eq]
  norm_cast -- not sure why this still introduces `Int.subNatNat`
  rw [Int.cast_abs, โ† int_cast_abs]

lemma dist_nat_cast (m n : โ„•) : dist (m : โ„‚) n = Nat.dist m n := by
  rw [dist_nat_cast', Nat.dist_eq_dist]

lemma Nat.dist_eq_zero_iff (m n : โ„•) : dist m n = 0 โ†” m = n :=
  โŸจNat.eq_of_dist_eq_zero, Nat.dist_eq_zeroโŸฉ

lemma dist_const (m n : โ„•) : dist (m : โ„‚) n < 1 โ†” m = n := by
  rw [dist_nat_cast, Nat.cast_lt_one, Nat.dist_eq_zero_iff]

lemma dist_one (m : โ„•) : dist (m : โ„‚) 1 < 1 โ†” m = 1 := by
  exact_mod_cast dist_const m 1

Patrick Massot (Dec 20 2023 at 14:57):

Regarding the previous question: struggling with such trivialities always means missing stupid lemmas, often simp lemmas. You simply need to have the patience to write those lemmas and put them into Mathlib.

import Mathlib

open Topology Filter

@[to_additive (attr := simp)] lemma Homeomorph.mulLeft_apply {G : Type*} [TopologicalSpace G] [Group G] [ContinuousMul G]
  (a b : G) : Homeomorph.mulLeft a b = a * b := rfl

@[to_additive (attr := simp)] lemma Homeomorph.mulRight_apply {G : Type*} [TopologicalSpace G] [Group G] [ContinuousMul G]
  (a b : G) : Homeomorph.mulRight a b = b * a := rfl

@[to_additive (attr := simp)] lemma Homeomorph.inv_apply {G : Type*} [TopologicalSpace G] [InvolutiveInv G] [ContinuousInv G] (a : G) :
  Homeomorph.inv G a = aโปยน := rfl

lemma Homeomorph.image_compl {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] (f : X โ‰ƒโ‚œ Y)
    (s : Set X) : f '' (sแถœ) = (f '' s)แถœ := f.toEquiv.image_compl s

lemma Homeomorph.map_punctured_nhds_eq {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y]
    (f : X โ‰ƒโ‚œ Y) (x : X) : map f (๐“[โ‰ ] x) = ๐“[โ‰ ] (f x) := by
  convert f.embedding.map_nhdsWithin_eq ({x}แถœ) x
  rw [f.image_compl, Set.image_singleton]

local notation "ฮ“" => Complex.Gamma

open Complex Topology Filter Metric in
lemma tendsto_sub_one_mul_Gamma_one_sub_nhds_one :
    Tendsto (fun x โ†ฆ (x - 1) * ฮ“ (1 - x)) (๐“[โ‰ ] 1) (๐“ (-1)) := by
  conv =>
    enter [1, x]
    rw [show (x - 1) * ฮ“ (1 - x) = - ((1 - x) * ฮ“ (1 - x)) by ring]
  refine (tendsto_self_mul_Gamma_nhds_zero.comp ?_).neg
  convert tendsto_map
  symm
  simpa using ((Homeomorph.neg โ„‚).trans (Homeomorph.addLeft (1 : โ„‚))).map_punctured_nhds_eq 1

Patrick Massot (Dec 20 2023 at 14:57):

The fact the first three lemmas are missing is very weird. They should be the first lemmas after the definition of these homeomorphisms.

Patrick Massot (Dec 20 2023 at 14:58):

Maybe they should even be auto-generated by @[simps] or something.

Michael Stoll (Dec 20 2023 at 15:00):

I am not really feeling at home in this part of Mathlib, so I would appreciate it if someone more knowledgeable would PR these missing lemmas. (Alternatively, I'd need some help with finding the right places to put them.)

Ruben Van de Velde (Dec 20 2023 at 15:03):

Fwiw:

@[to_additive (attr := simp)] lemma Homeomorph.mulLeft_apply {G : Type*} [TopologicalSpace G] [Group G] [ContinuousMul G]
  (a b : G) : Homeomorph.mulLeft a b = a * b := by simp? says simp only [coe_mulLeft]

Ruben Van de Velde (Dec 20 2023 at 15:05):

But there's zero lemmas about Homeomorph.inv

Patrick Massot (Dec 20 2023 at 15:06):

Ok, so the first two are there already, but didn't trigger because the third one was missing

Patrick Massot (Dec 20 2023 at 15:15):

I opened #9166


Last updated: May 02 2025 at 03:31 UTC