docs: def _potential_cross_partial_w(moment_index: int,
                                 op: ops.Operation,
                                 state: _OptimizerState) -> None:
      """Cross the held W over a partial W gate.
  
      [Where W(a) is shorthand for PhasedX(phase_exponent=a).]
  
      Uses the following identity:
          ───W(a)───W(b)^t───
          ≡ ───Z^-a───X───Z^a───W(b)^t────── (expand W(a))
          ≡ ───Z^-a───X───W(b-a)^t───Z^a──── (move Z^a across, phasing axis)
          ≡ ───Z^-a───W(a-b)^t───X───Z^a──── (move X across, negating axis angle)
          ≡ ───W(2a-b)^t───Z^-a───X───Z^a─── (move Z^-a across, phasing axis)
          ≡ ───W(2a-b)^t───W(a)───
      """
      a = state.held_w_phases.get(op.qubits[0])
      if a is None:
          return
      exponent, phase_exponent = cast(Tuple[float, float],
                                      _try_get_known_phased_pauli(op))
      new_op = ops.PhasedXPowGate(
          exponent=exponent,
          phase_exponent=2 * a - phase_exponent).on(op.qubits[0])
      state.deletions.append((moment_index, op))
      state.inline_intos.append((moment_index, new_op))