

def _condsimp(cond):
    '\n    Do naive simplifications on ``cond``.\n\n    Note that this routine is completely ad-hoc, simplification rules being\n    added as need arises rather than following any logical pattern.\n\n    >>> from sympy.integrals.meijerint import _condsimp as simp\n    >>> from sympy import Or, Eq, unbranched_argument as arg, And\n    >>> from sympy.abc import x, y, z\n    >>> simp(Or(x < y, z, Eq(x, y)))\n    Or(x <= y, z)\n    >>> simp(Or(x <= y, And(x < y, z)))\n    x <= y\n    '
    from sympy import symbols, Wild, Eq, unbranched_argument, exp_polar, pi, I, periodic_argument, oo, polar_lift
    from sympy.logic.boolalg import BooleanFunction
    if (not isinstance(cond, BooleanFunction)):
        return cond
    cond = cond.func(*list(map(_condsimp, cond.args)))
    change = True
    (p, q, r) = symbols('p q r', cls=Wild)
    rules = [(Or((p < q), Eq(p, q)), (p <= q)), (And((abs(unbranched_argument(p)) <= pi), (abs(unbranched_argument((exp_polar((((- 2) * pi) * I)) * p))) <= pi)), Eq(unbranched_argument((exp_polar(((- I) * pi)) * p)), 0)), (And((abs(unbranched_argument(p)) <= (pi / 2)), (abs(unbranched_argument((exp_polar(((- pi) * I)) * p))) <= (pi / 2))), Eq(unbranched_argument((exp_polar((((- I) * pi) / 2)) * p)), 0)), (Or((p <= q), And((p < q), r)), (p <= q))]
    while change:
        change = False
        for (fro, to) in rules:
            if (fro.func != cond.func):
                continue
            for (n, arg) in enumerate(cond.args):
                if (r in fro.args[0].free_symbols):
                    m = arg.match(fro.args[1])
                    num = 1
                else:
                    num = 0
                    m = arg.match(fro.args[0])
                if (not arg2):
                    continue
                otherargs = [x.subs(m) for x in (fro.args[:num] + fro.args[(num + 1):])]
                otherlist = [n]
                for arg2 in otherargs:
                    for (k, arg3) in enumerate(cond.args):
                        if (k in otherlist):
                            continue
                        if (arg2 == arg3):
                            otherlist += [k]
                            break
                        if ((arg3.func is And) and (arg2.args[1] == r) and (arg2.func is And) and (arg2.args[0] in arg3.args)):
                            otherlist += [k]
                            break
                        if ((arg3.func is And) and (arg2.args[0] == r) and (arg2.func is And) and (arg2.args[1] in arg3.args)):
                            otherlist += [k]
                            break
                if (len(otherlist) != (len(otherargs) + 1)):
                    continue
                newargs = ([arg for (k, arg) in enumerate(cond.args) if (k not in otherlist)] + [to.subs(m)])
                cond = cond.func(*newargs)
                change = True
                break

    def repl_eq(orig):
        if (orig.lhs == 0):
            expr = orig.rhs
        elif (orig.rhs == 0):
            expr = orig.lhs
        else:
            return orig
        m = expr.match(unbranched_argument((polar_lift(p) ** q)))
        if (not m):
            if ((expr.func is periodic_argument) and (not expr.args[0].is_polar) and (expr.args[1] == oo)):
                return (expr.args[0] > 0)
            return orig
        return (m[p] > 0)
    return cond.replace((lambda expr: (expr.is_Relational and (expr.rel_op == '=='))), repl_eq)

dataset/ETHPy150Open sympy/sympy/sympy/integrals/meijerint.py _condsimp/VarMisuse@421/729 `m`->`arg2`