Shortlex order

Definition (shortlex order on word) open_in_new

Suppose the finite alphabet $Σ$ comes with some ordering $<$.

The shortlex order is an order relation on $\mathbb{W}$ defined so that if $w = b_0 \ldots b_k, v = c_0 \ldots c_l\in \mathbb{W}$, $w<v$ iff $|w|<|v|$, or $|w| = |v|$ and $w\neq v$ and for $i$ minimal such that $b_i\neq c_i$, we have $b_i < c_i$.

  • It is a total order: irreflexive (no $w$ satisfies $w<w$), transitive (if $u<v<w$, then $u<w$) and trichotomous (either $v<w$ or $w<v$ or $v=w$).

  • $ε$ is the minimal element.

Theorem (shortlex order isomorphic to natural number) open_in_new

The shortlex order $(\mathbb{W}, <)$ is isomorphic to $(\N, <)$.

Proof

We use $\#(w)$ to denote the natural number assigned to $w\in \mathbb{W}$ by the canonical isomorphism.

Proposition (computability of shortlex ordering) open_in_new

Let $<$ be the shortlex order.

  • The characteristic function of $\sb{(v,w)}{v<w}$ is computable.

  • The function $s(w) = v$ where $v$ is the $<$-immediate successor (i.e. $\#(v) = \#(w)+1$) is computable.

Proof