Zulip Chat Archive

Stream: new members

Topic: Continuity


Parivash (Jun 05 2023 at 22:07):

Hi,
I'm going to prove the left continuity of this function:
f(x)f(xc) f(x)-f(x_c) in which f(x)=(1x)2f(x)= (\frac{1}{x})^2
I want to prove that the lim of (f(x)f(xc) f(x)-f(x_c)) when x approach xcx_c from left is equal to the value of the function (f(x)f(xc) f(x)-f(x_c)) at xcx_c which is equal to zero

I define it like this:

import data.real.basic
import topology.instances.real
import analysis.normed_space.basic
import tactic.linarith


open filter
open_locale topological_space
noncomputable theory

open filter set

def f (x : ) :  := (1/x)^2

def f_shift (x x_c : ) :  := f x - f x_c

lemma limit_V_shift (x x_c : ) (hx : x  0)(hx_c : x_c  0) :
  tendsto (λ x, f_shift x x_c) (𝓝[Iio x_c] x_c) (𝓝 0) :=
begin
  sorry,
end

is it correct?

Kevin Buzzard (Jun 05 2023 at 22:18):

This code does not compile for me on recent master: I get locale topological_space does not exist. Are you using a very old mathlib? I think this changed several months ago. I changed it to open_locale topology and got it compiling. As for the mathematics, I'm not sure what 𝓝[Iio x_c] x_c means but this is my problem, not yours :-)

Parivash (Jun 05 2023 at 22:32):

Oh, thanks for point it out.
Yeah, I used the notation 𝓝[Iio x_c] x_c to represent the behavior of a function as it approaches a particular value from one side (in this case, from values less than x_c).
In particular, I used it to express the idea that x tending to x_c from the left
But don't have idea how to prove it!

Jireh Loreaux (Jun 05 2023 at 22:37):

@Kevin Buzzard 𝓝[s] c is notation for nhds_within c s := 𝓝 c ⊓ filter.principal s

Eric Wieser (Jun 05 2023 at 22:37):

Is 𝓝[Iio x_c] x_c the same as 𝓝[≤] x_c?

Jireh Loreaux (Jun 05 2023 at 22:38):

Well, 𝓝[<] x_c, but yes.

Eric Wieser (Jun 05 2023 at 22:40):

I always screw up when reading the io/ic interval variants

Kevin Buzzard (Jun 05 2023 at 22:41):

Mathematically it looks like the statement is true then

Jireh Loreaux (Jun 05 2023 at 22:42):

There's an extraneous x in the statement though.

Jireh Loreaux (Jun 05 2023 at 22:45):

@Parivash is there a reason you want to prove this statement from scratch? It should follow easily from things we have in the library.

Parivash (Jun 05 2023 at 22:46):

Excuse me!
No, I just want to prove this:
lim(fxfxc)(xxc)=fxcfxc=0lim(f x - f x_c) (x \to x_c^-) = f x_c -f x_c = 0
No matter how!

Jireh Loreaux (Jun 05 2023 at 22:46):

For instance, we have a has_continuous_inv₀ ℝ instance.

Jireh Loreaux (Jun 05 2023 at 22:47):

I have to feed my kids now, but if no one has given you hints in an hour or so I'll write something up.

Jireh Loreaux (Jun 05 2023 at 23:11):

import topology.instances.real

-- note that `continuous_within_at` exactly captures what you want
-- this is a step-by-step proof so you can see the pieces.
example {c : } (hc : c  0) :
  continuous_within_at (λ x : , (1 / x) ^ 2) (set.Iio c) c :=
begin
  refine continuous_at.continuous_within_at _,
  simp_rw [inv_eq_one_div],
  change continuous_at ((λ x : , x ^ 2)  (λ x : , x⁻¹)) c,
  refine continuous_at.comp _ (continuous_at_inv₀ hc),
  refine continuous.continuous_at _,
  exact continuous_pow 2,
end

-- the above can be golfed to this
lemma foo {c : } (hc : c  0) :
  continuous_within_at (λ x : , (1 / x) ^ 2) (set.Iio c) c :=
by simpa only [inv_eq_one_div] using
  ((continuous_pow 2).continuous_at.comp (continuous_at_inv₀ hc)).continuous_within_at

-- Of course, this fact is stronger, and we used it to prove the above:
example {c : } (hc : c  0) :
  continuous_at (λ x : , (1 / x) ^ 2) c :=
