Solution (source code)

= Solution

For the <nilpotent matrix> $T$, define the polynomial $E(z)=\sum_{k=0}^{m-1}z^kT^k/k!$. Because $T^m=0$, differentiating gives $E'(z)=TE(z)=E(z)T$. The derivative of the preserved <bilinear form> matrix is therefore
$$
\frac{d}{dz}\bigl(E(z)^{\mathsf T}AE(z)\bigr)
=E(z)^{\mathsf T}(T^{\mathsf T}A+AT)E(z)=0.
$$
It is a constant matrix polynomial, equal to $A$ at $z=0$. Evaluation at one proves
$$
\boxed{(\exp T)^{\mathsf T}A\exp T=A.}
$$
Also $E(-1)$ is the inverse of $E(1)$ by the finite exponential product identity, so this really is an invertible isometry, even when $A$ is degenerate.