def test_to_cnf():
    (A, B, C) = list(map(Boolean, symbols('A,B,C')))
    assert (to_cnf((~ (B | C))) == And(Not(B), Not(C)))
    assert (to_cnf(((A & B) | C)) == And(Or(A, C), Or(B, C)))
    assert (to_cnf((A >> B)) == ((~ A) | B))
    assert (to_cnf((A >> (B & C))) == (((~ A) | B) & ((~ A) | C)))
    assert (to_cnf(Equivalent(A, B)) == And(Or(A, Not(B)), Or(B, Not(A))))
    assert (to_cnf(Equivalent(A, (B & C))) == ((((~ A) | B) & ((~ A) | C)) & (((~ B) | (~ C)) | A)))
    assert (to_cnf(Equivalent(A, (B | C))) == And(Or(Not(B), A), Or(Not(C), A), Or(B, C, Not(A))))
def test_to_cnf():
    (A, B, C) = list(map(Boolean, symbols('A,B,C')))
    assert (to_cnf((~ (B | C))) == And(Not(B), Not(C)))
    assert (to_cnf(((A & B) | C)) == And(Or(A, C), Or(B, C)))
    assert (to_cnf((A >> B)) == ((~ A) | B))
    assert (to_cnf((A >> (B & C))) == (((~ A) | B) & ((~ A) | C)))
    assert (to_cnf(Equivalent(A, B)) == And(Or(A, Not(B)), Or(B, Not(A))))
    assert (to_cnf(Equivalent(A, (B & C))) == ((((~ A) | B) & ((~ A) | C)) & (((~ B) | (~ C)) | A)))
    assert (to_cnf(Equivalent(A, (B | C))) == And(Or(Not(B), A), Or(Not(C), A), Or(B, C, Not(A))))