(expr, assumptions)
As long as there is at most only one noncommutative term:
        Hermitian*Hermitian         -> !Antihermitian
        Hermitian*Antihermitian     -> Antihermitian
        Antihermitian*Antihermitian -> !Antihermitian
As long as there is at most only one noncommutative term:
        Hermitian*Hermitian         -> !Antihermitian
        Hermitian*Antihermitian     -> Antihermitian
        Antihermitian*Antihermitian -> !Antihermitian
As long as there is at most only one noncommutative term : Hermitian * Hermitian - > !Antihermitian Hermitian * Antihermitian - > Antihermitian Antihermitian * Antihermitian - > !Antihermitian
def Mul(expr, assumptions):
        """
        As long as there is at most only one noncommutative term:
        Hermitian*Hermitian         -> !Antihermitian
        Hermitian*Antihermitian     -> Antihermitian
        Antihermitian*Antihermitian -> !Antihermitian
        """
        if expr.is_number:
            return AskImaginaryHandler._number(expr, assumptions)
        nccount = 0
        result = False
        for arg in expr.args:
            if ask(Q.antihermitian(arg), assumptions):
                result = result ^ True
            elif not ask(Q.hermitian(arg), assumptions):
                break
            if ask(~Q.commutative(arg), assumptions):
                nccount += 1
                if nccount > 1:
                    break
        else:
            return result
def Mul ( expr , assumptions ) : if expr . is_number : return AskImaginaryHandler . _number ( expr , assumptions ) nccount = 0 result = False for arg in expr . args : if ask ( Q . antihermitian ( arg ) , assumptions ) : result = result ^ True elif not ask ( Q . hermitian ( arg ) , assumptions ) : break if ask ( ~ Q . commutative ( arg ) , assumptions ) : nccount += 1 if nccount > 1 : break else : return result