by simpa only [inv_eq_one_div] using
  (continuous_pow 2).continuous_at.comp (continuous_at_inv₀ hc)

-- this was technically the statement you had, but it follows from `foo` easily.
example {c : } (hc : c  0) :
  filter.tendsto (λ x : , (1 / x) ^ 2 - (1 / c) ^ 2) (𝓝[<] c) (𝓝 0) :=
begin
  have : continuous_within_at (λ x : , (1 / x) ^ 2 - (1 / c) ^ 2) (set.Iio c) c,
    from (foo hc).sub tendsto_const_nhds,
  simpa only [continuous_within_at, sub_self],
end

Parivash (Jun 05 2023 at 23:44):

Excellent!
Thank you @Jireh Loreaux

David⚛️ (Sep 02 2023 at 04:49):

Jireh Loreaux said:

import topology.instances.real

-- note that `continuous_within_at` exactly captures what you want
-- this is a step-by-step proof so you can see the pieces.
example {c : } (hc : c  0) :
  continuous_within_at (λ x : , (1 / x) ^ 2) (set.Iio c) c :=
begin
  refine continuous_at.continuous_within_at _,
  simp_rw [inv_eq_one_div],
  change continuous_at ((λ x : , x ^ 2)  (λ x : , x⁻¹)) c,
  refine continuous_at.comp _ (continuous_at_inv₀ hc),
  refine continuous.continuous_at _,
  exact continuous_pow 2,
end

-- the above can be golfed to this
lemma foo {c : } (hc : c  0) :
  continuous_within_at (λ x : , (1 / x) ^ 2) (set.Iio c) c :=
by simpa only [inv_eq_one_div] using
  ((continuous_pow 2).continuous_at.comp (continuous_at_inv₀ hc)).continuous_within_at

-- Of course, this fact is stronger, and we used it to prove the above:
example {c : } (hc : c  0) :
  continuous_at (λ x : , (1 / x) ^ 2) c :=
by simpa only [inv_eq_one_div] using
  (continuous_pow 2).continuous_at.comp (continuous_at_inv₀ hc)

-- this was technically the statement you had, but it follows from `foo` easily.
example {c : } (hc : c  0) :
  filter.tendsto (λ x : , (1 / x) ^ 2 - (1 / c) ^ 2) (𝓝[<] c) (𝓝 0) :=
begin
  have : continuous_within_at (λ x : , (1 / x) ^ 2 - (1 / c) ^ 2) (set.Iio c) c,
    from (foo hc).sub tendsto_const_nhds,
  simpa only [continuous_within_at, sub_self],
end

Please can you show these lines of code of continuity in Lean 4?

Kevin Buzzard (Sep 02 2023 at 07:38):

Are you asking how to translate this code into lean 4? Did you try yourself? Where do you get stuck?

Jireh Loreaux (Sep 02 2023 at 12:27):

Mathport oneshot can also do that for you.

David⚛️ (Sep 03 2023 at 23:20):

Kevin Buzzard said:

Are you asking how to translate this code into lean 4? Did you try yourself? Where do you get stuck?

Yea ,
I was asking how to translate the code into lean 4 as I want to try something similar but the syntax remains unclear to me.

David⚛️ (Sep 03 2023 at 23:23):

Jireh Loreaux said:

Mathport oneshot can also do that for you.

Not familiar with Mathport oneshot.

Jireh Loreaux (Sep 03 2023 at 23:30):

@David⚛️ : https://github.com/leanprover-community/mathport/blob/master/Oneshot/README.md

David⚛️ (Sep 04 2023 at 20:08):

@Jireh Loreaux @Kevin Buzzard
At this point, my challenge is having a full grasp of how to use Mathlib.
This question might sound so dumb but I need to speak up.
The def and theorems in the doc of Mathlib, how do I apply /use them to whatever I wanna prove?
Is a struggle for me.

Jireh Loreaux (Sep 04 2023 at 20:16):

Can you give an example of what you want to prove? Something simple to start is a good idea. Separately, have you had a look at some of our learning resources, like #mil ?

David⚛️ (Sep 04 2023 at 20:22):

I've had time to go through some of the learning resources (Mechanics of Proof).
For example, if I want to show a function is continuous, I know Mathlib can help me but I don't know how to use it even when I open the Mathlib doc


Last updated: Dec 20 2023 at 11:08 UTC