The areas / V06. Rings, fields and ordered algebra
Mathlib.Algebra.Ring.SumsOfSquares
34 declarations. Mathlib docs · Source
Sums of squares
We introduce a predicate for sums of squares in a ring.
Main declarations
IsSumSq : R → Prop: for a typeRwith addition, multiplication and a zero, an inductive predicate defining the property of being a sum of squares inR.0 : Ris a sum of squares and ifSis a sum of squares, then, for alla : R,a * a + sis a sum of squares.AddMonoid.sumSq RandSubsemiring.sumSq R: respectively the submonoid or subsemiring of sums of squares in an additive monoid or semiringRwith multiplication.
ctor IsSumSq.below.sq_add E0 #
∀ {R : Type u_1} [inst : Mul R] [inst_1 : Add R] [inst_2 : Zero R] {motive : (a : R) → IsSumSq a → Prop} (a : R) {s : R}
(hs : IsSumSq s), IsSumSq.below hs → motive s hs → IsSumSq.below ⋯
ctor IsSumSq.below.zero E0 #
∀ {R : Type u_1} [inst : Mul R] [inst_1 : Add R] [inst_2 : Zero R] {motive : (a : R) → IsSumSq a → Prop},
IsSumSq.below ⋯
inductive IsSumSq E1 #
{R : Type u_1} → [Mul R] → [Add R] → [Zero R] → R → Prop
The property of being a sum of squares is defined inductively by:
0 : R is a sum of squares and if s : R is a sum of squares,
then for all a : R, a * a + s is a sum of squares in R.
theorem isSumSq_iff E0 #
∀ {R : Type u_1} [inst : Mul R] [inst_1 : Add R] [inst_2 : Zero R] (a : R),
IsSumSq a ↔ a = 0 ∨ ∃ a_1 s, IsSumSq s ∧ a = a_1 * a_1 + s
ctor IsSumSq.zero E0 #
∀ {R : Type u_1} [inst : Mul R] [inst_1 : Add R] [inst_2 : Zero R], IsSumSq 0
ctor IsSumSq.sq_add E0 #
∀ {R : Type u_1} [inst : Mul R] [inst_1 : Add R] [inst_2 : Zero R] (a : R) {s : R}, IsSumSq s → IsSumSq (a * a + s)
theorem IsSumSq.rec' E1 #
∀ {R : Type u_1} [inst : Mul R] [inst_1 : Add R] [inst_2 : Zero R] {motive : (s : R) → IsSumSq s → Prop},
motive 0 ⋯ →
(∀ {x s : R} (hx : IsSquare x) (hs : IsSumSq s), motive s hs → motive (x + s) ⋯) →
∀ {s : R} (h : IsSumSq s), motive s h
Alternative induction scheme for IsSumSq which uses IsSquare.
theorem IsSumSq.add E1 #
∀ {R : Type u_1} [inst : AddMonoid R] [inst_1 : Mul R] {s₁ s₂ : R}, IsSumSq s₁ → IsSumSq s₂ → IsSumSq (s₁ + s₂)
In an additive monoid with multiplication,
if s₁ and s₂ are sums of squares, then s₁ + s₂ is a sum of squares.
def AddSubmonoid.sumSq E1 #
(T : Type u_2) → [inst : AddMonoid T] → [Mul T] → AddSubmonoid T
In an additive monoid with multiplication R, AddSubmonoid.sumSq R is the submonoid of sums of
squares in R.
theorem AddSubmonoid.coe_sumSq E0 #
∀ (T : Type u_2) [inst : AddMonoid T] [inst_1 : Mul T], ↑(AddSubmonoid.sumSq T) = {s | IsSumSq s}
theorem AddSubmonoid.mem_sumSq E0 #
∀ {T : Type u_2} [inst : AddMonoid T] [inst_1 : Mul T] {s : T}, s ∈ AddSubmonoid.sumSq T ↔ IsSumSq s
theorem IsSumSq.mul_self E0 #
∀ {R : Type u_1} [inst : AddZeroClass R] [inst_1 : Mul R] (a : R), IsSumSq (a * a)
In an additive unital magma with multiplication, x * x is a sum of squares for all x.
theorem IsSquare.isSumSq E1 #
∀ {R : Type u_1} [inst : AddZeroClass R] [inst_1 : Mul R] {x : R}, IsSquare x → IsSumSq x
In an additive unital magma with multiplication, squares are sums of squares (see Mathlib.Algebra.Group.Even).
theorem IsSumSq.one E0 #
∀ {R : Type u_1} [inst : AddZeroClass R] [inst_1 : MulOneClass R], IsSumSq 1
theorem AddSubmonoid.closure_isSquare E0 #
∀ {R : Type u_1} [inst : AddMonoid R] [inst_1 : Mul R], AddSubmonoid.closure {x | IsSquare x} = AddSubmonoid.sumSq R
In an additive monoid with multiplication R, the submonoid generated by the squares is the set of
sums of squares in R.
theorem IsSumSq.sum E1 #
∀ {R : Type u_1} [inst : AddCommMonoid R] [inst_1 : Mul R] {ι : Type u_2} {I : Finset ι} {s : ι → R},
(∀ i ∈ I, IsSumSq (s i)) → IsSumSq (∑ i ∈ I, s i)
In an additive commutative monoid with multiplication, a finite sum of sums of squares is a sum of squares.
theorem IsSumSq.sum_isSquare E1 #
∀ {R : Type u_1} [inst : AddCommMonoid R] [inst_1 : Mul R] {ι : Type u_2} (I : Finset ι) {x : ι → R},
(∀ i ∈ I, IsSquare (x i)) → IsSumSq (∑ i ∈ I, x i)
In an additive commutative monoid with multiplication,
∑ i ∈ I, x i, where each x i is a square, is a sum of squares.
theorem IsSumSq.sum_mul_self E0 #
∀ {R : Type u_1} [inst : AddCommMonoid R] [inst_1 : Mul R] {ι : Type u_2} (I : Finset ι) (a : ι → R),
IsSumSq (∑ i ∈ I, a i * a i)
In an additive commutative monoid with multiplication,
∑ i ∈ I, a i * a i is a sum of squares.
theorem IsSumSq.sum_sq E0 #
∀ {R : Type u_1} [inst : CommSemiring R] {ι : Type u_2} (I : Finset ι) (a : ι → R), IsSumSq (∑ i ∈ I, a i ^ 2)
def NonUnitalSubsemiring.sumSq E1 #
(T : Type u_2) → [inst : NonUnitalCommSemiring T] → NonUnitalSubsemiring T
In a commutative (possibly non-unital) semiring R, NonUnitalSubsemiring.sumSq R is
the (possibly non-unital) subsemiring of sums of squares in R.
theorem NonUnitalSubsemiring.sumSq_toAddSubmonoid E0 #
∀ {T : Type u_2} [inst : NonUnitalCommSemiring T], (NonUnitalSubsemiring.sumSq T).toAddSubmonoid = AddSubmonoid.sumSq T
theorem NonUnitalSubsemiring.mem_sumSq E0 #
∀ {T : Type u_2} [inst : NonUnitalCommSemiring T] {s : T}, s ∈ NonUnitalSubsemiring.sumSq T ↔ IsSumSq s
theorem NonUnitalSubsemiring.coe_sumSq E0 #
∀ {T : Type u_2} [inst : NonUnitalCommSemiring T], ↑(NonUnitalSubsemiring.sumSq T) = {s | IsSumSq s}
theorem NonUnitalSubsemiring.closure_isSquare E0 #
∀ {T : Type u_2} [inst : NonUnitalCommSemiring T],
NonUnitalSubsemiring.closure {x | IsSquare x} = NonUnitalSubsemiring.sumSq T
theorem IsSumSq.natCast E0 #
∀ {R : Type u_2} [inst : NonAssocSemiring R] (n : ℕ), IsSumSq ↑n
theorem Nat.isSumSq E0 #
∀ (n : ℕ), IsSumSq n
theorem IsSumSq.mul E1 #
∀ {R : Type u_1} [inst : NonUnitalCommSemiring R] {s₁ s₂ : R}, IsSumSq s₁ → IsSumSq s₂ → IsSumSq (s₁ * s₂)
In a commutative (possibly non-unital) semiring,
if s₁ and s₂ are sums of squares, then s₁ * s₂ is a sum of squares.
def Subsemiring.sumSq E1 #
(T : Type u_2) → [inst : CommSemiring T] → Subsemiring T
In a commutative semiring R, Subsemiring.sumSq R is the subsemiring of sums of squares in R.
theorem Subsemiring.sumSq_toNonUnitalSubsemiring E0 #
∀ {T : Type u_2} [inst : CommSemiring T], (Subsemiring.sumSq T).toNonUnitalSubsemiring = NonUnitalSubsemiring.sumSq T
theorem Subsemiring.mem_sumSq E0 #
∀ {T : Type u_2} [inst : CommSemiring T] {s : T}, s ∈ Subsemiring.sumSq T ↔ IsSumSq s
theorem Subsemiring.coe_sumSq E0 #
∀ {T : Type u_2} [inst : CommSemiring T], ↑(Subsemiring.sumSq T) = {s | IsSumSq s}
theorem Subsemiring.closure_isSquare E0 #
∀ {T : Type u_2} [inst : CommSemiring T], Subsemiring.closure {x | IsSquare x} = Subsemiring.sumSq T
theorem IsSumSq.prod E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {ι : Type u_2} {I : Finset ι} {x : ι → R},
(∀ i ∈ I, IsSumSq (x i)) → IsSumSq (∏ i ∈ I, x i)
In a commutative semiring, a finite product of sums of squares is a sum of squares.
theorem IsSumSq.nonneg E1 #
∀ {R : Type u_2} [inst : Semiring R] [inst_1 : LinearOrder R] [IsStrictOrderedRing R] [ExistsAddOfLE R] {s : R},
IsSumSq s → 0 ≤ s
In a linearly ordered semiring with the property a ≤ b → ∃ c, a + c = b (e.g. ℕ),
sums of squares are non-negative.