def __eq__(self, other): # check importent special case first # %(x,y).(x:S & y:T|y) = prj2(S,T) if isinstance(other, SymbolicLambda): if not len(other.variable_list)==2: return False if isinstance(other.predicate, AConjunctPredicate): belong_pred0 = other.predicate.children[0] belong_pred1 = other.predicate.children[1] if isinstance(belong_pred0, AMemberPredicate) and isinstance(belong_pred1, AMemberPredicate): x = other.variable_list[0].idName y = other.variable_list[1].idName xx = belong_pred0.children[0] yy = belong_pred1.children[0] if USE_RPYTHON_CODE: from rpython_interp import interpret else: from interp import interpret if isinstance(xx, AIdentifierExpression) and xx.idName==x: S = interpret(belong_pred0.children[1], self.env) if isinstance(yy, AIdentifierExpression) and yy.idName==y: T = interpret(belong_pred1.children[1], self.env) if isinstance(other.expression, AIdentifierExpression): # else: maybe equal. try: if self.left_set==S and self.right_set==T and y==other.expression.idName: return True except NameError: pass # maybe equal. use brute-force in symbolic set return SymbolicSet.__eq__(self, other)
def __eq__(self, other): # TODO: handle empty set and maybe more sp. cases return SymbolicSet.__eq__(self, other)