(self, s2, exps=None)
return res, exps
Compute the union of self and s2, adjusting exps
Compute the union of self and s2, adjusting exps
Compute the union of self and s2 adjusting exps
def union(self, s2, exps=None):
        """Compute the union of self and s2, adjusting exps"""
        res = self.copy()
        tr = {}
        for expr, var in s2.items():
            if expr in self:
                if exps:
                    exps = exps.subs(var, res[expr])
                tr[var] = res[expr]
            else:
                res[expr] = var
        for var, rewr in s2.rewrites.items():
            res.rewrites[var] = rewr.subs(tr)
        return res, exps
def union ( self , s2 , exps = None ) : res = self . copy ( ) tr = { } for expr , var in s2 . items ( ) : if expr in self : if exps : exps = exps . subs ( var , res [ expr ] ) tr [ var ] = res [ expr ] else : res [ expr ] = var for var , rewr in s2 . rewrites . items ( ) : res . rewrites [ var ] = rewr . subs ( tr ) return res , exps