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
By definition of distance:


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

So holds for $d$.

Proof of
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 holds for $d$.

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

So holds for $d$.

Proof of
So holds for $d$.

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