A word is cubefree if it cannot be written as $xyyyz$ where $y$ has positive length.


Let $h$ be the morphism from $\{0,1,2,3,4\}^\*$ to $\{0,1\}^\*$ given for words of length 1 as follows ($a\to h(a)$):
$$0\to 001001010011$$
$$1\to 001001101011$$
$$2\to 001010011011$$
$$3\to 001101001011$$
$$4\to 010011001011$$
and extending to longer words by the morphism property $h(xy)=h(x)h(y)$.


Is it cubefree-preserving? That is, if $x$ is cubefree then is $h(x)$ cubefree?


(I checked that it is so for $x$ of length at most 8; in general there is no finite test set by a result of Richomme and Wlazinski, but maybe there's something special about this case.)


And if not this map...



> 
> does there exist *any* cubefree-preserving map from an alphabet of size 5 to an alphabet of size 2?
> 
> 
> 



A cubefree-preserving morphism from 5 to 2?
An $\infty$ to 2 (hence 5 to 2) cube-free morphism was constructed by Bean-Ehrenfeucht-McNulty. The fact that your morphism is cube-free follows from their theorem. See Theorem 2.4.1 of my book "Combinatorial Algebra:syntax and semantics".


