|
>> Quantification does exist implicitly, but (again, constraint solving
extensions and dif/2 aside) it's not useful with respect to infinities. \+
(member(X, D), \+ P) works just fine for a finite ground D, but try with an
unbound or partially-bound D and you get an instantiation error (at best) or
infinite recursion (at worst). The instantiation error would be raised by P being unbound, not D. You can
walk over variables with member/2. In Swi-Prolog: ?- member(X, D).
D = [X|_3304] ;
D = [_3302, X|_3310] ;
D = [_3302, _3308, X|_3316] ;
D = [_3302, _3308, _3314, X|_3322] .
In Sicstus Prolog: | ?- member(X,D).
D = [X|_A] ? ;
D = [_A,X|_B] ? ;
D = [_A,_B,X|_C] ? ;
D = [_A,_B,_C,X|_D] ?
yes
The instantiation error, e.g. in Swi: ?- (member(X,D), \+ P).
ERROR: Arguments are not sufficiently instantiated
- is an implementation detail, not a feature of the language (although it's
probably in some standard). You could write your own version of \+/2 that
doesn't raise an error.>> SMT2 is perfectly happy with infinite domains. Yes, you can encounter
undecidability (and obviously must in some cases), but it is not a given. You
can absolutely prove theorems over infinite domains with it. You can prove theorems in infinite domains with Prolog. For instance, given
the program P, below, the query Q terminates: P =
{ s(0),
s(s(N)):- s(N)
}
Q = { s(s(s(0))) }
Now that I think about it, member/2, append/2, etc list processing predicates also range over infinite domains. member(X,[X|T]).
member(X,[H|T]):-
member(X,T).
etc. True for lists of arbitrary length, restricted only by your computer's memory. |
You can't "write your own version of \+" to cause the above program to give the answer one would expect from FOL, without changing the language, and I'm not making claims about "YeGoblynQueenne's Imagined Prolog".
Your example on naturals breaks down as soon as one tries to make a statement ranging over the domain of all naturals. Even something simple like:
dives headlong into infinite recursion. My only claim is that, it's much easier to understand why this happens if one thinks of Prolog as a search language over structural terms, rather than as a logic language where such a statement could be expected to be useful (if not necessarily decidable). It's beyond me why anyone considers this contentious.