Search direction by goal failure in goal-oriented programming
A new approach to goal-oriented programming is described, whereby the search for values of variables to satisfy a goal is invariably directed by that goal or by information provided by its failure. This goal-directed approach is in contrast to that employed by logic programming systems, which attempt to satisfy a goal that has failed by resatisfying an already tested goal, and which furthermore do this in a way determined solely by the order of facts and rules in the database and without reference to the goal that has failed. Proposed changes in the control structure of logic programs designed to improve their execution serve more to reduce the search space than to add goal direction. A goal-directed language that embodies the new approach is presented. It is at the same time a functional programming language and a specification interpreter for the direct execution and testing of functional specifications, and permits the user to write executable program descriptions in which some of the constituent functions are fully defined while other are 'merely' specified. The language has been successfully tested on exampled drawn from such fields as deductive question answering and problem solving, where it compares favorably with the logic programming languages.