News for hackers. Stuff that matters.
Re:Division by zero in type theory: a FAQ by ragnese on Monday July 06, 2020 @04:55PM (#23752657)
f(x) = 1/x is also defined over what we call the "extended reals" which is just R + inf.

But, I don't think what you said is quite right, either. If you define f(x) = 1/x over the non-zero reals, then the range does have the same type as the domain- you can't get zero out of the function, so the range is also the non-zero reals.

Re:Division by zero in type theory: a FAQ by thaumasiotes on Monday July 06, 2020 @05:20PM (#23752881)
> f(x) = 1/x is also defined over what we call the "extended reals" which is just R + inf.

Not quite. The extended reals are ℝ + {inf, -inf}. This has the problem that 1/x approaches inf from the right and -inf from the left.

As ogogmad notes, in order to define a value for 1/x at 0, you need the projectively extended reals.

Re:Division by zero in type theory: a FAQ by enriquto on Tuesday July 07, 2020 @05:31AM (#23757288)
> Not quite. The extended reals are (...)

You are both right. There are several, different, extensions of the reals. The "projective" extension turns the real line into a (topological) circumference by adding a single point at infinity. The "affine" extension turns it into a closed segment by adding two infinities, one at each end; this corresponds to the convention used by ieee floating point numbers. There are many more extensions, like complex numbers, dual numbers, p-adic numbers, and in many of them (except complex numbers) you have various kinds of divide-by-zero fun.

Re:Division by zero in type theory: a FAQ by jacobolus on Monday July 06, 2020 @07:42PM (#23754044)
Extending the real numbers with 1 vs. 2 points at infinity both have applications where they model real situations.

For example, if we take a mercator projection of the globe onto a 2-infinite-ended cylinder, the latitude coordinate could meaningfully be either +∞ or –∞. If we take the stereographic projection of the globe onto the plane, every pair of coordinates with one infinite value corresponds to the same point on the sphere.

Re:Division by zero in type theory: a FAQ by ogogmad on Monday July 06, 2020 @05:07PM (#23752769)
The codomain doesn't have to equal the image. The image is the non-zero reals, but the codomain could be any superset of it (including all of R). The word "range" is ambiguous.
Re:Division by zero in type theory: a FAQ by ragnese on Tuesday July 07, 2020 @06:34AM (#23757651)
Thank you. I've forgotten some of the terminology, since I haven't thought about real math in a few years. :(
Re:Division by zero in type theory: a FAQ by contravariant on Monday July 06, 2020 @05:10PM (#23752794)
There's no real problem with defining the codomain to be too big. Although you can indeed also pick the non-zero reals as the co-domain.