| > "Prolog has its roots in first-order logic" And Erlang has its roots in Prolog. Yet I can't perform unification or backtracking in Erlang. 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). 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. I'm basing my arguments on years of experience using Prolog, SMT2, and TLA+. You are free to disagree about the definition of a fuzzy English term, but terms are only valuable inasmuch as they are useful, and defining Prolog strictly as a logic language has not proved useful to me, given how much it differs in capability from true logic languages. The most effective programming style differs greatly between them when you realize that you must always be aware of terms and instantiation. Hence my assertion that it's much better to think of Prolog as a language for dealing with said terms and instantiation, than as a language for expressing logical statements. To clarify: Prolog imbued with constraint-solving extensions I absolutely consider a logic language. You gain constraints and reasoning over infinities, and it allows you to stop thinking in terms of search and terms. See https://www.metalevel.at/prolog/purity for some examples of what this buys you (scroll down to "Applications to teaching Prolog"). It's enough of a game-changer to me as to warrant a different categorization. |
The instantiation error would be raised by P being unbound, not D. You can walk over variables with member/2.
In Swi-Prolog:
In Sicstus Prolog: The instantiation error, e.g. in Swi: - 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:
Now that I think about it, member/2, append/2, etc list processing predicates also range over infinite domains. etc. True for lists of arbitrary length, restricted only by your computer's memory.