Are there any prolog implementations that are able to enumerate all elements of countably infinite results?
Let's consider to enumerate all pairs of natural numbers. If we enumerate pairs in order {(0,0), (0,1), (1,0), (0,2), (1,1), (2,0), ...}, we can enumerate all pairs. However, if we enumerate pairs in order {(0,0), (0,1), (0,2), (0,3) ...} as the following GNU prolog program, we never reach pairs such as (1,1).
% cat nats.pl
nat(0).
nat(X1) :- nat(X), X1 is X + 1.
pair_of_nats(X, Y) :- nat(X), nat(Y).
% prolog
GNU Prolog 1.3.0
By Daniel Diaz
Copyright (C) 1999-2007 Daniel Diaz
| ?- ['nats.pl'].
compiling /home/egi/prolog/nats.pl for byte code...
/home/egi/prolog/nats.pl compiled, 4 lines read - 762 bytes written, 9 ms
yes
| ?- pair_of_nats(X,Y).
X = 0
Y = 0 ? ;
X = 0
Y = 1 ? ;
X = 0
Y = 2 ? ;
X = 0
Y = 3 ?