Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Mathlib/Algebra/Field/Defs.lean
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module

public import Mathlib.Algebra.Ring.Defs
public import Mathlib.Data.Rat.Init
public import Mathlib.Tactic.FastInstance

/-!
# Division (semi)rings and (semi)fields
Expand Down Expand Up @@ -180,7 +181,8 @@ If the field has positive characteristic `p`, our division by zero convention fo
class Field (K : Type u) extends CommRing K, DivisionRing K

-- see Note [lower instance priority]
instance (priority := 100) Field.toSemifield [Field K] : Semifield K := { ‹Field K› with }
instance (priority := 100) Field.toSemifield [Field K] : Semifield K :=
fast_instance% { ‹Field K› with }

namespace NNRat
variable [DivisionSemiring K]
Expand Down
7 changes: 7 additions & 0 deletions Mathlib/Algebra/Ring/Defs.lean
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ class Semiring (α : Type u) extends NonUnitalSemiring α, NonAssocSemiring α,
/-- A `Ring` is a `Semiring` with negation making it an additive group. -/
class Ring (R : Type u) extends Semiring R, AddCommGroup R, AddGroupWithOne R
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might have better luck with

Suggested change
class Ring (R : Type u) extends Semiring R, AddCommGroup R, AddGroupWithOne R
class Ring (R : Type u) extends Semiring R, AddCommGroupWithOne R

and removing your other changes in this file.


attribute [-instance] Ring.toAddGroupWithOne
Copy link
Copy Markdown
Member

@eric-wieser eric-wieser Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only disables it for this file / section, it doesn't propagate to downstream files.


instance Ring.toAddGroupWithOne' (R : Type u) [Ring R] : AddGroupWithOne R :=
@AddGroupWithOne.mk R Ring.toIntCast inferInstance inferInstance
inferInstance Ring.sub_eq_add_neg Ring.zsmul Ring.zsmul_zero' Ring.zsmul_succ'
Ring.zsmul_neg' Ring.neg_add_cancel intCast_ofNat intCast_negSucc

/-!
### Semirings
-/
Expand Down
9 changes: 5 additions & 4 deletions Mathlib/Analysis/RCLike/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -674,10 +674,6 @@ variable (K) in
lemma nnnorm_nnqsmul (q : ℚ≥0) (x : E) : ‖q • x‖₊ = q • ‖x‖₊ := by
simpa [NNRat.cast_smul_eq_nnqsmul] using nnnorm_smul (q : K) x

@[bound]
lemma norm_expect_le {ι : Type*} {s : Finset ι} {f : ι → E} : ‖𝔼 i ∈ s, f i‖ ≤ 𝔼 i ∈ s, ‖f i‖ :=
Finset.le_expect_of_subadditive norm_zero norm_add_le fun _ _ ↦ by rw [norm_nnqsmul K]

end NormedField

theorem mul_self_norm (z : K) : ‖z‖ * ‖z‖ = normSq z := by rw [normSq_eq_def', sq]
Expand Down Expand Up @@ -788,6 +784,11 @@ end Instances

namespace RCLike

@[bound]
lemma norm_expect_le {K : Type*} {E : Type*} [RCLike K] [NormedField E] [CharZero E]
[NormedSpace K E] {ι : Type u_3} {s : Finset ι} {f : ι → E} : ‖𝔼 i ∈ s, f i‖ ≤ 𝔼 i ∈ s, ‖f i‖ :=
Finset.le_expect_of_subadditive norm_zero norm_add_le fun _ _ ↦ by rw [norm_nnqsmul K]

section Order

open scoped ComplexOrder
Expand Down
Loading