algebra.star.orderMathlib.Algebra.Star.Order

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -93,7 +93,7 @@ and obviates the hassle of `add_submonoid.closure_induction` when creating those
 If you are working with a `non_unital_ring` and not a `non_unital_semiring`, see
 `star_ordered_ring.of_nonneg_iff` for a more convenient version. -/
 @[reducible]
-def ofLEIff [NonUnitalSemiring R] [PartialOrder R] [StarRing R]
+def of_le_iff [NonUnitalSemiring R] [PartialOrder R] [StarRing R]
     (h_add : ∀ {x y : R}, x ≤ y → ∀ z, z + x ≤ z + y)
     (h_le_iff : ∀ x y : R, x ≤ y ↔ ∃ s, y = x + star s * s) : StarOrderedRing R :=
   { ‹StarRing R› with
@@ -112,15 +112,15 @@ def ofLEIff [NonUnitalSemiring R] [PartialOrder R] [StarRing R]
         · rintro a b ha hb x y rfl
           nth_rw 1 [← add_zero x]
           refine' h_add ((ha 0 _ (zero_add a).symm).trans (hb a _ rfl)) x }
-#align star_ordered_ring.of_le_iff StarOrderedRing.ofLEIffₓ
+#align star_ordered_ring.of_le_iff StarOrderedRing.of_le_iffₓ
 
-#print StarOrderedRing.ofNonnegIff /-
+#print StarOrderedRing.of_nonneg_iff /-
 -- set note [reducible non-instances]
 /-- When `R` is a non-unital ring, to construct a `star_ordered_ring` instance it suffices to
 show that the nonnegative elements are precisely those elements in the `add_submonoid` generated
 by `star s * s` for `s : R`. -/
 @[reducible]
-def ofNonnegIff [NonUnitalRing R] [PartialOrder R] [StarRing R]
+def of_nonneg_iff [NonUnitalRing R] [PartialOrder R] [StarRing R]
     (h_add : ∀ {x y : R}, x ≤ y → ∀ z, z + x ≤ z + y)
     (h_nonneg_iff : ∀ x : R, 0 ≤ x ↔ x ∈ AddSubmonoid.closure (Set.range fun s : R => star s * s)) :
     StarOrderedRing R :=
@@ -130,10 +130,10 @@ def ofNonnegIff [NonUnitalRing R] [PartialOrder R] [StarRing R]
       by
       haveI : CovariantClass R R (· + ·) (· ≤ ·) := ⟨fun _ _ _ h => h_add h _⟩
       simpa only [← sub_eq_iff_eq_add', sub_nonneg, exists_eq_right'] using h_nonneg_iff (y - x) }
-#align star_ordered_ring.of_nonneg_iff StarOrderedRing.ofNonnegIff
+#align star_ordered_ring.of_nonneg_iff StarOrderedRing.of_nonneg_iff
 -/
 
-#print StarOrderedRing.ofNonnegIff' /-
+#print StarOrderedRing.of_nonneg_iff' /-
 -- set note [reducible non-instances]
 /-- When `R` is a non-unital ring, to construct a `star_ordered_ring` instance it suffices to
 show that the nonnegative elements are precisely those elements of the form `star s * s`
@@ -143,14 +143,14 @@ This is provided for convenience because it holds in many common scenarios (e.g.
 any C⋆-algebra), and obviates the hassle of `add_submonoid.closure_induction` when creating those
 instances. -/
 @[reducible]
-def ofNonnegIff' [NonUnitalRing R] [PartialOrder R] [StarRing R]
+def of_nonneg_iff' [NonUnitalRing R] [PartialOrder R] [StarRing R]
     (h_add : ∀ {x y : R}, x ≤ y → ∀ z, z + x ≤ z + y)
     (h_nonneg_iff : ∀ x : R, 0 ≤ x ↔ ∃ s, x = star s * s) : StarOrderedRing R :=
