Eine aufbereitete Darstellung der Quelle

 
     
 
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung


Quelle  Basic.lean   Sprache: Lean

 

/-
Copyright (c) 2018 Patrick Massot. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Massot, Johannes Hölzl
-/

module

public import Mathlib.Algebra.Algebra.Subalgebra.Basic
public import Mathlib.Analysis.Normed.Group.Constructions
public import Mathlib.Analysis.Normed.Group.Real
public import Mathlib.Analysis.Normed.Group.Subgroup
public import Mathlib.Analysis.Normed.Group.Submodule

import Mathlib.Data.Fintype.Order

/-!
# Normed rings

In this file we define (semi)normed rings. We also prove some theorems about these definitions.

A normed ring instance can be constructed from a given real absolute value on a ring via
`AbsoluteValue.toNormedRing`.
-/


@[expose] public section

-- Guard against import creep.
assert_not_exists AddChar comap_norm_atTop DilationEquiv Finset.sup_mul_le_mul_sup_of_nonneg
  IsOfFinOrder Isometry.norm_map_of_map_one NNReal.isOpen_Ico_zero Rat.norm_cast_real
  RestrictScalars

variable {G α β ι : Type*}

open Filter
open scoped Topology NNReal

/-- A non-unital seminormed ring is a not-necessarily-unital ring
endowed with a seminorm which satisfies the inequality `‖x y‖ ≤ ‖x‖ ‖y‖`. -/

class NonUnitalSeminormedRing (α : Type*) extends Norm α, NonUnitalRing α,
  PseudoMetricSpace α where
  /-- The distance is induced by the norm. -/
  dist_eq : ∀ x y, dist x y = norm (-x + y)
  /-- The norm is submultiplicative. -/
  protected norm_mul_le : ∀ a b, norm (a * b) ≤ norm a * norm b

-- see Note [lower instance priority]
attribute [instance 10] NonUnitalSeminormedRing.toNonUnitalRing

/-- A seminormed ring is a ring endowed with a seminorm which satisfies the inequality
`‖x y‖ ≤ ‖x‖ ‖y‖`. -/

class SeminormedRing (α : Type*) extends Norm α, Ring α, PseudoMetricSpace α where
  /-- The distance is induced by the norm. -/
  dist_eq : ∀ x y, dist x y = norm (-x + y)
  /-- The norm is submultiplicative. -/
  norm_mul_le : ∀ a b, norm (a * b) ≤ norm a * norm b

-- see Note [lower instance priority]
attribute [instance 10] SeminormedRing.toRing

-- see Note [lower instance priority]
/-- A seminormed ring is a non-unital seminormed ring. -/
instance (priority := 100) SeminormedRing.toNonUnitalSeminormedRing [β : SeminormedRing α] :
    NonUnitalSeminormedRing α :=
  { β with }

/-- A non-unital normed ring is a not-necessarily-unital ring
endowed with a norm which satisfies the inequality `‖x y‖ ≤ ‖x‖ ‖y‖`. -/

class NonUnitalNormedRing (α : Type*) extends Norm α, NonUnitalRing α, MetricSpace α where
  /-- The distance is induced by the norm. -/
  dist_eq : ∀ x y, dist x y = norm (-x + y)
  /-- The norm is submultiplicative. -/
  norm_mul_le : ∀ a b, norm (a * b) ≤ norm a * norm b

-- see Note [lower instance priority]
attribute [instance 10] NonUnitalNormedRing.toNonUnitalRing

-- see Note [lower instance priority]
/-- A non-unital normed ring is a non-unital seminormed ring. -/
instance (priority := 100) NonUnitalNormedRing.toNonUnitalSeminormedRing
    [β : NonUnitalNormedRing α] : NonUnitalSeminormedRing α :=
  { β with }

/-- A normed ring is a ring endowed with a norm which satisfies the inequality `‖x y‖ ≤ ‖x‖ ‖y‖`. -/
class NormedRing (α : Type*) extends Norm α, Ring α, MetricSpace α where
  /-- The distance is induced by the norm. -/
  dist_eq : ∀ x y, dist x y = norm (-x + y)
  /-- The norm is submultiplicative. -/
  norm_mul_le : ∀ a b, norm (a * b) ≤ norm a * norm b

-- see Note [lower instance priority]
attribute [instance 10] NormedRing.toRing

-- see Note [lower instance priority]
/-- A normed ring is a seminormed ring. -/
instance (priority := 100) NormedRing.toSeminormedRing [β : NormedRing α] : SeminormedRing α :=
  { β with }

-- see Note [lower instance priority]
/-- A normed ring is a non-unital normed ring. -/
instance (priority := 100) NormedRing.toNonUnitalNormedRing [β : NormedRing α] :
    NonUnitalNormedRing α :=
  { β with }

/-- A non-unital seminormed commutative ring is a non-unital commutative ring endowed with a
seminorm which satisfies the inequality `‖x y‖ ≤ ‖x‖ ‖y‖`. -/

class NonUnitalSeminormedCommRing (α : Type*)
    extends NonUnitalSeminormedRing α, NonUnitalCommRing α where

-- see Note [lower instance priority]
attribute [instance 10] NonUnitalSeminormedCommRing.toNonUnitalCommRing

/-- A non-unital normed commutative ring is a non-unital commutative ring endowed with a
norm which satisfies the inequality `‖x y‖ ≤ ‖x‖ ‖y‖`. -/

class NonUnitalNormedCommRing (α : Type*) extends NonUnitalNormedRing α, NonUnitalCommRing α where

-- see Note [lower instance priority]
attribute [instance 10] NonUnitalNormedCommRing.toNonUnitalCommRing

-- see Note [lower instance priority]
/-- A non-unital normed commutative ring is a non-unital seminormed commutative ring. -/
instance (priority := 100) NonUnitalNormedCommRing.toNonUnitalSeminormedCommRing
    [β : NonUnitalNormedCommRing α] : NonUnitalSeminormedCommRing α :=
  { β with }

/-- A seminormed commutative ring is a commutative ring endowed with a seminorm which satisfies
the inequality `‖x y‖ ≤ ‖x‖ ‖y‖`. -/

class SeminormedCommRing (α : Type*) extends SeminormedRing α, CommRing α where

-- see Note [lower instance priority]
attribute [instance 10] SeminormedCommRing.toCommRing

/-- A normed commutative ring is a commutative ring endowed with a norm which satisfies
the inequality `‖x y‖ ≤ ‖x‖ ‖y‖`. -/

class NormedCommRing (α : Type*) extends NormedRing α, CommRing α where

-- see Note [lower instance priority]
attribute [instance 10] NormedCommRing.toCommRing

-- see Note [lower instance priority]
/-- A seminormed commutative ring is a non-unital seminormed commutative ring. -/
instance (priority := 100) SeminormedCommRing.toNonUnitalSeminormedCommRing
    [β : SeminormedCommRing α] : NonUnitalSeminormedCommRing α :=
  { β with }

-- see Note [lower instance priority]
/-- A normed commutative ring is a non-unital normed commutative ring. -/
instance (priority := 100) NormedCommRing.toNonUnitalNormedCommRing
    [β : NormedCommRing α] : NonUnitalNormedCommRing α :=
  { β with }

-- see Note [lower instance priority]
/-- A normed commutative ring is a seminormed commutative ring. -/
instance (priority := 100) NormedCommRing.toSeminormedCommRing [β : NormedCommRing α] :
    SeminormedCommRing α :=
  { β with }

instance PUnit.normedCommRing : NormedCommRing PUnit :=
  { PUnit.normedAddCommGroup, PUnit.commRing with
    norm_mul_le _ _ := by simp }

section NormOneClass

/-- A mixin class with the axiom `‖1‖ = 1`. Many `NormedRing`s and all `NormedField`s satisfy this
axiom. -/

class NormOneClass (α : Type*) [Norm α] [One α] : Prop where
  /-- The norm of the multiplicative identity is 1. -/
  norm_one : ‖(1 : α)‖ = 1

export NormOneClass (norm_one)

attribute [simp] norm_one

section SeminormedAddCommGroup
variable [SeminormedAddCommGroup G] [One G] [NormOneClass G]

@[simp] lemma nnNorm_one : ‖(1 : G)‖₊ = 1 := NNReal.eq norm_one
@[simp] lemma eNorm_one : ‖(1 : G)‖ₑ = 1 := by simp [eNorm]

