Abstract

A pure prolog program (with goal) consists of a definite clause part P and an expression G where P essentially assigns recursive definitions to predicate names and G is evaluated with respect to that assignment. This can be described using a term calculus for defining predicators p:πn and goal expressions g:o. Predicate names can be bound using recursion operators, and programs correspond to expressions without free predicate names. Evaluation of a goal expression g(ξ) with free program variables ξ enumerates a stream of answer substitutions {τ/ξ}.The denotational semantics of this language is employed to show limits of the expressiveness: While pure prolog is computationally complete in the sense that for every partial recursive function there is a closed predicator p so that [p](n,y) = [{f(n)/y}] (here n and f(n) stand for representations of numbers and [α] is a singleton stream), the set of definable functionals λP [[πn]. [t(p)]ϕ[p<-P] is extremely small. It is shown that even simple functionals as λP.λt.[P(t)(1)] (if defined otherwise ⊥), λP.λt.[P(t)(2)],… (i.e. ‘pick the first, second,… answer") are not definable. While ‘pick the first’ is usually obtained by adding the control construct once or cut or if-then-else to pure prolog, this does not in general account for ‘pick the n-th’.In full prolog, where imperative features are available, the situation changes. The classical prolog control, however, like cut etc. prove valuable as well as insufficient.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call