Multi-Context Systems: Dynamics and Evolution (Pre-Print of "Multi-context systems in dynamic environments")

06/12/2021 ∙ by Pedro Cabalar, et al. ∙ Università degli Studi dell'Aquila Universidade da Coruña Università Perugia 0

Multi-Context Systems (MCS) model in Computational Logic distributed systems composed of heterogeneous sources, or "contexts", interacting via special rules called "bridge rules". In this paper, we consider how to enhance flexibility and generality in bridge-rules definition and application. In particular, we introduce and discuss some formal extensions of MCSs useful for a practical use in dynamic environments, and we try to provide guidelines for implementations

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Multi-Context Systems (MCSs) have been proposed in Artificial Intelligence and Knowledge Representation to model information exchange among heterogeneous sources

BrewkaE07 ; BrewkaEF11 ; BrewkaEP14 . MCSs do not make any assumption about such sources nor require them to be homogeneous; rather, the MCS approach deals explicitly with their different representation languages and semantics. These sources, also called contexts or modules, interact through special interconnection expressions called bridge rules

; such rules are very similar in syntax and in meaning to logic programming rules as seen in Datalog (cf.

lloyd:foundations ; lpneg:survey ) or Answer Set Programming (ASP, cf. GelLif88 ; GelLif91 ; MarTru99 ; Gelfond07 for foundations. See also ErdemGL16 and the references therein for applications of ASP), save that atoms in their bodies refer to knowledge items to be obtained from external contexts. So, a literal (where is an atom) in the body of a bridge rule occurring in context means that can be proved in context (given ’s underlying logic and semantics and given ’s knowledge base present contents), vice versa means that cannot be proved in . In case the entire body “succeeds” then the bridge rule can be applied, and its conclusion can be exploited within context .

The reason why MCSs are particularly interesting is that they aim at a formal modeling of real applications requiring access to distributed sources, possibly on the web. In many application domains the adoption of MCSs can bring real advances, whenever different types of heterogeneous information systems are involved and a rigorous formalization should be adopted, also in view of reliability and verifiability of the resulting systems. Notice that this kind of systems often involves agents; MCSs encompassing logical agents have in fact been proposed in the literature (cf., CostantiniDM1 ).

Given the potential impact of MCSs for practical knowledge representation and reasoning, there are some aspects in which their definition is still too abstract. In this paper, we introduce and discuss some formal extensions of MCSs useful for a practical use in dynamic environments and we try to provide guidelines for implementations. The paper considers the following aspects:

  1. The specification of bridge-rule grounding and of grounded equilibria, and a concept of proactive bridge-rule activation, i.e., a bridge-rule in our approach is no longer reactively applied whenever applicable, but rather it must be explicitly enabled by the context where it occurs.

  2. The explicit definition of the evolution of an MCS over time in consequences of updates that can be more general than sensor input as treated in BrewkaEP14 .

  3. A further refinement of bridge-rule grounding in an evolving MCS.

  4. Bridge Rules Patterns, by which we make bridge rules parametric w.r.t. contexts by introducing special terms called context designators to be replaced by actual context names; this is in our opinion a very important extension, which allow general bridge rules schemata to be specialized to actual bridge rules by choosing which specific contexts (of a certain kind) should specifically be queried in the situation at hand.

  5. Dynamic MCSs whose composition can change over time as the context may join or leave the system, or can be unavailable at certain time intervals (e.g., due to system/network faults).

  6. Multi-Source option, i.e., whenever a context can obtain the required information from several other contexts, a choice may be possible concerning the preferred source, where preferences may change over time and according to current circumstances.

  7. The definition of practical modalities of execution of bridge rules in a distributed MCS.

All these extensions represent substantial and much-needed improvements to the basic MCS framework, as certified by existing connections with related work on MCSs that treat (though in a different way) the same issues. For instance, concerning the fact that a static set of bridge rules associated to a context can sometimes be unsatisfactory, we mention the work of GoncalvesKL14a , where, at run-time, new bridge rules can be “observed”, i.e., learned from outside. Such rules can be added to existing ones or can replace them and a check on consistency among bridge-rules conclusions is done after the update. This very interesting work is complementary to our proposal, where new bridge rules are generated inside a context from general meta-level schemata; a combination of the two approaches might confer much more flexibility to contexts’ operation. Also, concerning MCSs that evolve in time, much work has been done, e.g., in BrewkaEP14 ; GoncalvesKL14b ; GoncalvesKL14a ; our approach either generalizes such proposals or, at least, can be combined with them.

This paper is a revised extended version of the work presented in CostantiniDG16 ; CostantiniCF17 . In the rest of the paper, we first recall the MCS approach. Then, after illustrating a motivating scenario, we introduce a list of aspects concerning MCS that are in our opinion problematic, or that might be improved; in the subsequent sections, for every such aspect we discuss and formalize some variations, enhancements, and extensions to basic MCSs that we deem to be necessary/useful to improve the basic paradigm. Subsequently we present a case study, we discuss the complexity of the enhanced framework and finally we conclude. We have chosen to discuss related work whenever a discussion is useful and pertinent rather than in a separate section.

2 Bridge Rules and Multi-Context Systems

Heterogeneous MCSs have been introduced in GiunchigliaS94 in order to integrate different inference systems without resorting to non-classical logic systems. Later, the idea has been further developed and generalized to non-monotonic reasoning domains —see, for instance, BrewkaE07 ; BrewkaEF11 ; BrewkaEFW11 ; BrewkaEP14 ; Serafini2004 among many. (Managed) MCSs are designed for the construction of systems that need to access multiple (heterogeneous) data sources called contexts. The information flow is modeled via bridge rules, whose form is similar to Datalog rules with negation where however each element in their “body” explicitly includes the indication of the contexts from which each item of information is to be obtained. To represent the heterogeneity of sources, each context is supposed to be based on its own logic, defined in a very general way BrewkaEF11 . A logic defines its own syntax as a set of possible formulas (or -elements) under some signature possibly containing predicates, constants, and functions. As usual, formulas are expressions built upon the idea of atom, that is, the application of a predicate to a number (the predicate arity) of terms. The latter, in their turn, can be variables, constants, or compound terms using function symbols, as usual. A term/atom/formula is ground if there are no variables occurring therein. A logic is relational if in its signature the set of function symbols is empty, so its terms are variables and constants only. Formulas can be grouped to form some knowledge base, . The set of all knowledge bases for is defined as some . The logic also defines beliefs or data (usually, ground facts) that can be derived as consequences from a given . The set represents all possible belief sets in logic . Finally, the logic specification must also define some kind of inference or entailment. This is done by defining which belief sets are acceptable consequences of a given with a relation . Thus, means that belief set is an acceptable consequence of knowledge base . We can also use as a function where is the same as as a relation. To sum up, logic can be completely specified by the triple .

A multi-context system (MCS) is a set of contexts, each of them of the form , where is the context name (unique for each context; if a specific name is omitted, can act as such), is a logic, is a knowledge base, and is a set of bridge rules. Each bridge rule has the form

