{'fraction_non_alphanumeric': 0.04073928917675695, 'fraction_numerical': 0.006930836032096372, 'mean_word_length': 3.9677221026744545, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 27, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Quantifying information flow in interactive systems

We consider the problem of quantifying information flow in interactive systems, modelled as finite-state transducers in the style of Goguen and Meseguer. Our main result is that if the system is deterministic then the information flow is either logarithmic or linear, and there is a polynomial-time algorithm to distinguish the two cases and compute the rate of logarithmic flow. To achieve this we first extend the theory of information leakage through channels to the case of interactive systems, and establish a number of results which greatly simplify computation. We then show that for deterministic systems the information flow corresponds to the growth rate of antichains inside a certain regular language, a property called the width of the language. In a companion work we have shown that there is a dichotomy between polynomial and exponential antichain growth, and a polynomial time algorithm to distinguish the two cases and to compute the order of polynomial growth. We observe that these two cases correspond to logarithmic and linear information flow respectively. Finally, we formulate several attractive open problems, covering the cases of probabilistic systems, systems with more than two users and nondeterministic systems where the nondeterminism is assumed to be innocent rather than demonic.


I. INTRODUCTION
The notion of 'noninterference' was introduced by Goguen and Meseguer in [1]. It has long been recognised, however, that this condition-that no information can reach Bob about the actions of Alice-may in some circumstances be too strong. The field of quantitative information flow therefore aims to compute the amount of information that can reach Bob about Alice's actions.
The contributions of this work are in two main parts. In the first part we extend the theory of information flow through channels developed by Smith, Palamidessi and many others to the case of interactive systems. In addition to basic definitions, we establish a number of results which greatly simplify computation. In particular, we show that it suffices to consider probability distributions over deterministic strategies for the two parties and that one of them may be assumed to adopt a pure deterministic strategy. We also show that if the system itself is deterministic then there is a possiblistic characterisation of the information flow which avoids quantifying over probability distributions altogether; this will be essential for the work of the second part.
In the second part we study determinstic interactive systems modelled as finite-state transducers in the style of Goguen and Meseguer. We define the information-flow capacity of such systems, before addressing the formidable technical problem of computing it. The key idea is to show that this can be reduced to a certain combinatorial problem on partially ordered sets. This problem is solved in a companion work [2], with the consequence that we are able to show (Theorem 30) that for such systems there is a dichotomy between logarithmic and linear information flow, and a polynomial-time algorithm to distinguish the two cases. These two cases are naturally interpreted as 'safe' and 'dangerous' respectively, so we have shown that it is possible to distinguish genuinely dangerous information flow. We thereby accomplish a goal proposed by Ryan, McLean, Millen and Gligor at CSFW'01 in [3].

Overview
In Section II we first recall some relevant theory on the information-flow capacity of channels, and improve a result of Alvim, Chatzikokolakis, McIver, Morgan, Palamidessi and Smith giving an upper bound on the 'Dalenius leakage' of a channel to an exact formula (Theorem 1). We then consider interactive channels, where both parties may be required to make choices. We define leakage and information-flow capacity in this setting, and show that Bob's strategy may be assumed to be deterministic (Corollary 3). We show (Theorem 4) that in the case of deterministic channels we may take a possbilistic view of Alice's actions, which we will find simplifies calculation considerably. Finally we show (Theorem 9) that for systems which may involve multiple rounds of interaction it suffices to consider probability distributions over deterministic, rather than probabilistic, strategies.
In Section III we model deterministic interactive systems as finite-state transducers, and define their information-flow capacity. We then show how to reduce the problem of computing this to a problem involving only nondeterministic finite automata, and then to the combinatorial problem of computing the 'width' of the languages generated by the relevant automata. We observe that this problem is solved in [2], and consequently conclude (Theorem 30) that there is a dichotomy between logarithmic and linear information flow, and a polynomial-time algorithm to distinguish the two cases. The structure of the sequence of reductions leading to this theorem is summarised in Figure 3, and we illustrate the theory by applying it to a simple scheduler.
In Section IV we discuss some generalisations of the systems studied in main part of this work: namely nondeterministic systems, systems with more than two agents (which we observe encompasses the case of nondeterministic systems), and probabilistic systems. For the latter two we define the information-flow capacity and formulate the open problems of computing it. Finally in Section V we discuss related work and in Section VI we conclude.

A. Leakage through channels
We consider first the case of leakage through a channel from a space X of inputs to a space Y of outputs, corresponding to a situation in which the attacker is purely passive: Alice selects an input according to a known prior distribution p X and Bob (the attacker) receives an output according to the conditional distribution p Y |X , which specifies the channel. How much information should we say that Bob has received?
The first work on quantified information flow adopted the classical information-theoretic notion of mutual information introduced by Shannon in the 1940s [4]. However, Smith observed in [5] the problems with this consensus definition. The essential problem is that mutual information represents in some sense the average number of bits of information leaked by the system. This is appropriate for the noisy coding theorem, where we are interested in the limit of many uses of the channel, but not for the case of information leakage where we assume that the adversary receives only one output (or a small number of outputs).
This means that, in the example used by Smith, a system which leaks the whole secret 1/8 of the time is seen as largely secure (because H(X|Y ) = 7 8 H(X)), although it allows (for instance) a cryptographic key to be guessed 1/8 of the time. Smith addresses this by adopting the min-entropy leakage, defined 1 as the expected value of the increase in the probability of guessing the input upon observing the output y: Given a channel C specified by a matrix of conditional probabilities p Y |X , we may be interested in its capacity, which is the maximum value of the leakage over all possible priors p X : where the notation (X, Y ) ∼ C means that X and Y are random variables compatible with C; that is, that the conditional probabilities p Y |X (where defined) correspond to the matrix defining C.
In [6], Alvim, Chatzikolakis, Palamidessi and Smith generalise this definition to the notion of g-leakage, in which Bob makes a guess drawn from a set W, and receives a payoff according to the function g : W × X → [0, 1]. The leakage with respect to g is then sup w∈W x∈X p X (x)g(w, x) . 1 Smith and subsequent authors generally define leakage only for random variables whose images are finite sets. However, their definitions are straightforwardly generalised to arbitrary discrete random variables by replacing max with sup where appropriate. Except where noted, the proofs of all quoted results remain valid after the same modification.
Once again, we can define the capacity of a channel C: In Theorem 5.1 of [6], the authors prove the so-called 'miracle' theorem, which states that for any channel C and any gain function g we have that the g-capacity is at most the min-entropy capacity: However, it may be the case that the secret which Bob is trying to guess is not Alice's input but some other secret value (a cryptographic key, say) which is related to x in some known but unspecified way. We may be interested in bounding the possible gain for Bob for any possible secret and any (probabilistic) relationship to the choice of x; this is sometimes known as the 'Dalenius leakage', after a desideratum attributed to T. Dalenius by Dwork in [7]. We may therefore define In [8], Alvim, Chatzikokolakis, McIver, Morgan, Palamidessi and Smith give an upper bound for the Dalenius leakage: they show in Corollary 23 that for any Markov chain Z → X → Y we have that where the suprema are taken over gain functions g. Hence in particular we have that L ∞ (Z, Y ) ≤ sup g L g (Y, X). But L g (Y, X) ≤ L g (C), where C is any channel such that (X, Y ) ∼ C, and by the miracle theorem we have that L g (C) ≤ L ∞ (C), and hence we have that We are able to improve this to a precise formula for the Dalenius leakage between two random variables. Theorem 1. Let X, Y be any discrete random variables. Then Proof. We may assume without loss of generality that p Y (y) > 0 for all y ∈ Y (otherwise redefine Y to be the set of values on which p Y is supported).
For the upper bound, we recall that Braun, Chatzikokolakis and Palamidessi observe in Proposition 5.11 of [9] that there is a simple formula for the min-entropy capacity of a channel C defined by matrix p Y |X : This is proved in [9] for random variables with finite image. For general discrete random variables, the upper bound on L ∞ (C) is obtained by replacing max with sup as appropriate, but the lower bound requires a little more care since it is given by considering the uniform distribution on X . However, the lower bound can be recovered for infinite X by considering the uniform distribution on the first k elements of X and taking the limit as k → ∞.
The upper bound on L D (X, Y ) is immediate from (1) by taking C to be any channel such that (X, Y ) ∼ C.
For the lower bound, suppose that X = {x 1 , x 2 , x 3 , . . .}, and define the function f : Note that for each x ∈ X we have that p X (x) = µ(f −1 (x)), where µ is the Borel measure.
For each positive integer n, let Z n = {0, 1, 2, . . . , 2 n − 1} and let Z n be a random variable taking values in Z n , with Note that by the previous observation we have We claim that for all y ∈ Y. Indeed, by Bayes' theorem we have Let x ∈ X be arbitrary. For sufficiently large n we have that p X|Zn (x|z) = 1 for some z ∈ Z n , and hence for this z we have that p Y (y)2 n p Zn|Y (z|y) ≥ p Y |X (y|x), proving the claim. Summing (2) over all y ∈ Y and rearranging gives as required.

B. Interactive channels
More generally, we will be interested in interactive channels, where an input is chosen by both Alice and Bob, and the system then produces an output to Bob. This means that the space X is of the form X A ×X B , where the spaces X A and X B are the spaces of inputs for Alice and Bob respectively, and the interactive channel C is defined by the matrix of conditional probabilites p Y |XA,XB .
Note that if the system involves a sequence of outputs and actions by Alice and Bob then the 'inputs' x A and x B will in fact represent strategies for Alice and Bob, determining their actions on the basis of the outputs they have seen so far (in general these may be probabilistic, but we will see in Section II-D that in fact it is sufficient to consider only deterministic strategies).
We will write ((X A , X B ), Y ) ∼ C to mean that the random variables X A , X B and Y are consistent with the channel C: that is, that X A and X B are independent and the matrix p Y |XA,XB corresponds with the matrix defining C.
We can once again define the min-entropy leakage as the expected increase in Bob's probability of guessing the value of the input based on having seen the output: Again the capacity of the channel is defined as the maximum leakage over all possible priors p XA and p XB .
It appears at first glance that calculating L ∞ (C) may in general be highly intractible: we have to quantify over mixed strategies (that is over probability distributions on strategies) for Alice and Bob. However, it turns out that we may assume without loss of generality that Bob chooses a pure strategy. 2 Indeed, this holds not only for the choices we have made but for all reasonable such choices.
Specifically, we chose a leakage measure, namely L ∞ , and a method of averaging the leakage over different values of x B , namely taking log E xB 2 L . The following proposition shows that we may assume a pure strategy for Bob for any choice of leakage measure, and any method of averaging which is 'reasonable' in the sense that if the distribution of leakage is constant with value x then the value is x, and also that the value of a weighted sum of leakage distributions cannot be more than the maximum value of the distributions making up the sum (this last property is known as 'quasiconvexity'). is constant x then φ(X) = x and for any X 1 , X 2 , . . . ∈ D(R) and any ρ 1 , ρ 2 , . . . with i ρ i = 1 we have (3) Then we have where the notation (X A , x B , Y ) means the distribution with p XB (x B ) = 1, and in the above D(X ) means the space of probability distributions over the set X .
Hence for any ǫ > 0, by (3) there exists some x B such that Hence we have establishing the result.
The min-entropy capacity is a special case of this result, with L = L ∞ and φ(X) = log E x∼X 2 x . Corollary 3. Let C be an interactive channel. Then we have

C. Deterministic channels
For the channels we have considered above, once the inputs from Alice and Bob are fixed we obtain a probability distribution on outputs. However, for some systems it may be that the output is not probabilistic, but is determined by the values of the inputs; we will call such a channel deterministic. More concretely, an interactive channel C defined by the matrix If C is deterministic then the computation of L ∞ (C) simplifies considerably, because it turns out that we can take a purely possibilistic view of Alice's actions and avoid any quantification over probability distributions.

Theorem 4. Let C be a deterministic interactive channel. Then
Proof. By Corollary 3, it suffices to prove that By the formula for L ∞ (C) from [9] (recalled as (1) in the proof of Theorem 1) we have Theorem 4 essentially says that it suffices to count the maximum number of outputs that can be seen by Bob, consistently with his choice of strategy. The corresponding result for noninteractive channels is Theorem 1 of [5].

D. Probabilistic vs deterministic strategies
We observed in Section II-B that the 'channel' paradigm is able to model systems involving many rounds of interaction, because we can take Alice and Bob's inputs to be strategies, determining the actions they will take at each step of the interaction. At each step, Alice (respectively Bob) will have observed a trace of the interaction thus far drawn from a set T , and must select an action drawn from a set Σ. To specify a randomised strategy for Alice or Bob, we must therefore specify for each t ∈ T a probability distribution over Σ, so the set of strategies is the set of maps T → DΣ.
In this section we will show that in fact it suffices to consider only deterministic strategies for Alice and Bob. The intuition behind this is fairly straightforward: given a probabilistic strategy, we could imagine that any necessary coins are tossed before the execution begins, which gives a probability distribution over deterministic strategies. This changes nothing except that it allows Bob to see how the random choices made by his strategy were resolved, but this only gives him more information and so does not affect the information flow capacity. To avoid technical measurability issues we will assume that the sets T and Σ are finite.

Definition 5. Let T be a finite set of traces and Σ a finite set of actions. A strategy over T and Σ is a function
for all t ∈ T and x ∈ Σ. We write D T,Σ ⊂ S T,Σ for the set of deterministic strategies over T and Σ.
In the execution itself, these strategies will be executed and particular actions chosen. The output y ∈ Y displayed to Bob is then a function (which may be probabilistic) of the choices that were made; the system is defined by this function, which is a map from pairs of functions T → Σ (the choices made by Alice and Bob respectively) to distributions over Y.
Note that it may be that in some executions not all traces are actually presented to Alice and Bob for decision; this can be represented by the choices made in response to those traces being ignored, so no generality is lost by considering total functions T → Σ (similarly the trace-sets relevant to Alice and Bob may be distinct, but this can be represented by ignoring the choices made by Alice on Bob's traces and vice versa).
We write Σ T for the set of functions T → Σ; the probability that a particular function is realised by a particular strategy can be computed by multiplying the probabilities for each decision (note that nothing is lost by assuming independence: if Alice and Bob are supposed to know about previous choices they have made then this can be encoded in the traces).
Definition 6. Let f ∈ S T,Σ be any strategy and g ∈ Σ T . The probability that f realises g, written f (g), is given by Definition 7. Let φ : Σ T × Σ T → DY be any map, and let X A and X B be any subsets of S T,Σ . The interactive channel determined by φ, X A and X B , denoted C φ,XA,XB , is determined by the matrix of conditional probabilities We observe that if the function φ defining the system is deterministic, and if Alice and Bob use only deterministic strategies, then the channel produced is a deterministic interactive channel in the sense of the previous section, such that Theorem 4 applies to it.
The main theorem of this section is that in fact it suffices to conisder only deterministic strategies for Alice and Bob.
Theorem 9. Let Σ and T be any finite sets, Y any set and φ : Σ T × Σ T → DY be any map. Then we have Proof. The lower bound is immediate: since whenever ST,Σ , we must have (writing C S and C D resectively for the two channels in the statement of the theorem) For the upper bound, let X A and X B be any independent S T,Σ -valued random variables. We will first show that without loss of generality we may assume that X B is supported only on D T,Σ . By Corollary 3 it suffices to show this where X B is a point distribution, 3 so say that X B takes the value f B ∈ S T,Σ .
Define the random variable X ′ B to be supported only on D T,Σ , and for f ∈ D T,Σ let Note that by Definitions 6 and 7 we have that (X A , X B ) and (X A , X ′ B ) induce the same output distribution Y , and so it suffices to prove that for each y ∈ Y we have Now on the one hand we have On the other hand we have Plainly (4) ≥ (5), establishing the result.
We now show that we may also assume that X A is supported only on D T,Σ , and again by Corollary 3 it suffices to show this where X B takes only a single value, say f B ∈ D T,Σ . By the min-entropy capacity formula (1) conditioned on X B = f B it suffices to show that for every y ∈ Y we have But this is straightforward: indeed, for any f A ∈ S T,Σ we have as required.

A. Finite-state transducers
We will model deterministic interactive systems as deterministic finite-state transducers. Whereas Goguen and Meseguer in [1] modelled such systems as 'state-observed' transducers, we will consider the more general notion of 'action-observed' transducers (see the work of van der Meyden and Zhang in [10] for further discussion of the relationship between noninterference properties in these two models; this model is also essentially equivalent to the notion of 'Input-Output Labelled Transition System' used by Clark and Hunt in the non-quantitative setting in [11]).
. We will write L(T ) for the subset of Σ * × Γ * accepted by T ; such a set is a deterministic finite-state transduction, which we will also abbreviate by DFST.
This definition is not quite convenient for our purposes, because we assume that the agents are able to observe the passage of time. Hence even at a timestep where the machine does nothing, there should be a record in the trace of the fact that time has passed. We ensure this by requiring that there should be an output at each step, and apply the nonstandard term 'synchronised' to describe this property (such a transducer is also sometimes called 'letter-to-letter').
for any q ∈ Q and a ∈ Σ). In this case we say that T is a synchronised deterministic finite-state transducer (SDFST).
Note that this definition almost corresponds with the original definition of a Mealy machine ( [12]), except that we allow for a set of final states We shall therefore apply the 'zip' operation and view T as accepting elements of (Σ × Γ) * .
We are interested in SDFSTs of a special kind, representing the fact that the system communicates separately with Alice and Bob. We will consider SDFSTs whose input and output alphabets Σ and Γ are of the form Σ A × Σ B and Γ A × Γ B respectively. The pairs (Σ A , Γ A ) and (Σ B , Γ B ) represent the input and output alphabets used for communication with Alice and Bob respectively.
A simple example of such a transducer is the system which simply relays messages between the two agents (with Σ A = Σ B = {a, b} and Γ A = Γ B = {a ′ , b ′ }). This is shown in Figure 1.

B. Strategies and information flow
In order to apply the framework of the previous section, we must define the spaces X A , X B of strategies for Alice and Bob, the space Y of outcomes visible to Bob, and the matrix p Y |XA,XB governing which outcomes occur. Since we are considering deterministic specifications, the matrix p Y |XA,XB will be 0-1-valued.
Alice and Bob must each decide on an action based on the trace they have seen thus far, so a strategy for Alice is a function and similarly a strategy for Bob is a function Recall that by Theorem 9 it suffices to consider deterministic strategies for Alice and Bob: in the language of Section II-D, We will have that the function φ(g A , g B , y) ignores the values of g A on (Σ B × Γ B ) * and the values of g B on (Σ A × Γ A ) * , and treats all elements of Σ B in the image of g A as equivalent to some fixed a ∈ Σ A and similarly all elements of Σ A in the image of g B as equivalent to some fixed b ∈ Σ B . By Theorem 9 it suffices to consider deterministic strategies for Alice and Bob and so it is more convenient to refer to the sets of deterministic strategies directly as X A and X B , and to φ(x A , x B )(y) directly as the channel matrix p Y |XA,XB (y|x A , x B ).
Given an SDFST T , and strategies x A and x B for Alice and Bob respectively, what output or outputs can be shown to Bob? We consider first the case where F = Q, postponing for later the issues that arise when F Q. Definition 12. We will say that a word and there exist a 1 , . . . , a k ∈ Σ A and b 1 We will sometimes refer to limb (ii) of the above Definition as 'being consistent with x A , x B '; then being consistent with T , x A , x B means being an element of L(T ) and being consistent with x A , x B .
Could we choose to have Y = (Σ B × Γ B ) * , and say that No, because such a y may not be unique, and so the matrix p Y |XA,XB (y|x A , x B ) would not in general be stochastic. For example, if T is the identity transduction and x A and x B are both constant a, we have that (a, a) k is consistent with T , x A and x B for all k. But prefixes are the only way this can happen.
Proposition 13. Let T be an SDFST as above and let x A , x B be strategies for Alice and Bob. Then there exists some w 0 ∈ (Σ × Γ) ω such that for any w ∈ L(T ) we have that w is consistent with x A and x B if and only if w ≤ w 0 .
Proof. Define the infinite word , where q 0 is the initial state and the sequence q 0 q 1 . . . is defined by q i = δ(q i−1 , (a i , a ′ i )) for i ≥ 1. Clearly if w ≤ w 0 then w satisfies limb (ii) of Definition 12, and so if also w ∈ L(T ) then w is consistent with T , x A and x B .
Conversely suppose that w ≤ w 0 . Then we have that ). But if a = (a k+1 , a ′ k+1 ) then without loss of generality we have fst(a) = a k+1 = x A ((a 1 , b 1 ) . . . (a k , b k )) and so w is The intuition here is that having fixed x A and x B , these uniquely determine the actions of Alice and Bob at each step given the outputs they are shown, and T determines those outputs uniquely based on the actions up to the current time.
Projecting w 0 onto (Σ B × Γ B ) ω gives Corollary 14. Let T , x A and x B be as above. There exists So can we have Y = (Σ B × Γ B ) ω , and p Y |XA,XB (y|x A , x B ) = 1 for y = w 0 as in Corollary 14?
One reason why not is that this is not at all realistic: it corresponds to Bob being able to conduct an experiment lasting for an infinite time. Moreover it would allow Bob to acquire an infinite (or at least unbounded) amount of information, and it is not clear how this should be interpreted.
For this reason we will consider Bob's interaction with the system not as a single experiment, but as a family of experiments, parametrised by the amount of time allowed; that is, by the length of traces which we consider as outcomes. Assuming for the moment that F = Q, we then have that the matrix p Y |XA,XB is stochastic. Truncating at length k also means that strategies x A , x B can be viewed as drawn from the spaces of functions (Σ A × Γ A ) <k → Σ A and (Σ B × Γ B ) <k → Σ B respectively. This means that the spaces X A and X B of possible strategies for Alice and Bob are also finite.
We can now apply Theorem 4 to calculate the information flow as the size of the largest possible set of outcomes that can consistently be seen by Bob, and for convenience we will adopt this as a definition.
Definition 16. Let T be an SDFST over input and output alphabets Σ A ×Σ B , and let X A , X B be the spaces of functions Observe that if F = Q then by Theorem 4 we have that L k (T ) = L ∞ (C), where C is the interactive channel defined by the matrix of conditional probabilities in the statement of Proposition 15.
What about the case where F Q? The treatment of this depends on what we consider to be the meaning of a run ending in a non-accepting state. One interpretation is that it represents a catastrophically bad outcome (say, the intruder being detected) which must be avoided. By Corollary 3 we may assume that Bob is employing a pure (i.e. non-random) strategy, and so Alice can ensure that non-accepting runs are avoided by avoiding particular x A . This means that Definition 16 is exactly right for this interpretation.
Another possible interpretation is that a run ending in a nonaccepting state produces some kind of 'error' output, where all errors are indistinguishable. This essentially increases the number of possible observations by Bob by either 1 or 0, depending on whether or not the extremal x B allows for nonaccepting runs. This means that the amount of information is either L k (T ) or log(1 + 2 L k (T ) ), which we consider to be a trivial difference.
A third possiblity of course is that we reject the very notion of a non-accepting run, and consider only SDFSTs with F = Q. Note that many kinds of behaviour which may involve the system going into an 'error' state and producing only a fixed 'dummy' output symbol can straightforwardly be modelled as an SDFST with F = Q.
Which of these three options the reader considers most satisfactory is, to some extent, a matter of personal taste. However, since as noted above all are modelled adequately by Definition 16, that is what we shall adopt as the basic definition for the remainder of this analysis.
Definition 16 is in some sense an intensional definition, in the sense that it involves directly considering all possible strategies for Alice and Bob. It will be helpful to have a more extensional version. Definition 16 can be recast as y is consistent with T , x A and x B } .
So having an extensional characterisation of L k (T ) amounts to having a condition for a set X to be a member of F . Theorem 17. Let T , X A and X B be as above. Let F ⊆ P ((Σ B × Γ B ) * ) be defined by Y ∈ F if and only if there exists some x B ∈ X B such that Proof. The 'only if' direction is straightforward. Part (i) is immediate from the definitions, and for part (ii) we must have a = x B (w) = a ′ (for the relevant x B ).
For the 'if' direction, suppose that X satisfies the two conditions in the statement of the theorem. Define the partial function x : (Σ B × Γ B ) * ⇁ Σ B by x(w ′ ) = a whenever w ′ (a, b) ≤ w for some w ∈ X and some b ∈ Γ B . This is well-defined by condition (ii). Define x B : (Σ B ×Γ B ) * → Σ B to be x, extended arbitrarily where x is undefined. We claim that Indeed, let w ∈ X be arbitrary. Plainly w is consistent with be an arbitrary total extension of x ′ . Then plainly w ′ is consistent with x A , and is also consistent with x B since w was. Hence w is consistent with T , x A and x B , as required.
Truncating to length k, and observing that gives Corollary 18. Let T , X A and X B be as above. Then we have