@[deprecated (since := "2026-10-31")] alias nnnorm_one := nnNorm_one
@[deprecated (since := "2026-11-06")] alias enorm_one := eNorm_one

theorem NormOneClass.nontrivial : Nontrivial G :=
  nontrivial_of_ne 0 1 <| ne_of_apply_ne norm <| by simp

end SeminormedAddCommGroup

end NormOneClass

-- see Note [lower instance priority]
instance (priority := 100) NonUnitalNormedRing.toNormedAddCommGroup [β : NonUnitalNormedRing α] :
    NormedAddCommGroup α :=
  { β with }

-- see Note [lower instance priority]
instance (priority := 100) NonUnitalSeminormedRing.toSeminormedAddCommGroup
    [NonUnitalSeminormedRing α] : SeminormedAddCommGroup α :=
  { ‹NonUnitalSeminormedRing α› with }

instance ULift.normOneClass [SeminormedAddCommGroup α] [One α] [NormOneClass α] :
    NormOneClass (ULift α) :=
  ⟨by simp [ULift.norm_def]⟩

instance Prod.normOneClass [SeminormedAddCommGroup α] [One α] [NormOneClass α]
    [SeminormedAddCommGroup β] [One β] [NormOneClass β] : NormOneClass (α × β) :=
  ⟨by simp [Prod.norm_def]⟩

instance Pi.normOneClass {ι : Type*} {α : ι → Type*} [Nonempty ι] [Fintype ι]
    [∀ i, SeminormedAddCommGroup (α i)] [∀ i, One (α i)] [∀ i, NormOneClass (α i)] :
    NormOneClass (∀ i, α i) :=
  ⟨by simpa [Pi.norm_def] using Finset.sup_const Finset.univ_nonempty 1⟩

instance MulOpposite.normOneClass [SeminormedAddCommGroup α] [One α] [NormOneClass α] :
    NormOneClass αᵐᵒᵖ :=
  ⟨@norm_one α _ _ _⟩

section NonUnitalSeminormedRing

variable [NonUnitalSeminormedRing α] {a a₁ a₂ b c : α}

/-- The norm is submultiplicative. -/
theorem norm_mul_le (a b : α) : ‖a * b‖ ≤ ‖a‖ * ‖b‖ :=
  NonUnitalSeminormedRing.norm_mul_le a b

theorem nnNorm_mul_le (a b : α) : ‖a * b‖₊ ≤ ‖a‖₊ * ‖b‖₊ := norm_mul_le a b

@[deprecated (since := "2026-10-31")] alias nnnorm_mul_le := nnNorm_mul_le

lemma norm_mul_le_of_le {r₁ r₂ : ℝ} (h₁ : ‖a₁‖ ≤ r₁) (h₂ : ‖a₂‖ ≤ r₂) : ‖a₁ * a₂‖ ≤ r₁ * r₂ :=
  (norm_mul_le ..).trans <| mul_le_mul h₁ h₂ (norm_nonneg _) ((norm_nonneg _).trans h₁)

lemma nnNorm_mul_le_of_le {r₁ r₂ : ℝ≥0} (h₁ : ‖a₁‖₊ ≤ r₁) (h₂ : ‖a₂‖₊ ≤ r₂) :
    ‖a₁ * a₂‖₊ ≤ r₁ * r₂ := (nnNorm_mul_le ..).trans <| mul_le_mul' h₁ h₂

@[deprecated (since := "2026-10-31")] alias nnnorm_mul_le_of_le := nnNorm_mul_le_of_le

lemma norm_mul₃_le : ‖a * b * c‖ ≤ ‖a‖ * ‖b‖ * ‖c‖ := norm_mul_le_of_le (norm_mul_le ..) le_rfl

lemma nnNorm_mul₃_le : ‖a * b * c‖₊ ≤ ‖a‖₊ * ‖b‖₊ * ‖c‖₊ :=
  nnNorm_mul_le_of_le (norm_mul_le ..) le_rfl

@[deprecated (since := "2026-10-31")] alias nnnorm_mul₃_le := nnNorm_mul₃_le

theorem one_le_norm_one (β) [NormedRing β] [Nontrivial β] : 1 ≤ ‖(1 : β)‖ :=
  (le_mul_iff_one_le_left <| norm_pos_iff.mpr (one_ne_zero : (1 : β) ≠ 0)).mp
    (by simpa only [mul_one] using norm_mul_le (1 : β) 1)

theorem one_le_nnNorm_one (β) [NormedRing β] [Nontrivial β] : 1 ≤ ‖(1 : β)‖₊ :=
  one_le_norm_one β

@[deprecated (since := "2026-10-31")] alias one_le_nnnorm_one := one_le_nnNorm_one

/-- In a seminormed ring, the left-multiplication `AddMonoidHom` is bounded. -/
theorem mulLeft_bound (x : α) : ∀ y : α, ‖AddMonoidHom.mulLeft x y‖ ≤ ‖x‖ * ‖y‖ :=
  norm_mul_le x

/-- In a seminormed ring, the right-multiplication `AddMonoidHom` is bounded. -/
theorem mulRight_bound (x : α) : ∀ y : α, ‖AddMonoidHom.mulRight x y‖ ≤ ‖x‖ * ‖y‖ := fun y => by
  rw [mul_comm]
  exact norm_mul_le y x

/-- A non-unital subring of a non-unital seminormed ring is also a non-unital seminormed ring,
with the restriction of the norm. -/

instance NonUnitalSubring.nonUnitalSeminormedRing {E : Type*}
    [NonUnitalSeminormedRing E] (s : NonUnitalSubring E) :
    NonUnitalSeminormedRing s :=
  fast_instance%
  { s.seminormedAddCommGroup, s.toNonUnitalRing with
    norm_mul_le a b := norm_mul_le a.1 b.1 }

/-- A non-unital subalgebra of a non-unital seminormed ring is also a non-unital seminormed ring,
with the restriction of the norm. -/

instance NonUnitalSubalgebra.nonUnitalSeminormedRing {�� : Type*} [CommRing ��] {E : Type*}
    [NonUnitalSeminormedRing E] [Module �� E] (s : NonUnitalSubalgebra �� E) :
    NonUnitalSeminormedRing s :=
  fast_instance% s.toNonUnitalSubring.nonUnitalSeminormedRing

/-- A non-unital subring of a non-unital normed ring is also a non-unital normed ring, with the
restriction of the norm. -/

instance NonUnitalSubring.nonUnitalNormedRing {E : Type*}
  [NonUnitalNormedRing E] (s : NonUnitalSubring E) : NonUnitalNormedRing s :=
  fast_instance%
  { s.nonUnitalSeminormedRing with
    eq_of_dist_eq_zero := eq_of_dist_eq_zero }

/-- A non-unital subalgebra of a non-unital normed ring is also a non-unital normed ring, with the
restriction of the norm. -/

instance NonUnitalSubalgebra.nonUnitalNormedRing {�� : Type*} [CommRing ��] {E : Type*}
    [NonUnitalNormedRing E] [Module �� E] (s : NonUnitalSubalgebra �� E) : NonUnitalNormedRing s :=
  fast_instance% s.toNonUnitalSubring.nonUnitalNormedRing

instance ULift.nonUnitalSeminormedRing : NonUnitalSeminormedRing (ULift α) :=
  { ULift.seminormedAddCommGroup, ULift.nonUnitalRing with
    norm_mul_le x y := norm_mul_le x.down y.down }

/-- Non-unital seminormed ring structure on the product of two non-unital seminormed rings,
  using the sup norm. -/

instance Prod.nonUnitalSeminormedRing [NonUnitalSeminormedRing β] :
    NonUnitalSeminormedRing (α × β) :=
  { seminormedAddCommGroup, instNonUnitalRing with
    norm_mul_le x y := calc
      ‖x * y‖ = ‖(x.1 * y.1, x.2 * y.2)‖ := rfl
      _ = max ‖x.1 * y.1‖ ‖x.2 * y.2‖ := rfl
      _ ≤ max (‖x.1‖ * ‖y.1‖) (‖x.2‖ * ‖y.2‖) :=
        (max_le_max (norm_mul_le x.1 y.1) (norm_mul_le x.2 y.2))
      _ = max (‖x.1‖ * ‖y.1‖) (‖y.2‖ * ‖x.2‖) := by simp [mul_comm]
      _ ≤ max ‖x.1‖ ‖x.2‖ * max ‖y.2‖ ‖y.1‖ := by
        apply max_mul_mul_le_max_mul_max <;> simp [norm_nonneg]
      _ = max ‖x.1‖ ‖x.2‖ * max ‖y.1‖ ‖y.2‖ := by simp [max_comm]
      _ = ‖x‖ * ‖y‖ := rfl }

