I think the missing element is this: you need to establish that the domain that you are trying to measure is a metric space before trying to measure distance using this formula.
http://en.wikipedia.org/wiki/Metric_space
edit: read the second section on how to establish something is a metric space. (in the wiki article)