| OCR Text |
Show 102 The advantages of being able to compute with infinite data structures have been cogently argued by several researchers e.g ., [40, 64] There are certain inherent difficulties that arise in Prolog when attemptmg to t ermmate computations on infinite data structures. By "computmg w ith infintte data structures," we mean that the program can mantpulate as a w hole data object s t hat are conceptually infinite, even though the user may, in any given computation, only wish to obtain a finite portion of the potentially infinite objects. This ability provides a programming style in which one can separate the data processing aspect from possibly complex boundary conditions, thus enabling elegant solutions to certain classes of problems. In this chapter we describe Funlog, a computational model that integrates functional and logic programming models, is described. First, an underlying functional model is characterized whose reduction mechanism is "lazy" in the sense of [34, 40]. The notion of semantic unification is then discussed. Semantic unification allows executable functions to be used in Horn clauses and to be "reduced by need," i.e., the underlying resolution is based upon semantic unification. The resulting computation model can be viewed as a restricted version of first-order logic with equality. We show by means of examples that our approach accommodates computations with infinite data structures, and that such "infinite" computations can be gracefully terminated without explicit control specifications by the user. We argue that this approach also alleviates the degree of control difficulties typically encountered in Prolog programs for solving certain classes of problems. This is achieved ( 1) by providing the ability to write program segments where the underlying computing mechanism is function reduction without any backtracking; and (2) by explicitly embodying the concept of "evaluation" (of function invocations) in Funlog programs. The model can be extended to include the notion of equality when complete E-unification algorithms are used. This chapter is organized as follows. Section 6.1 introduces a functional programming model whose reduction mechanism is based on pattern-driven |