Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IntegerInfinity #9

Open
dlfivefifty opened this issue Feb 15, 2021 · 7 comments
Open

Add IntegerInfinity #9

dlfivefifty opened this issue Feb 15, 2021 · 7 comments

Comments

@dlfivefifty
Copy link
Member

I think we could use more type:

struct IntegerInfinity <: Integer
   signbit::Bool
end

This will be almost identical to RealInfinity but confirm to the Integer interface, and can be viewed as the limit of integers.

@fingolfin
Copy link

How would that be different, though, mathematically? Why not simply have RealInfinity be an Integer?

@dlfivefifty
Copy link
Member Author

RealInfinity would correspond to the limit through any real number, where IntegerInfinity would be through the integers

@fingolfin
Copy link

I don't see how that is mathematically useful. Do we then also get "infinities" through e.g half-integers or multiples of pi or along square integers or ...?

@Keno
Copy link

Keno commented May 31, 2022

I wanted something similar, but I'm a bit worried about making an Integer infinity <: Integer, since Integer at the moment pretty firmly means finite. That said, as a practical matter, there are a lot of cases where ℤ ∪ ∞ makes sense, but arbitrary reals do not. Perhaps we need another intermediate level between Real and Integer in base where RealInfinity fits.

@dlfivefifty
Copy link
Member Author

We already have InfiniteCardinal <: Integer so here it is not the case that Integer means finite. This is needed since array lengths are assumed to be Integer.

My feeling is Integer has an interface and as long as a type satisfies the interface it’s fine. So it’s distinct from the mathematical definition of integers, in the same way we are OK that Inf isa Real. Unfortunately none of these interfaces are written down.

@putianyi889 putianyi889 mentioned this issue Mar 29, 2023
@fingolfin
Copy link

Just to say that Julia's Integer indeed is different from mathematical integers even in stock Julia: I mean, Int is a subtype, and its elements are not mathematical integers (rather, they are elements of a residue ring $\mathbb{Z}/n\mathbb{Z}$ for some $n$).

I still don't understand the argument about a "limit through the reals" and how that would differ from a "limit through integers" in any useful mathematical way -- not saying there isn't one, but I think it would be important to record this kind of reasoning somewhere in the package documentation. Or revise it if it turns out to be not the case.

@dlfivefifty
Copy link
Member Author

Here would be an example where the difference makes sense: sinpi(IntegerInfinity()) would return zero where sinpi(RealInfinity()) would be NotANumber()

I agree this package needs more thorough documentation and the logic explained, however, I created it for my own practical needs (InfiniteArrays.jl and InfiniteLinearAlgebra.jl) and don’t have the time to write documentation.

Any contributions would be appreciated! But we just need to make sure we don’t break the practical usage for the sake of “mathematical purity” since theres a difference anyways between types in Julia and usual set theory constructions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants