

def eq_assoc(u, v, eq=core.eq, n=None):
    " Goal for associative equality\n\n    >>> from logpy import run, var, fact\n    >>> from logpy.assoccomm import eq_assoc as eq\n\n    >>> fact(commutative, 'add')    # declare that 'add' is commutative\n    >>> fact(associative, 'add')    # declare that 'add' is associative\n\n    >>> x = var()\n    >>> run(0, x, eq(('add', 1, 2, 3), ('add', 1, x)))\n    (('add', 2, 3),)\n    "
    (uop, uargs) = op_args(u)
    (vop, vargs) = op_args(v)
    if (uop and vop):
        return conde([(core.eq, u, v)], [(eq, uop, vop), (associative, uop), (lambda s: assocunify(u, v, s, eq, n))])
    if (uop or vop):
        if vop:
            (uop, vop) = (vop, uop)
            (uargs, vargs) = (vargs, uargs)
            (v, u) = (u, v)
        return conde([(core.eq, u, v)], [(associative, uargs), (lambda s: assocunify(u, v, s, eq, n))])
    return (core.eq, u, v)

dataset/ETHPy150Open logpy/logpy/logpy/assoccomm.py eq_assoc/VarMisuse@176/394 `uop`->`uargs`