Proof (positive solution for word problem for noncontracting grammars)

Let $G$ be a noncontracting grammar.

Upper bound for length of derivation of $w\in \mathcal{L}(G)$

Suppose $w\in \mathcal{L}(G)$. Then there exists a derivation $(σ_0, σ_1, \ldots, σ_n)$ such that $σ_0 = S$ and $σ_n = w$. Take $n$ to be minimal.

Since $G$ is noncontracting, $|σ_i| \leq |σ_{i+1}|$, so the lengths of strings in the derivation is non-decreasing.

For a fixed length $m$, there are exactly $|Ω|^m$ such strings. By the pigeonhole principle, if there are more than $|Ω|^m$ strings of length $m$ in the derivation, then one of them must repeat. But then the derivation can be shortened by removing the loop, contradicting with minimality of $n$. Thus the derivation contains at most $|Ω|^m$ strings of length $m$.

This gives an upper bound on the length of the entire derivation $$ \begin{align*} n\leq N := \sum_{i=1}^{|w|} |Ω|^i. \end{align*} $$

The algorithm

Given $w$ and $G$, compute $N$.

Write down all derivations of length $N$.

If one of them produce $w$, output "Yes". Otherwise, output "No".