development and application of logical actors mathematical apparatus for logic programming of web...

39
Application of Logical Application of Logical Actors Mathematical Actors Mathematical Apparatus for Logic Apparatus for Logic Programming of Web Programming of Web Agents Agents Alexei A. Morozov Alexei A. Morozov PhD, Senior Researcher PhD, Senior Researcher Institute of Radio Engineering and Institute of Radio Engineering and Electronics Electronics Russian Academy of Sciences Russian Academy of Sciences [email protected] [email protected]

Upload: aileen-weaver

Post on 01-Jan-2016

216 views

Category:

Documents


2 download

TRANSCRIPT

Development and Development and Application of Logical Application of Logical Actors Mathematical Actors Mathematical Apparatus for Logic Apparatus for Logic

Programming of Web Programming of Web AgentsAgents

Alexei A. MorozovAlexei A. MorozovPhD, Senior ResearcherPhD, Senior Researcher

Institute of Radio Engineering and ElectronicsInstitute of Radio Engineering and ElectronicsRussian Academy of SciencesRussian Academy of Sciences

[email protected]@mail.cplire.ru

What is the fundamental What is the fundamental problem to be solved in our problem to be solved in our

project?project?

We are interested in We are interested in mathematical strictnessmathematical strictness of of logic programs that operate in logic programs that operate in dynamic outer worlddynamic outer world..

Web agentsWeb agents are only a are only a particular case of such particular case of such programs. Other cases are the programs. Other cases are the following: visual user following: visual user interface, virtual reality, interface, virtual reality, control systems, etc.control systems, etc.

What is Web agent?What is Web agent?Web agentsWeb agents are programs that automate retrieval, are programs that automate retrieval,

recognition, extraction, and analysis of recognition, extraction, and analysis of information on the Internet oriented at the information on the Internet oriented at the needs of an individual user (or a group of needs of an individual user (or a group of users). users).

AgentsAgents differ from the widely used Internet differ from the widely used Internet retrieval systems in the followingretrieval systems in the following::

They can autonomously operate during They can autonomously operate during long long periods of timeperiods of time (days, weeks, or more) (days, weeks, or more) performing the task set by the userperforming the task set by the user. .

As any other program, once created, an agent As any other program, once created, an agent can be used can be used many timesmany times whereas a query to a whereas a query to a universal retrieval system invokes a single universal retrieval system invokes a single operation of information retrievaloperation of information retrieval..

An example of Web An example of Web agentagent

User interface of the User interface of the agentagent

Operation of the agentOperation of the agent

Advantages of the logic Advantages of the logic approach to the programming approach to the programming

of Web agentsof Web agents Prolog has a very Prolog has a very high level of abstractionhigh level of abstraction.. The ideology of Prolog is based on the concept of The ideology of Prolog is based on the concept of tree tree

searchsearch (backtracking) (backtracking).. The syntax of logic languages is The syntax of logic languages is simplersimpler and more and more

expressiveexpressive than that of imperative ones because than that of imperative ones because::aa.. PointersPointers are not explicitly used are not explicitly used..bb.. RecursionRecursion and and backtrackingbacktracking are used instead of are used instead of cycling and branchingcycling and branching..cc.. Any complex data item has a clear Any complex data item has a clear text text representationrepresentation..

Logic programs are a convenient object for Logic programs are a convenient object for automaticautomatic construction, analysis, and transformationconstruction, analysis, and transformation..

Logic languages are attractive for processing texts Logic languages are attractive for processing texts written in written in natural languagesnatural languages..

The main advantage of the The main advantage of the logic programming of Web logic programming of Web

agentsagents

The main advantage of logic The main advantage of logic programming is that it gives programming is that it gives means and criteria for means and criteria for estimation of estimation of mathematical mathematical strictnessstrictness of Web agent of Web agent operation. There are operation. There are model-model-theoretic semanticstheoretic semantics, as well as , as well as the the “soundness”“soundness” and and “completeness”“completeness” notions. notions.

The dynamic environment The dynamic environment problemproblem

Soundness:Soundness:

Completeness:Completeness:

The use of standard Prolog is mathematically incorrect, because the standard control strategy of Prolog doesn’t ensure soundness and completeness of inference in conditions of changing source data.

We have proposed We have proposed the repeated the repeated proving principleproving principle that is an that is an

alternative to nonmonotonic alternative to nonmonotonic approachapproach