(1)

where the left-hand side is called the head, denoted as , the right-hand side is called the body, denoted as , and the comma stands for conjunction. We define the positive (resp. negative) body as (resp. ). The head is a formula in such that . Each element in the body has the form for a given , , and can be seen as a query to the context (possibly different from ) whose name is , to check the status of belief (a formula from ) with respect to the current belief state (defined below) in . When the query is made in the context we will omit the context name, simply writing instead of . A relational MCS FinkGW11 is a variant where all the involved logics are relational and aggregate operators in database style (like sum, count, max, min) are admitted in bridge-rule bodies.

A belief state (or data state) of an MCS  is a tuple such that for , . Thus, a data state associates to each context a possible set of consequences . A bridge rule of context is applicable in belief state when, for any , , and for any , ; so, is the set composed of the head of those bridge rules which are applicable in .

In managed MCSs (mMCSs)111For the sake of simplicity, we define mMCS simply over logics instead of “logic suite” as done in BrewkaEFW11 , where one can select the desired semantics among a set of possibilities. the conclusion , which represents the “bare” bridge-rule result, becomes , where is a special operator. The meaning is that is processed by operator , that can perform any elaboration, such as format conversion, belief revision, etc. More precisely, for a given logic with formulas , a management base is a set of operation names (briefly, operations) , defining elaborations that can be performed on formulas. For a logic and a management base , the set of operational statements that can be built from and is . The semantics of such statements is given by a management function, , which maps a set of operational statements and a knowledge base into a (possibly different) modified knowledge base.222We assume a management function to be deterministic, i.e., to produce a unique new knowledge base. Now, each context in an mMCS is extended to include its own management function which is crucial for knowledge incorporation from external sources. Notice that, management functions are not required to be monotonic operators.

The application of the management function to the result of the applicable rules must be acceptable with respect to . We say that a belief state is an equilibrium for an mMCS iff, for ,

(2)

Namely, one

  1. applies all the bridge rules of that are applicable in the belief state  (namely, the set );

  2. applies the management function which, by incorporating bridge-rule results into ’s knowledge base , computes a new knowledge base ;

  3. determines via the set of acceptable sets of consequences of .

In an equilibrium, such a set includes , i.e., an equilibrium is “stable” w.r.t. bridge-rule application.

Conditions for existence of equilibria and the complexity of deciding equilibrium existence for mMCS have been studied BrewkaE07 ; roughly speaking, such complexity depends on the complexity of computing formula (2) for each . Algorithms for computing equilibria have been recently proposed BrewkaEF11 ; EiterDFK2014 but, in practice, they are only applicable when open-access to contexts’ contents is granted. For practical purposes, one will often provisionally assume that equilibria exist, and that they do not include inconsistent data sets. It has been proved that such local consistency is achieved whenever all management functions are (lc-)preserving, i.e., if they always determine a which is consistent.

3 Motivating Scenarios and Discussion

Some of the reasons of our interest in (m)MCSs and bridge-rules stem from a project where we are among the proponents FeK2016 , concerning smart Cyber Physical Systems, with particular attention (though without restriction) to applications in the e-Health field. The general scenario of such “F&K” (“Friendly-and-Kind”) systems FeK2016 is depicted in Figure 1.

In such setting we have a set of computational entities, of knowledge bases, and of sensors, all immersed in the “Fog” of the Internet of Everything. All components can, in time, join or leave the system. Some computational components will be agents. In the envisaged e-Health application for instance, an agent will be in charge of each patient. The System’s engine will keep track of present system’s configuration, and will enable the various classes of rules to work properly. Terminological rules will allow for more flexible knowledge exchange via Ontologies. Pattern Rules will have the role of defining and checking coherence/correctness of system’s behavior. Bridge rules are the vital element, as they allow knowledge to flow among components in a clearly-specified principled way: referring to Figure 1, devices for bridge-rule functioning can be considered as a part of the System’s engine. Therefore, F&Ks are ”knowledge-intensive” systems, providing flexible access to dynamic, heterogeneous, and distributed sources of knowledge and reasoning, within a highly dynamic computational environment. We basically consider such systems to be (enhanced) mMCSs: as mentioned in fact, suitable extensions to include agents and sensors in such systems already exist.

Figure 1: Motivating Scenario

Another application (depicted in Figure 2) in a very different domain though with some analogous features is aimed at Digital Forensics (DF) and Digital Investigations (DI). Digital Forensics is a branch of criminalistics which deals with the identification, acquisition, preservation, analysis, and presentation of the information content of computer systems, or in general of digital devices, in relation to crimes that have been perpetrated. The objective of the Evidence Analysis stage of Digital Forensics, or more generally of Digital Investigations, is to identify, categorize, and formalize digital sources of evidence (or, however, sources of evidence represented in digital form). The objective is to organize such sources of proof into evidences, so as to make them robust in view of their discussion in court, either in civil or penal trials.

Figure 2: Digital Forensics (DF) and Digital Investigations (DI) Scenario

In recent work333Supported by Action COST CA17124 “DIGFORASP: DIGital FORensics: evidence Analysis via intelligent Systems and Practices, start September 10, 2018.” CostantiniLPNMR215 ; OlivieriTh16 we have identified a setting where an intelligent agent is in charge of supporting the human investigator in such activities. The agent should help identify, retrieve, and gather the various kinds of potentially useful evidence, process them via suitable reasoning modules, and integrate the results into coherent evidence. In this task, the agent may need to retrieve and exploit knowledge bases concerning, e.g., legislation, past cases, suspect’s criminal history, and so on. In the picture, the agent considers: results from blood-pattern analysis on the crime scene, which lead to model such a scene via a graph, where suitable graph reasoning may reconstruct the possible patterns of action of the murderer; alibi verification in the sense of a check of the GPS positions of suspects, so as to ascertain the possibility of her/him being present on the crime scene on the crime time; alibi verification in the sense of double-checking the suspect’s declarations with digital data such as computer logs, videos from video cameras situated on the suspect’s path, etc. All the above can be integrated with further evidence such as the results of DNA analysis and others. The system can also include Complex Event Processing so as to infer from significant clues the possibility that a crime is being or will be perpetrated.

In our view also this system can be seen as an (enhanced) mMCSs. In reality however, many of the involved data must be retrieved, elaborated, or checked from knowledge bases belonging to organizations which are external to the agent, and have their own rules and regulations for data access and data elaboration. Therefore, suitable modalities for data retrieval and integration must be established in the agent to correctly access such organizations. Therefore, a relevant issue that we mention but we do not treat here is exactly that of modalities of access to contexts included in an MCS, which can possibly include time limitations and the payment of fees.

In the perspective of the definition and implementation of such kind of systems as mMCSs, the definition recalled in Section 2 must be somehow enhanced. Our first experiments show in fact that such definition is, though neat, too abstract when confronted with practical implementation issues.

We list below and discuss some aspects that constitute limitations to the actual flexible applicability of the MCS paradigm, or that might anyway be usefully improved. For the sake of illustration, we consider throughout the rest of the paper two running examples. The first example has been introduced in CostantiniF16a , where we have proposed Agent Computational Environments (ACE), that are actually MCSs including agents among their components. In CostantiniF16a , an ACE has been used to model a personal assistant agent aiding a prospective college student; the student has to understand to which universities she could send an application, given the subjects of interest, the available budget for applications and then for tuition, and other preferences. Then she has to realize where to perform the tests, and where to enroll among the universities that have accepted the application. The second example concerns F&Ks, and is developed in detail in Section 9 where we propose a full though small case study. There, a patient can be in need of a medical doctor, possibly a specialized one, and may not know in advance which one to consult. In the example we adopt a Prolog-like syntax (for surveys about logic programming and Prolog, cf. lloyd:foundations ; lpneg:survey ), with constant, predicate and function symbols indicated by names starting with a lowercase letter, and variable symbols indicated by names starting with an uppercase letter.

Grounded Knowledge Assumption.

Bridge rules are by definition ground, i.e., they do not contain variables. In BrewkaEFW11 it is literally stated that [in their examples] they “use for readability and succinctness schematic bridge rules with variables (upper case letters and ’_’ [the ’anonymous’ variable]) which range over associated sets of constants; they stand for all respective instances (obtainable by value substitution)”. The basic definition of mMCS does not require either contexts’ knowledge bases or bridge rules to be finite sets. Though contexts’ knowledge bases will in practice be finite, they cannot be assumed to necessarily admit a finite grounding, and thus a finite number of bridge-rules’ ground instances. This assumption can be reasonable, e.g., for standard relational databases and logic programming under the answer set semantics Gelfond07 . In other kinds of logics, for instance simply “plain” general logic programs, it is no longer realistic. In practical applications however, there should either be a finite number of applicable (ground instances of) bridge-rules, or some suitable device for run-time dynamic bridge-rule instantiation and application should be provided. The issue of bridge-rule grounding has been discussed in BarilaroFRT13 for relational MCSs, where however the grounding is performed over a carefully defined finite domain, composed of constants only. Consider for instance a patient looking for a cardiologist from a medical directory, represented as a context, say, e.g., called . A ground bridge rule might look like:

where the patient would confirm what she already knows, i.e., the rule verifies that Dr. Maggie Smith is actually listed in the directory. Instead, a patient may in general intend to use a rule such as:

where the query to the medical directory will return in variable the name (e.g., Maggie Smith) of a previously unknown cardiologist. Let us assume that is instantiated to which is the name of a context representing the cardiologist’s personal assistant.

Similarly, a prospective student’s personal assistant will query universities about the courses that they propose, where this information is new and will be obtained via a bridge rule which is not ground.

Notice that for actual enrichment of a context’s knowledge one must allow value invention, that is, a constant returned via application of a non-ground bridge rule may not previously occur in the destination module; in this way, a module can “learn” really new information through inter-context exchange.

Update Problem.

Considering inputs from sensor networks as done in BrewkaEP14 is a starting point to make MCSs evolve in time and to have contexts which update their knowledge base and thus cope flexibly with a changing environment. However, sources can be updated in many ways via the interaction with their environment. For instance, agents are supposed to continuously modify themselves via sensing and communication with other agents, but even a plain relational database can be modified by its users/administrators. Referring to the examples, a medical directory will be updated periodically, and universities will occasionally change the set of courses that they offer, update the fees and other features of interest to students. Where one might adopt fictitious sensors (as suggested in relevant literature) in order to simulate many kinds of update, a more general update mechanism seems in order. Such mechanism should assume that each context has its own update operators and its own modalities of application. An MCS can be “parametric” w.r.t. contexts’ update operators as it is parametric w.r.t. contexts’ logics and management functions.

Logical Omniscience Assumption and Bridge Rules Application Mechanisms.

In
MCS, bridge rules are supposed to be applied whenever their body is entailed by the current data state. In fact bridge rules are, in the original MCS formulation, a reactive device where each bridge rule is applied whenever applicable. In reality, contexts are in general not logical omniscient and will hardly compute their full set of consequences beforehand. So, the set of bridge rules which are applicable at each stage is not fully known. Thus, practical bridge rule application will presumably consist in an attempt of application, performed by posing queries, corresponding to the elements of the body of the bridge rule, to other contexts which are situated somewhere in the nodes of a distributed system. The queried contexts will often determine the required answer upon request. Each source will need time to compute and deliver the required result and might even never be able to do so, in case of reasoning with limited resources or of network failures. Moreover, contexts may want to apply bridge rules only if and when their results are needed. So, a generalization of bridge-rule applicability in order to make it proactive rather than reactive can indeed be useful. For instance, a patient might look for a cardiologist (by enabling the bridge rule seen above) only if some health condition makes it necessary.

Static Set of Bridge Rules.

Equipping a context with a static set of bridge rules can be a limitation; in fact, in such bridge rules all contexts to be queried are fully known in advance. In contexts’ practical reasoning instead, it can become known only at “run-time” which are the specific contexts to be queried in the situations that practically arise. To enhance flexibility in this sense, we introduce Bridge Rules Patterns to make bridge rules parametric w.r.t. the contexts to be queried; such patterns are meta-level rule schemata where in place of contexts’ names we introduce special terms called context designators. Bridge rule patterns can be specialized to actual bridge rules by choosing which specific contexts (of a certain kind) should specifically be queried in the situation at hand. This is, in our opinion, a very important extension which avoid a designer’s omniscience about how the system will evolve. For instance, after acquiring as seen above, the reference to a reliable cardiologist (e.g., ), the patient (say Mary) can get in contact with the cardiologist, disclose her health condition , and thus make an appointment for time . This, in our approach, can be made by taking a general bridge rule

where is intended as a placeholder, that we call context designator, that is intended to denote a context not yet known. Such bridge rule pattern can be instantiated, at run-time, to the specific bridge rule

Static System Assumption.

The definition of mMCS might realistically be extended in order to encompass settings where the set of contexts changes over time. This to take into account dynamic aspects such as momentarily disconnections of contexts or the fact that components may freely either join or abandon the system or that inter-context reachability might change over time.

Full System Knowledge Assumption and Unique Source Assumption.

A context might know the role of another context it wants to query (e.g., a medical directory, or diagnostic knowledge base) but not its “name” that could be, for instance, its URI or anyway some kind of reference that allows for actually posing a query. In the body of bridge rules, each literal mentions however a specific context (even for bridge rule patterns, context designators must be instantiated to specific context names). We enrich the MCS definition with a directory facility, where instead of context names bridge rules may employ queries to the directory to obtain contexts with the required role. Each “destination” context might have its own preferences among contexts with the same role. We also introduce a structure in the system, by allowing to specify reachability, i.e., which context can query which one. This corresponds to the nature of many applications: a context can sometimes be not allowed to access all or some of the others, either for a matter of security/privacy or for a matter of convenience. Often, information must be obtained via suitable mediation, while access to every information source is not necessarily either allowed or desirable.

