Skip to content

[SWI-Prolog] - (negative) operator misbehaving in clpfd with set_prolog_flag(clpfd_monotonic, true). #3

@LuizFBR

Description

@LuizFBR

The expression ?- #(Y) #= 2, #(X) #= ( (-#(Y)) /\ 1).

returns the following stack trace:

ERROR: Domain error: `clpfd_expression' expected, found `-#(2)'
ERROR: In:
ERROR:   [19] throw(error(domain_error(clpfd_expression,...),_10238))
ERROR:   [16] clpfd:parse_clpfd(-#(2)/\1,_10276) at c:/program files/swipl/library/clp/clpfd.pl:7840
ERROR:   [14] clpfd:clpfd_equal(#(_10322),-#(2)/\1) at c:/program files/swipl/library/clp/clpfd.pl:2846
ERROR:   [11] toplevel_call(user:user: ...) at c:/program files/swipl/boot/toplevel.pl:1317
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
^  Exception: (4) setup_call_cleanup('$toplevel':notrace(call_repl_loop_hook(begin, 0)), '$toplevel':'$query_loop'(0), '$toplevel':notrace(call_repl_loop_hook(end, 0))) ? creep

That's it. This kind of complicates things for me, I'm trying to build a relational random generator in prolog and clpfd seems like the perfect tool for handling arithmetic relations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions