Skip to content

User Guide (2.2.0) Example 3.13 #33

@rgrzywinski

Description

@rgrzywinski

(This isn't a question about the guide per se so I didn't submit it there. If there is a better place to ask this, please let me know!)

Example 3.13 in User Guide (2.2.0) reads:

person(jane). person(john).
day(mon). day(tue). day(wed). day(thu). day(fri).

available(jane) :- not on(fri).
available(john) :- not on(mon), not on(wed).

meet :- available(X) : person(X).
on(X) : day(X) :- meet.

If the availability of john is changed from a conjunction of negations to a disjunction then the encoding no longer returns the expected answer sets:

% available(john) :- not on(mon), not on(wed).
available(john) :- on(tue).
available(john) :- on(thu).

Specifically, the grounder removes all of the meet terms:

person(jane).
person(john).
day(mon).
day(tue).
day(wed).
day(thu).
day(fri).
available(jane):-not on(fri).

Is this expected? If so, why?

My second somewhat related question is about how not binds. If the last two rules are changed to the following:

% meet :- available(X) : person(X).
% on(X) : day(X) :- meet.
on(X) : day(X).
:- not available(X) : person(X).

then the expected results are not obtained. But instead if the two rules are changed to the following:

meet :- available(X) : person(X).
% on(X) : day(X) :- meet.
on(X) : day(X).
:- not meet.

then the expected results are seen. My assumption is that negation cannot be used as I intended and therefore the auxiliary predicate is necessary. Is there a way to perform the negation as in the first case?

FWIW: I would change 3.13 to use this last encoding so that it works with all cases.

Thanks in advance for any help or guidance!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions