Abstract 1 Introduction 2 Preliminaries 3 Reward Interfaces 4 Compatibility and Composition of Reward Interfaces 5 Reward Interface Refinement 6 Checking Compatibility, Refinement, and Implementability 7 Related Work 8 Conclusion References Appendix A Appendix: Compatibility of Reward Interfaces Appendix B Appendix: Properties of Reward Interface Refinement

Reward Interfaces
with Best-Effort Implementations

Rafael Dewes ORCID CISPA Helmholtz Center for Information Security, Saarbrücken, Germany Rayna Dimitrova ORCID CISPA Helmholtz Center for Information Security, Saarbrücken, Germany
Abstract

Interface theories, notably interface automata, serve as expressive frameworks for component-based design, specifying component behavior and interaction in concurrent systems. Traditional interface formalisms specify assumptions that a component’s environment must satisfy and the guarantees that each component provides. This qualitative view of component interaction based on imposing strict assumptions and Boolean guarantees may, however, not be expressive enough to capture the system’s allowed or desired behaviors under different environments.

In this paper, we introduce reward interfaces to support component-based design while accommodating multi-valued correctness requirements and adaptive best-effort satisfaction of component’s guarantees. Building upon interface automata, our framework enables modeling a rich class of quantitative component specifications. We propose formal notions of implementation, refinement and compatibility for reward interfaces. We study a class of reward interfaces with automata-based representations, for which we provide algorithms for checking compatibility and refinement, and existence of best-effort implementations. Our framework offers a comprehensive approach to reward interface specification and design.

Keywords and phrases:
Component-based design, interface automata, quantitative specifications
Copyright and License:
[Uncaptioned image] © Rafael Dewes and Rayna Dimitrova; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation → Formal languages and automata theory
Editors:
Stefano Guerrini and Barbara König

1 Introduction

In system design and analysis, component-based techniques are essential for managing the increasing size and complexity of modern systems. Specification theories, particularly those based on interfaces or contracts [3, 9, 14], provide structured frameworks to address the challenges posed by concurrent systems. Interface theories [15, 18, 10] are especially suited for expressing interactions and dependencies of subsystems, offering formal specifications for analysis and verification. Here, each component is modeled by an interface, enabling a modular, independent design process, while ensuring compatibility between components.

One well-studied formalism are automata-based stateful interfaces, building on de Alfaro and Henzinger’s seminal work on interface automata [14]. They model components with distinct input and output actions, synchronizing with other components. Key properties are compatibility, which allows abstraction of multiple components into a single subsystem, and refinement, which supports independent component implementation. Interface automata have been extended to express more complex system behaviors. For example, resource interfaces [6] handle quantitative aspects like resource usage, while modal interfaces [20, 23, 21] capture richer properties such as liveness, expanding the expressivity of the framework. Further extensions [25, 24] incorporate state-based contracts, which enables concepts like shared memory in interface theories. A core motivation for interface theories is to simplify the design process by relieving designers from defining responses for every possible input. Typically, interfaces adopt an optimistic stance, allowing components to assume specific behavior from their environment. Inputs are either allowed or disallowed, with no obligation to handle disallowed inputs. This assumption holds as long as the system is closed, meaning all inputs come from other components. However, for open systems, where external inputs are beyond our control, these strong assumptions must be reconsidered.

We introduce a novel approach of reward interfaces, building on interface automata, that aims to enhance the design process while accommodating an unrestricted external environment. Central to our approach is the concept of good-enough satisfaction, based on the idea of good-enough synthesis [2], which says satisfaction of requirements is only necessary under feasible input conditions. This notion enables designers to focus on essential aspects of system behavior, removing the task of considering more explicit environment restrictions. It also naturally lends itself to the quantitative domain, introducing an additional direction in expressing complex properties to interface specifications, such as graceful degradation.

We consider an automaton structure coupled with a multi-valued reward function, defined over sequences of inputs and outputs of the interface, and require best-effort satisfaction from its implementation. While this generally loosens obligations, it selects for high-quality implementations if they exist. The interface automaton provides strict assumptions and guarantees, but is limited to safety properties. The reward function is more flexible, and able to express a substantial class of properties including liveness. This keeps the automaton simple and interpretable, offloading complicated requirements to the function without obscuring essential interaction restrictions. Our approach allows designers to succinctly capture complex system behaviors, which we illustrate below using a simple example.

Example 1.

Suppose we want to design a message distribution system 𝖲. The system 𝖲 can receive messages 𝖾𝟣,𝖾𝟤 and should relay the received messages in the respective order via the output actions 𝗈𝟣 and 𝗈𝟤. The system is limited in that it cannot produce an output while receiving an input, and it cannot send more than one output at a time. If the system has to handle both 𝖾𝟣 and 𝖾𝟤 during an execution, this will consume more resources.

Formally, 𝖲 is modeled via the input actions 𝖾𝟣,𝖾𝟤, controlled by the external environment, and output actions 𝗈𝟣, 𝗈𝟤 and 𝗈𝟥, with the following requirements: Once 𝖾𝟣 occurs, then 𝖲 must output 𝗈𝟣, and once 𝖾𝟤 occurs, 𝖲 must output 𝗈𝟤. If both inputs are received, then 𝗈𝟣 and 𝗈𝟤 must be produced in the same order. 𝖲 must not perform actions 𝗈𝟣, 𝗈𝟤 before 𝖾𝟣 or 𝖾𝟤, respectively, has happened. The additional output 𝗈𝟥 is unconstrained by the specification.

The specification of 𝖲 is formalized as a reward function ℱ𝖲 which maps the possible execution traces of 𝖲 to numerical values reflecting the extent to which the requirements are satisfied. Concretely, ℱ𝖲 maps (possibly infinite) sequences σ over the alphabet Σ𝖲={𝖾𝟣,𝖾𝟤,𝗈𝟣,𝗈𝟤,𝗈𝟥} to values v∈{0,14,12,1}.

Executions where 𝗈𝟣 occurs after an 𝖾𝟣, and no input 𝖾𝟤 is received, are awarded the maximum value of 1. The same value 1 is assigned to executions where the only input is 𝖾𝟤, and 𝗈𝟤 occurs after. If both 𝖾𝟣 and 𝖾𝟤 occur, and both 𝗈𝟣 and 𝗈𝟤 occur in the respective order, the achieved value will be 12. This represents the more demanding input behavior from the environment, abstracting a lowered efficiency, and is not a penalty on the system. The value is lowered to 14 if the order is reversed. Executions where an input is erroneously or not at all relayed are assigned value 0, violating the specification. We also give value 0 to sequences without any input, or an infinite sequence of inputs, as the system would be unable to produce output if continuously receiving inputs from the environment.

Since the inputs 𝖾𝟣,𝖾𝟤 are under the control of the environment, the system cannot force them to occur. This means that no implementation of 𝖲 can guarantee positive satisfaction of ℱ𝖲. A more realistic requirement is to ask 𝖲 to achieve the maximal satisfaction value possible for each sequence of input actions produced by the environment. In this best-effort view, the obligations on 𝖲 depend on the input provided by the environment. Thus, if the environment does not provide 𝖲 with an input, 𝖲 is not expected to achieve value higher than 0. Formally, we identify the so called (ℱ𝖲,v)-hopeful input sequences, which allow for achieving satisfaction value v. Here, for v=1 these are the sequences of the form 𝖾𝟣+ or 𝖾𝟤+.

Suppose that internally, 𝖲 is to be designed as the composition of two components P and Q. Component P is responsible for producing the output 𝗈𝟣, and component Q for outputs 𝗈𝟤,𝗈𝟥. This is expressed via the interface automata AP and AQ modeling the allowed interactions of P and Q, as depicted in Figure 1. AP and AQ synchronize on actions 𝗉, 𝗊, and operate independently otherwise. They can enable each other to produce outputs 𝗈𝟣,𝗈𝟤.

However, interface automata alone are unable to capture the quantitative requirement expressed via the function ℱ𝖲. The modeling framework of reward interfaces that we propose in this paper addresses this limitation. Reward interfaces equip interface automata with reward functions to capture the quantitative specifications that components must satisfy. In the coming sections, we will see how reward interfaces for P and Q model local quantitative specifications such that their combination captures the high-level specification ℱ𝖲.  ⌟

(a) Interface automaton AP with additional output action 𝗉 and additional input action 𝗊.
(b) Interface automaton AQ with additional output action 𝗊 and additional input action 𝗉.
Figure 1: Interface automata describing the components of the system in Example 1.

As Example 1 shows, our framework offers an elegant way to describe systems of interacting components. Our reward interfaces build directly on interface automata, adding expressivity through the reward function without necessarily making the automata more complex.

We introduce the formal definition of reward interfaces in Section 3, and define reward functions in a general way to maintain a high degree of flexibility. The notions of compatibility and refinement on reward interfaces are defined in Section 4 and Section 5 respectively, and we show that these entail desirable properties of interfaces. In Section 6 we provide a collection of algorithmic solutions for assessing these properties for a specific class of interfaces. Concretely, we consider reward functions with finite range that are represented as automata. For brevity, some of the missing proofs are presented in full in the appendix.

2 Preliminaries

In this section, we introduce necessary notation and preliminaries. Further, we recall and adapt the definition of interface automata and related notions from [14].

Languages and Automata

For an alphabet Σ, the set Σ∞:=Σ∗∪Σω contains all finite and infinite words over Σ. Given a sequence σ∈(Σ∪Σ′)∞, we denote with σ|Σ′ the projection of σ to Σ′, that is, σ|Σ′∈(Σ′)∞ is the sequence obtained from σ by removing all letters in Σ∖Σ′. For a sequence σ∈Σ∞, we denote with σ⁢[i]∈Σ the letter of σ at the i-th position.

A non-deterministic finite automaton (NFA) over an alphabet Σ is a tuple 𝒩=⟨Q,Σ,δ,Q0,F⟩ with finite set of states Q, initial states Q0⊆Q, transition relation δ⊆Q×Σ×Q, and a set of accepting states F⊆Q. A run of 𝒩 on a finite word σ=a1⁢…⁢an∈Σ∗ is a finite sequence ρ=ρ0⁢ρ1⁢…⁢ρn∈Q∗ such that ρ0∈Q0 and for every i<n, it holds that ρi+1∈δ⁢(ρi,σi+1). A run ρ is accepting if and only if ρn∈F. A non-deterministic Büchi automaton (NBA) ℬ=⟨Q,Σ,δ,Q0,B⟩ on infinite words instead has a set of Büchi-accepting states B⊆Q of which some must be visited infinitely often. A run ρ of ℬ on σ∈Σω is defined analogously, and is accepting if and only if for every i∈ℕ there exists j≥i such that ρ⁢[j]∈B. The language of an automaton ℒ⁢(𝒜) is the set of words σ on which 𝒜 has an accepting run. For a universal co-Büchi automaton (UCW) 𝒞=⟨Q,Σ,δ,Q0,B⟩, a run ρ of 𝒞 on a word σ∈Σω is accepting if and only if there exists i∈ℕ such that for all j≥i, ρ⁢[j]∉B, and σ∈Σω is only accepted by 𝒞 if every run is accepting. We define the size of an automaton 𝒜 as the total number of states and transitions, i.e. |𝒜|=|Q|+|δ|.

We use ℝ to denote the set of real numbers, and define ∞,−∞ as the elements where ∞>n>−∞ for all n∈ℝ. The set ℝ−∞=ℝ∪{−∞} then contains the real numbers and −∞. We define conventionally the infimum over the empty set as inf(∅)=∞.

Interface Automata

Interface automata [14] are a modeling formalism for specifying the interactions between components and their environment. Components communicate via synchronization on input and output actions. In contrast to the interface automata in [14], we distinguish external inputs ΣE, which are external to the overall system and broadcast to all components, from inputs ΣI that come from system components outside of A and are subject to assumptions specified by A. The external inputs enable synchronization between multiple components on the same input action, and are used to model behavior uncontrollable by the system.

Definition 2 (Interface Automaton (adapted from [14])).

An interface automaton A=⟨V,Vi⁢n⁢i⁢t,ΣI,ΣO,ΣE,ΣH,𝒯⟩ is a tuple where:

  • ■

    V is a finite set of states and Vi⁢n⁢i⁢t⊆V is a set of initial states. We require that Vi⁢n⁢i⁢t contains at most one state. If Vi⁢n⁢i⁢t=∅, then A is called empty.

  • ■

    ΣI,ΣO,ΣE,ΣH are mutually disjoint finite sets of input, output, external input and internal actions respectively. Let ΣA:=ΣI∪ΣO∪ΣE∪ΣH be the set of all actions of A.

  • ■

    𝒯⊆V×ΣA×V is a set of transitions such that for every state v∈V it holds that:

    • –

      for every external input action a∈ΣE, there exists v′∈V such that (v,a,v′)∈𝒯;

    • –

      for all a∈ΣE∪ΣI and v′,v′′∈V with (v,a,v′)∈𝒯 and (v,a,v′′)∈𝒯 we have v′=v′′.

Note that we require A to be input enabled on external input actions ΣE, i.e., it accommodates any external input in every state. We also require that A is input-deterministic on ΣE∪ΣI, in order to ensure compositionality of parallel composition [15].

We define the size of A as |A|=|V|+|𝒯|. For u∈V, we define the interface automaton Au=⟨V,{u},ΣI,ΣO,ΣE,ΣH,𝒯⟩ obtained from A by replacing the set of initial states by {u}.

