next up previous
Next: EXAMPLES Up: RESOURCE HANDLING Previous: Resource Addition

Resource Consumption

Atomic goal formula A means resource consumption and program invocation. All possibilities are examined by backtracking. For example, the following program displays 1 and 2.

r(2).
  ?- !r(1) -<> r(X), write(X), nl, fail.

In goal formula tex2html_wrap_inline427 , resources are copied before execution, and the same resources should be consumed in tex2html_wrap_inline429 and tex2html_wrap_inline431 . The following query succeeds by letting tex2html_wrap_inline433 and tex2html_wrap_inline435 , or tex2html_wrap_inline437 and tex2html_wrap_inline439 , because r(X) and r(Y) should consume the same resources.

?- (r(1), r(2)) -<> ((r(X) & r(Y)), r(Z)).

Goal formula tex2html_wrap_inline441 is just like G, but only infinite resources can be consumed during the execution of G. The following query succeeds by letting tex2html_wrap_inline389 and tex2html_wrap_inline405 .

?- (!r(1), r(2)) -<> (!r(X), r(Y)).

Goal formula top means the erasure of remaining resources. In the following queries, the first one succeeds, but the second one fails because there is a remaining resource.

?- (r(1), r(2)) -<> (r(X), top).
  ?- (r(1), r(2)) -<> r(X).


Naoyuki Tamura
Thu May 8 20:39:01 JST 1997