a field theory motivated approach to computer algebra

# reduce_delta

Simplify a self-contracted generalised delta.
Reduce a self-contracted generalised Kronecker delta symbol to a simpler expression without self-contractions, according to $$n! \, \delta^{a_1\cdots a_n}_{b_1\cdots b_n}\, \delta^{b_1}_{a_1} \cdots \delta^{b_m}_{a_m} = \Big[\prod_{i=1}^m \big( d-(n-i) \big) \Big] \, (n-m)!\, \delta^{a_{m+1}\cdots a_n}_{b_{m+1}\cdots b_n}\, .$$ Here is an example:
\delta{#}::KroneckerDelta; {m,n,q}::Integer(0..3); ex:=\delta_{m}^{n}_{n}^{q};
$$\displaystyle{}\text{Attached property KroneckerDelta to }\delta\left(\#\right).$$
$$\displaystyle{}\text{Attached property Integer to }\left(m, n, q\right).$$
$$\displaystyle{}\delta_{m}\,^{n}\,_{n}\,^{q}$$
reduce_delta(_);
$$\displaystyle{} - \frac{3}{2}\delta_{m}\,^{q}$$
Note that this requires that the indices on the Kronecker delta symbol also carry an Integer property to specify their range.