Let A=⟨V,Vi⁢n⁢i⁢t,ΣI,ΣO,ΣE,ΣH,𝒯⟩ be an interface automaton. An execution of A is an alternating sequence v0,a0,v1,a1,… of states vi∈V and actions ai∈ΣA such that (vi,ai,vi+1)∈𝒯 for all i≥0. An execution fragment is a finite prefix v0,a0,v1,a1,…,vn of an execution ending in a state. A state v∈V is reachable in A if there exists an execution fragment starting in some v0∈Vi⁢n⁢i⁢t that ends in v. We denote with 𝖱𝖾𝖺𝖼𝗁⁢(A)⊆V the set of states reachable in A. For Σ′⊆ΣA, let 𝖤𝗇𝖺𝖻𝗅𝖾𝖽A⁢(v,Σ′):={a∈Σ′∣∃v′.(v,a,v′)∈𝒯} be the set of actions from Σ′ enabled in state v.

Two key notions in the theory of interface automata are the composability and product of automata. Whether two interface automata are composable depends on their actions. They must not share input, output and internal actions, but may have joint external inputs. For two composable interface automata, we can construct their product. This is formalized in the definitions below. For the remainder of this section, let AP=⟨VP,VPi⁢n⁢i⁢t,ΣPI,ΣPO,ΣPE,ΣPH,𝒯P⟩ and AQ=⟨VQ,VQi⁢n⁢i⁢t,ΣQI,ΣQO,ΣQE,ΣQH,𝒯Q⟩ be interface automata.

Definition 3 (Composability [14]).

Two interface automata AP and AQ are composable if ΣPI∩ΣQI=∅, ΣPO∩ΣQO=∅, ΣPH∩ΣQ=∅, and ΣQH∩ΣP=∅.

We define 𝖲𝗁𝖺𝗋𝖾𝖽⁢(AP,AQ):=(ΣPI∩ΣQO)∪(ΣQI∩ΣPO), and denote with 𝖩𝗈𝗂𝗇𝗍𝖤⁢(AP,AQ):=ΣPE∩ΣQE the set of joint external inputs of AP and AQ.

Definition 4 (Product).

Let AP and AQ be composable. Their product AP⊗AQ=⟨VP⊗Q,VP⊗Qi⁢n⁢i⁢t,ΣP⊗QI,ΣP⊗QO,ΣP⊗QE,ΣP⊗QH,𝒯P⊗Q⟩ is the interface automaton with the components defined as follows:

  • ■

    VP⊗Q:=VP×VQ, VP⊗Qi⁢n⁢i⁢t=VPi⁢n⁢i⁢t×VQi⁢n⁢i⁢t,

  • ■

    ΣP⊗QI=(ΣPI∪ΣQI)∖𝖲𝗁𝖺𝗋𝖾𝖽⁢(AP,AQ),ΣP⊗QO=(ΣPO∪ΣQO)∖𝖲𝗁𝖺𝗋𝖾𝖽⁢(AP,AQ),ΣP⊗QE=ΣPE∪ΣQE,ΣP⊗QH=(ΣPH∪ΣQH)∪𝖲𝗁𝖺𝗋𝖾𝖽⁢(AP,AQ),

  • ■

    𝒯P⊗Q={((vP,vQ),α,(vP′,vQ′))∣α∈(𝖲𝗁𝖺𝗋𝖾𝖽(AP,AQ)∪𝖩𝗈𝗂𝗇𝗍𝖤(AP,AQ))∧(vP,α,vP′)∈𝒯P∧(vQ,α,vQ′)∈𝒯Q}∪{((vP,vQ),α,(vP′,vQ))∣α∉(𝖲𝗁𝖺𝗋𝖾𝖽(AP,AQ)∪𝖩𝗈𝗂𝗇𝗍𝖤(AP,AQ))∧(vP,α,vP′)∈𝒯P}∪{((vP,vQ),α,(vP,vQ′))∣α∉(𝖲𝗁𝖺𝗋𝖾𝖽(AP,AQ)∪𝖩𝗈𝗂𝗇𝗍𝖤(AP,AQ))∧(vQ,α,vQ′)∈𝒯Q}.

Note that the actions 𝖲𝗁𝖺𝗋𝖾𝖽⁢(AP,AQ) become internal actions of AP⊗AQ, and P and Q must synchronize on shared and joint external input actions.

Given two composable interface automata AP and AQ, a product state (vP,vQ)∈VP×VQ is called an illegal state of the product automaton AP⊗Q if and only if there exists a∈𝖲𝗁𝖺𝗋𝖾𝖽⁢(AP,AQ) such that a∈(𝖤𝗇𝖺𝖻𝗅𝖾𝖽P⁢(vP,ΣPO)∖𝖤𝗇𝖺𝖻𝗅𝖾𝖽Q⁢(vQ,ΣQI))∪(𝖤𝗇𝖺𝖻𝗅𝖾𝖽Q⁢(vQ,ΣQO)∖𝖤𝗇𝖺𝖻𝗅𝖾𝖽P⁢(vP,ΣPI)). That is, illegal states are ones in which a shared action can be produced as an output of one of the interface automata but is not allowed as an input by the other one. Let 𝖨𝗅𝗅𝖾𝗀𝖺𝗅⁢(AP,AQ) be the set of illegal states of AP⊗AQ.

We say that two interface automata AP and AQ are compatible if there exists a way for the rest of the system, supplying the inputs ΣP⊗QI to ensure that illegal states are avoided. This gives rise to the notion of legal environment for AP and AQ, which we recall next.

Definition 5 (Legal Environment and Compatibility[14]).

A legal environment for (AP,AQ) is a non-empty interface automaton AR=⟨VR,VRi⁢n⁢i⁢t,ΣRI,ΣRO,ΣRE,ΣRH,𝒯R⟩ where:

  1. 1.

    ΣRE=ΣP⊗QE, ΣRI=ΣP⊗QO, ΣRO=ΣP⊗QI, ΣRH=∅.

  2. 2.

    AR is composable with AP⊗AQ, and 𝖨𝗅𝗅𝖾𝗀𝖺𝗅⁢(AP⊗AQ,AR)=∅.

  3. 3.

    𝖱𝖾𝖺𝖼𝗁⁢((AP⊗AQ)⊗AR)∩(𝖨𝗅𝗅𝖾𝗀𝖺𝗅⁢(AP,AQ)×VR)=∅.

Two interface automata AP and AQ are considered compatible if they are non-empty, composable and there exists a legal environment for (AP,AQ).

Intuitively, a legal environment AR for (AP,AQ) represents the remaining system beyond AP and AQ. Condition 3 requires that the inputs provided by AR to the two interfaces steer them away from illegal states in the product.

Definition 6 (Composition of Interface Automata[14]).

Given composable interface automata AP and AQ, a product state (vP,vQ)∈VP×VQ is called compatible if there exists a legal environment for (APvP,AQvQ). Let 𝖢𝗈𝗆𝗉⁢(AP,AQ) be the set of compatible product states. The composition AP∥AQ of AP and AQ is defined by restricting AP⊗AQ to 𝖢𝗈𝗆𝗉⁢(AP,AQ). Formally, AP∥AQ=⟨VP⊗Q∩𝖢𝗈𝗆𝗉⁢(AP,AQ),VP⊗Qi⁢n⁢i⁢t∩𝖢𝗈𝗆𝗉⁢(AP,AQ),ΣP⊗QI,ΣP⊗QO,ΣP⊗QE,ΣP⊗QH,𝒯P⊗Q∩(𝖢𝗈𝗆𝗉⁢(AP,AQ)×ΣP⊗Q×𝖢𝗈𝗆𝗉⁢(AP,AQ))⟩.

Intuitively, the compatible product states are those from which an environment can prevent reaching illegal states. Thus, AP and AQ are compatible if and only if VP⊗Qi⁢n⁢i⁢t⊆𝖢𝗈𝗆𝗉⁢(AP,AQ). Furthermore, for every (vP,vQ)∈𝖢𝗈𝗆𝗉⁢(AP,AQ), all the external input actions ΣP⊗QE lead to product sates in 𝖢𝗈𝗆𝗉⁢(AP,AQ). If this was not the case, (vP,vQ) would not be in 𝖢𝗈𝗆𝗉⁢(AP,AQ), since an external input action leading to an illegal state cannot be prevented by a legal environment. If an action a∈ΣP⊗QO leads from (vP,vQ) to 𝖨𝗅𝗅𝖾𝗀𝖺𝗅⁢(AP,AQ), we prune all a-transitions from (vP,vQ). Therefore, for compatible interface automata, the composition AP∥AQ is a non-empty interface automaton conforming to Definition 2.

Another concept, crucial for independent implementability of interfaces, is refinement. Refinement of interface automata [14] is defined via alternating simulation, recalled below.

For an interface automaton A and state v, let ε⁢-⁢𝖼𝗅𝗈𝗌𝗎𝗋𝖾A⁢(v) be the set of states of A that can be reached from v using only internal actions from ΣH. We define:

𝖤𝗑𝗍𝖤𝗇AI,E⁢(v):={a∣∀u∈ε⁢-⁢𝖼𝗅𝗈𝗌𝗎𝗋𝖾A⁢(v).a∈𝖤𝗇𝖺𝖻𝗅𝖾𝖽A⁢(u,ΣAI∪ΣAE)}⁢ and 𝖤𝗑𝗍𝖤𝗇AO⁢(v):={a∣∃u∈ε⁢-⁢𝖼𝗅𝗈𝗌𝗎𝗋𝖾A⁢(v).a∈𝖤𝗇𝖺𝖻𝗅𝖾𝖽A⁢(u,ΣAO)}.

to be the sets of externally enabled input and output actions at v. Further, for actions a∈𝖤𝗑𝗍𝖤𝗇AI,E⁢(v)∪𝖤𝗑𝗍𝖤𝗇AO⁢(v), let 𝖤𝗑𝗍𝖣𝖾𝗌𝗍A⁢(v,a)={u′∣∃(u,a,u′)∈𝒯A.u∈ε⁢-⁢𝖼𝗅𝗈𝗌𝗎𝗋𝖾A⁢(v)}.

Definition 7 (Alternating Simulation [14]).

A binary relation ⪰⊆VP×VQ is an alternating simulation from the interface automaton AQ to the interface automaton AP if for all vP∈VP and vQ∈VQ, vP⪰vQ implies that:

  1. 1.

    𝖤𝗑𝗍𝖤𝗇PI,E⁢(vP)⊆𝖤𝗑𝗍𝖤𝗇QI,E⁢(vQ) and 𝖤𝗑𝗍𝖤𝗇QO⁢(vQ)⊆𝖤𝗑𝗍𝖤𝗇PO⁢(vP).

  2. 2.

    For all a∈𝖤𝗑𝗍𝖤𝗇PI,E⁢(vP)∪𝖤𝗑𝗍𝖤𝗇QO⁢(vQ) and vQ′∈𝖤𝗑𝗍𝖣𝖾𝗌𝗍Q⁢(vQ,a), there exists a state vP′∈𝖤𝗑𝗍𝖣𝖾𝗌𝗍P⁢(vP,a) such that vP′⪰vQ′.

The existence of an alternating simulation from AQ to AP guarantees that the interactions of AP are preserved in AQ. In particular, AQ does not impose more assumptions on the environment than AP, and satisfies all the output restrictions of AP. That is, any environment compatible with AP also is compatible with AQ.

Definition 8 (Interface Automata Refinement [14]).

For interface automata AP and AQ, we say that AQ refines AP, written AQ⪯AP, if and only if ΣQE=ΣPE, ΣQI⊇ΣPI, ΣQO⊆ΣPO, and there exists an alternating simulation ⪰ from AQ to AP, and states vP∈VPi⁢n⁢i⁢t and vQ∈VQi⁢n⁢i⁢t, such that vP⪰vQ.

Thus, the relation AQ⪯AP guarantees that AQ must accept at least all inputs ΣPE∪ΣPI, and may not add any new outputs w.r.t. ΣPO. The alternating simulation ensures that for any input, the outward behavior of Q matches that of P.

3 Reward Interfaces

We now introduce reward interfaces, the central notion of the framework we propose. They build on the classical interface automata, extending them with an additional quantitative requirement, defined as a reward function that assigns numerical values to sequences of observable actions of the interface. Essentially, a reward function defines a quantitative language [8] over the alphabet of non-internal actions of the given interface automaton.

Definition 9 (Reward Interface).

A reward interface is a pair P=(AP,ℱP) where AP=⟨VP,VPi⁢n⁢i⁢t,ΣPI,ΣPO,ΣPE,ΣPH,𝒯P⟩ is an interface automaton and ℱP:(ΣPO⁢b⁢s)∞→ℝ−∞ is a partial function that assigns a value from ℝ−∞ to sequences over the alphabet ΣPO⁢b⁢s:=ΣPI∪ΣPO∪ΣPE of non-internal actions of AP.

Intuitively, ℱP expresses a quantitative specification, by associating reward values with sequences in (ΣPO⁢b⁢s)∞. The reward value of a sequence describes how well the respective observed behavior satisfies the quantitative requirement. Since ℱP is part of the interface specification, it is defined in terms of the actions ΣPO⁢b⁢s that are visible to the component’s environment. We deliberately do not impose further restrictions on the functions ℱP, in order to retain full generality of the proposed framework. In Section 6 we discuss possible instantiations, in which the reward functions have a natural finite representation.

Example 10.

Continuing from Example 1, we show a possible reward interface P=(AP,ℱP) for component P. The restrictions from AP (Figure 1(a)) ensure that output 𝗈𝟣 can only occur after input 𝗊. The requirement that 𝗈𝟣 must occur after 𝖾𝟣, and not before, is modeled via the reward function ℱP, mapping sequences over ΣPO⁢b⁢s={𝖾𝟣,𝖾𝟤,𝗉,𝗊,𝗈𝟣} to values. The reward function ℱP follows ℱ𝖲: We award value 1 if only one type of input 𝖾𝟣 or 𝖾𝟤 occurs, and require respectively 𝗈𝟣 and 𝗉, instead of 𝗈𝟤, as P has no knowledge nor control over 𝗈𝟤. Similarly, if both 𝖾𝟣 and 𝖾𝟤 occur, the order of 𝗈𝟣 and 𝗉 must reflect that to achieve value 12, otherwise the value is lowered to 14. In both cases when 𝖾𝟤 occurs, 𝗈𝟣 and 𝗉 should not be performed infinitely, otherwise the assigned value is 0.

Note that while we could for example encode the safety requirement that there is no 𝗈𝟣 before the first occurrence of 𝖾𝟣 as part of the interface automaton, it would make the automaton structure more complicated. Furthermore, as the internal order of 𝗈𝟣 and 𝖾𝟣 is less relevant for the interaction with component Q, which is not concerned with 𝗈𝟣, it is more meaningful to capture that in the reward function ℱP rather than AP.

A reward function ℱQ for a reward interface Q=(AQ,ℱQ) is defined analogously.  ⌟

For v∈ℝ−∞ and ∼∈{<,≤,≥,>}, we define ℱP∼v:={σ∈(ΣPO⁢b⁢s)∞∣ℱP⁢(σ)∼v} to be the set of words which ℱP maps to some value ∼v. When we write ℱP⁢(σ)∼v, we implicitly mean that ℱP⁢(σ) is defined. We define 𝑉𝑎𝑙𝑠⁢(ℱP):={v∈ℝ−∞∣∃σ∈(ΣPO⁢b⁢s)∞.ℱ⁢(σ)=v}.

Let us fix an interface automaton A=⟨S,Si⁢n⁢i⁢t,ΣI,ΣO,ΣE,ΣH,𝒯⟩ for the rest of this section. To evaluate implementations of an interface, we define the set of traces of A as

𝖳𝗋𝖺𝖼𝖾𝗌⁢(A):={σ∈ΣAω∣∃execution of ⁢A⁢ on ⁢σ}∪{σ∈ΣA∗∣∃exec. of ⁢A⁢ on ⁢σ⁢ ending in ⁢s:𝖤𝗇𝖺𝖻𝗅𝖾𝖽⁢(s,ΣO∪ΣH)=∅}.

That is, 𝖳𝗋𝖺𝖼𝖾𝗌⁢(A) is the set that consists of the infinite words over ΣA for which there exists an infinite execution, as well as the finite words over ΣA where an execution ends in a state with no output or internal action possible. That is, we consider maximal traces, taking into account that the environment inputs are not forced to occur.

For a given input sequence σE,I∈(ΣE∪ΣI)∞, we define 𝖳𝗋𝖺𝖼𝖾𝗌⁢(A,σE,I):={σ∈𝖳𝗋𝖺𝖼𝖾𝗌⁢(A)∣σ|(ΣE∪ΣI)=σE,I} to be the subset of 𝖳𝗋𝖺𝖼𝖾𝗌⁢(A) containing the words consistent with σE,I. These words represent all possible behaviors of A when the environment provides the inputs specified by σE,I. If Γ⊆ΣA is an alphabet such that Γ⊇ΣI∪ΣE, we define 𝖳𝗋𝖺𝖼𝖾𝗌Γ⁢(A,σE,I):={γ∈Γ∞∣∃σ∈𝖳𝗋𝖺𝖼𝖾𝗌⁢(A,σE,I)∧σ|Γ=γ} to be the projection of 𝖳𝗋𝖺𝖼𝖾𝗌⁢(A,σE,I) on Γ.

Reward functions impose no assumptions on the environment of a component. However, the value that a component can possibly achieve may depend on the behaviour of the environment. Therefore, we require that components implementing a reward interface satisfy the quantitative specification to the best extent possible with respect to the input provided by the component’s environment. This intuition is formalized by the good-enough criterion for interface automata (also used to model implementations).

First, we adapt to our setting the notion of hopeful sequences [2], which is used to characterize the input sequences for which a given reward value is possible. Note that in our setting, we consider asynchronous executions, such that there can be several consecutive inputs with no output in-between, or such that from some point on we only have outputs. This is in contrast to hopeful inputs in [2], which are defined for synchronous executions. We also allow arbitrary hidden actions, which may interleave with the non-internal actions.

Definition 11 (Hopeful Sequences).

Given alphabets Σ and Γ such that Γ⊆Σ, a function ℱ:Σ∞→ℝ−∞ and v∈ℝ−∞, we say that a sequence γ∈Γ∞ is (ℱ,v)-hopeful if and only if there exists σ∈Σ∞ such that γ=σ|Γ, ℱ⁢(σ) is defined, and ℱ⁢(σ)≥v. We denote the set of (ℱ,v)-hopeful Γ-sequences by 𝐻𝑜𝑝𝑒𝑓𝑢𝑙⁢(ℱ,v,Γ):={γ∈Γ∞∣∃σ∈Σ∞.γ=σ|Γ∧ℱ⁢(σ)≥v}.

We use Γ here to denote a subset of Σ, which will typically be instantiated to be a subset of the inputs ΣI∪ΣE, as we will see in the following definition. This notion describes the potential quality of the environment, characterizing the inputs to an interface as hopeful with respect only to specific values of ℱ. The hopefulness of an input sequence does not depend on the interface automaton itself, but only on the reward function ℱ. An interface automaton is good-enough with respect to a reward function ℱ, if, intuitively, the traces it generates on any (ℱ,v)-hopeful input sequence achieve reward at least v.

Definition 12 (Good-Enough Interface Automaton).

Consider an interface automaton A and a reward function ℱ:Δ∞→ℝ−∞. We say that A is good-enough with respect to ℱ if and only if for every value v∈𝑉𝑎𝑙𝑠⁢(ℱ), every input sequence σE,I∈𝐻𝑜𝑝𝑒𝑓𝑢𝑙⁢(ℱ,v,(ΣAE∪ΣAI)∩Δ), and every σ∈𝖳𝗋𝖺𝖼𝖾𝗌(Δ∩ΣA)⁢(A,σE,I) it holds that ℱ⁢(σ) is defined and ℱ⁢(σ)≥v.

This definition is in the spirit of [2], as a good-enough interface automaton must perform to the best extent possible according to ℱ, but only for the input it receives. In Definition 12 we used a general alphabet Δ. This is useful for the definition of compatibility of reward interfaces with respect to a given reward function.

Now we define the notion of (best-effort) implementation of a reward interface, which must be good-enough with respect the interface’s reward function.

Definition 13 (Best-Effort Implementation).

An interface automaton S is an implementation of a reward interface P=(AP,ℱP) if and only if it satisfies the following conditions.

  1. 1.

    S refines the interface automaton AP.

  2. 2.

    S is good-enough with respect to the function ℱP.

We denote with 𝖨𝗆𝗉⁢(P) the set of all implementations of P.

An implementation of a reward interface P is an instance of a classical interface automaton, as it does not have a reward function. In the original theory, there is no distinction between an interface and its implementation, as the interface is defined by the automaton structure alone. When considering an interface in isolation, the external inputs ΣE and inputs ΣI are treated in the same way. However, we differentiate between the two when considering the interface in the context of rest of the system, which generates the inputs ΣI.

Example 14.

Let us examine how a best-effort implementation for P could act. With respect to the reward function ℱP from Example 10, a possible implementation SP for P waits for 𝖾𝟣 or 𝖾𝟤, and then expects input 𝗊 to follow with 𝗈𝟣, or produces output 𝗉, respectively. We give a portion of the respective implementation in Figure 2(a), for the behaviors where 𝖾𝟣 occurs first. The missing part has analogous structure for the case when 𝖾𝟤 is received first.

As the implementation must not perform 𝗈𝟣 unless 𝖾𝟣 was received, it waits until 𝖾𝟣 happens. Should 𝗊 never appear, SP has no obligation to perform 𝗈𝟣. This is because, even though ℱP does not require 𝗊, Definition 12 considers the traces of SP, where 𝗊 must be read before 𝗈𝟣 can be produced. While P is unable to control or observe 𝗈𝟤, it exercises control by withholding 𝗉 until 𝖾𝟤, which is represented in ℱP, and therefore in implementation SP. If instead, the implementation could immediately produce 𝗉, the value for ℱP would be lower since it could be that no 𝖾𝟤 occurred.  ⌟

(a) (Part of) implementation SP of P.
(b) Composition AP∥AQ.
Figure 2: Interface automata for an implementation of P and composition of AP and AQ.

4 Compatibility and Composition of Reward Interfaces

In this section, we lift the notions of interface compatibility and composition to reward interfaces. Following the classical interface theory, compatibility of reward interfaces requires the existence of a legal environment for the underlying interface automata. For the quantitative part of our reward interfaces, we define compatibility with respect to a “joint” reward function ℱ, which, intuitively, is a quantitative specification with respect to which the composition of the implementations of the two interfaces must be good enough. In top-down component-based design, we need to ensure that the local reward functions for interfaces guarantee that the composition of their implementations is good-enough with respect to a given high-level reward function ℱ. This is precisely the ℱ-compatibility criterion we define.

For this section, let P=(AP,ℱP) and Q=(AQ,ℱQ) be composable reward interfaces with AP=⟨VP,VPi⁢n⁢i⁢t,ΣPI,ΣPO,ΣPE,ΣPH,𝒯P⟩ and AQ=⟨VQ,VQi⁢n⁢i⁢t,ΣQI,ΣQO,ΣQE,ΣQH,𝒯Q⟩, and AP⊗AQ=⟨VP⊗Q,VP⊗Qi⁢n⁢i⁢t,ΣP⊗QI,ΣP⊗QO,ΣP⊗QE,ΣP⊗QH,𝒯P⊗Q⟩ their product [Definition 4].

We now define ℱ-compatibility, for a given reward function ℱ:(ΣP⊗QO⁢b⁢s)∞→ℝ−∞ with alphabet consisting of the non-internal actions of the product automaton AP⊗AQ.

Definition 15 (ℱ-Compatibility).

The reward interfaces P=(AP,ℱP) and Q=(AQ,ℱQ) are ℱ-compatible for a given function ℱ:(ΣP⊗QO⁢b⁢s)∞→ℝ−∞ if and only if AP and AQ are compatible and for all implementations SP∈𝖨𝗆𝗉⁢(P) and SQ∈𝖨𝗆𝗉⁢(Q) of P and Q respectively, if SP and SQ are composable, then SP∥SQ is good-enough with respect to ℱ.

Example 16.

We now illustrate that the reward interfaces P and Q are ℱ𝖲-compatible for the reward function ℱ𝖲 from Example 1. In particular, the composition of P and Q refines the high-level specification of 𝖲 expressed by ℱ𝖲. Clearly, P and Q are composable, and since 𝖨𝗅𝗅𝖾𝗀𝖺𝗅⁢(AP,AQ)=∅, we can construct their composition AP∥AQ (shown in Figure 2(b)).

To see that P and Q are ℱ𝖲-compatible, consider any pair of implementations SP and SQ. Now we explain why the composition SP∥SQ must be good-enough with respect to ℱ𝖲. We examine (ℱ𝖲,v)-hopeful input sequences, and consider the expected behaviors of SP and SQ. ℱP requires SP to produce 𝗈𝟣 once 𝖾𝟣 was received, and not before. The same holds with respect to ℱQ, and 𝗈𝟤 and 𝖾𝟤. Since ℱP and ℱQ further constrain 𝗉 and 𝗊, respectively, this ensures that both SP and SQ will each have the opportunity to output 𝗈𝟣 or 𝗈𝟤 respectively, once required. Thus, any pair of best-effort implementations of P and Q together will operate as a best-effort implementation of the high-level reward function ℱ𝖲.

In top-down design, we may further refine our model, by splitting Q into two components Q1 and Q2. Suppose for example that Q1 handles 𝗉, and can output 𝗈𝟥 and some 𝗊1. Q2 outputs 𝗈𝟤 and 𝗊, and synchronizes with Q1 via 𝗊1. The interface automata AQ1 and AQ2 are in Figure 3. The reward function ℱQ1 requires that 𝗊1 only occurs once 𝖾𝟤 did. Similarly, ℱQ2 requires 𝗊 after 𝖾𝟣. Through action 𝗊1, Q1 can prevent Q2 from incorrectly producing 𝗈𝟤.

In the product AQ1⊗AQ2, the state (v1,w2) is illegal, because AQ1 can output 𝗊1 from v1, but w2 in AQ2 can not accept it. In the composition AQ1∥AQ2, state (v1,w2) is therefore removed. It is easy to see that the composition of any pair of implementations of Q1 and Q2 is good enough with respect to ℱQ. Thus, Q1 and Q2 are ℱQ-compatible.  ⌟

(a) Interface automaton AQ1.
(b) Interface automaton AQ2.
Figure 3: Splitting of Q into two components Q1 and Q2 as described in Example 16.

The ℱ-compatibility of AP and AQ guarantees that (AP∥AQ,ℱ) is a reward interface, as it requires that the interface automata AP and AQ are compatible, and ℱ has the right domain. Furthermore, the second condition of ℱ-compatibility ensures that P and Q can be implemented independently, and composing the resulting implementations yields a good-enough implementation of (AP∥AQ,ℱ). By checking ℱ-compatibility of two reward interfaces for a given reward function ℱ, we can establish whether their individual reward functions are aligned to guarantee the good-enough satisfaction of the specification ℱ.

In bottom-up design, on the other hand, we want to construct the composition of two interfaces by combining their reward functions, in order to express the guarantees of two interfaces when put together. For this, we need to provide a definition of composition of reward functions. The definition is parametrized by a function 𝑐𝑜𝑚𝑏:ℝ−∞×ℝ−∞→ℝ−∞, which specifies how we combine the numeric values assigned by the two functions.

The observable behaviours of the composition P∥Q are over the alphabet ΣP⊗QO⁢b⁢s=(ΣPO⁢b⁢s∪ΣQO⁢b⁢s)∖𝖲𝗁𝖺𝗋𝖾𝖽⁢(P,Q) of non-internal actions of P∥Q. Thus, the domain of the composed reward function must be the set of sequences over ΣP⊗QO⁢b⁢s. Our goal is to define the composition of ℱP and ℱQ in a way that captures the combined value achieved by any pair of implementations of the two interfaces. Since the implementations of each of the interfaces are constrained by the respective reward function, we cannot assume that any pair of implementations will be cooperating. Therefore, the value assigned to a sequence σ∈(ΣP⊗QO⁢b⁢s)∞ corresponds to the worst case over all the traces produced by some pair of composable implementations that are compatible with the sequence σ|ΣP⊗QI,E of inputs in σ.

Definition 17 (Reward Function Composition).

Let 𝑐𝑜𝑚𝑏:ℝ−∞×ℝ−∞→ℝ−∞. We define the composition ℱP▽𝑐𝑜𝑚𝑏ℱQ:(ΣP⊗QO⁢b⁢s)∞→ℝ−∞ of the functions ℱP and ℱQ, such that for σ∈(ΣP⊗QO⁢b⁢s)∞ where there exist composable SP′∈𝖨𝗆𝗉⁢(P) and SQ′∈𝖨𝗆𝗉⁢(Q) and σ′∈𝖳𝗋𝖺𝖼𝖾𝗌⁢(SP′∥SQ′) such that σ′|ΣP⊗QO⁢b⁢s=σ, we let

ℱP▽𝑐𝑜𝑚𝑏ℱQ(σ):=inf{𝑐𝑜𝑚𝑏⁢(ℱP⁢(σ′′|ΣPO⁢b⁢s),ℱQ⁢(σ′′|ΣQO⁢b⁢s))∣SP∈𝖨𝗆𝗉⁢(P)⁢ and SQ∈𝖨𝗆𝗉(Q) composable,σ′′∈𝖳𝗋𝖺𝖼𝖾𝗌(SP∥SQ,σ|ΣP⊗QI,E)},

and ℱP▽𝑐𝑜𝑚𝑏ℱQ⁢(σ) is undefined otherwise.

By taking the worst case in the definition of ℱP▽𝑐𝑜𝑚𝑏ℱQ, we guarantee that as long as AP and AQ are compatible, the reward interfaces P and Q are ℱP▽𝑐𝑜𝑚𝑏ℱQ-compatible, as shown in the next proposition. Composing P and Q results in the reward interface (AP∥AQ,ℱP▽𝑐𝑜𝑚𝑏ℱQ). P and Q can be implemented independently, and the composition of their implementations will be good enough with respect to ℱP▽𝑐𝑜𝑚𝑏ℱQ.

Proposition 18 (ℱP▽𝑐𝑜𝑚𝑏ℱQ-Compatibility).

Let 𝑐𝑜𝑚𝑏:ℝ−∞×ℝ−∞→ℝ−∞. For all reward interfaces P=(AP,ℱP) and Q=(AQ,ℱQ) with AP and AQ compatible, it holds that P and Q are ℱP▽𝑐𝑜𝑚𝑏ℱQ-compatible.

We discard any observable traces not resulting from implementations of P and Q, restricting the observable behaviors of interface automata good enough w.r.t. ℱP▽𝑐𝑜𝑚𝑏ℱQ to those resulting from some SP∥SQ where SP∈𝖨𝗆𝗉⁢(P) and SQ∈𝖨𝗆𝗉⁢(Q). This composition is associative if the function 𝑐𝑜𝑚𝑏 used to combine the values is associative, and satisfies some monotonicity and continuity conditions (Proposition 29).

Proposition 19 (Quality of the Reward Function Composition).

Consider reward interfaces P=(AP,ℱP) and Q=(AQ,ℱQ) with AP and AQ compatible, and a reward function ℱ such that P and Q are ℱ-compatible. Then, 𝖨𝗆𝗉⁢(AP∥AQ,ℱP▽𝑐𝑜𝑚𝑏ℱQ)⊆𝖨𝗆𝗉⁢(AP∥AQ,ℱ).

Example 20.

Let us consider components P and Q from Example 1 from the perspective of bottom-up design. Recall the reward function ℱP from Example 14, where we impose that for input sequences containing both 𝖾𝟣 and 𝖾𝟤, there must be outputs 𝗈𝟣 and 𝗉 in the respective order. Now, suppose instead we use a function ℱP′, which ignores the requirements on 𝗉, meaning that it only asks for 𝗈𝟣 to occur after 𝖾𝟣 and 𝗊, and nothing else. For those input sequences with both 𝖾𝟣 and 𝖾𝟤, ℱP′ will always award a value of 12 as long as 𝗈𝟣 is produced. Note that this does not disallow 𝗉, it simply does not require it.

A possible behavior of an implementation SP′ of (AP,ℱP′) is then to produce 𝗈𝟣 once receiving 𝗊, and be idle otherwise. In particular, it will never produce 𝗉. Implementations SQ of Q will, as before, produce 𝗈𝟤 only after receiving 𝖾𝟤 and 𝗉.

It is easy to see that the new function ℱP′ allows implementations of (AP,ℱP′) which prevent Q from producing 𝗈𝟤, disabling the best value w.r.t. ℱQ. Since P has no knowledge of ℱQ, we cannot assume that SP will be more cooperative than required by AP and ℱP′. As AP and AQ are compatible, choosing 𝑐𝑜𝑚𝑏 to be the sum, we have the guarantee that any SP∥SQ is good enough w.r.t. ℱP′▽𝑐𝑜𝑚𝑏ℱQ. This guarantee is however weaker than ℱ𝖲. In this case, that means that for the mentioned input sequences featuring 𝖾𝟣 and 𝖾𝟤, where previously the best value of 12+12 was possible, we will now achieve at least 12+0.

In bottom-up design, we can use (AP∥AQ,ℱP′▽𝑐𝑜𝑚𝑏ℱQ) as the reward interface for the composition of P′=(AP,ℱP′) and Q. This captures the guarantees of the composed components at a higher level of the system, without the need to devise a new reward function and checking if P and Q are compatible with respect to it.  ⌟

5 Reward Interface Refinement

Supporting different levels of abstraction for the same component is helpful in the design process, as it allows a coarse description of interactions and dependencies while also defining internal details. Refinement enables this independent implementability of an interface, permitting extended functionality as long as original obligations are maintained. For a reward interface Q to be a refinement of a reward interface P, we require as usual that Q works within the same environments as P, and that an implementation of Q is also an implementation of P. This means, in particular, that, similarly to classical interface automata, a refinement of P must accept at least all inputs of P and not produce more outputs than P. In addition, we must consider the reward function w.r.t. best-effort implementations.

The refinement relation for reward interfaces can be defined as the conjunction of refinement between the respective interface automata [Definition 8] and refinement between the respective reward functions. We define the notion of refinement for quantitative reward functions in the context of good-enough satisfaction. Intuitively, for a function ℱQ to refine a function ℱP, each input sequence for Q must be “as hopeful” w.r.t. ℱQ as it is w.r.t. ℱP, and the value assigned by ℱQ to a trace must be matched by the value assigned by ℱP to the corresponding trace in P. This captures the idea that ℱQ inherits the obligations of ℱP and assigns values in a way that is possible in ℱP. We formalize this intuition as the existence of a helper function rP⁢Q:ℝ−∞→ℝ−∞, that suitably relates the ranges 𝑉𝑎𝑙𝑠⁢(ℱP) and 𝑉𝑎𝑙𝑠⁢(ℱQ) of the functions. The idea is that rP⁢Q preserves the relative order of the values in ℱP, as it relates to both the hopefulness of input traces and values assigned to the respective full traces.

Definition 21 (Reward Function Refinement).

Suppose that for the reward interfaces P=(AP,ℱP) and Q=(AQ,ℱQ) we have ΣPI⊆ΣQI, ΣPE⊆ΣQE and ΣQO⊆ΣPO. We say that ℱQ refines ℱP, denoted ℱQ⪯ℱP, iff there exists a function rP⁢Q:ℝ−∞→ℝ−∞ such that for every value v∈𝑉𝑎𝑙𝑠⁢(ℱP), the following two conditions are satisfied.

  1. 1.

    For every σQI,E∈(ΣQI∪ΣQE)∞, if σQI,E|ΣP∈𝐻𝑜𝑝𝑒𝑓𝑢𝑙⁢(ℱP,v,ΣPI∪ΣPE),
    For every σQI,E∈(ΣQI∪ΣQE)∞, then σQI,E∈𝐻𝑜𝑝𝑒𝑓𝑢𝑙⁢(ℱQ,rP⁢Q⁢(v),ΣQI∪ΣQE).

  2. 2.

    For every σQ∈(ΣQO⁢b⁢s)∞, if ℱQ⁢(σQ)≥rP⁢Q⁢(v) then ℱP⁢(σQ|ΣP)≥v.

Definition 21 captures the nature of refinement, because while it retains priority brackets for obligations of the original function, we can also introduce new dependencies or arbitrary subdivisions within each priority. The next example illustrates the refinement relation for reward functions and demonstrates the use of the helper function for establishing the relation.

Example 22.

Going back to the reward interface for 𝖲 with ℱ𝖲 from Example 1, suppose we want to modify the guarantees, requiring 𝖲 to output 𝗈𝟣 or 𝗈𝟤 for a period of time. More concretely, we ask for 𝗈𝟣 to hold as often as possible from the point 𝖾𝟣 is first received until the first occurrence of 𝖾𝟤, as to capture the change in input. We add the same requirement on 𝗈𝟤 if 𝖾𝟤 occurs first. We modify the existing reward function ℱ𝖲 to ℱR, where we multiply the assigned value by a factor of 23 if this new condition is violated.

Clearly, a subset of traces that had value 1 for ℱ𝖲 are now assigned value 23, namely where the other output 𝗈𝟥 is interjected. The same holds for traces going from 12 to 13. The new requirement will always be violated if the order was not preserved in the first place, giving us 16 instead of 14. However, the old obligations are kept: Any (ℱ𝖲,1)-hopeful input will be paired with a trace that for ℱR achieves at least 23. The function r𝖲⁢R will then be r𝖲⁢R={(0,0),(14,16),(12,13),(1,23)}. Thus, the priorities from ℱ𝖲 are preserved in the refinement, even though we are able to strengthen requirements in the reward function ℱR.  ⌟

The refinement relation for reward interfaces combines the two refinement relations.

Definition 23 (Reward Interface Refinement).

A reward interface Q=(AQ,ℱQ) refines a reward interface P=(AP,ℱP), written as Q⪯P, if and only if AQ⪯AP and ℱQ⪯ℱP.

The rest of this section is dedicated to establishing that the refinement relation we defined has the properties necessary for compositional design. We establish that the refinement relation ⪯ between reward interfaces is a preorder, i.e. it is reflexive and transitive (Proposition 30). In particular, transitivity of refinement is important, as it allows for an iterative design process, where each refinement needs to only consider the last to maintain a refinement relation to the original specification. It is established by composing the respective helper functions.

As a consequence, an implementation of a refinement is then also an implementation of the original interface. Since the implementation must be good-enough w.r.t. the refined function, by refinement we can show it is also good-enough w.r.t. the original function.

Theorem 24 (Implementation of a Refinement).

If a reward interface Q=(AQ,ℱQ) refines a reward interface P=(AP,ℱP), then 𝖨𝗆𝗉⁢(Q)⊆𝖨𝗆𝗉⁢(P).

The other direction of Theorem 24 does not hold in general. First of all, a reward interface constrains the set of implementations through both the interface automaton and the reward function, while the refinement relation treats those two components separately, which makes it stronger than the inclusion relation between the sets of implementations. Moreover, the refinement relation on reward functions alone is stronger than the inclusion between the respective sets of good-enough automata.

The last properties we establish enable independent implementability, by guaranteeing that refinement does not impair the original context of an interface. They concern refinement in the function composition and the property of substitutability. Intuitively, substitutability states that a refinement of a reward interface P remains ℱ-compatible with any reward interfaces that are ℱ-compatible with P.

Theorem 25.

Consider P=(AP,ℱP) and Q=(AQ,ℱQ) with AP and AQ compatible, and let P′=(AP′,ℱP′) be a non-empty refinement of P, with (ΣP′I∖ΣPI)∩ΣQO=∅. Then if 𝑐𝑜𝑚𝑏 is monotonically increasing, (AP′∥AQ,ℱP′▽𝑐𝑜𝑚𝑏ℱQ)⪯(AP∥AQ,ℱP▽𝑐𝑜𝑚𝑏ℱQ). If P and Q are ℱ-compatible for a reward function ℱ, then P′ and Q are also ℱ-compatible.

With that, we established that the refinement for reward interfaces in Definition 23 indeed lifts the ideas of interface refinement to the best-effort quantitative setting and has the properties to enable component-based design of systems with quantitative specifications.

6 Checking Compatibility, Refinement, and Implementability

In this section, we study the algorithmic aspects of our theory of reward interfaces, in the context of an automata-based finite representation of the reward functions. We first introduce this representation. Then, we define the decision problems of interest, namely checking compatibility, refinement and implementability of reward interfaces, and outline algorithms for each of them for our representation. Lastly, we discuss quantitative temporal logics and weighted automata as representations of reward functions, and relate them to the representation studied in this section.

6.1 Automata-Based Finite Representation

The framework we introduced is designed to be general, including the representation of the reward function. Here, we study one possible representation, which is based on automata over finite and infinite words. We need both finite automata to model terminating components, as well as ω-automata to account for infinite behaviors of reactive systems.

We consider functions ℱ:Σ∞→ℝ such that 𝑉𝑎𝑙𝑠⁢(ℱ) is finite, and which have a finite representation as a set of pairs of automata Φ={(ℬv,𝒩v)∣v∈𝑉𝑎𝑙𝑠⁢(ℱ)}, where for each v∈𝑉𝑎𝑙𝑠⁢(ℱ), ℬv is an NBA, and 𝒩v is an NFA, and ℒ⁢(ℬv)∪ℒ⁢(𝒩v)=ℱ=v. Intuitively, for each of the finitely many possible values of ℱ, the set of finite (resp. infinite) words that ℱ maps to that value is given as a NFA (resp. NBA). We denote with ⟦Φ⟧ the function ℱ:Σ∞→ℝ represented by Φ. For a reward interface P=(AP,ℱP) where the function ℱP is given in a finite representation ΦP, we abuse notation and write P=(AP,ΦP), and 𝑉𝑎𝑙𝑠⁢(ΦP) instead of 𝑉𝑎𝑙𝑠(⟦ΦP⟧). The size of ΦP is given by |ΦP|=∑v∈𝑉𝑎𝑙𝑠⁢(ℱP)(|ℬv|+|𝒩v|).

6.2 Decision Problems and Automata-Based Algorithms

Assuming reward functions ⟦Φ⟧ given as defined above, with pairs of automata for each value, we now study the main decision problems for reward interfaces.

Theorem 26 (Checking Compatibility of Reward Interfaces).

For a given finitely represented reward function ⟦Φ⟧:(ΣP⊗QO⁢b⁢s)∞→ℝ, checking if P=(AP,ΦP) and Q=(AQ,ΦQ) are ⟦Φ⟧-compatible can be done in double exponential time.

Proof Sketch.

We reduce the second condition of Definition 15 to checking language inclusion for tree automata, by constructing an automaton capturing the set of joint implementations SP∥SQ s.t. SP∈𝖨𝗆𝗉⁢(P) and SQ∈𝖨𝗆𝗉⁢(Q). To this end, we construct a deterministic interface automaton from AP∥AQ, which incurs an exponential blowup in the worst case. We construct two universal co-Büchi word automata, one for implementations SP∥SQ, and one for good-enough sequences w.r.t. ⟦Φ⟧, that are converted to universal co-Büchi tree automata. Checking language inclusion can be done in exponential time, thus in total we can check reward interface compatibility in time double exponential in |AP|⋅|AQ|⋅|ΦP|⋅|ΦQ|. ◀

Theorem 27 (Checking Reward Interface Refinement).

Checking if (AQ,ΦQ)⪯(AP,ΦP) can be done in exponential time.

Proof Sketch.

Checking AQ⪯AP is done in polynomial time [14]. To find a candidate function rP⁢Q according to condition 1 of Definition 21, we iteratively match values of 𝑉𝑎𝑙𝑠⁢(ΦP) to those in 𝑉𝑎𝑙𝑠⁢(ΦQ). We compare sets of hopeful input sequences for the respective pairs of values in exponential time, by checking language inclusion. If a candidate rP⁢Q was constructed, we verify condition 2 of Definition 21, by checking that for every complete trace achieving value rP⁢Q⁢(v) on ⟦ΦQ⟧, the corresponding traces achieve value v for ⟦ΦP⟧. This is done by checking language emptiness. The overall procedure runs in exponential time. ◀

Theorem 28 (Implementations of a Reward Interface).

Checking if S∈𝖨𝗆𝗉⁢((AP,ΦP)) for an interface automaton S can be done in polynomial time.
Checking if 𝖨𝗆𝗉⁢(P)≠∅ for P=(AP,ΦP) can be done in time exponential in |AP|⋅|ΦP|.

Proof Sketch.

From ΦP, we construct an NBA whose language contains all counterexamples a good-enough implementation must not produce, whose size is polynomial in |ΦP|. We check for language emptiness of its product with S, which can be done in polynomial time.

For checking the existence of an implementation, we construct from the automaton accepting counterexamples a deterministic parity automaton for the positive case, incurring in the worst case an exponential blow-up in the number of states. We intersect the result with a deterministic automaton obtained from AP to restrict the language to traces with corresponding executions on AP. From the combined automaton we construct a parity game and solve it. If there exists a winning strategy, it gives us a possible implementation of P. If there is no such strategy, then there exists no implementation. Since the number of states in the game is exponential in |AP|⋅|ΦP|, the overall check can be done in exponential time. ◀

6.3 Discussion on Reward Functions and their Representation

The automata-based finite representation of reward functions allows system designers to express a quantitative language with a finite set of possible values in a convenient way, by describing the languages mapped to individual values as finite automata, providing a ranking for sets of execution traces with respect to how desirable these executions are.

This finite representation enables higher-level specification languages for quantitative requirements, such as LTL[ℱ] [1], which is a temporal logic with quantitative features, and the derived logic LTLf[ℱ] [5] over finite traces. Such logic formulas can be seen as functions mapping infinite and finite words, respectively, to values in ℝ. The range of values for LTL[ℱ] specifications is finite [1]. Following the construction in [1], we can translate, in exponential time, LTL[ℱ] and LTLf[ℱ] formulas into the above automata representation.

A reward function can also capture a quantitative language L𝒲:Σ∞→ℝ, expressed with a weighted automaton 𝒲=⟨Q,qI,Σ,δ,γ⟩, where γ:δ→ℚ is a weight function, and a value function 𝖵:ℚ∞→ℝ [8]. These automata can serve as a concise specification in the design process. To use the finite representation above and enable the respective algorithms, we restrict the instances of 𝖵 we consider to those where 𝑉𝑎𝑙𝑠 finite. For the value functions 𝐿𝑎𝑠𝑡 or 𝑀𝑎𝑥 on finite sequences, and 𝑆𝑢𝑝, 𝐿𝑖𝑚𝑆𝑢𝑝 or 𝐿𝑖𝑚𝐼𝑛𝑓 on infinite sequences, we can construct in at most polynomial time [8], from a quantitative automaton 𝒲, individual (Boolean) automata 𝒲∼v for threshold v and ∼∈{>,≥,=,≤,<}, such that L𝒲∼v={σ∈Σ∞∣L𝒲⁢(σ)∼v}. We can thus translate a pair of quantitative automata with those value functions into a set of automata {(ℬv,𝒩v)∣v∈𝑉𝑎𝑙𝑠}. While our theory supports more expressive classes of quantitative languages, such as 𝐿𝑖𝑚𝐴𝑣𝑔 or 𝐷𝑖𝑠𝑐, there the language inclusion problem becomes undecidable for nondeterministic automata [8] and deterministic automata lack many essential closure properties [7]. In the future, we plan to investigate decidable subclasses, in order to extend algorithmic support to more expressive representations of reward functions.

7 Related Work

De Alfaro and Henzinger’s interface automata [14] have been extended in various ways, including the timed domain [16, 12], and focusing on communication and synchronization using game semantics [13]. The work on contract-based design by Benveniste et al. [3] provides a comprehensive overview of different interface theories, with a unified set of properties.

Modal interface theories [20, 23, 21] refine the model by introducing modalities, which enable the expression of liveness properties. Extensions by Tripakis et al. [25], or Mouelhi et al. [22] extend the expressive power of interface automata by introducing additional contracts over the input and output variables at each state and globally. A similar idea is presented concerning shared memory [24], where the pre- and post-conditions on transitions are interpreted as modification of shared data on synchronization. These approaches lift interface automata for more expressivity and finer control. We similarly address these issues with requirements on interfaces expressed as a reward function, which by its multi-valued range is able to capture complex specifications in a concise way, and additionally, we define compatibility with respect to arbitrary functions to express higher level goals.

Quantitative aspects of interface automata have been explored in the form of resource interfaces [6], which extend stateful interfaces to include resource labels. Each state is associated with an increase or decrease in the value of an execution if entered. This allows for naturally specifying minimum resource usage, or checking compatibility within a threshold of consumed energy. For a single interface, reward interfaces are able to express the same using the reward function, but our compatibility notion is less strict outside the automaton structure. We could however use a resource interface in place of the function, similarly to a weighted automaton, since it will associate a value for each execution. Still, the semantics will be different since we interpret obligations given by the function in a good-enough context.

Our approaches to algorithmically checking consistency and compatibility of interfaces reduce to synthesis questions, where we need to find a good-enough strategy for an infinite two-player game. Good-enough synthesis [2] is closely related to dominant [11] and admissible [4] strategies, which are strategies that perform as good as the best alternative, such that they are not dominated by another strategy. There has been further work on applying these ideas to the compositional synthesis setting [11, 19, 17].

8 Conclusion

We introduced a novel interface framework for best-effort quantitative requirements, called reward interfaces, building on interface automata. Our formalism can enforce high-quality implementations for unconstrained external environments, while providing notions of compatibility and refinement central to interface theories. It allows for expressing a wide range of both qualitative and quantitative properties in a concise manner, as to not increase the effort required during the component-based design process. The algorithmic solutions we presented are of considerably higher complexity than those for classic interface automata, due to the high degree of flexibility afforded by the quantitative function.

References

  • [1] Shaull Almagor, Udi Boker, and Orna Kupferman. Formally reasoning about quality. J. ACM, 63(3):24:1–24:56, 2016. doi:10.1145/2875421.
  • [2] Shaull Almagor and Orna Kupferman. Good-enough synthesis. In Shuvendu K. Lahiri and Chao Wang, editors, Computer Aided Verification - 32nd International Conference, CAV 2020, Los Angeles, CA, USA, July 21-24, 2020, Proceedings, Part II, volume 12225 of Lecture Notes in Computer Science, pages 541–563. Springer, 2020. doi:10.1007/978-3-030-53291-8_28.
  • [3] Albert Benveniste, Benoît Caillaud, Dejan Nickovic, Roberto Passerone, Jean-Baptiste Raclet, Philipp Reinkemeier, Alberto L. Sangiovanni-Vincentelli, Werner Damm, Thomas A. Henzinger, and Kim G. Larsen. Contracts for system design. Found. Trends Electron. Des. Autom., 12(2-3):124–400, 2018. doi:10.1561/1000000053.
  • [4] Romain Brenguier, Jean-François Raskin, and Ocan Sankur. Assume-admissible synthesis. Acta Informatica, 54(1):41–83, 2017. doi:10.1007/s00236-016-0273-2.
  • [5] Alberto Camacho, Meghyn Bienvenu, and Sheila A. McIlraith. Finite LTL synthesis with environment assumptions and quality measures. CoRR, abs/1808.10831, 2018. arXiv:1808.10831.
  • [6] Arindam Chakrabarti, Luca de Alfaro, Thomas A. Henzinger, and Mariëlle Stoelinga. Resource interfaces. In Rajeev Alur and Insup Lee, editors, Embedded Software, pages 117–133, Berlin, Heidelberg, 2003. Springer Berlin Heidelberg. doi:10.1007/978-3-540-45212-6_9.
  • [7] Krishnendu Chatterjee, Laurent Doyen, and Thomas A. Henzinger. Expressiveness and closure properties for quantitative languages. In Proceedings of the 2009 24th Annual IEEE Symposium on Logic In Computer Science, LICS ’09, pages 199–208, USA, 2009. IEEE Computer Society. doi:10.1109/LICS.2009.16.
  • [8] Krishnendu Chatterjee, Laurent Doyen, and Thomas A. Henzinger. Quantitative languages. ACM Trans. Comput. Log., 11(4):23:1–23:38, 2010. doi:10.1145/1805950.1805953.
  • [9] Taolue Chen, Chris Chilton, Bengt Jonsson, and Marta Kwiatkowska. A compositional specification theory for component behaviours. In Helmut Seidl, editor, Programming Languages and Systems, pages 148–168, Berlin, Heidelberg, 2012. Springer Berlin Heidelberg. doi:10.1007/978-3-642-28869-2_8.
  • [10] Chris Chilton, Bengt Jonsson, and Marta Kwiatkowska. An algebraic theory of interface automata. Theoretical Computer Science, 549:146–174, 2014. doi:10.1016/j.tcs.2014.07.018.
  • [11] Werner Damm and Bernd Finkbeiner. Automatic compositional synthesis of distributed systems. In Cliff B. Jones, Pekka Pihlajasaari, and Jun Sun, editors, FM 2014: Formal Methods - 19th International Symposium, Singapore, May 12-16, 2014. Proceedings, volume 8442 of Lecture Notes in Computer Science, pages 179–193. Springer, 2014. doi:10.1007/978-3-319-06410-9_13.
  • [12] Alexandre David, Kim G. Larsen, Axel Legay, Ulrik Nyman, and Andrzej Wasowski. Timed i/o automata: a complete specification theory for real-time systems. In Proceedings of the 13th ACM International Conference on Hybrid Systems: Computation and Control, HSCC ’10, pages 91–100, New York, NY, USA, 2010. Association for Computing Machinery. doi:10.1145/1755952.1755967.
  • [13] Luca de Alfaro, Leandro Dias da Silva, Marco Faella, Axel Legay, Pritam Roy, and Maria Sorea. Sociable interfaces. In Bernhard Gramlich, editor, Frontiers of Combining Systems, pages 81–105, Berlin, Heidelberg, 2005. Springer Berlin Heidelberg. doi:10.1007/11559306_5.
  • [14] Luca de Alfaro and Thomas A. Henzinger. Interface automata. SIGSOFT Softw. Eng. Notes, 26(5):109–120, 2001. doi:10.1145/503271.503226.
  • [15] Luca de Alfaro and Thomas A. Henzinger. Interface-based design. In Manfred Broy, Johannes Grünbauer, David Harel, and Tony Hoare, editors, Engineering Theories of Software Intensive Systems, pages 83–104, Dordrecht, 2005. Springer Netherlands.
  • [16] Luca de Alfaro, Thomas A. Henzinger, and Mariëlle Stoelinga. Timed interfaces. In Alberto Sangiovanni-Vincentelli and Joseph Sifakis, editors, Embedded Software, pages 108–122, Berlin, Heidelberg, 2002. Springer Berlin Heidelberg. doi:10.1007/3-540-45828-X_9.
  • [17] Rafael Dewes and Rayna Dimitrova. Compositional high-quality synthesis. In Étienne André and Jun Sun, editors, Automated Technology for Verification and Analysis - 21st International Symposium, ATVA 2023, Singapore, October 24-27, 2023, Proceedings, Part I, volume 14215 of Lecture Notes in Computer Science, pages 334–354. Springer, 2023. doi:10.1007/978-3-031-45329-8_16.
  • [18] Laurent Doyen, Thomas A. Henzinger, Barbara Jobstmann, and Tatjana Petrov. Interface theories with component reuse. In Proceedings of the 8th ACM International Conference on Embedded Software, EMSOFT ’08, pages 79–88, New York, NY, USA, 2008. Association for Computing Machinery. doi:10.1145/1450058.1450070.
  • [19] Bernd Finkbeiner and Noemi Passing. Dependency-based compositional synthesis. In Dang Van Hung and Oleg Sokolsky, editors, Automated Technology for Verification and Analysis - 18th International Symposium, ATVA 2020, Hanoi, Vietnam, October 19-23, 2020, Proceedings, volume 12302 of Lecture Notes in Computer Science, pages 447–463. Springer, 2020. doi:10.1007/978-3-030-59152-6_25.
  • [20] Kim G. Larsen, Ulrik Nyman, and Andrzej Wąsowski. Modal i/o automata for interface and product line theories. In Rocco De Nicola, editor, Programming Languages and Systems, pages 64–79, Berlin, Heidelberg, 2007. Springer Berlin Heidelberg.
  • [21] Gerald Lüttgen and Walter Vogler. Modal interface automata. In Jos C. M. Baeten, Thomas Ball, and Frank S. de Boer, editors, Theoretical Computer Science - 7th IFIP TC 1/WG 2.2 International Conference, TCS 2012, Amsterdam, The Netherlands, September 26-28, 2012. Proceedings, volume 7604 of Lecture Notes in Computer Science, pages 265–279. Springer, 2012. doi:10.1007/978-3-642-33475-7_19.
  • [22] Sebti Mouelhi, Samir Chouali, and Hassan Mountassir. Refinement of interface automata strengthened by action semantics. In FESCA@ETAPS, volume 253 of Electronic Notes in Theoretical Computer Science, pages 111–126. Elsevier, 2009. doi:10.1016/J.ENTCS.2009.09.031.
  • [23] Jean-Baptiste Raclet, Éric Badouel, Albert Benveniste, Benoît Caillaud, Axel Legay, and Roberto Passerone. A modal interface theory for component-based design. Fundam. Informaticae, 108(1-2):119–149, 2011. doi:10.3233/FI-2011-416.
  • [24] Ayleen Schinko, Walter Vogler, Johannes Gareis, N. Tri Nguyen, and Gerald Lüttgen. Interface automata for shared memory. Acta Informatica, 59(5):521–556, 2022. doi:10.1007/S00236-021-00408-8.
  • [25] Stavros Tripakis, Ben Lickly, Thomas A. Henzinger, and Edward A. Lee. A theory of synchronous relational interfaces. ACM Trans. Program. Lang. Syst., 33(4), July 2011. doi:10.1145/1985342.1985345.