instance MulOpposite.instNonUnitalSeminormedRing : NonUnitalSeminormedRing αᵐᵒᵖ where
  __ := instNonUnitalRing
  __ := instSeminormedAddCommGroup
  norm_mul_le := MulOpposite.rec' fun x ↦ MulOpposite.rec' fun y ↦
    (norm_mul_le y x).trans_eq (mul_comm _ _)

end NonUnitalSeminormedRing

section SeminormedRing

variable [SeminormedRing α] {a b c : α}

/-- A subring of a seminormed ring is also a seminormed ring, with the restriction of the norm. -/
instance Subring.seminormedRing {E : Type*} [SeminormedRing E] (s : Subring E) :
    SeminormedRing s :=
  fast_instance%
  { s.seminormedAddCommGroup, s.toRing with
    norm_mul_le a b := norm_mul_le a.1 b.1 }

/-- A subalgebra of a seminormed ring is also a seminormed ring, with the restriction of the
norm. -/

instance Subalgebra.seminormedRing {�� : Type*} [CommRing ��] {E : Type*} [SeminormedRing E]
    [Algebra �� E] (s : Subalgebra �� E) : SeminormedRing s :=
  fast_instance% s.toSubring.seminormedRing

/-- A subring of a normed ring is also a normed ring, with the restriction of the norm. -/
instance Subring.normedRing {E : Type*} [NormedRing E] (s : Subring E) : NormedRing s :=
  fast_instance%
  { s.seminormedRing with
    eq_of_dist_eq_zero := eq_of_dist_eq_zero }

/-- A subalgebra of a normed ring is also a normed ring, with the restriction of the norm. -/
instance Subalgebra.normedRing {�� : Type*} [CommRing ��] {E : Type*} [NormedRing E]
    [Algebra �� E] (s : Subalgebra �� E) : NormedRing s :=
  fast_instance% s.toSubring.normedRing

theorem Nat.norm_cast_le : ∀ n : ℕ, ‖(n : α)‖ ≤ n * ‖(1 : α)‖
  | 0 => by simp
  | n + 1 => by
    rw [n.cast_succ, n.cast_succ, add_mul, one_mul]
    exact norm_add_le_of_le (Nat.norm_cast_le n) le_rfl

theorem List.norm_prod_le' : ∀ {l : List α}, l ≠ [] → ‖l.prod‖ ≤ (l.map norm).prod
  | [], h => (h rfl).elim
  | [a], _ => by simp
  | a::b::l, _ => by
    rw [List.map_cons, List.prod_cons, List.prod_cons (a := ‖a‖)]
    refine le_trans (norm_mul_le _ _) (mul_le_mul_of_nonneg_left ?_ (norm_nonneg _))
    exact List.norm_prod_le' (List.cons_ne_nil b l)