Uniform Knowledge Representation Format Assumption.

Different contexts might represent similar concepts in different ways: this aspect is taken into account in CostantiniDM2 (and so it is not treated here), where ontological definitions can be exchanged among contexts and a possible global ontology is also considered.

Equilibria Computation and Consistency Check Assumption.

Algorithms for computing equilibria are practically applicable only if open access to contexts’ contents is granted. The same holds for local and global consistency checking. However, the potential of MCSs is, in our view, that of modeling real distributed systems where contexts in general keep their knowledge bases private. Therefore, in practice, one will often just assume the existence of consistent equilibria. This problem is not treated here, but deserves due attention for devising interesting sufficient conditions.

In the next sections we discuss each aspect, and we introduce our proposals of improvement. We devised the proposed extensions in the perspective of the application of mMCSs; in view of such an application we realized in fact that, primarily, issues related to the concrete modalities of bridge-rule instantiation, activation and execution need to be considered.

4 Grounded Knowledge Assumption

To the best of our knowledge, the problem of loosening the constraint of bridge-rules groundedness has not been so far extensively treated in the literature and no satisfactory solution exists. The issue has been discussed in BarilaroFRT13 for relational MCSs, where however the grounding of bridge rules is performed over a carefully defined finite domain composed of constants only. Instead, we intend to consider any, even infinite, domain.

In the rest of this section we first provide by examples an intuitive idea of how grounding might be performed, step by step, along with the computation of equilibria. Then, we provide a formalization of our ideas.

4.1 Intuition

The procedure for computing equilibria that we propose for the case of non-ground bridge rules is, informally, the following.

  1. We consider a standard initial data state .

  2. We instantiate bridge rules over ground terms occurring in ; we thus obtain an initial bridge-rule grounding relative to .

  3. We evaluate whether is an equilibrium, i.e., if coincides with the data state  resulting from applicable bridge rules.

  4. In case is not an equilibrium, bridge rules can now be grounded w.r.t. terms occurring in , and so on, until either an equilibrium is reached, or no more applicable bridge rules are generated.

It is reasonable to set the initial data state from where to start the procedure as the “basic” data state where each element consists of the set of ground atoms obtained from the initial knowledge base of each context, i.e., the context’s Herbrand Universe lloyd:foundations obtained by substituting variables with constants: one takes functions, predicate symbols and constants occurring in each context’s knowledge base and builds the context’s data state element by constructing all possible ground atoms. By definition, a ground instance of a context ’s knowledge base is in fact an element of , i.e., it is indeed a set of possible consequences, though in general it is not acceptable. As seen below starting from , even in cases when it is a finite data state, does not guarantee neither the existence of a finite equilibrium, nor that an equilibrium can be reached in a finite number of steps.

Consider as a first example an MCS composed of two contexts and , both based upon plain Prolog-like logic programming and concerning the representation of natural numbers. Assume such contexts to be characterized respectively by the following knowledge bases and bridge rules (where has no bridge rule).

The basic data state is , where in fact ’s initial data state is empty because there is no constant occurring in . The unique equilibrium is reached in one step from via the application of which “communicates” fact to . In fact, due to the recursive rule, we have the equilibrium where  and I.e., is an infinite set representing all natural numbers.

If we assume to add a third context with empty knowledge base and a bridge rule defined as  ,   then the equilibrium would be with . There, in fact, would be grounded on the infinite domain of the terms occurring in , thus admitting an infinite number of instances.

The next example is a variation of the former one where a context “produces” the even natural numbers (starting from ) and a context

the odd ones. In this case

is empty.

We may notice that the contexts in the above example enlarge their knowledge by means of mutual “cooperation”, similarly to logical agents. Let us consider again, according to our proposed method, the basic data state . As stated above, bridge rules are grounded on the terms occurring therein. is not an equilibrium for the given MCS. In fact, the bridge rule in , once grounded on the constant , is applicable but not applied. The data set resulting from the application, namely, is not an equilibrium either, because now the bridge rule in (grounded on ) is in turn applicable but not applied.

We may go on, as leaves the bridge rule in to be applied (grounded on ), and so on. There is clearly a unique equilibrium that cannot however be reached within finite time, though at each step we have a data state composed of finite sets.

The unique equilibrium (reached after a denumerably infinite number of steps), is composed of two infinite sets, the former one representing the even natural numbers (including zero) and the latter representing the odd natural numbers. The equilibrium may be represented as:

We have actually devised and applied an adaptation to non-ground bridge rules of the operational characterization introduced in BrewkaE07 for the grounded equilibrium of a definite MCS. In fact, according to the conditions stated therein and are monotonic and admit at each step a unique set of consequences and bridge-rule application is not unfounded (cyclic). In our more general setting however, the set of ground bridge rules associated to given knowledge bases cannot be computed beforehand and the step-by-step computation must take contexts interactions into account.

Since reaching equilibria finitely may have advantages in practical cases, we show below a suitable reformulation of the above example, that sets via a practical expedient a bound on the number of steps. The equilibrium reached will be partial, in the sense of representing a subset of natural numbers, but can be reached finitely and is composed of finite sets.

We require a minor modification in bridge-rule syntax that we then take as given in the rest of the paper; we assume in particular that whenever in some element the body of a bridge rule the context is omitted, i.e., we have just instead of , then we assume that is proved locally from the present context’s knowledge base. Previous example can be reformulated as follows, where we assume the customary Prolog syntax and procedural semantics, where elements in the body of a rule are proved/executed in left-to-right order. The knowledge bases and bridge rules now are:

In the new definition there is a counter (initialized to zero) and some threshold, say . We will exploit a management function that suitably defines the operator which is now applied to bridge-rule results. A logic programming definition of such management function might be the following, where the counter is incremented and the new natural number asserted. Notice that such definition is by no means not logical, as we can shift to the “evolving logic programming” extension jelia02:evolp .

Consequently, bridge rules will now produce a result only until the counter reaches the threshold, which guarantees the existence of a finite equilibrium.

4.2 Formalization

Below we formalize the procedure that we have empirically illustrated via the examples, so as to generalize to mMCS with non-ground bridge rules the operational characterization of BrewkaE07 for monotonic MCSs (i.e., those where each context’s knowledge base admits a single set of consequences, which grows monotonically when information is added to the context’s knowledge base). Following BrewkaE07 , for simplicity we assume each bridge-rule body to include only positive literals, and the formula in its head to be an atom. So, we will be able to introduce the definition of grounded equilibrium of grade . Preliminarily, in order to admit non-ground bridge rules we have to specify how we obtain their ground instances and how to establish applicability.

Definition 1

Let be a non-ground bridge rule occurring in context of a given mMCS with belief state . A ground instance of w.r.t.  is obtained by substituting every variable occurring in (i.e., occurring either in the elements in the body of or in its head or in both) via (ground) terms occurring in .

For an mMCS , a data state and a ground bridge rule , let be a Boolean-valued function which checks, in the ground case, bridge-rule body entailment w.r.t. . Let us redefine bridge-rule applicability.

Definition 2

The set relative to ground bridge rules which are applicable in a data state of a given mMCS is now defined as follows.

We assume, analogously to BrewkaE07 , that a given mMCS is monotonic, which here means that for each the following properties hold:

  1. is monotonic w.r.t. additions to the context’s knowledge base, and

  2. is monotonic, i.e., it allows to only add formulas to ’s knowledge base.

Let, for a context , the function be a variation of which selects one single set among those generated by and let be monotonic. Namely, given a context and a knowledge base , where . Let, moreover,

be the first infinite ordinal number isomorphic to the natural numbers. We introduce the following definition:

Definition 3

Let be an mMCS with no negative literals in bridge-rule bodies, and assume arbitrary choice of function for each composing context . Let, for each , be the grounding of w.r.t. the constants occurring in any , for . A data state of grade is obtained as follows.

For and , we let , and we let

For each , we let with and where, for finite and we have

while if we put

Differently from BrewkaE07 , the computation of a new data state element is provided here according to mMCSs, and thus involves the application of the management function to the present knowledge base so as to obtain a new one. Such data state element is then the unique set of consequences of the new knowledge base, as computed by the function.

The result can be an equilibrium only if the specified grade is sufficient to account for all potential bridge-rules applications. In the terminology of BrewkaE07 it would then be a grounded equilibrium, as it is computed iteratively and deterministically from the contexts’ initial knowledge bases. We have the following.

Definition 4

Let be a monotonic mMCS with no negative literals in bridge-rule bodies. A belief state is a grounded equilibrium of grade of iff , for .

Proposition 1

Let be a monotonic mMCS with no negative literals in bridge-rule bodies. A belief state is a grounded equilibrium of grade (or simply ’a grounded equilibrium’) for iff is an equilibrium for .

Proof

is an equilibrium for because it fulfills the definition by construction. In fact, step-by-step all applicable bridge rules will have been applied, so , obtained via steps, is stable w.r.t. bridge rule application. ∎

Notice that reaching a grounded equilibrium of grade does not always require an infinite number of steps: the procedure of Definition 3 can possibly reach a fixpoint in a number of steps, where either or is finite. In fact, the required grade for obtaining an equilibrium would be in the former version of the example, where in the latter version if setting threshold we would have .

Several grounded equilibria may exist, depending upon the choice of . We can state the following relationship with BrewkaE07 :

Proposition 2

Let be a definite MCS (in the sense of BrewkaE07 ), and let be a grounded equilibrium for according to their definition. Then, is a grounded equilibrium of the mMCS ’obtained by including in the same contexts as in , and, for each context , letting , and associating to a management function  that just adds to every such that .

Proof

As all the bridge rules in both and are ground, the procedure of Definition 3 and the procedure described on page 4 (below Definition 11) in BrewkaE07 become identical, as we added only two aspects, i.e., considering non-ground bridge rules, and considering a management function, which are not applicable to . ∎

In BrewkaE07 , where the authors consider ground bridge rules only, they are able to transfer the concept of grounded equilibrium of grade  of a monotonic MCS to its extensions, where an extension is defined below. Intuitively, an extension of (m)MCS has the same number of contexts, each context in has the same knowledge base of the corresponding context in , but, possibly, a wider set of bridge rules; some of these bridge rules, however, extend those in as they agree on the positive bodies.

Definition 5

Let be a monotonic (m)MCS with no negative literals in bridge-rule bodies. A monotonic (m)MCS is an extension of iff for each , we have that where implies where and may be nonempty. We call and corresponding bridge rules.

In BrewkaE07 it is stated that a grounded equilibrium of grade  of a definite MCS is a grounded equilibrium of grade  of any extension of that can be obtained from by: canceling all bridge rules where does not imply the negative body, and canceling the negative body of all remaining bridge rules. We may notice that BrewkaE07 proceeds from to via a reduction similar to the Gelfond-Lifschitz reduction GelLif88 . In our case, we assume to extend the procedure of Definition 3 by dropping the assumption of the absence of negation in bridge-rule bodies. So, the procedure will now be applicable to monotonic MCSs in general. Then, we have that:

Proposition 3

Let be a monotonic (m)MCS with no negative literals in bridge-rule bodies, and let be an extension of . Let be a grounded equilibrium for , reachable in steps. is a grounded equilibrium for iff, if applying the procedure of Definition 3 to both and , we have that , iff , where and are corresponding bridge rules and are the data states at step of and , respectively.

Proof

The result follows immediately from the fact that at each step corresponding bridge rules are applied in and on the same knowledge bases, so at step the same belief state will have been computed. A proof by induction is thus straightforward. ∎

5 Update Problem: Update Operators and Timed Equilibria

Bridge rules as defined in mMCSs are basically a reactive device, as a bridge rule is applied whenever applicable. In dynamic environments, however, a bridge rule in general will not be applied only once, and it does not hold that an equilibrium, once reached, lasts forever. In fact, in recent extensions to mMCS, contexts are able to incorporate new data items coming from observations, so that a bridge rule can be, in principle, re-evaluated upon new observations. For this purpose, two main approaches have been proposed for this type of mMCSs: so-called reactive BrewkaEP14 and evolving GoncalvesKL14b multi-context systems. A reactive MCS (rMCS) is an mMCS where the system is supposed to be equipped with a set of sensors that can provide observations from a set . Bridge rules can refer now to a new type of atoms of the form , being an observation that can be provided by sensor . A “run” of such system starts from an equilibrium and consists in a sequence of equilibria induced by a sequence of sets of observations. In an evolving MCS (eMCS), instead, there are special observation contexts where the observations made over time may cause changes in each context knowledge base. As for the representation of time, different solutions have been proposed. For instance, BrewkaEP14 defines a special context whose belief sets on a run specify a time sequence. Other possibilities assume an “objective” time provided by a particular sensor, or a special head predicate in bridge rules whose unique role is adding timed information to a context.

However, in the general case of dynamic environments, contexts can be realistically supposed to be able to incorporate new data items in several ways, including interaction with a user and with the environment. We thus intend to propose extensions to explicitly take into account not only observations but, more generally, the interaction of contexts with an external environment. Such an interaction needs not to be limited to bridge rules, but can more generally occur as part of the context’s reasoning/inference process. We do not claim that the interaction with an external environment cannot somehow be expressed via the existing approaches to MCSs which evolve in time BrewkaEP14 ; GoncalvesKL14b ; GoncalvesKL14a ; however, it cannot be expressed directly; in view of practical applications, we introduce explicit and natural devices to cope with this important issue.

