Next Article in Journal
Decisions for Blockchain Adoption and Information Sharing in a Low Carbon Supply Chain
Next Article in Special Issue
Mathematics of a Process Algebra Inspired by Whitehead’s Process and Reality: A Review
Previous Article in Journal
A Neural Network Model Secret-Sharing Scheme with Multiple Weights for Progressive Recovery
Previous Article in Special Issue
Collective Intelligence in Design Crowdsourcing
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Thread Algebra with Prospecting Services and Foresight Patterns

Informatics Institute, Faculty of Science, University of Amsterdam, Science Park 904, 1098 XH Amsterdam, The Netherlands
Mathematics 2022, 10(13), 2232; https://doi.org/10.3390/math10132232
Submission received: 13 May 2022 / Revised: 15 June 2022 / Accepted: 17 June 2022 / Published: 26 June 2022
(This article belongs to the Special Issue Theories of Process and Process Algebras)

Abstract

:
Thread algebra is a domain-specific process algebra which may be used for semantic work on sequential systems, including systems based on deterministically scheduled multi-threading. Thread algebra is used in this capacity with the forecasting phenomenon for programs and machines as a domain of interest. Several new informal notions are proposed: prospecting services, foresight patterns for systems, and lookahead conditions as a mechanism for the specification of services. Some new prospecting services are proposed which facilitate the realisation of certain foresight patterns. Several negative results about the non-realisability of certain foresight patterns are provided.
MSC:
68N30; 68Q10; 68Q58

1. Introduction

Thread algebra [1] is a domain-specific process algebra, which is tailor made for providing semantics for imperative programs in the form of instruction sequences written in the notation of the program algebra PGA of [2]. For introductions to program algebra, instruction sequences and thread algebra we refer to [3], and for more comprehensive information, to [4]. For more information on thread algebra we mention [5,6]. A comprehensive example of the use of notations from process algebra and thread algebra can be found in [7]. Below, the phrase “instruction sequence” will refer to an instruction sequence in one of the notations provided by program algebra, and thread will refer to an element of the domain of a thread algebra.
Thread algebra offers constants S (stop) for a properly terminating thread and D (deadlock/divergence) for an improperly terminating thread. With threads P and Q also R P f . m Q is a thread. A non-terminating (run of a) thread performs an infinite number of subsequent method calls. Non-termination differs from divergence in that divergence may involve an infinite number of subsequent internal steps, while non-termination involves an infinity of externally visible steps, viz. the subsequent method calls.
The idea is that f . m constitutes a method call, where a component accessible under the name (focus) f is asked to process a method call m . Processing a method will change the state of the component which performs that task, and moreover, it will produce a result in the form of a Boolean value. If true is returned, the thread R proceeds as P and if false is returned, the thread proceeds as Q . Components able to process method calls are called services. A focus f and a service H made accessible under focus f are combined as a service in focus f . H . A thread and a service in focus can cooperate in different ways: use (denoted P / f . H ) , apply (denoted P f . H ) , and reply (denoted P ! f . H ) . In the case of use, the service is used for computing a thread; in the case of apply, the thread transforms the service which will contain inputs before a run of the thread is started and outputs upon termination of the run said thread; and in case of reply, a mere Boolean value is computed. Use and apply represent extremes of the different way a sequential process may deal with data: data may support the computation of a more complicated process, and the sequential process is used for computing a function which is applied to the data. Below, we will only consider the case of use.
A representation of thread algebra terms of the process algebra ACP (as defined in [8]) is given in [4,9]. The idea is that a thread P is represented by a process ( P ) and a service H is represented by a process ( H ) . ♮ is the thread/service to process projection, which may be alternatively be denoted by ts 2 p . In particular, using ACP notation for actions for sending and reading along a port, and communication thereof (as used in [10] and later):
( P f . m Q ) = s f ( m ) · ( r f ( true ) · ( P ) + r f ( false ) · ( Q ) )
P f . H is represented by a parallel composition ( P f . H ) = RS ( ( P ) | | ( f . H ) ) of a representation ( P ) of P and a representation ( f . H ) of f . H . Here RS is the encapsulation operator which guarantees that corresponding send and receive actions, together collected in the set RS , will synchronize. A state of a service H ( s ) then takes the following form:
( H ( s ) ) = m J ( r ( m ) · s ( θ ( m , s ) ) · ( H ( η ( m , s , θ ( m , s ) ) ) )
Here θ ( m , s ) is a Boolean condition which determines the reply value of the service on the call of method m : if θ ( m , s ) = true , then the reply value is true and if θ ( m , s ) = false , then the reply value is false . The function η determines the state of the service after a reply has been returned. The follow-up state depends on the original state s , the method involved and the reply value θ ( m , s ) that has been returned.
For an ordinary service H , θ ( , ) the so-called reply condition, and η ( , , ) , the so-called effect function, are functions. In the case of an infinite state space, it is plausible that both functions are computable. Throughout the paper, we will assume that η is a function, while θ may depend on other attributes of a system in which the service operates. If θ ( , ) is a function, i.e., it depends on m and s only, the service is called ordinary.
The following equivalent form is more suggestive about the fact that for each method call, the corresponding reply conditions must be evaluated just once. Here, x ϕ y is the “if ϕ then x else y” function with the condition written as the argument in the middle. When located under focus f the send and receive actions are renamed, the focus f being used as a port name for the process algebra notation, we obtain ( f . H ( s ) ) = m J ( r f ( m ) · ( ( s f ( true ) · ( H ( η ( m , s , true ) ) ) ) θ ( m , s ) ( s f ( false ) · ( H ( η ( m , s , false ) ) ) ) ) ) A trivial manner in which the reply condition can be non-functional is to have it dependent of the focus by which the service is made accessible (using multiline notation for better readability and subscripts for the reply condition and effect function so that unambiguous reference to these from outside the architerm can be made).
( f . H ( s ) ) = m J ( r f ( m ) · ( ( s f ( true ) · ( H ( η H ( m , s , true ) ) ) ) θ H ( m , s ) ( s f ( false ) · ( H ( η H ( m , s , false ) ) ) ) ) )
Multiple services, H 1 , , H n accessible under pairwise different foci g 1 , , g n are combined into a single service using the service composition operator ⊕: g 1 . H 1 g n . H n . For the details of service composition, we refer to [4]. In terms of the process algebra, one finds ( g 1 . H 1 g n . H n ) = ( g 1 . H 1 ) | | | | ( g n . H n ) , at least in case the g i are pairwise different. Thread algebra allows different representations in terms of process algebra. For instance, for some applications, an interpretation into a discrete time process algebra (see, for example, [11]) is preferable. Below, the thread algebra notation is used unless the additional detail of how a basic action is realised via a pair of atomic actions matters.
A thread P may be defined in different ways. First of all, threads can be defined, like processes in process algebra, by means of recursion equations or systems of recursion equations; for instance P = S f . m 1 ( P g . m 2 D ) . Otherwise, comparable with the use of a transition system as a process definition in process algebra, a thread, say P , can be defined by means of thread extraction from an instruction sequence, say X : P = | X | . An expression of the form RS ( P g 1 . H 1 g n . H n ) is referred to as an architerm, it describes a so-called execution architecture for X , in the terminology of [12].
Process algebras contain behaviours as elements and provide composition operators for these. Many different process algebras have been designed, and process algebras can be tailor made for certain application areas. Conventionally, process algebras have been studied in the context of parallel processes so that parallel composition is the primary composition operator. In thread algebra, behaviours represent sequential systems, including deterministic systems that result from scheduled concurrent compositions of sequential systems (see [1,5]).
Instruction sequences, as well as threads, allow, as much as possible, the separation of data and control. For no datatype, not even for Booleans, the presence is taken for granted in the setting of program algebra. Only Boolean feedback from operations on data (i.e., method calls), which are located in services, is used to influence the progression of control.

1.1. Prospecting, Foresight and Lookahead Conditions

We will discuss prospecting in the context of thread algebra. Prospecting allows an agent participating in a system to survey (aspects of) the potential future behaviour of one or more other agents in the system. We model prospecting as a capability of a service. We use the term prospecting rather than the perhaps more appealing term lookahead in order to diminish the connotation of statistically sound inference from available data. Dealing with prospecting in a process algebra setting seems to be harder but may follow suit just as, for instance, strategic interleaving was first defined in the context of thread algebra in [1] and only thereafter in a setting of process algebra (see, for example, [13]).
Foresight constitutes the apparently successful ability of an agent in a system to take future options of behaviour of the entire system into account. We use the term foresight rather than forecasting, also in order to weaken the connotation of inference based on scientifically rigorous methods. Indeed prospecting, as meant below, may be achieved by way of magic, and forecasting may be based on unexplained or non-rigorous forecasting. Foresight is a phenomenon which concerns a system as a whole because it combines the intention of an agent in the system to take expectations or knowledge about the entire system (including the agent) into account as well as some assessment of the success of the agent in that respect.
Prospecting may allow successful foresight. One may think of an agent as a robot R the software of which is known to another agent P in the form of a compiled source program. Somehow P may be able to make useful predictions about the behaviour of R on the basis of that information. We will not look into this particular scenario, and it is mentioned only in order to indicate that it is not inconceivable that agent P uses intelligence to obtain meaningful information regarding the future behaviour of another component R .
An example of prospect and foresight is as follows. With I method ( H ) , we will denote the method interface of H , and a detailed description of interfaces is given in Section 2.4. Let m 1 I method ( K 1 ) and m 2 I method ( K 2 ) . Now consider the following architerm: A = ( ( g 2 . m 2 S ) g 1 . m 1 S ) h . find ( S g 1 . m 1 ( g 2 . m 2 S ) ) ) h . H g 1 . K 1 g 2 . K 2 .
The task is to design a service H with method interface I method ( H ) = { find } which works in such a manner that in all circumstances, A = A ( H , K 1 , K 2 ) will perform the basic action g 2 . m 2 . Suppose that H is an ordinary service, say H ( s 0 ) with state space S H and s 0 S H , and with reply condition θ H ( find , s ) and effect function η H ( , , ) . Now suppose θ H ( find , s 0 ) = true , then on the first call of a method (in this case h . find ) a reply true is received so that the next state of the computation will be
A = ( ( g 2 . m 2 S ) g 1 . m 1 S ) h . H ( η H ( s 0 , find , true ) ) g 1 . K 1 g 2 . K 2
Now assume that service K 1 produces reply false on the first call of method m 1 . Then (writing t 0 for the initial state of K 1 ) the subsequent state is
A = S h . H ( η H ( s 0 , find , true ) ) g 1 . K 1 ( η K ( t 0 , m 1 , false ) ) g 2 . K 2
Clearly, A will not perform basic action g 2 . m 2 . A similar argument can be given if it is assumed that θ H ( find , s 0 ) = false . It follows that an ordinary service H cannot have the required property that always a call g 2 . m 2 will take place.
Next, with a leap of imagination, one may allow the reply condition θ H ( find , s 0 ) to include K 1 as an additional argument and to allow H to experiment with the (hypothetical) future behaviour of K 1 . Now consider the following reply condition for H : θ ^ H ( find , s 0 ) [ K 1 ( m 1 ) = true ] (i.e., θ K 1 ( m 1 , t 0 ) = true ). This new condition is permitted to acquire prospective information about another service in the architerm A . Let H ( θ ^ H ) denote the service obtained from H by replacing the reply condition θ ( find , s 0 ) by θ ^ ( find , s 0 ) then the execution architecture A ( H ( θ ^ ) , K 1 , K 2 ) has the required property.
We will say that θ ^ is a lookahead condition which allows H ( θ ^ ) to perform prospecting, a state of affairs which then explains the fact that in configurations of the form A ( H ( θ ^ ) , K 1 , K 2 ) a phenomenon of foresight can be observed. In this paper, we will demonstrate some examples of lookahead conditions that may serve as non-ordinary reply conditions. The design of a most general class of such conditions is non-trivial so it seems, and the following problem is left open.
Problem 1.
Is there a plausible definition of which conditions may occur as (non-ordinary) reply conditions, so that prospection can be “exploited” to its limits?
This question applies in particular to configurations where more than one service may use lookahead conditions.

1.2. Configurations and Intermediate Configurations

