#NEWLINE# def unit_propagate( clauses , symbol ) : #NEWLINE# #INDENT# '\n    Returns an equivalent set of clauses\n    If a set of clauses contains the unit clause l, the other clauses are\n    simplified by the application of the two following rules:\n\n      1. every clause containing l is removed\n      2. in every clause that contains ~l this literal is deleted\n\n    Arguments are expected to be in CNF.\n\n    >>> from sympy import symbols\n    >>> from sympy.abc import A, B, D\n    >>> from sympy.logic.algorithms.dpll import unit_propagate\n    >>> unit_propagate([A | B, D | ~B, B], B)\n    [D, B]\n\n    ' #NEWLINE# output = [ ] #NEWLINE# for c in clauses : #NEWLINE# #INDENT# if ( c . func != Or ) : #NEWLINE# #INDENT# output . append ( c ) #NEWLINE# continue #NEWLINE# #UNINDENT# for arg in c . args : #NEWLINE# #INDENT# if ( arg == ( ~ symbol ) ) : #NEWLINE# #INDENT# output . append ( Or ( * [ x for x in x . args if ( x != ( ~ symbol ) ) ] ) ) #NEWLINE# break #NEWLINE# #UNINDENT# if ( arg == symbol ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# output . append ( c ) #NEWLINE# #UNINDENT# #UNINDENT# return output