Zulip Chat Archive
Stream: condensed mathematics
Topic: nonneg
Johan Commelin (May 15 2021 at 14:43):
Here is a little (big) project for anyone who's interested. (Maybe Damiano even has some code in this direction already, I think we experimented with this on the toric branch.)
- Define
nonneg A
, whenever[has_zero A] [has_le A]
. Add acoe
toA
. - If
A
is anordered_add_monoid
, so isnonneg A
. - If
A
is anordered_add_group
, thennonneg A
is cancellative. - If
A
is anordered_semiring
, so isnonneg A
. In this casenonneg A
is alsocomm_monoid_with_zero
(even an ordered one, do we have a class for that?) - If
A
is anlinear_ordered_field
, thennonneg A
is alinear_ordered_comm_group_with_zero
- Define an ordered ring equiv between
nat
andnonneg int
- Refactor
nnreal
to use this machinery. - Define
nnrat
to benonneg rat
Johan Commelin (May 15 2021 at 14:44):
We already have nnrat
in LTE, thanks to Bhavik and Yael's work on Gordan.
Johan Commelin (May 15 2021 at 14:44):
It seems time that we abstract these constructions.
Adam Topaz (May 15 2021 at 14:45):
Johan Commelin said:
- Refactor
nnreal
to use this machinery.
:expressionless:
Damiano Testa (May 15 2021 at 14:45):
Actually, this is something that I was planning to do for the ordered
refactor. Once you get to a type with add and mul and \le, multiplication is monotone only by the non-negative elements. Thus, my plan was to define the type of nonnegative elements of exactly what you said and start proving stuff about this!
Damiano Testa (May 15 2021 at 14:45):
It is even in one of the PR messages! :smile:
Damiano Testa (May 15 2021 at 14:47):
... and it did start in order to prove stuff for nnreal, arising from liquid, both from the toric side and from the real inequalities side!
Damiano Testa (May 15 2021 at 14:48):
By the way, the first PR in the ordered
refactor has already received positive comments from Anne and Floris. In case anyone is interested in taking a look, this is the current winner:
#7371 :wink: :upside_down:
Damiano Testa (May 15 2021 at 14:52):
(and don't feel daunted by the size of the PR: the 442 removed lines are essentially lemmas that changed files. The PR really only contains fewer than 300 new lines, most of which are doc-strings.)
Damiano Testa (May 18 2021 at 02:56):
Now that the PRs splitting the ordered hierarchy have (mostly) taken care of monoids and groups, the next on the list is rings. In this case, the assumption on monotonicity for addition is already there, but the assumption on monotonicity of multiplication is going to require a non-negativity/positivity assumption on the multiplier.
For flexibility, given the experiment in the liquid project, I would set this up as a function from a Type to a [Type with le
and zero
] such that the function is injective and the elements in the image are... non-negative? Positive?
-
Pro of non-negative/Con of positive
mostly, the source could be assumed to be, for instance, a semiring, which could come in handy, e.g. when saying that we multiply a real number by a nnreal number (or anat
!). -
Con of non-negative/Pro of positive
for roughly half the statements, there would have to be a non-zero assumption on the (image of the) multiplier, instead of a single check when setting up the action.
Which of these two do you think outweighs the other? Is there something else that you think could be a deciding factor?
Thanks!
PS The second refactor is #7645, freshly opened!
Johan Commelin (May 18 2021 at 03:14):
The first option is the more flexible/general one, right?
Damiano Testa (May 18 2021 at 03:17):
I think so: the first option includes all second options, plus the ones which happen to have zero in the image. I am just worried of a lot of ne_zero
showing up in proofs and names of lemmas.
Damiano Testa (May 18 2021 at 03:17):
Although, I think that this already happens and is also my preference.
Damiano Testa (May 18 2021 at 03:19):
An alternative, would be to define semiring_without_zero
... :upside_down:
Johan Commelin (May 18 2021 at 03:20):
semi_rig
?
Damiano Testa (May 18 2021 at 03:20):
I see where this is going...
Johan Commelin (May 18 2021 at 03:20):
I guess that would be a distrib_with_one
?
Damiano Testa (May 18 2021 at 03:21):
:lol: Indeed! Although I want to make sure that we are just joking around, right? :lol:
Damiano Testa (May 18 2021 at 03:22):
A philosophical question could be to ponder about the positive elements in semi_rig
.
Last updated: Dec 20 2023 at 11:08 UTC