Configurations capture both initial stages and intermediate stages for computations in an obvious manner: step after step, the basic actions of the thread are performed and the states of various services are updated. Final states of such computations are mere service families from which the thread has become trivial: either S or D .
The term configuration refers to a threads/service configuration. A typical (generic) configuration has the form C P g 1 . K 1 g n . K n . In the setting of thread algebra configurations compute by performing steps which correspond to (i) a method call being made, (ii) a reply being computed, and (iii) the (side) effect on the state of the service which is processing the call that is computed. Upon looking at the same run from the perspective of process algebra, additional precision can be obtained, and intermediate states and configurations appear. We will need some notation for intermediate configurations and components thereof.
For a thread P , ( P ) will denote that same thread, though with its first atomic action (when present) missing. This idea can be made formal via the translation to processes: ( ( P ) ) is the unique process p such that for some atomic action a it is the case that ( P ) = a . p if such a decomposition of P atomic action exists and ( P ) = δ (the inactive process in ACP) otherwise. In particular, one finds: ( ( P f . m Q ) ) = r f ( true ) · ( P ) + r f ( false ) · ( Q ) .
Moreover for two services H 1 , H 2 with the same method interface J , let [ H 1 ] f θ f [ H 2 ] denote a service, present under focus f , in the state just after having received a method call and going to reply true , then moving on as H 1 if the reply condition θ turns out to be true and going to reply false , while continuing as the service H 2 otherwise. Upon reading threads as process with ♮, one finds
( [ H 1 ] f θ f [ H 2 ] ) = ( s f ( true ) · ( f . H 1 ) ) θ ( s f ( false ) · ( f . H 2 ) )
Now consider the configuration A ( P f . m Q ) f . H ( s ) g 1 . K 1 g n . K n . As a process, ( A ) takes smaller steps (one atomic action at a time) than as a thread/service configuration (one basic action at a time). After performing one atomic action (sending m to H via port f), the following configuration A is obtained:
A ( P f . m Q ) ) f . ( [ H 1 ( η H 1 ( s , m , true ) ] f θ ( s , m ) f [ H 2 ( η H 2 ( s , m , false ) ] ) g 1 . K 1 g n . K n
.
The advantage of considering A is that it provides a precise picture of the situation in which a reply condition determines which reply is to be returned after a method call has been received and the corresponding reply has been computed by the service at hand, and how the service at hand will proceed. This picture allows an informal answer to Problem 1.
Definition 1 (Informal definition of lookahead conditions).
In the configuration A , a lookahead condition θ ( s , m ) may depend on
(i) all focus and method names which play a role in A ,
(ii) the threads P and Q , and
(iii) the services K 1 , , K n .
What matters is that dependence on the services H 1 and H 2 is not permitted. The reason to be so cautious about H 1 and H 2 lies in the observation that it is more likely than not that the same lookahead condition θ ( m , s ) occurs in these services as well. That may happen, for instance, if H 1 and H 2 are chosen as both continuations of a single service H upon having received method call f . m in state s and if after a number of steps, the same state is visited once more during the computation of A . A complicated self-reference might result, which is now excluded, however.
In this manner, a reasonable upper bound to the notion of a lookahead condition in the context of A is obtained. A meaningful restriction, however, is that θ ( s , m ) is built up by logical connectives and quantifiers over primitive assertions, which can be understood as expressing outcomes of hypothetical experiments with configurations of the form
A ( P f . m Q ) ) f . ( [ L 1 ] f θ ( s , m ) f [ L 2 ] ) g 1 . K 1 g n . K n
for various ordinary services L 1 and L 2 with the same method interface J as is required for H 1 and H 2 in the configuration A .
Below, we will make use of the following notation: P f 1 . H 1 f n . H n sat ̲ CALL ( f i . m ) expresses that after zero or more intermediate steps (counting atomic actions as steps), the computation starting with the architerm B P f 1 . K 1 f n . K n will perform a call f i . m (or more precisely, ( B ) will perform an action c f ( m ) which constitutes the synchronisation of a send action and a receive action with content m along port f (in ACP style process algebra terminology). Taking A for B the condition A sat ̲ CALL ( f . m ) is an example of an assertion which can be understood as expressing information concerning outcomes of experimentation with runs of A and, for that reason, as a lookahead condition.

1.3. Thread Algebra, an ACP Representable Domain Specific Process Algebra

An action f . m in the context of program algebra and thread algebra is called a basic action. Seen from the viewpoint of process algebras, basic actions are not atomic actions. Instead, a basic action can be explained in terms of synchronous communication of atomic actions. As was outlined above, thread algebra, services, and service composition can be interpreted in process algebra, and in fact, different such interpretations exist. We prefer to understand this kind of interpretation as a representation. The process algebra provides a well-known semantic standard based on bisimulation semantics, while the thread algebra is to some extent a matter of ad hoc design. By thinking in terms of representations of thread algebra in process algebra, the conceptual primacy of process algebra is emphasised. Upon adopting a specific representation, e.g., as indicated above, the use of thread algebra instead of the underlying process algebra becomes merely a matter of convenience. Thread algebra does not come with the ambition to acquire any new semantic insights or principles for concepts, such as sequential composition, concurrent composition, atomicity of actions, abstraction from internal (silent) steps, and the proper definition and use of infinite state systems. Thread algebra is a domain-specific process algebra that features two kinds/classes of domain-specific processes: threads and service families. Thread algebra offers several domain-specific combinators on these domain-specific classes of processes (apply, use, and reply), each of which are instances of reactive concurrent composition when understood from the perspective of process algebra. Thread algebra is ACP representable in the sense that there is a preferred representation (♮) of thread algebra into ACP-style process algebra.
Thread algebra is one of several domain-specific process algebras that have been developed on the basis of representation in ACP. Process algebra based on asynchronous communication constitutes a domain-specific process algebra which may be further specialised for use with dataflow networks. Alternatively, systolic arrays may be modelled with a highly concurrent version of ACP. The notation μ CRL [14] and its successor mCRL2 [15] may be understood as domain-specific process algebras which exploit data as parameters of processes rather than to have as separate semantic entities wrapped in a dedicated process, or as parameters of an additional operator (viz. the state operator of [16]).
For threads and services, the notion of an interface is vital. Interface calculus is a “sister” of the alpha–beta calculus for ACP in [17]. As it turns out, due to the built-in symmetries in ACP, the idea of an interface boils down to a set of actions, which is relatively simple compared with the notion of an interface, as it is needed for the setup of thread algebra.
Thread algebra involves threads and services, representing two types of agents with threads having a focus on control, and services a focus on data. Thread algebra is more specific for sequential, deterministic, and reactive systems and, therefore, less general than process algebra, which is meant to capture arbitrary concurrent systems.
Different forms of process algebra come into play for different themes. In this paper, we will look at prospecting, both phenomena which one may at least hypothetically ascribe to the behaviour of an agent, and foresight, a capability which, again hypothetically, may be ascribed to the participation of an agent in a system.
For software engineering, the idea of prospecting is rather uncommon, though very common in processor pipelines. Prospecting is usually expected of rational agents. Prospecting and foresight play a role already in sequential systems, and for that reason, the investigation of these topics may well start with thread algebra rather than in process algebra.
Process algebra is a tool for analysing the options for mutual communication and understanding in a multi-agent network. Such networks are thematic for AI. Thread algebra, and an underlying program algebra, provide specialised algebraic approaches for dealing with sequential subsystems of such networks.
Prospecting services were studied in [12] (then named forecasting services) and in [4], where it was shown that such services cannot correctly forecast halting when giving replies in a two-valued logic only. In [4], different forms of the halting problem are formalised in the context of thread algebra. Apparently, thread algebra is better suited for analysing such applications, where control and data are to be treated on equal footing than process algebras, where control is the dominant feature and data are an “add on” feature to some extent.

1.4. Process Algebra, Thread Algebra, and AI

Process algebra can help to analyse the boundaries of what can be computed. What Turing machines do for computability, allowing techniques for analysing what can and what cannot be done, can be repeated and adapted in a plurality of models of concurrency when it comes to analysing the notion of algorithmic impossibility for interacting agents. Process algebra, as an approach with a plurality of instances, each of which serves as a model for concurrency, allows some uniformity for the analysis of such models. Analysing what cannot be done in qualitative terms is of relevance for AI as much (or even more) as it has been for computer science.
When it comes to proving the impossibility of computational phenomena, arguments often depend on diagonalisation. At face value, the liar paradox and the Russel paradox on the one hand and undecidability of the halting problem and the incompleteness of the axioms of Peano arithmetic (following Gödel) are similar phenomena. However, there is a difference: the liar paradox and the Russel paradox show that certain combinations of features are clearly inconsistent. These are paradoxes. The unsolvability of the Halting problem and the incompleteness of Peano arithmetic show that certain problems are just too complex to be solved by certain limited means, and these express unfeasibility rather than a paradox. Admittedly, this discrepancy is gradual; provability logics in arithmetic bridge this kind of gap, and in [4], it was analysed how Turing incompleteness can take the form of a paradox-like manifest incompatibility when working in a setting of program algebra and thread algebra.
The famous observation by Cohen dating back to 1984 [18] (see also [19,20]) that an agent cannot decide whether or not its behaviour will be harmful, brings to the surface a disparity of the first kind: a certain combination of features, including a form of forecasting is paradoxical, i.e., leads to a manifest contradiction, while at closer inspection, a somewhat different casting of the same theme brings it closer to the halting problem and Gödel incompleteness. What is tried cannot be achieved in full generality because it is too difficult, not because it is a paradoxical (self-contradictory) idea as such.
In this article, we elaborate on these matters with the following general question in mind.
Problem 2.
Where are the boundaries and what are the options concerning self-reflection about the future of a computation, the self-reflection being understood as a part of the same computation?
In light of the objectives of this special issue, it matters contemplating how and why this particular problem might matter for AI.
  • Contemplating the Cohen impossibility result, several follow-up questions arise. To begin with, one may ask how the software engineering life-cycle for certain safety critical components would change (would have changed) if the result would have been the opposite to what it has been. How would the tests (which, after all, do not exist) would be used in practice.
    The software engineering life-cycle is a computational model where computed phases and human actions take place in an interleaved manner. However, as a result of progress in AI, increasingly, many of the human steps are becoming incorporated in the computed phases. The question arises if the availability of the program/machine that Cohen showed not to exist would, hypothetically, show up in systems design for automated programming. Apparently, an attempt to incorporate a component which is blessed with successful foresight about whether or not another component is viral (assuming a particular definition of that) into a larger system induces a change of the requirements on said component. As a consequence of that change, instead of being paradoxical, it becomes merely unfeasible (as in the case of the halting problem) to determine virality.
    Unfeasible problems may have useful automated approximations, however, which then could be used for imperfect but still practical automated improvements of an ordinary software engineering life-cycle. By working with approximations of software components that provably do not exist, hypothetical foresight may be transformed into plausible forecasting.
  • The Cohen impossibility may be considered, like the halting problem, to constitute merely a conceptual matter. However, one may consider the notion of a program fault. The formidable literature on program faults provides some principled approaches, e.g., in [21,22], where the idea is that a fault must have two properties, it can be the cause of a failure during a run and it allows a (preferably provable, otherwise at least evidence based) improvement such that said cause is removed. For a survey of approaches to the notion of a program fault, we refer to [23]. Faults may be understood as options for forecasting certain failures, and in a fully automated software engineering life-cycle, one can imagine tools for dealing with, i.e., profiting from, such forms of foresight.
  • Another link between AI and forecasting arises when contemplating robot morality. Without assuming any form of lookahead, it is hardly possible to imagine any moral judgement regarding the control software for a military robot. For some reflection on this matter, we refer to [24].
  • Another area where lookahead plays a role is garbage collection, where, given a pool of linked objects which is used for the processing of a single instruction sequence only, the notion of garbage may be made dependant on the future behaviour of said instruction sequence. This idea gives rise to the notion of shedding (see [25]), which involves run-time foresight by a thread about its own future behaviour. Comparable to the case of virus detection, it takes care to avoid self-contradictory requirements, and indeed AI methods for automated self-reflection might become useful for garbage collection.

1.5. Survey of the Paper

Thread algebra is introduced as a domain-specific process algebra. In particular, thread algebra is ACP representable. The use of process algebra facilitates the introduction of so-called intermediate states, which proves very helpful for introducing the informal notion of a lookahead condition (in Definition 1). Two more informal notions, prospecting service and foresight pattern, are introduced. The relevance of non-paradoxical foresight patterns is motivated.
A fairly complete account is presented of interfaces in the context of thread algebra. That is done both in intuitive and semantic terms and by way of an axiomatisation which is informative, though lacking known formal properties.
The new results are as follows: Proposition 3 demonstrates a case where foresight cannot be realised, while this is not entirely obvious. Proposition 5 introduces a new foresight mechanism, which indicates that the Cohen impossibility result is shown in a context where the sought forecasting pattern is not paradoxical. Theorem 2 indicates that for the same requirements, paradoxical circumstances arise in the presence of a second service with prospecting capability. The basic action foresight pattern is introduced, and in Proposition 4, a prospecting service is obtained which can implement this pattern.

2. Threads, Services, and Architerms

At risk of repeating some elements that were covered in the introduction, we will proceed with some additional remarks on threads, services and service families. We will use without further reference the elements of program algebra, thread algebra, and instruction sequence theory which are surveyed in [3,26], and which have been set out in detail in the papers referenced therein. In these papers, the focus method notation f . m provides a basic instruction, where the focus f represents the name of (a link to) a service and m names a method to be applied to (as seen from an instruction sequence) and processed by (as seen from the service) the service, under the assumption that (i) the service will send a Boolean reply back to the instruction sequence which made the method call f . m in such a manner that the continuation of the computation as prescribed by the instruction sequence may (but need not) depend on the reply value, (ii) as a consequence of processing the method m , the service may update its state, and (iii) in between the processing of subsequent method calls, say f . m 1 and f . m 2 , the service may interact with external components working as an independent process, concurrently with other services. The architerm, also termed configuration, which will mostly be used below, is thus:
U ( P g 1 . K 1 g n . K n )
with P a thread and g 1 . K 1 g n . K n , a service family which offers access to service K i under focus g i for 1 i n , and with U { g 1 , , g n } . More often than not, the encapsulation operator will be omitted from an architerm.
The service combination operator _ _ is assumed to be commutative and associative so that the ordering of the services in an expression for an execution architecture does not matter. U ( ) performs restriction to the services with a focus outside U . The representation of restriction in ACP-style process algebra satisfies ( U ( P g 1 . K 1 g n . K n ) ) = RS ( U ) ( ( P g 1 . K 1 g n . K n ) ) with RS ( U ) containing the communication actions along port f , that is
RS ( U ) = { c f ( m ) , c f ( b ) f { g 1 , , g n } , m I method ( H i ) , b { true , false } }
Here c f ( m ) = s f ( m ) | r f ( m ) and c f ( b ) = s f ( b ) | r f ( b ) with | , the communication function of ACP. Services with a focus in U may be used as containers for inputs or as containers for auxiliary data only of use during a computation. All outputs are located as states in services with a focus outside U . For this particular notion of an execution architecture for instruction sequences and for threads, we refer to [12] and to the further development thereof in [4]. Below, we will use architerm as an abbreviation of execution architecture.
The equality of architerms is denoted with ≡. Architerm equality is a somewhat informal motion because it depends on the context as to how much abstraction comes with ≡. Writing A U ( P g 1 . K 1 g n . K n ) , it is confirmed that A denotes an architerm involving restriction (removal of auxiliary services from the result by U ( ) ), a thread P , which is applied to (processing determined by •) n services which are accessible via foci g 1 , , g n , respectively. No further structural information is given (via A ) regarding P and the respective services. We will always assume that the g i are pairwise different. With U = { g j 1 , , g j k } , the service family g j 1 . K j 1 g j l . K j k contains the services with either a pure input status or an auxiliary status (or a combination of both) for the architerm A . With B | + f . m 1 ; # 3 ; g . m 2 ; f . m 3 ; X ; ! | f . K g . L , it is required that a thread is applied which is obtained via thread extraction from an instruction sequence beginning with + f . m 1 ; # 3 ; g . m 2 ; f . m 3 and ending with !. The idea is then that said instruction sequence ( + f . m 1 ; # 3 ; g . m 2 ; f . m 3 ) constitutes a part of the architerm. By substitution for variables, the architerms can be refined.

2.1. Reply Function Services

Each service H comes with (i) an input alphabet J = I method ( H ) and (ii) a reply function α : J + { true , false } . When a method call m J takes place, the reply is α ( m ) and the new reply function is λ u J + α ( m u ) . A reply-only service has implicit states, and the reply function serves as its state.
We write RFS ( J , α ) for the service with method interface I method ( RFS ( J , α ) ) = J and reply function α : J + { true , false } . When available under focus f , the (single-service) service family f . RFS ( J , α ) has provided interface I provided ( f . RFS ( J , α ) ) = { f . m m J } . f . RFS ( J , α ) will process method call f . m by asking RFS ( α , J ) to process the call m .

2.2. Stateful Services

A service may also have an explicit state space. Then, H comes with a state space S containing an initial state s 0 and a reply condition function θ : S × J { true , false } and an effect function η : S × J × { t r u e , f a l s e } S . Upon method call m J and when in state s , the condition θ ( s , m ) is evaluated. Let b { true , false } be the result of evaluating θ ( s , m ) , then b is returned to the calling thread as a reply, and the next state is η ( s , m , b ) .
Such services are called stateful. We write SFS ( J , S , s 0 , θ , η ) (for stateful service) for the service with method interface J , state space S , with initial state s 0 S reply condition function θ , and effect function η .
The architectural primitive indicates that thread P is run in the context of the service family g 1 . K 1 ( s 1 ) g m . K m ( s n ) , with s i , assuming encapsulation U with U = { g i 1 , , g i k } , a state of K i , with as an output, in case of termination, a service family g i 1 . K i 1 ( s i 1 ) g i k . K m ( s i k ) . In case of non-termination as well as in the case of divergence after a number of method calls have been processed, the result is g i 1 . 0 service g i k . 0 service , where 0 service is the unique service which accepts no methods.

2.3. Threads and Thread Extraction

A thread P is either S (stop, termination), or D or P 1 g . m P 2 for some method call (basic action ) g . m and some threads P 1 and P 2 . P f . m P can be abbreviated to f . m P .
Instruction sequences and threads are connected via the thread extraction operator | P | , for instance: | f . m ; g . m 1 ; h . m 2 ; ! | = f . m g . m 1 h . m 2 S , | + f . m ; # 2 ; g . m 1 ; h . m 2 ; ! | = ( h . m 2 S ) f . m ( g . m 1 h . m 2 S ) , and | f . m ; + g . m 1 ; ! ; h . m 2 ; # 0 ; ! | = f . m ( S g . m 1 ( S h . m 2 D ) ) , where g . m P = P g . m P .
For the construction of an apply architerm, it is required that the interfaces of the thread and service family match, i.e., that every method call can be processed by one of the services. Expressing these requirements rests on a notion of interface, which we will discuss in some detail.

2.4. Interfaces: Required Interfaces and Provided Interfaces

Interfaces serve as abstractions of components which are made in order to facilitate reasoning about the design and composition of components. Consider the instruction sequence, X + f . m 1 ; g . m 2 ; ! . The processing of X works as follows: (i) apply method m 1 to the service accessible with focus f ; (ii) if the reply false is returned, skip the second method call and terminate; and (iii) if instead true is replied, perform the method call g . m 2 and then terminate, irrespective of the reply which has been returned. X requires of an execution environment that it provides a service accessible under focus f which is able to process a method named m 1 and another service accessible under focus g which will process a method named m 2 . This information can be combined in the interface J = { f . m 1 , g . m 2 } . The interface J is a required interface, it conveys what an environment must provide for X to be properly effectuated. Now consider Y = ! ; + f . m 1 ; g . m 2 ; ! . Y will terminate at once and make no method calls. It is plausible to say that its required interface is empty. If, however, a jump from outside is allowed and a run may not start with the first instruction (e.g., in Z # 3 ; Y ), then it is not plausible to think of Y as having an empty interface. With I required ( P ) , we will denote the required interface of an instruction sequence P , which contains a mere collection of all basic actions ( f . m ), which occur in X (either as a void basic instruction f . m , as a positive test instruction + f . m or as a negative test instruction f . m ). Thus, with Y as above, I required ( X ) = I required ( Y ) = { f . m 1 , g . m 2 } .
Given the task to design an instruction sequence, say X , which computes some given function or otherwise performs some specified task, there may be constraints (requirements on) on the required interface of X for instance one may wish that I required ( X ) J for some interface J . For the programming task at hand, J is an access-constraining interface. Access-constraining interfaces play a key role in complexity questions about instruction sequences when looking for the shortest, or otherwise best, instruction sequence in some format (say PGLB of [2]) that achieves a certain given task.
Complementarily to the required interface of an instruction sequence, one may consider the method interface I method ( H ) of a service, say H , e.g., { m 1 , m 2 , m 3 } . A method interface of a service is a provided interface. If a service family H offers only S accessible under focus f , then the provided interface of H is I provided ( H ) = { f . m 1 , f . m 2 , f . m 3 } . If one has the task to design a service family, say L , then it may be required that a certain interface J is provided by L : I provided ( L ) J .

2.5. Some Naming Conventions; Equations for Interfaces

The paper involves a range of different types of entities, and we will follow some informal, and non-strict rules for the naming of variables for these types. We will use X , Y , Z for instruction sequences, P , Q , R for threads, I , J for interfaces, H , K , L for services, S , T for state spaces of (stateful) services with s , t for states in the state space of stateful services, and V , W for service families. Methods often are given names involving m or n , and foci often have names involving f , g , or h .
Using these conventions, some equations that loosely specify the various types of and operations about interfaces are given in Table 1 and Table 2. Concerning these tables, some comments are in order.
  • Interfaces are by default sets of focus method pairs. Interfaces may serve as the required interface for a thread, as the provided interface for a service family, or as the constraining interface for a (forthcoming) thread. interface is the empty interface. 0 service family is the empty service family. Its interface is empty as well.
  • Services have a method interface which consists of method names only. method interface is the empty method interface. 0 service is the unique service without any method.
  • The service family f . 0 service differs from interface because it involves a focus f . This complication is useful because it allows ⊕ to be a total, commutative, and associative operator. Suppose m I methods ( H 1 ) I methods ( H 2 ) the result of a call f . m to a service family f . H 1 f . H 2 is hard to define. Non-determinism is to be avoided, and ⊕ is supposedly commutative. A simple way out is to avoid service families with multiple services under the same focus. Adopting f . H f . K = 0 service family fails, as it renders ⊕ as being non-associative. However, adopting f . H f . K = f . 0 service , blocks ambiguous method calls and allows ⊕ to be commutative and associative, though not idempotent (i.e., V V = V fails on any service family V with I provided ( V ) interface ).
  • The notion of an interface occurs in quite different ways in the literature on software technology. Three clusters of use of the term “interface” may be distinguished as follows:
    -
    Operational interfaces: collections of primitives with definite meaning.
    *
    API: an application programmer interface is a toolkit in a software engineering environment;
    *
    Processor instruction sets;
    *
    Collections of message passing primitives (e.g., MPI).
    -
    Requirements of specification-oriented interfaces (interface elements come with limited information regarding semantics).
    *
    Modal interfaces (see, for example, [27]);
    *
    Interface automata (see, for example, [28]);
    *
    Algebraic specifications as interface of data types.
    -
    Syntactic interfaces. (comprising declarations of syntactic elements; interface elements come without a predefined semantics, but may have suggestive names or symbols).
    *
    Similarity types in universal algebra (interfaces for first order theories);
    *
    Signatures as interfaces for algebraic (abstract data type) specifications;
    *
    Sets (alphabets) of atomic actions as process interfaces in process algebra (see, for example, [17]);
    *
    Sets of basic actions as interfaces in program algebra and thread algebra (following, for example, [26].
    In the context of thread algebra, interfaces are used in the capacity of syntactic interfaces as well as in the capacity of operational interfaces (though in a theoretical manner).

2.6. Thread Service Interaction, Instruction Sequence Processing Operators

In PGA-style program algebra and the corresponding theory of instruction sequences, the general idea of an execution architecture is as follows: given a instruction sequence X , thread extraction produces a thread | X | . Threads are processes captured in a thread algebra which is a simplified process algebra. Threads have three forms: S , the terminating (stopping) thread, D the deadlocked (diverging, improperly terminating) thread and P Q f . m R , the basic action form of a thread. The stopped thread may be equipped with a result value, for instance, a bit: S 0 and S 1 . Threads in basic action form can perform a unique basic action, say, for P : f . m , which works as follows:
(step 1) Let the service in focus f (say the service name H , which at the time of the method call is in state s , or more precisely H ( s ) ) performs the (its) method named m , the service is offered from the context as given by the execution architecture.
(step 2) A Boolean reply is expected, at reply true , the run proceeds with Q , and at reply false , the run proceeds with R , and the reply is found by evaluating the reply condition θ ( s , m ) for method m to state s , thereby obtaining Boolean value b .
(step 3) In both cases the state s of H is updated with the effect function η to H ( η ( s , m , b ) ) .
Three operators connecting instruction sequences and service families come into play:
(i) The reply operator: | X | ! H , which produces a bit in { true , false } and in which X is understood as a way to define (compute) a function from (states of) service families to bits. To allow definition of the reply operator, two different termination instructions are needed: ! : true (terminate with result true ) and ! : false (terminate with result false ) .
(ii) The apply operator | X | H in which X is supposed to describe a transformation from H to a new state of it (i.e., to a new state for each of the services contained in it).
(iii) The use operator | X | / H , which produces a thread rather than a value or a service family (carrying the states of the various services). For | X | / H , the services combined in H act as local resources, to begin with memory sources, which support X in computing thread | X | / H .
Typically, one may imagine compositions ( | X | / V ) W where it is plausible though not necessary that the service families V and W have no focus in common (i.e., I focus collection ( V ) I focus collection ( W ) = focus collection ). Encapsulation drops services from a service family: with U , a collection of foci, U ( V ) removes from V each service accessible under a focus in U . Assuming that V and W involve disjoint collections of foci results in the following useful identity:
I focus collection ( V ) I focus collection ( W ) = focus collection ( | X | / V ) W = I focus collection ( V ) ( | X | ( V W ) ) )

3. Prospecting Services: Endowed with a Non-Ordinary Capability

Below, further lookahead conditions are introduced, as a follow up on the ones mentioned in Section 1.1. Prospecting refers to the capability of a service to evaluate one or more lookahead conditions. That is a non-ordinary capability. Foresight is a property of a system (here, an execution architecture) where one or more services perform as if they were able to forecast the actual and potential future behaviour of the system. Proper foresight is present if no ordinary service meets the given requirements.
The basic action foresight pattern, when realised, allows a system to use a certain service (here, H ) to operate in such a manner that a given basic action (viz. g i . m ) will certainly be performed provided that basic action might occur with non-deterministic behaviour for H . For an explanation of the conditions of the form A sat ̲ CALL ( h . m ) , see Section 1.2 above.
Definition 2 (Basic action foresight pattern).
Let n > 1 and let J 1 , , J n be method interfaces. Further, let H be a service with I method ( H ) = { find } then an open architerm
( X 1 h . find X 2 ) h . H g 1 . Y 1 g n . Y n realises the basic action foresight pattern for some i { 1 , , n } and method m J i if for all ordinary (but arbitrary) services K 1 , , K n with I method ( K 1 ) J 1 , , I method ( K n ) J n , and for all threads P , Q with I required ( P ) I required ( Q ) I provided ( h . H g 1 . K 1 g n . K n ) , the following holds:
if P h . H g 1 . K 1 g n . K n sat ̲ CALL ( g i . m ) or Q h . H g 1 . K 1 g n . K n sat ̲ CALL ( g i . m )
then also, ( P h . find Q ) h . H g 1 . K 1 g n . K n sat ̲ CALL ( g i . m ) .
The example in Section 1.1 above (taking i = 2 and m = m 2 ) provides a proof of the following proposition.
Proposition 1.
No ordinary service H satisfies the requirements of the basic action foresight pattern.
In Theorem 4 below, a prospecting service named MCP is shown to satisfy the requirements of the basic action foresight pattern. From the latter observation, it follows that the basic action foresight pattern is not self-contradictory.

3.1. Forecasting versus Prospection: Forecasting Patterns and Prospecting Services

Proposition 1 asserts that a certain foresight pattern will not emerge unless a service with prospecting capability is available. A foresight pattern may also be inconsistent (paradoxical, self-contradictory).
Foresight is reflexive in the sense that it works as if an agent (service) is well-informed about its own future behaviour, as well as about the behaviour of other agents (services). Prospection is non-reflexive, and refers to the capability of a service to acquire knowledge about the future behaviour of threads and other services in the same system. Lookahead conditions which occur in a service will work under the hypothesis that the service proceeds as an ordinary service (even if, in fact, it does not). For this limitation, see the preliminary definition of lookahead conditions and the remarks in Section 1.2 above. Using these conventions, prospection realised in a service by way of lookahead conditions will not have any paradoxical consequences, however hypothetical the evaluation of lookahead conditions in practice may be.
Proposition 2.
Let i { 1 , , n } , and let K 1 , , K n be ordinary (i.e., non-prospecting) services and let the interface J be given by J = { f . ok } I provided ( g 1 . K 1 g n . K n ) . Further let TERM be a lookahead service with I method ( TERM ) = { ok } .
Now, it is not possible that for all threads P of the form P Q f . ok Q , with I required ( P ) J , the following holds: the first call along focus f of the computation P f . TERM g 1 . K 1 g n . K n returns true if and only if the computation of P f . TERM g 1 . K 1 g n . K n properly terminates.
Proof. 
Suppose otherwise, and take Q D , Q S . Now the computation ( D f . ok S ) f . TERM g 1 . K 1 g n . K n terminates properly (ends in S ) if and only if the first (and only) method call f . ok returns true if and only if the same computation diverges (ends in D ). □
Proposition 2 is a rephrasing of the argument on the non-existence of malware detection by Cohen [18]. The latter result works with an action do : harm instead of termination. We will discuss this forecasting pattern in more detail in Section 3.3 below. It is informative to phrase Proposition 2 in terms of a foresight pattern.

3.2. More Primitive Lookahead Conditions R

Primitive lookahead conditions have the quality that these may be understood as outcomes of experimenting with an architerm as outlined in Definition 1 and subsequent comments. Besides the lookahead condition A sat ̲ CALL ( f . m ) , which is introduced below Definition 1, the following lookahead conditions (for an architerm A ) are used below:
  • A sat ̲ PERP holds if the computation from A does not terminate (i.e., perpetuates).
  • A sat ̲ TERMINATION ( ok ) if the computation starting from A properly terminates.
  • A sat ̲ TERMINATION ( not _ ok ) asserts that the computation starting from A improperly terminates (i.e., ends in D ).
  • A sat ̲ TERMINATIONat ( n , ok ) asserts that in the n ’th step proper termination occurs.
  • A sat ̲ TERMINATIONat ( n , not _ ok ) asserts that at the n ’th step improper termination occurs.
  • A sat ̲ noCALL ( f . m ) asserts that the computation from architerm A at no stage performs a method call f . m . Here, the computation may not terminate or may terminate properly or improperly and if f { g 1 , , g m } , ¬ ( A sat ̲ noCALL ( f . m ) ) holds.
  • A sat ̲ CALLat ( k , f . m ) asserts that the computation from architerm A performs a method call f . m in step number k for a natural number k > 0 .
Definition 3 (Termination foresight pattern A).
Let n > 1 and let J 1 , , J n be method interfaces. Further, let H be a service with method interface I method ( H ) = { ok } then an open architerm X P f . H g 1 . Y 1 g n . Y n realises the termination foresight pattern A if the following holds:
let K 1 , , K n be ordinary services such that I method ( K 1 ) J 1 , I method ( K n ) J n . Then, for all threads Q , Q with I required ( Q ) I required ( Q ) I provided ( f . H g 1 . K 1 g n . K n ) , it is the case that: ( Q f . ok Q ) f . H g 1 . K 1 g n . K n sat ̲ TERMINATION ( ok ) , if and only if the first call of f . ok in the computation ( Q f . ok Q ) h . H g 1 . K 1 g n . K n returns true .
Proposition 1 entails that the termination foresight pattern A cannot be realised, not even with a prospecting service. That state of affairs is hardly surprising. Here is a similar foresight pattern for which it is less obvious that it cannot be realised.
Definition 4 (Termination foresight pattern B).
Let n > 1 and let J 1 , , J n be method interfaces. Further let H be an SFS service (see Section 2.2 above) with method interface I method ( H ) = { ok } and with state space S and initial state s 0 S , then an open architerm X P f . H g 1 . Y 1 g n . Y n realises the termination foresight pattern B if the following holds:
let K 1 , , K n be ordinary services such that I method ( K 1 ) J 1 , I method ( K n ) J n and assume that m I method ( K i ) . Then for all threads Q , Q with I required ( Q ) I required ( Q ) I provided ( f . H g 1 . K 1 g n . K n ) , and for each state s S , it is the case that Q f . H ( s ) g 1 . K 1 g n . K n sat ̲ TERMINATION ( ok ) if and only if the first call of f . ok in the computation ( Q f . ok Q ) h . H g 1 . K 1 g n . K n returns true .
Termination foresight pattern B is unrealisable, irrespective of any conceivable prospecting capabilities of H :
Proposition 3.
Termination foresight pattern B cannot be realised by any ordinary or non-ordinary service H .
Proof. 
Let S be the state space of H so that H = H ( s 0 ) and choose Q and Q as follows: Q = Q f . ok S , Q = S .
If θ H ( s 0 , ok ) = false then Q f . H ( s 0 ) g 1 . K 1 g n . K n sat ̲ TERMINATIONat ( 2 , ok ) which contradicts the assumptions of the proposition. It follows that θ H ( s 0 , ok ) = true , Now consider s 1 = η H ( s 0 , ok , true ) . For s 1 it follows in the same way that θ H ( s 1 , ok ) = true . In this way, an infinite sequence s 0 , s 1 , s 2 , . . results such that for all i , θ H ( s i , ok ) = true and s i + 1 = η H ( s i , ok , true ) . It follows that Q f . H ( s 0 ) g 1 . K 1 g n . K n sat ̲ PERP so that termination does not occur, which contradicts the assumption that the reply to the first method call equals true , i.e., θ H ( s 0 , ok ) = true . □

3.3. SHRD: A Hypothetical Service for Security Hazard Risk Detection

We contemplate a service SHRD (security hazard risk detection), according to which the occurrence of method call g i . do : harm constitutes a security hazard, and which supports running a thread in such a way that the risk of a security hazard is detected and an alternative option for proceeding the computation is taken. The following result states the impossibility result of Cohen in terms of threads and services. This formalisation is based on [29].
Malware detection in practice, and in theory, amounts to much more than the mere detection of the future occurrence of a single basic action. For instance, in [30], the occurrence of runs of certain instruction sequences as subcomputations, perhaps interspersed with other steps, of the run of an instruction sequence is considered an indication/confirmation of a virus infection.
Proposition 4.
Let i { 1 , , n } and let K 1 , , K n be ordinary services with do : harm I method ( K i ) , and let the interface J be given by J = { f . ok } I provided ( g 1 . K 1 g n . K n ) . Let SHRD (for security hazard determination) be a (possibly non-ordinary) service with method interface I method ( SHRD ) = { ok } .
Now, it is not possible that for all threads P of the form P Q f . ok Q with I required ( P ) J , the following holds: the first call along focus f of the computation P f . SHRD g 1 . K 1 g n . K n returns true if and only if the computation of P f . SHRD g 1 . K 1 g n . K n does not involve a method call g i . do : harm .
Proof. 
Suppose otherwise, and take Q do : harm S , Q S . Then, one finds that the computation ( ( do : harm S ) f . ok S ) f . SHRD g 1 . K 1 g n . K n avoids performing g i . do : harm if and only if the first (and only) method call f . ok returns true if and only if the same computation performs g i . do : harm (and then terminates). □
Now assume, irrespective of Proposition 4, that an SHRD -like service is available as suggested in the proposition. Plausibly, SHRD would be used in the following manner: in a context ( Q f . ok Q ) f . SHRD g 1 . K 1 g m . K m call f . ok in order to prevent a run of Q leading to a method call g i . do : harm and instead to engage in a run of Q , thereby hopefully avoiding g i . do : harm . Although SHRD as indicated above in Proposition 4 cannot exist, a lookahead service which allows the particular use just mentioned is conceivable. In the following paragraph, such a service is defined under the name SHRAT . SHRAT will be a service of the form L θ ok , s according to the following definition.
Definition 5.
Let the service L θ m , s has singleton state space { s } and I method ( L θ m , s ) = { w } and when accessible under focus f in an architerm A it works as follows: on method call f . m evaluate b = θ ( s , m ) , then return b , without changing the state.

3.4. SHRAT: A Prospecting Service for Security Hazard Risk Assessment

In [31], the possibility of a service SHRAT (security hazard risk assessment) service is contemplated, which, supposedly, determines during the operation of an instruction sequence X , the text of which is known to the service, and can determine whether or not the thread created by the instruction sequence will in the future perform a method call do : harm to an unnamed service.
A method call ok to SHRAT aims to determine whether or not “the future is ok”, i.e., no do : harm action will be performed. We will rephrase this idea with more emphasis on interfaces than in the presentation in [31]. To begin with the unnamed service is given name K and is present via the interface under focus g .
We imagine a service SHRAT with a single method ok and a single state s . In slight contrast with SHRAT one may imagine a service K i with method interface I method ( K i ) containing a method do : harm . Most methods from I method ( K i ) constitute useful (friendly) operations on the state space of K , while the method do : harm brings its state in disarray, so that it may be called only under special circumstances.
Let X be an instruction sequence such that
I required ( X ) J = def I provided ( f . SHRAT g 1 . K 1 ( s 1 ) g n . K n ( s n ) )
The application of X to a service family g 1 . K 1 ( s 1 ) g n . K n ( s n ) while making use of the support of the (possibly non-ordinary) service SHRAT amounts to application of the thread | X | extracted from the instruction sequence X to the service family f . SHRAT g 1 . K 1 ( s 1 ) g n . K n ( s n ) followed by forgetting f . SHRAT , thereby obtaining
f ( | X | f . SHRAT g 1 . K 1 ( s 1 ) g n . K n ( s n ) )
Now the idea is that in a thread P f . ok Q , when effectuated in the context of a service family f . SHRAT g 1 . K 1 g n . K n , the reply of SHRAT on the call ok is positive if the computation of P f . SHRAT g 1 . K 1 g n . K n will not involve any call of the form g i . do : harm while the reply is negative otherwise. Here, it is assumed that P and Q are threads arising from thread extraction of states of X so that the required interface of both P and Q is included in J as introduced above.
For example, taking n = 1 , if P contains a single occurrence of g 1 . do : harm , it still may be the case that this particular method call will certainly not be performed so that a positive reply of f . ok can be given by SHRAT . For instance if K 1 ( s ) returns false on m 1 then in
( ( g 1 . do : harm S g 1 . m 1 g 1 . m 2 S ) f . ok S ) f . SHRAT g 1 . K 1 ( s )
the call of f . ok returns true and thus:
f ( ( ( g 1 . do : harm S g 1 . m 1 g 1 . m 2 S ) f . ok S ) f . SHRAT g 1 . K 1 ( s ) ) =
( g 1 . m 1 g 1 . m 2 S ) K 1 ( s ) = K 1 ( effect m 2 ( effect m 1 ( s ) ) )
With this idea in mind, a definition of the functionality of the lookahead service SHRAT can be given as follows. ( RFS is defined in Section 2.1 above).
Definition 6.
The assertion θ SHRAT with arguments Q , K 1 , , K n is as follows: θ SHRAT
β : { ok } + { true , false } [ Q g . RFS ( { ok } , β ) g 1 . K 1 g n . K n sat ̲ noCALL ( g i . do : harm ) ]
Definition 7.
SHRAT determines its reply to a method call ( Q f . ok Q ) f . SHRAT g 1 . K 1 g n . K n as follows: first determine the truth value (say b of the assertion θ SHRAT as in Definition 6) with arguments Q , K 1 , , K m ; then the reply given by SHRAT to the call f . ok equals b while the state is left unchanged.
In this definition, the form of Φ matters. In particular, if one or more of the services K 1 , , K n have prospecting capability and SHRAT is informed about that fact, then when evaluating θ SHRAT , it is “known” that when evaluating Q f . RFS ( { ok } , β ) g 1 . K 1 g n . K n the services K i operate on the basis of the information that the service accessible via focus f behaves as an ordinary service, thus reducing the number of non-ordinary services in the service family at hand. It follows that replies of SHRAT are well defined also without the assumption that the services K 1 , , K n are ordinary services.

3.5. Obtaining Lookahead Functionality with SHRAT

We first formalise with Proposition 5 the intuition that the sought foresight pattern cannot be provided by an ordinary service. Then Theorem 1 captures how SHRAT realises the required foresight pattern.
Proposition 5.
Let i { 1 , , n } and let K 1 , , K n be ordinary (i.e., non lookahead) services with do : harm I method ( K i ) . Let H be an ordinary service with method interface I method ( H ) = { ok } .
Then it cannot be the case that for all threads P and Q both with required interfaces included in J = I provided ( f . H g 1 . K 1 g n . K n ) the following holds: the reply of the service H to the first method call in the computation ( P f . ok Q ) f . H g 1 . K 1 g n . K n equals true if and only if
P f . H g 1 . K 1 g n . K n sat ̲ noCALL ( g i . do : harm ) .
Proof. 
There are two cases: reply ok ( H ) = true and reply ok ( H ) = false . In the first case, choose P g i . do : harm S and Q S and in the second case choose P S and Q S . In both cases the required equivalence fails. □
Theorem 1.
Let i { 1 , , n } and let K 1 , , K n be ordinary (i.e., non lookahead) services with do : harm I K i , and let P and Q be threads both with required interfaces included in J = { f . ok } I provided ( g 1 . K 1 g n . K n ) .
Then the reply of the service SHRAT (as defined above) to the first method call in the computation ( P f . ok Q ) f . SHRAT g 1 . K 1 g n . K n equals true if and only if
P f . SHRAT g 1 . K 1 g n . K n sat ̲ noCALL ( g i . do : harm )
Proof. 
Without loss of generality, we will assume that n = i = 1 and we will write K instead of K 1 and g instead of g 1 . Let V be a state space with r V so that K = K ( r ) . We will distinguish two cases in this order: (i) the case that the computation P f . SHRAT g . K ( r ) involves a method call g . do : harm , and (ii) the case that it does not.
For case (i), suppose that the computation P f . SHRAT g . K ( r ) involves a method call g . do : harm . It is shown that the reply by SHRAT to the first method call of the computation ( P f . ok Q ) f . SHRAT g . K ( r ) equals false . To this end, it suffices to prove that for each infinite sequence of Boolean values β = b 0 , b 1 , , the computation P f . RFS ( { ok } , β ) g . K ( r ) involves a basic action g . do : harm . If not, choose a thread P with required interface included in J and r V = STATES ( K ) such that (i) the computation from architerm P f . SHRAT g . K ( r ) ) involves a method call g . do : harm , (ii) for some finite or infinite sequence of Boolean values β = b 1 , b 2 , the computation P f . RFS ( { ok } , β ) g . K ( r ) involves no basic action g . do : harm , (iii) the number n of steps of the computation of P f . SHRAT g . K ( r ) until its first call of g . do : harm is minimal, say n min . A contradiction is derived from a case distinction on the structure of P .
Consider first the case that P S , S f . SHRAT g . K ( r ) terminates at once and does not involve an occurrence of the basic action g . do : harm , thereby contradicting requirement (i) on P and r . A similar argument applies if P D . Now suppose that P P 1 g . do : harm P 2 . In this case, there is no β such that the computation P f . RFS ( { ok } , β ) g . K ( r ) avoids performing basic action g . do : harm , thereby contradicting requirement (ii) on the choice of P and r . Next let P P 1 g . m P 2 for m I K . Now, two cases are distinguished: reply m ( r ) = true and reply m ( r ) = false . Consider the first case, then in one step, the architerm ( P 1 g . m P 2 ) f . SHRAT g . K ( r ) evolves to the architerm P 1 f . SHRAT g . K ( effect m ( r ) . Now, it must be the case that (a) the computation from the latter architerm involves an occurrence of g . do : harm (because of assumption (i) on P and r ) , (b) for some β (the same as for the combination P and r ) the computation P 1 f . SHRAT g . K ( effect m ( r ) ) does not involve an occurrence of the basic action g . do : harm , and (c) the number of steps in the computation of P 1 f . SHRAT g . K ( effect m ( r ) ) until the first call of g . do : harm equals n min 1 which contradicts the minimality of n min . The case reply m ( r ) = false works in the same way. Finally consider the case P P 1 f . ok P 2 . There are two subcases: in the first step of the computation of P f . SHRAT g . K ( r ) SHRAT returns true (subcase 1) or it returns false (subcase 2).
(Subcase 1). If SHRAT returns true , then it is known that (a) the computation of P 1 f . SHRAT g . K ( r ) involves an occurrence of g . do : harm (because of requirement (i) on P and r ), (b) there is a sequence α such that the computation P 1 f . RFS ( { ok } , α ) g . K ( r ) does not contain an occurrence of g . do : harm (the existence of α is obtained from the definition of SHRAT and the fact that its most recent reply was positive), and (c) the number of steps in this computation until the first occurrence of g . do : harm equals n min 1 . Together, (a), (b), and (c) contradict the minimality of n min for P and r .
(Subcase 2). The case that SHRAT returns false begins with the observation (a) that because the computation ( P 1 f . ok P 2 ) f . SHRAT g . K ( r ) involves a call g . do : harm so does the computation from the next step (because of the assumption made on the value of the call f . ok ) P 2 f . SHRAT g . K ( r ) ; observation (b) reads that b 1 = false . To see this, notice that due to the definition of SHRAT , the fact that the most recent reply to a call f . ok was negative must have been caused by the fact that, for each α , each computation starting from the architerm P 1 f . RFS ( { ok } , α ) g . K ( r ) involves a call g . do : harm . It follows from the latter that b 1 (the reply to the recent call f . ok as encoded in β ) must be false .
The computation from architerm ( P 1 f . ok P 2 ) f . RFS ( { ok } , β ) g . K ( r ) involves no call g . do : harm , and together with b 1 = false , it follows that the computation from architerm P 2 f . RFS ( β ) g . K ( r ) (with β = b 2 , b 3 , ) contains no call g . do : harm either. Finally notice (c) that the length of the latter computation is n min 1 . Together, (a), (b), and (c) contradict the minimality of n min , which concludes subcase 2.
In the second part of the proof, regarding case (ii) ( P f . SHRAT g . K ( r ) does not involve a method call g . do : harm ) one may assume that the computation of P f . SHRAT g . K ( r ) does not contain a method call g . do : harm .
We show that the first reply of SHRAT to a call f . ok (in the computation of ( P f . ok Q ) f . SHRAT g . K ( r ) ) equals true . Consider the finite or infinite sequence of Boolean values α = a 0 , a 1 , such that the successive calls (if any) of f . ok in the computation of P f . SHRAT g . K ( r ) are replied to by SHRAT as encoded in α . Making use of the fact that K is not a lookahead service, and that, consequently, its replies will only depend on the state of the service at the moment of a call being made and, of course, on the particular method which is being called, while its replies cannot not depend on future behaviour of the system, the architerm P f . RFS ( { ok } , α ) g . K ( r ) produces the same computation, and for that reason, it does not contain an occurrence of the method call g . do : harm . Now it follows from clause (b) in the definition of the behaviour of SHRAT that the reply given to the first call of f . ok in the computation of ( P f . ok Q ) f . SHRAT g . K ( r ) equals true . □
Definition 8.
SHRAT fst / fss is the restriction of SHRAT to finite state threads (fst) and finite state services (fss).
Proposition 6.
SHRAT fst / fss is a computable service taking as additional inputs for the determination of a reply on a method call ok a combination of two finite PGLB instruction sequences for the representation of the threads P and Q and finite state machines for the representation of the services K 1 , , K m .
Proof. 
A decision method for Φ (in the definition of SHRAT ) is as follows: Given arguments P , K 1 , , K n let u p = # STATES ( P ) , u 1 = # STATES ( K 1 ) , , # STATES ( K n ) be the respective sizes (number of elements) of the respective state spaces of these components. We find that a computation path without a call g i . do : harm   P f . SHRAT g . K 1 g . K n can have at most u = u p · u 1 · · u n steps unless it gets into a cycle. So by checking all paths of a length of u steps it can be found if there is a (possibly cyclic) path without a call to g i . do : harm , in which case the sequence of successive replies to calls f . ok provides a cyclic sequence β as required, while otherwise, no such β exists. □
Definition 9.
SHRAT fst / fss / tts is the restriction of SHRAT to finite state threads (fst) and a combination of finite state services (fss) with K 1 a service for a Turing tape (tts).
Proposition 7.
SHRAT fst / fss / tts is a non-computable service taking as additional inputs for the determination of a reply on a method call ok a combination of two finite PGLB instruction sequences for the representation of the threads P and Q , a bit sequence for the tape architerm for K 1 , and finite state machines for the representation of the services K 2 , , K m .
Proof. 
We consider the collection U of PGLB instruction sequences with required interface included in g 1 . I r ( TTS ) and such that termination can only occur at the last instruction (which must be !). Termination of computations of the form | P ; ! | g 1 . TSS is well known to be not computationally decidable. We find that for P ; ! U : the computation from | P ; ! | g 1 . TSS terminates if and only if the computation from | P ; g 2 . do : harm ; ! | g 1 . TSS g 2 . K 2 involves a call g 2 . do : harm , if and only if the initial call f . ok in the computation ( | P ; g 2 . do : harm ; ! | f . ok S ) f . SHRAT g 1 . TSS g 2 . K 2 receives reply false . If SHRAT is a computable service, it follows that the halting problem for PGLB instruction sequences over a Turing tape service is decidable as well, which is not the case. □
The notion of a lookahead service leaves open the possibility of the interaction of multiple lookahead services, and suggests possible generalisations of Theorem 1, with one or more of the K i featuring lookahead capability. This suggestion leads to the following result.
Theorem 2.
The condition for Theorem 1 that K 1 , , K n are ordinary services is a necessary condition for Theorem 1.
Proof. 
Let n = i = 2 in the notation of Theorem 1. We assume that I method ( K 1 ) = { m 1 , m 2 , m 3 } and I method ( K 2 ) = { do : harm , u 1 , u 2 } . We consider the following example:
P ( g 2 . u 1 ( g 2 . do : harm S g 1 . m 2 S ) ) f . ok ( g 2 . u 2 ( g 2 . do : harm S g 1 . m 3 S ) ) ) g 1 . m 1 S and Q S . Moreover, K 2 is an ordinary service such that do : harm I method ( K 2 ) . K 1 , however, is a non-ordinary service, which is defined as follows:
(i) K 1 has a single state only, so none of its actions results in a state change.
(ii) On m 2 and m 3 , the reply is always true .
(iii) on m 1 , the evaluation of θ ( s , m 1 ) for K 1 in a context ( R 1 g 1 . m 1 R 2 ) f . H g 1 . K 1 g 2 . K 2 depends on prospection as follows: θ ( s , m 1 ) is false (and with it the reply of f . K 1 to the call f . m ), if and only if there are two different ordinary services K a and K b so that R 1 f . H g 1 . K a g 2 . K 2 sat ̲ CALL ( g 2 . u 1 ) and R 1 f . H g 1 . K b g 2 . K 2 sat ̲ CALL ( g 2 . u 2 ) .
(iv) On m 1 there is no state change.
Now adopting the definition of SHRAT as given above, consider the computation starting from ( P f . ok Q ) f . SHRAT g 1 . K 1 g 2 . K 2 . This computation, however, does not comply with the requirement on f . SHRAT as given in Theorem 1. In particular, it is the case that:
(a) P f . SHRAT g 1 . K 1 g 2 . K 2 sat ̲ noCALL ( g 2 . do : harm ) while
(b) The first call of f . ok in the computation ( P f . ok Q ) f . SHRAT g 1 . K 1 g 2 . K 2 receives reply false from SHRAT .
To prove (b), first notice that the call f . ok requests SHRAT to evaluate the reply condition θ SHRAT . It must be shown that for each reply function β : { ok } + { true , false } it is the case that P f . RFS ( { ok } , β ) g 1 . K 1 g 2 . K 2 sat ̲ CALL ( g 2 . do : harm ) . The latter computation starts with the call g 1 . m 1 which will return false if and only if two different ordinary services K a and K b exist so that
R 1 f . RFS ( { ok } , β ) g 1 . K a g 2 . K 2 sat ̲ CALL ( g 2 . u 1 ) , and
R 1 f . RFS ( { ok } , β ) g 1 . K b g 2 . K 2 sat ̲ CALL ( g 2 . u 2 ) , with
R 1 = ( g 2 . u 1 ( g 2 . do : harm S g 1 . m 2 S ) ) f . ok ( g 2 . u 2 ( g 2 . do : harm S g 1 . m 3 S ) ) ) .
There are two cases β ( ok ) = true and β ( ok ) = false . If β ( ok ) = true , then both computations (for K a and for K b ) proceed with a reply true in the next step, i.e., the call f . ok , and both computations will subsequently perform a call of g 2 . u 1 and will therefore not perform a call of g 2 . u 2 . It follows, in this case, that the criterion for returning false on the call g 1 . m 1 is not satisfied, and true is returned as a reply. For the case β ( ok ) = false , a similar argument leads to the same conclusion.
We find that the reply of g 1 . K 1 on the method call g 1 . m 1 in the computation starting from P f . RFS ( { ok } , β ) g 1 . K 1 g 2 . K 2 must be true and therefore the next state of the computation is R 1 f . RFS ( { ok } , β ) g 1 . K 1 g 2 . K 2 . Now, two cases can be distinguished: β ( ok ) = true and β ( ok ) = false .
In the first case, the computation of R 1 f . RFS ( { ok } , β ) g 1 . K 1 g 2 . K 2 proceeds to
( g 2 . u 1 ( g 2 . do : harm S g 1 . m 2 S ) ) f . RFS ( { ok } , β ) g 1 . K b g 2 . K 2 . After a step for the call g 2 . u 1 , the call g 1 . m 2 will produce reply true (on the basis of the specification of K 1 ), so that the subsequent step is a call g 2 . do : harm . A similar argument applies if β ( ok ) = false . This proves that the call g 2 . do : harm is unavoidable, which proves (b) above.
For (a), it must be shown that
( R 1 g 1 . m 1 S ) f . SHRAT g 1 . K 1 g 2 . K 2 sat ̲ noCALL ( g 2 . do : harm ) . In the second step of the computation, K 1 produces a reply to the call g 1 . m 1 . The latter reply of K 1 equals false . To see this, one notices that when choosing K a (as a possible future for itself, such that the next reply on m 2 is false and the next reply on m 3 is true ), the reply of SHRAT to the next call of f . ok would be false , because otherwise g 2 . do : harm would become unavoidable. Moreover, the action g 2 . m 2 will take place.
Alternatively, upon contemplating K b as a possible future behaviour of K 1 so that the next reply to a call m 2 is true and the next reply on m 3 is false , the reply of SHRAT to the next call of f . ok would be true , because otherwise g 2 . do : harm would become unavoidable. Moreover the action g 2 . u 2 will take place.
So, given the fact that these two different computations for K a and K b are possible, the reply of K 1 to the initial method call g 1 . m 1 (in the computation ( R 1 g 1 . m 1 S ) f . SHRAT g 1 . K 1 g 2 . K 2 ) equals false (due to the particular non-ordinary definition of K 1 ). So the computation proceeds to S f . SHRAT g 1 . K 1 g 2 . K 2 which will not perform any basic action any longer such that noCALL ( g 2 : do : harm ) is satisfied, which proves (a). □

4. Promoting a Method Call

Rather than for avoiding a certain method call, prospection may, for whatever reason, be used to promote it taking place, i.e., to guarantee that it will take place if that guarantee can be given. However, the simplest foresight pattern to that extent fails. Instead of an action do : harm , which is preferably avoided, the presence of an action do : no _ harm which is preferably performed may be assumed.
Theorem 3.
Let m , i N , 1 i m and let K 1 , , K m be ordinary services with do : no _ harm I method ( K i ) . There is no single state service H with I method ( H ) = { find } such that the following holds:
for all threads P and Q with required interfaces included in J = I provided ( h . H g 1 . K 1 g m . K m ) , the reply of the service H to the first method call in the computation ( P h . find Q ) h . H g 1 . K 1 g m . K m equals true if and only if it is the case that P h . H g 1 . K 1 g m . K m sat ̲ CALL ( g i . do : no _ harm ) .
Proof. 
Suppose otherwise, and let H meet the requirements of the Theorem. Using the notation of Theorem 3, let P = P h . find ( g i . do : no _ harm S ) and Q = g i . do : no _ harm S .
First assume that H replies true on the first call h . find . Then after processing the positive reply, the computation returns to precisely the same state as it was in before said method call. Now, because H is a single-state service, the computation enters in a loop from which it will not escape and during which no method call g i . do : no _ harm will be performed. It follows that on a positive reply to the first call to H , it is not the case that P h . H g 1 . K 1 g m . K m will perform the required method call, so that the requirement on H is violated in that case.
Hence, it may be assumed that the first method call h . find receives reply false . In that case, given the assumptions made on H in the theorem, such will also be the case of the computation P h . H g 1 . K 1 g m . K m , which is precisely the same and which is processed with H from the same unique state. In that case, because of the negative reply, the method call g i . do : no _ harm will be performed in the computation of P h . H g 1 . K 1 g m . K m so that a mismatch with the requirement on H arises. □
Theorem 3 generalises to stateful prospecting services. First notice that the definition of a single state prospecting service can be easily adapted to involve several methods:
Definition 10 (Single state multi-method prospecting service).
L m 1 , , m t θ 1 , , θ t uses θ i to determine which reply to produce on a call of method m i . Definition 5 is adapted by using a quantifier of type { m 1 , , m t } + { true , false } instead.
Definition 11 (Stateful multi-method prospecting service).
A prospecting service L with method interface J , a state space S and an effect function η : J × S × { true , false } S can be defined if for each s S , and z J , a lookahead condition θ ( s , m ) CLA I I dm ( I ) is given which determines the reply on method m J in state s of L .
A workable notation for a service of this form with method interface J is L ( Z , S , s 0 , η , θ ) with η : Z × S × { true , false } S and θ : Z × S a lookahead condition. We will refer to services of this form as stateful with an ordinary effect function.
Services with multiple states will use the result of the evaluation of a reply condition for determining the next state transition (the result of the effect function). Then, the effect function has type effect : Z × S × BOOL S where the third argument is taken to be the reply value which is given in the same step.
Proposition 8.
Let n , i N , 1 i n and let J 1 , , J n be method interfaces with do : no _ harm J i . Let J = { h . find } g 1 . J 1 g n . J n . There is no stateful prospecting service
L L ( { find } , S , s 0 , η , θ ) for which the following holds:
for all n -tuples of ordinary services K 1 , , K n , with I method ( K 1 ) J 1 , , I method ( K n ) J n , for all states s S , and for all threads P and Q with required interfaces included in J , the reply of the service L ( { find } , S , s , η , θ ) to the first method call in the computation
( P h . find Q ) h . L ( { find } , S , s , η , θ ) g 1 . K 1 g n . K n equals true if and only if
P h . L ( { find } , S , η ( find , s , true ) , η , θ ) g 1 . K 1 g n . K n sat ̲ CALL ( g i . do : no _ harm ) .
Proof. 
Suppose otherwise, and let L ( { find } , S , s 0 , η , θ ) meet the stated requirements. Choose threads P and Q as follows: P = P h . find ( g i . do : no _ harm S ) and Q = g i . do : no _ harm S and let s S : A s P h . L ( find , S , s , η , θ ) g 1 . K 1 g n . K n . Suppose A s sat ̲ ¬ θ ( s , find ) . For s S let U s be the smallest subset of S which contains η ( find , s , true ) and which contains η ( find , t , true ) for each t S . It must be the case that for all t U s , A t sat ̲ θ ( t , find ) , because otherwise the computation from architerm A η ( find , s , true ) will perform a method call g i . do : no _ harm after as many steps as needed to arrive at a state t U s with A t sat ̲ ¬ θ ( t , find ) so that, given the requirements on L , A s sat ̲ θ ( s , find ) must be expected instead, thereby contradicting the above assumption that A s sat ̲ ¬ θ ( s , find ) . It follows that for all states s , of L ( { find } , S , s , η , θ ) it is the case that A s sat ̲ θ ( s , find ) whence A s 0 sat ̲ PERP without ever performing g i . do : no _ harm , from which it follows, with the requirements on L in the theorem, that A s 0 sat ̲ ¬ θ ( s 0 , find ) should hold, which yields a contradiction with the facts just established about L , thus concluding the proof. □

Method Call Promotion with a Single State Prospecting Service: MCP

The single state service MCP has state s and method interface { find } , and it is made accessible via focus h , which differs from g 1 , , g m . In a context ( P f . find Q ) h . MCP g 1 . K 1 g m . K m , the intended foresight pattern comprises that MCP produces replies in such a way that (i) a shortest path to a call of g i . do : no _ harm is found, and (ii) a positive reply is preferred in case (i) with both choices shortest paths to a call of g i . do : no _ harm of equal lengths can be found or (ii) no such paths can be found at all.
A reply r to the call h . find (i.e., θ ( s , find ) , in the context ( P h . find Q ) h . MCP g 1 . K 1 g m . K m as mentioned above) is computed as follows: r = θ ( s , find ) = ψ ¬ χ with
ψ α : { find } + { true , false } [ Q h . RFS ( { find } , α ) g 1 . K 1 g m . K m sat ̲ noCALL ( g i . do : no _ harm ) ] χ α : { find } + { true , false } , k N + [ P h . RFS ( { find } , α ) g 1 . K 1 g m . K m sat ̲ CALLat ( k , g i . do : no _ harm ) γ : { find } + { true , false } , l N + [ l < k & Q h . RFS ( { find } , γ ) g 1 . K 1 g m . K m sat ̲ CALLat ( l , g i . do : no _ harm ) ] ]
In other words: the reply is true if upon processing that reply (i.e., proceeding with P ), under the assumption that H is non-deterministic, a shortest path (of a computation of ( P h . find Q ) h . H g 1 . K 1 g m . K m ) to a call of g i . do : no _ harm can be found, or if such a path does not exist.
Or, phrased alternatively, the reply is false if only upon proceeding with Q a path in the computation of Q h . H g 1 . K 1 g m . K m to a call of g i . do : no _ harm (with non-deterministic H ) can be found, which is shorter than any such path in the computation of P h . H g 1 . K 1 g m . K m .
Proposition 9.
Let m , i N , 1 i m and let K 1 , , K m be ordinary (i.e., non-lookahead) services with do : no _ harm I method ( K i ) .
Then, for all threads P with I required ( P ) J = { h . find } g 1 . J 1 g m . J m , the following implication holds: if there is a function β { find } + { true , false } such that
P h . RFS ( { find } , β ) g 1 . K 1 g m . K m sat ̲ CALL ( g i . do : no _ harm ) then also
P h . MCP g 1 . K 1 g m . K m sat ̲ CALL ( g i . do : no _ harm ) .
Proof. 
Without loss of generality and for the ease of notation, We will assume that m = 2 and i = 2 . Let for natural number k > 0 , χ k be the following assertion:
Let K 1 , K 2 be ordinary (i.e., non-lookahead) services with do : no _ harm I method ( K 2 ) , and let P be a thread with required interface included in J , then if there is a Boolean function β such that
P h . RFS ( { find } , β ) g 1 . K 1 g 2 . K 2 sat ̲ CALLat ( k , g 2 . do : no _ harm ) ,
then there is a natural number l k such that
P h . MCP g 1 . K 1 g 2 . K 2 sat ̲ CALLat ( l , g 2 . do : no _ harm ) .
It is immediate that k . χ k implies Proposition 10. To prove that for all k > 0 , χ k holds, use induction on k with k = 1 as the basis. If k = 1 and P h . RFS ( { find } , β ) g 1 . K 1 g 2 . K 2 performs a basic instruction g 2 . do : no _ harm as the first step then P P 1 g 2 . do : no _ harm P 2 , for some threads P 1 and P 2 from which it follows that P h . MCP g 1 . K 1 g 2 . K 2 performs g 2 . do : no _ harm as the first step.
Now let k = l + 1 , l > 0 . In case P = S or P = D , the required implication is immediate as an instance of material implication. In case P P 1 g 2 . do : no _ harm P 2 , the implication is immediate too. The remaining cases to be checked are (a) P P 1 g j . m j P 2 with j { 1 , 2 } and m j J j , except the case that j = 2 and m j do : no _ harm , and (b) P P 1 h . find P 2 .
In case (a) there are two subcases, j = 1 , j = 2 both of which have two subcases: K j returns true on the call g j . m 1 and K j returns false of the call g j . m j . Each of these cases works in the same way. We consider the case that j = 1 and that true is returned. Now, P h . RFS ( { find } , β ) g 1 . K 1 g 2 . K 2 performs a single-step transition to P 1 h . RFS ( { find } , β ) g 1 . m 1 ( K 1 ) g 2 . K 2 . Here, f ( K ) denotes the state of a service K just after having replied to a call of method f I K . It follows that P 1 h . RFS ( { find } , β ) g 1 . m 1 ( K 1 ) g 2 . K 2 performs g 1 . do : no _ harm in at most l steps. Now the induction hypothesis can be applied to the latter architerm, which yields that the computation of P 1 h . MCP g 1 . m 1 ( K 1 ) g 2 . K 2 will perform a basic instruction g 2 . do : no _ harm within the first l steps from which it follows that computing P h . MCP g 1 . K 1 g 2 . K 2 involves a call of g 2 . do : no _ harm within the first k = l + 1 steps.
In case (b), there are again two subcases: (b/t) β 1 = true , and (b/f) β 1 = false . In case (b/t), upon performing a first step, the computation proceeds from P 1 h . RFS ( { find } , β ) g 1 . K 1 g 2 . K 2 arriving at a method call g i . do : no _ harm at the l -th step. Using the induction hypothesis, the computation of P 1 h . MCP g 1 . K 1 g 2 . K 2 performs a method call g 2 . do : no _ harm within the first l steps. Now, once more, there are two cases: (b/t/t) the reply on the first method call in the computation of ( P 1 h . find P 2 ) h . MCP g 1 . K 1 g 2 . K 2 is true , and (b/t/f) the mentioned reply equals false . In the first case, it is immediate that the computation of ( P 1 h . find P 2 ) h . MCP g 1 . K 1 g 2 . K 2 contains a call of g 2 . do : no _ harm within l + 1 steps. In the second case (b/t/f) in view of the definition of MCP , with β = λ x { find } + . β ( find x ) , it must be so that the computation of P 2 h . RFS ( { find } , β ) g 1 . K 1 g 2 . K 2 performs a call of g i . do : no _ harm , and in fact within less than l steps. Now, with the induction hypothesis, it follows that the computation of P 2 h . MCP g 1 . K 1 g 2 . K 2 involves a call of g 2 . do : no _ harm within l steps, from which it follows (with the assumption for case (b/t/f), that the computation of P h . MCP g 1 . K 1 g 2 . K 2 involves a call of g 2 . do : no _ harm within l + 1 steps. The argument in case (b/f) is very similar to the case for (b/t), and is deleted for that reason. □
Proposition 10.
Let m , i N , 1 i m and let K 1 , , K m and P , Q be as in Proposition 9.
Then the reply of the service MCP (as defined above) to the first method call in the computation ( P h . find Q ) h . MCP g 1 . K 1 g m . K m equals false if and only if the following condition is satisfied:
for some positive k N , the computation Q h . MCP g 1 . K 1 g m . K m performs the method call g i . do : no _ harm in the k ’th step while P h . MCP g 1 . K 1 g m . K m does not reach an occurrence of the method call g i . do : no _ harm in l steps for some l k .
Proof. 
This proof is a straightforward though somewhat tedious consequence of Proposition 9. Suppose that the reply of MCP to the first method call in the computation ( P h . find Q ) h . MCP g 1 . K 1 g m . K m equals false . Then in view of the definition of MCP , there exists a function β such that the computation Q h . RFS ( { find } , β ) g 1 . K 1 g m . K m performs g i . do : no _ harm . With Proposition 9, it follows that the computation Q h . MCP g 1 . K 1 g m . K m performs g i . do : no _ harm , say, at the k -th step. Following this computation, one finds that for some function α , it must be the case that Q h . RFS ( { find } , α ) g 1 . K 1 g m . K m performs g i . do : no _ harm in the k -th step, moreover for function α , the computation Q h . RFS ( { find } , α ) g 1 . K 1 g m . K m performs g i . do : no _ harm within fewer than k steps. Now contemplating the definition of MCP , one notices that its condition ψ is not satisfied, whence its condition χ must be satisfied, from which it follows that for no function γ , it is the case that P h . RFS ( { find } , γ ) g 1 . K 1 g m . K m performs g i . do : no _ harm within k or fewer steps, from which it follows by Proposition 9 that P h . MCP g 1 . K 1 g m . K m does not perform a method call within k steps or less. This proves one direction of the Theorem; the argument in the other direction is quite similar, and is deleted for that reason. □
Theorem 4.
With the same assumptions as in Propositions 9 and 10: for all threads P , Q with required interface included in J = { h . find } g 1 . I K 1 g m . I K m , the following implication holds: if P h . MCP g 1 . K 1 g m . K m performs a basic instruction g i . do : no _ harm or Q h . MCP g 1 . K 1 g m . K m performs a basic instruction g i . do : no _ harm then also ( P h . find Q ) h . MCP g 1 . K 1 g m . K m performs a basic instruction g i . do : no _ harm .
Proof. 
This result follows from Proposition 10 plus the observation that if P h . MCP g 1 . K 1 g m . K m performs a basic instruction g i . do : no _ harm , then for some Boolean function β also P h . MCP β g 1 . K 1 g m . K m performs a basic instruction g i . do : no _ harm . □
Problem 3.
Consider architerms containing both a SHRAT service and an MCP service. Can Theorem 4 be generalised to this case?

5. Lookahead Instructions

Threads provide abstractions from sequential programs. The impossibility result of Cohen on virus detection was formulated in terms of programs rather than in terms of threads and services. In this section, we will consider how the results on lookahead services may be used for obtaining information at the lower abstraction level of instruction sequences.
Special instructions may be designed, which incorporate the support of lookahead services into instruction (sequence) processing without making explicit calls to a lookahead service. Leaving apart the task of designing a syntax for such instructions in general, it is already informative to consider some simple special cases.
With a § f . m , for a a positive natural number, we will denote the following condition which may be evaluated during a run at some position (instruction) in an instruction sequence. Let X ; Y be an instruction sequence such that LLOC ( X ) = b 1 . Now a § f . m , when evaluated at position b asserts that a computation of X ; Y when stated at the beginning of Y will proceed in such a manner that the a ’th step is a basic action involving a method call f . m , i.e., either the void method call or a test + f . m or a test f . m . If the computation has terminated, either properly or improperly, at or before the a ’th step, the value of a a § f . m is considered false .
Making use of a lookahead condition is not an obvious matter. The simplest idea is to use the condition as a test which is evaluated at the position where it occurs. However, in X 1 = # 1 ; g . m 1 ; ( 2 § f . m ) ; f . m ; ! , a difficulty arises. Assuming that at position 3 , the condition 2 § f . m takes value true , then upon starting the run in position 3 , the result of the test is positive and because of its embedding in a negative test instruction, the instruction is performed as if it were # 2 so that as a second step in the run, termination (!) occurs, which implies that the evaluation of 2 § f . m at position 3 should have taken value false in hindsight. Alternatively one may consider the possibility that evaluation of the condition 2 § f . m at position 3 yields value false , and then the third instruction is performed as if it were # 1 so that the second step is f . m so that, again in hindsight, 2 § f . m (evaluated at position 3 ) should have yielded value true . The instruction ( 2 § f . m ) is, in this context, paradoxical because no evaluation of its embedded condition is possible. In that case, a run of X 1 involving the putting into effect of the third instruction is said to terminate improperly (just like # 0 ).
By first jumping to another position, either forward or backward, the mentioned paradox may be avoided, though not fully. With # b § a § f . m , the condition is denoted which, when evaluated at position p amounts to evaluating a § f . m at position p + b . If that position lies outside the range of instructions, the result is false . Similarly the condition \ # b § a § f . m is evaluated by evaluating a § f . m at position p b , again returning false if that position is 0 or lower. Consider X 2 = # 1 ; g . m 1 ; ( # 1 § 2 § f . m ) ; + g . m 2 ; f . m ; # 0 ; ! When evaluating # 1 § 2 § f . m at position 3 , the hypothetical computation has to start at position 4 , then as the first step, the test + g . m 2 is performed, and then depending on the result either the call f . m is made (so that the evaluation of # 1 § 2 § f . m yields true ) or improper termination results (so that the evaluation of # 1 § 2 § f . m yields false ).
A paradoxical situation may result if the computation started at position p + b for an evaluation of # b § a § f . m at position p visits the test instruction (say + ( # b § a § f . m ) ) within k steps. In that case, it is assumed that no definite value can be found for the condition # b § a § f . m and that the execution of the instruction + ( # b § a § f . m ) at position p runs into improper termination. With the understanding that, say ( 2 § f . m ) is an abbreviation of ( # 0 § 2 § f . m ) , it is plausible to adopt the convention that ( 2 § f . m ) leads to improper termination immediately, because the test is called before an evaluation of the embedded condition is known.
For the (hypothetical) processing of a condition # b § a § f . m , say, occurring as an embedded instruction in a test + ( # b § a § f . m ) at position p in an instruction sequence X , we notice the following:
(i) It does not change the state of any service (because it is a hypothetical form of processing);
(ii) It returns true if, when (hypothetically) the computation is performed, that computation will perform a basic action f . m in the a -th step (without any visit to the p ’th instruction in between);
(iii) It returns false otherwise (including the cases that proper or improper termination arises before the a’th step of the computation).

Implementing a Lookahead Instruction via a Prospective Service

A useful modification of the lookahead instructions + ( # b § a § f . m ) and ( # b § a § f . m ) is as follows: + ( # b § F § f . m ) and ( # b § F § f . m ) include tests which require that at least once during a run, a basic action or test based on the method call f . m is performed.
The positive result in Theorem 1 can be used for clarifying the feasibility of a specific lookahead instruction. Here, the use of infinite instruction sequences, obtained via repetition of a finite instruction sequence, comes in handy. As was shown in [2], repetition, which underlies the program algebra PGA, has the expressive power of arbitrary flow charts though without making use of backward jumps.
Proposition 11.
Let U ( # 1 § F § g i . do : harm ) . Let X be an instruction sequence with zero or more occurrences of U as its only lookahead instructions and without backward jumps and with required interface contained in J = I provided ( g 1 . K 1 g n . K n ) . Let X be obtained from X by replacing each occurrence of U by the method call + f . ok .
Then, upon defining | X | g 1 . K 1 g n . K n as | X | f . SHRAT g 1 . K 1 g n . K n , the semantics of instruction U is given in such a way that it complies with the (informal) definition given above for the (lookahead) test instruction ( # 1 § F § g i . do : harm ) .
Proof. 
When using repetition as an instruction sequence constructor, an infinite, repeating, instruction sequence results in which only forward jumps are used. Using this fact, the correspondence between the semantics of instruction U and its counterpart after thread abstraction is perfect. □

6. Concluding Remarks

Several aspects of this paper suggest further work. The notion of a lookahead condition merits more scrutiny. Perhaps we have not yet been able to prove anything positive about cases where different prospecting services are simultaneously present. As intelligent agents will try to forecast one-another’s behaviour, the idea of different forecasting mechanisms acting in parallel may be considered intuitively obvious, while the mathematics of that situation is not at all clear.

6.1. Multi-Agent Aspects

Suppose P 1 , , P n are threads and W i are service families such that (i) the different focus interfaces ( I focus ( W i ) ) are pairwise disjoint and (ii) I required ( P i ) I provided ( W i ) . We will assume that the threads constitute a so-called thread vector, so that the ordering matters as well. Following [1], we will write this vector as follows: P 1 P n . Then strategic interleaving of the thread vector is denoted with
| | c ( P 1 P n )
In [1], a range of different strategic interleaving operations are provided. The idea behind strategic interleaving operators is to model multi-threading in the way it is implemented in programming systems which arrange for deterministic scheduling rather than for some form of the arbitrary interleaving of concurrent threads. The advantage of modelling multi-threading with strategic interleaving is that arguably, that is more realistic. A disadvantage, however, is that the very well understood parallel composition operator based on arbitrary interleaving, which stands at the basis of most process algebras, is replaced by a range of different strategic interleaving operators of increasing complexity.
For cyclic interleaving and variations thereof (as discussed in detail in [1]), the required interface of a thread vector is found by taking the union for the individual threads: I required ( | | c ( P 1 P n ) ) = i = 1 n I required ( P i ) . Because I provided ( W 1 W n ) = i = 1 n I provided ( W i ) the architerm
| | c ( P 1 P n ) W 1 W n
makes perfect sense. It follows from Proposition 5 that if, say, W 1 contains f . SHRAT and this instance of SHRAT attempts prospection on a basic action, say, g . m with g I focus ( W 2 ) that this will allow P 1 to use foresight to the extent that it may only perform certain basic actions in the case that P 1 “knows” that P 2 will not perform g . m in the future. It follows from Theorem 2 that the situation becomes much more complicated if different agents try to make use of prospecting services at the same time. On the other hand, expecting that P 1 may be equally certain about guarantees that P 2 will actually perform g . m in the future may be asking too much in view of Proposition 8.
Collective action and underlying collective intelligence rests upon knowledge that agents have or pretend to have about other agents in the same flock. The results of the paper shed some light on the options and limitations of such knowledge.

6.2. Why Thread Algebra, in the Context of Prospection and Foresight?

Viewed from the perspective of process algebra working with a domain-specific process algebra is an overhead which one might preferably avoid.
The simplest idea on foresight in process algebra is to allow a condition noACT ( a g ( d ) ) which is true if and only if an atomic action a g ( d ) (i.e., atomic action of type a at location/port g , with parameter/data, d ) will not be performed in the future of the system (process at hand). One may look for a counterpart of Proposition 5 in this case, but there is a problem with that idea.
Indeed consider P = a g ( d ) noACT ( b g ( d ) ) a g ( d ) with a b . P is paradoxical in the sense that the suggested foresight cannot exist. This very issue of foresight preventing self-reference is, at least to some degree, avoided by working with thread algebra.

6.3. Potential Connections with Classical AI

While prospecting, services which allow the realisation of attractive foresight patterns may be impossible or hypothetical. Reworking the concepts at hand in such a manner that prospecting and foresight can be replaced by computable approximations thereof may be a workable approach. Practical prospecting, especially when based on empirical data may be termed lookahead; practical foresight, again when performed on a scientifically defensible basis, may be termed forecasting. An option for further work along the lines of this paper is to adapt software engineering life-cycle models in two stages: first to make use of the admittedly hypothetical advantage of prospecting services and foresight patterns realised with the help of such services, and thereafter to work with approximations of the various instances of prospecting and foresight, thereby obtaining computable (non-hypothetical) lookahead services and forecasting patterns.

Funding

This research received no external funding.

Conflicts of Interest

The author declares no conflict of interest.

References

  1. Bergstra, J.A.; Middelburg, C.A. Thread algebra for strategic interleaving. Form. Asp. Comput. 2007, 19, 445–474. [Google Scholar] [CrossRef] [Green Version]
  2. Bergstra, J.A.; Loots, M.E. Program algebra for sequential code. J. Log. Algebr. Program. 2002, 51, 125–156. [Google Scholar] [CrossRef] [Green Version]
  3. Bergstra, J.A.; Middelburg, C.A. A short introduction to program algebra with instructions for Boolean registers. Comput. Sci. J. Mold. 2019, 26, 199–232. Available online: http://www.math.md/files/csjm/v26-n3/v26-n3-(pp199-232).pdf (accessed on 12 May 2022).
  4. Bergstra, J.A.; Middelburg, C.A. Instruction sequence processing operators. Acta Inform. 2012, 49, 139–172. [Google Scholar] [CrossRef] [Green Version]
  5. Bergstra, J.A.; Middelburg, C.A. Distributed strategic interleaving with load balancing. Future Gener. Comput. Syst. 2008, 120, 530–548. [Google Scholar] [CrossRef] [Green Version]
  6. Bergstra, J.A.; Middelburg, C.A. Thread algebra for poly-threading. Form. Asp. Comput. 2011, 23, 567–583. [Google Scholar] [CrossRef] [Green Version]
  7. Middelburg, C.A. Progam algebra for random access machines. arXiv 2020, arXiv:2007.09946. [Google Scholar]
  8. Bergstra, J.A.; Klop, J.W. Process algebra for synchronous communication. Inf. Control 1984, 60, 109–137. [Google Scholar] [CrossRef] [Green Version]
  9. Bergstra, J.A.; Middelburg, C.A. On the behaviours produced by instruction sequences under execution. Fundam. Inform. 2012, 24, 111–144. [Google Scholar] [CrossRef] [Green Version]
  10. Bergstra, J.A.; Klop, J.W. Verification of an alternating bit protocol by means of process algebra. In Lecture Notes in Computer Science/Lecture Notes in Artificial Intelligence; Springer: Berlin/Heidelberg, Germany, 1986; pp. 9–23. [Google Scholar] [CrossRef] [Green Version]
  11. Baeten, J.C.M.; Middelburg, C.A. Process Algebra with Timing; Monographs in Theoretical Computer Science; Springer: Berlin/Heidelberg, Germany, 2002. [Google Scholar] [CrossRef]
  12. Bergstra, J.A.; Ponse, A. Execution architectures for program algebra. J. Appl. Log. 2004, 5, 170–192. [Google Scholar] [CrossRef]
  13. Middelburg, C.A. Probabilistic process algebra and strategic interleaving. Sci. Ann. Comput. Sci. 2020, 30, 205–243. [Google Scholar] [CrossRef]
  14. Groote, J.F.; Ponse, A. The syntax and semantics of μCRL. In Algebra of Communicating Processes; Springer: London, UK, 1994; pp. 26–62. [Google Scholar]
  15. Groote, J.F.; Mathijssen, A.; Reniers, M.A.; Usenko, Y.S.; van Weerdenburg, M.J. Analysis of distributed systems with mCRL2. In Process Algebra for Parallel and Distributed Processing; Chapman & Hall: Boca Raton, FL, USA, 2009; pp. 99–128. [Google Scholar]
  16. Baeten, J.C.M.; Bergstra, J.A. Global renaming operators in concrete process algebra. Inf. Comput. 1988, 78, 205–245. [Google Scholar] [CrossRef] [Green Version]
  17. Baeten, J.C.M.; Bergstra, J.A.; Klop, J.W. Conditional Axioms and α/β- Calculus in Process Algebra. In Formal Description of Programming Concepts III, Proceedings of IFIP TC 2/WG 2.2 Working Conference, Ebberup, Denmark, 25–28 August 1986; North Holland Publishing Company: Amsterdam, The Netherlands, 2017; pp. 53–74. [Google Scholar]
  18. Cohen, F. Computer viruses—Theory and experiments. Comput. Secur. 1984, 6, 22–35. [Google Scholar] [CrossRef]
  19. Evans, D. On the Impossibility of Virus Detection; Department of Computer Science, University of Virginia: Charlottesville, VA, USA, 2017; Available online: https://www.cs.virginia.edu/~evans/virus/ (accessed on 12 May 2022).
  20. Selçuk, A.A.; Orhan, F.; Batur, B. Undecidable problems in malware analysis. In Proceedings of the 12th International Conference for Internet Technology and Secured Transactions (ICITST), Cambridge, UK, 11–14 December 2017. [Google Scholar] [CrossRef]
  21. Laski, J. Programming faults and errors: Towards a theory of software incorrectness. Ann. Softw. Eng. 1997, 4, 79–114. [Google Scholar] [CrossRef]
  22. Mili, A.; Frias, M.F.; Jaoua, A. On Faults and Faulty Programs; Höfner, P., Jipsen, P., Kahl, W., Müller, M.E., Eds.; RAMiCS 2014, LNCS 8428 Series; Springer: Cham, Switzerland, 2014; pp. 191–207. [Google Scholar] [CrossRef]
  23. Bergstra, J.A. Instruction sequence faults with formal change justification. Sci. Ann. Comput. Sci. 2020, 30, 105–166. [Google Scholar] [CrossRef]
  24. Bergstra, J.A. Promises in the context of humanoid robot morality. Int. J. Robot. Eng. 2020, 5, 20. [Google Scholar]
  25. Bergstra, J.A.; Middelburg, C.A. Data linkage dynamics with shedding. Fundam. Inform. 2010, 103, 31–52. [Google Scholar] [CrossRef] [Green Version]
  26. Bergstra, J.A. Quantitative expressiveness of instruction sequence classes for computation on bit registers. Comput. Sci. J. Mold. 2019, 27, 131–161. Available online: http://www.math.md/publications/csjm/issues/v27-n2/12969/ (accessed on 12 May 2022).
  27. Raclet, J.-B.; Badoel, E.; Benveniste, A.; Callaud, B.; Passerone, R. Why Are Modalities Good for Interface Theories? Report No. 6899; INRIA: Rocquencourt, France, 2009; ISSN 0249-6399. Available online: https://hal.inria.fr/inria-00375098 (accessed on 12 May 2022).
  28. de Alfaro, L.; Henzinger, T.A. Interface Automata. ACM SIGSOFT Software Engineering Notes. 2001. Available online: https://luca.dealfaro.com/papers/01/FSE01.pdf (accessed on 12 May 2022).
  29. Bergstra, J.A.; Ponse, A. A bypass of Cohen’s impossibility result. In Advances in Grid Computing 2005, Proceedings of the European Grid Conference, Amsterdam, The Netherlands, 14–16 February 2005; LNCS 3470 Series; Springer: Berlin, Germany, 2005; pp. 1097–1106. Available online: https://staff.fnwi.uva.nl/a.ponse/publist/EGCreport.pdf (accessed on 12 May 2022).
  30. Christodorescu, M.; Jha, S.; Seshia, S.A.; Song, D.; Bryant, R.E. Semantics-Aware Malware Detection. In Proceedings of the 2005 IEEE Symposium on Security and Privacy (S&P’05), Oakland, CA, USA, 8–11 May 2005. [Google Scholar] [CrossRef] [Green Version]
  31. Bergstra, J.A.; Bethke, I.; Ponse, A. Thread algebra and risk assessment services. Camb. Lect. Notes Log. 2007, 28, 1–17. Available online: https://staff.fnwi.uva.nl/a.ponse/publist/Bergstra.pdf (accessed on 12 May 2022).
Table 1. Equations for provided interfaces.
Table 1. Equations for provided interfaces.
( 1 ) x interface = x ( 2 ) x y = y x ( 3 ) x ( y z ) = ( x y ) z ( 4 ) x x = x ( 5 ) f . { m } = { f . m } ( 6 ) f . method interface = interface ( 7 ) f . ( h u ) = f . h f . u ( 8 ) H 0 service family = H ( 9 ) H L = L H ( 10 ) H ( K L ) = ( H K ) L ( 11 ) focus collection ( H ) = H ( 12 ) U 0 service family = 0 service family ( 13 ) { f } ( f . R ) = 0 service family ( 14 ) f g { f } ( g . R ) = g . R ( 15 ) { f } ( H K ) = { f } ( H ) { f } ( K ) ( 16 ) U V ( H ) = U V ( H ) ( 17 ) f . H f . K = f . 0 service ( 18 ) I method 0 service = method interface ( 19 ) I method ( H ) = { m m is a method of H } ( 20 ) I provided 0 service family = interface ( 21 ) I provided ( f . H ) = f . I method ( H ) ( 22 ) I provided f . H { f } ( K ) = I provided ( f . H ) I provided { f } ( K ) ( 23 ) I focus collection 0 service family = focus collection ( 24 ) I focus collection ( f . H ) = { f } ( 25 ) I focus collection ( V W ) = I focus collection ( V ) I focus collection ( W ) ( 26 ) x y x y = y
Table 2. Equations for the required interfaces of threads and instruction sequences.
Table 2. Equations for the required interfaces of threads and instruction sequences.
( 27 ) I required ( S ) = interface ( 28 ) I required ( D ) = interface ( 29 ) I required ( P f . m Q ) = I required ( P ) { f . m } I required ( Q ) ( 30 ) I required ( ! ) = interface ( 31 ) I required ( # n ) = I required ( \ # n ) = interface ( 32 ) I required ( + f . m ) = I required ( f . m ) = I required ( f . m ) = { f . m } ( 33 ) I required ( X ; Y ) = I required ( X ) I required ( Y ) ( 34 ) I required ( X ! ) = I required ( X )
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Bergstra, J. Thread Algebra with Prospecting Services and Foresight Patterns. Mathematics 2022, 10, 2232. https://doi.org/10.3390/math10132232

AMA Style

Bergstra J. Thread Algebra with Prospecting Services and Foresight Patterns. Mathematics. 2022; 10(13):2232. https://doi.org/10.3390/math10132232

Chicago/Turabian Style

Bergstra, Jan. 2022. "Thread Algebra with Prospecting Services and Foresight Patterns" Mathematics 10, no. 13: 2232. https://doi.org/10.3390/math10132232

APA Style

Bergstra, J. (2022). Thread Algebra with Prospecting Services and Foresight Patterns. Mathematics, 10(13), 2232. https://doi.org/10.3390/math10132232

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop