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

Commit d6c1cf1

Browse files
committed
feat(analysis/normed_space/pointwise): Balls disjointness (#13379)
Two balls in a real normed space are disjoint iff the sum of their radii is less than the distance between their centers.
1 parent 2194eef commit d6c1cf1

File tree

5 files changed

+115
-30
lines changed

5 files changed

+115
-30
lines changed

src/algebra/module/basic.lean

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ instance add_comm_monoid.nat_module : module ℕ M :=
7272
add_smul := λ r s x, add_nsmul x r s }
7373

7474
theorem add_smul : (r + s) • x = r • x + s • x := module.add_smul r s x
75+
76+
lemma convex.combo_self {a b : R} (h : a + b = 1) (x : M) : a • x + b • x = x :=
77+
by rw [←add_smul, h, one_smul]
78+
7579
variables (R)
7680

7781
theorem two_smul : (2 : R) • x = x + x := by rw [bit0, add_smul, one_smul]
@@ -80,7 +84,7 @@ theorem two_smul' : (2 : R) • x = bit0 x := two_smul R x
8084

8185
@[simp] lemma inv_of_two_smul_add_inv_of_two_smul [invertible (2 : R)] (x : M) :
8286
(⅟2 : R) • x + (⅟2 : R) • x = x :=
83-
by rw [←add_smul, inv_of_two_add_inv_of_two, one_smul]
87+
convex.combo_self inv_of_two_add_inv_of_two _
8488

8589
/-- Pullback a `module` structure along an injective additive monoid homomorphism.
8690
See note [reducible non-instances]. -/

src/algebra/order/ring.lean

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ ordered_semiring.mul_lt_mul_of_pos_left a b c h₁ h₂
177177
lemma mul_lt_mul_of_pos_right (h₁ : a < b) (h₂ : 0 < c) : a * c < b * c :=
178178
ordered_semiring.mul_lt_mul_of_pos_right a b c h₁ h₂
179179

180+
lemma mul_lt_of_lt_one_left (hb : 0 < b) (ha : a < 1) : a * b < b :=
181+
(mul_lt_mul_of_pos_right ha hb).trans_le (one_mul _).le
182+
183+
lemma mul_lt_of_lt_one_right (ha : 0 < a) (hb : b < 1) : a * b < a :=
184+
(mul_lt_mul_of_pos_left hb ha).trans_le (mul_one _).le
185+
180186
-- See Note [decidable namespace]
181187
protected lemma decidable.mul_le_mul_of_nonneg_left [@decidable_rel α (≤)]
182188
(h₁ : a ≤ b) (h₂ : 0 ≤ c) : c * a ≤ c * b :=

src/analysis/convex/basic.lean

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,6 @@ begin
145145
exact h (mem_open_segment_of_ne_left_right 𝕜 hxz hyz hz),
146146
end
147147

148-
lemma convex.combo_self {a b : 𝕜} (h : a + b = 1) (x : E) : a • x + b • x = x :=
149-
by rw [←add_smul, h, one_smul]
150-
151148
end module
152149
end ordered_semiring
153150

src/analysis/normed_space/pointwise.lean

Lines changed: 93 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/-
22
Copyright (c) 2021 Sébastien Gouëzel. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
4-
Authors: Sébastien Gouëzel
4+
Authors: Sébastien Gouëzel, Yaël Dillies
55
-/
66
import analysis.normed.group.pointwise
77
import analysis.normed.group.add_torsor
@@ -95,13 +95,104 @@ by rw [vadd_ball, vadd_eq_add, add_zero]
9595
lemma vadd_closed_ball_zero (x : E) (r : ℝ) : x +ᵥ closed_ball 0 r = closed_ball x r :=
9696
by rw [vadd_closed_ball, vadd_eq_add, add_zero]
9797

98-
variables [normed_space ℝ E]
98+
variables [normed_space ℝ E] {x y z : E} {δ ε : ℝ}
9999

