def test_unifiable_with_term(): add = Op('add') t = MyTerm(add, (1, 2)) assert arguments(t) == (1, 2) assert operator(t) == add assert term(operator(t), arguments(t)) == t x = var('x') assert unify(MyTerm(add, (1, x)), MyTerm(add, (1, 2)), {}) == {x: 2}
def teacupo(x): return conde((unify("tea", x),), (unify("cup", x),))
def test_rs1_16(): q = var() eq(("corn",), run(0, q, success, unify("corn", q)))
def test_rs1_47(): x = var() eq(("olive", "oil"), run(0, x, conde((unify("olive", x),), (unify("oil", x),))))
def test_rs1_12(): q = var() eq((), run(0, q, fail, unify(True, q)))
def test_rs1_13(): q = var() eq((True,), run(0, q, success, unify(True, q)))
def test_rs1_11(): q = var() eq((True,), run(0, q, unify(True, q)))
def test2(): x = var() z = var() eq((5,), run(0, x, unify(x, z), unify(z, 5)))
def test1(): x = var() eq((5,), run(0, x, unify(x, 5)))
def test_rs2_24(): r, x, y, z = mvars(4) eq((("e", "a", "d", "c"),), run(0, r, unify(("e", "a", "d", x), r), conso(y, ("a", z, "c"), r)))
def test_unify(): with variables(A, B): s = {A: X, B: Y} assert unify(gemm, vgemm, {}) == s assert reify(vgemm, s) == gemm assert run(1, vgemm, eq(vsyrk, syrk)) == (gemm,)