test :- a, fail.
test :-
	( a -> writeln('a is true') ; writeln('a is false') ),
	( b -> writeln('b is true') ; writeln('b is false') ),
	( c -> writeln('c is true') ; writeln('c is false') ),
	( d -> writeln('d is true') ; writeln('d is false') ),
	( e -> writeln('e is true') ; writeln('e is false') ),
	( f -> writeln('f is true') ; writeln('f is false') ),
	( g -> writeln('g is true') ; writeln('g is false') ).

%--------------------------------------------------------------

%
% Example that shows that choosing to complete the SCC containing the
% leader is not safe...  Instead the SCC that contains "e" should be
% completed first.  Then the SCC that contains "b" and "c", then that
% containing "f" and "g", and finally "d".
%

:- table a/0, b/0, c/0, d/0, e/0, f/0, g/0.

a :- b, d.

b :- c.
b.
b :- tnot(e).

c :- b, fail.

d :- e, f, tnot(g).

e.

f :- tnot(c), e.
f :- tnot(e).
f :- g.

g :- f.