Appendix A Appendix: Compatibility of Reward Interfaces

Proposition 18 (ℱP▽𝑐𝑜𝑚𝑏ℱQ-Compatibility). [Restated, see original statement.]

Let 𝑐𝑜𝑚𝑏:ℝ−∞×ℝ−∞→ℝ−∞. For all reward interfaces P=(AP,ℱP) and Q=(AQ,ℱQ) with AP and AQ compatible, it holds that P and Q are ℱP▽𝑐𝑜𝑚𝑏ℱQ-compatible.

Proof.

Let P=(AP,ℱP) and Q=(AQ,ℱQ) be reward interfaces where AP and AQ are compatible. To prove that P and Q are ℱP▽𝑐𝑜𝑚𝑏ℱQ-compatible, we need to show that for any pair of implementations SP∈𝖨𝗆𝗉⁢(P) and SQ∈𝖨𝗆𝗉⁢(Q) that are composable, it holds that SP∥SQ is good enough w.r.t. ℱP▽𝑐𝑜𝑚𝑏ℱQ. For the sake of contradiction, assume that there exist composable SP∈𝖨𝗆𝗉⁢(P) and SQ∈𝖨𝗆𝗉⁢(Q) such that SP∥SQ is not good-enough w.r.t. ℱP▽𝑐𝑜𝑚𝑏ℱQ. That means that for some v∈𝑉𝑎𝑙𝑠⁢(ℱP▽𝑐𝑜𝑚𝑏ℱQ) there exists an input sequence σE,I∈(ΣP⊗QE,I)∞ that witnesses this violation, that is,

  • ■

    σE,I∈𝐻𝑜𝑝𝑒𝑓𝑢𝑙⁢(ℱP▽𝑐𝑜𝑚𝑏ℱQ,v,ΣP⊗QE,I), and

  • ■

    for some σ∈𝖳𝗋𝖺𝖼𝖾𝗌⁢(SP∥SQ,σE,I), ℱP▽𝑐𝑜𝑚𝑏ℱQ⁢(σ) is undef. or ℱP▽𝑐𝑜𝑚𝑏ℱQ⁢(σ)<v.

By the first item above, together with the definition of hopeful sequences (Definition 11) and the definition of ℱP▽𝑐𝑜𝑚𝑏ℱQ (Definition 17), there exist composable SP′∈𝖨𝗆𝗉⁢(P) and SQ′∈𝖨𝗆𝗉⁢(Q) and σ′∈𝖳𝗋𝖺𝖼𝖾𝗌⁢(SP′∥SQ′) such that σ′|ΣP⊗QE,I=σE,I and

inf{𝑐𝑜𝑚𝑏(ℱP(σ′′|ΣPO⁢b⁢s),ℱQ(σ′′|ΣQO⁢b⁢s))∣SP′′∈𝖨𝗆𝗉⁢(P)⁢ and ⁢SQ′′∈𝖨𝗆𝗉⁢(Q)⁢ composable,σ′′∈𝖳𝗋𝖺𝖼𝖾𝗌(SP′′∥SQ′′,σE,I)}≥v.

Since σ∈𝖳𝗋𝖺𝖼𝖾𝗌⁢(SP∥SQ,σE,I), by the definition of ℱP▽𝑐𝑜𝑚𝑏ℱQ, we have that ℱP▽𝑐𝑜𝑚𝑏ℱQ⁢(σ) is defined. Thus, by the second item we have that ℱP▽𝑐𝑜𝑚𝑏ℱQ⁢(σ)<v. This, together with the definition of ℱP▽𝑐𝑜𝑚𝑏ℱQ implies that

inf{𝑐𝑜𝑚𝑏(ℱP(σ′′|ΣPO⁢b⁢s),ℱQ(σ′′|ΣQO⁢b⁢s))∣SP′′∈𝖨𝗆𝗉⁢(P)⁢ and ⁢SQ′′∈𝖨𝗆𝗉⁢(Q)⁢ composable,σ′′∈𝖳𝗋𝖺𝖼𝖾𝗌(SP′′∥SQ′′,σE,I)}<v.

This is a contradiction, which concludes the proof. ◀

Proposition 19 (Quality of the Reward Function Composition). [Restated, see original statement.]

Consider reward interfaces P=(AP,ℱP) and Q=(AQ,ℱQ) with AP and AQ compatible, and a reward function ℱ such that P and Q are ℱ-compatible. Then, 𝖨𝗆𝗉⁢(AP∥AQ,ℱP▽𝑐𝑜𝑚𝑏ℱQ)⊆𝖨𝗆𝗉⁢(AP∥AQ,ℱ).

Proof.

Let P=(AP,ℱP) and Q=(AQ,ℱQ) be reward interfaces with automata AP and AQ that are compatible. Let ℱ be a reward function such that P and Q are ℱ-compatible.

We have to show that for every S∈𝖨𝗆𝗉⁢(AP∥AQ,ℱP▽𝑐𝑜𝑚𝑏ℱQ) it holds that S∈𝖨𝗆𝗉⁢(AP∥AQ,ℱ). For the sake of contradiction, suppose that there exists S∈𝖨𝗆𝗉⁢(AP∥AQ,ℱP▽𝑐𝑜𝑚𝑏ℱQ) such that S∉𝖨𝗆𝗉⁢(AP∥AQ,ℱ). Since S⪯AP∥AQ, this means that S is not good-enough with respect to ℱ. Let σ∈𝖳𝗋𝖺𝖼𝖾𝗌⁢(S) be the trace witnessing this violation. Thus, σ|ΣP⊗QE,I is (ℱ,v)-hopeful for some v∈ℝ−∞ and ℱ⁢(σ|ΣP⊗QO⁢b⁢s) is either undefined or strictly smaller than v. We will now show that this assumption leads to contradiction.

Let ℐ={SP‖SQ∣SP∈𝖨𝗆𝗉⁢(P),SQ∈𝖨𝗆𝗉⁢(Q),SP⁢ and ⁢SQ⁢ composable} be the set of composed implementations of P and Q. Since implementations do not restrict the allowed inputs, we have that there exists S′∈ℐ and σ′∈𝖳𝗋𝖺𝖼𝖾𝗌⁢(S′) such that σ′|ΣP⊗QE,I=σ|ΣP⊗QE,I. This implies that ℱP▽𝑐𝑜𝑚𝑏ℱQ⁢(σ|ΣP⊗QE,I) is defined. Thus, since S is good-enough with respect to ℱP▽𝑐𝑜𝑚𝑏ℱQ, we have that ℱP▽𝑐𝑜𝑚𝑏ℱQ⁢(σ|ΣP⊗QO⁢b⁢s) must be defined as well. By the definition of ℱP▽𝑐𝑜𝑚𝑏ℱQ, this implies that there exist S′′∈ℐ and σ′′∈𝖳𝗋𝖺𝖼𝖾𝗌⁢(S′′) such that σ′′|ΣP⊗QO⁢b⁢s=σ|ΣP⊗QO⁢b⁢s. Now, since σ′′|ΣP⊗QE,I=σ|ΣP⊗QE,I, and by Proposition 18 S′′ is good-enough with respect to ℱ, it must be the case that ℱ⁢(σ′′|ΣP⊗QO⁢b⁢s)≥v. Since σ′′|ΣP⊗QO⁢b⁢s=σ|ΣP⊗QO⁢b⁢s, it also holds that ℱ⁢(σ|ΣP⊗QO⁢b⁢s)≥v, which is the desired contradiction. ◀

Proposition 29 (Composition Associativity).

Let P=(AP,ℱP),Q=(AQ,ℱQ) and R=(AR,ℱR) be reward interfaces with pairwise compatible interface automata. If the function 𝑐𝑜𝑚𝑏 is symmetric, then ℱP▽𝑐𝑜𝑚𝑏ℱQ=ℱQ▽𝑐𝑜𝑚𝑏ℱP. If 𝑐𝑜𝑚𝑏 is associative, monotonically increasing and continuous, then the reward function composition using 𝑐𝑜𝑚𝑏 is associative, that is, (ℱP▽𝑐𝑜𝑚𝑏ℱQ)▽𝑐𝑜𝑚𝑏ℱR=ℱP▽𝑐𝑜𝑚𝑏(ℱQ▽𝑐𝑜𝑚𝑏ℱR).

Proof.

Let P=(AP,ℱP),Q=(AQ,ℱQ) and R=(AR,ℱR) be reward interfaces with pairwise compatible interface automata. Clearly, AP∥AQ=AQ∥AP. The associativity of composition for compatible interface automata is established in [14], thus (AP∥AQ)∥AR=AP∥(AQ∥AR). Let AP⁢Q:=AP∥AQ and AQ⁢R:=AQ∥AR.

By the definition of composition, it is clearly the case that for every σ∈ΣP⊗QO⁢b⁢s we have that ℱP▽𝑐𝑜𝑚𝑏ℱQ⁢(σ) is defined if and only if ℱQ▽𝑐𝑜𝑚𝑏ℱP⁢(σ) is defined. When 𝑐𝑜𝑚𝑏 is symmetric, that, for all a,b∈ℝ−∞ we have that 𝑐𝑜𝑚𝑏⁢(a,b)=𝑐𝑜𝑚𝑏⁢(b,a), the definition of reward function composition (Definition 17) implies that if defined, the two values are equal.

Suppose that the function 𝑐𝑜𝑚𝑏 satisfies the following conditions for all a,b,c,d,d′∈ℝ−∞:

  • ■

    (Associativity) 𝑐𝑜𝑚𝑏⁢(c⁢o⁢m⁢b⁢(a,b),c)=𝑐𝑜𝑚𝑏⁢(a,c⁢o⁢m⁢b⁢(b,c)).

  • ■

    (Monotonicity) If d≤d′, then 𝑐𝑜𝑚𝑏⁢(d,b)≤𝑐𝑜𝑚𝑏⁢(d′,b) and 𝑐𝑜𝑚𝑏⁢(a,d)≤𝑐𝑜𝑚𝑏⁢(a,d′).

  • ■

    (Continuity) For every fixed v∈ℝ−∞, the functions f1⁢(x)=𝑐𝑜𝑚𝑏⁢(x,v) and f2⁢(y)=𝑐𝑜𝑚𝑏⁢(v,y) are continuous on ℝ−∞.

