Menu

#256 A minor question on negation in recursive query

wrong answer
open
nobody
None
5
2022-12-05
2022-12-05
chi
No

Hi,

I have a minor question on the following program:

:- table win/1.

move(1, 2).
move(2, 1).
move(1, 3).
move(3, 4).

win(A) :- move(A, B), not win(B).

I execute it with

/tmp/xsb-code/XSB/bin/xsb --noprompt --quietload --nobanner --nofeedback -e "example.P, win(A), win([A]), halt."

but get an empty result.

However, I manually calculated and found that the result should contain at least win(3). Did I do something wrong?

Related

Bugs: #256

Discussion

  • Michael Kifer

    Michael Kifer - 2022-12-05

    First, you have multiple syntax errors in your command in the "..." part.

    It would be useful if you tested the exact things that you include in
    your messages.

    Second, A is indeed 3, but you are not supposed to get any output, since
    you did not include any output statements.

    Things like

    A=3

    yes

    are provided only in the interactive mode.

    On 12/4/22 9:34 PM, chi wrote:


    [bugs:#256] https://sourceforge.net/p/xsb/bugs/256/ A minor
    question on negation in recursive query

    Status: open
    Group: wrong answer
    Created: Mon Dec 05, 2022 02:33 AM UTC by chi
    Last Updated: Mon Dec 05, 2022 02:33 AM UTC
    Owner: nobody

    Hi,

    I have a minor question on the following program:

    |:- table win/1. move(1, 2). move(2, 1). move(1, 3). move(3, 4).
    win(A) :- move(A, B), not win(B). |

    I execute it with

    |/tmp/xsb-code/XSB/bin/xsb--noprompt --quietload --nobanner
    --nofeedback -e "example.P, win(A), win([A]), halt." |

    but get an empty result.

    However, I manually calculated and found that the result should
    contain at least win(3). Did I do something wrong?


    Sent from sourceforge.net because you indicated interest in
    https://sourceforge.net/p/xsb/bugs/256/
    https://sourceforge.net/p/xsb/bugs/256/

    To unsubscribe from further messages, please visit
    https://sourceforge.net/auth/subscriptions/
    https://sourceforge.net/auth/subscriptions/

     

    Related

    Bugs: #256

    • chi

      chi - 2022-12-05

      Hello Michael,

      Thank you very much for your answer!

      Is it only for recursive queries with negation that the results cannot be obtained using non-interactive mode?

      Could you please tell me what the correct command should be if I want to use non-interactive mode?

       
      • Michael Kifer

        Michael Kifer - 2022-12-05

        xsb --noprompt --quietload --nobanner --nofeedback -e "[example],
        win(A), win(A), writeln('A'=A), halt."

        On 12/5/22 3:20 AM, chi wrote:

        Hello Michael,

        Thank you very much for your answer!

        Is it only for recursive queries with negation that the results cannot be obtained using non-interactive mode?

        Could you please tell me what the correct command should be if I want to use non-interactive mode?


        ** [bugs:#256] A minor question on negation in recursive query**

        Status: open
        Group: wrong answer
        Created: Mon Dec 05, 2022 02:33 AM UTC by chi
        Last Updated: Mon Dec 05, 2022 02:34 AM UTC
        Owner: nobody

        Hi,

        I have a minor question on the following program:
        ~~~
        :- table win/1.

        move(1, 2).
        move(2, 1).
        move(1, 3).
        move(3, 4).

        win(A) :- move(A, B), not win(B).
        ~~~
        I execute it with
        ~~~
        /tmp/xsb-code/XSB/bin/xsb --noprompt --quietload --nobanner --nofeedback -e "example.P, win(A), win([A]), halt."
        ~~~
        but get an empty result.

        However, I manually calculated and found that the result should contain at least win(3). Did I do something wrong?


        Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/xsb/bugs/256/

        To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

         

        Related

        Bugs: #256

        • chi

          chi - 2022-12-05

          Hello Michael,

          I made a stupid mistake on command, thank you very much for your patient reply.

           

Log in to post a comment.