A somewhat more cadabra-esque way of doing this is as follows (a regression in 2.5.10 prevents this from completing but 2.5.12 will roll out soon). First, setup the computation:
\partial{#}::PartialDerivative.
t::Coordinate.
O::Depends(t).
# R = O(t=0)
{H,R}::NonCommuting.
# time-evolution of operator O
exO := O = \exp{i H t} R \exp{-i H t}:
dOdt := \partial_{t}{ @(exO) };
This makes dOdt
contain the full equation (not just the right-hand side); note how you can take a partial derivative of an equation and it will apply that on both sides. Then
product_rule(dOdt)
evaluate_derivatives = join($\partial_{t}{R} -> 0 $,
$\partial_{t}{\exp{A??}} -> \partial_{t}{A??} \exp{A??}$,
$\partial_{t}{i H t} = i H$)
substitute(_, evaluate_derivatives, repeat=True)
factor_out(dOdt, $i$)
Now re-insert the original identity (which you can do using builtin functionality, you don't have to do the swapping of lhs/rhs yourself):
from cdb.core.manip import *
substitute(dOdt, swap_sides(exO))
substitute(dOdt, $A?? B?? - B?? A?? -> \commutator{A??}{B??}$);
This is still not completely optimal in my opinion; more improvements to come over time.