# Kronecker $\delta$ for Indices of different dimensions

+1 vote

Hi,
I have $\delta$-symbols involving a color index $a$ that runs from 1 to 3 and a Euclidian index $\mu$ from 1 to 4.

{\mu,\nu}::Indices(Euklid, position=free).
{\mu,\nu}::Integer(1..4).
{a,b}::Indices(Color, position=independent).
{a,b}::Integer(1..3).
\delta_{#}::KroneckerDelta.


But when I try to contract them like in

ex := \delta_{a \mu} \delta_{a \mu} ;
eliminate_kronecker(ex);


I get 4 but it should be 3. When I reverse the order of the indices I get the correct number:

ex2 := \delta_{\mu a} \delta_{\mu a} ;
eliminate_kronecker(ex2);


This gives 3.

I suppose cadabra contracts the first two indices first so in the first case we get

$\delta{a \mu} \delta^{a \mu} = \delta{\mu}^{\mu} = 4$

and in the second it becomes

$\delta{\mu a} \delta^{\mu a} = \delta{a}^{a} = 3$.

Maybe this behavior could be avoided by always first contracting the indices of higher dimension? In the meantime, can somebody think of a workaround?

In the interest of completeness:

ex3 := \delta_{\mu a} \delta_{a \mu} ;
eliminate_kronecker(ex3);


gives 4 and

ex4 := \delta_{a \mu} \delta_{\mu a} ;
eliminate_kronecker(ex4);


returns 3.

Thank you

EDIT: Directly after asking I think I found a workaround by adding a substitution to the post_process function that sorts the indices such that the Euclidian one gets contracted first.

def post_process(ex):
substitute( ex, $\delta_{a \mu} = \delta_{\mu a}$ )

It might be a dull comment but, Have you tried to use the vielbein property Link to github