Open fingolfin opened 1 month ago
Proposals for package name:
While mathematically an infinity isn't a real number
As you mentioned: Julia types are not the same as mathematical sets. I think they are best thought of as encoding an "interface" and anything that follows the rules of the interface can be subtype. Eg. in ForwardDiff.jl we also have Dual <: Real
which of course is mathematically nonsense but makes perfect sense (and is essential) in terms of the interface.
I don't exactly remember why we defined Infinity <: Real
instead of Infinity <: Number
or indeed Infinity <: Any
. This can probably be changed without any serious side-effects.
No we have no interest in that. It just makes maintenance harder for us with no real benefit. As you pointed out, there is already a package for infinites that people who don't want to use AA/Nemo/Oscar can use, and which deliberately are not using.
In particular our infinity is not a subtype of Real. That's not a bug, it's a feature.
"Consistent hashing" of infinities to me also sounds like a red herring, not a useful feature in itself.
Sorry, I just checked, and equality, and I guess also other comparisons and hashing, are already correct.
Another package that features a singleton real infinity is Infinities.jl.
IMO it'd be nice to extract Nemo's src/Infinity.jl into a new package, then have all mentioned packages depend on it, for greater compatibility within the ecosystem. This would ensure the comparisons and hashing all are correct across packages.
cc @dlfivefifty @jishnub
There's one thing that I'd say needs to be changed in src/Infinity.jl, the supertype should be
Real
instead ofAny
:https://github.com/Nemocas/Nemo.jl/blob/6848ca3c61abd6aa67d55902b826a2b404587765/src/Infinity.jl#L9-L10
While mathematically an infinity isn't a real number, in the context of the
Number
type hierarchyReal
should supertype the infinities, because the positive infinity is defined as being equal toInf
, which isFloat64
, which subtypesReal
, similarly with the negative infinity type. This would also be necessary for compatibility with Infinities.jl, I guess.I guess the new package would most appropriately live under JuliaMath?
Thoughts?