History of the question. I was proposing a conjecture here, called Prop. 1. Fedor Pakhomov showed a counter-example. Here I am proposing a slightly weaker version of the conjecture, Prop. 2, that holds for that counter-example and is still apparently hard to prove. An old version of the problem is also here.
Here is the question. We have two functions, $ f: \{0,1\}^* \to \{0,1\}^* $ and $ g: \{0,1\}^* \to \{0,1\}^* $, that commute: $$ f[g(x)] = g[f(x)] $$
These two functions can be calculated in polynomial time (in the length of the input). Moreover, the outputs have the same length of the inputs: $|f(x)| = |x|$ and $|g(x)| = |x|$ .
A trivial example of functions that commute can be easily constructed by splitting the strings into two parts and defining: $$ f(x,y) = ( h(x), y ) $$ and $$ g(x,y) = ( x, l(y) ) $$ where the functions $h(x)$ and $l(y)$ can be calculated in polynomial time (in their inputs).
I was able to construct slightly more complex examples, but not much more complex. An ingenious example is shown by Fedor Pakhomov as an answer to my previous question. However, in all the examples, the evolution obtained by repeatedly applying $f$ seems to be either independent of the evolution obtained by repeatedly applying $g$, or exactly the same. More rigorously, in the examples I have seen, the following proposition holds:
Proposition 2
For every polynomially-computable commuting functions $f$ and $g$ preserving the string length, there is an algorithm that gets as input the binary representation of two integers, $n$ and $m$, and a string $x$; it calculates the function $f^n[g^m(x)]$, operating in polynomial time (in the length of its input); it accesses at most once an oracle that calculates $f^{n'}(y)$ and $g^{m'}(z)$ (both), with some desired $n'$, $m'$, $y$, and $z$.
Important note The expression $f^n$ means $f$ applied $n$ times. For example $f^2(x)$ means $f[f(x)]$, $f^3(x)$ means $f\{f[f(x)]\}$.
I remark that this happens even if $n$ and $m$ increase exponentially in $|x|$.
In the trivial example above, setting $n'=n$, $m'=m$, and $y=z=x$, we see that $f^n(x)= ( h^n(x), y )$ and $g^m(x) = (x, l^m(y) )$, from which it is easy to calculate $f^n[g^m(x,y)] = ( h^n(x), l^m(y) ) $.
The example shown by Fedor Pakhomov in the answer to my previous question also satisfies Prop. 2. In that case, it is enough to call an oracle that calculates $f^{n'}(y)$ ($g$ is not needed).
The question is: is Prop. 2 a general theorem? Alternatively, is there a counter-example to Prop. 2?