(expr)
Change >>, <<, and Equivalent into &, |, and ~. That is, return an
    expression that is equivalent to s, but has only &, |, and ~ as logical
    operators.

    Examples
    ========

    >>> from sympy.logic.boolalg import Implies, Equivalent, \
         eliminate_implications
    >>> from sympy.abc import A, B, C
    >>> eliminate_implications(Implies(A, B))
    Or(B, Not(A))
    >>> eliminate_implications(Equivalent(A, B))
    And(Or(A, Not(B)), Or(B, Not(A)))
    >>> eliminate_implications(Equivalent(A, B, C))
    And(Or(A, Not(C)), Or(B, Not(A)), Or(C, Not(B)))
Change >>, <<, and Equivalent into &, |, and ~. That is, return an
    expression that is equivalent to s, but has only &, |, and ~ as logical
    operators.
Change >> << and Equivalent into & | and ~ . That is return an expression that is equivalent to s but has only & | and ~ as logical operators .
def eliminate_implications(expr):
    """
    Change >>, <<, and Equivalent into &, |, and ~. That is, return an
    expression that is equivalent to s, but has only &, |, and ~ as logical
    operators.

    Examples
    ========

    >>> from sympy.logic.boolalg import Implies, Equivalent, \
         eliminate_implications
    >>> from sympy.abc import A, B, C
    >>> eliminate_implications(Implies(A, B))
    Or(B, Not(A))
    >>> eliminate_implications(Equivalent(A, B))
    And(Or(A, Not(B)), Or(B, Not(A)))
    >>> eliminate_implications(Equivalent(A, B, C))
    And(Or(A, Not(C)), Or(B, Not(A)), Or(C, Not(B)))
    """
    expr = sympify(expr)
    if expr.is_Atom:
        return expr  # (Atoms are unchanged.)
    args = list(map(eliminate_implications, expr.args))

    if expr.func is Implies:
        a, b = args[0], args[-1]
        return (~a) | b

    elif expr.func is Equivalent:
        clauses = []
        for a, b in zip(islice(args, None), islice(args, 1, None)):
            clauses.append(Or(Not(a), b))
        a, b = args[-1], args[0]
        clauses.append(Or(Not(a), b))
        return And(*clauses)

    else:
        return expr.func(*args)
def eliminate_implications ( expr ) : expr = sympify ( expr ) if expr . is_Atom : return expr # (Atoms are unchanged.) args = list ( map ( eliminate_implications , expr . args ) ) if expr . func is Implies : a , b = args [ 0 ] , args [ - 1 ] return ( ~ a ) | b elif expr . func is Equivalent : clauses = [ ] for a , b in zip ( islice ( args , None ) , islice ( args , 1 , None ) ) : clauses . append ( Or ( Not ( a ) , b ) ) a , b = args [ - 1 ] , args [ 0 ] clauses . append ( Or ( Not ( a ) , b ) ) return And ( * clauses ) else : return expr . func ( * args )