(formula)
Returns a generator over the top-level disjuncts of the given formula

    The result is such that for every formula phi, the following holds:
    phi <-> Or(conjunctive_partition(phi))
Returns a generator over the top-level disjuncts of the given formula
Returns a generator over the top - level disjuncts of the given formula
def disjunctive_partition(formula):
    """ Returns a generator over the top-level disjuncts of the given formula

    The result is such that for every formula phi, the following holds:
    phi <-> Or(conjunctive_partition(phi))
    """
    to_process = [formula]
    seen = set()
    while to_process:
        cur = to_process.pop()
        if cur not in seen:
            seen.add(cur)
            if cur.is_or():
                to_process += cur.args()
            else:
                yield cur
def disjunctive_partition ( formula ) : to_process = [ formula ] seen = set ( ) while to_process : cur = to_process . pop ( ) if cur not in seen : seen . add ( cur ) if cur . is_or ( ) : to_process += cur . args ( ) else : yield cur