next up previous contents index
Next: Programming in the Well-founded Up: Non-stratified Programs Previous: Conditional Answers   Contents   Index


When Conditional Answers are Needed

A good Prolog programmer uses the order of literals in the body of a clause to make her program more efficient. However, as seen in the previous section, delaying can break the order that literals are evaluated within the body of a clause. It then becomes natural to ask if any guarantees can be made that XSB is not delaying literals unnecessarily.

Such a guarantee can in fact be made, using the concept of dynamic stratification [31]. Without going into the formalism of dynamic stratification, we note that a program is dynamically stratified if and only if it has a two-valued model. It is also known that computation of queries to dynamically stratified programs is not possible under any fixed strategy for selecting literals within the body of a clause. In other words, some mechanism for breaking the fixed-order literal selection strategy must be used, such as delaying.

However, by redefining dynamic stratification to use an arbitrary fixed-order literal selection strategy (such as the left-to-right strategy of Prolog), a new kind of stratification is characterized, called Left-to-Right Dynamic Stratification, or LRD-stratification. LRD-stratified is not as powerful as dynamic stratification, but is more powerful than other fixed-order stratification methods, and it can be shown that for ground programs, XSB delays only when programs are not LRD-stratified. In the language of [38] XSB is delay minimal.


next up previous contents index
Next: Programming in the Well-founded Up: Non-stratified Programs Previous: Conditional Answers   Contents   Index
Baoqiu Cui
2000-04-23