Computability logic (CoL) -, is an elegant theory of (multi-)agent computability. In CoL, computational problems are seen as games between a machine and its environment and logical operators stand for operations on games. It understands interaction among agents in its most general — game-based — sense. On the other hand, other formalisms such as situation calculus appear to be too rudimentary to represent complex interactions among agents. In particular, CoL supports query/knowledge duality (or we call it ‘querying knowledge’): what is a query for one agent becomes new knowledge for another agent. This duality leads to dynamic knowledge migration from one agent to another agent. Note that traditional agent/object-oriented approaches  fail to support this duality. Therefore, CoL provides a promising basis for multiagent programming.
In this paper, we discuss a web-based implemention of agent programming based on CoL, which can also be seen as a distributed logic programming (or LogicWeb) model with distributed processing. We assume the following in our model:
Each agent corresponds to a web site with a URL. An agent’s knowledgebase(KB) is described in its homepage.
Agents are initially inactive. An inactive agent becomes activated when another agent invokes a query for the former.
Our model supports query/knowledge duality and querying knowledge. That is, knowledge of an agent can be obtained from another agent by invoking queries to the latter.
To make things simple, we choose CL1– the most basic fragment of CoL – as our target language. CL1 is obtained by adding to classical propositional logic two additional choice operators: disjunction () and conjunction () operators. The choice disjunction models decision steps by the machine. The choice conjunction models decision steps by the environment. For example, is a game where the machine must choose either or , while is a game where the environment must choose either or .
In this paper, we present CL1 which is a web-based implementation of CL1. This implementation is very simple and straightfoward and its correctness is rather obvious. What is interesting is that CL1 is a novel distributed logic programming model with no centralized control. It would provide a good starting point for future distributed logic programming as well as high-level web programming.
The rest of this paper is organized as follows. Some basic terminology of CL1 and CL1 will be reviewed in Section 2. Section 3 introduces the execution phase of a formula from its proof.
We review the most basic fragment of propositional computability logic called CL1 . Its language extends that of classical propositional logic by incorporating into it and . As always, there are infinitely many atoms in the language, for which we will be using the letters as metavariables. The two atoms: and have a special status in that their interpretation is fixed. Formulas of this language, referred to as CL1-formulas, are built from atoms in the standard way:
The class of CL1-formulas is defined as the smallest set of expressions such that all atoms are in it and, if and are in it, then so are , , , , , .
Let be a CL1-formula. An interpretation is a function which sends to a game . is said to be valid if, for every interpretation , there is a machine who wins the game for all possible scenarios corresponding to different behaviors by the environment.
Now we define CL1, a slight extension to CL1 with environment parameters. Let be a CL1-formula. We introduce a new env-annotated formula which reads as ‘play against an agent . For an -occurrence in , we say is the matching environment of . For example, is an agent-annotated formula and is the matching environment of both occurrences of . We extend this definition to subformulas and formulas. For a subformula of the above , we say that is the matching environment of both and .
In introducing environments to a formula , one issue is whether we allow ‘env-switching’ formulas of the form . Here represents a formula with some occurrence of a subformula . That is, the machine initially plays against agent and then switches to play against another agent in the course of playing . This kind of formulas are difficult to process. For this reason, in this paper, we focus on non ‘env-switching’ formulas. This leads to the following definition:
The class of CL1-formulas is defined as the smallest set of expressions such that (a) For any CL1-formula and any agent , are in it and, (b) if and are in it, then so are , , , .
Given a CL1-formula , the skeleton of – denoted by – is obtained by replacing every occurrence by .
For example, .
We often use instead of when it is irrelevant. In addition, we assume that each agent is identified with a physical URL address and the KB of an agent is stored in its homepage.
The following definitions comes from . They apply both to CL1 and CL1.
Understanding as an abbreviation of , a positive occurrence of a subformula is one that is in the scope of an even number of ’s. Otherwise, the occurrence is negative.
A surface occurrence of a subformula means an occurrence that is not in the scope of a choice ( or ) operator.
A formula is elementary iff it does not contain the choice operators.
The elementarization of a formula is the result of replacing, in it, every surface occurrence of the form by , and every surface occurrence of the form by .
A formula is stable iff its elementarization is valid in classical logic, otherwise it is instable.
-specification of , where is a formula and is a surface occurrence in , is a string which can be defined by:
-specification of the occurrence in itself is the empty string.
If = , then -specification of an occurrence that happens to be in is the same as the -specification of that occurrence.
If is , , or , then -specification of an occurrence that happens to be in is the string , where is the -specification of that occurrence.
The proof system of CL1 is identical to that CL1 and
has the following two rules, with , standing for CL1-formulas and for a set
Rule (A): , where is stable and, whenever has a positive (resp. negative) surface occurrence of (resp. ) whose matching environment is , for each i, contains the result of replacing in that occurrence by .
Rule (B): , where is the result of replacing in a negative (resp. positive) surface occurrence of (resp. ) whose matching environment is by for some i.
where , represent distinct non-logical atoms, and is an agent. Note that plays no roles in the proof procedure.
, rule A, no premise
, rule A, no premise
, rule B, 1
, rule B, 3
, rule B, 2
, rule B, 5
, rule A, 4 6
where , represent distinct non-logical atoms.
, rule (A). no premise
, rule B. 1
3 Execution Phase
The machine model of CL1 is designed to process only one query/formula at one time. In distributed systems, however, it is natural for an agent to receive/process multiple queries. For this reason, we introduce multiple queries to our machine. What changes are required for the machine to be able to process multiple queries at the same time? The answer is: time slicing/ context switching. That is, we assume that our machine supports multiprogramming by processing multiple queries in a time-interleaved fashion.
Concurrency typically causes a lot of complications including mutual exclusive access to resources. Fortunately, in our setting, concurrency causes relatively little complications, as there is no interaction between queries.
As discussed, the machine for CL1 requires to handle multiple queries. To do this, it maintains a queue for storing multiple queries We assume that the machine processes by executing the following procedures concurrently:
Here is the knowledgebase associated with the machine. Below we will introduce an algorithm that executes
a formula . The algorithm contains two stages:
Algorithm Exec(J): % is a CL1-formula
First stage is to initialize a temporary variable to , activate all the resource agents specified in by invoking proper queries to them. That is, for each negative occurrence of an annotated formula in , activate by querying to . Here is the current machine; On the other hand, we assume that all the querying agents – which appear positively in – are already active.
The second stage is to play according to the following procedure (which is from ):
procedure : % is a proof tree of
Case is derived by Rule (A):
Wait for the matching adversary to make a move , where -specifies a positive (negative) surface occurrence of a subformula () and . Let be the result of substituting in the above occurrence by . Then update to .
Case is derived by Rule (B):
Let be the premise of in the proof. is the result of substituting, in , a certain negative (resp. positive) surface occurrence of a subformula (resp. ) by for some . Let be the -specification of that occurrence. Then make the move , update to . Let be the matching environment. Then inform of the move .
The following proposition has been proved in .
iff is valid (any CL1-formula ).
The following proposition follows easily from Proposition 3.1, together with the observation that CL1-proof of encodes an environment-independent winning strategy for .
iff is valid (any CL1-formula ).
Proof. Let be . It is known from  that every CL1(/CL1)-proof of encodes an environment-independent winning strategy for . It follows that a machine with such a strategy wins against any environment. Hence is valid. Conversely, suppose there is no CL1/CL1-proof of . Since CL1-proof of is in fact identical to CL1-proof of , it follows from  that there is no machine who can win for some interpretation . Therefore is not valid.
In our context, a CL1-web page corresponds simply to a CL1-formula with a URL. An example is provided by the following “weather” agent which contains today’s weather (sunny or cloudy) and temperature (hot or cold).
Our language permits ‘querying knowledge’ of the form in KB. This requires the current machine to invoke the query to the agent . Now let us consider the agent which gives advice on the dress codes according to the weather condition. It contains the following four rules and two querying knowledges and relative to the agent.
|% dress codes|
Now, consider a goal ?- . Solving this goal has the effect of activating and then replacing with and with and then eventually answering to the user. Note that two queries to execute concurrently within .
We thank Giorgi Japaridze for many helpful comments.
-  E.S. Lam and I. Cervesato and N. Fatima. Comingle: Distributed Logic Programming for Decentralized Mobile Ensembles. LNCS 9037. 2015.
-  Japaridze G. Introduction to computability logic. Annals of Pure and Applied Logic, 2003, 123(1/3): 1-99.
-  Japaridze G. Propositional computability logic I. ACM Transactions on Computational Logic, 2006, 7(2): 302-330.
-  Japaridze G. Towards applied theories based on computability logic. Journal of Symbolic Logic, 2010, 75(2): 565-601.
-  Japaridze G. On the system CL12 of computability logic. http://arxiv.org/abs/1203.0103, June 2013.
-  Kwon K, Hur S. Adding Sequential Conjunctions to Prolog. International Journal of Computer Technology and Applications, 2010, 1(1): 1-3.
-  S.W. Loke and A. Davison: LogicWeb: Enhancing the Web with Logic Programming. Journal of Logic Programming, 1998, 36(3): 195-240.