We proceed next to define a new extension called timed MCS (tmMCS). In a tmMCS, the main new feature is the idea of (update) action. For each context , we define a set of elementary actions, where each element is the name of some action or operation that can be performed to update context . We allow a subset for observing sensor inputs as in BrewkaEP14 . A compound action (action, for short) is a set of elementary actions that can be simultaneously applied for context . The application of an action to a knowledge base is ruled by an update function:

so that means that the “new” knowledge base is a possible result of updating with action under function . We thus assume to encompass all possible updates performed to a module (including, for instance, sensor inputs, updates performed by a user, consequences of messages from other agents or changes determined by the context’s self re-organization). Note that is (possibly) non-deterministic, but never empty (some resulting is always specified). In some cases, we may even leave the knowledge base unaltered, since it is admitted that . Notice, moreover, that update operations can be non-monotonic.

In order to allow arbitrary sequences of updates, we assume a linear time represented by a sequence of time points indexed by natural numbers and representing discrete states or instants in which the system is updated. The elapsed time between each pair of states is some real quantity . Given and context , we write and to respectively stand for the knowledge base content at instant and the action performed to update from instant to . We define the

actions vector

at time as . Finally, denotes the set of beliefs for context at instant whereas, accordingly,  denotes the belief state . can be indicated simply as whenever does not matter.

Definition 6 (timed context)

Let be a context in an mMCS. The corresponding timed context w.r.t. an initial belief state is defined as:

  • [ topsep=1pt, itemsep=0pt]

  • , for

where and , whereas and .

Definition 7

We let a tmMCS at time be .

The initial timed belief state can possibly be an equilibrium, according to original mMCS definition. Later on, however, the transition from a timed belief state to the next one, and consequently the definition of an equilibrium, is determined both by the update operators and by the application of bridge rules. Therefore:

Definition 8 (timed equilibrium)

A timed belief state of tmMCS at time is a timed equilibrium iff, for it holds that  .

The meaning is that a timed equilibrium is now a data state which encompasses bridge rules applicability on the updated contexts’ knowledge bases. As seen in Definition 6, applicability is checked on belief state , but bridge rules are applied (and their results incorporated by the management function) on the knowledge base resulting from the update. The enhancement w.r.t. BrewkaEP14

is that the management function keeps its original role concerning bridge rules, while the update operator copes with updates, however and wherever performed. So, we relax the limitation that each rule involving an update should be a bridge rule, and that updates should consist of (the combination and elaboration of) simple atoms occurring in bridge bodies. Our approach, indeed, allows update operators to consider and incorporate any piece of knowledge; for instance, an update can encompass table creation and removal in a context which is a relational database or addition of machine-learning results in a context which collects and processes big data. In addition, we make time explicit thus showing the timed evolution of contexts and equilibria, while in

BrewkaEP14 such an evolution is implicit in the notion of system run.

A very important recent proposal to introducing time in mMCS is that of Streaming MCS (sMCS) EiterSMCS17 . The sMCS approach equips MCS with data streams and models the time needed to transfer data among contexts, and computation time at contexts. The aim is to model the asynchronous behavior that may arises in realistic MCS applications. In sMCS, bridge rules can employ window atoms to obtain ’snapshots’ of input streams from other contexts. Semantically, “feedback equilibria” extend the notion of MCS equilibria to the asynchronous setting, allowing local stability in system “runs” to be enforced, overcoming potentially infinite loops. To define window atoms the authors exploit the LARS framework Beck2015 , which allows to define “window functions” to specify timebased windows (of size k) out of a data stream . A Window atom are expressed on a plain atom and can specify that is true at some time instant or sometimes/always within a time window. Window atoms may appear in bridge rules: a literal in the body of some bridge rule, where is a window atom involving atom , means that the “destination” context (the context to which the bridge rule belongs) is enabled to observe in context during given time window. This models in a natural way the access to sensors, i.e., cases where

is a fictitious context representing a sensor, whose outcomes are by definition observable. However, window atoms may concern other kinds of contexts, which are available to grant observability of their belief state. The sMCS approach also consider a very important aspect, namely that knowledge exchange between context is not immediate (as in the basic, rather ideal, MCS definition) but instead takes a time, that is supposed to be bounded, where bounds associated to the different contexts are known in advance. So, the approach considers the time that a context will take to evaluate bridge rules and to compute the management function. Thus, ‘runs’ of an sMCS will consider that each context’s knowledge base will actually be updated according to these time estimations.

The sMCS proposal is very relevant and orthogonal to ours. We in fact intend as future work to devise an integration of sMCS with our approach. In the next section we consider aspects not presently covered in sMCS, i.e: how to activate bridge rule evaluation only when needed, and how to cope with the case where the time taken by knowledge interchange between contexts is not known in advance.

6 Static Set of Bridge Rules: Bridge-Rules Patterns

In the original MCS definition, each context is equipped with a static set of bridge rules, a choice that in tmMCSs can be a limitation. In fact, contexts to be queried are not necessarily fully known in advance; rather, it can become known only at “run-time” which are the specific contexts to be queried in the situations that practically arise. For instance, in CostantiniF16a we have proposed an Agent Computational Environment (ACE), that is actually a tmMCS including an agent, to model a personal assistant-agent assisting a prospective college student; the student has to understand to which universities she could send an application (given the subjects of interest, the available budget for applications and then for tuition, and other preferences), where to perform the tests, where to enroll among the universities that have accepted the application. So, universities, test centers etc. have to be retrieved dynamically (as external contexts) and then suitable bridge rules to interact with such contexts must be generated and executed; in our approach, such bridge rules are obtained exactly by instantiating bridge rules patterns. See Section 7 below for a generalization of mMCS and tmMCS to dynamic systems, whose definition in term of composing contexts can change in time.

Thus, below we generalize and formalize for mMCS and tmMCS the enhanced form of bridge rules proposed in CosForEMAS16 for logical agents. In particular, we replace context names in bridge-rule bodies with special terms, called context designators, which are intended to denote a specific kind of context. For instance, a literal such as

asking family doctor, specifically Dr. Ross, for a prescription related to a certain disease, might become

where the doctor to be consulted is not explicitly specified. Each context designator must be substituted by a context name prior to bridge-rule activation; in the example, a doctor’s name to be associated and substituted to the context designators (which, therefore, acts as a placeholder) must be dynamically identified; the advantage is, for instance, to be able to flexibly consult the physician who is on duty at the actual time of the inquiry.

Definition 9

Let be a context of a (t)mMCS. A context designator is a term where is a fresh function symbol and a fresh constant.444Meaning that and belong to the signature of , but they do not occur in or in .

A bridge-rule pattern is an expression of the form:

where each can be either a constant or a context designator.

New bridge rules can thus be obtained and applied by replacing, in a bridge-rule pattern, context designators via actual contexts names. So, contexts will now evolve also in the sense that they may increase their set of bridge rules by exploiting bridge-rule patterns:

Definition 10

Given a (t)mMCS, each of the timed composing contexts , , is defined, at time , as , where is a set of bridge-rule patterns, and all the other elements are as in Definition 6.