theorem List.nnNorm_prod_le' {l : List α} (hl : l ≠ []) : ‖l.prod‖₊ ≤ (l.map nnNorm).prod :=
  (List.norm_prod_le' hl).trans_eq <| by simp [NNReal.coe_list_prod, List.map_map]

@[deprecated (since := "2026-10-31")] alias List.nnnorm_prod_le' := List.nnNorm_prod_le'

theorem List.norm_prod_le [NormOneClass α] : ∀ l : List α, ‖l.prod‖ ≤ (l.map norm).prod
  | [] => by simp
  | a::l => List.norm_prod_le' (List.cons_ne_nil a l)

theorem List.nnNorm_prod_le [NormOneClass α] (l : List α) : ‖l.prod‖₊ ≤ (l.map nnNorm).prod :=
  l.norm_prod_le.trans_eq <| by simp [NNReal.coe_list_prod, List.map_map]

@[deprecated (since := "2026-10-31")] alias List.nnnorm_prod_le := List.nnNorm_prod_le

theorem Finset.norm_prod_le' {α : Type*} [NormedCommRing α] (s : Finset ι) (hs : s.Nonempty)
    (f : ι → α) : ‖∏ i ∈ s, f i‖ ≤ ∏ i ∈ s, ‖f i‖ := by
  rcases s with ⟨⟨l⟩, hl⟩
  have : l.map f ≠ [] := by simpa using! hs
  simpa using! List.norm_prod_le' this

theorem Finset.nnNorm_prod_le' {α : Type*} [NormedCommRing α] (s : Finset ι) (hs : s.Nonempty)
    (f : ι → α) : ‖∏ i ∈ s, f i‖₊ ≤ ∏ i ∈ s, ‖f i‖₊ :=
  (s.norm_prod_le' hs f).trans_eq <| by simp [NNReal.coe_prod]

@[deprecated (since := "2026-10-31")] alias Finset.nnnorm_prod_le' := Finset.nnNorm_prod_le'

theorem Finset.norm_prod_le {α : Type*} [NormedCommRing α] [NormOneClass α] (s : Finset ι)
    (f : ι → α) : ‖∏ i ∈ s, f i‖ ≤ ∏ i ∈ s, ‖f i‖ := by
  rcases s with ⟨⟨l⟩, hl⟩
  simpa using! (l.map f).norm_prod_le

theorem Finset.nnNorm_prod_le {α : Type*} [NormedCommRing α] [NormOneClass α] (s : Finset ι)
    (f : ι → α) : ‖∏ i ∈ s, f i‖₊ ≤ ∏ i ∈ s, ‖f i‖₊ :=
  (s.norm_prod_le f).trans_eq <| by simp [NNReal.coe_prod]

@[deprecated (since := "2026-10-31")] alias Finset.nnnorm_prod_le := Finset.nnNorm_prod_le

lemma norm_natAbs (z : ℤ) :
    ‖(z.natAbs : α)‖ = ‖(z : α)‖ := by
  rcases z.natAbs_eq with hz | hz
  · rw [← Int.cast_natCast, ← hz]
  · rw [← Int.cast_natCast, ← norm_neg, ← Int.cast_neg, ← hz]

lemma nnNorm_natAbs (z : ℤ) :
    ‖(z.natAbs : α)‖₊ = ‖(z : α)‖₊ := by
  simp [← NNReal.coe_inj, -Nat.cast_natAbs, norm_natAbs]

@[deprecated (since := "2026-10-31")] alias nnnorm_natAbs := nnNorm_natAbs

@[simp] lemma norm_intCast_abs (z : ℤ) :
    ‖((|z| : ℤ) : α)‖ = ‖(z : α)‖ := by
  simp [← norm_natAbs]

@[simp] lemma nnNorm_intCast_abs (z : ℤ) :
    ‖((|z| : ℤ) : α)‖₊ = ‖(z : α)‖₊ := by
  simp [← nnNorm_natAbs]

@[deprecated (since := "2026-10-31")] alias nnnorm_intCast_abs := nnNorm_intCast_abs

/-- If `α` is a seminormed ring, then `‖a ^ n‖₊ ≤ ‖a‖₊ ^ n` for `n > 0`.
See also `nnNorm_pow_le`. -/

theorem nnNorm_pow_le' (a : α) : ∀ {n : ℕ}, 0 < n → ‖a ^ n‖₊ ≤ ‖a‖₊ ^ n
  | 1, _ => by simp only [pow_one, le_rfl]
  | n + 2, _ => by
    simpa only [pow_succ' _ (n + 1)] using
      le_trans (nnNorm_mul_le _ _) (mul_le_mul_right (nnNorm_pow_le' a n.succ_pos) _)

@[deprecated (since := "2026-10-31")] alias nnnorm_pow_le' := nnNorm_pow_le'

/-- If `α` is a seminormed ring with `‖1‖₊ = 1`, then `‖a ^ n‖₊ ≤ ‖a‖₊ ^ n`.
See also `nnNorm_pow_le'`. -/

theorem nnNorm_pow_le [NormOneClass α] (a : α) (n : ℕ) : ‖a ^ n‖₊ ≤ ‖a‖₊ ^ n :=
  Nat.recOn n (by simp)
    fun k _hk => nnNorm_pow_le' a k.succ_pos

@[deprecated (since := "2026-10-31")] alias nnnorm_pow_le := nnNorm_pow_le

/-- If `α` is a seminormed ring, then `‖a ^ n‖ ≤ ‖a‖ ^ n` for `n > 0`. See also `norm_pow_le`. -/
theorem norm_pow_le' (a : α) {n : ℕ} (h : 0 < n) : ‖a ^ n‖ ≤ ‖a‖ ^ n := by
  simpa only [NNReal.coe_pow, coe_nnNorm] using NNReal.coe_mono (nnNorm_pow_le' a h)

/-- If `α` is a seminormed ring with `‖1‖ = 1`, then `‖a ^ n‖ ≤ ‖a‖ ^ n`.
See also `norm_pow_le'`. -/

theorem norm_pow_le [NormOneClass α] (a : α) (n : ℕ) : ‖a ^ n‖ ≤ ‖a‖ ^ n :=
  Nat.recOn n (by simp)
    fun n _hn => norm_pow_le' a n.succ_pos

theorem eventually_norm_pow_le (a : α) : ∀ᶠ n : ℕ in atTop, ‖a ^ n‖ ≤ ‖a‖ ^ n :=
  eventually_atTop.mpr ⟨1, fun _b h => norm_pow_le' a (Nat.succ_le_iff.mp h)⟩

@[simp]
theorem norm_neg_pow (a : α) (n : ℕ) : ‖(-a) ^ n‖ = ‖a ^ n‖ := by
  rw [neg_pow, neg_one_pow_eq_ite]
  split_ifs <;> simp

@[simp]
theorem nnNorm_neg_pow (a : α) (n : ℕ) : ‖(-a) ^ n‖₊ = ‖a ^ n‖₊ := by
  simp [nnNorm]

@[deprecated (since := "2026-10-31")] alias nnnorm_neg_pow := nnNorm_neg_pow

@[simp]
theorem eNorm_neg_pow (a : α) (n : ℕ) : ‖(-a) ^ n‖ₑ = ‖a ^ n‖ₑ := by
  simp [eNorm]

@[deprecated (since := "2026-11-06")] alias enorm_neg_pow := eNorm_neg_pow

instance ULift.seminormedRing : SeminormedRing (ULift α) :=
  { ULift.nonUnitalSeminormedRing, ULift.ring with }

/-- Seminormed ring structure on the product of two seminormed rings,
  using the sup norm. -/

instance Prod.seminormedRing [SeminormedRing β] : SeminormedRing (α × β) :=
  { nonUnitalSeminormedRing, instRing with }

instance MulOpposite.instSeminormedRing : SeminormedRing αᵐᵒᵖ where
  __ := instRing
  __ := instNonUnitalSeminormedRing

/-- This inequality is particularly useful when `c = 1` and `‖a‖ = ‖b‖ = 1` as it then shows that
chord length is a metric on the unit complex numbers. -/

lemma norm_sub_mul_le (ha : ‖a‖ ≤ 1) : ‖c - a * b‖ ≤ ‖c - a‖ + ‖1 - b‖ :=
  calc
    _ ≤ ‖c - a‖ + ‖a * (1 - b)‖ := by
        simpa [mul_one_sub] using norm_sub_le_norm_sub_add_norm_sub c a (a * b)
    _ ≤ ‖c - a‖ + ‖a‖ * ‖1 - b‖ := by gcongr; exact norm_mul_le ..
    _ ≤ ‖c - a‖ + 1 * ‖1 - b‖ := by gcongr
    _ = ‖c - a‖ + ‖1 - b‖ := by simp

/-- This inequality is particularly useful when `c = 1` and `‖a‖ = ‖b‖ = 1` as it then shows that
chord length is a metric on the unit complex numbers. -/

lemma norm_sub_mul_le' (hb : ‖b‖ ≤ 1) : ‖c - a * b‖ ≤ ‖1 - a‖ + ‖c - b‖ := by
  rw [add_comm]; exact norm_sub_mul_le (α := αᵐᵒᵖ) hb

/-- This inequality is particularly useful when `c = 1` and `‖a‖ = ‖b‖ = 1` as it then shows that
chord length is a metric on the unit complex numbers. -/

lemma nnNorm_sub_mul_le (ha : ‖a‖₊ ≤ 1) : ‖c - a * b‖₊ ≤ ‖c - a‖₊ + ‖1 - b‖₊ := norm_sub_mul_le ha

@[deprecated (since := "2026-10-31")] alias nnnorm_sub_mul_le := nnNorm_sub_mul_le

/-- This inequality is particularly useful when `c = 1` and `‖a‖ = ‖b‖ = 1` as it then shows that
chord length is a metric on the unit complex numbers. -/

lemma nnNorm_sub_mul_le' (hb : ‖b‖₊ ≤ 1) : ‖c - a * b‖₊ ≤ ‖1 - a‖₊ + ‖c - b‖₊ := norm_sub_mul_le' hb

@[deprecated (since := "2026-10-31")] alias nnnorm_sub_mul_le' := nnNorm_sub_mul_le'

lemma norm_commutator_units_sub_one_le (a b : αˣ) :
    ‖(a * b * a⁻¹ * b⁻¹).val - 1‖ ≤ 2 * ‖a⁻¹.val‖ * ‖b⁻¹.val‖ * ‖a.val - 1‖ * ‖b.val - 1‖ :=
  calc
    ‖(a * b * a⁻¹ * b⁻¹).val - 1‖ = ‖(a * b - b * a) * a⁻¹.val * b⁻¹.val‖ := by simp [sub_mul, *]
    _ ≤ ‖(a * b - b * a : α)‖ * ‖a⁻¹.val‖ * ‖b⁻¹.val‖ := norm_mul₃_le
    _ = ‖(a - 1 : α) * (b - 1) - (b - 1) * (a - 1)‖ * ‖a⁻¹.val‖ * ‖b⁻¹.val‖ := by
      simp_rw [sub_one_mul, mul_sub_one]; abel_nf
    _ ≤ (‖(a - 1 : α) * (b - 1)‖ + ‖(b - 1 : α) * (a - 1)‖) * ‖a⁻¹.val‖ * ‖b⁻¹.val‖ := by
      gcongr; exact norm_sub_le ..
    _ ≤ (‖a.val - 1‖ * ‖b.val - 1‖ + ‖b.val - 1‖ * ‖a.val - 1‖) * ‖a⁻¹.val‖ * ‖b⁻¹.val‖ := by
      gcongr <;> exact norm_mul_le ..
    _ = 2 * ‖a⁻¹.val‖ * ‖b⁻¹.val‖ * ‖a.val - 1‖ * ‖b.val - 1‖ := by ring

lemma nnNorm_commutator_units_sub_one_le (a b : αˣ) :
    ‖(a * b * a⁻¹ * b⁻¹).val - 1‖₊ ≤ 2 * ‖a⁻¹.val‖₊ * ‖b⁻¹.val‖₊ * ‖a.val - 1‖₊ * ‖b.val - 1‖₊ := by
  simpa using! norm_commutator_units_sub_one_le a b

@[deprecated (since := "2026-10-31")]
alias nnnorm_commutator_units_sub_one_le := nnNorm_commutator_units_sub_one_le

/-- A homomorphism `f` between semi_normed_rings is bounded if there exists a positive
  constant `C` such that for all `x` in `α`, `norm (f x) ≤ C * norm x`. -/

def RingHom.IsBounded {α : Type*} [SeminormedRing α] {β : Type*} [SeminormedRing β]
    (f : α →+* β) : Prop :=
  ∃ C : ℝ, 0 < C ∧ ∀ x : α, norm (f x) ≤ C * norm x

end SeminormedRing

section NonUnitalNormedRing

variable [NonUnitalNormedRing α]

instance ULift.nonUnitalNormedRing : NonUnitalNormedRing (ULift α) :=
  { ULift.nonUnitalSeminormedRing, ULift.normedAddCommGroup with }

/-- Non-unital normed ring structure on the product of two non-unital normed rings,
using the sup norm. -/

instance Prod.nonUnitalNormedRing [NonUnitalNormedRing β] : NonUnitalNormedRing (α × β) :=
  { Prod.nonUnitalSeminormedRing, Prod.normedAddCommGroup with }

instance MulOpposite.instNonUnitalNormedRing : NonUnitalNormedRing αᵐᵒᵖ where
  __ := instNonUnitalRing
  __ := instNonUnitalSeminormedRing
  __ := instNormedAddCommGroup

end NonUnitalNormedRing

section NormedRing

variable [NormedRing α]

theorem Units.norm_pos [Nontrivial α] (x : αˣ) : 0 < ‖(x : α)‖ :=
  norm_pos_iff.mpr (Units.ne_zero x)

theorem Units.nnNorm_pos [Nontrivial α] (x : αˣ) : 0 < ‖(x : α)‖₊ :=
  x.norm_pos

@[deprecated (since := "2026-10-31")] alias Units.nnnorm_pos := Units.nnNorm_pos

instance ULift.normedRing : NormedRing (ULift α) :=
  { ULift.seminormedRing, ULift.normedAddCommGroup with }

/-- Normed ring structure on the product of two normed rings, using the sup norm. -/
instance Prod.normedRing [NormedRing β] : NormedRing (α × β) :=
  { nonUnitalNormedRing, instRing with }

instance MulOpposite.instNormedRing : NormedRing αᵐᵒᵖ where
  __ := instRing
  __ := instSeminormedRing
  __ := instNormedAddCommGroup

end NormedRing

section NonUnitalSeminormedCommRing

variable [NonUnitalSeminormedCommRing α]

instance ULift.nonUnitalSeminormedCommRing : NonUnitalSeminormedCommRing (ULift α) :=
  { ULift.nonUnitalSeminormedRing, ULift.nonUnitalCommRing with }

/-- Non-unital seminormed commutative ring structure on the product of two non-unital seminormed
commutative rings, using the sup norm. -/

instance Prod.nonUnitalSeminormedCommRing [NonUnitalSeminormedCommRing β] :
    NonUnitalSeminormedCommRing (α × β) :=
  { nonUnitalSeminormedRing, instNonUnitalCommRing with }

instance MulOpposite.instNonUnitalSeminormedCommRing : NonUnitalSeminormedCommRing αᵐᵒᵖ where
  __ := instNonUnitalSeminormedRing
  __ := instNonUnitalCommRing

end NonUnitalSeminormedCommRing

section NonUnitalNormedCommRing

variable [NonUnitalNormedCommRing α]

/-- A non-unital subring of a non-unital seminormed commutative ring is also a non-unital
seminormed commutative ring, with the restriction of the norm. -/

instance NonUnitalSubring.nonUnitalSeminormedCommRing {E : Type*}
    [NonUnitalSeminormedCommRing E] (s : NonUnitalSubring E) :
    NonUnitalSeminormedCommRing s :=
  fast_instance% { s.nonUnitalSeminormedRing, s.toNonUnitalCommRing with }

/-- A non-unital subalgebra of a non-unital seminormed commutative ring is also a non-unital
seminormed commutative ring, with the restriction of the norm. -/

instance NonUnitalSubalgebra.nonUnitalSeminormedCommRing {�� : Type*} [CommRing ��] {E : Type*}
    [NonUnitalSeminormedCommRing E] [Module �� E] (s : NonUnitalSubalgebra �� E) :
    NonUnitalSeminormedCommRing s :=
  fast_instance% s.toNonUnitalSubring.nonUnitalSeminormedCommRing

/-- A non-unital subring of a non-unital normed commutative ring is also a non-unital normed
commutative ring, with the restriction of the norm. -/

instance NonUnitalSubring.nonUnitalNormedCommRing {E : Type*}
    [NonUnitalNormedCommRing E] (s : NonUnitalSubring E) :
    NonUnitalNormedCommRing s :=
  fast_instance% { s.nonUnitalSeminormedCommRing, s.nonUnitalNormedRing with }

/-- A non-unital subalgebra of a non-unital normed commutative ring is also a non-unital normed
commutative ring, with the restriction of the norm. -/

instance NonUnitalSubalgebra.nonUnitalNormedCommRing {�� : Type*} [CommRing ��] {E : Type*}
    [NonUnitalNormedCommRing E] [Module �� E] (s : NonUnitalSubalgebra �� E) :
    NonUnitalNormedCommRing s :=
  fast_instance% s.toNonUnitalSubring.nonUnitalNormedCommRing

instance ULift.nonUnitalNormedCommRing : NonUnitalNormedCommRing (ULift α) :=
  { ULift.nonUnitalSeminormedCommRing, ULift.normedAddCommGroup with }

/-- Non-unital normed commutative ring structure on the product of two non-unital normed
commutative rings, using the sup norm. -/

instance Prod.nonUnitalNormedCommRing [NonUnitalNormedCommRing β] :
    NonUnitalNormedCommRing (α × β) :=
  { Prod.nonUnitalSeminormedCommRing, Prod.normedAddCommGroup with }

instance MulOpposite.instNonUnitalNormedCommRing : NonUnitalNormedCommRing αᵐᵒᵖ where
  __ := instNonUnitalNormedRing
  __ := instNonUnitalSeminormedCommRing

end NonUnitalNormedCommRing

section SeminormedCommRing

variable [SeminormedCommRing α]

instance ULift.seminormedCommRing : SeminormedCommRing (ULift α) :=
  { ULift.nonUnitalSeminormedRing, ULift.commRing with }

/-- Seminormed commutative ring structure on the product of two seminormed commutative rings,
  using the sup norm. -/

instance Prod.seminormedCommRing [SeminormedCommRing β] : SeminormedCommRing (α × β) :=
  { Prod.nonUnitalSeminormedCommRing, instCommRing with }

instance MulOpposite.instSeminormedCommRing : SeminormedCommRing αᵐᵒᵖ where
  __ := instSeminormedRing
  __ := instNonUnitalSeminormedCommRing

end SeminormedCommRing

section NormedCommRing

/-- A subalgebra of a seminormed commutative ring is also a seminormed commutative ring, with the
restriction of the norm. -/

instance Subalgebra.seminormedCommRing {�� : Type*} [CommRing ��] {E : Type*} [SeminormedCommRing E]
    [Algebra �� E] (s : Subalgebra �� E) : SeminormedCommRing s :=
  { s.seminormedRing, s.toCommRing with }

/-- A subalgebra of a normed commutative ring is also a normed commutative ring, with the
restriction of the norm. -/

instance Subalgebra.normedCommRing {�� : Type*} [CommRing ��] {E : Type*} [NormedCommRing E]
    [Algebra �� E] (s : Subalgebra �� E) : NormedCommRing s :=
  { s.seminormedCommRing, s.normedRing with }

variable [NormedCommRing α]

instance ULift.normedCommRing : NormedCommRing (ULift α) :=
  { ULift.normedRing (α := α), ULift.seminormedCommRing with }

/-- Normed commutative ring structure on the product of two normed commutative rings, using the sup
norm. -/

instance Prod.normedCommRing [NormedCommRing β] : NormedCommRing (α × β) :=
  { nonUnitalNormedRing, instCommRing with }

instance MulOpposite.instNormedCommRing : NormedCommRing αᵐᵒᵖ where
  __ := instNormedRing
  __ := instSeminormedCommRing

/-- The restriction of a power-multiplicative function to a subalgebra is power-multiplicative. -/
theorem IsPowMul.restriction {R S : Type*} [CommRing R] [Ring S] [Algebra R S]
    (A : Subalgebra R S) {f : S → ℝ} (hf_pm : IsPowMul f) :
    IsPowMul fun x : A => f x.val := fun x n hn => by
  simpa using hf_pm (↑x) hn

end NormedCommRing

instance Real.normedCommRing : NormedCommRing ℝ :=
  { Real.normedAddCommGroup, Real.commRing with norm_mul_le x y := (abs_mul x y).le }

namespace NNReal

open NNReal

theorem norm_eq (x : ℝ≥0) : ‖(x : ℝ)‖ = x := by rw [Real.norm_eq_abs, x.abs_eq]

@[simp] lemma nnNorm_eq (x : ℝ≥0) : ‖(x : ℝ)‖₊ = x := by ext; simp [nnNorm]
@[simp] lemma eNorm_eq (x : ℝ≥0) : ‖(x : ℝ)‖ₑ = x := by simp [eNorm]

@[deprecated (since := "2026-10-31")] alias nnnorm_eq := nnNorm_eq
@[deprecated (since := "2026-11-06")] alias enorm_eq := eNorm_eq

end NNReal

/-- A restatement of `MetricSpace.tendsto_atTop` in terms of the norm. -/
theorem NormedAddCommGroup.tendsto_atTop [Nonempty α] [Preorder α] [IsDirectedOrder α]
    {β : Type*} [SeminormedAddCommGroup β] {f : α → β} {b : β} :
    Tendsto f atTop (�� b) ↔ ∀ ε, 0 < ε → ∃ N, ∀ n, N ≤ n → ‖f n - b‖ < ε :=
  (atTop_basis.tendsto_iff Metric.nhds_basis_ball).trans (by simp [dist_eq_norm])

/-- A variant of `NormedAddCommGroup.tendsto_atTop` that
uses `∃ N, ∀ n > N, ...` rather than `∃ N, ∀ n ≥ N, ...`
-/

theorem NormedAddCommGroup.tendsto_atTop' [Nonempty α] [Preorder α] [IsDirectedOrder α]
    [NoMaxOrder α] {β : Type*} [SeminormedAddCommGroup β] {f : α → β} {b : β} :
    Tendsto f atTop (�� b) ↔ ∀ ε, 0 < ε → ∃ N, ∀ n, N < n → ‖f n - b‖ < ε :=
  (atTop_basis_Ioi.tendsto_iff Metric.nhds_basis_ball).trans (by simp [dist_eq_norm])

section RingHomIsometric

variable {R₁ R₂ : Type*}

/-- This class states that a ring homomorphism is isometric. This is a sufficient assumption
for a continuous semilinear map to be bounded and this is the main use for this typeclass. -/

class RingHomIsometric [Semiring R₁] [Semiring R₂] [Norm R₁] [Norm R₂] (σ : R₁ →+* R₂) : Prop where
  /-- The ring homomorphism is an isometry. -/
  norm_map : ∀ {x : R₁}, ‖σ x‖ = ‖x‖

attribute [simp] RingHomIsometric.norm_map

@[simp]
theorem RingHomIsometric.nnNorm_map [SeminormedRing R₁] [SeminormedRing R₂] (σ : R₁ →+* R₂)
    [RingHomIsometric σ] (x : R₁) : ‖σ x‖₊ = ‖x‖₊ :=
  NNReal.eq norm_map

@[deprecated (since := "2026-10-31")]
alias RingHomIsometric.nnnorm_map := RingHomIsometric.nnNorm_map

@[simp]
theorem RingHomIsometric.eNorm_map [SeminormedRing R₁] [SeminormedRing R₂] (σ : R₁ →+* R₂)
    [RingHomIsometric σ] (x : R₁) : ‖σ x‖ₑ = ‖x‖ₑ :=
  congrArg ENNReal.ofNNReal <| nnNorm_map σ x

@[deprecated (since := "2026-11-06")] alias RingHomIsometric.enorm_map := RingHomIsometric.eNorm_map

variable [SeminormedRing R₁]

instance RingHomIsometric.ids : RingHomIsometric (RingHom.id R₁) :=
  ⟨rfl⟩

end RingHomIsometric

section NormMulClass

/-- A mixin class for strict multiplicativity of the norm, `‖a * b‖ = ‖a‖ * ‖b‖` (rather than
`≤` as in the definition of `NormedRing`). Many `NormedRing`s satisfy this stronger property,
including all `NormedDivisionRing`s and `NormedField`s. -/

class NormMulClass (α : Type*) [Norm α] [Mul α] : Prop where
  /-- The norm is multiplicative. -/
  protected norm_mul : ∀ (a b : α), ‖a * b‖ = ‖a‖ * ‖b‖

@[simp] lemma norm_mul [Norm α] [Mul α] [NormMulClass α] (a b : α) :
    ‖a * b‖ = ‖a‖ * ‖b‖ :=
  NormMulClass.norm_mul a b

section SeminormedAddCommGroup

variable [SeminormedAddCommGroup α] [Mul α] [NormMulClass α] (a b : α)

@[simp] lemma nnNorm_mul : ‖a * b‖₊ = ‖a‖₊ * ‖b‖₊ := NNReal.eq <| norm_mul a b

@[deprecated (since := "2026-10-31")] alias nnnorm_mul := nnNorm_mul

@[simp] lemma eNorm_mul : ‖a * b‖ₑ = ‖a‖ₑ * ‖b‖ₑ := by simp [eNorm]

@[deprecated (since := "2026-11-06")] alias enorm_mul := eNorm_mul

end SeminormedAddCommGroup

section SeminormedRing

variable [SeminormedRing α] [NormOneClass α] [NormMulClass α]

/-- `norm` as a `MonoidWithZeroHom`. -/
@[simps]
def normHom : α →*₀ ℝ where
  toFun := (‖·‖)
  map_zero' := norm_zero
  map_one' := norm_one
  map_mul' := norm_mul

/-- `nnNorm` as a `MonoidWithZeroHom`. -/
@[simps]
def nnNormHom : α →*₀ ℝ≥0 where
  toFun := (‖·‖₊)
  map_zero' := nnNorm_zero
  map_one' := nnNorm_one
  map_mul' := nnNorm_mul

@[deprecated (since := "2026-10-31")] alias nnnormHom := nnNormHom
@[deprecated (since := "2026-10-31")] alias nnnormHom_apply := nnNormHom_apply

@[simp]
theorem norm_pow (a : α) : ∀ n : ℕ, ‖a ^ n‖ = ‖a‖ ^ n :=
  (normHom.toMonoidHom : α →* ℝ).map_pow a

@[simp]
theorem nnNorm_pow (a : α) (n : ℕ) : ‖a ^ n‖₊ = ‖a‖₊ ^ n :=
  (nnNormHom.toMonoidHom : α →* ℝ≥0).map_pow a n

@[deprecated (since := "2026-10-31")] alias nnnorm_pow := nnNorm_pow

@[simp] lemma eNorm_pow (a : α) (n : ℕ) : ‖a ^ n‖ₑ = ‖a‖ₑ ^ n := by simp [eNorm]

@[deprecated (since := "2026-11-06")] alias enorm_pow := eNorm_pow

protected theorem List.norm_prod (l : List α) : ‖l.prod‖ = (l.map norm).prod :=
  map_list_prod (normHom.toMonoidHom : α →* ℝ) _

protected theorem List.nnNorm_prod (l : List α) : ‖l.prod‖₊ = (l.map nnNorm).prod :=
  map_list_prod (nnNormHom.toMonoidHom : α →* ℝ≥0) _

@[deprecated (since := "2026-10-31")] protected alias List.nnnorm_prod := List.nnNorm_prod

@[simp]
theorem List.norm_prod_map (l : List β) (f : β → α) :
    ‖(l.map f).prod‖ = (l.map (‖f ·‖)).prod := by
  aesop (add simp List.norm_prod)

@[simp]
theorem List.nnNorm_prod_map (l : List β) (f : β → α) :
    ‖(l.map f).prod‖₊ = (l.map (‖f ·‖₊)).prod := by
  aesop (add simp List.nnNorm_prod)

@[deprecated (since := "2026-10-31")] alias List.nnnorm_prod_map := List.nnNorm_prod_map

end SeminormedRing

section SeminormedCommRing

variable [SeminormedCommRing α] [NormMulClass α] [NormOneClass α]

@[simp]
theorem norm_prod (s : Finset β) (f : β → α) : ‖∏ b ∈ s, f b‖ = ∏ b ∈ s, ‖f b‖ :=
  map_prod normHom.toMonoidHom f s

@[simp]
theorem nnNorm_prod (s : Finset β) (f : β → α) : ‖∏ b ∈ s, f b‖₊ = ∏ b ∈ s, ‖f b‖₊ :=
  map_prod nnNormHom.toMonoidHom f s

@[deprecated (since := "2026-10-31")] alias nnnorm_prod := nnNorm_prod

protected theorem Multiset.norm_prod (s : Multiset α) : ‖s.prod‖ = (s.map norm).prod :=
  map_multiset_prod (normHom.toMonoidHom : α →* ℝ) _

protected theorem Multiset.nnNorm_prod (s : Multiset α) : ‖s.prod‖₊ = (s.map nnNorm).prod :=
  map_multiset_prod (nnNormHom.toMonoidHom : α →* ℝ≥0) _

@[deprecated (since := "2026-10-31")] protected alias Multiset.nnnorm_prod := Multiset.nnNorm_prod

@[simp]
theorem Multiset.norm_prod_map (s : Multiset β) (f : β → α) :
    ‖(s.map f).prod‖ = (s.map (‖f ·‖)).prod := by
  simp [Multiset.norm_prod]

@[simp]
theorem Multiset.nnNorm_prod_map (s : Multiset β) (f : β → α) :
    ‖(s.map f).prod‖₊ = (s.map (‖f ·‖₊)).prod := by
  simp [Multiset.nnNorm_prod]

@[deprecated (since := "2026-10-31")] alias Multiset.nnnorm_prod_map := Multiset.nnNorm_prod_map

end SeminormedCommRing

section NormedAddCommGroup
variable [NormedAddCommGroup α] [MulOneClass α] [NormMulClass α] [Nontrivial α]

/-- Deduce `NormOneClass` from `NormMulClass` under a suitable nontriviality hypothesis. Not
an instance, in order to avoid loops with `NormOneClass.nontrivial`. -/

lemma NormMulClass.toNormOneClass : NormOneClass α where
  norm_one := by
    obtain ⟨u, hu⟩ := exists_ne (0 : α)
    simpa [mul_eq_left₀ (norm_ne_zero_iff.mpr hu)] using (norm_mul u 1).symm

end NormedAddCommGroup

section NormedRing
variable [NormedRing α] [NormMulClass α]

instance NormMulClass.isAbsoluteValue_norm : IsAbsoluteValue (norm : α → ℝ) where
  abv_nonneg' := norm_nonneg
  abv_eq_zero' := norm_eq_zero
  abv_add' := norm_add_le
  abv_mul' := norm_mul

instance NormMulClass.toNoZeroDivisors : NoZeroDivisors α where
  eq_zero_or_eq_zero_of_mul_eq_zero h := by
    simpa only [← norm_eq_zero (E := α), norm_mul, mul_eq_zero] using h

end NormedRing

end NormMulClass

/-! ### Induced normed structures -/

section Induced

variable {F : Type*} (R S : Type*) [FunLike F R S]

/-- A non-unital ring homomorphism from a `NonUnitalRing` to a `NonUnitalSeminormedRing`
induces a `NonUnitalSeminormedRing` structure on the domain.

See note [reducible non-instances] -/

abbrev NonUnitalSeminormedRing.induced [NonUnitalRing R] [NonUnitalSeminormedRing S]
    [NonUnitalRingHomClass F R S] (f : F) : NonUnitalSeminormedRing R := fast_instance%
  { SeminormedAddCommGroup.induced R S f, ‹NonUnitalRing R› with
    norm_mul_le x y := show ‖f _‖ ≤ _ from (map_mul f x y).symm ▸ norm_mul_le (f x) (f y) }

/-- An injective non-unital ring homomorphism from a `NonUnitalRing` to a
`NonUnitalNormedRing` induces a `NonUnitalNormedRing` structure on the domain.

See note [reducible non-instances] -/

abbrev NonUnitalNormedRing.induced [NonUnitalRing R] [NonUnitalNormedRing S]
    [NonUnitalRingHomClass F R S] (f : F) (hf : Function.Injective f) :
    NonUnitalNormedRing R := fast_instance%
  { NonUnitalSeminormedRing.induced R S f, NormedAddCommGroup.induced R S f hf with }

/-- A non-unital ring homomorphism from a `Ring` to a `SeminormedRing` induces a
`SeminormedRing` structure on the domain.

See note [reducible non-instances] -/

abbrev SeminormedRing.induced [Ring R] [SeminormedRing S] [NonUnitalRingHomClass F R S] (f : F) :
    SeminormedRing R := fast_instance%
  { NonUnitalSeminormedRing.induced R S f, SeminormedAddCommGroup.induced R S f, ‹Ring R› with }

/-- An injective non-unital ring homomorphism from a `Ring` to a `NormedRing` induces a
`NormedRing` structure on the domain.

See note [reducible non-instances] -/

abbrev NormedRing.induced [Ring R] [NormedRing S] [NonUnitalRingHomClass F R S] (f : F)
    (hf : Function.Injective f) : NormedRing R := fast_instance%
  { NonUnitalSeminormedRing.induced R S f, NormedAddCommGroup.induced R S f hf, ‹Ring R› with }

/-- A non-unital ring homomorphism from a `NonUnitalCommRing` to a `NonUnitalSeminormedCommRing`
induces a `NonUnitalSeminormedCommRing` structure on the domain.

See note [reducible non-instances] -/

abbrev NonUnitalSeminormedCommRing.induced [NonUnitalCommRing R] [NonUnitalSeminormedCommRing S]
    [NonUnitalRingHomClass F R S] (f : F) : NonUnitalSeminormedCommRing R := fast_instance%
  { NonUnitalSeminormedRing.induced R S f, ‹NonUnitalCommRing R› with }

/-- An injective non-unital ring homomorphism from a `NonUnitalCommRing` to a
`NonUnitalNormedCommRing` induces a `NonUnitalNormedCommRing` structure on the domain.

See note [reducible non-instances] -/

abbrev NonUnitalNormedCommRing.induced [NonUnitalCommRing R] [NonUnitalNormedCommRing S]
    [NonUnitalRingHomClass F R S] (f : F) (hf : Function.Injective f) :
    NonUnitalNormedCommRing R := fast_instance%
  { NonUnitalNormedRing.induced R S f hf, ‹NonUnitalCommRing R› with }
/-- A non-unital ring homomorphism from a `CommRing` to a `SeminormedRing` induces a
`SeminormedCommRing` structure on the domain.

See note [reducible non-instances] -/

abbrev SeminormedCommRing.induced [CommRing R] [SeminormedRing S] [NonUnitalRingHomClass F R S]
    (f : F) : SeminormedCommRing R := fast_instance%
  { NonUnitalSeminormedRing.induced R S f, SeminormedAddCommGroup.induced R S f, ‹CommRing R› with }

/-- An injective non-unital ring homomorphism from a `CommRing` to a `NormedRing` induces a
`NormedCommRing` structure on the domain.

See note [reducible non-instances] -/

abbrev NormedCommRing.induced [CommRing R] [NormedRing S] [NonUnitalRingHomClass F R S] (f : F)
    (hf : Function.Injective f) : NormedCommRing R := fast_instance%
  { SeminormedCommRing.induced R S f, NormedAddCommGroup.induced R S f hf with }

/-- A ring homomorphism from a `Ring R` to a `SeminormedRing S` which induces the norm structure
`SeminormedRing.induced` makes `R` satisfy `‖(1 : R)‖ = 1` whenever `‖(1 : S)‖ = 1`. -/

theorem NormOneClass.induced {F : Type*} (R S : Type*) [Ring R] [SeminormedRing S]
    [NormOneClass S] [FunLike F R S] [RingHomClass F R S] (f : F) :
    @NormOneClass R (SeminormedRing.induced R S f).toNorm _ :=
  let _ : SeminormedRing R := SeminormedRing.induced R S f
  { norm_one := congr(norm $(map_one f)).trans norm_one }

/-- A ring homomorphism from a `Ring R` to a `SeminormedRing S` which induces the norm structure
`SeminormedRing.induced` makes `R` satisfy `‖(1 : R)‖ = 1` whenever `‖(1 : S)‖ = 1`. -/

theorem NormMulClass.induced {F : Type*} (R S : Type*) [Ring R] [SeminormedRing S]
    [NormMulClass S] [FunLike F R S] [RingHomClass F R S] (f : F) :
    @NormMulClass R (SeminormedRing.induced R S f).toNorm _ :=
  let _ : SeminormedRing R := SeminormedRing.induced R S f
  { norm_mul x y := congr(norm $(map_mul f x y)).trans <| norm_mul _ _ }

end Induced

namespace NonUnitalSubringClass

variable {S R : Type*} [SetLike S R]

instance (priority := 75) toNonUnitalSeminormedRing [NonUnitalSeminormedRing R]
    [NonUnitalSubringClass S R] (s : S) :
    NonUnitalSeminormedRing s :=
  fast_instance% NonUnitalSeminormedRing.induced s R (subtype s)

instance (priority := 75) toNonUnitalNormedRing [NonUnitalNormedRing R]
    [NonUnitalSubringClass S R] (s : S) :
    NonUnitalNormedRing s :=
  fast_instance% NonUnitalNormedRing.induced s R (subtype s) Subtype.val_injective

instance (priority := 75) toNonUnitalSeminormedCommRing [NonUnitalSeminormedCommRing R]
    [NonUnitalSubringClass S R] (s : S) :
    NonUnitalSeminormedCommRing s :=
  fast_instance% NonUnitalSeminormedCommRing.induced s R (subtype s)

instance (priority := 75) toNonUnitalNormedCommRing [NonUnitalNormedCommRing R]
    [NonUnitalSubringClass S R] (s : S) :
    NonUnitalNormedCommRing s :=
  fast_instance% NonUnitalNormedCommRing.induced s R (subtype s) Subtype.val_injective

end NonUnitalSubringClass

namespace SubringClass

variable {S R : Type*} [SetLike S R]

instance (priority := 75) toSeminormedRing [SeminormedRing R] [SubringClass S R] (s : S) :
    SeminormedRing s :=
  fast_instance% SeminormedRing.induced s R (subtype s)

instance (priority := 75) toNormedRing [NormedRing R] [SubringClass S R] (s : S) : NormedRing s :=
  fast_instance% NormedRing.induced s R (subtype s) Subtype.val_injective

instance (priority := 75) toSeminormedCommRing [SeminormedCommRing R] [SubringClass S R] (s : S) :
    SeminormedCommRing s :=
  fast_instance% SeminormedCommRing.induced s R (subtype s)

instance (priority := 75) toNormedCommRing [NormedCommRing R] [SubringClass S R] (s : S) :
    NormedCommRing s :=
  fast_instance% NormedCommRing.induced s R (subtype s) Subtype.val_injective

instance (priority := 75) toNormOneClass [SeminormedRing R] [NormOneClass R]
    [SubringClass S R] (s : S) :
    NormOneClass s :=
  .induced s R <| subtype _

instance (priority := 75) toNormMulClass [SeminormedRing R] [NormMulClass R]
    [SubringClass S R] (s : S) :
    NormMulClass s :=
  .induced s R <| subtype _

end SubringClass

namespace AbsoluteValue

/-- A real absolute value on a ring determines a `NormedRing` structure. -/
@[instance_reducible]
noncomputable def toNormedRing {R : Type*} [Ring R] (v : AbsoluteValue R ℝ) : NormedRing R where
  norm := v
  dist x y := v (-x + y)
  dist_eq _ _ := rfl
  dist_self x := by simp
  dist_comm x y := by rw [add_comm (-x), add_comm (-y), ← sub_eq_add_neg, v.map_sub, sub_eq_add_neg]
  dist_triangle x y z := by simpa [neg_add_eq_sub, add_comm (v (y - x))] using v.sub_le z y x
  edist_dist x y := rfl
  norm_mul_le x y := (v.map_mul x y).le
  eq_of_dist_eq_zero := by
    intro x y hxy
    rw [add_comm, ← sub_eq_add_neg, AbsoluteValue.map_sub_eq_zero_iff] at hxy
    exact hxy.symm

end AbsoluteValue

namespace Real

/-
Note: We cannot easily generalize this to targets other than `ℝ`, because we need
the fact that `⨆ i, f i = 0` when the indexing type is empty (`Real.iSup_of_isEmpty`).
-/


section mul

variable {R ι ι' : Type*} [Semiring R] [Finite ι] [Finite ι']

lemma iSup_fun_mul_eq_iSup_mul_iSup_of_nonneg {F : Type*} [FunLike F R ℝ]
    [NonnegHomClass F R ℝ] [MulHomClass F R ℝ] (v : F) (x : ι → R) (y : ι' → R) :
    ⨆ a : ι × ι', v (x a.1 * y a.2) = (⨆ i, v (x i)) * ⨆ j, v (y j) := by
  simp_rw [Real.iSup_mul_of_nonneg (iSup_nonneg fun i ↦ apply_nonneg v (y i)),
    Real.mul_iSup_of_nonneg (apply_nonneg v _), map_mul, Finite.ciSup_prod]

end mul

/-
Note: We cannot easily generalize this to targets other than `ℝ`, because we need
the fact that `⨆ i, f i = 0` when the indexing type is empty (`Real.iSup_of_isEmpty`).
-/


section prod

universe u v

variable {α R : Type*} [Fintype α] {ι : α → Type u} [∀ a, Finite (ι a)]

lemma iSup_prod_eq_prod_iSup_of_nonneg {f : (a : α) → ι a → ℝ} (hf₀ : ∀ a i, 0 ≤ f a i) :
    ⨆ (i : (a : α) → ι a), ∏ a, f a (i a) = ∏ a, ⨆ i, f a i := by
  rcases isEmpty_or_nonempty ((a : α) → ι a) with h | h
  · rw [iSup_of_isEmpty, eq_comm, Finset.prod_eq_zero_iff]
    obtain ⟨a, ha⟩ := isEmpty_pi.mp h
    exact ⟨a, by simp⟩
  refine le_antisymm ?_ ?_
  · exact ciSup_le fun i ↦ Finset.prod_le_prod₀ (by simp [hf₀])
      fun a ha ↦ Finite.le_ciSup_of_le _ le_rfl
  · rw [Classical.nonempty_pi] at h
    have H a : ∃ i : ι a, f a i = ⨆ i, f a i := exists_eq_ciSup_of_finite
    choose i hi using H
    simp only [← hi]
    exact Finite.le_ciSup_of_le i le_rfl

lemma iSup_prod_eq_prod_iSup_of_nonnegHomClass {F : Type*} [FunLike F R ℝ]
    [NonnegHomClass F R ℝ] (v : F) {x : (a : α) → ι a → R} :
    ⨆ (i : (a : α) → ι a), ∏ a, v (x a (i a)) = ∏ a, ⨆ i, v (x a i) :=
  Real.iSup_prod_eq_prod_iSup_of_nonneg (f := fun a i ↦ v (x a i)) (fun _ _ ↦ apply_nonneg v _)

end prod

end Real

section IsUnital

attribute [local instance] IsUnital.toMulOneClass in
/-- A unital non-unital seminormed ring is a seminormed ring.

This constructor is primarily intended to be used within proofs since it creates bad definitional
equalities. -/

noncomputable abbrev IsUnital.toSeminormedRing {A : Type*} [NonUnitalSeminormedRing A]
    [IsUnital A] : SeminormedRing A where
  __ := ‹NonUnitalSeminormedRing A›
  __ := toSemiring

attribute [local instance] IsUnital.toSeminormedRing in
/-- A unital non-unital seminormed commutative ring is a seminormed commutative ring.

This constructor is primarily intended to be used within proofs since it creates bad definitional
equalities. -/

noncomputable abbrev IsUnital.toSeminormedCommRing {A : Type*} [NonUnitalSeminormedCommRing A]
    [IsUnital A] : SeminormedCommRing A where

attribute [local instance] IsUnital.toMulOneClass in
/-- A unital non-unital normed ring is a normed ring.

This constructor is primarily intended to be used within proofs since it creates bad definitional
equalities. -/

noncomputable abbrev IsUnital.toNormedRing {A : Type*} [NonUnitalNormedRing A] [IsUnital A] :
    NormedRing A where
  __ := ‹NonUnitalNormedRing A›
  __ := toSemiring

attribute [local instance] IsUnital.toNormedRing in
/-- A unital non-unital normed commutative ring is a normed commutative ring.

This constructor is primarily intended to be used within proofs since it creates bad definitional
equalities. -/

noncomputable abbrev IsUnital.toNormedCommRing {A : Type*} [NonUnitalNormedCommRing A]
    [IsUnital A] : NormedCommRing A where

end IsUnital

Messung
CHZG
9110010096

¤ Dauer der Verarbeitung: 0.31 Sekunden  ¤

*© Formatika GbR, Deutschland







                                                                                                                                                                                                                                                                                                                                                                                                     

 

Neuigkeiten

Aktuelles
Motto des Tages

Open Source Software


Gedichte
Musik
Bilder

Jenseits des Üblichen

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1,188,158
#Domains=932,831