a field-theory motivated approach to computer algebra

## rewrite_indices

Rewrite indices by contracting with vielbein or metric.
Rewrite indices on an object by contracting it with a second object which contains indices of both the old and the new type (a vielbein, in other words, or a metric). A vielbein example is
{m,n,p}::Indices(flat). {\mu,\nu,\rho}::Indices(curved). ex:=T_{m n p}; rewrite_indices(_, $T_{\mu\nu\rho}$, $e_{\mu}^{n}$);
$$\displaystyle{}T_{m n p}$$
$$\displaystyle{}T_{\mu \nu \rho} e^{\mu}\,_{m} e^{\nu}\,_{n} e^{\rho}\,_{p}$$
If you want to raise or lower an index with a metric, this can also be done with as an index rewriting command, as the following example shows:
{\mu,\nu,\rho,\sigma,\lambda,\kappa}::Indices(curved, position=fixed). ex:=H_{\mu \nu \rho}; rewrite_indices(_, $H^{\mu \nu \rho}$, $g_{\mu \nu}$);
$$\displaystyle{}H_{\mu \nu \rho}$$
$$\displaystyle{}H^{\sigma \lambda \kappa} g_{\mu \sigma} g_{\nu \lambda} g_{\rho \kappa}$$
As these examples show, the desired form of the tensor should be given as the first argument, and the conversion object (metric, vielbein) as the second object.