a field-theory motivated approach to computer algebra

# Tensor monomials and multi-term symmetries

Cadabra contains powerful algorithms to bring any tensorial expression into a canonical form. For multi-term symmetries, cadabra relies on Young tableau methods to generate a canonical form for tensor monomials. As an example, consider the following identity, $W_{p q r s} W_{p t r u} W_{t v q w} W_{u v s w} - W_{p q r s} W_{p q t u} W_{r v t w} W_{s v u w} = W_{m n a b} W_{n p b c} W_{m s c d} W_{s p d a} - \frac{1}{4} W_{m n a b} W_{p s b a} W_{m p c d} W_{n s d c}\,,$ in which $W_{m n p q}$ is a Weyl tensor (all contracted indices have been written as subscripts for easier readability). Proving this identity requires multiple uses of the Ricci cyclic identity $W_{m[npq]}=0\,.$ With Cadabra's Young tableau methods the proof is simple. We first declare our objects and input the identity which we want to prove,
{m,n,p,q,r,s,t,u,v,w,a,b,c,d,e,f}::Indices(vector). W_{m n p q}::WeylTensor.
ex:= W_{p q r s} W_{p t r u} W_{t v q w} W_{u v s w} - W_{p q r s} W_{p q t u} W_{r v t w} W_{s v u w} - W_{m n a b} W_{n p b c} W_{m s c d} W_{s p d a} + (1/4) W_{m n a b} W_{p s b a} W_{m p c d} W_{n s d c};
$$\displaystyle{}W_{p q r s} W_{p t r u} W_{t v q w} W_{u v s w}-W_{p q r s} W_{p q t u} W_{r v t w} W_{s v u w}-W_{m n a b} W_{n p b c} W_{m s c d} W_{s p d a}+\frac{1}{4}W_{m n a b} W_{p s b a} W_{m p c d} W_{n s d c}$$
Using a Young projector to project all Weyl tensors onto a form which shows the Ricci symmetry in manifest form is done with
young_project_tensor(_, modulo_monoterm=True);
$$\displaystyle{}\left(\frac{2}{3}W_{p q r s} - \frac{1}{3}W_{p s q r}+\frac{1}{3}W_{p r q s}\right) \left(\frac{2}{3}W_{p t r u}+\frac{1}{3}W_{p u r t}+\frac{1}{3}W_{p r t u}\right) \left(\frac{2}{3}W_{q w t v}+\frac{1}{3}W_{q v t w} - \frac{1}{3}W_{q t v w}\right) \left(\frac{2}{3}W_{s w u v}+\frac{1}{3}W_{s v u w} - \frac{1}{3}W_{s u v w}\right)-\left(\frac{2}{3}W_{p q r s} - \frac{1}{3}W_{p s q r}+\frac{1}{3}W_{p r q s}\right) \left(\frac{2}{3}W_{p q t u} - \frac{1}{3}W_{p u q t}+\frac{1}{3}W_{p t q u}\right) \left(\frac{2}{3}W_{r v t w}+\frac{1}{3}W_{r w t v}+\frac{1}{3}W_{r t v w}\right) \left(\frac{2}{3}W_{s v u w}+\frac{1}{3}W_{s w u v}+\frac{1}{3}W_{s u v w}\right)-\left(\frac{2}{3}W_{a b m n} - \frac{1}{3}W_{a n b m}+\frac{1}{3}W_{a m b n}\right) \left(\frac{2}{3}W_{b c n p} - \frac{1}{3}W_{b p c n}+\frac{1}{3}W_{b n c p}\right) \left(\frac{2}{3}W_{c d m s} - \frac{1}{3}W_{c s d m}+\frac{1}{3}W_{c m d s}\right) \left(\frac{2}{3}W_{a d p s} - \frac{1}{3}W_{a s d p}+\frac{1}{3}W_{a p d s}\right)+\frac{1}{4}\left(\frac{2}{3}W_{a b m n} - \frac{1}{3}W_{a n b m}+\frac{1}{3}W_{a m b n}\right) \left( - \frac{2}{3}W_{a b p s} - \frac{1}{3}W_{a p b s}+\frac{1}{3}W_{a s b p}\right) \left(\frac{2}{3}W_{c d m p} - \frac{1}{3}W_{c p d m}+\frac{1}{3}W_{c m d p}\right) \left( - \frac{2}{3}W_{c d n s} - \frac{1}{3}W_{c n d s}+\frac{1}{3}W_{c s d n}\right)$$
This algorithm knows that the Weyl tensor sits in the '$2\times 2$ box' representation of the rotation group $\text{SO}(d)$, and effectively leads to a replacement $W_{m n p q} \rightarrow \frac{2}{3} W_{m n p q} - \frac{1}{3} W_{m q n p} + \frac{1}{3} W_{m p n q}\,.$ We then expand the products of sums and canonicalise once more using mono-term symmetries,
distribute(_) canonicalise(_) rename_dummies(_);
$$\displaystyle{}0$$