100100
/-- In a real normed space, the image of the unit ball under scalar multiplication by a positive
101101
constant `r` is the ball of radius `r`. -/
102102
lemma smul_unit_ball_of_pos {r : ℝ} (hr : 0 < r) : r • ball 0 1 = ball (0 : E) r :=
103103
by rw [smul_unit_ball hr.ne', real.norm_of_nonneg hr.le]
104104

105+
-- This is also true for `ℚ`-normed spaces
106+
lemma exists_dist_eq (x z : E) {a b : ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) (hab : a + b = 1) :
107+
∃ y, dist x y = b * dist x z ∧ dist y z = a * dist x z :=
108+
begin
109+
use a • x + b • z,
110+
nth_rewrite 0 [←one_smul ℝ x],
111+
nth_rewrite 3 [←one_smul ℝ z],
112+
simp [dist_eq_norm, ←hab, add_smul, ←smul_sub, norm_smul_of_nonneg, ha, hb],
113+
end
114+
115+
lemma exists_dist_le_le (hδ : 0 ≤ δ) (hε : 0 ≤ ε) (h : dist x z ≤ ε + δ) :
116+
∃ y, dist x y ≤ δ ∧ dist y z ≤ ε :=
117+
begin
118+
obtain rfl | hε' := hε.eq_or_lt,
119+
{ exact ⟨z, by rwa zero_add at h, (dist_self _).le⟩ },
120+
have hεδ := add_pos_of_pos_of_nonneg hε' hδ,
121+
refine (exists_dist_eq x z (div_nonneg hε $ add_nonneg hε hδ) (div_nonneg hδ $ add_nonneg hε hδ) $
122+
by rw [←add_div, div_self hεδ.ne']).imp (λ y hy, _),
123+
rw [hy.1, hy.2, div_mul_comm', div_mul_comm' ε],
124+
rw ←div_le_one hεδ at h,
125+
exact ⟨mul_le_of_le_one_left hδ h, mul_le_of_le_one_left hε h⟩,
126+
end
127+
128+
-- This is also true for `ℚ`-normed spaces
129+
lemma exists_dist_le_lt (hδ : 0 ≤ δ) (hε : 0 < ε) (h : dist x z < ε + δ) :
130+
∃ y, dist x y ≤ δ ∧ dist y z < ε :=
131+
begin
132+
refine (exists_dist_eq x z (div_nonneg hε.le $ add_nonneg hε.le hδ) (div_nonneg hδ $ add_nonneg
133+
hε.le hδ) $ by rw [←add_div, div_self (add_pos_of_pos_of_nonneg hε hδ).ne']).imp (λ y hy, _),
134+
rw [hy.1, hy.2, div_mul_comm', div_mul_comm' ε],
135+
rw ←div_lt_one (add_pos_of_pos_of_nonneg hε hδ) at h,
136+
exact ⟨mul_le_of_le_one_left hδ h.le, mul_lt_of_lt_one_left hε h⟩,
137+
end
138+
139+
-- This is also true for `ℚ`-normed spaces
140+
lemma exists_dist_lt_le (hδ : 0 < δ) (hε : 0 ≤ ε) (h : dist x z < ε + δ) :
141+
∃ y, dist x y < δ ∧ dist y z ≤ ε :=
142+
begin
143+
obtain ⟨y, yz, xy⟩ := exists_dist_le_lt hε hδ
144+
(show dist z x < δ + ε, by simpa only [dist_comm, add_comm] using h),
145+
exact ⟨y, by simp [dist_comm x y, dist_comm y z, *]⟩,
146+
end
147+
148+
-- This is also true for `ℚ`-normed spaces
149+
lemma exists_dist_lt_lt (hδ : 0 < δ) (hε : 0 < ε) (h : dist x z < ε + δ) :
150+
∃ y, dist x y < δ ∧ dist y z < ε :=
151+
begin
152+
refine (exists_dist_eq x z (div_nonneg hε.le $ add_nonneg hε.le hδ.le) (div_nonneg hδ.le $
153+
add_nonneg hε.le hδ.le) $ by rw [←add_div, div_self (add_pos hε hδ).ne']).imp (λ y hy, _),
154+
rw [hy.1, hy.2, div_mul_comm', div_mul_comm' ε],
155+
rw ←div_lt_one (add_pos hε hδ) at h,
156+
exact ⟨mul_lt_of_lt_one_left hδ h, mul_lt_of_lt_one_left hε h⟩,
157+
end
158+
159+
-- This is also true for `ℚ`-normed spaces
160+
lemma disjoint_ball_ball_iff (hδ : 0 < δ) (hε : 0 < ε) :
161+
disjoint (ball x δ) (ball y ε) ↔ δ + ε ≤ dist x y :=
162+
begin
163+
refine ⟨λ h, le_of_not_lt $ λ hxy, _, ball_disjoint_ball⟩,
164+
rw add_comm at hxy,
165+
obtain ⟨z, hxz, hzy⟩ := exists_dist_lt_lt hδ hε hxy,
166+
rw dist_comm at hxz,
167+
exact h ⟨hxz, hzy⟩,
168+
end
169+
170+
-- This is also true for `ℚ`-normed spaces
171+
lemma disjoint_ball_closed_ball_iff (hδ : 0 < δ) (hε : 0 ≤ ε) :
172+
disjoint (ball x δ) (closed_ball y ε) ↔ δ + ε ≤ dist x y :=
173+
begin
174+
refine ⟨λ h, le_of_not_lt $ λ hxy, _, ball_disjoint_closed_ball⟩,
175+
rw add_comm at hxy,
176+
obtain ⟨z, hxz, hzy⟩ := exists_dist_lt_le hδ hε hxy,
177+
rw dist_comm at hxz,
178+
exact h ⟨hxz, hzy⟩,
179+
end
180+
181+
-- This is also true for `ℚ`-normed spaces
182+
lemma disjoint_closed_ball_ball_iff (hδ : 0 ≤ δ) (hε : 0 < ε) :
183+
disjoint (closed_ball x δ) (ball y ε) ↔ δ + ε ≤ dist x y :=
184+
by rw [disjoint.comm, disjoint_ball_closed_ball_iff hε hδ, add_comm, dist_comm]; apply_instance
185+
186+
lemma disjoint_closed_ball_closed_ball_iff (hδ : 0 ≤ δ) (hε : 0 ≤ ε) :
187+
disjoint (closed_ball x δ) (closed_ball y ε) ↔ δ + ε < dist x y :=
188+
begin
189+
refine ⟨λ h, lt_of_not_ge $ λ hxy, _, closed_ball_disjoint_closed_ball⟩,
190+
rw add_comm at hxy,
191+
obtain ⟨z, hxz, hzy⟩ := exists_dist_le_le hδ hε hxy,
192+
rw dist_comm at hxz,
193+
exact h ⟨hxz, hzy⟩,
194+
end
195+
105196
end semi_normed_group
106197

107198
section normed_group

src/topology/metric_space/basic.lean

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ by rw [edist_dist, ennreal.to_real_of_real (dist_nonneg)]
389389
namespace metric
390390

391391
/- instantiate pseudometric space as a topology -/
392-
variables {x y z : α} {ε ε₁ ε₂ : ℝ} {s : set α}
392+
variables {x y z : α} {δ ε ε₁ ε₂ : ℝ} {s : set α}
393393

394394
/-- `ball x ε` is the set of all points `y` with `dist y x < ε` -/
395395
def ball (x : α) (ε : ℝ) : set α := {y | dist y x < ε}
@@ -466,31 +466,18 @@ assume y (hy : _ < _), le_of_lt hy
466466
theorem sphere_subset_closed_ball : sphere x ε ⊆ closed_ball x ε :=
467467
λ y, le_of_eq
468468

469-
lemma closed_ball_disjoint_ball (x y : α) (rx ry : ℝ) (h : rx + ry ≤ dist x y) :
470-
disjoint (closed_ball x rx) (ball y ry) :=
471-
begin
472-
rw disjoint_left,
473-
intros a ax ay,
474-
apply lt_irrefl (dist x y),
475-
calc dist x y ≤ dist a x + dist a y : dist_triangle_left _ _ _
476-
... < rx + ry : add_lt_add_of_le_of_lt (mem_closed_ball.1 ax) (mem_ball.1 ay)
477-
... ≤ dist x y : h
478-
end
469+
lemma closed_ball_disjoint_ball (h : δ + ε ≤ dist x y) : disjoint (closed_ball x δ) (ball y ε) :=
470+
λ a ha, (h.trans $ dist_triangle_left _ _ _).not_lt $ add_lt_add_of_le_of_lt ha.1 ha.2
479471

480-
lemma ball_disjoint_ball (x y : α) (rx ry : ℝ) (h : rx + ry ≤ dist x y) :
481-
disjoint (ball x rx) (ball y ry) :=
482-
(closed_ball_disjoint_ball x y rx ry h).mono_left ball_subset_closed_ball
472+
lemma ball_disjoint_closed_ball (h : δ + ε ≤ dist x y) : disjoint (ball x δ) (closed_ball y ε) :=
473+
(closed_ball_disjoint_ball $ by rwa [add_comm, dist_comm]).symm
483474

484-
lemma closed_ball_disjoint_closed_ball {x y : α} {rx ry : ℝ} (h : rx + ry < dist x y) :
485-
disjoint (closed_ball x rx) (closed_ball y ry) :=
486-
begin
487-
rw disjoint_left,
488-
intros a ax ay,
489-
apply lt_irrefl (dist x y),
490-
calc dist x y ≤ dist a x + dist a y : dist_triangle_left _ _ _
491-
... ≤ rx + ry : add_le_add ax ay
492-
... < dist x y : h
493-
end
475+
lemma ball_disjoint_ball (h : δ + ε ≤ dist x y) : disjoint (ball x δ) (ball y ε) :=
476+
(closed_ball_disjoint_ball h).mono_left ball_subset_closed_ball
477+
478+
lemma closed_ball_disjoint_closed_ball (h : δ + ε < dist x y) :
479+
disjoint (closed_ball x δ) (closed_ball y ε) :=
480+
λ a ha, h.not_le $ (dist_triangle_left _ _ _).trans $ add_le_add ha.1 ha.2
494481

495482
theorem sphere_disjoint_ball : disjoint (sphere x ε) (ball x ε) :=
496483
λ y ⟨hy₁, hy₂⟩, absurd hy₁ $ ne_of_lt hy₂

0 commit comments

Comments
 (0)