Where have you seen a similar argument?
In the Floyd algorithm for the shortest path (see section 9, p. 125).