Created
November 20, 2019 03:12
-
-
Save d4hines/8f0647de932131fc0da24c1abd558b13 to your computer and use it in GitHub Desktop.
Attempt a translation of Dr. Gelfond's system description of windows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% fluent win(W), where W is a window name, e.g "w". | |
% fluent position(W, P), where W is a window, and P is a possible position, e.g "p1" | |
% Note: position is really a total function: every window has one and only one position. position is not injective, i.e windows can occupy the same position. | |
% add(W, P) causes window(W). | |
window(W, T + 1) :- occurs(add(W, P), T). | |
% add(W, P) causes position(W, P). | |
position(W, T + 1) :- occurs(add(W, P), T). | |
% remove(W) causes -window(W). | |
-window(W, T + 1) :- occurs(remove(W), T). | |
% impossible add(W, P) if window(W). | |
:- occurs(add(W, P), T), window(W, T). | |
% impossible remove(W, P) if -window(W). | |
:- occurs(remove(W), T), -window(W, T). | |
% move(W, P) causes position(W, P). | |
position(W, P, T + 1) :- occurs(move(W, P), T). | |
% impossible move(W, P) if -window(W). | |
:- occurs(move(W, P), T), -window(W, T). | |
% Functional constraint: every window may have one and only one position. | |
% -position(W, P) if window(W, P), position(W, P2), P1 != P2. | |
-position(W, P1, T) :- window(W, T), position(W, P2), P1 != P2. | |
% Inertial laws | |
% Window is a total fluent, i.e, defined on every proper input. | |
window(W, T + 1) :- window(W, T), step(T). | |
% position, by contrast, is a partial fluent with a dynamic domain (i.e, domain depending on a time step). | |
position(W, P, T + 1) :- position(W, P, T), window(W, T + 1), not -position(W, P, T + 1), step(T). | |
% Instance | |
step(0..4). | |
% initial state. | |
-window(w, 0). | |
% example history. | |
occurs(add(w, p1), 0). | |
occurs(move(w, p2), 1). | |
occurs(remove(w), 2). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This program produces the following error in Clingo: