Hi rtagaras and Kasper.
Before starting, I'm running cadabra2 v.2.4.3
on Manjaro Linux.
I was able to reproduce the behaviour reported by rtagaras. Let me show some details.
preliminars
I'd use a simplified properties. Note that I'm not defining Greek indices.
{a,b,c,d,m,n,p,q}::Indices.
{a,b,c,d,m,n,p,q}::Integer(range=1..k).
\delta{#}::KroneckerDelta.
A test
ex := \delta^a_a;
eliminate_kronecker(ex);
this code block returns k
as expected.
A simple expression
I'd evaluate the second expression reported by rtagaras.
y := X^{a b} X^{c d} ( \delta_{a c} \delta_{b d} + \delta_{a d} \delta_{b c});
distribute(y);
I'm getting the expected result
$$\X^{a b} X^{c d} \delta{a c} \delta{b d}+X^{a b} X^{c d} \delta{a d} \delta{b c}$$
and even better after
eliminate_kronecker(_);
$X{c d} X^{c d}+X{d c} X^{c d}$
No bad behaviour so far.
A more complex manipulation
Now I add some spices
y_new := X^{\mu a} X^{\nu b} X^{\mu m} X^{\nu p}
( \delta_{a c} \delta_{b d} + \delta_{a d} \delta_{b c} )
( \delta_{m n} \delta_{p q} + \delta_{m q} \delta_{p n} );
distribute(_);
Here I don't get the expected result, but something similar to what rtagaras reports.
For completness:
$X^{\mu a} X^{\nu b} X^{\mu}\,{n} X^{\nu}\,{q}\left(\delta{a c} \delta{b d}+\delta{a d} \delta{b c}\right)+X^{\mu a} X^{\nu b} X^{\mu}\,{q} X^{\nu}\,{n}\left(\delta{a c} \delta{b d}+\delta{a d} \delta{b c}\right)$
Update: Solved by Kasper
I confirm that the addition of the multiplication operation *
to the expression solves the unexpected behaviour.
y_new := X^{\mu a} X^{\nu b} X^{\mu m} X^{\nu p} *
( \delta_{a c} \delta_{b d} + \delta_{a d} \delta_{b c} ) *
( \delta_{m n} \delta_{p q} + \delta_{m q} \delta_{p n} );
distribute(_);