Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit a9c1300

Browse files
committed
refactor(topology/metric_space/basic): rename closed_ball_Icc (#8790)
* rename `closed_ball_Icc` to `real.closed_ball_eq`; * add `real.ball_eq`, `int.ball_eq`, `int.closed_ball_eq`, `int.preimage_ball`, `int.preimage_closed_ball`.
1 parent 373911d commit a9c1300

File tree

3 files changed

+29
-11
lines changed

3 files changed

+29
-11
lines changed

src/number_theory/liouville/basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ begin
146146
{ exact λ a, one_le_pow_of_one_le ((le_add_iff_nonneg_left 1).mpr a.cast_nonneg) _ },
147147
-- 2: the polynomial `fR` is Lipschitz at `α` -- as its derivative continuous;
148148
{ rw mul_comm,
149-
rw closed_ball_Icc at hy,
149+
rw real.closed_ball_eq at hy,
150150
-- apply the Mean Value Theorem: the bound on the derivative comes from differentiability.
151151
refine convex.norm_image_sub_le_of_norm_deriv_le (λ _ _, fR.differentiable_at)
152152
(λ y h, by { rw fR.deriv, exact hM _ h }) (convex_Icc _ _) hy (mem_Icc_iff_abs_le.mp _),

src/topology/instances/real.lean

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ theorem rat.dist_eq (x y : ℚ) : dist x y = abs (x - y) := rfl
2929

3030
@[norm_cast, simp] lemma rat.dist_cast (x y : ℚ) : dist (x : ℝ) y = dist x y := rfl
3131

32+
namespace int
33+
3234
section low_prio
3335
-- we want to ignore this instance for the next declaration
3436
local attribute [instance, priority 10] int.uniform_space
@@ -46,21 +48,33 @@ begin
4648
end
4749
end low_prio
4850

49-
theorem int.dist_eq (x y : ℤ) : dist x y = abs (x - y) := rfl
51+
theorem dist_eq (x y : ℤ) : dist x y = abs (x - y) := rfl
5052

51-
@[norm_cast, simp] theorem int.dist_cast_real (x y : ℤ) : dist (x : ℝ) y = dist x y := rfl
53+
@[norm_cast, simp] theorem dist_cast_real (x y : ℤ) : dist (x : ℝ) y = dist x y := rfl
5254

53-
@[norm_cast, simp] theorem int.dist_cast_rat (x y : ℤ) : dist (x : ℚ) y = dist x y :=
55+
@[norm_cast, simp] theorem dist_cast_rat (x y : ℤ) : dist (x : ℚ) y = dist x y :=
5456
by rw [← int.dist_cast_real, ← rat.dist_cast]; congr' 1; norm_cast
5557

58+
theorem preimage_ball (x : ℤ) (r : ℝ) : coe ⁻¹' (ball (x : ℝ) r) = ball x r := rfl
59+
60+
theorem preimage_closed_ball (x : ℤ) (r : ℝ) :
61+
coe ⁻¹' (closed_ball (x : ℝ) r) = closed_ball x r := rfl
62+
63+
theorem ball_eq (x : ℤ) (r : ℝ) : ball x r = Ioo ⌊↑x - r⌋ ⌈↑x + r⌉ :=
64+
by rw [← preimage_ball, real.ball_eq, preimage_Ioo]
65+
66+
theorem closed_ball_eq (x : ℤ) (r : ℝ) : closed_ball x r = Icc ⌈↑x - r⌉ ⌊↑x + r⌋ :=
67+
by rw [← preimage_closed_ball, real.closed_ball_eq, preimage_Icc]
68+
5669
instance : proper_space ℤ :=
5770
begin
5871
intros x r,
59-
apply set.finite.is_compact,
60-
have : closed_ball x r = coe ⁻¹' (closed_ball (x:ℝ) r) := rfl,
61-
simp [this, closed_ball_Icc, set.Icc_ℤ_finite],
72+
rw closed_ball_eq,
73+
exact (set.Icc_ℤ_finite _ _).is_compact,
6274
end
6375

76+
end int
77+
6478
theorem uniform_continuous_of_rat : uniform_continuous (coe : ℚ → ℝ) :=
6579
uniform_continuous_comap
6680

@@ -111,7 +125,7 @@ instance : order_topology ℚ :=
111125
induced_order_topology _ (λ x y, rat.cast_lt) (@exists_rat_btwn _ _ _)
112126

113127
instance : proper_space ℝ :=
114-
{ compact_ball := λx r, by { rw closed_ball_Icc, apply is_compact_Icc } }
128+
{ compact_ball := λx r, by { rw real.closed_ball_eq, apply is_compact_Icc } }
115129

116130
instance : second_countable_topology ℝ := second_countable_of_proper
117131

@@ -264,7 +278,7 @@ lemma real.bounded_iff_bdd_below_bdd_above {s : set ℝ} : bounded s ↔ bdd_bel
264278
begin
265279
assume bdd,
266280
rcases (bounded_iff_subset_ball 0).1 bdd with ⟨r, hr⟩, -- hr : s ⊆ closed_ball 0 r
267-
rw closed_ball_Icc at hr, -- hr : s ⊆ Icc (0 - r) (0 + r)
281+
rw real.closed_ball_eq at hr, -- hr : s ⊆ Icc (0 - r) (0 + r)
268282
exact ⟨bdd_below_Icc.mono hr, bdd_above_Icc.mono hr⟩
269283
end,
270284
begin

src/topology/metric_space/basic.lean

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,11 @@ instance : order_topology ℝ :=
951951
order_topology_of_nhds_abs $ λ x,
952952
by simp only [nhds_basis_ball.eq_binfi, ball, real.dist_eq, abs_sub_comm]
953953

954-
lemma closed_ball_Icc {x r : ℝ} : closed_ball x r = Icc (x-r) (x+r) :=
954+
lemma real.ball_eq (x r : ℝ) : ball x r = Ioo (x - r) (x + r) :=
955+
set.ext $ λ y, by rw [mem_ball, dist_comm, real.dist_eq,
956+
abs_sub_lt_iff, mem_Ioo, ← sub_lt_iff_lt_add', sub_lt]
957+
958+
lemma real.closed_ball_eq {x r : ℝ} : closed_ball x r = Icc (x - r) (x + r) :=
955959
by ext y; rw [mem_closed_ball, dist_comm, real.dist_eq,
956960
abs_sub_le_iff, mem_Icc, ← sub_le_iff_le_add', sub_le]
957961

@@ -1844,7 +1848,7 @@ begin
18441848
{ rw ← bounded_iff_subset_ball,
18451849
exact hs.bounded },
18461850
refine ⟨(coe ⁻¹' closed_ball (0:ℝ) r)ᶜ, _, _⟩,
1847-
{ simp [mem_cofinite, closed_ball_Icc, set.Icc_ℤ_finite] },
1851+
{ simp [mem_cofinite, real.closed_ball_eq, set.Icc_ℤ_finite] },
18481852
{ rw ← compl_subset_compl at hr,
18491853
intros y hy,
18501854
exact hr hy }

0 commit comments

Comments
 (0)