Skip to content

Commit

Permalink
Generalise definition
Browse files Browse the repository at this point in the history
  • Loading branch information
artie2000 committed Aug 21, 2024
1 parent a53848e commit 5fa2878
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions Mathlib/Algebra/Ring/Semireal/Defs.lean
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
/-
Copyright (c) 2024 Florent Schaffhauser. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Florent Schaffhauser
Authors: Florent Schaffhauser, Artie Khovanov
-/
import Mathlib.Algebra.Ring.SumsOfSquares
import Mathlib.Algebra.Order.Ring.Defs

/-!
# Semireal rings
A semireal ring is a non-trivial commutative ring (with unit) in which `-1` is *not* a sum of
squares. Note that `-1` does not make sense in a semiring.
A semireal ring is a commutative ring (with unit) in which `-1` is *not* a sum of squares.
For instance, linearly ordered fields are semireal, because sums of squares are positive and `-1` is
not. More generally, linearly ordered semirings in which `a ≤ b → ∃ c, a + c = b` holds, are
semireal.
not. More generally, (nontrivial) linearly ordered semirings
in which a ≤ b → ∃ c, a + c = b holds are semireal.
## Main declaration
Expand All @@ -28,19 +28,19 @@ semireal.
variable (R : Type*)

/--
A semireal ring is a non-trivial commutative ring (with unit) in which `-1` is *not* a sum of
squares. Note that `-1` does not make sense in a semiring. Below we define the class `IsSemireal R`
for all additive monoid `R` equipped with a multiplication, a multiplicative unit and a negation.
A semireal ring is a commutative ring (with unit) in which `-1` is *not* a sum of
squares. We define the class `IsSemireal R` for all structures equipped with
a multiplication, an addition, a multiplicative unit and an additive unit.
-/
@[mk_iff]
class IsSemireal [AddMonoid R] [Mul R] [One R] [Neg R] : Prop where
non_trivial : (0 : R) ≠ 1
not_isSumSq_neg_one : ¬IsSumSq (-1 : R)
class IsSemireal [Add R] [Mul R] [One R] [Zero R]: Prop where

This comment has been minimized.

Copy link
@jcommelin

jcommelin Aug 22, 2024

Member

Please put a space before the :

not_isSumSq_neg_one : ¬ ∃ a : R, IsSumSq a ∧ a + 1 = 0

This comment has been minimized.

Copy link
@jcommelin

jcommelin Aug 22, 2024

Member

Is the exact logical phrasing important (for non-classical applications)?
Otherwise I would push_neg this: \forall a : R, IsSumSq a -> a + 1 \ne 0 or something like that.

This comment has been minimized.

Copy link
@artie2000

artie2000 Aug 22, 2024

Author Collaborator

Yeah oops your definition is actually intuitionistically equivalent to the old one in the case that -1 exists, and mine is not!


@[deprecated (since := "2024-08-09")] alias isSemireal := IsSemireal
@[deprecated (since := "2024-08-09")] alias isSemireal.neg_one_not_SumSq :=
IsSemireal.not_isSumSq_neg_one

instance [LinearOrderedRing R] : IsSemireal R where
non_trivial := zero_ne_one
not_isSumSq_neg_one := fun h ↦ (not_le (α := R)).2 neg_one_lt_zero h.nonneg
instance [LinearOrderedSemiring R] [ExistsAddOfLE R] : IsSemireal R where
not_isSumSq_neg_one ex :=
Exists.elim ex (fun _ hyp ↦ zero_ne_one' R
(le_antisymm zero_le_one (le_of_le_of_eq (le_add_of_nonneg_left hyp.1.nonneg) hyp.2)))

0 comments on commit 5fa2878

Please sign in to comment.