
Jeff Garland wrote:
On Mon, 10 Oct 2005 23:22:24 -0400, Deane Yang wrote
Jeff Garland wrote:
Wow, that's amazing. Replace quantity_vector with time_duration and quantity_point with time_point and you have the core concepts behind date-time. And the 32 versus zero -- seems an awful lot like an epoch_time adjustment. So I suppose I'm saying I believe there is something fundamental here :-)
Yes, there is.
If you dig back in the archives, I tried to explain it all before, but obviously not very well.
(stuff deleted)
Sorry if I missed or didn't respond to your comments the first time.
Definitely understandable.
However, I now have reasons to be more interested in the theoretical foundations. Specifically, the LWG committee is rightly an intense group that needs to ensure the quality and correctness of things that get added to the standard -- having additional theoretical foundations for the date-time concepts can't hurt. Any chance you can point me to some sort of references (preferably readable to folks that have only taken ~15 college math courses ;-)
Here's a brief summary of the idea (assuming that you learned about vector spaces (http://en.wikipedia.org/wiki/Vector_space) in linear algebra) (In anything you read about vector and affine spaces, if they say "field F", just assume that F is the set of real numbers): A "dimension" or, as Matt calls it, a "point quantity" or, as you call it the set of "time_points", without choosing any particular unit, corresponds to the mathematical concept of an "affine line" or an "1-dimensional affine space" A (see http://en.wikipedia.org/wiki/Affine_space). Associated with any "point quantity" or "dimension" or the set of "time_points" is the set of all possible differences between two points. Matt calls this a "vector quantity"; you call it the set of "time_durations"; mathematicians call it the (1-dimensional) vector space (http://en.wikipedia.org/wiki/Vector_space) associated with the affine space. Assigning (relative) units to a vector quantity corresponds to fixing a nontrivial real-valued linear function f: R -> V on the vector space V. Think of V as a straight line with the "zero vector" marked and the map f as like putting a ruler on top of the straight line, assigning a real number to each point on the line. Notice, however, that you have to line up the ruler so that the 0 on the ruler is placed against the zero-vector. So your only flexibility in what you do is stretching or shrinking the ruler. Assigning (absolute) units to a point quantity corresponds to fixing a non-trivial affine map (http://en.wikipedia.org/wiki/Affine_transformation) f: R -> A, where A is the set of all possible values of the point quantity. Think of A as a competely blank straight line and the map f as putting a ruler on top of the line. This time, since the line is blank, you can slide the ruler along the line and put the 0 on the ruler against any point on A. So you have more flexibility with your units; you can stretch, shrink, or slide the ruler. Unit casting corresponds to the situation where you have two different rulers you want to use, and you need to convert a number on one ruler into the corresponding number on the other. For vector quantities, you just need to multiply the number by a fixed proportionality constant. For point quantities (temperature is the best example here), you might also need to do an addition or subtraction, too. You can always turn any vector space V into an affine space, by simply "forgetting" where the zero vector is. You can always turn any affine space into a vector space V by arbitrarily choosing a point in A and declaring it to be the zero vector.