The proof makes sense to me intuitively, but I am struggling to understand how you make the jump from “a->b, b->c is a valid path from a->c” to the actual inequality. It makes complete sense to me but is there a way to explicitly explain that the indirect path can only be as or less optimal than the direct path from a to c? ]]>

d(x,z) <= d(x,y) + d(y,z)

]]>rcik

rick

irck

irkc

Gives three transformations for which rcik goes to irkc. This is just the distance computed by going along “the shorter path” in your picture (but in fact, if your algorithm doesn’t take this path then it’s not computing the true Damerau-Levensthein distance! O_o)

The proof that the triangle inequality always holds is not particularly hard: if we transform a string x to a string y, and then to a third string z, then the composition of the operations we performed will always be a valid edit from x right to z, and hence d(x,y) + d(y,z) <= d(x,z). However, if we restrict to the case where we are only allowed to edit each substring *once* (which makes it quite silly to speak of the triangle inequality), then this no longer holds.

]]>