1.1.Nonmonotonic logic is a means Nonmonotonic logic is a means formalizing the formalizing the unsoundunsound (in (in classical sense) logical classical sense) logical inference.inference.

2.2.Our task is to provide the Our task is to provide the classical soundnessclassical soundness of logic of logic program in program in dynamic outer worlddynamic outer world..

The idea of repeated The idea of repeated provingproving

Commonvariables

Logicalactors

Search space

Implementation of the Implementation of the repeated proving repeated proving

principleprinciple SequentialSequential control control

strategies supporting strategies supporting repeated proving.repeated proving.

Implicit parallelizationImplicit parallelization of of logic programs.logic programs.

Syntactic means of Syntactic means of explicit explicit definitiondefinition of concurrent of concurrent processes. processes.

The “Actor Prolog˝ The “Actor Prolog˝ projectproject

Theoretical resultsTheoretical results:: A logical interpretation of object-oriented programmingA logical interpretation of object-oriented programming.. Repeat proving of logical actors providing soundness in Repeat proving of logical actors providing soundness in

dynamic environmentdynamic environment.. A new concurrent computing modelA new concurrent computing model..

Logic programming technology issuesLogic programming technology issues:: Visual programming based on SADT (Structured Analysis Visual programming based on SADT (Structured Analysis

and Design Technique).and Design Technique). Component-oriented programmingComponent-oriented programming..

Implementation issuesImplementation issues:: All the All the Actor PrologActor Prolog agents are persistent agents are persistent.. Predefined classes support FTP andPredefined classes support FTP and HTTP nowHTTP now.. You are welcome to participate in beta testing of Actor You are welcome to participate in beta testing of Actor

