%This tests that a general call may be undefined, although a specific call may be definite.

:- table p1/1.

:- table undef/0.
undef:- tnot(undef).

:- table p1/1 as subsumptive.
p1(_X):- undef.
p1(X):- data(X).

data(1).

:- table p2/1 as subsumptive.
p2(_X).
p2(1).

go :- test.

test:- (p1(X),fail ; true),write_answers(test1,p1(X)),fail.
test:- (p2(X),fail ; true),write_answers(test2,p2(X)),fail.
test.

:- import numbervars/1 from num_vars.

write_answers(Tag,Goal):-
	get_residual(Goal,R),
	numbervars(get_residual(Goal,R)),
	write(Tag),write(' : '),write(Goal), write(' <- '),writeln(R),
	fail.
write_answers(_,_).


end_of_file.

% :- table p2/1 as subsumptive.
% p2(_X).
% p2(X):- data(X).
%
% :- table p3/1 as subsumptive.
% p3(X):- data(X).
%
% :- table p4/1 as subsumptive.
% p4(X):- (X = 1 ; X = 2).
%