-  ofLEIff (@h_add)
+  of_le_iff (@h_add)
     (by
       haveI : CovariantClass R R (· + ·) (· ≤ ·) := ⟨fun _ _ _ h => h_add h _⟩
       simpa [sub_eq_iff_eq_add', sub_nonneg] using fun x y => h_nonneg_iff (y - x))
-#align star_ordered_ring.of_nonneg_iff' StarOrderedRing.ofNonnegIff'
+#align star_ordered_ring.of_nonneg_iff' StarOrderedRing.of_nonneg_iff'
 -/
 
 #print StarOrderedRing.nonneg_iff /-
Diff
@@ -181,7 +181,7 @@ theorem mul_star_self_nonneg (r : R) : 0 ≤ r * star r := by nth_rw_rhs 1 [←
 #print conjugate_nonneg /-
 theorem conjugate_nonneg {a : R} (ha : 0 ≤ a) (c : R) : 0 ≤ star c * a * c :=
   by
-  rw [StarOrderedRing.nonneg_iff] at ha 
+  rw [StarOrderedRing.nonneg_iff] at ha
   refine'
     AddSubmonoid.closure_induction ha (fun x hx => _)
       (by rw [MulZeroClass.mul_zero, MulZeroClass.zero_mul]) fun x y hx hy => _
Diff
@@ -172,10 +172,10 @@ theorem star_mul_self_nonneg (r : R) : 0 ≤ star r * r :=
 #align star_mul_self_nonneg star_mul_self_nonneg
 -/
 
-#print star_mul_self_nonneg' /-
-theorem star_mul_self_nonneg' (r : R) : 0 ≤ r * star r := by nth_rw_rhs 1 [← star_star r];
+#print mul_star_self_nonneg /-
+theorem mul_star_self_nonneg (r : R) : 0 ≤ r * star r := by nth_rw_rhs 1 [← star_star r];
   exact star_mul_self_nonneg (star r)
-#align star_mul_self_nonneg' star_mul_self_nonneg'
+#align star_mul_self_nonneg' mul_star_self_nonneg
 -/
 
 #print conjugate_nonneg /-
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2023 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison
 -/
-import Mathbin.Algebra.Star.Basic
-import Mathbin.GroupTheory.Submonoid.Basic
+import Algebra.Star.Basic
+import GroupTheory.Submonoid.Basic
 
 #align_import algebra.star.order from "leanprover-community/mathlib"@"6b31d1eebd64eab86d5bd9936bfaada6ca8b5842"
 
Diff
@@ -93,7 +93,7 @@ and obviates the hassle of `add_submonoid.closure_induction` when creating those
 If you are working with a `non_unital_ring` and not a `non_unital_semiring`, see
 `star_ordered_ring.of_nonneg_iff` for a more convenient version. -/
 @[reducible]
-def ofLeIff [NonUnitalSemiring R] [PartialOrder R] [StarRing R]
+def ofLEIff [NonUnitalSemiring R] [PartialOrder R] [StarRing R]
     (h_add : ∀ {x y : R}, x ≤ y → ∀ z, z + x ≤ z + y)
     (h_le_iff : ∀ x y : R, x ≤ y ↔ ∃ s, y = x + star s * s) : StarOrderedRing R :=
   { ‹StarRing R› with
@@ -112,7 +112,7 @@ def ofLeIff [NonUnitalSemiring R] [PartialOrder R] [StarRing R]
         · rintro a b ha hb x y rfl
           nth_rw 1 [← add_zero x]
           refine' h_add ((ha 0 _ (zero_add a).symm).trans (hb a _ rfl)) x }
-#align star_ordered_ring.of_le_iff StarOrderedRing.ofLeIffₓ
+#align star_ordered_ring.of_le_iff StarOrderedRing.ofLEIffₓ
 
 #print StarOrderedRing.ofNonnegIff /-
 -- set note [reducible non-instances]
@@ -146,7 +146,7 @@ instances. -/
 def ofNonnegIff' [NonUnitalRing R] [PartialOrder R] [StarRing R]
     (h_add : ∀ {x y : R}, x ≤ y → ∀ z, z + x ≤ z + y)
     (h_nonneg_iff : ∀ x : R, 0 ≤ x ↔ ∃ s, x = star s * s) : StarOrderedRing R :=
-  ofLeIff (@h_add)
+  ofLEIff (@h_add)
     (by
       haveI : CovariantClass R R (· + ·) (· ≤ ·) := ⟨fun _ _ _ h => h_add h _⟩
       simpa [sub_eq_iff_eq_add', sub_nonneg] using fun x y => h_nonneg_iff (y - x))
Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2023 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison
-
-! This file was ported from Lean 3 source module algebra.star.order
-! leanprover-community/mathlib commit 6b31d1eebd64eab86d5bd9936bfaada6ca8b5842
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Algebra.Star.Basic
 import Mathbin.GroupTheory.Submonoid.Basic
 
+#align_import algebra.star.order from "leanprover-community/mathlib"@"6b31d1eebd64eab86d5bd9936bfaada6ca8b5842"
+
 /-! # Star ordered rings
 
 > THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
Diff
@@ -86,7 +86,6 @@ instance (priority := 100) toOrderedAddCommGroup [NonUnitalRing R] [PartialOrder
 #align star_ordered_ring.to_ordered_add_comm_group StarOrderedRing.toOrderedAddCommGroup
 -/
 
-#print StarOrderedRing.ofLeIff /-
 -- set note [reducible non-instances]
 /-- To construct a `star_ordered_ring` instance it suffices to show that `x ≤ y` if and only if
 `y = x + star s * s` for some `s : R`.
@@ -116,8 +115,7 @@ def ofLeIff [NonUnitalSemiring R] [PartialOrder R] [StarRing R]
         · rintro a b ha hb x y rfl
           nth_rw 1 [← add_zero x]
           refine' h_add ((ha 0 _ (zero_add a).symm).trans (hb a _ rfl)) x }
-#align star_ordered_ring.of_le_iff StarOrderedRing.ofLeIff
--/
+#align star_ordered_ring.of_le_iff StarOrderedRing.ofLeIffₓ
 
 #print StarOrderedRing.ofNonnegIff /-
 -- set note [reducible non-instances]
Diff
@@ -67,6 +67,7 @@ instance (priority := 100) toOrderedAddCommMonoid [NonUnitalSemiring R] [Partial
 #align star_ordered_ring.to_ordered_add_comm_monoid StarOrderedRing.toOrderedAddCommMonoid
 -/
 
+#print StarOrderedRing.toExistsAddOfLE /-
 -- see note [lower instance priority]
 instance (priority := 100) toExistsAddOfLE [NonUnitalSemiring R] [PartialOrder R]
     [StarOrderedRing R] : ExistsAddOfLE R
@@ -74,6 +75,7 @@ instance (priority := 100) toExistsAddOfLE [NonUnitalSemiring R] [PartialOrder R
     match (le_iff _ _).mp h with
     | ⟨p, _, hp⟩ => ⟨p, hp⟩
 #align star_ordered_ring.to_has_exists_add_of_le StarOrderedRing.toExistsAddOfLE
+-/
 
 #print StarOrderedRing.toOrderedAddCommGroup /-
 -- see note [lower instance priority]
@@ -84,6 +86,7 @@ instance (priority := 100) toOrderedAddCommGroup [NonUnitalRing R] [PartialOrder
 #align star_ordered_ring.to_ordered_add_comm_group StarOrderedRing.toOrderedAddCommGroup
 -/
 
+#print StarOrderedRing.ofLeIff /-
 -- set note [reducible non-instances]
 /-- To construct a `star_ordered_ring` instance it suffices to show that `x ≤ y` if and only if
 `y = x + star s * s` for some `s : R`.
@@ -114,7 +117,9 @@ def ofLeIff [NonUnitalSemiring R] [PartialOrder R] [StarRing R]
           nth_rw 1 [← add_zero x]
           refine' h_add ((ha 0 _ (zero_add a).symm).trans (hb a _ rfl)) x }
 #align star_ordered_ring.of_le_iff StarOrderedRing.ofLeIff
+-/
 
+#print StarOrderedRing.ofNonnegIff /-
 -- set note [reducible non-instances]
 /-- When `R` is a non-unital ring, to construct a `star_ordered_ring` instance it suffices to
 show that the nonnegative elements are precisely those elements in the `add_submonoid` generated
@@ -131,7 +136,9 @@ def ofNonnegIff [NonUnitalRing R] [PartialOrder R] [StarRing R]
       haveI : CovariantClass R R (· + ·) (· ≤ ·) := ⟨fun _ _ _ h => h_add h _⟩
       simpa only [← sub_eq_iff_eq_add', sub_nonneg, exists_eq_right'] using h_nonneg_iff (y - x) }
 #align star_ordered_ring.of_nonneg_iff StarOrderedRing.ofNonnegIff
+-/
 
+#print StarOrderedRing.ofNonnegIff' /-
 -- set note [reducible non-instances]
 /-- When `R` is a non-unital ring, to construct a `star_ordered_ring` instance it suffices to
 show that the nonnegative elements are precisely those elements of the form `star s * s`
@@ -149,11 +156,14 @@ def ofNonnegIff' [NonUnitalRing R] [PartialOrder R] [StarRing R]
       haveI : CovariantClass R R (· + ·) (· ≤ ·) := ⟨fun _ _ _ h => h_add h _⟩
       simpa [sub_eq_iff_eq_add', sub_nonneg] using fun x y => h_nonneg_iff (y - x))
 #align star_ordered_ring.of_nonneg_iff' StarOrderedRing.ofNonnegIff'
+-/
 
+#print StarOrderedRing.nonneg_iff /-
 theorem nonneg_iff [NonUnitalSemiring R] [PartialOrder R] [StarOrderedRing R] {x : R} :
     0 ≤ x ↔ x ∈ AddSubmonoid.closure (Set.range fun s : R => star s * s) := by
   simp only [le_iff, zero_add, exists_eq_right']
 #align star_ordered_ring.nonneg_iff StarOrderedRing.nonneg_iff
+-/
 
 end StarOrderedRing
 
@@ -161,14 +171,19 @@ section NonUnitalSemiring
 
 variable [NonUnitalSemiring R] [PartialOrder R] [StarOrderedRing R]
 
+#print star_mul_self_nonneg /-
 theorem star_mul_self_nonneg (r : R) : 0 ≤ star r * r :=
   StarOrderedRing.nonneg_iff.mpr <| AddSubmonoid.subset_closure ⟨r, rfl⟩
 #align star_mul_self_nonneg star_mul_self_nonneg
+-/
 
+#print star_mul_self_nonneg' /-
 theorem star_mul_self_nonneg' (r : R) : 0 ≤ r * star r := by nth_rw_rhs 1 [← star_star r];
   exact star_mul_self_nonneg (star r)
 #align star_mul_self_nonneg' star_mul_self_nonneg'
+-/
 
+#print conjugate_nonneg /-
 theorem conjugate_nonneg {a : R} (ha : 0 ≤ a) (c : R) : 0 ≤ star c * a * c :=
   by
   rw [StarOrderedRing.nonneg_iff] at ha 
@@ -184,11 +199,15 @@ theorem conjugate_nonneg {a : R} (ha : 0 ≤ a) (c : R) : 0 ≤ star c * a * c :
       _ ≤ star c * x * c + star c * y * c := (StarOrderedRing.add_le_add_left _ _ hy _)
       _ ≤ _ := by rw [mul_add, add_mul]
 #align conjugate_nonneg conjugate_nonneg
+-/
 
+#print conjugate_nonneg' /-
 theorem conjugate_nonneg' {a : R} (ha : 0 ≤ a) (c : R) : 0 ≤ c * a * star c := by
   simpa only [star_star] using conjugate_nonneg ha (star c)
 #align conjugate_nonneg' conjugate_nonneg'
+-/
 
+#print conjugate_le_conjugate /-
 theorem conjugate_le_conjugate {a b : R} (hab : a ≤ b) (c : R) : star c * a * c ≤ star c * b * c :=
   by
   rw [StarOrderedRing.le_iff] at hab ⊢
@@ -196,10 +215,13 @@ theorem conjugate_le_conjugate {a b : R} (hab : a ≤ b) (c : R) : star c * a *
   simp_rw [← StarOrderedRing.nonneg_iff] at hp ⊢
   exact ⟨star c * p * c, conjugate_nonneg hp c, by simp only [add_mul, mul_add]⟩
 #align conjugate_le_conjugate conjugate_le_conjugate
+-/
 
+#print conjugate_le_conjugate' /-
 theorem conjugate_le_conjugate' {a b : R} (hab : a ≤ b) (c : R) : c * a * star c ≤ c * b * star c :=
   by simpa only [star_star] using conjugate_le_conjugate hab (star c)
 #align conjugate_le_conjugate' conjugate_le_conjugate'
+-/
 
 end NonUnitalSemiring
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison
 
 ! This file was ported from Lean 3 source module algebra.star.order
-! leanprover-community/mathlib commit 31c24aa72e7b3e5ed97a8412470e904f82b81004
+! leanprover-community/mathlib commit 6b31d1eebd64eab86d5bd9936bfaada6ca8b5842
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -13,6 +13,9 @@ import Mathbin.GroupTheory.Submonoid.Basic
 
 /-! # Star ordered rings
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 We define the class `star_ordered_ring R`, which says that the order on `R` respects the
 star operation, i.e. an element `r` is nonnegative iff it is in the `add_submonoid` generated by
 elements of the form `star s * s`. In many cases, including all C⋆-algebras, this can be reduced to
Diff
@@ -180,7 +180,6 @@ theorem conjugate_nonneg {a : R} (ha : 0 ≤ a) (c : R) : 0 ≤ star c * a * c :
       0 ≤ star c * x * c + 0 := by rw [add_zero] <;> exact hx
       _ ≤ star c * x * c + star c * y * c := (StarOrderedRing.add_le_add_left _ _ hy _)
       _ ≤ _ := by rw [mul_add, add_mul]
-      
 #align conjugate_nonneg conjugate_nonneg
 
 theorem conjugate_nonneg' {a : R} (ha : 0 ≤ a) (c : R) : 0 ≤ c * a * star c := by
Diff
@@ -55,27 +55,31 @@ class StarOrderedRing (R : Type u) [NonUnitalSemiring R] [PartialOrder R] extend
 
 namespace StarOrderedRing
 
+#print StarOrderedRing.toOrderedAddCommMonoid /-
 -- see note [lower instance priority]
 instance (priority := 100) toOrderedAddCommMonoid [NonUnitalSemiring R] [PartialOrder R]
     [StarOrderedRing R] : OrderedAddCommMonoid R :=
   { show NonUnitalSemiring R by infer_instance, show PartialOrder R by infer_instance,
     show StarOrderedRing R by infer_instance with }
 #align star_ordered_ring.to_ordered_add_comm_monoid StarOrderedRing.toOrderedAddCommMonoid
+-/
 
 -- see note [lower instance priority]
-instance (priority := 100) to_existsAddOfLE [NonUnitalSemiring R] [PartialOrder R]
+instance (priority := 100) toExistsAddOfLE [NonUnitalSemiring R] [PartialOrder R]
     [StarOrderedRing R] : ExistsAddOfLE R
     where exists_add_of_le a b h :=
     match (le_iff _ _).mp h with
     | ⟨p, _, hp⟩ => ⟨p, hp⟩
-#align star_ordered_ring.to_has_exists_add_of_le StarOrderedRing.to_existsAddOfLE
+#align star_ordered_ring.to_has_exists_add_of_le StarOrderedRing.toExistsAddOfLE
 
+#print StarOrderedRing.toOrderedAddCommGroup /-
 -- see note [lower instance priority]
 instance (priority := 100) toOrderedAddCommGroup [NonUnitalRing R] [PartialOrder R]
     [StarOrderedRing R] : OrderedAddCommGroup R :=
   { show NonUnitalRing R by infer_instance, show PartialOrder R by infer_instance,
     show StarOrderedRing R by infer_instance with }
 #align star_ordered_ring.to_ordered_add_comm_group StarOrderedRing.toOrderedAddCommGroup
+-/
 
 -- set note [reducible non-instances]
 /-- To construct a `star_ordered_ring` instance it suffices to show that `x ≤ y` if and only if

Changes in mathlib4

mathlib3
mathlib4
chore: rename StarOrderedRing convenience constructors (#12089)

StarOrderedRing was recently turned into a Prop mixin. This renames the convenience constructors to adhere to the naming convention for theorems vs. defs.

Diff
@@ -20,7 +20,7 @@ literature (see the seminal paper [*The positive cone in Banach algebras*][kelle
 In order to accommodate `NonUnitalSemiring R`, we actually don't characterize nonnegativity, but
 rather the entire `≤` relation with `StarOrderedRing.le_iff`. However, notice that when `R` is a
 `NonUnitalRing`, these are equivalent (see `StarOrderedRing.nonneg_iff` and
-`StarOrderedRing.ofNonnegIff`).
+`StarOrderedRing.of_nonneg_iff`).
 
 It is important to note that while a `StarOrderedRing` is an `OrderedAddCommMonoid` it is often
 *not* an `OrderedSemiring`.
@@ -45,7 +45,7 @@ variable {R : Type u}
 constitute precisely the `AddSubmonoid` generated by elements of the form `star s * s`.
 
 If you are working with a `NonUnitalRing` and not a `NonUnitalSemiring`, it may be more
-convenient to declare instances using `StarOrderedRing.ofNonnegIff'`.
+convenient to declare instances using `StarOrderedRing.of_nonneg_iff`.
 
 Porting note: dropped an unneeded assumption
 `add_le_add_left : ∀ {x y}, x ≤ y → ∀ z, z + x ≤ z + y` -/
@@ -89,9 +89,9 @@ This is provided for convenience because it holds in some common scenarios (e.g.
 and obviates the hassle of `AddSubmonoid.closure_induction` when creating those instances.
 
 If you are working with a `NonUnitalRing` and not a `NonUnitalSemiring`, see
-`StarOrderedRing.ofNonnegIff` for a more convenient version.
+`StarOrderedRing.of_nonneg_iff` for a more convenient version.
  -/
-lemma ofLEIff [NonUnitalSemiring R] [PartialOrder R] [StarRing R]
+lemma of_le_iff [NonUnitalSemiring R] [PartialOrder R] [StarRing R]
     (h_le_iff : ∀ x y : R, x ≤ y ↔ ∃ s, y = x + star s * s) : StarOrderedRing R where
   le_iff x y := by
     refine' ⟨fun h => _, _⟩
@@ -105,19 +105,19 @@ lemma ofLEIff [NonUnitalSemiring R] [PartialOrder R] [StarRing R]
       · rintro a b ha hb x y rfl
         rw [← add_assoc]
         exact (ha _ _ rfl).trans (hb _ _ rfl)
-#align star_ordered_ring.of_le_iff StarOrderedRing.ofLEIffₓ
+#align star_ordered_ring.of_le_iff StarOrderedRing.of_le_iffₓ
 
 /-- When `R` is a non-unital ring, to construct a `StarOrderedRing` instance it suffices to
 show that the nonnegative elements are precisely those elements in the `AddSubmonoid` generated
 by `star s * s` for `s : R`. -/
-lemma ofNonnegIff [NonUnitalRing R] [PartialOrder R] [StarRing R]
+lemma of_nonneg_iff [NonUnitalRing R] [PartialOrder R] [StarRing R]
     (h_add : ∀ {x y : R}, x ≤ y → ∀ z, z + x ≤ z + y)
     (h_nonneg_iff : ∀ x : R, 0 ≤ x ↔ x ∈ AddSubmonoid.closure (Set.range fun s : R => star s * s)) :
     StarOrderedRing R where
   le_iff x y := by
     haveI : CovariantClass R R (· + ·) (· ≤ ·) := ⟨fun _ _ _ h => h_add h _⟩
     simpa only [← sub_eq_iff_eq_add', sub_nonneg, exists_eq_right'] using h_nonneg_iff (y - x)
-#align star_ordered_ring.of_nonneg_iff StarOrderedRing.ofNonnegIff
+#align star_ordered_ring.of_nonneg_iff StarOrderedRing.of_nonneg_iff
 
 /-- When `R` is a non-unital ring, to construct a `StarOrderedRing` instance it suffices to
 show that the nonnegative elements are precisely those elements of the form `star s * s`
@@ -126,13 +126,13 @@ for `s : R`.
 This is provided for convenience because it holds in many common scenarios (e.g.,`ℝ`, `ℂ`, or
 any C⋆-algebra), and obviates the hassle of `AddSubmonoid.closure_induction` when creating those
 instances. -/
-lemma ofNonnegIff' [NonUnitalRing R] [PartialOrder R] [StarRing R]
+lemma of_nonneg_iff' [NonUnitalRing R] [PartialOrder R] [StarRing R]
     (h_add : ∀ {x y : R}, x ≤ y → ∀ z, z + x ≤ z + y)
     (h_nonneg_iff : ∀ x : R, 0 ≤ x ↔ ∃ s, x = star s * s) : StarOrderedRing R :=
-  ofLEIff <| by
+  of_le_iff <| by
     haveI : CovariantClass R R (· + ·) (· ≤ ·) := ⟨fun _ _ _ h => h_add h _⟩
     simpa [sub_eq_iff_eq_add', sub_nonneg] using fun x y => h_nonneg_iff (y - x)
-#align star_ordered_ring.of_nonneg_iff' StarOrderedRing.ofNonnegIff'
+#align star_ordered_ring.of_nonneg_iff' StarOrderedRing.of_nonneg_iff'
 
 theorem nonneg_iff [NonUnitalSemiring R] [PartialOrder R] [StarRing R] [StarOrderedRing R] {x : R} :
     0 ≤ x ↔ x ∈ AddSubmonoid.closure (Set.range fun s : R => star s * s) := by
feat: make StarOrderedRing a mixin (#11872)

This makes StarOrderedRing take StarRing as a parameter instead of extending it, and as a result moves the typeclass to Prop. It was already a mixin with respect to the order and algebraic structure. There are two primary motivations:

  1. This makes it possible to directly assume that C(α, R) is a StarOrderedRing with [StarOrderedRing C(α, R)], as currently there is no typeclass on R which would naturally guarantee this property. This is relevant as we want this type class on continuous functions for the continuous functional calculus.
  2. We will eventually want a StarOrderedRing instance on C(α, A) where A is a complex (or even real) C⋆-algebra, and making this a mixin avoids loops with StarRing.
Diff
@@ -49,7 +49,7 @@ convenient to declare instances using `StarOrderedRing.ofNonnegIff'`.
 
 Porting note: dropped an unneeded assumption
 `add_le_add_left : ∀ {x y}, x ≤ y → ∀ z, z + x ≤ z + y` -/
-class StarOrderedRing (R : Type u) [NonUnitalSemiring R] [PartialOrder R] extends StarRing R where
+class StarOrderedRing (R : Type u) [NonUnitalSemiring R] [PartialOrder R] [StarRing R] : Prop where
   /-- characterization of the order in terms of the `StarRing` structure. -/
   le_iff :
     ∀ x y : R, x ≤ y ↔ ∃ p, p ∈ AddSubmonoid.closure (Set.range fun s => star s * s) ∧ y = x + p
@@ -59,7 +59,7 @@ namespace StarOrderedRing
 
 -- see note [lower instance priority]
 instance (priority := 100) toOrderedAddCommMonoid [NonUnitalSemiring R] [PartialOrder R]
-    [StarOrderedRing R] : OrderedAddCommMonoid R where
+    [StarRing R] [StarOrderedRing R] : OrderedAddCommMonoid R where
   add_le_add_left := fun x y hle z ↦ by
     rw [StarOrderedRing.le_iff] at hle ⊢
     refine hle.imp fun s hs ↦ ?_
@@ -69,7 +69,7 @@ instance (priority := 100) toOrderedAddCommMonoid [NonUnitalSemiring R] [Partial
 
 -- see note [lower instance priority]
 instance (priority := 100) toExistsAddOfLE [NonUnitalSemiring R] [PartialOrder R]
-    [StarOrderedRing R] : ExistsAddOfLE R where
+    [StarRing R] [StarOrderedRing R] : ExistsAddOfLE R where
   exists_add_of_le h :=
     match (le_iff _ _).mp h with
     | ⟨p, _, hp⟩ => ⟨p, hp⟩
@@ -77,12 +77,11 @@ instance (priority := 100) toExistsAddOfLE [NonUnitalSemiring R] [PartialOrder R
 
 -- see note [lower instance priority]
 instance (priority := 100) toOrderedAddCommGroup [NonUnitalRing R] [PartialOrder R]
-    [StarOrderedRing R] : OrderedAddCommGroup R where
+    [StarRing R] [StarOrderedRing R] : OrderedAddCommGroup R where
   add_le_add_left := @add_le_add_left _ _ _ _
 
 #align star_ordered_ring.to_ordered_add_comm_group StarOrderedRing.toOrderedAddCommGroup
 
--- set note [reducible non-instances]
 /-- To construct a `StarOrderedRing` instance it suffices to show that `x ≤ y` if and only if
 `y = x + star s * s` for some `s : R`.
 
@@ -92,8 +91,7 @@ and obviates the hassle of `AddSubmonoid.closure_induction` when creating those
 If you are working with a `NonUnitalRing` and not a `NonUnitalSemiring`, see
 `StarOrderedRing.ofNonnegIff` for a more convenient version.
  -/
-@[reducible]
-def ofLEIff [NonUnitalSemiring R] [PartialOrder R] [StarRing R]
+lemma ofLEIff [NonUnitalSemiring R] [PartialOrder R] [StarRing R]
     (h_le_iff : ∀ x y : R, x ≤ y ↔ ∃ s, y = x + star s * s) : StarOrderedRing R where
   le_iff x y := by
     refine' ⟨fun h => _, _⟩
@@ -109,12 +107,10 @@ def ofLEIff [NonUnitalSemiring R] [PartialOrder R] [StarRing R]
         exact (ha _ _ rfl).trans (hb _ _ rfl)
 #align star_ordered_ring.of_le_iff StarOrderedRing.ofLEIffₓ
 
--- set note [reducible non-instances]
 /-- When `R` is a non-unital ring, to construct a `StarOrderedRing` instance it suffices to
 show that the nonnegative elements are precisely those elements in the `AddSubmonoid` generated
 by `star s * s` for `s : R`. -/
-@[reducible]
-def ofNonnegIff [NonUnitalRing R] [PartialOrder R] [StarRing R]
+lemma ofNonnegIff [NonUnitalRing R] [PartialOrder R] [StarRing R]
     (h_add : ∀ {x y : R}, x ≤ y → ∀ z, z + x ≤ z + y)
     (h_nonneg_iff : ∀ x : R, 0 ≤ x ↔ x ∈ AddSubmonoid.closure (Set.range fun s : R => star s * s)) :
     StarOrderedRing R where
@@ -123,7 +119,6 @@ def ofNonnegIff [NonUnitalRing R] [PartialOrder R] [StarRing R]
     simpa only [← sub_eq_iff_eq_add', sub_nonneg, exists_eq_right'] using h_nonneg_iff (y - x)
 #align star_ordered_ring.of_nonneg_iff StarOrderedRing.ofNonnegIff
 
--- set note [reducible non-instances]
 /-- When `R` is a non-unital ring, to construct a `StarOrderedRing` instance it suffices to
 show that the nonnegative elements are precisely those elements of the form `star s * s`
 for `s : R`.
@@ -131,8 +126,7 @@ for `s : R`.
 This is provided for convenience because it holds in many common scenarios (e.g.,`ℝ`, `ℂ`, or
 any C⋆-algebra), and obviates the hassle of `AddSubmonoid.closure_induction` when creating those
 instances. -/
-@[reducible]
-def ofNonnegIff' [NonUnitalRing R] [PartialOrder R] [StarRing R]
+lemma ofNonnegIff' [NonUnitalRing R] [PartialOrder R] [StarRing R]
     (h_add : ∀ {x y : R}, x ≤ y → ∀ z, z + x ≤ z + y)
     (h_nonneg_iff : ∀ x : R, 0 ≤ x ↔ ∃ s, x = star s * s) : StarOrderedRing R :=
   ofLEIff <| by
@@ -140,7 +134,7 @@ def ofNonnegIff' [NonUnitalRing R] [PartialOrder R] [StarRing R]
     simpa [sub_eq_iff_eq_add', sub_nonneg] using fun x y => h_nonneg_iff (y - x)
 #align star_ordered_ring.of_nonneg_iff' StarOrderedRing.ofNonnegIff'
 
-theorem nonneg_iff [NonUnitalSemiring R] [PartialOrder R] [StarOrderedRing R] {x : R} :
+theorem nonneg_iff [NonUnitalSemiring R] [PartialOrder R] [StarRing R] [StarOrderedRing R] {x : R} :
     0 ≤ x ↔ x ∈ AddSubmonoid.closure (Set.range fun s : R => star s * s) := by
   simp only [le_iff, zero_add, exists_eq_right']
 #align star_ordered_ring.nonneg_iff StarOrderedRing.nonneg_iff
@@ -149,7 +143,7 @@ end StarOrderedRing
 
 section NonUnitalSemiring
 
-variable [NonUnitalSemiring R] [PartialOrder R] [StarOrderedRing R]
+variable [NonUnitalSemiring R] [PartialOrder R] [StarRing R] [StarOrderedRing R]
 
 theorem star_mul_self_nonneg (r : R) : 0 ≤ star r * r :=
   StarOrderedRing.nonneg_iff.mpr <| AddSubmonoid.subset_closure ⟨r, rfl⟩
@@ -241,7 +235,7 @@ lemma IsSelfAdjoint.of_nonneg {x : R} (hx : 0 ≤ x) : IsSelfAdjoint x :=
 end NonUnitalSemiring
 
 section Semiring
-variable [Semiring R] [PartialOrder R] [StarOrderedRing R]
+variable [Semiring R] [PartialOrder R] [StarRing R] [StarOrderedRing R]
 
 @[simp]
 lemma one_le_star_iff {x : R} : 1 ≤ star x ↔ 1 ≤ x := by
@@ -263,8 +257,8 @@ end Semiring
 
 section OrderClass
 
-variable {F R S : Type*} [NonUnitalSemiring R] [PartialOrder R] [StarOrderedRing R]
-variable [NonUnitalSemiring S] [PartialOrder S] [StarOrderedRing S]
+variable {F R S : Type*} [NonUnitalSemiring R] [PartialOrder R] [StarRing R] [StarOrderedRing R]
+variable [NonUnitalSemiring S] [PartialOrder S] [StarRing S] [StarOrderedRing S]
 
 -- we prove this auxiliary lemma in order to avoid duplicating the proof twice below.
 lemma NonUnitalRingHom.map_le_map_of_map_star (f : R →ₙ+* S) (hf : ∀ r, f (star r) = star (f r))
feat: , and ℚ≥0 are star-ordered rings (#10633)

Also golf the existing instance for and rename Rat.num_nonneg_iff_zero_le to Rat.num_nonneg, Rat.num_pos_iff_pos to Rat.num_pos.

From LeanAPAP

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison
 -/
 import Mathlib.Algebra.Star.SelfAdjoint
-import Mathlib.GroupTheory.Submonoid.Basic
+import Mathlib.GroupTheory.Submonoid.Operations
 
 #align_import algebra.star.order from "leanprover-community/mathlib"@"31c24aa72e7b3e5ed97a8412470e904f82b81004"
 
@@ -34,6 +34,9 @@ positive cone which is the _closure_ of the sums of elements `star r * r`. A wea
 the advantage of not requiring a topology.
 -/
 
+open Set
+open scoped NNRat
+
 universe u
 
 variable {R : Type u}
@@ -294,3 +297,11 @@ instance (priority := 100) StarRingHomClass.instOrderIsoClass [EquivLike F R S]
     exact f_inv.map_le_map_of_map_star f_inv_star h
 
 end OrderClass
+
+instance Nat.instStarOrderedRing : StarOrderedRing ℕ where
+  le_iff a b := by
+    have : AddSubmonoid.closure (range fun x : ℕ ↦ x * x) = ⊤ :=
+      eq_top_mono
+        (AddSubmonoid.closure_mono <| singleton_subset_iff.2 <| mem_range.2 ⟨1, one_mul _⟩)
+        Nat.addSubmonoid_closure_one
+    simp [this, le_iff_exists_add]
feat: between star ordered rings, star-preserving ring homomorphisms preserve order (#10563)
Diff
@@ -257,3 +257,40 @@ lemma star_lt_one_iff {x : R} : star x < 1 ↔ x < 1 := by
   simpa using star_lt_star_iff (x := x) (y := 1)
 
 end Semiring
+
+section OrderClass
+
+variable {F R S : Type*} [NonUnitalSemiring R] [PartialOrder R] [StarOrderedRing R]
+variable [NonUnitalSemiring S] [PartialOrder S] [StarOrderedRing S]
+
+-- we prove this auxiliary lemma in order to avoid duplicating the proof twice below.
+lemma NonUnitalRingHom.map_le_map_of_map_star (f : R →ₙ+* S) (hf : ∀ r, f (star r) = star (f r))
+    {x y : R} (hxy : x ≤ y) : f x ≤ f y := by
+  rw [StarOrderedRing.le_iff] at hxy ⊢
+  obtain ⟨p, hp, rfl⟩ := hxy
+  refine ⟨f p, ?_, map_add f _ _⟩
+  induction hp using AddSubmonoid.closure_induction'
+  all_goals aesop
+
+instance (priority := 100) StarRingHomClass.instOrderHomClass [FunLike F R S] [StarHomClass F R S]
+    [NonUnitalRingHomClass F R S] : OrderHomClass F R S where
+  map_rel f := (f : R →ₙ+* S).map_le_map_of_map_star (map_star f)
+
+-- This doesn't require any module structure, but the only morphism we currently have bundling
+-- `star` is `starAlgHom`. So we have to build the inverse morphism by hand.
+instance (priority := 100) StarRingHomClass.instOrderIsoClass [EquivLike F R S] [StarHomClass F R S]
+    [RingEquivClass F R S] : OrderIsoClass F R S where
+  map_le_map_iff f x y := by
+    refine ⟨fun h ↦ ?_, map_rel f⟩
+    let f_inv : S →ₙ+* R :=
+      { toFun := EquivLike.inv f
+        map_mul' := fun _ _ ↦ EmbeddingLike.injective f <| by simp
+        map_add' := fun _ _ ↦ EmbeddingLike.injective f <| by simp
+        map_zero' := EmbeddingLike.injective f <| by simp }
+    have f_inv_star (s : S) : f_inv (star s) = star (f_inv s) := EmbeddingLike.injective f <| by
+      simp only [map_star f, show ∀ s, f (f_inv s) = s from EquivLike.apply_inv_apply f]
+    have f_inv_f (r : R) : f_inv (f r) = r := EquivLike.inv_apply_apply f r
+    rw [← f_inv_f x, ← f_inv_f y]
+    exact f_inv.map_le_map_of_map_star f_inv_star h
+
+end OrderClass
feat(Algebra/Star/Order): more lemmas (#9096)
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2023 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison
 -/
-import Mathlib.Algebra.Star.Basic
+import Mathlib.Algebra.Star.SelfAdjoint
 import Mathlib.GroupTheory.Submonoid.Basic
 
 #align_import algebra.star.order from "leanprover-community/mathlib"@"31c24aa72e7b3e5ed97a8412470e904f82b81004"
@@ -185,4 +185,75 @@ theorem conjugate_le_conjugate' {a b : R} (hab : a ≤ b) (c : R) : c * a * star
   by simpa only [star_star] using conjugate_le_conjugate hab (star c)
 #align conjugate_le_conjugate' conjugate_le_conjugate'
 
+@[simp]
+lemma star_le_star_iff {x y : R} : star x ≤ star y ↔ x ≤ y := by
+  suffices ∀ x y, x ≤ y → star x ≤ star y from
+    ⟨by simpa only [star_star] using this (star x) (star y), this x y⟩
+  intro x y h
+  rw [StarOrderedRing.le_iff] at h ⊢
+  obtain ⟨d, hd, rfl⟩ := h
+  refine ⟨starAddEquiv d, ?_, star_add _ _⟩
+  refine AddMonoidHom.mclosure_preimage_le _ _ <| AddSubmonoid.closure_mono ?_ hd
+  rintro - ⟨s, rfl⟩
+  exact ⟨s, by simp⟩
+
+@[simp]
+lemma star_lt_star_iff {x y : R} : star x < star y ↔ x < y := by
+  by_cases h : x = y
+  · simp [h]
+  · simpa [le_iff_lt_or_eq, h] using star_le_star_iff (x := x) (y := y)
+
+lemma star_le_iff {x y : R} : star x ≤ y ↔ x ≤ star y := by rw [← star_le_star_iff, star_star]
+
+lemma star_lt_iff {x y : R} : star x < y ↔ x < star y := by rw [← star_lt_star_iff, star_star]
+
+@[simp]
+lemma star_nonneg_iff {x : R} : 0 ≤ star x ↔ 0 ≤ x := by
+  simpa using star_le_star_iff (x := 0) (y := x)
+
+@[simp]
+lemma star_nonpos_iff {x : R} : star x ≤ 0 ↔ x ≤ 0 := by
+  simpa using star_le_star_iff (x := x) (y := 0)
+
+@[simp]
+lemma star_pos_iff {x : R} : 0 < star x ↔ 0 < x := by
+  simpa using star_lt_star_iff (x := 0) (y := x)
+
+@[simp]
+lemma star_neg_iff {x : R} : star x < 0 ↔ x < 0 := by
+  simpa using star_lt_star_iff (x := x) (y := 0)
+
+lemma IsSelfAdjoint.mono {x y : R} (h : x ≤ y) (hx : IsSelfAdjoint x) : IsSelfAdjoint y := by
+  rw [StarOrderedRing.le_iff] at h
+  obtain ⟨d, hd, rfl⟩ := h
+  rw [IsSelfAdjoint, star_add, hx.star_eq]
+  congr
+  refine AddMonoidHom.eqOn_closureM (f := starAddEquiv (R := R)) (g := .id R) ?_ hd
+  rintro - ⟨s, rfl⟩
+  simp
+
+lemma IsSelfAdjoint.of_nonneg {x : R} (hx : 0 ≤ x) : IsSelfAdjoint x :=
+  (isSelfAdjoint_zero R).mono hx
+
 end NonUnitalSemiring
+
+section Semiring
+variable [Semiring R] [PartialOrder R] [StarOrderedRing R]
+
+@[simp]
+lemma one_le_star_iff {x : R} : 1 ≤ star x ↔ 1 ≤ x := by
+  simpa using star_le_star_iff (x := 1) (y := x)
+
+@[simp]
+lemma star_le_one_iff {x : R} : star x ≤ 1 ↔ x ≤ 1 := by
+  simpa using star_le_star_iff (x := x) (y := 1)
+
+@[simp]
+lemma one_lt_star_iff {x : R} : 1 < star x ↔ 1 < x := by
+  simpa using star_lt_star_iff (x := 1) (y := x)
+
+@[simp]
+lemma star_lt_one_iff {x : R} : star x < 1 ↔ x < 1 := by
+  simpa using star_lt_star_iff (x := x) (y := 1)
+
+end Semiring
chore: rename star_mul_self_nonneg' (#8305)
Diff
@@ -152,9 +152,9 @@ theorem star_mul_self_nonneg (r : R) : 0 ≤ star r * r :=
   StarOrderedRing.nonneg_iff.mpr <| AddSubmonoid.subset_closure ⟨r, rfl⟩
 #align star_mul_self_nonneg star_mul_self_nonneg
 
-theorem star_mul_self_nonneg' (r : R) : 0 ≤ r * star r := by
+theorem mul_star_self_nonneg (r : R) : 0 ≤ r * star r := by
   simpa only [star_star] using star_mul_self_nonneg (star r)
-#align star_mul_self_nonneg' star_mul_self_nonneg'
+#align star_mul_self_nonneg' mul_star_self_nonneg
 
 theorem conjugate_nonneg {a : R} (ha : 0 ≤ a) (c : R) : 0 ≤ star c * a * c := by
   rw [StarOrderedRing.nonneg_iff] at ha
chore: tidy various files (#7137)
Diff
@@ -90,9 +90,9 @@ If you are working with a `NonUnitalRing` and not a `NonUnitalSemiring`, see
 `StarOrderedRing.ofNonnegIff` for a more convenient version.
  -/
 @[reducible]
-def ofLeIff [NonUnitalSemiring R] [PartialOrder R] [StarRing R]
+def ofLEIff [NonUnitalSemiring R] [PartialOrder R] [StarRing R]
     (h_le_iff : ∀ x y : R, x ≤ y ↔ ∃ s, y = x + star s * s) : StarOrderedRing R where
-  le_iff := fun x y => by
+  le_iff x y := by
     refine' ⟨fun h => _, _⟩
     · obtain ⟨p, hp⟩ := (h_le_iff x y).mp h
       exact ⟨star p * p, AddSubmonoid.subset_closure ⟨p, rfl⟩, hp⟩
@@ -104,7 +104,7 @@ def ofLeIff [NonUnitalSemiring R] [PartialOrder R] [StarRing R]
       · rintro a b ha hb x y rfl
         rw [← add_assoc]
         exact (ha _ _ rfl).trans (hb _ _ rfl)
-#align star_ordered_ring.of_le_iff StarOrderedRing.ofLeIffₓ
+#align star_ordered_ring.of_le_iff StarOrderedRing.ofLEIffₓ
 
 -- set note [reducible non-instances]
 /-- When `R` is a non-unital ring, to construct a `StarOrderedRing` instance it suffices to
@@ -115,7 +115,7 @@ def ofNonnegIff [NonUnitalRing R] [PartialOrder R] [StarRing R]
     (h_add : ∀ {x y : R}, x ≤ y → ∀ z, z + x ≤ z + y)
     (h_nonneg_iff : ∀ x : R, 0 ≤ x ↔ x ∈ AddSubmonoid.closure (Set.range fun s : R => star s * s)) :
     StarOrderedRing R where
-  le_iff := fun x y => by
+  le_iff x y := by
     haveI : CovariantClass R R (· + ·) (· ≤ ·) := ⟨fun _ _ _ h => h_add h _⟩
     simpa only [← sub_eq_iff_eq_add', sub_nonneg, exists_eq_right'] using h_nonneg_iff (y - x)
 #align star_ordered_ring.of_nonneg_iff StarOrderedRing.ofNonnegIff
@@ -132,7 +132,7 @@ instances. -/
 def ofNonnegIff' [NonUnitalRing R] [PartialOrder R] [StarRing R]
     (h_add : ∀ {x y : R}, x ≤ y → ∀ z, z + x ≤ z + y)
     (h_nonneg_iff : ∀ x : R, 0 ≤ x ↔ ∃ s, x = star s * s) : StarOrderedRing R :=
-  ofLeIff <| by
+  ofLEIff <| by
     haveI : CovariantClass R R (· + ·) (· ≤ ·) := ⟨fun _ _ _ h => h_add h _⟩
     simpa [sub_eq_iff_eq_add', sub_nonneg] using fun x y => h_nonneg_iff (y - x)
 #align star_ordered_ring.of_nonneg_iff' StarOrderedRing.ofNonnegIff'
chore: drop MulZeroClass. in mul_zero/zero_mul (#6682)

Search&replace MulZeroClass.mul_zero -> mul_zero, MulZeroClass.zero_mul -> zero_mul.

These were introduced by Mathport, as the full name of mul_zero is actually MulZeroClass.mul_zero (it's exported with the short name).

Diff
@@ -159,7 +159,7 @@ theorem star_mul_self_nonneg' (r : R) : 0 ≤ r * star r := by
 theorem conjugate_nonneg {a : R} (ha : 0 ≤ a) (c : R) : 0 ≤ star c * a * c := by
   rw [StarOrderedRing.nonneg_iff] at ha
   refine' AddSubmonoid.closure_induction ha (fun x hx => _)
-    (by rw [MulZeroClass.mul_zero, MulZeroClass.zero_mul]) fun x y hx hy => _
+    (by rw [mul_zero, zero_mul]) fun x y hx hy => _
   · obtain ⟨x, rfl⟩ := hx
     convert star_mul_self_nonneg (x * c) using 1
     rw [star_mul, ← mul_assoc, mul_assoc _ _ c]
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2023 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison
-
-! This file was ported from Lean 3 source module algebra.star.order
-! leanprover-community/mathlib commit 31c24aa72e7b3e5ed97a8412470e904f82b81004
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Algebra.Star.Basic
 import Mathlib.GroupTheory.Submonoid.Basic
 
+#align_import algebra.star.order from "leanprover-community/mathlib"@"31c24aa72e7b3e5ed97a8412470e904f82b81004"
+
 /-! # Star ordered rings
 
 We define the class `StarOrderedRing R`, which says that the order on `R` respects the
chore: cleanup whitespace (#5988)

Grepping for [^ .:{-] [^ :] and reviewing the results. Once I started I couldn't stop. :-)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -78,7 +78,7 @@ instance (priority := 100) toExistsAddOfLE [NonUnitalSemiring R] [PartialOrder R
 -- see note [lower instance priority]
 instance (priority := 100) toOrderedAddCommGroup [NonUnitalRing R] [PartialOrder R]
     [StarOrderedRing R] : OrderedAddCommGroup R where
-  add_le_add_left := @add_le_add_left  _ _ _ _
+  add_le_add_left := @add_le_add_left _ _ _ _
 
 #align star_ordered_ring.to_ordered_add_comm_group StarOrderedRing.toOrderedAddCommGroup
 
feat: drop an unneeded field of StarOrderedRing (#5639)

In StarOrderedRing.ofLeIff, the assumption h_add : ∀ {x y}, x ≤ y → ∀ z, z + x ≤ z + y follows from the other one.

Co-authored-by: Jireh Loreaux <loreaujy@gmail.com>

Diff
@@ -25,6 +25,9 @@ rather the entire `≤` relation with `StarOrderedRing.le_iff`. However, notice
 `NonUnitalRing`, these are equivalent (see `StarOrderedRing.nonneg_iff` and
 `StarOrderedRing.ofNonnegIff`).
 
+It is important to note that while a `StarOrderedRing` is an `OrderedAddCommMonoid` it is often
+*not* an `OrderedSemiring`.
+
 ## TODO
 
 * In a Banach star algebra without a well-defined square root, the natural ordering is given by the
@@ -34,20 +37,19 @@ positive cone which is the _closure_ of the sums of elements `star r * r`. A wea
 the advantage of not requiring a topology.
 -/
 
-
 universe u
 
 variable {R : Type u}
 
-/-- An ordered `*`-ring is a ring which is both an `OrderedAddCommGroup` and a `*`-ring,
-and the nonnegative elements constitute precisely the `AddSubmonoid` generated by
-elements of the form `star s * s`.
+/-- An ordered `*`-ring is a `*`ring with a partial order such that the nonnegative elements
+constitute precisely the `AddSubmonoid` generated by elements of the form `star s * s`.
 
 If you are working with a `NonUnitalRing` and not a `NonUnitalSemiring`, it may be more
-convenient to declare instances using `StarOrderedRing.ofNonnegIff'`. -/
+convenient to declare instances using `StarOrderedRing.ofNonnegIff'`.
+
+Porting note: dropped an unneeded assumption
+`add_le_add_left : ∀ {x y}, x ≤ y → ∀ z, z + x ≤ z + y` -/
 class StarOrderedRing (R : Type u) [NonUnitalSemiring R] [PartialOrder R] extends StarRing R where
-  /-- addition commutes with `≤` -/
-  add_le_add_left : ∀ a b : R, a ≤ b → ∀ c : R, c + a ≤ c + b
   /-- characterization of the order in terms of the `StarRing` structure. -/
   le_iff :
     ∀ x y : R, x ≤ y ↔ ∃ p, p ∈ AddSubmonoid.closure (Set.range fun s => star s * s) ∧ y = x + p
@@ -57,9 +59,12 @@ namespace StarOrderedRing
 
 -- see note [lower instance priority]
 instance (priority := 100) toOrderedAddCommMonoid [NonUnitalSemiring R] [PartialOrder R]
-    [StarOrderedRing R] : OrderedAddCommMonoid R :=
-  { show NonUnitalSemiring R by infer_instance, show PartialOrder R by infer_instance,
-    show StarOrderedRing R by infer_instance with }
+    [StarOrderedRing R] : OrderedAddCommMonoid R where
+  add_le_add_left := fun x y hle z ↦ by
+    rw [StarOrderedRing.le_iff] at hle ⊢
+    refine hle.imp fun s hs ↦ ?_
+    rw [hs.2, add_assoc]
+    exact ⟨hs.1, rfl⟩
 #align star_ordered_ring.to_ordered_add_comm_monoid StarOrderedRing.toOrderedAddCommMonoid
 
 -- see note [lower instance priority]
@@ -72,9 +77,9 @@ instance (priority := 100) toExistsAddOfLE [NonUnitalSemiring R] [PartialOrder R
 
 -- see note [lower instance priority]
 instance (priority := 100) toOrderedAddCommGroup [NonUnitalRing R] [PartialOrder R]
-    [StarOrderedRing R] : OrderedAddCommGroup R :=
-  { show NonUnitalRing R by infer_instance, show PartialOrder R by infer_instance,
-    show StarOrderedRing R by infer_instance with }
+    [StarOrderedRing R] : OrderedAddCommGroup R where
+  add_le_add_left := @add_le_add_left  _ _ _ _
+
 #align star_ordered_ring.to_ordered_add_comm_group StarOrderedRing.toOrderedAddCommGroup
 
 -- set note [reducible non-instances]
@@ -85,28 +90,24 @@ This is provided for convenience because it holds in some common scenarios (e.g.
 and obviates the hassle of `AddSubmonoid.closure_induction` when creating those instances.
 
 If you are working with a `NonUnitalRing` and not a `NonUnitalSemiring`, see
-`StarOrderedRing.ofNonnegIff` for a more convenient version. -/
+`StarOrderedRing.ofNonnegIff` for a more convenient version.
+ -/
 @[reducible]
 def ofLeIff [NonUnitalSemiring R] [PartialOrder R] [StarRing R]
-    (h_add : ∀ {x y : R}, x ≤ y → ∀ z, z + x ≤ z + y)
-    (h_le_iff : ∀ x y : R, x ≤ y ↔ ∃ s, y = x + star s * s) : StarOrderedRing R :=
-  { ‹StarRing R› with
-    add_le_add_left := @h_add
-    le_iff := fun x y => by
-      refine' ⟨fun h => _, _⟩
-      · obtain ⟨p, hp⟩ := (h_le_iff x y).mp h
-        exact ⟨star p * p, AddSubmonoid.subset_closure ⟨p, rfl⟩, hp⟩
-      · rintro ⟨p, hp, hpxy⟩
-        revert x y hpxy
-        refine' AddSubmonoid.closure_induction hp _ (fun x y h => add_zero x ▸ h.ge) _
-        · rintro _ ⟨s, rfl⟩ x y rfl
-          nth_rw 1 [← add_zero x]
-          refine' h_add _ x
-          exact (h_le_iff _ _).mpr ⟨s, by rw [zero_add]⟩
-        · rintro a b ha hb x y rfl
-          nth_rw 1 [← add_zero x]
-          refine' h_add ((ha 0 _ (zero_add a).symm).trans (hb a _ rfl)) x }
-#align star_ordered_ring.of_le_iff StarOrderedRing.ofLeIff
+    (h_le_iff : ∀ x y : R, x ≤ y ↔ ∃ s, y = x + star s * s) : StarOrderedRing R where
+  le_iff := fun x y => by
+    refine' ⟨fun h => _, _⟩
+    · obtain ⟨p, hp⟩ := (h_le_iff x y).mp h
+      exact ⟨star p * p, AddSubmonoid.subset_closure ⟨p, rfl⟩, hp⟩
+    · rintro ⟨p, hp, hpxy⟩
+      revert x y hpxy
+      refine' AddSubmonoid.closure_induction hp _ (fun x y h => add_zero x ▸ h.ge) _
+      · rintro _ ⟨s, rfl⟩ x y rfl
+        exact (h_le_iff _ _).mpr ⟨s, rfl⟩
+      · rintro a b ha hb x y rfl
+        rw [← add_assoc]
+        exact (ha _ _ rfl).trans (hb _ _ rfl)
+#align star_ordered_ring.of_le_iff StarOrderedRing.ofLeIffₓ
 
 -- set note [reducible non-instances]
 /-- When `R` is a non-unital ring, to construct a `StarOrderedRing` instance it suffices to
@@ -116,12 +117,10 @@ by `star s * s` for `s : R`. -/
 def ofNonnegIff [NonUnitalRing R] [PartialOrder R] [StarRing R]
     (h_add : ∀ {x y : R}, x ≤ y → ∀ z, z + x ≤ z + y)
     (h_nonneg_iff : ∀ x : R, 0 ≤ x ↔ x ∈ AddSubmonoid.closure (Set.range fun s : R => star s * s)) :
-    StarOrderedRing R :=
-  { ‹StarRing R› with
-    add_le_add_left := @h_add
-    le_iff := fun x y => by
-      haveI : CovariantClass R R (· + ·) (· ≤ ·) := ⟨fun _ _ _ h => h_add h _⟩
-      simpa only [← sub_eq_iff_eq_add', sub_nonneg, exists_eq_right'] using h_nonneg_iff (y - x) }
+    StarOrderedRing R where
+  le_iff := fun x y => by
+    haveI : CovariantClass R R (· + ·) (· ≤ ·) := ⟨fun _ _ _ h => h_add h _⟩
+    simpa only [← sub_eq_iff_eq_add', sub_nonneg, exists_eq_right'] using h_nonneg_iff (y - x)
 #align star_ordered_ring.of_nonneg_iff StarOrderedRing.ofNonnegIff
 
 -- set note [reducible non-instances]
@@ -136,10 +135,9 @@ instances. -/
 def ofNonnegIff' [NonUnitalRing R] [PartialOrder R] [StarRing R]
     (h_add : ∀ {x y : R}, x ≤ y → ∀ z, z + x ≤ z + y)
     (h_nonneg_iff : ∀ x : R, 0 ≤ x ↔ ∃ s, x = star s * s) : StarOrderedRing R :=
-  ofLeIff (@h_add)
-    (by
-      haveI : CovariantClass R R (· + ·) (· ≤ ·) := ⟨fun _ _ _ h => h_add h _⟩
-      simpa [sub_eq_iff_eq_add', sub_nonneg] using fun x y => h_nonneg_iff (y - x))
+  ofLeIff <| by
+    haveI : CovariantClass R R (· + ·) (· ≤ ·) := ⟨fun _ _ _ h => h_add h _⟩
+    simpa [sub_eq_iff_eq_add', sub_nonneg] using fun x y => h_nonneg_iff (y - x)
 #align star_ordered_ring.of_nonneg_iff' StarOrderedRing.ofNonnegIff'
 
 theorem nonneg_iff [NonUnitalSemiring R] [PartialOrder R] [StarOrderedRing R] {x : R} :
chore: fix many typos (#4967)

These are all doc fixes

Diff
@@ -20,7 +20,7 @@ elements of the form `star s * s`. In many cases, including all C⋆-algebras, t
 allows us to register a `StarOrderedRing` instance for `ℚ`), and more closely resembles the
 literature (see the seminal paper [*The positive cone in Banach algebras*][kelleyVaught1953])
 
-In order to accodomate `NonUnitalSemiring R`, we actually don't characterize nonnegativity, but
+In order to accommodate `NonUnitalSemiring R`, we actually don't characterize nonnegativity, but
 rather the entire `≤` relation with `StarOrderedRing.le_iff`. However, notice that when `R` is a
 `NonUnitalRing`, these are equivalent (see `StarOrderedRing.nonneg_iff` and
 `StarOrderedRing.ofNonnegIff`).
chore: forward-port leanprover-community/mathlib#18854 (#4840)

This forward-ports all the files from leanprover-community/mathlib#18854 which have already been ported, and it also ports the new file algebra.star.order, which is a split from algebra.star.basic and was necessary to do at the same time.

Co-authored-by: Chris Hughes <chrishughes24@gmail.com>

Dependencies 3 + 183

184 files ported (98.4%)
70547 lines ported (98.5%)
Show graph

The unported dependencies are