PrologProlog ((http://www.cplire.ru/Lab144http://www.cplire.ru/Lab144))..

Logic Object-Oriented Logic Object-Oriented ModelModel

of Asynchronous of Asynchronous Concurrent ComputationsConcurrent Computations RFBR project no. RFBR project no. 00-01-0056000-01-00560

2000-20022000-2002

Why Logical?Why Logical?The computing model is based on the The computing model is based on the logic logic

programmingprogramming principles: principles: The model supports The model supports model-theoretic model-theoretic

semanticssemantics: any concurrent program is an : any concurrent program is an implementation of an algorithm and a logical implementation of an algorithm and a logical formula at the same time.formula at the same time.

There are mathematically strict criteria of There are mathematically strict criteria of correctness of the Web agent: correctness of the Web agent: soundnesssoundness and and completenesscompleteness..

The possibility of logical inference with The possibility of logical inference with incomplete input dataincomplete input data is essentially used in is essentially used in the model (speculative computations).the model (speculative computations).

Why Asynchronous Why Asynchronous Concurrent Concurrent

Computations?Computations?The delays of processes are not used for synchronizing processes in our computing model. Speculative computing and subsequent modification of logic inference are used instead of delays.

Why Object-Why Object-OrientedOriented??

Process is a class instance in the concurrent version of Actor Prolog, whose clauses are executed concurrently relative to clauses of other processes.

Basic Components of the Basic Components of the ModelModel

Messages Flow Direct

Residents

Process state Proven Failed Unused

Process StatesProcess States

A proven process. This state is characterized by the consistency of all actors of the process (the proof of all actors was successful).

A failed process. This state is characterized by the fact that actors of the process are inconsistent.

An unused process. The unused process can be considered as some offline component of a computing device. The processes automatically pass into this state and automatically recover from it when certain special flow messages are obtained.

Flow messagesFlow messages

A process can pass information to other processes by changing the value of their common variable. Common variables that connect processes are called ports.

Ports of ProcessesPorts of Processes

Plain ports. Protecting ports. A protected value of a

common variable can only be replaced by another protected value.

Suspending ports. Suspending ports serve for automatic passing of processes in the unused state and for their automatic recovering from this state.

Direct messagesDirect messages

A process can perform an asynchronous predicate call in the other process. The so-called informational and switching direct messages are distinguished.

The informational and switching The informational and switching direct messages differ by the direct messages differ by the

following:following:1. As a result of processing of a switching direct

message, the process can become either proven or failed, while after processing of the informational direct message, the process is always proven. If the execution of an informational direct message fails, this message is simply ignored and the process restores its former state.

2. In contrast to switching direct messages, processing of informational direct messages is suspended until the recipient process becomes proven. The suspended messages are accumulated in the buffer.

ResidentsResidents

The resident is a certain active entity observing the state of assigned (target) process and sending the collected information to its owner.

After each change in the state of the target process, the resident repeats the construction and sending of the list of values of the function.

The following correspond to The following correspond to each resident of the each resident of the

program:program:1. The owner of the resident. The owner of the

resident is the process that has created it.2. The atomic formula. This formula denotes the

call of a certain function (nondeterministic in the general case) which must be executed in the target process. The functions in Actor Prolog are implemented with the help of standard technique of program flattening.

3. The target process of a resident.4. A common variable. Using it, the resident

sends the collected information to its owner.

An example of asynchronous An example of asynchronous concurrent program (Web concurrent program (Web

agent)agent)

The difference between flow and The difference between flow and direct messages consists in the direct messages consists in the

following:following:1. Direct messages are passed directly from one

process to another (in the form of the predicate call), while the flow messages are passed from one to many processes (by changing the values of common variables).

2. Direct messages are not lost in the course of communication, while the flow messages can cancel one another if a new (updated) value of a common variable arrives before the processing of the previous value has started.

Definition 1. We say that the logic program has attained its successful final state if:

1. All the processes of the program are proven or unused.

2. Activation of residents is not required.3. The processing of no messages by processes

and residents is required.

Definition 2. The result computed by the program are the values of common variables connecting the processes of a program that has reached a successful final state.

Model-theoretic Model-theoretic semantics of semantics of

concurrent programsconcurrent programsWe have defined a scheme of transformations of an arbitrary concurrent logic program P into the sequential program P' for which the existence of the classical model-theoretic semantics is guaranteed. The declarative semantics of the program P' is taken as the semantics of the source program P.

TheoremTheorem 1. 1.A concurrent logic A concurrent logic program is program is soundsound in in respect to its model-respect to its model-theoretic semantics.theoretic semantics.

1.1. There are no non-logical built-in predicates in the text of the program. There are no non-logical built-in predicates in the text of the program.2.2. Direct messages are not used. Information between processes is Direct messages are not used. Information between processes is

transmitted only via the flow messages.transmitted only via the flow messages.3.3. The program does not get caught in an endless loop in the course of The program does not get caught in an endless loop in the course of

execution of goal statements and functions of residents.execution of goal statements and functions of residents.4.4. The functions called by residents always return a finite number of The functions called by residents always return a finite number of

values.values.5.5. Predicates computing data which are then sent by means of flow Predicates computing data which are then sent by means of flow

messages are deterministic.messages are deterministic.6.6. Information is transmitted between processes along one-direction Information is transmitted between processes along one-direction

channels only. The unidirectional data transmission in the channels only. The unidirectional data transmission in the Actor Actor PrologProlog can be modeled by means of the can be modeled by means of the protectingprotecting keyword. keyword.

7.7. There is a partial ordering of processes exchanging information. That There is a partial ordering of processes exchanging information. That is, there is no recursive transmission of data between the processes is, there is no recursive transmission of data between the processes and residents in the program.and residents in the program.

8.8. All values computed by processes and residents which must be All values computed by processes and residents which must be passed to other processes and residents are ground (i.e., they do not passed to other processes and residents are ground (i.e., they do not contain unbound variables).contain unbound variables).

TheoremTheorem  22..The concurrent program is The concurrent program is completecomplete in in respect of its model-theoretic semantics ifrespect of its model-theoretic semantics if

The main results of the RFBRThe main results of the RFBR00-01-0056000-01-00560 project ( project (2000-2000-

2002)2002) We have developed a new We have developed a new concurrent computing model concurrent computing model for logic for logic

programming. This model differs from others in the following: the programming. This model differs from others in the following: the model provides model provides soundnesssoundness and (in some special cases) and (in some special cases) completenesscompleteness of concurrent logic programs being executed in of concurrent logic programs being executed in dynamic outside dynamic outside worldworld, such that input data of the logic program could be modified , such that input data of the logic program could be modified after the start of the program.after the start of the program.

The conditions of The conditions of classical soundness and completenessclassical soundness and completeness of logic of logic programs being executed in programs being executed in dynamic outside worlddynamic outside world have been have been investigated.investigated.

We have developed methods and syntactic means for We have developed methods and syntactic means for logical logical description and analysis of the Webdescription and analysis of the Web..

We have designed and implemented an We have designed and implemented an experimental systemexperimental system for for logical search and recognition in the Internet on the basis of logical search and recognition in the Internet on the basis of developed mathematical apparatus. In particular, we have developed developed mathematical apparatus. In particular, we have developed methods of methods of visual component-oriented logic programmingvisual component-oriented logic programming of of persistentpersistent Web agentsWeb agents..

We have created several We have created several Web agentsWeb agents collecting information in the collecting information in the Internet. The experiments with these agents have demonstrated Internet. The experiments with these agents have demonstrated expediency and effectiveness of developed methods of logic expediency and effectiveness of developed methods of logic programming the programming the Web agentsWeb agents..

You are welcome to You are welcome to participate in beta testing participate in beta testing

of Actor Prologof Actor Prolog

http://www.cplire.ru/Lab144/space/prolog.html

ReferencesReferences Morozov A.A.Morozov A.A. Actor Prolog: an Object-Oriented Language Actor Prolog: an Object-Oriented Language

with the Classical Declarative Semantics // Proc. of IDL'99 with the Classical Declarative Semantics // Proc. of IDL'99 workshop. – Paris, France, September 27-28, 1999.workshop. – Paris, France, September 27-28, 1999.

Morozov A.A., Obukhov Yu.V.Morozov A.A., Obukhov Yu.V. On the Problem of Logical On the Problem of Logical Recognition in the Dynamic Internet Environment // Pattern Recognition in the Dynamic Internet Environment // Pattern Recognition and Image Analysis. – 2001. – Vol.11. – No.2. – Recognition and Image Analysis. – 2001. – Vol.11. – No.2. – pp.454-457.pp.454-457.

Morozov A.A., Obukhov Yu.V.Morozov A.A., Obukhov Yu.V. An Approach to Logic An Approach to Logic Programming of Intelligent Agents for Searching and Programming of Intelligent Agents for Searching and Recognizing Information on the Internet // Pattern Recognizing Information on the Internet // Pattern Recognition and Image Analysis. – 2001. – Vol.11. – No.3. – Recognition and Image Analysis. – 2001. – Vol.11. – No.3. – pp.570-582.pp.570-582.

Morozov A.A.Morozov A.A. On Semantic Link Between Logic, Object- On Semantic Link Between Logic, Object-Oriented, Functional, and Constraint Programming // Proc. of Oriented, Functional, and Constraint Programming // Proc. of MultiCPL'02 workshop. – Ithaca, USA, September 8, 2002. – MultiCPL'02 workshop. – Ithaca, USA, September 8, 2002. – pp.43-57.pp.43-57.

Morozov A.A., Obukhov Yu.V.Morozov A.A., Obukhov Yu.V. Development of the Development of the Methods and Tools for Mathematically Correct Logic Methods and Tools for Mathematically Correct Logic Programming of Internet Agents // Pattern Recognition and Programming of Internet Agents // Pattern Recognition and Image Analysis. – 2003. – Vol.13. – No.2. – pp.225-227.Image Analysis. – 2003. – Vol.13. – No.2. – pp.225-227.

ReferencesReferences

See also:See also:

Morozov A.A. Getting Started in Morozov A.A. Getting Started in Actor Prolog. – IRE RAS: 2002. Actor Prolog. – IRE RAS: 2002. ––

http://www.cplire.ru/Lab144/start/index.htmlhttp://www.cplire.ru/Lab144/start/index.html

Morozov A.A.Morozov A.A. Logic Object-Oriented Model of Asynchronous Logic Object-Oriented Model of Asynchronous Concurrent Computations// Pattern Recognition and Image Concurrent Computations// Pattern Recognition and Image Analysis. – 2003. – Vol.13. – No.4. – pp.640-649.Analysis. – 2003. – Vol.13. – No.4. – pp.640-649.

DiscussionDiscussion

Alexei A. MorozovAlexei A. MorozovInstitute of Radio Engineering and Electronics RASInstitute of Radio Engineering and Electronics RAS

Mokhovaya 11, Moscow 125009, RussiaMokhovaya 11, Moscow 125009, Russia [email protected]@mail.cplire.ru

Comparison with the Nonmonotonic ApproachComparison with the Nonmonotonic Approach

Comparison with the Nonmonotonic ApproachComparison with the Nonmonotonic Approach

Comparison with the Nonmonotonic ApproachComparison with the Nonmonotonic Approach

1. New data arrive in the form of terms (data items) rather than in the form of logical statements.

2. If the input data have been changed, it is only necessary to prove once again certain subgoals.

3. We stay in the framework of classical monotonic logic. We have saved all its descriptive and deductive abilities.