Tabled declarations have wrong arity

Issue #335 resolved
Joachim Jansen created an issue

The ":- table pred/arity" doesn't take into account that pred's arity could be increased due to it being a function's graph.

Example:

:- table diag1/2.

:- table diag2/2.

diag1(IDPXSB_x, IDPXSB_y, IDPXSB_var12) :- a1(IDPXSB_x, IDPXSB_y, IDPXSB_var12), index(IDPXSB_x), index(IDPXSB_y), s51(IDPXSB_var12).

a1(IDPXSB_x, IDPXSB_y, IDPXSB_var12) :- index(IDPXSB_x), index(IDPXSB_y), IDPXSB_var12 is IDPXSB_x - IDPXSB_y+3.

diag2(IDPXSB_x, IDPXSB_y, IDPXSB_var13) :- a2(IDPXSB_x, IDPXSB_y, IDPXSB_var13), index(IDPXSB_x), index(IDPXSB_y), s15(IDPXSB_var13).

a2(IDPXSB_x, IDPXSB_y, IDPXSB_var13) :- index(IDPXSB_x), index(IDPXSB_y), IDPXSB_var13 is IDPXSB_x+IDPXSB_y - 1.

Loading into XSB:

| ?- [tmp].

[Compiling ./tmp]

++Warning[XSB]: [Compiler] ./tmp : diag1/2 declared as tabled, but not defined.

++Warning[XSB]: [Compiler] ./tmp : diag2/2 declared as tabled, but not defined.

[tmp compiled, cpu time used: 0.0280 seconds]

[tmp loaded]

Comments (6)

  1. Joachim Jansen reporter

    Context: The above Prolog rules are produced by the following definitions (of 2 functions):

    { diag1(x,y) = x-(y+3). }

    { diag2(x,y) = x+y-1. }

  2. Joachim Jansen reporter

    Fixed a bug that lead to incorrect ":- table ..." statements

    When functions are transformed into Prolog rules, the resulting arity is incremented. This was not yet reflected in the declaration of the ":- table prologpred/arity" statements.

    This fixes issue #335

    → <<cset c9b0c14421ec>>

  3. Joachim Jansen reporter

    Fixed a bug that lead to incorrect ":- table ..." statements

    When functions are transformed into Prolog rules, the resulting arity is incremented. This was not yet reflected in the declaration of the ":- table prologpred/arity" statements.

    This fixes issue #335

    → <<cset 938c928f92c4>>

  4. Joachim Jansen reporter

    Fixed a bug that lead to incorrect ":- table ..." statements

    When functions are transformed into Prolog rules, the resulting arity is incremented. This was not yet reflected in the declaration of the ":- table prologpred/arity" statements.

    This fixes issue #335

    → <<cset de5307129ded>>

  5. Joachim Jansen reporter

    Fixed a bug that lead to incorrect ":- table ..." statements

    When functions are transformed into Prolog rules, the resulting arity is incremented. This was not yet reflected in the declaration of the ":- table prologpred/arity" statements.

    This fixes issue #335

    → <<cset 3446db042bbb>>

  6. Broes De Cat

    Fixed a bug that lead to incorrect ":- table ..." statements

    When functions are transformed into Prolog rules, the resulting arity is incremented. This was not yet reflected in the declaration of the ":- table prologpred/arity" statements.

    This fixes issue #335

    → <<cset 51f04b74c76a>>

  7. Log in to comment