spacepaste

  1.  
  2. def m5(u, x):
  3. return x + 5 * u
  4. def d5(u, index_structure, y):
  5. return y - index_structure
  6. def get_index_structure(u):
  7. return u * 5
  8. def example(u, x):
  9. assert d5(u, get_index_structure(u), m5(u, x)) == x
  10. Y = m5(U, X), Z = d5(U, _, Y) :- Z = X.
  11. Y = abs(X), Z = abs(Y) :- Z = Y.
  12. declare_rule(m5, [1, 2], d5, [1, 3, 0], 2)
  13. declare_rule(abs, [1], abs, [0], 0)
  14. declare_rule(operator.neg, [1], abs, [0], 0)
  15. declare_rule(rbigint.add, [1, 2], rbigint.sub, [0, 2], 1)
  16. declare_rule(rbigint.add, [2, 1], rbigint.sub, [0, 2], 1)
  17.