def zero_canon(expr, real_args, imag_args, real2imag): if imag_args[0] is None: return [expr.copy(real_args)], None imag_cons = [Zero(imag_args[0], constr_id=real2imag[expr.id])] if real_args[0] is None: return None, imag_cons else: return [expr.copy(real_args)], imag_cons
def lower_equality(equality): lhs = equality.args[0] rhs = equality.args[1] return Zero(lhs - rhs, constr_id=equality.constr_id)
def zero_constr_canon(expr, args): assert len(args) == 2 return Zero(args[0] - args[1], constr_id=expr.id), []