# Difference space?

I'm curious as to whether a certain mathematical structure has a name.

Let's say I have two sets, S and D, and I define a "difference" operation on elements in S which results in an element in D, and an addition operation taking an element of S and D to S, as well as an addition operation on D:

- : S x S -> D
+1 : S x D -> S
+2 : D x D -> D

This pattern fits for several real-world examples:

* The difference between two dates is a time interval. You can add a date and an interval to get a date. You can add two intervals to get an interval.
* The difference between two absolute file paths is a relative path. You can add an absolute path and a relative path to get an absolute path.
* In the C programming language, you can subtract two pointers and get a value of "pointer difference" type. The same concept exists for array indices and an array size type.

This concept seems similar to a metric space, but yet different in that D is not the set of reals, and that elements of D can be somehow "negative".

So my question is: Is there a name for this mathematical concept. Do S and D and the defined operations satisfy the rules for some sort of "space" that has a well-defined name in the mathematical community?

### Re: Difference space?

This seems to be similar to the action of a group on a set.

If G is a group and X is a set, then you have a natural group multiplication

*:G x G -> G

Now G acts on X (on the right) via function
M:X x G -> X

and if this action is "good", which means that for any x,y in X there exists a UNIQUE g in G with the property M(x,g)=y, then this element g can be defined as your "difference" of x and y.

This perfectly fits to your first real-world example. X is a set of all dates, G is a group of all integers (with standard addition), then we have an action of G on X, which sends every date d in X and integer r in G to a date d+r, where r represents (for example) the number of days.

Actually G does not have to be group, it is enough when G is a semigroup (at the very least the associativity must hold).

All in all, it seems that this is rather *algebraic* problem then *topological/metrical/analytic*.

I hope this helps.

joking