## explicit_indices

Make indices explicit on an expression with implicit indices.

In Cadabra you can write expressions which are understood to have indices suppressed, in order
to get a cleaner notation. This is often used for vector/matrix notation, or when dealing
with spinors. In order to inform Cadabra about these implicit indices, you use the
`ImplicitIndex`

property (which is also necessary to prevent Cadabra from moving
these objects through each other when sorting products into canonical form).
The `explicit_indices`

algorithm can then make these indices explicit, which can
sometimes make them easier to work with, for example when doing substitutions.In the following example we define two sets of indices, and several objects which are assumed
to have implicit indices.

{m,n,p}::Indices(spacetime, position=fixed);
{a,b,c,d,e,f,g,h}::Indices(spinor, position=fixed);
\sigma^{p}::ImplicitIndex(\sigma^{p a}_{b});
\psi::ImplicitIndex(\psi_{a});
\chi::ImplicitIndex(\chi^{a});

\(\displaystyle{}\text{Attached property Indices(position=fixed) to }\left[m, n, p\right].\)

\(\displaystyle{}\text{Attached property Indices(position=fixed) to }\left[a, b, c, d, e, f, g, h\right].\)

\(\displaystyle{}\text{Attached property ImplicitIndex to }\sigma^{p}.\)

\(\displaystyle{}\text{Attached property ImplicitIndex to }\psi.\)

\(\displaystyle{}\text{Attached property ImplicitIndex to }\chi.\)

The following is a valid expression for a spinor bilinear,

ex:= \psi \sigma^{m} \sigma^{n} \chi;

\(\displaystyle{}\psi \sigma^{m} \sigma^{n} \chi\)

\psi \sigma^{m} \sigma^{n} \chi

We can now make the indices explicit using

explicit_indices(ex);

\(\displaystyle{}\psi_{a} \sigma^{m a}\,_{b} \sigma^{n b}\,_{c} \chi^{c}\)

\psi_{a} \sigma^{m a}_{b} \sigma^{n b}_{c} \chi^{c}

This also works when there are trace operators, as is illustrated in the following
example.

Tr{#}::LaTeXForm("{\rm Tr}").
Tr{#}::Trace(indices=spinor);
ex:= Tr(\sigma^{m} \sigma^{n} + \sigma^{n} \sigma^{m});

\(\displaystyle{}\text{Attached property Trace to }{\rm Tr}\left(\#\right).\)

\(\displaystyle{}{\rm Tr}\left(\sigma^{m} \sigma^{n}+\sigma^{n} \sigma^{m}\right)\)

Tr(\sigma^{m} \sigma^{n} + \sigma^{n} \sigma^{m})

explicit_indices(_);

\(\displaystyle{}\sigma^{m a}\,_{b} \sigma^{n b}\,_{a}+\sigma^{n a}\,_{b} \sigma^{m b}\,_{a}\)

\sigma^{m a}_{b} \sigma^{n b}_{a} + \sigma^{n a}_{b} \sigma^{m b}_{a}