# AntiCommuting

Make objects anti-commuting.

Makes components anti-commuting, for example{A,B}::AntiCommuting;
ex:=B A;
sort_product(_);

\(\displaystyle{}\text{Attached property AntiCommuting to }(A, B).\)

\(\displaystyle{}B A\)

\(\displaystyle{}-A B\)

It also works for objects with indices:

{\psi_{m}, \chi}::AntiCommuting.
ex:= \psi_{m} \chi \psi_{n};
sort_product(_);

\(\displaystyle{}\psi_{m} \chi \psi_{n}\)

\(\displaystyle{}-\chi \psi_{m} \psi_{n}\)

If you want a pattern like

`\psi_{m}`

to anti-commute with
itself, you should use the `SelfAntiCommuting`

property instead.You can think about the difference
between

`SelfAntiCommuting`

and `AntiCommuting`

in
the following way. If `A_{m n}`

is `SelfAntiCommuting`

, it
means that for each value of the indices the expression `A_{m n}`

is an operator which anti-commutes with the operator for any other
value of the indices. The matrix $A$ is thus a matrix of
operator-valued components which mutually anti-commute. On the other
hand, if `A`

and
`B`

are declared to
be `AntiCommuting`

, then these can be viewed as two matrices of
commuting components, whose matrix product satisfies $A B = - B A$.If you attach the \prop|AntiCommuting| property to an object
with an

`ImplicitIndex`

property, the commutation property does
not refer to the object as a whole, but rather to its components. The
logic behind that becomes clear when considering e.g. spinor bilinears,{\chi, \psi}::Spinor(dimension=10, type=MajoranaWeyl);
{\chi, \psi}::AntiCommuting;
\bar{#}::DiracBar;
\Gamma{#}::GammaMatrix;
{\chi, \psi}::SortOrder;
ex:=\bar{\psi} \Gamma_{m n p} \chi;

\(\displaystyle{}\text{Attached property Spinor to }(\chi, \psi).\)

\(\displaystyle{}\text{Attached property AntiCommuting to }(\chi, \psi).\)

\(\displaystyle{}\text{Attached property DiracBar to }\bar{\#}.\)

\(\displaystyle{}\text{Attached property GammaMatrix to }\Gamma(\#).\)

\(\displaystyle{}\text{Attached property SortOrder to }(\chi, \psi).\)

\(\displaystyle{}\bar{\psi} \Gamma_{m n p} \chi\)

sort_product(_);

\(\displaystyle{}\bar{\psi} \Gamma_{m n p} \chi\)

sort_spinors(_);

{\color{red}{

Traceback (most recent call last): File "<string>", line 1, in <module> NameError: name 'sort_spinors' is not defined}}

Here

`sort_product`

did not act because both the spinors and
the gamma matrices have the `ImplicitIndex`

property and
there are thus no simple rules for their re-ordering. However,
the `sort_spinors`

algorithm did act, and took into account
the fact that the components of the spinors are anti-commuting.