Under these conditions we prove that for any sequence σ∈(ΣP⊗Q⊗RO⁢b⁢s)∞ it either holds that ((ℱP▽𝑐𝑜𝑚𝑏ℱQ)▽𝑐𝑜𝑚𝑏ℱR)⁢(σ)=(ℱP▽𝑐𝑜𝑚𝑏(ℱQ▽𝑐𝑜𝑚𝑏ℱR))⁢(σ), or both are undefined.

Let ℱP⁢Q:=ℱP▽𝑐𝑜𝑚𝑏ℱQ, ℱQ⁢R:=ℱQ▽𝑐𝑜𝑚𝑏ℱR, P⁢Q:=(AP⁢Q,ℱP⁢Q) and Q⁢R:=(AQ⁢R,ℱQ⁢R), and let A:=(AP∥AQ)∥AR=AP∥(AQ∥AR). Let σ∈(ΣP⊗Q⊗RO⁢b⁢s)∞.

First we show that (ℱP⁢Q▽𝑐𝑜𝑚𝑏ℱR)⁢(σ) is defined iff (ℱP▽𝑐𝑜𝑚𝑏ℱQ⁢R)⁢(σ) is defined.

Suppose that (ℱP⁢Q▽𝑐𝑜𝑚𝑏ℱR)⁢(σ) is defined. Then, there exist composable implementations SP⁢Q′∈𝖨𝗆𝗉⁢(P⁢Q) and SR′∈𝖨𝗆𝗉⁢(R) and σ′∈𝖳𝗋𝖺𝖼𝖾𝗌⁢(SP⁢Q′∥SR′) such that σ′|ΣP⊗Q⊗RO⁢b⁢s=σ. Since SP⁢Q′ is good-enough with respect to ℱP⁢Q, from the properties of composition of reward functions we have that there exist composable SP′∈𝖨𝗆𝗉⁢(P) and SQ′∈𝖨𝗆𝗉⁢(Q) and a trace σ′′∈𝖳𝗋𝖺𝖼𝖾𝗌⁢(SP′∥SQ′) such that σ′′|ΣP⊗QO⁢b⁢s=σ′|ΣP⊗QO⁢b⁢s. By the choice of σ′ and σ′′ we have that there exists σ′′′∈𝖳𝗋𝖺𝖼𝖾𝗌⁢((SP′∥SQ′)∥SR′) such that σ′′′|ΣP⊗Q⊗RO⁢b⁢s=σ. Since 𝖳𝗋𝖺𝖼𝖾𝗌((SP′∥SQ′)∥SR′)=𝖳𝗋𝖺𝖼𝖾𝗌(SP′∥(SQ′∥SR′)), we can use SP′, SQ′∥SR′ and σ′′′ as a witness to the fact that (ℱP▽𝑐𝑜𝑚𝑏ℱQ⁢R)⁢(σ) is defined. The other direction of the implication is shown analogously, concluding the first part of the proof.

It remains to show that when both functions are defined on σ, then their values are equal.

By definition, we have (ℱP⁢Q▽𝑐𝑜𝑚𝑏ℱR)(σ)=inf{𝑐𝑜𝑚𝑏(ℱP⁢Q(σ′|ΣP⊗QO⁢b⁢s),ℱR(σ′|ΣRO⁢b⁢s))|SP⁢Q′∈𝖨𝗆𝗉(PQ),SR′∈𝖨𝗆𝗉(R),composable,σ′∈𝖳𝗋𝖺𝖼𝖾𝗌(SP⁢Q′∥SR′,σ|ΣP⊗Q⊗RE,I)}. Applying the definition to ℱP⁢Q, we replace ℱP⁢Q⁢(σ′|ΣP⊗QO⁢b⁢s) by inf{𝑐𝑜𝑚𝑏(ℱP(σ′′|ΣPO⁢b⁢s),ℱQ(σ′′|ΣQO⁢b⁢s))|SP′∈𝖨𝗆𝗉(P),SQ′∈𝖨𝗆𝗉(Q),composable,σ′′∈𝖳𝗋𝖺𝖼𝖾𝗌(SP′∥SQ′,σ′|ΣP⊗QE,I)}.

Due to the monotonicity and continuity properties of 𝑐𝑜𝑚𝑏, we get (ℱP⁢Q▽𝑐𝑜𝑚𝑏ℱR)(σ)=inf{𝑐𝑜𝑚𝑏(𝑐𝑜𝑚𝑏(ℱP(σ′′|ΣPO⁢b⁢s),ℱQ(σ′′|ΣQO⁢b⁢s)),ℱR(σ′|ΣRO⁢b⁢s))∣SP⁢Q′∈𝖨𝗆𝗉(PQ),SR′∈𝖨𝗆𝗉(R),composable,σ′∈𝖳𝗋𝖺𝖼𝖾𝗌(SP⁢Q′∥SR′,σ|ΣP⊗Q⊗RE,I),SP′∈𝖨𝗆𝗉(P),SQ′∈𝖨𝗆𝗉(Q),composable,σ′′∈𝖳𝗋𝖺𝖼𝖾𝗌(SP′∥SQ′,σ′|ΣP⊗QE,I)}. Applying reasoning similar to that in the first part of the proof, we get (ℱP⁢Q▽𝑐𝑜𝑚𝑏ℱR)⁢(σ)=inf{𝑐𝑜𝑚𝑏⁢(𝑐𝑜𝑚𝑏⁢(ℱP⁢(σ′′′|ΣPO⁢b⁢s),ℱQ⁢(σ′′′|ΣQO⁢b⁢s)),ℱR⁢(σ′′′|ΣRO⁢b⁢s))∣SP′∈𝖨𝗆𝗉⁢(P),SQ′∈𝖨𝗆𝗉⁢(Q),composable,SR′∈𝖨𝗆𝗉⁢(R)⁢ composable with ⁢SP′∥SQ′,σ′′′∈𝖳𝗋𝖺𝖼𝖾𝗌⁢(SP′⁢‖SQ′‖⁢SR′,σ|ΣP⊗Q⊗RE,I)}. Using the associativity of 𝑐𝑜𝑚𝑏 we replace the term 𝑐𝑜𝑚𝑏⁢(𝑐𝑜𝑚𝑏⁢(ℱP⁢(σ′′′|ΣPO⁢b⁢s),ℱQ⁢(σ′′′|ΣQO⁢b⁢s)),ℱR⁢(σ′′′|ΣRO⁢b⁢s)) by
𝑐𝑜𝑚𝑏⁢(ℱP⁢(σ′′′|ΣPO⁢b⁢s),𝑐𝑜𝑚𝑏⁢(ℱQ⁢(σ′′′|ΣQO⁢b⁢s),ℱR⁢(σ′′′|ΣRO⁢b⁢s))).

Additionally, reorganizing the composition, we obtain (ℱP⁢Q▽𝑐𝑜𝑚𝑏ℱR)(σ)=inf{𝑐𝑜𝑚𝑏(ℱP(σ′′′|ΣPO⁢b⁢s),𝑐𝑜𝑚𝑏(ℱQ(σ′′′|ΣQO⁢b⁢s),ℱR(σ′′′|ΣRO⁢b⁢s)))∣SP′∈𝖨𝗆𝗉(P),SQ′∥SR′∈𝖨𝗆𝗉(QR),composable,σ′′′∈𝖳𝗋𝖺𝖼𝖾𝗌(SP′∥(SQ′∥SR′),σ|ΣP⊗Q⊗RE,I)}.

Using again the properties of 𝑐𝑜𝑚𝑏, we get (ℱP⁢Q▽𝑐𝑜𝑚𝑏ℱR)(σ)=inf{𝑐𝑜𝑚𝑏(ℱP(σ′′′|ΣPO⁢b⁢s),ℱQ⁢R(σ′′′|ΣQ⊗RO⁢b⁢s))∣SP′∈𝖨𝗆𝗉(P),SQ′∥SR′∈𝖨𝗆𝗉(QR),composable,σ′′′∈𝖳𝗋𝖺𝖼𝖾𝗌(SP′∥(SQ′∥SR′),σ′|ΣP⊗Q⊗RE,I)}. This is precisely (ℱP▽𝑐𝑜𝑚𝑏ℱQ⁢R)⁢(σ). ◀

Appendix B Appendix: Properties of Reward Interface Refinement

Proposition 30 (Refinement as Preorder).

For all reward interfaces P, Q and R, it holds that (1) P⪯P and (2) if Q⪯P, and R⪯Q, then also R⪯P.

Proof.

Theorem 4.1 in [14] establishes that the refinement relation between classical interface automata is a preorder. Thus, we show only that reward function refinement is a preorder.

Consider reward interfaces P=(AP,ℱP), Q=(AQ,ℱQ), and R=(AR,ℱR).

(1) is trivial, so we show only (2). Assume that P⪰Q and Q⪰R.

Since AP⪰AQ and AQ⪰AR, we have alternating simulations ⪰P⁢Q⊆VP×VQ and ⪰Q⁢R⊆VQ×VR from AQ to AP, and from AR to AQ, respectively. Furthermore we have that ΣPE⊆ΣQE⊆ΣRE, ΣPI⊆ΣQI⊆ΣRI, and ΣRO⊆ΣQO⊆ΣPO. For AP⪰AR, we define the relation ⪰P⁢R⊂VP×VR as ⪰P⁢R:={(u,v)∈VP×VR∣∃w∈VQ.u⪰P⁢Qw∧w⪰Q⁢Rv}. The relation ⪰P⁢R is an alternating simulation from AR to AP. Thus, AP⪰AR.

Since ℱP⪰ℱQ and ℱQ⪰ℱR, there exist functions rP⁢Q:ℝ−∞→ℝ−∞, and rQ⁢R:ℝ−∞→ℝ−∞, which satisfy the conditions of Definition 21. We define the function rP⁢R:ℝ−∞→ℝ−∞ such that rP⁢R⁢(v)=rQ⁢R⁢(rP⁢Q⁢(v)) for all v∈𝑉𝑎𝑙𝑠⁢(ℱP). We now show that rP⁢R satisfies the conditions of Definition 21. Let v∈𝑉𝑎𝑙𝑠⁢(ℱP).

  1. 1.

    Let σRI,E∈(ΣRE∪ΣRI)∞ be such that σRI,E|ΣP∈𝐻𝑜𝑝𝑒𝑓𝑢𝑙⁢(ℱP,v,(ΣPE∪ΣPI)). We have to show that σRI,E∈𝐻𝑜𝑝𝑒𝑓𝑢𝑙⁢(ℱR,rP⁢R⁢(v),(ΣRE∪ΣRI)). From the properties of rP⁢Q, we get σRI,E|ΣQ∈𝐻𝑜𝑝𝑒𝑓𝑢𝑙⁢(ℱQ,rP⁢Q⁢(v),(ΣQE∪ΣQI)). From that, using the properties of rQ⁢R, we get that σRI,E∈𝐻𝑜𝑝𝑒𝑓𝑢𝑙⁢(ℱR,rQ⁢R⁢(rP⁢Q⁢(v)),(ΣQE∪ΣQI)). Since rQ⁢R⁢(rP⁢Q⁢(v))=rP⁢R⁢(v), this is precisely what we needed to show.

  2. 2.

    Let σR∈(ΣRO⁢b⁢s)∞ be such that ℱR⁢(σR)≥rP⁢R⁢(v). We have to show that ℱP⁢(σR|ΣP)≥v. Since rP⁢R⁢(v)=rQ⁢R⁢(rP⁢Q⁢(v)), from the properties of rQ⁢R we have that ℱQ⁢(σR|ΣQ)≥rP⁢Q⁢(v). From that, by the properties of the function rP⁢Q we get ℱP⁢((σR|ΣQ)|ΣP)≥v. (σR|ΣQ)|ΣP is equal to σR|ΣP because of the subset relationships between alphabets of P, Q, and R, as stated above, which is precisely what we had to show.

◀

Theorem 24 (Implementation of a Refinement). [Restated, see original statement.]

If a reward interface Q=(AQ,ℱQ) refines a reward interface P=(AP,ℱP), then 𝖨𝗆𝗉⁢(Q)⊆𝖨𝗆𝗉⁢(P).

Proof.

Consider reward interfaces P=(AP,ℱP) and Q=(AQ,ℱQ) such that Q is a refinement of P. We have to show that 𝖨𝗆𝗉⁢(Q)⊆𝖨𝗆𝗉⁢(P). Let S∈𝖨𝗆𝗉⁢(Q). By Definition 13, we need to show that (a) S⪯AP, and (b) S is good-enough w.r.t. ℱP.

Refinement of interface automata is transitive, and since S is a refinement of AQ, and AQ refines AP, condition (a) is satisfied. To establish condition (b), we have to show that for every σE,I∈(ΣPE∪ΣPI)∞ with σE,I∈𝐻𝑜𝑝𝑒𝑓𝑢𝑙⁢(ℱP,v,ΣPE∪ΣPI) and every trace σ∈𝖳𝗋𝖺𝖼𝖾𝗌ΣPO⁢b⁢s⁢(S,σE,I) it holds that ℱP⁢(σ) is defined and ℱP⁢(σ)≥v.