Definition 11 (rule instance)

An instance of the bridge-rule pattern , for , occurring in an (t)mMCS, is a bridge rule obtained by substituting every context designator occurring in by a context name .

The context names to replace a context designator must be established by suitable reasoning in context’s knowledge base.

Definition 12

Given a (t)mMCS , any composing context , for , and a timed data state of , a valid instance of a bridge-rule pattern is a bridge rule obtained by substituting every context designator in with a context name such that , where is a distinguished predicate that we assume to occur in the signature of .

Let denote the set of valid instances of bridge rule patterns that can be obtained at time (for ). The set of bridge rules associated with a context increases in time with the addition of new ones which are obtained as valid instances of bridge-rule patterns.

Definition 13

Given a tmMCS, each of the timed composing contexts , , is defined, at time , as:

with , , and all the rest is defined as done in Definition 6.

All the other previously-introduced notions (namely, equilibria, bridge-rule applicability, etc.) remain unchanged. Notice that instantiation of bridge-rule patterns corresponds to specializing bridge rules with respect to the context which is deemed more suitable for acquiring some specific information at a certain stage of a context’s operation. This evaluation is performed via the predicate that can be defined so as to take several factors into account, among which, for instance, trust and preferences.

Notice that a solution that might seem alternative though equivalent to ours could be that of defining “classical” bridge rules where each rule has a special element in the body acting as a ’guard’ to establish if the rule should be actually applied. However, let us reconsider our working examples. Initially the student does not know which are the universities of interest, as this will the result of a reasoning process and of knowledge exchange with other contexts; the student may even not know which universities exist. So, in the alternative solution it would be necessary to define one bridge rule for each university in the world, where the rule has a ‘guard’ to ’enable’ the rule in case it should be finally applied as the student concluded to be interested: this is unfeasible if the student does not know all universities in advance, and it is clearly unpractical. Similarly for doctors, who can retire or die, or start a new practice, or be initially unknown to the patient; so, they can hardly be all listed in advance. The same holds for many other classes of knowledge sources that can be modeled as contexts. Our solution is in many practical cases more practical and compact. It is unprecedented in the literature and adds actual expressive power.

This enhancement enables us to pursue the direction of dynamic (t)mMCS, where contexts can either join or leave the system during its operation. Such an extension has been in fact advocated since BrewkaEF11 . The meaning is that the set of contexts which compose an mMCS may be different at different times. Here, one can see the usefulness of having a constant acting as the context name; in fact, bridge-rule definition does not strictly depend upon the composition of the mMCS, as it would be by using integer numbers. Rather, the applicability of a bridge rule depends on the presence in the system of contexts with the names indicated in the bridge-rule definition. Not only can contexts be added or removed, but they can be substituted by new “versions” with the same name.

7 Static System Assumption and Unique Source Assumption: Dynamic (Timed) mMCSs (dtmMCS) and Multi-Source Option

As mentioned, in general, a heterogeneous collection of distributed sources will not necessarily remain static in time. New contexts can be added to the system, or can be removed, or can be momentarily unavailable due to network problems. Moreover, a context may be known by the others only via the role(s) it assumes or the services which it provides within the system. Although not explicitly specified in the original MCS definition, context names occurring in bridge-rule bodies must represent all the necessary information for reaching and querying a context, e.g., names might be URIs.

It is however useful for a context to be able to refer to other contexts via their roles, without necessarily being explicitly aware of their names. Also, a context which joins an MCS will not necessarily make itself visible to every other contexts: rather, there might be specific authorizations involved. These aspects may be modeled by means of the following extensions.

Definition 14

A dynamic managed (timed) Multi-Context System (d(t)mMCS) at time is a (t)mMCS augmented with the two special contexts and , which have no associated bridge rules, bridge-rule patterns, and update operator, and where:

  • is a directory which contains the list of the contexts, namely , participating in the system at time  where, for each , its name is associated with its roles. We assume to admit queries of the form ’’, returning the name of some context with role ’’, where ’’ is assumed to be a constant.

  • contains a directed graph determining which other contexts are reachable from each context . For simplicity, we may see as composed of couples of the form meaning that context is (directly or indirectly) reachable from context .

A d(t)mMCS is a more structured system w.r.t. MCS. Via , contexts can access sources of knowledge without knowing them in advance, via a centralized system facility listing available contexts, with their role. In practice, contexts joining a d(t)mMCS will be allowed to register to specifying their role, where this registration can possibly be optional. Via , the system assumes a structure that may correspond to the nature the applications, where a context can sometimes be not allowed to access all the others, either for a matter of security or for a matter of convenience. Often, information must be obtained via suitable mediation, while access to every information source is not necessarily either allowed or desirable. For instance, a patient’s relatives can ask the doctors about the patient’s conditions and prognosis, but they are not allowed (unless explicitly authorized by the patient) to access medical documentation directly. Students can see their data and records, but not those of other students.

For now, let us assume that a query where , i.e., returns a unique result. The definition of timed data state remains unchanged. Bridge rule syntax must instead be extended accordingly:

Definition 15

Given a d(t)mMCS (at time if timed) , each (non-ground) bridge rule in the composing contexts has the form:

where for the expression is either a context name, or an expression .

Bridge-rule grounding and applicability must also be revised. In fact, for checking bridge rule applicability: (i) each expression must be substituted by its result and (ii) every context occurring in bridge rule body must be reachable from the context where the bridge rule occurs.

Definition 16

Let be a d(t)mMCS (at time if timed) and be a (timed) data state for . Let be a bridge rule in the form specified in Definition 15. The pre-ground version of is obtained by substituting each expression occurring in the body of with its result obtained from .

Notice that is a bridge rule in “standard” form, and that and have the same head, where their body differ since in all context names are specified explicitly.

Definition 17

Let be a pre-ground version of a bridge rule occurring in context of d(t)mMCS with (timed) data state . Let be a ground instance w.r.t.  of . We have now if fulfills the conditions for applicability w.r.t.  and, in addition, for each context occurring in the body of we have that .

The definition of equilibria is basically unchanged, save the extended bridge-rule applicability. However, suitable update operators (that we do not discuss here) will be defined for both and , to keep both the directory and the reachability graph up-to-date with respect to the actual system state. The question may arise of where such updates might come from. This will in general depend upon the application at hand: the contexts might themselves generate an update when joining/leaving a system, or some kind of monitor (that might be one of the composing contexts, presumably however equipped with reactive, proactive and reasoning capabilities) might take care of such task. Thus, the system as a whole will have a “policy” that defines reachability. Notice, in fact, that provides structure to the system in a global way: each context indeed belongs to the sub-MCS of its reachable contexts. This corresponds to the structure of many applications and introduces a notion similar to “views” in databases: a context can sometimes be not allowed to access all the others, either for a matter of security or for a matter of convenience. Often, information must be obtained via suitable mediation, while access to every information source is not necessarily allowed or desirable. Reachability can evolve in time according to system’s global policies.

