I am converting some old code to Cadabra v2, and I ran across an old bug in v1.42. It seems to be fixed in v2, but I want to report it here in case it is related to some other subtle bug in the substitution routine.
In Cadabra v1, I define three types of indices: undotted spinors, dotted spinors, and vectors.
{\alpha,\beta,\gamma,\delta}::Indices(spinor, position=independent).
\dalpha::LaTeXForm("\dot{\alpha}").
# ( similarly for \dbeta, \dgamma, \ddelta ...)
{\dalpha,\dbeta,\dgamma,\ddelta,\depsilon}::Indices(dspinor, position=independent).
{a,b,c,d}::Indices(vector4, position=independent).
Define the substitution routine:
Rule := {X_{b}^{\dalpha \alpha} X_{a b \gamma}^{\beta} -> Y_{a}^{\dalpha}_{\gamma}^{\alpha \beta}}
The following evaluates correctly:
X_{b}^{\dalpha \alpha} X_{a b \gamma}^{\beta};
@substitute(%)(@(Rule));
with the output Y_{a}^{\dalpha}_{\gamma}^{\alpha \beta}}
.
However, if I replace \alpha in the original expression with (say) \delta, it evaluates as if \delta were \alpha -- it gives Y_{a}^{\dalpha}_{\gamma}^{\alpha \beta}}
. This happens only in this slot. If I rename any other undotted spinor index, it works fine. Also, if I rename several of the undotted spinor indices, the rule is applied almost correctly, i.e.
X_{b}^{\dalpha \beta} X_{a b \gamma}^{\delta};
@substitute(%)(@(Rule));
evaluates to Y_{a}^{\dalpha}_{\gamma}^{\alpha \delta}
rather than the expected Y_{a}^{\dalpha}_{\gamma}^{\beta \delta}
.
Other modifications also give the correct behavior including:
- Swapping the order of \alpha and \dalpha in the superscript of the rule.
- Removing some of the vector indices in the expression and the rule.
- Making the dotted spinor indices something without LaTeXForm (i.e. make them \mu, \nu, \rho).
This would seem to be an especially strange bug requiring lots of different types of indices, and some weird conflict with LaTeXForm. So while the above works fine in Cadabra v2, I thought I should report anyway...