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

Commit a741585

Browse files
committed
chore(algebra/group): make coe_norm_subgroup and submodule.norm_coe consistent (#11427)
The `simp` lemmas for norms in a subgroup and in a submodule disagreed: the first inserted a coercion to the larger group, the second deleted the coercion. Currently this is not a big deal, but it will become a real issue when defining `add_subgroup_class`. I want to make them consistent by pointing them in the same direction. The consensus in the [Zulip thread](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Simp.20normal.20form.3A.20coe_norm_subgroup.2C.20submodule.2Enorm_coe) suggests `simp` should insert a coercion here, so I went with that. After making the changes, a few places need extra `simp [submodule.coe_norm]` on the local hypotheses, but nothing major.
1 parent c3273aa commit a741585

File tree

3 files changed

+31
-11
lines changed

3 files changed

+31
-11
lines changed

src/analysis/normed/group/basic.lean

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,20 @@ semi_normed_group.induced s.subtype
656656

657657
/-- If `x` is an element of a subgroup `s` of a seminormed group `E`, its norm in `s` is equal to
658658
its norm in `E`. -/
659-
@[simp] lemma coe_norm_subgroup {E : Type*} [semi_normed_group E] {s : add_subgroup E} (x : s) :
660-
∥x∥ = ∥(x:E)∥ :=
659+
@[simp] lemma add_subgroup.coe_norm {E : Type*} [semi_normed_group E]
660+
{s : add_subgroup E} (x : s) :
661+
∥(x : s)∥ = ∥(x:E)∥ :=
662+
rfl
663+
664+
/-- If `x` is an element of a subgroup `s` of a seminormed group `E`, its norm in `s` is equal to
665+
its norm in `E`.
666+
667+
This is a reversed version of the `simp` lemma `add_subgroup.coe_norm` for use by `norm_cast`.
668+
-/
669+
670+
@[norm_cast] lemma add_subgroup.norm_coe {E : Type*} [semi_normed_group E] {s : add_subgroup E}
671+
(x : s) :
672+
∥(x : E)∥ = ∥(x : s)∥ :=
661673
rfl
662674

663675
/-- A submodule of a seminormed group is also a seminormed group, with the restriction of the norm.
@@ -668,18 +680,24 @@ instance submodule.semi_normed_group {𝕜 : Type*} {_ : ring 𝕜}
668680
{ norm := λx, norm (x : E),
669681
dist_eq := λx y, dist_eq_norm (x : E) (y : E) }
670682

671-
/-- If `x` is an element of a submodule `s` of a normed group `E`, its norm in `E` is equal to its
672-
norm in `s`.
683+
/-- If `x` is an element of a submodule `s` of a normed group `E`, its norm in `s` is equal to its
684+
norm in `E`.
673685
674686
See note [implicit instance arguments]. -/
675-
@[simp, norm_cast] lemma submodule.norm_coe {𝕜 : Type*} {_ : ring 𝕜}
687+
@[simp] lemma submodule.coe_norm {𝕜 : Type*} {_ : ring 𝕜}
676688
{E : Type*} [semi_normed_group E] {_ : module 𝕜 E} {s : submodule 𝕜 E} (x : s) :
677-
∥(x : E)∥ = ∥x∥ :=
689+
∥(x : s)∥ = ∥(x : E)∥ :=
678690
rfl
679691

680-
@[simp] lemma submodule.norm_mk {𝕜 : Type*} {_ : ring 𝕜}
681-
{E : Type*} [semi_normed_group E] {_ : module 𝕜 E} {s : submodule 𝕜 E} (x : E) (hx : x ∈ s) :
682-
∥(⟨x, hx⟩ : s)∥ = ∥x∥ :=
692+
/-- If `x` is an element of a submodule `s` of a normed group `E`, its norm in `E` is equal to its
693+
norm in `s`.
694+
695+
This is a reversed version of the `simp` lemma `submodule.coe_norm` for use by `norm_cast`.
696+
697+
See note [implicit instance arguments]. -/
698+
@[norm_cast] lemma submodule.norm_coe {𝕜 : Type*} {_ : ring 𝕜}
699+
{E : Type*} [semi_normed_group E] {_ : module 𝕜 E} {s : submodule 𝕜 E} (x : s) :
700+
∥(x : E)∥ = ∥(x : s)∥ :=
683701
rfl
684702

685703
/-- seminormed group instance on the product of two seminormed groups, using the sup norm. -/

src/geometry/manifold/instances/sphere.lean

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,13 @@ begin
200200
-- the core of the problem is these two algebraic identities:
201201
have h₁ : (2 ^ 2 / (1 - a) ^ 2 * ∥y∥ ^ 2 + 4)⁻¹ * 4 * (2 / (1 - a)) = 1,
202202
{ field_simp,
203+
simp only [submodule.coe_norm] at *,
203204
nlinarith },
204205
have h₂ : (2 ^ 2 / (1 - a) ^ 2 * ∥y∥ ^ 2 + 4)⁻¹ * (2 ^ 2 / (1 - a) ^ 2 * ∥y∥ ^ 2 - 4) = a,
205206
{ field_simp,
206207
transitivity (1 - a) ^ 2 * (a * (2 ^ 2 * ∥y∥ ^ 2 + 4 * (1 - a) ^ 2)),
207208
{ congr,
209+
simp only [submodule.coe_norm] at *,
208210
nlinarith },
209211
ring },
210212
-- deduce the result
@@ -337,7 +339,7 @@ begin
337339
have h_set : ∀ p : sphere (0:E) 1, p = v' ↔ ⟪(p:E), v'⟫_ℝ = 1,
338340
{ simp [subtype.ext_iff, inner_eq_norm_mul_iff_of_norm_one] },
339341
ext,
340-
simp [h_set, hUv, hU'v', stereographic, real_inner_comm]
342+
simp [h_set, hUv, hU'v', stereographic, real_inner_comm, ← submodule.coe_norm]
341343
end
342344

343345
/-- The inclusion map (i.e., `coe`) from the sphere in `E` to `E` is smooth. -/

src/measure_theory/function/simple_func_dense.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ local attribute [instance] simple_func.module
569569
/-- If `E` is a normed space, `Lp.simple_func E p μ` is a normed space. Not declared as an
570570
instance as it is (as of writing) used only in the construction of the Bochner integral. -/
571571
protected def normed_space [fact (1 ≤ p)] : normed_space 𝕜 (Lp.simple_func E p μ) :=
572-
⟨ λc f, by { rw [coe_norm_subgroup, coe_norm_subgroup, coe_smul, norm_smul] } ⟩
572+
⟨ λc f, by { rw [add_subgroup.coe_norm, add_subgroup.coe_norm, coe_smul, norm_smul] } ⟩
573573

574574
end instances
575575

0 commit comments

Comments
 (0)