Via contexts are categorized, independently of their names, into, e.g., universities, doctors, etc. So, a context can query the ‘right’ ones via their role. However, there might sometimes be the case where a specific context is not able to return a required answer, while another context with the same role instead would. More generally, we may admit a query to return not just one, but possibly several results, representing the set of contexts which, in the given d(t)mMCS, have the specified role. So, the extension that we propose in what follows can be called a multi-source option. In particular, for d(t)mMCS , composed at time of contexts , the expression occurring in bridge rule will now denote some nonempty set (), indicating the contexts with the required role (where is excluded as a context would not in this case intend to query itself). Technically, there will be now several pre-ground versions of a bridge rule, which differ relative to the contexts occurring in their body.

Definition 18

Let be a d(t)mMCS (at time ) and be a (timed) data state for . Let be a bridge rule in the form specified in Definition 15 occurring in context . A pre-ground version of is obtained by substituting each expression occurring in the body of  with .

Bridge-rule applicability is still as specified in Definition 17 and the definition of equilibria is also basically unchanged.

In practice, one may consider to implement the multi-source option in bridge-rule run-time application by choosing an order for querying the contexts with a certain role as returned by the directory. The evaluation would proceed to the next one in case the answer is not returned within a time-out, or if the answer is under some respect unsatisfactory (according to the management function).

A further refinement might consist in considering, among the contexts returned by , only the preferred ones. For instance, among medical specialist a patient might prefer the ones who practice nearer to patient’s home, or who have the best ratings according to other patients’ feedback.

Definition 19 (preferred source selection)

Given a query with result , a preference criterion returns a (nonempty) ordered subset .

Different preference criteria can be defined according to several factors such as trust, reliability, fast answer, and others. Approaches to preferences in logic programming might be adapted to the present setting: cf., among many, BrewkaEP14 and the references therein, BienvenuEtAl2010 ; BrewkaEtAl1010preferencesNMR and CF-jalgor09 ; CosForWCP2011 ). The definition of a context will now be as follows.

Definition 20

A context included in a d(t)mMCS (except for and ) is defined (at time ), as where all elements are as defined before for (t)mMCS, and is a preference criterion as specified in Definition 19.

Preferences have been exploited in MCS extensions in EiterW17 and PontelliMCS18 in a very different way with respect to what is done here, to cope with relevant issue. Both the above-mentioned approaches are however orthogonal to ours, where the preference criterion is associated to each context, and determines which other contexts to query given a present situation. PontelliMCS18 aims to reconcile the different contexts’ preferences about some common issue (for instance, mentioning from their first example where they apparently consider contexts as agents, whether to drink red or white wine if going to restaurant together). EiterW17 copes with the situation where some constraint is violated in some context depending upon other contexts’ results communicated via bridge rules.

More precisely, EiterW17 observes that “As the contexts of an MCS are typically autonomous and host knowledge bases that are inherited legacy systems, it may happen that the information exchange leads to unforeseen conclusions and in particular to inconsistency; to anticipate and handle all such situations at design time is difficult if not impossible, especially if sufficient details about the knowledge bases are lacking. Inconsistency of an MCS means that it has no model”, i.e., no equilibrium. To solve the problem, they propose to define consistency-restoring rules based upon user preferences, specified in any suitable formalism (though in their examples they adopt CP-Nets BoutilierBDHP04 ). This in order to choose among possible repairs, called “diagnoses”, intended as modifications to bridge rules that might restore consistency. Such rules might be included into a special context to be added to given MCS. The goal of PontelliMCS18 instead is “to allow each agent (context) to express its preferences and to provide an acceptable semantics for MCS with preferences”. To this aim, to define contexts they adopt “Ranked logics”, where a partial order among acceptable belief sets is defined.

8 Logical Omniscience Assumption and Bridge Rules Application Mechanisms

In an implemented mMCS, as remarked in BarilaroFRT13 , “…computing equilibria and answering queries on top is not a viable solution.” So, they assume a given MCS to admit an equilibrium, and define a query-answering procedure based upon some syntactic restriction on bridge-rule form, and involving the application and a concept of “unfolding” of positive atoms in bridge-rule bodies w.r.t. their definition in the “destination” context. Still, they assume an open system, where every context’s contents are visible to others (save some possible restrictions). We assume instead contexts to be opaque, i.e., that contexts’ contents are accessible from the outside only via queries.

Realistically therefore, the grounding of literals in bridge rule bodies w.r.t. the present data state will most presumably be performed at run-time, whenever a bridge rule is actually applied. Such grounding, and thus the bridge-rule result, can be obtained for instance by “executing” or “invoking” literals in the body (i.e., querying contexts) left-to-right in Prolog style. In practice, we allow bridge rules to have negative literals in their body. To this aim, we introduce a syntactic limitation in the form of non-ground bridge rules very common in logic programming approaches. Namely, we assume that (i) every variable occurring in the head of a non-ground bridge rule also occurs in some positive literal of its body; and (ii) in the body of each rule, positive literals occur (in a left-to-right order) before negative literals.

So, at run-time variables in a bridge rule will be incrementally and coherently instantiated via results returned by contexts. Clearly, asynchronous application of bridge rules determines evolving equilibria.

As mentioned, we believe that bridge-rule application should not necessarily be reactive but rather, according to a context’s own logic, other modalities of application may exist. For instance, a doctor will be consulted not whenever the doctor is available, but only if the patient is in need. Or, an application to some institution is sent not just when all the needed documentation is available, but only if and when the potential applicant should choose to do that. Thus, in our approach the bridge rules that consult the doctor or issue the application remain in general “passive”, unless they are explicitly triggered by suitable conditions. Moreover, the results returned by a bridge rule are not necessarily processed immediately, but only if and when the receiving context will have the wish and the need to take such results into account. For instance, the outcome of medical analyses will be considered only when a specialist is available to examine them. So, in our approach we make bridge-rule application proactive (i.e., performed upon specific conditions) and we detach bridge-rule application and the processing of the management function.

In the rest of this section we formalize the aspects that we have just discussed. Below, when referring to tmMCS we implicitly possibly refer to their timed dynamic version according to the definitions introduced in previous section. We are now able to formalize the rule instantiation and application mechanism, via a suitable notion of potential applicability.

A slight variation of the definition of bridge-rule grounding is required, as a generalization of Definition 1.

Definition 21

Let be a non-ground bridge rule in a context of a given tmMCS with (timed) belief state . A ground instance of w.r.t.  is obtained by substituting every variable occurring in with ground terms occurring in .555Variables may occur in atoms in the body of , in its head , or in both.

By a “ground bridge rule” we implicitly mean a ground instance of a bridge rule w.r.t. a timed data state. We now redefine bridge-rule applicability, by first introducing proactive activation. For each context , let

(3)

We introduce a timed triggering function,  , which specifies (via their heads) which bridge rules are triggered at time , and so, by performing some reasoning over the present knowledge base contents. Since can be in general an infinite set,