C. Reduction to automata
In this section, we show how to reduce the problem of computing L k (T ) from a problem about transducers to a problem which mentions only automata. The first step is to produce an automaton whose language is in correspondence with Bob's interface with T . , (a, a ′ )), snd(σ(q, (a, a ′ ))))|a ∈ Σ A } for all q ∈ Q and a ′ ∈ Σ B , ∆(q, b ′ ) = ∅ for all b ′ ∈ Γ B , and

an SDFST. Define the nondeterministic finite automaton
Informally, we introduce an auxiliary state for each pair (q, b ′ ) ∈ Q × Γ B to represent the behaviour 'emit the event b ′ and then go into state q'. For states q, q ′ ∈ Q and events a ′ ∈ Σ B , b ′ ∈ Γ B we have a transition from q to (q ′ , b ′ ) if and only there exist some a ∈ Σ A and b ∈ Γ A such that δ(q, (a, a ′ )) = q ′ and σ(q, (a, a ′ )) = (b, b ′ ). In the language of Communicating Sequential Procceses, this corresponds to treating Alice's behavious as nondeterministic and hiding all of her events: that is, the familiar lazy abstraction formulation of noninterference [13]. Fig. 2. Automaton corresponding to the relay system transducer shown in Figure 1.
The following lemma is immediate from the definitions, and expresses the fact that the words accepted by A T are in precise correspondence with the words accepted by T , projected onto defined by f ((a 1 , b 1 Note that since elements of Σ B appear at odd-numbered positions in traces of A T and elements of Γ B appear at evennumbered positions, we may assume without loss of generality that Σ B and Γ B are disjoint. Then combining Lemma 20 with Corollary 18 gives Theorem 21. Let T be an SDFST as above such that Σ B and Γ B are disjoint. Then

the collections of sets which do not contain two words which first differ by an element of
Note that an alternative notation for this theorem (and, mutatis mutandis, Corollary 18) would be to define a single family F ⊆ P ((Σ B ∪ Γ B ) * ) consisting of the sets which do not contain words first differing on an element of Σ B , and then say that We have therefore reduced computing the information flow permitted by a deterministic interactive system to an instance of a more general problem over finite automata, which we call the Σ-deterministic subset growth problem.
For a nondeterministic finite automaton A over alphabet where F k consists of the Σ-deterministic subsets of L(A) =k .
Problem 23 (Σ-deterministic subset growth). Given a nondeterministic finite automaton A over Σ ∪ Γ, determine the growth rate of D k (A).
Of course, the statement of this problem is somewhat informal, in that the meaning of 'determine the growth rate' is not precisely specified. This is in some sense inevitable, considering that D k (A) is an infinite collection of values, so many types of results are possible. Below we will obtain results on the asymptotic growth of D k (A) as k → ∞.

D. Antichains
In this section we will see that Problem 23 can be further reduced, to that of computing the 'width' of L(A).
Definition 24. Let X be a set, and let ≤ be a partial order on X. Then the lexicographic order induced by ≤ on X * , denoted , is defined by ∀w ∈ X * : ǫ w (and w ǫ if w = ǫ), and ∀x, y ∈ X, w, w ′ ∈ X * : xw yw ′ if and only if either x < y or x = y and w w ′ .
Observe that defines a partial order. Indeed, suppose that w 1 , w 2 ∈ X * are of minimum total length such that w 1 w 2 , w 2 w 1 but w 1 = w 2 . Trivially if w 1 = ǫ then also w 2 = ǫ = w 1 (and vice versa). Otherwise we have w 1 = xw, w 2 = yw ′ , and either x < y or x = y and w w ′ , and on the other hand either y < x or y = x and w ′ w. Hence we have y = x and both w w ′ and w ′ w, so by induction w = w ′ . Hence w 1 = w 2 , a contradiction, so indeed is antisymmetric.
Similarly suppose that w 1 , w 2 , w 3 ∈ X * are of minimum total length such that w 1 w 2 and w 2 w 3 but w 1 w 3 . Since w 1 w 3 we have w 1 = ǫ, and plainly w 1 = w 2 and w 2 = w 3 and so w 2 , w 3 = ǫ. Write w 1 = xw, w 2 = yw ′ and w 3 = zw ′′ . If x < y then (since y ≤ z) we have x < z and so w 1 w 3 . Similarly if y < z then (since x ≤ y) we have x < x so w 1 w 3 . Hence we have x = y = z and w w ′ and w ′ w ′′ . But then by induction we have w w ′′ and so w 1 w 3 , a contradiction. Hence indeed is transitive and so (since we have also shown it is antisymmetric, and it is trivially reflexive) it is a partial order. The study of partially ordered sets is often concerned with chains (sets wherein any two elements are comparable) and antichains (sets where no two elements are comparable).
Definition 25. Let X be a partially ordered set, partially orderd by ≤. A set Y ⊆ X is a chain if for any x, y ∈ Y we have x ≤ y or y ≤ x. Y is an antichain if for any x, y ∈ Y such that x ≤ y we have x = y. Let Y ⊆ X be an antichain of maximum size. Then |Y | is the width of X, denoted w(X).
An example of the relevance of the width of a partially ordered set to its structure is given by the celebrated theorem of Robert Dilworth [14].
Theorem 26 (Dilworth, 1950). Let X be a partially ordered set. Let k be minimal such that X = Y 1 ∪ . . . ∪ Y k with each Y k a chain. Then k = w(X).
The relevance of these ideas to Problem 23 is established by the following theorem.
Theorem 27. Let Σ, Γ be disjoint sets. Define the partial order ≤ on Σ ∪ Γ by setting ≤| Σ to be an arbitrary linear order on Σ, and setting x ≤ y, y ≤ x for all x ∈ Γ and all y ∈ Σ ∪ Γ with y = x.
Let X ⊆ (Σ∪Γ) k be arbitrary. Then X is Σ-deterministic if and only if it is an antichain with respect to the lexicographic order induced by ≤.
We have thus reduced Problem 23 to the problem of calculating the growth rate of the width of a regular language, with respect to this partial order, a special case of the following problem.
Problem 28 (Antichain growth for NFA). Given a nondeterministic finite automaton A over a finite partially ordered set (Σ, ≤), determine the growth rate of w (L(A) =k ), with respect to the lexicographic order.
The structure of the reductions in the preceding sections is shown in Figure 3.
Theorem 29. Let A be an NFA over a partially ordered set (Σ, ≤). Then we have the following: Combining Theorem 29 with the reduction shown in Figure  3 yields the main theorem of this work, that any SDFST has either logarithmic or linear min-entropy capacity, and there is a polynomial-time algorithm to distinguish the two cases (and determine the constant for logarithmic capacity). Note in particular that the information flow capacity is bounded if and only if w(L(A) =n ) has polynomial growth of order 0.
Returning to the relay system shown in Figure 1 at the beginning of this section, it is easy to see that the corresponding automaton shown in Figure 2 has exponential antichain growth, since in particular its language contains the exponential antichain (aa ′ +ab ′ ) * . We conclude that the system allows linear information flow, which is as expected since in n steps Alice can transmit n independent bits to Bob.
We claim that the cases of linear and logarithmic information flow can in some sense be interpreted as 'dangerous' and 'safe' respectively. That linear information flow is dangerous should require no explanation: it offers an adversary an exponential speedup over exhaustive guessing of a secret (for instance a cryptographic key). On the other hand, if the information flow in time n is only proportional to log n, then this offers the adversary at most a polynomial speedup over exhaustive guessing.
Of course it will not be appropriate in every situation to regard logarithmic antichain growth as 'safe', and for instance we may sometimes be more interested in the precise amount of information flow that can occur in a fixed time n. This is given by w(L(A T ) =n ), which can be computed by a straightforward dynamic programming algorithm at the cost of determinising A T ; see p.89 of the author's PhD thesis [15] for details. Whether there is an algorithm which is polynomial in n and the size of A T (as an NFA) is an open problem.

E. Example: a simple scheduler
We now illustrate the theory of the preceding two sections by applying it to analyse a simple scheduler. A resource is shared between Alice and Bob, and at each step Alice can transmit a, signifying that she wishes to use the resource, or b, signifying that she does not. She receives back either an a ′ , signifying that she was succesful, or a b ′ , signifying that she was not (if she did not ask to use the resource then she always receives a b ′ ). The interface for Bob is similar but with primed and unprimed alphabets reversed.
Initially, Bob has priority over the use of the system, and for as long as Alice transmits b he retains it. However, as soon as Alice seeks to use the system by transmitting an a she obtains priority and retains it for as long as she uses it continuously. As soon as she transmits a b priority shifts back to Bob, who retains it for the remainder of the execution.
The transducer T corresponding to this system is depicted in Figure 4 (where missing arguments mean that the input from that user is ignored). We can now apply Definition 19 to construct the corresponding automaton A, which is shown in Figure 5. By Theorems 21 and 27 we have that L n (T ) = w(L(A) =k ), where L(A) is given the lexicographic order with the primed letters linearly ordered and the unprimed letters incomparable.
By the criteria in Theorems 16 and 28 of [2], this automaton has polynomial antichain growth of order 2, and so the system has logarithmic information flow, with L n (T ) ∼ 2 log n (see 5. Automaton corresponding to the interrupt system transducer shown in Figure 4. Section 6.5.2 of [15] for a more detailed discussion). Note that this makes intuitive sense: Alice can choose when to start using the resource and when to stop, which she can do in n 2 = Θ(n 2 ) ways.

IV. NONDETERMINISTIC, MULTI-AGENT AND PROBABILISTIC SYSTEMS
In this section we describe some open problems relating to various generalisations of the deterministic, two-agent systems considered in Section III.

A. Nondeterministic systems
In Section III we considered only deterministic systems. More generally, however, we may be interested in systems which are nondeterministic: Definition 31. A synchronised nondeterministic finite-state transducer (SNDFST) is a 6-tuple T = (Q, q 0 , F, Σ, Γ, ∆), where Q, q 0 and F are as in the definition of DFST, and Similarly to before we say that (a 1 a 2 . . . a k , b 1 b 2 . . . b k ) ∈ Σ * × Γ * is accepted by T if there exists a sequence of states q 1 . . . q k ∈ Q * such that q k ∈ F and for every 0 ≤ i < k we have (q i , a i , q i+1 , b i ) ∈ ∆. As before we will consider systems for which Σ = Σ A × Σ B and Γ = Γ A × Γ B , representing the inputs and outputs of Alice and Bob respectively.
The question then arises of how the nondeterminism in the system should be interpreted. One option is to consider it is essentially 'demonic'-that is, under the control of Alice and available to be used to convey information to Bob. This precisely corresponds to Definition 16, which can be adopted wholesale, and a construction similar to that in Definition 19 can be used to produce an NFA A T such that the capacity of T is equivalent to the antichain growth of A. We therefore have that Theorem 30 holds also for nondeterministic systems interpreted in this way.
However, the assumption of demonic nondeterminism may in some circumstances be too pessimistic. In particular, it may sometimes be reasonable to assume that the way the nondeterminism is resolved depends only on the previous events, and not on Alice's secret. Equivalently, we may imagine that the resolution of the nondeterminism is controlled by an 'innocent' third party who is isolated from both Alice and Bob (but is able to see their inputs and outputs). We thus have that if we can handle deterministic systems with multiple agents then we will be able to handle nondeterministic systems with this interpretation.

B. Multi-agent systems
We will model multi-agent systems as SDSFTs, as before, but now with for some k, where the Σ i and Γ i represent the inputs and outputs respectively to the ith 'innocent' agent. We will call such a system a k-SDSFT.
We will now require that the k innocent agents choose distributions over strategies. An argument similar to Proposition 2 shows that we may assume that the innocent agents select deterministic strategies, and so we adopt a definition analagous to Definition 16.
Definition 32. Let T be a k-SDFST. We define where X i is the set of functions (Σ i × Γ i ) → Σ i , and consistency is defined similarly to Definition 12. Our first open problem is to compute the min-entropy capacity of a k-SDFST. We conjecture that there should still be a dichotomy between polynomial and exponential growth.

C. Probabilistic systems
We may also wish to handle systems whose behaviour is probabilistic. We model such systems as probabilistic finitestate transducers.
Definition 33. A probabilistic finite-state transducer is a tuple T = (Q, q 0 , Σ, Γ, ∆), where Q is a finite set of states, q 0 ∈ Q is the initial state and ∆ : Q × Σ × Q × Γ → R ≥0 is the transition function, such that for all q ∈ Q and all a ∈ Σ we have b∈Γ,q ′ ∈Q ∆(q, a, q ′ , b) = 1.
We interpret ∆(q, a, q ′ , b) as the probability that on receiving the input a in state q, the system outputs b and moves to state q ′ .
As before we require that Σ and Γ are of the form Σ A ×Σ B and Γ A × Γ B respectively (although of course it would also be possible to consider multi-agent probabilistic systems), and the sets X A and X B are as before. For fixed x A and x B , the output Y produced to Bob after n steps is a sequence y ∈ (Σ B × Γ B ) n , where y = ((a ′ 1 , b ′ 1 ), . . . , (a ′ n , b ′ n )) occurs with probability ( (a1,b1),...,(an,bn))∈Z q1,...,qn∈Q where Z is the set of ((a 1 , b 1 ), . . . , (a n , b n )) ∈ (Σ A × Γ A ) n such that ((a 1 , a ′ 1 ), This defines an interactive channel C n , and so our second open problem is to compute the growth of L ∞ (C n ). This seems to be a rather formidable challenge since we lack a way to reduce to a possibilistic view of Alice's actions, and so we may genuinely have to quantify over probability distributions for X A .
V. RELATED WORK So far as we are aware this is the first quantitative study which is able to analyse interactive systems in full generality, that is to say where inputs may be provided by both parties, according to distributions chosen adversarially so as to maximise information flow, rather than being specified as part of the system.
Mardziel, Alvim, Hicks and Clarkson in [16] consider interactive systems in essentially the same model as we use in Section III of this paper: they represent the system by a probabilistic finite automaton, which is executed in a 'context' consisting of the strategy functions for the high and low users. They then employ probabilistic programming to analyse particular systems with respect to particular contexts, demonstrating for instance that allowing an adaptive adversary can greatly increase information flow. However, they acknowledge that they are not able to analyse the maximum leakage over all possible contexts, instead observing that 'We consider such worst-case reasoning challenging future work'. The present work addresses this question for the case where the system is deterministic.
Köpf and Basin in [17] show how to calculate information leakage for a particular model relating to side-channel attacks in which the attacker is repeatedly permitted to make queries drawn from some fixed set. They give an exhaustive algorithm to compute the maximum amount of information leakege after n queries.
Boreale and Pampaloni in [18] consider the case of repeated queries issued by the attacker (possibly adaptively) to a stateless system and show that under certain reasonable assumptions the problem of computing the maximum leakage after n queries is NP-hard. In [19], the same authors together with Paolini study the asymptotics of the leakage resulting from n independent uses of a single channel for large n. This is in some sense dual to the situation we have considered, of the asymptotics of a single, long execution of a stateful system.
In [20], Andrés, Palamidessi, van Rossum and Smith compute the leakage of what they term 'interactive informationhiding systems' (IIHS), which are essentially automata over (secret) inputs and (observed) outputs. However, they assume an essentially passive attacker: apart from the values of the secret (whose distribution they sometimes allow to be chosen so as to maximise information flow), the system is assumed to follow known probabilistic behaviour. In follow-up work [21], Alvim, Andrés and Palamidessi demonstrate interesting connections between the mutual information capacity of such systems and the directed information capacity of channels with feedback, although this is of limited practical significance since it is now recognised that mutual information is not generally an appropriate measure of information flow.
An interesting alternative algorithmic approach is taken by Kawamoto and Given-Wilson in [22], although for a completely different problem from that addressed in this work. In [22], the authors consider a purely passive observer who is shown the outputs of two channels, interleaved according to some scheduler; the goal is to find a scheduler which minimises the information leakage. They show that this can be expressed as a linear programming problem, and therefore solved in time polynomial in the number of possible interleavings, which unfortunately is exponential in the number of possible traces.

VI. CONCLUSIONS
In [3], Ryan, McLean, Millen and Gligor write the following: Even at a theoretical level where timings are not available, and a bit per millisecond is not distinguishable from a bit per fortnight or a bit per century, a channel that compromises an unbounded amount of information is substantially different from one that cannot. Characterization of unbounded channels is suggested as the kind of goal that would advance the study of this subject In Theorem 30 we have achieved this goal for deterministic systems, and in fact slightly more: we have shown that even among unbounded channels there is a dichotomy between 'safe' and 'dangerous' information flow, and this can be determined for a given system in polynomial time.
Having characterised the notion of safe versus dangerous information flow, one may ask about the question of enforcement of the safety criterion. In one sense this question is already answered by Theorem 30, since it includes a polynomialtime algorithm to determine whether the condition is satisfied for a given system. However, the development of automated tools implementing this algorithm, which preferably would allow realistic systems to be specified using more convenient notation than the rather abstract mathematical formalism of finite-state transducers, is certainly an important area for future work.