Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.cplire.ru/Lab144/start/e_intro.html
Дата изменения: Mon Sep 24 15:02:27 2007 Дата индексирования: Tue Oct 2 01:45:07 2012 Кодировка: Поисковые слова: п п п п п п р п р п п п |
What is the main difference between Actor Prolog and other logic languages?1. Actor Prolog supports so-called repeated proving of sub-goals. As a matter of fact, this is the reason why Actor Prolog is called "Actor" one. Logical actors are a name of these repeatedly proved sub-goals. Well, what are the repeatedly proved sub-goals and why it was so important to implement them? A logic program consists of sub-goals that must be proven in the course of an execution of the program (like a usual imperative program consists of commands to be executed). Generally, an execution of any sub-goal causes an instantiation of values of some variables. For example, the sub-goal A = 5 means an instantiation of the value A, if the variable A has no value yet (is unbound). But if the variable A has some another value, for instance 7, a proving of the sub-goal A=5 will fail, because there is logical contradiction between the statements A=5 and A=7.
In other words, there is no destructive assignment in logic languages, in ordinary sense of this term. So, if a variable has got a value in the course of an execution of a program, this value can be only instantiated, but not changed in the future. For example, a variable B could get the value At the beginning this property of logic languages did not cause any difficulties in the theory and the practice of logic programming because:
Backtracking is powerful and useful means of logic programming. It is implemented in Actor Prolog as well. Unfortunately, there is a problem with the backtracking: it is possible only inside a computer. There are irreversible processes in the real world that are beyond a control of the backtracking. Let us imagine that a program outputs something on a printer. In the case of backtracking the program will return to an initial state. But what should the printer do? Should it erase a printed text? To make a long story short, the ideology of logic programming appeared to be insufficient for development of programs working in dynamic environment. The idea of logical actors was developed as our answer to this challenge. Thus, a program written in Actor Prolog consists of some repeatedly proved sub-goals (logical actors). Not all of the sub-goals of the program are repeatedly proved. Now (at the 2002 A.D.) the repeatedly proved sub-goals are the 'goal' predicates that are called automatically during creation of every new class instance. All other sub-goals are called by these logical actors of the program. So, if one need to assign a new value 5 to a variable A that already has another value 7, one should defeat the results of proving of all actors that have logical contradiction with the statement A=5. Then one should carry out a new (repeated) proving of these actors with the additional condition A=5. If this operation completes successfully, it will implement a destructive assignment that is correct from the logical point of view. If the operation fails, then the destructive assignment is impossible, and the standard backtracking of the program will occur. One could say that backtracking is a partial defeat of results of proving of all sub-goals of a program, returning the program to a previous state. There are some logical actors in the outside world from the standpoint of the ideology of Actor Prolog, and a program interacts with these external actors. These external actors have the following properties:
Thus the spoilt sheet of paper is an actor the backtracking of that will never completed and the repeated proving of that will never happened. A blinking bulb on a display is an actor proved repeatedly with some constant period of time, etc. As a matter of fact, we made nothing especial, but we have considered honestly contradictions in the ideology of logic programming and proposed a way to overcome them. Afterward the honest look to the world appears to be very useful. The development of the idea of logical actors has lead to appearance of new principles of event-driven and concurrent programming. The point is that the elimination of the contradictions between the logical actors and repeated proving resemble so-called daemons that are used in the area of artificial intelligence for a long time. Also a possibility to defeat of results of separate actors allows us to implement speculative computing in the course of concurrent execution of a program. In other words, one can calculate something without a wait of all necessary source data, because the proof can be modified after its completion if some new information arrives. So, one can write concurrent programs without any synchronizing commands. It is difficult to predict now, what another "crazy" ideas will be implemented on the basis of the logical actors in the future. I should note only that all new principles of data processing obtained in the course of the research are an essential corollary of basic principles of logic programming. What we have made is a way to implement these principles honestly and purposefully in programming of a computer working in dynamic environment. Dear colleagues! If you have read this text to this point, then it is the time to explain what the difference between our approach and non-monotonic logic, temporal logic, modal logic, transaction logic, defeasible logic, and other useful things developed earlier in the mathematics, artificial intelligence, and logic programming is. The difference is that the repeatedly proved sub-goals are a new principle of logic inference but not a new logic (moreover, one could propose several control strategies implementing this principle in Prolog). We perform a logic inference in usual first-order logic, like the standard Prolog does. Thus, logical actors are a means for implementing modified reasoning in dynamic environment but not a means for a reasoning on dynamic properties of objects or properties of the outside world. Note also that there is no contradiction between these two things. The method of repeated proving could be used for inference in other logic systems, including temporal and modal logic as well. It is an interesting subject for new research. 2. All programs written in Actor Prolog are persistent. It means that you can save a state of a program into a file and switch off the computed. Then you can continue the execution of the program from the saved point. Actor Prolog can save states of all objects of a program including content of text windows and positions of open files. This feature was created specially for implementing of so-called intelligent agents. Intelligent agents are programs autonomously fulfilling tasks that are given them by user, during long periods of time (days, weeks, months, and more). For instance, intelligent agent can search and collect information at Internet. It is no need to explain importance of the possibility to save and restore a state of an agent in the case of crash or damage of the computer. Furthermore, I can delay execution of my agents, switch off the computer and go home at any time. I can also transfer an agent to another computer with the help of usual floppy disk. |
Table of content |