Zulip Chat Archive
Stream: mathlib4
Topic: Formally real fields
Artie Khovanov (Aug 13 2024 at 19:09):
Is there anything in Mathlib on the relationship between formally real fields [-1 not a sum of squares] and [linear] ordered fields? I see that a notion of positive cones has been defined for groups and rings; is there anything more?
(I think this notion can be extended to formally real rings, I could implement that too if people want)
Kim Morrison (Aug 14 2024 at 02:16):
I don't think there is. Sounds reasonable!
Riccardo Brasca (Aug 14 2024 at 03:41):
We already have the notion of formally real field. cc @Flo (Florent Schaffhauser)
Artie Khovanov (Aug 14 2024 at 17:53):
Where is this defined? I can't find it from a quick search.
Florent Schaffhauser (Aug 15 2024 at 08:03):
Hi @Artie Khovanov :wave:
Sorry, I am not fully available these days. We had a repo on formally real fields here:
https://github.com/riccardobrasca/formally_real
And in Mathlib, we have the following:
The repo on @Riccardo Brasca 's GitHub contains a proof that a field is formally real iff it admits an ordering compatible with field structure (Artin-Schreier theory). Would you be interested in working jointly on getting this into mathlib? We could meet over Zoom to discuss this, or manage it via DM :smile:
Yaël Dillies (Aug 15 2024 at 13:13):
@Riccardo Brasca, it's good practice to include a licence in your repo so that we know we can PR stuff from it to Mathlib. Of course, we should also ask you first, but in the event of a really long beach enjoyment session on your part it's good to know that we can get those juicy positive cones in
Floris van Doorn (Aug 15 2024 at 17:12):
As an outsider looking at the definition of docs#IsSemireal, why have we included the condition that 0 ≠ 1
? In any type where -0 = 0
holds, this follows from ¬IsSumSq (-1)
and the definition of IsSumSq
. And surely we don't care about types where -0 = 0
fails.
Scott Carnahan (Aug 15 2024 at 22:35):
I also find the definition of docs#IsSemireal a bit odd, for orthogonal reasons: we could replace ¬IsSumSq (-1 : R)
with something like ¬∃ (x : R), IsSumSq x ∧ x + 1 = 0
and avoid [Neg R]
altogether.
Artie Khovanov (Aug 15 2024 at 23:16):
I agree with both of these objections; I want to refactor the two files on cones and IsSemireal to make them easier to use and more general, as well as integrating the additional material on formally real fields.
Artie Khovanov (Aug 21 2024 at 23:00):
I generalised the IsSemireal file using @Floris van Doorn and @Scott Carnahan's suggestions. Here is my draft:
https://github.com/leanprover-community/mathlib4/commit/5fa28782c709f9db08987f052a348af91c9330f2
I welcome any feedback -- I will hopefully be building on this to integrate @Riccardo Brasca's work in the future.
Johan Commelin (Aug 22 2024 at 06:33):
Thanks, I left two comments on GH
Artie Khovanov (Aug 22 2024 at 12:29):
Have updated accordingly.
Johan Commelin (Aug 22 2024 at 12:35):
Is your code on some branch? (I don't know how to find your new commit)
Artie Khovanov (Aug 22 2024 at 12:39):
Oh sorry
It's the real-closed-field-dev
branch:
https://github.com/leanprover-community/mathlib4/tree/real_closed_field_dev
Artie Khovanov (Aug 22 2024 at 17:13):
I want to replace the definition of sumSqIn
with multiple definitions for the various structures (AddMonoid, Semiring, RingCone) called AddMonoid.sumSqIn
etc.
@Riccardo Brasca I belive you were the one that made sumSqIn
be defined as a monoid; will this change fundamentally break anything downstream? At worst I think this would require renaming some stuff, but I am inexperienced with the design of the library.
Artie Khovanov (Aug 22 2024 at 17:13):
By the way my PR rewriting positive cones is about to go live:
https://github.com/leanprover-community/mathlib4/pull/15975
Eric Wieser (Aug 22 2024 at 17:21):
I worry a little about how many new structures that PR introduces, because every new structure creates quite a big API burden. On the other hand, that doesn't mean that it's the wrong approach, just that we should have more machinery to make it more obviously the right approach!
Artie Khovanov (Aug 22 2024 at 17:23):
The new structures I have added are the multiplicative versions of the group cones, and also the cones with squares, which I will need for the formally real field stuff.
The other structures already existed, but I rewrote them to have a more standard definition and also to extend Submonoid and Subsemiring to make them easier to work with.
Artie Khovanov (Aug 22 2024 at 17:34):
By the way, what alternatives are there to structures in this sort of situation?
Eric Wieser (Aug 22 2024 at 17:36):
One option is to have fewer structures and more predicates; for instance, we don't have a structure for "injective linear maps", you have to pass the linear maps and Function.Injective
separately
Eric Wieser (Aug 22 2024 at 17:36):
That's not to say this is a better choice in your situation
Artie Khovanov (Aug 22 2024 at 17:37):
Oh I see what you mean. Having predicates for the Maximal
and WithSquares
forms would be fine, I'm pretty indifferent.
Artie Khovanov (Aug 22 2024 at 19:15):
Should I refactor it to that? Or is it good as is?
Artie Khovanov (Aug 23 2024 at 00:25):
Artie Khovanov said:
I want to replace the definition of
sumSqIn
with multiple definitions for the various structures (AddMonoid, Semiring, RingCone) calledAddMonoid.sumSqIn
etc.
Riccardo Brasca I belive you were the one that madesumSqIn
be defined as a monoid; will this change fundamentally break anything downstream? At worst I think this would require renaming some stuff, but I am inexperienced with the design of the library.
Update: a draft of my additions is available at
https://github.com/leanprover-community/mathlib4/blob/real_closed_field_dev/Mathlib/Algebra/Ring/SumsOfSquares.lean
(Compare: https://github.com/leanprover-community/mathlib4/compare/real_closed_field_dev)
Artie Khovanov (Aug 23 2024 at 13:08):
Update: here is my PR
https://github.com/leanprover-community/mathlib4/pull/16094
Johan Commelin (Aug 23 2024 at 13:09):
Note that you can simply write #16094. (For some value of simply.)
Johan Commelin (Aug 23 2024 at 13:13):
@Artie Khovanov please update the title of the PR to follow the commit guidelines: https://leanprover-community.github.io/contribute/commit.html
Artie Khovanov (Aug 23 2024 at 13:15):
Have now changed the title
Artie Khovanov (Aug 23 2024 at 13:15):
My branches have silly names but that's because I made them before Yael convinced me to use a sane workflow.
Last updated: May 02 2025 at 03:31 UTC