def demorgan(self):
        """
        Return a expr where the NOT function is moved inward.
        This is achieved by canceling double NOTs and using De Morgan laws.
        """
        expr = self.cancel()
        if expr.isliteral or not isinstance(expr, self.NOT):
            return expr
        op = expr.args[0]
        return op.dual(*(self.__class__(arg).cancel() for arg in op.args))
def demorgan ( self ) : expr = self . cancel ( ) if expr . isliteral or not isinstance ( expr , self . NOT ) : return expr op = expr . args [ 0 ] return op . dual ( * ( self . __class__ ( arg ) . cancel ( ) for arg in op . args ) )
Return a expr where the NOT function is moved inward.
        This is achieved by canceling double NOTs and using De Morgan laws.