Distance between Linear Codewords is Distance Function

Theorem
Let $\map V {n, p}$ be a master code.

Let $d: V \times V \to \Z$ be the mapping defined as:
 * $\forall u, v \in V: \map d {u, v} =$ the distance between $u$ and $v$

that is, the number of corresponding terms at which $u$ and $v$ are different.

Then $d$ defines a distance function in the sense of a metric space.

Proof
It is to be demonstrated that $d$ satisfies all the metric space axioms.

Let $u, v, w \in \map V {n, p}$ be arbitrary.

Proof of $M1$
By definition of distance:


 * $\map d {u, u} = 0$

So axiom $M1$ holds for $d$.

Proof of $M2$
Consider $\map d {u, v} + \map d {v, w}$.

Let $\map d {u, w} \ne 0$.

Then at each term at which $u$ and $w$ are different, those corresponding terms in either $u$ and $v$ or $v$ and $w$ must be different.

So every contribution to the value of $\map d {u, w}$ is present in either $\map d {u, v}$ or $\map d {v, w}$.

It follows that $\map d {u, v} + \map d {v, w} \ge \map d {u, w}$.

So axiom $M2$ holds for $d$.

Proof of $M3$
$\map d {u, v} = \map d {v, u}$ by definition of distance.

So axiom $M3$ holds for $d$.

Proof of $M4$
So axiom $M4$ holds for $d$.

Thus $d$ satisfies all the metric space axioms and so is a metric.