Skip to content

Commit

Permalink
feat(analysis/normed_space,topology/metric_space): distance between d…
Browse files Browse the repository at this point in the history
…iagonal vectors (#5803)

Add formulas for (e|nn|)dist between `λ _, a` and `λ _, b` as well
as `∥(λ _, a)∥` and `nnnorm (λ _, a)`.
  • Loading branch information
urkud committed Jan 19, 2021
1 parent da6e3c3 commit 21b0b01
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/analysis/normed_space/basic.lean
Expand Up @@ -426,6 +426,13 @@ lemma norm_le_pi_norm {π : ι → Type*} [fintype ι] [∀i, normed_group (π i
∥x i∥ ≤ ∥x∥ :=
(pi_norm_le_iff (norm_nonneg x)).1 (le_refl _) i

@[simp] lemma pi_norm_const [nonempty ι] [fintype ι] (a : α) : ∥(λ i : ι, a)∥ = ∥a∥ :=
by simpa only [← dist_zero_right] using dist_pi_const a 0

@[simp] lemma pi_nnnorm_const [nonempty ι] [fintype ι] (a : α) :
nnnorm (λ i : ι, a) = nnnorm a :=
nnreal.eq $ pi_norm_const a

lemma tendsto_iff_norm_tendsto_zero {f : ι → β} {a : filter ι} {b : β} :
tendsto f a (𝓝 b) ↔ tendsto (λ e, ∥f e - b∥) a (𝓝 0) :=
by { convert tendsto_iff_dist_tendsto_zero, simp [dist_eq_norm] }
Expand Down
3 changes: 3 additions & 0 deletions src/data/finset/basic.lean
Expand Up @@ -162,6 +162,9 @@ lemma nonempty.bex {s : finset α} (h : s.nonempty) : ∃ x:α, x ∈ s := h
lemma nonempty.mono {s t : finset α} (hst : s ⊆ t) (hs : s.nonempty) : t.nonempty :=
set.nonempty.mono hst hs

lemma nonempty.forall_const {s : finset α} (h : s.nonempty) {p : Prop} : (∀ x ∈ s, p) ↔ p :=
let ⟨x, hx⟩ := h in ⟨λ h, h x hx, λ h x hx, h⟩

/-! ### empty -/

/-- The empty finset -/
Expand Down
3 changes: 3 additions & 0 deletions src/data/finset/lattice.lean
Expand Up @@ -51,6 +51,9 @@ begin
exact ⟨λ k b hb, k _ _ hb rfl, λ k a' b hb h, h ▸ k _ hb⟩,
end

lemma sup_const {s : finset β} (h : s.nonempty) (c : α) : s.sup (λ _, c) = c :=
eq_of_forall_ge_iff $ λ b, sup_le_iff.trans h.forall_const

lemma sup_le {a : α} : (∀b ∈ s, f b ≤ a) → s.sup f ≤ a :=
sup_le_iff.2

Expand Down
6 changes: 6 additions & 0 deletions src/topology/metric_space/basic.lean
Expand Up @@ -1199,6 +1199,12 @@ subtype.eta _ _
lemma dist_pi_def (f g : Πb, π b) :
dist f g = (sup univ (λb, nndist (f b) (g b)) : ℝ≥0) := rfl

@[simp] lemma dist_pi_const [nonempty β] (a b : α) : dist (λ x : β, a) (λ _, b) = dist a b :=
by simpa only [dist_edist] using congr_arg ennreal.to_real (edist_pi_const a b)

@[simp] lemma nndist_pi_const [nonempty β] (a b : α) : nndist (λ x : β, a) (λ _, b) = nndist a b :=
nnreal.eq $ dist_pi_const a b

lemma dist_pi_lt_iff {f g : Πb, π b} {r : ℝ} (hr : 0 < r) :
dist f g < r ↔ ∀b, dist (f b) (g b) < r :=
begin
Expand Down
3 changes: 3 additions & 0 deletions src/topology/metric_space/emetric_space.lean
Expand Up @@ -484,6 +484,9 @@ instance emetric_space_pi [∀b, emetric_space (π b)] : emetric_space (Πb, π
lemma edist_pi_def [Π b, emetric_space (π b)] (f g : Π b, π b) :
edist f g = finset.sup univ (λb, edist (f b) (g b)) := rfl

@[simp] lemma edist_pi_const [nonempty β] (a b : α) : edist (λ x : β, a) (λ _, b) = edist a b :=
finset.sup_const univ_nonempty (edist a b)

end pi

namespace emetric
Expand Down

0 comments on commit 21b0b01

Please sign in to comment.