Since ℱQ⪯ℱP, there exists a function rP⁢Q:ℝ−∞→ℝ−∞ that satisfies the conditions of Definition 21. Because σE,I∈𝐻𝑜𝑝𝑒𝑓𝑢𝑙⁢(ℱP,v,ΣPE∪ΣPI), and (ΣPE∪ΣPI)⊆(ΣQE∪ΣQI), we know by the first property of rP⁢Q that σE,I∈𝐻𝑜𝑝𝑒𝑓𝑢𝑙⁢(ℱQ,rP⁢Q⁢(v),ΣQE∪ΣQI). Then, since S∈𝖨𝗆𝗉⁢(Q) we have that for every trace σ∈𝖳𝗋𝖺𝖼𝖾𝗌ΣQO⁢b⁢s⁢(S,σE,I), ℱQ⁢(σ) is defined and ℱQ⁢(σ)≥rP⁢Q⁢(v). Applying Definition 21, every trace σ∈𝖳𝗋𝖺𝖼𝖾𝗌ΣQO⁢b⁢s⁢(S,σE,I) is such that ℱP⁢(σ|ΣP) is defined and ℱP⁢(σ|ΣP)≥v. Conditions on rP⁢Q guarantee that the matching sequence σ|ΣP achieves value v for ℱP. Since ΣPO⊇ΣQO⊇ΣSO, {σ|ΣP∣σ∈𝖳𝗋𝖺𝖼𝖾𝗌ΣQO⁢b⁢s⁢(S,σE,I)}={σ∣σ∈𝖳𝗋𝖺𝖼𝖾𝗌ΣPO⁢b⁢s⁢(S,σE,I)}. Thus, it follows that for every trace σ∈𝖳𝗋𝖺𝖼𝖾𝗌ΣPO⁢b⁢s⁢(S,σE,I), ℱP⁢(σ) is defined and ℱP⁢(σ)≥v, which is what we had to prove. ◀

Theorem 25. [Restated, see original statement.]

Consider P=(AP,ℱP) and Q=(AQ,ℱQ) with AP and AQ compatible, and let P′=(AP′,ℱP′) be a non-empty refinement of P, with (ΣP′I∖ΣPI)∩ΣQO=∅. Then if 𝑐𝑜𝑚𝑏 is monotonically increasing, (AP′∥AQ,ℱP′▽𝑐𝑜𝑚𝑏ℱQ)⪯(AP∥AQ,ℱP▽𝑐𝑜𝑚𝑏ℱQ). If P and Q are ℱ-compatible for a reward function ℱ, then P′ and Q are also ℱ-compatible.

We will differentiate Theorem 25 into Lemma 31 and Lemma 32.

Lemma 31 (Substitutability).

Let P=(AP,ℱP) be ℱ-compatible with Q=(AQ,ℱQ) for some function ℱ:(ΣP⊗QO⁢b⁢s)∞→ℝ. Then, any non-empty refinement P′=(AP′,ℱP′) of P with (ΣP′I∖ΣPI)∩ΣQO=∅ is ℱ-compatible with Q.

Proof.

Since P and Q are ℱ-compatible, we know that all the following hold:

  • ■

    AP and AQ are non-empty and composable,

  • ■

    there exists a legal environment AR for (AP,AQ), and

  • ■

    for SP∈𝖨𝗆𝗉⁢(P) and SQ∈𝖨𝗆𝗉⁢(Q) composable, SP∥SQ is good-enough w.r.t. ℱ.

To prove ℱ-compatibility of P′ and Q, we will first construct an interface automaton AR′ that is a legal environment for (AP′,AQ). We will then show that for any SP′∈𝖨𝗆𝗉⁢(P′) and any SQ∈𝖨𝗆𝗉⁢(Q), SP′∥SQ is good-enough w.r.t. ℱ. By (ΣP′I∖ΣPI)∩ΣQO=∅ and ΣP′O⊆ΣPO, we know that 𝖲𝗁𝖺𝗋𝖾𝖽⁢(AP′,AQ)⊆𝖲𝗁𝖺𝗋𝖾𝖽⁢(AP,AQ), i.e. AP′ does not synchronize with AQ on any new actions. We define AR′=⟨VR,VRi⁢n⁢i⁢t,ΣR′I,ΣR′O,ΣRE,ΣRH,𝒯R′⟩ such that:

  • ■

    ΣR′I=ΣRI∖(ΣPO∖ΣP′O), ΣR′O=ΣRO∪(ΣP′I∖ΣPI),

  • ■

    𝒯R′={(v,a,v′)|(v,a,v′)∈𝒯R∧a∈ΣR′}.

That is, AR′ is equal to AR except for the sets of inputs and outputs actions towards P′⊗Q. These are modified to account for the fact that ΣPI⊆ΣP′I and ΣPO⊇ΣP′O. Since none of the new outputs (ΣP′I∖ΣPI) of AR′ are used in 𝒯R, functionally AR′ differs from AR only in not accepting outputs of P that are removed in P′, that is (ΣPO∖ΣP′O). To prove that AR′ is a legal environment for (AP′,AQ) we need to show that conditions in Definition 5 are met. Meaning that AR′ is not empty and

  1. 1.

    ΣR′E=ΣP′⊗QE, ΣR′I=ΣP′⊗QO, ΣR′O=ΣP′⊗QI.

  2. 2.

    AR′ is composable with AP′⊗AQ, and 𝖨𝗅𝗅𝖾𝗀𝖺𝗅⁢(AP′⊗AQ,AR)=∅.

  3. 3.

    𝖱𝖾𝖺𝖼𝗁⁢((AP′⊗AQ)⊗AR′)∩(𝖨𝗅𝗅𝖾𝗀𝖺𝗅⁢(AP′,AQ)×VR′)=∅

By the definition of AR′ and the properties of AR, the first two conditions hold.

For the third condition, note that since AP′ is a refinement of AP, AP′ will never reject an input accepted by AP. In particular, 𝖱𝖾𝖺𝖼𝗁⁢((AP′⊗AQ)⊗AR′) will not contain illegal states from (𝖨𝗅𝗅𝖾𝗀𝖺𝗅⁢(AP′,AQ)×VR′) if 𝖱𝖾𝖺𝖼𝗁⁢((AP⊗AQ)⊗AR) did not, since 𝒯R′⊆𝒯R. Thus, the third condition also holds. Therefore, AR′ is a legal environment for (P′,Q).

Now we show that for any two implementations SP′∈𝖨𝗆𝗉⁢(P′) and SQ∈𝖨𝗆𝗉⁢(Q) that are composable, SP′∥SQ is good-enough w.r.t. ℱ.

As P′⪯P, by Theorem 24 we have that SP′∈𝖨𝗆𝗉⁢(P). Therefore, the ℱ-compatibility of P and Q implies that SP′∥SQ is good-enough w.r.t ℱ. ◀

Lemma 32 (Monotonicity of Reward Function Composition).

Consider reward interfaces P=(AP,ℱP) and Q=(AQ,ℱQ) with AP and AQ compatible, and let P′=(AP′,ℱP′) be a non-empty refinement of P, with (ΣP′I∖ΣPI)∩ΣQI=∅. If 𝑐𝑜𝑚𝑏 is monotonically increasing, then (AP′∥AQ,ℱP′▽𝑐𝑜𝑚𝑏ℱQ)⪯(AP∥AQ,ℱP▽𝑐𝑜𝑚𝑏ℱQ).

Proof.

Let P=(AP,ℱP) and Q=(AQ,ℱQ) be such that AP and AQ are compatible, and P′=(AP′,ℱP′) be non-empty, P′⪯P and (ΣP′I∖ΣPI)∩ΣQI=∅. We show that if 𝑐𝑜𝑚𝑏 is monotonically increasing, then (AP′∥AQ,ℱP′▽𝑐𝑜𝑚𝑏ℱQ)⪯(AP∥AQ,ℱP▽𝑐𝑜𝑚𝑏ℱQ).

For interface automata, AP′∥AQ⪯AP∥AQ. We show (ℱP′▽𝑐𝑜𝑚𝑏ℱQ)⪯(ℱP▽𝑐𝑜𝑚𝑏ℱQ).

From ℱP′⪯ℱP, there is a function r:V⁢a⁢l⁢s⁢(ℱP)→V⁢a⁢l⁢s⁢(ℱP′) that satisfies the conditions of Definition 21. To show (ℱP′▽𝑐𝑜𝑚𝑏ℱQ)⪯(ℱP▽𝑐𝑜𝑚𝑏ℱQ), we need to construct a function r′:ℝ−∞→ℝ−∞ that satisfies the conditions of Definition 21 for these functions.

For all v∈V⁢a⁢l⁢s⁢(ℱP▽𝑐𝑜𝑚𝑏ℱQ), let r′⁢(v)=inf{𝑐𝑜𝑚𝑏⁢(r⁢(ℱP⁢(σ|ΣPO⁢b⁢s)),ℱQ⁢(σ|ΣQO⁢b⁢s))∣σ∈(ΣP⊗QO⁢b⁢s)∞⁢ and ⁢𝑐𝑜𝑚𝑏⁢(ℱP⁢(σ|ΣPO⁢b⁢s),ℱQ⁢(σ|ΣQO⁢b⁢s))≥v}.

For every value v∈V⁢a⁢l⁢s⁢(ℱP▽𝑐𝑜𝑚𝑏ℱQ) we have:

  • ■

    Condition 1:
    Let σE,I∈(ΣP′⊗QE,I)∞ be such that σE,I|ΣP⊗QE,I∈𝐻𝑜𝑝𝑒𝑓𝑢𝑙⁢(ℱP▽𝑐𝑜𝑚𝑏ℱQ,v,ΣP⊗QE,I). This means that inf{𝑐𝑜𝑚𝑏⁢(ℱP⁢(σ|ΣPO⁢b⁢s),ℱQ⁢(σ|ΣQO⁢b⁢s))∣SP∈𝖨𝗆𝗉⁢(P),SQ∈𝖨𝗆𝗉⁢(Q)⁢ composable,σ∈𝖳𝗋𝖺𝖼𝖾𝗌⁢(SP∥SQ,σE,I)}≥v.

    We know that 𝖨𝗆𝗉⁢(P′)⊆𝖨𝗆𝗉⁢(P), so in particular 𝖨𝗆𝗉⁢(AP′∥AQ,ℱP′▽𝑐𝑜𝑚𝑏ℱQ)⊆𝖨𝗆𝗉⁢(AP∥AQ,ℱP▽𝑐𝑜𝑚𝑏ℱQ). That means that for ℱP′▽𝑐𝑜𝑚𝑏ℱQ we will consider a subset of the implementations, and therefore not more traces when applying inf, as for ℱP▽𝑐𝑜𝑚𝑏ℱQ. This, together with the above inequality implies ℱP′▽𝑐𝑜𝑚𝑏ℱQ⁢(σE,I)≥r′⁢(v). Then it holds that any σ∈𝖳𝗋𝖺𝖼𝖾𝗌⁢(AP∥AQ,σE,I), for which ℱP′▽𝑐𝑜𝑚𝑏ℱQ⁢(σ) is defined, is a witness for σE,I∈𝐻𝑜𝑝𝑒𝑓𝑢𝑙⁢(ℱP′▽𝑐𝑜𝑚𝑏ℱQ,r′⁢(v),ΣP′⊗QE,I).

  • ■

    Condition 2:
    Let σ′∈(ΣP′⊗QO⁢b⁢s)∞ be such that (ℱP′▽𝑐𝑜𝑚𝑏ℱQ)⁢(σ′)≥r′⁢(v). This means that
    inf{𝑐𝑜𝑚𝑏(ℱP′(σ|ΣP′O⁢b⁢s),ℱQ(σ|ΣQO⁢b⁢s))∣SP′∈𝖨𝗆𝗉(P′),SQ∈𝖨𝗆𝗉(Q), composable,σ∈𝖳𝗋𝖺𝖼𝖾𝗌(SP′∥SQ,σ′|ΣP′⊗QE,I)}≥r′(v).

    We have to show that inf{𝑐𝑜𝑚𝑏(ℱP(σ|ΣPO⁢b⁢s),ℱQ(σ|ΣQO⁢b⁢s))∣SP∈𝖨𝗆𝗉(P),SQ∈𝖨𝗆𝗉(Q), composable,σ∈𝖳𝗋𝖺𝖼𝖾𝗌(SP∥SQ,σ′|ΣP⊗QE,I)}≥v.

    Since ℱP′⪯ℱP we have for the function r that ℱP′⁢(σ)≥r⁢(ℱP⁢(σ|ΣPO⁢b⁢s)). Since this function r is used in r′, then 𝑐𝑜𝑚𝑏⁢(r⁢(ℱP⁢(σ|ΣPO⁢b⁢s)),ℱQ⁢(σ|ΣQO⁢b⁢s))≥r′⁢(v), meaning that 𝑐𝑜𝑚𝑏⁢(ℱP⁢(σ|ΣPO⁢b⁢s),ℱQ⁢(σ|ΣQO⁢b⁢s))≥v by definition of r′ and monotonicity of 𝑐𝑜𝑚𝑏. Thus, inf{𝑐𝑜𝑚𝑏(ℱP(σ|ΣPO⁢b⁢s),ℱQ(σ|ΣQO⁢b⁢s))∣SP∈𝖨𝗆𝗉(P),SQ∈𝖨𝗆𝗉(Q), composable,σ∈𝖳𝗋𝖺𝖼𝖾𝗌(SP∥SQ,σ′|ΣP⊗QE,I)}≥v.

Thus, both conditions in Definition 21 hold for r′. Hence, (ℱP′▽𝑐𝑜𝑚𝑏ℱQ)⪯(ℱP▽𝑐𝑜𝑚𝑏ℱQ). ◀