Skip to content

Commit bc37ac3

Browse files
committed
chore(Algebra/Ring/SumsOfSquares, Algebra/Ring/Semireal): name convension (#15621)
1 parent 00d93f9 commit bc37ac3

File tree

2 files changed

+49
-36
lines changed

2 files changed

+49
-36
lines changed

Mathlib/Algebra/Ring/Semireal/Defs.lean

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ Copyright (c) 2024 Florent Schaffhauser. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Florent Schaffhauser
55
-/
6-
76
import Mathlib.Algebra.Ring.SumsOfSquares
87
import Mathlib.Algebra.Order.Field.Defs
98

@@ -19,7 +18,7 @@ semireal.
1918
2019
## Main declaration
2120
22-
- `isSemireal`: the predicate asserting that a commutative ring `R` is semireal.
21+
- `IsSemireal`: the predicate asserting that a commutative ring `R` is semireal.
2322
2423
## References
2524
@@ -31,14 +30,18 @@ variable (R : Type*)
3130

3231
/--
3332
A semireal ring is a non-trivial commutative ring (with unit) in which `-1` is *not* a sum of
34-
squares. Note that `-1` does not make sense in a semiring. Below we define the class `isSemiReal R`
33+
squares. Note that `-1` does not make sense in a semiring. Below we define the class `IsSemireal R`
3534
for all additive monoid `R` equipped with a multiplication, a multiplicative unit and a negation.
3635
-/
3736
@[mk_iff]
38-
class isSemireal [AddMonoid R] [Mul R] [One R] [Neg R] : Prop where
39-
non_trivial : (0 : R) ≠ 1
40-
neg_one_not_SumSq : ¬isSumSq (-1 : R)
37+
class IsSemireal [AddMonoid R] [Mul R] [One R] [Neg R] : Prop where
38+
non_trivial : (0 : R) ≠ 1
39+
not_isSumSq_neg_one : ¬IsSumSq (-1 : R)
40+
41+
@[deprecated (since := "2024-08-09")] alias isSemireal := IsSemireal
42+
@[deprecated (since := "2024-08-09")] alias isSemireal.neg_one_not_SumSq :=
43+
IsSemireal.not_isSumSq_neg_one
4144

42-
instance [LinearOrderedField R] : isSemireal R where
45+
instance [LinearOrderedField R] : IsSemireal R where
4346
non_trivial := zero_ne_one
44-
neg_one_not_SumSq := fun h ↦ (not_le (α := R)).2 neg_one_lt_zero h.nonneg
47+
not_isSumSq_neg_one := fun h ↦ (not_le (α := R)).2 neg_one_lt_zero h.nonneg

Mathlib/Algebra/Ring/SumsOfSquares.lean

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ Copyright (c) 2024 Florent Schaffhauser. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Florent Schaffhauser
55
-/
6-
76
import Mathlib.Algebra.Ring.Defs
87
import Mathlib.Algebra.Group.Submonoid.Basic
98
import Mathlib.Algebra.Group.Even
@@ -13,27 +12,27 @@ import Mathlib.Algebra.Order.Ring.Defs
1312
# Sums of squares
1413
1514
We introduce sums of squares in a type `R` endowed with an `[Add R]`, `[Zero R]` and `[Mul R]`
16-
instances. Sums of squares in `R` are defined by an inductive predicate `isSumSq : R → Prop`:
15+
instances. Sums of squares in `R` are defined by an inductive predicate `IsSumSq : R → Prop`:
1716
`0 : R` is a sum of squares and if `S` is a sum of squares, then for all `a : R`, `a * a + S` is a
1817
sum of squares in `R`.
1918
2019
## Main declaration
2120
22-
- The predicate `isSumSq : R → Prop`, defining the property of being a sum of squares in `R`.
21+
- The predicate `IsSumSq : R → Prop`, defining the property of being a sum of squares in `R`.
2322
2423
## Auxiliary declarations
2524
26-
- The type `SumSqIn R` : in an additive monoid with multiplication `R`, we introduce the type
27-
`SumSqIn R` as the submonoid of `R` whose carrier is the subset `{S : R | isSumSq S}`.
25+
- The type `sumSqIn R` : in an additive monoid with multiplication `R`, we introduce the type
26+
`sumSqIn R` as the submonoid of `R` whose carrier is the subset `{S : R | IsSumSq S}`.
2827
2928
## Theorems
3029
31-
- `isSumSq.add`: if `S1` and `S2` are sums of squares in `R`, then so is `S1 + S2`.
32-
- `SumSq.nonneg`: in a linearly ordered semiring `R` with an `[ExistsAddOfLE R]` instance, sums of
30+
- `IsSumSq.add`: if `S1` and `S2` are sums of squares in `R`, then so is `S1 + S2`.
31+
- `IsSumSq.nonneg`: in a linearly ordered semiring `R` with an `[ExistsAddOfLE R]` instance, sums of
3332
squares are non-negative.
34-
- `SquaresInSumSq`: a square is a sum of squares.
35-
- `SquaresAddClosure`: the submonoid of `R` generated by the squares in `R` is the set of sums of
36-
squares in `R`.
33+
- `mem_sumSqIn_of_isSquare`: a square is a sum of squares.
34+
- `AddSubmonoid.closure_isSquare`: the submonoid of `R` generated by the squares in `R` is the set
35+
of sums of squares in `R`.
3736
3837
-/
3938

@@ -45,57 +44,68 @@ squares is defined by an inductive predicate: `0 : R` is a sum of squares and if
4544
squares, then for all `a : R`, `a * a + S` is a sum of squares in `R`.
4645
-/
4746
@[mk_iff]
48-
inductive isSumSq [Add R] [Zero R] : R → Prop
49-
| zero : isSumSq 0
50-
| sq_add (a S : R) (pS : isSumSq S) : isSumSq (a * a + S)
47+
inductive IsSumSq [Add R] [Zero R] : R → Prop
48+
| zero : IsSumSq 0
49+
| sq_add (a S : R) (pS : IsSumSq S) : IsSumSq (a * a + S)
50+
51+
@[deprecated (since := "2024-08-09")] alias isSumSq := IsSumSq
5152

5253
/--
5354
If `S1` and `S2` are sums of squares in a semiring `R`, then `S1 + S2` is a sum of squares in `R`.
5455
-/
55-
theorem isSumSq.add [AddMonoid R] {S1 S2 : R} (p1 : isSumSq S1)
56-
(p2 : isSumSq S2) : isSumSq (S1 + S2) := by
56+
theorem IsSumSq.add [AddMonoid R] {S1 S2 : R} (p1 : IsSumSq S1)
57+
(p2 : IsSumSq S2) : IsSumSq (S1 + S2) := by
5758
induction p1 with
5859
| zero => rw [zero_add]; exact p2
59-
| sq_add a S pS ih => rw [add_assoc]; exact isSumSq.sq_add a (S + S2) ih
60+
| sq_add a S pS ih => rw [add_assoc]; exact IsSumSq.sq_add a (S + S2) ih
61+
62+
@[deprecated (since := "2024-08-09")] alias isSumSq.add := IsSumSq.add
6063

6164
variable (R) in
6265
/--
63-
In an additive monoid with multiplication `R`, the type `SumSqIn R` is the submonoid of sums of
66+
In an additive monoid with multiplication `R`, the type `sumSqIn R` is the submonoid of sums of
6467
squares in `R`.
6568
-/
66-
def SumSqIn [AddMonoid R] : AddSubmonoid R where
67-
carrier := {S : R | isSumSq S}
68-
zero_mem' := isSumSq.zero
69-
add_mem' := isSumSq.add
69+
def sumSqIn [AddMonoid R] : AddSubmonoid R where
70+
carrier := {S : R | IsSumSq S}
71+
zero_mem' := IsSumSq.zero
72+
add_mem' := IsSumSq.add
73+
74+
@[deprecated (since := "2024-08-09")] alias SumSqIn := sumSqIn
7075

7176
/--
7277
In an additive monoid with multiplication, every square is a sum of squares. By definition, a square
7378
in `R` is a term `x : R` such that `x = y * y` for some `y : R` and in Mathlib this is known as
7479
`IsSquare R` (see Mathlib.Algebra.Group.Even).
7580
-/
76-
theorem SquaresInSumSq [AddMonoid R] {x : R} (px : IsSquare x) : x ∈ SumSqIn R := by
81+
theorem mem_sumSqIn_of_isSquare [AddMonoid R] {x : R} (px : IsSquare x) : x ∈ sumSqIn R := by
7782
rcases px with ⟨y, py⟩
7883
rw [py, ← AddMonoid.add_zero (y * y)]
79-
exact isSumSq.sq_add _ _ isSumSq.zero
84+
exact IsSumSq.sq_add _ _ IsSumSq.zero
85+
86+
@[deprecated (since := "2024-08-09")] alias SquaresInSumSq := mem_sumSqIn_of_isSquare
8087

81-
open AddSubmonoid in
8288
/--
8389
In an additive monoid with multiplication `R`, the submonoid generated by the squares is the set of
8490
sums of squares.
8591
-/
86-
theorem SquaresAddClosure [AddMonoid R] : closure IsSquare = SumSqIn R := by
87-
refine le_antisymm (closure_le.2 (fun x hx ↦ SquaresInSumSq hx)) (fun x hx ↦ ?_)
92+
theorem AddSubmonoid.closure_isSquare [AddMonoid R] : closure {x : R | IsSquare x} = sumSqIn R := by
93+
refine le_antisymm (closure_le.2 (fun x hx ↦ mem_sumSqIn_of_isSquare hx)) (fun x hx ↦ ?_)
8894
induction hx with
8995
| zero => exact zero_mem _
9096
| sq_add a S _ ih => exact AddSubmonoid.add_mem _ (subset_closure ⟨a, rfl⟩) ih
9197

98+
@[deprecated (since := "2024-08-09")] alias SquaresAddClosure := AddSubmonoid.closure_isSquare
99+
92100
/--
93101
Let `R` be a linearly ordered semiring in which the property `a ≤ b → ∃ c, a + c = b` holds
94102
(e.g. `R = ℕ`). If `S : R` is a sum of squares in `R`, then `0 ≤ S`. This is used in
95103
`Mathlib.Algebra.Ring.Semireal.Defs` to show that linearly ordered fields are semireal.
96104
-/
97-
theorem isSumSq.nonneg {R : Type*} [LinearOrderedSemiring R] [ExistsAddOfLE R] {S : R}
98-
(pS : isSumSq S) : 0 ≤ S := by
105+
theorem IsSumSq.nonneg {R : Type*} [LinearOrderedSemiring R] [ExistsAddOfLE R] {S : R}
106+
(pS : IsSumSq S) : 0 ≤ S := by
99107
induction pS with
100108
| zero => simp only [le_refl]
101109
| sq_add x S _ ih => apply add_nonneg ?_ ih; simp only [← pow_two x, sq_nonneg]
110+
111+
@[deprecated (since := "2024-08-09")] alias isSumSq.nonneg := IsSumSq.nonneg

0 commit comments

Comments
 (0)