% Example of a tight program % (c) Tomi Janhunen % % The stable and supported models of the program coincide % usage: lparse -cn= tight.lp | smodels 0 % or lparse -cn= tight.lp | support | smodels 0 node(0..n-1). % Define a ring of edges edge(X,(X+1) mod n) :- node(X). hide node(X). hide edge(X,Y). % Choose edges which are "in" and which "out" in(X,Y) :- not out(X,Y), edge(X,Y). out(X,Y) :- not in(X,Y), edge(X,Y). % Constraints (exactly one edge is "out" others "in") :- in(X,Y):edge(X,Y). :- out(X,Y), out(Z,V), X!=Z, edge(X,Y;Z,V). % Reachability over edges that are "in" reach(X,Y) :- in(X,Y), edge(X,Y). reach(X,Y) :- reach(X,Z), in(Z,Y), node(X), edge(Z,Y).