# Reverse the input and output of a Mealy machine

Given a Mealy machine $M$, is it possible to construct another Mealy machine $M'$ that generates the reverse outputs from the reverse inputs, and if so, how?

That is, for each string $s$, $M(s) = t$ iff $M'(s') = t'$, where $s'$ is $s$ reversed and $t'$ is $t$ reversed.

For example, if $M(abcd")$ is $efgh"$ then $M'(dcba")$ should be $hgfe"$.

If we have this, then there is only a finite number of different input strings. If $M'$ is actually well-defined, then it is possible to build such a Mealy machine. But $M'$ may not be well-defined. For example if $M(\textit{abcd}) = \textit{efgh}$ and $M(\textit{cd}) = \textit{he}$, then we have $M'(\textit{dcba})=\textit{hgfe}$ and $M'(\textit{dc}) = \textit{eh}$. By the definition of Mealy machine, this also means however that $M'(\textit{d})=\textit{h}$ and $M'(\textit{d}) = \textit{e}$, which is a contradiction.