%------------------------------------------------------------------------ % Program for which non-trivial ANSWER COMPLETION is needed. %------------------------------------------------------------------------ :- table p/0, q/0, s/0, r/0. p :- p. p :- q. q :- p. q :- tnot(s). s :- tnot(r). s :- p. r :- tnot(s), r. %------------------------------------------------------------------------ test :- p, fail. test :- ( p -> ( tnot(p) -> writeln('p is undefined') ; writeln('p is true') ) ; writeln('p is false (OK)') ), ( q -> ( tnot(q) -> writeln('q is undefined') ; writeln('q is true') ) ; writeln('q is false (OK)') ), ( s -> ( tnot(s) -> writeln('s is undefined') ; writeln('s is true (OK)') ) ; writeln('s is false') ), ( r -> ( tnot(r) -> writeln('r is undefined') ; writeln('r is true') ) ; writeln('r is false (OK)') ).