8 ms·
This is probably better known here under the name of implicit type conversions. Strictly speaking, the rational number 1 is not the same as the integer 1; we ju
by generationP 2y ago
This is probably better known here under the name of implicit type conversions. Strictly speaking, the rational number 1 is not the same as the integer 1; we just have a conversion map that preserves all the relevant properties. It's all fun and games until there are 1000 types and 10000 conversion maps involved and the relevant diagrams no longer commute (i.e., it depends what order you go).
- actionfromafar 2y agoI assume you mean any random enterprise codebase? Because that is any random enterprise codebase.
- 082349872349872 2y agoIn other areas, one might compare code jurisdictions, where presumably all the legislative clauses share a common vocabulary (and probably even conceptual framework), with common law jurisdictions, where all the legislative clauses occur in different centuries and thus one adds "picking a parallel transport" between the legal languages of the times (and jurisdictions) to the difficulties of adjudication.
- om8 2y agoNot if you use a language that bans implicit type conversions (like go)
- actionfromafar 2y agoI was thinking in much more abstract terms. You have information from a webflow, at some point converted to an XML message, converted to database entry, again to a JSON document, combined with an Azure workitem, then sent to Salesforce. At any one point the data can interact with other systems, travel through codebases each seeing the data through their types, legacy APIs, the same-(ish) new-(ish) RPC API and in each service the data is represented in its own internal quirky way. Sure, throw Go in that mix, hell at this point the more merrier! :)
- nico 2y agoOr when your formulas on Google sheets start failing because you do 1-1 and the result is not 0, and then you spend 30 minutes creating new sheets, searching the web and double checking everything, until you realize that the value on the cell wasn’t 1, but 1. This happened to me yesterday
- boppo1 2y agoCan you elaborate?
- gatane 2y ago1 vs 1.0 ???
- nico 2y agoNow I noticed that the period at the end of the paragraph is a bit unfortunate The value was 1. which I guess is shorthand for 1.0 and it’s technically not the same value as 1 On top of that, sometimes values like 0.961727 will be shown as 1, so sometimes you think that the value in the cell you are referring to is a 1 but instead it’s something close to it In particular I was making a list of array positions from 1 to 32 and calculating x,y coordinates from the position using the formulas (x = (i-1) % width, y = (i-1)/width) Some of the coordinates were wrong, and it was because the i values were not integers, which I couldn’t tell just by looking at the sheet, and only realized it when double clicked on the cells
- jkaptur 2y agoIt's frustrating that there isn't an easy way to see the "canonical" value and format of a cell (in Sheets or Excel). Just looking at a cell, it's not trivial to see if it's the number 1 or the string 1 (you can enter text by using a leading apostrophe, but that's not the only way to get text in a cell!). Numbers and strings have different alignments by default, but that can be overridden. The numeric value of the string 1 is 0 if you're using the SUM formula, but it's 1 if you use +. In other words, =A1+A2 does not necessarily equal =SUM(A1:A2) Then you can format numbers however you like. For example, dates are stored in spreadsheets as days since an epoch (not the Unix epoch). So you can have the number 2 in a spreadsheet cell, then format it as a date, but just the day of the month, and it can appear as 1. There's rounding, which bit you. 0.95 can appear as 1 if you display fewer decimal places. Finally, there's the fact that the calculation is done like IEEE 754. Programmers are used to floating point numbers and the fact that properties like associativity don't apply, but that's not obvious to everyone.
- paulddraper 2y ago1 is an integer, a rational number, a positive integer, an odd integer, a power of 2, etc.
- sharkbot 2y agoIt's also a complex number, a Unicode character, an ASCII character, an Extended ASCII character, a glyph, the multiplicative identity element, a raster image, ... The GP point is correct; we implicitly convert between all these representations naturally and quickly, but there are interesting branches of mathematics that consider those conversions explicitly and find nuances (eg, category theory).
- kbolino 2y agoBut the integers are a subset of the rationals, which are a subset of the reals, which are a subset of the complex numbers. Looking only at the objects and not their operations 1 (integer) = 1 (rational) = 1 (real) = 1 (complex). Moreover, when we do account for the operations, we also see that 1 + 1 = 2 and 1 * 1 = 1 in every one of those systems. This isn't just a coincidence, of course; it's by design. However, the way you arrive at 1 + 1 = 2 is not the same (though I suppose you could short-circuit the algorithm). Rational addition requires finding a common denominator, while integer addition doesn't. They achieve the same result when the inputs are integers, and again this is by design, but the process isn't the same. Ditto real addition vs. rational and complex addition vs. real. In higher-level mathematics, the operations on the objects become definitional. We don't look at just a set of things, we look at a set of things and the set of operations upon those things. Thus "1 with integer addition and integer multiplication" becomes the object under consideration (even if it's just contextually understood) instead of simply 1. This is why they don't satisfy higher-level notions of equivalence, even if they intentionally do satisfy simple equality as taught in grade school. Of course, the entire point of the submitted paper is to examine this in detail.
- JadeNB 2y ago> But the integers are a subset of the rationals, which are a subset of the reals, which are a subset of the complex numbers. It depends on definitions, and, in some sense, the point of the common approach to mathematics is not just that one does not, but that one cannot, ask such questions. One approach is to look at natural numbers set theoretically, starting with 0 = ∅; to define integers as equivalence classes of pairs of natural numbers; to define rational numbers as equivalence classes of certain pairs of integers; and to define real numbers as equivalence classes of Cauchy sequences of rational numbers. In each of these cases there is an obvious injection which we are used to regarding as inclusion, but most of mathematics is set up to make it meaningless even to ask whether the natural number 1 is the same as the integer 1 is the same as …. That is to say, if you're working on an application where encoding details are important, then you can and will ask such questions; but if I am writing a paper about natural numbers, I do not have to worry about the fact that, for some choice of encoding, the number 2 = {∅, {∅}} is the same as the ordered pair (0, 0) = {0, {0, 0}} = {∅, {∅}}, and in fact it is meaningless to test whether 2 "equals" (0, 0). The philosophy of studiously avoiding such meaningless questions leads some to avoid even testing for equality, as opposed to isomorphism; failing to do so used to be referred to in category-theoretic circles as "evil", although, as the nLab points out if you try to go to https://ncatlab.org/nlab/show/evil https://ncatlab.org/nlab/show/evil , it seems common nowadays to avoid such language.
- reaperman 2y ago> (i.e., it depends what order you go) At the risk of utterly derailing this with irrelevant discussion: path-dependent systems are particularly tricky for some people IMHO. I think in a more state-based way, and my first rigorous dive into path-dependent calculation was during my chemical engineering degree -- I learned to be extremely vigilant about memorizing what was path-dependent and triple-checking if that affected the situation I was calculating. I do wish there was more rigorous exposure to them at lower levels of education and younger age. Because while I'm perfectly capable of handling path-dependent systems with proper focus and effort, my brain doesn't feel "native" when deriving solutions around those spaces - it feels similar to being "fluent enough" in another language. I feel this way about a lot of things -- I really feel I'd have been happier and more fulfilled if I'd been immersed in super rigorous first-principles education beginning around age 8-9. I didn't do well with things like "memorize this procedure for doing long division" and did much better with conceptual derivations of physics/math/science/historical arcs, etc.
- generationP 2y agoThe problem is that no one thinks of type conversions as taking any explicit paths! It's one thing to view the actual process of long division as path-dependent (something everyone who learns about Gröbner bases is familiar with, as at the right level of generality even the result is path-dependent); it's another thing to apply the same intuition to the way the inputs are parsed. (You said divide 3 by 2 with remainder? Sure, the quotient is 3/2 and the remainder is 0. Problem?)
- reaperman 2y ago> The problem is that no one thinks of type conversions as taking any explicit paths! Indeed. This is super surprising to me and I’m adding the topic to my “study” list. I had no idea until today - I easily could imagine it’s possible if some of the type conversions are “lossy” (e.g. maps to lists), but I have a strong feeling that simpified lossy conversions are not what is being referenced.
- generationP 2y ago
- belter 2y ago> Strictly speaking, the rational number 1 is not the same as the integer 1 So does that mean you can have different 0 zero's ?
- lupire 2y agoYes
- gerdesj 2y agoNote how your parent comment has specified "rational" 1 and "integer" 1. They use the symbol 1 for two similar concepts: We all "know" that 1 + 1 = 2 and 1.0 + 1.0 = 2.0. I have deliberately specified 1 for an int and 1.0 for a rational. Now we have two different representations for two very similar but not identical concepts. At which point does 1 + a tiny amount cease to be an integer? By definition that tiny amount can have any magnitude and 1 plus anything will cease to be an integer. That is the property that defines an integer. Integers have subsequent "behaviours" that other types of numbers might lack. You have picked zero/0. Now that is a sodding complicated concept 8) There are lots of things called zero but no more nor less than any other. Zero might be defined by: 1 - 1 = 0. I have £1 in my bank account and I pay out £1 for a very small flower, my bank balance is now £0. Lovely model, all good except that interest calcs intervened and I actually have a balance of £0.00031. Blast. My pretty integer has morphed into a bloody complicated ... well is it a rational thingie or a ... what is it? Now I want to withdraw my balance. I put a shiny £1 in, bought something and I have some change. What on earth does a 0.031p coin look like? Obviously, it doesn't exist. My lovely integer account has gone rational. Symbols mean what we agree on with some carefully and well chosen language. Mathematicians seem to think they are the ultimate aces at using spoken and written language to make formal definitions, derivations and so on. That is a bit unfair, obviously. We all believe that what we think is communicable in some way. Perhaps it is but I suspect that it isn't always. Have a jolly good think about what zero, nothing, 0 and so on really mean. Concepts and their description to others is a really hard problem, that some funky symbols sort of helps with. Yes there are loads of things called zero. If I had to guess: infinitely things are zero! Which infinity I could not say.
- eru 2y agoYes. 0/1, 0/2, 0/3 are all different in some sense, but they belong in the same equivalence class.
- zarzavat 2y agoThis doesn’t sound right to me. The rational numbers are a superset of the integers. We know that there’s only one 1 in the rational numbers, then it must be the same 1 object as the 1 in the integers. The statement “3/3 is in Z” is true. There’s no conversion happening: 3/3 is a notation for 1, just like 0.999… is a notation for 1. Many notations, but only one 1 object. The case of R x R^2 = R^3 is different because the Cartesian product is defined to produce a set of ordered pairs. So it cannot give rise to a set of triples any more than a dog can give birth to a cat. So either x is not a Cartesian product or = is isomorphism not equality.
- perforator 2y agoYour statements such as > We know that there’s only one 1 in the rational numbers, then it must be the same 1 object as the 1 in the integers. > The statement “3/3 is in Z” is true. make it sound very trivial while in reality it is not. I do not quite understand your example with R^3 but the defined applies equally to your statements. There are many ways to define and think about the objects you mentioned -- there is not one single truth. Unless you are a devoted platonist, in which case, it's still like your opinion, man.
- ndriscoll 2y agoQ is (usually) a set of equivalence classes of ZxZ\{0}, so obviously it's not a superset of Z since they're not even the same types of things. There is however a canonical embedding of Z into Q, sending n to the class of (n,1).
- tobbe2064 2y agoMost people define it as the smallest set extending (the smallest set extending Z\{0} where * is invertible) where + is invertible
- red_trumpet 2y agoBut such a set is not unique...
- 2y ago
- AlecBG 2y agoI'm not sure I agree. That sort of type conversion involves inclusions, while the examples Buzzard talked about involved isomorphisms
- types_vs_sets 2y agoInclusions are a form of isomorphism. In the more common developments of elementary arithmetic, Q is constructed from Z, and in particular the subset of integral rational numbers are technically a different ring from Z. The conversion Z \to Q in particular is an isomorphism from Z to that subset. Type conversions in every day programming languages though sometimes not only fail to be surjective, they can also fail to be injective, for example int32 -> float32. type-conversions and "implicit isomorphisms" differ because the former does not need to be invertible, but they agree in that they are implicit maps, that are often performed without thought by the user. So I think that the type-conversions analogy is pretty good in that it captures the idea that implicit conversions, when composed in different ways from A to B, can arrive at various values, even if each stage along the way the choices seemed natural.