Currently I get these results:
/* SWI-Prolog 9.1.7 */
?- A=(B,0), B=(A,1), T=f(A,B).
A = ((A, 1), 0),
B = (A, 1),
T = f(A, (A, 1)).
?- A=(B,0), B=(A,1), T=f(B,A).
A = ((A, 1), 0),
B = (A, 1),
T = f((A, 1), A).
But I wonder, wouldn’t it be shorter and more intuitive to show:
?- A=(B,0), B=(A,1), T=f(A,B).
A = (B, 0),
B = (A, 1),
T = f(A, B).
?- A=(B,0), B=(A,1), T=f(B,A).
A = (B, 0),
B = (A, 1),
T = f(B, A).
Edit 13.04.2023
Amazingly, Trealla Prolog just does it:
/* Trealla Prolog 2.14.17 */
?- A=(B,0), B=(A,1), T=f(A,B).
A = (B,0), B = (A,1), T = f(A,B).
?- A=(B,0), B=(A,1), T=f(B,A).
A = (B,0), B = (A,1), T = f(B,A).
It clearly raises the bar, Scryer-Prolog isn’t very convincing:
/* Scryer Prolog 0.9.1-228 */
?- A=(B,0), B=(A,1), T=f(A,B).
A = ((A,1),0), B = ((B,0),1), T = f(((A,1),0),((B,0),1)).
?- A=(B,0), B=(A,1), T=f(B,A).
A = ((A,1),0), B = ((B,0),1), T = f(((B,0),1),((A,1),0)).