SYNTHESIS FROM PROBABILISTIC COMPONENTS

. Synthesis is the automatic construction of a system from its speciﬁcation. In classical synthesis algorithms, it is always assumed that the system is “constructed from scratch” rather than composed from reusable components. This, of course, rarely happens in real life, where almost every non-trivial commercial software system relies heavily on using libraries of reusable components. Furthermore, other contexts, such as web-service orchestration, can be modeled as synthesis of a system from a library of components. Recently, Lustig and Vardi introduced dataﬂow and control-ﬂow synthesis from libraries of reusable components. They proved that dataﬂow synthesis is undecidable, while control-ﬂow synthesis is decidable. In this work, we consider the problem of control-ﬂow synthesis from libraries of probabilistic components . We show that this more general problem is also decidable.


Introduction
Hardware and software systems are rarely built from scratch.Almost every non-trivial system is based on existing components.A typical component might be used in the design of multiple systems.Examples of such components include function libraries, web APIs, and ASICs.Consider the mapping application in a typical smartphone.Such an application might call the location service provided by the phone's operating system to get the user's co-ordinates, then call a web API to obtain the correct map image tiles, and finally call a graphics library to display the user's location on the screen.None of these components are exclusive to the mapping application and all of them are commonly used by other applications.
The construction of systems from reusable components is an area of active research.Examples of important work on the subject can be found in Sifakis' work on componentbased construction [21], and de Alfaro and Henzinger's work on "interface-based design" [9].Furthermore, other situations, such as web-service orchestration [1], can be viewed as the construction of systems from libraries of reusable components.such that, regardless of the external environment, the traces generated by the system S are accepted by A with probability 1.Each component in the library can be used an arbitrary number of times in the construction and there is no apriori bound on the size of the system obtained.The technical challenge here is dealing with the finiteness of the system under construction.In [14], as well as in [17], one need not deal with finiteness from the start.In fact, one can test realizability without being concerned with finiteness of the constructed system, as finiteness is a consequence of the construction.This is not the case here, where we need to deal with finiteness from the start.Nevertheless, we are able to show that the problem is in 2EXPTIME.
Before tackling the full problem, we first consider a restricted version of the problem, where the specification is given in the form of a parity index on the states of the components, and the composed system must satisfy the parity condition.We call this the embedded parity realizability problem.We solve this problem and then show how solving the embedded parity realizability problem directly allows us to solve the more general DPW probabilistic realizability problem as well.The key idea here is that by taking the product of the specification DPW with each of the components, we can obtain larger components each of whose states has a parity associated with it.The challenge in completing the reduction is the need to generate a static composition, which does not depend on the history of the computation.Here we use ideas about synthesis with incomplete information from [13].
2.1.1.Labeled Trees.Given a set D of directions, a D-tree is a set T ⊆ D * such that (a) there is an element x 0 ∈ T , called the root of T, such that, for all x ∈ T there exists y ∈ D * with x = x 0 • y, and (b) if x • c is a non-root element of T , where x ∈ D * and c ∈ D, then x is also an element of T .The elements of T are called its nodes.For every node x ∈ T , the set of successors of x is given by {x • c ∈ T : c ∈ D}.A node with no successors is called a leaf.A path π of a tree T is a set π ⊆ T such for every pair of nodes x, y in π, there exists z ∈ D * such that x = y • z or y = x • z.A path is infinite if it has no leaf nodes, otherwise it is finite.A subtree of T is a tree T ′ ⊆ T .For a node x ∈ T , the subtree rooted at x is the tree {x • y ∈ T : y ∈ D * }.The full D-tree is D * .The full subtree at x is the tree whose set of nodes is x • D * .
Given an alphabet Σ, a Σ-labeled D-tree is a pair T, τ , where T is a tree and τ : T → Σ maps each node of T to a letter in Σ.A subtree of T, τ , is a Σ-labeled D-tree T ′ , τ ′ , where T ′ is a subtree of T and τ ′ (x) = τ (x), for all x ∈ T ′ .2.1.2.Tree Automata.For a set X, let B + (X) be the set of positive Boolean formulas over X (i.e., Boolean formulas built from elements in X using ∧ and ∨), including the formulas True (an empty conjunction) and False (an empty disjunction).For a set Y ⊆ X and a formula θ ∈ B + (X), we say that Y satisfies θ iff assigning True to elements in Y and assigning False to elements in X − Y makes θ true.An alternating tree automaton is tuple A = Σ, D, Q, q 0 , δ, β , where Σ is the input alphabet, D is a set of directions, Q is a finite set of states, q 0 ∈ Q is an initial state, δ : Q × Σ → B + (D × Q) is a transition function, and β specifies the acceptance condition that defines a subset of Q ω .Each element of B + (D × Q) is called an atom.The alternating automaton A runs on Σ-labeled full D-trees.A run of A over a Σ-labeled D-tree T, τ is a (T × Q)-labeled N-tree T r , r .Each node of T r corresponds to a node of T .A node in T r , labeled by (x, q), describes a copy of the automaton that reads the node x of T and visits the state q.Note that multiple nodes of T r can correspond to the same node of T .The labels of a node and its successors have to satisfy the transition function.Formally, T r , r satisfies the following conditions: (1) ǫ ∈ T r and r(ǫ) = (ǫ, q 0 ).
(2) Let y ∈ T r with r(y) = (x, q) and δ(q, τ (x)) = θ.Then there exists a set S = {(c 0 , q 0 ), (c 1 , q 1 ), . .., (c n , q n )} ⊆ D × Q such that S satisfies θ, and for all 0 ≤ i ≤ n, we have y • i ∈ T r and r(y S is allowed to be empty.An infinite path π of a run T r , r is labeled by a word in Q ω .Let inf (π) be the set of states in Q that occur infinitely often in r(π).The Büchi acceptance condition is given as β ⊆ Q, and π satisfies β if inf (π) ∩ β = ∅.The parity acceptance condition is given as a function β : Q → {1, . .., k}, and π satisfies β if min({β(q) : q ∈ inf (π)}) is even.A run T r , r is accepting if all its infinite paths satisfy the acceptance condition.An automaton accepts a tree iff there exists a run that accepts it.We denote by L(A) the set of all Σ-labeled D-trees accepted by A.
The transition function δ of an alternating tree automaton is nondeterministic if every formula produced by δ can be written in disjunctive normal form such that if two atoms (c 1 , q 1 ) and (c 2 , q 2 ) occur in the same conjunction then c 1 and c 2 must be different.A nondeterministic tree automaton A is an alternating tree automaton with a nondeterministic transition function.In this case the transition function returns a set of |D|-ary tuples of states and can be represented as a function δ : 2.1.3.Transducers.A deterministic transducer is a tuple B = Σ I , Σ O , Q, q 0 , δ, L , where: Σ I is a finite input alphabet, Σ O is a finite output alphabet, Q is a finite set of states, q 0 ∈ Q is an initial state, L : Q → Σ O is an output function labeling states with output letters, and δ : Q × Σ I → Q is a transition function.We define δ * : Σ * I → Q as follows: δ * (ǫ) = q 0 and for x ∈ Σ * I and a ∈ Σ I , δ * (x • a) = δ(δ * (x), a).We denote by tree(B), the Σ O -labeled Σ I -tree Σ * I , τ , where for all x ∈ Σ * I , we have τ (x) = L(δ * (x)).We say tree(B) is the unwinding of B. A Σ-labeled D-tree T is called regular, if there exists a deterministic transducer C such that T = tree(C).
A probability distribution on a finite set X is a function f : We use Dist(X) to denote the set of all probability distributions on set states, and L : Q → Σ O is an output function labeling states with output letters.Note that there are no transitions out of an exit state.If F is empty, we say T is a probabilistic transducer without exits.Note that deterministic transducers are a special case of probabilistic transducers.
Given a probabilistic transducer M = (Σ I , Σ o , Q, q 0 , δ, F, L), a strategy for M is a function f : Q * → Dist(Σ I ) that probabilistically chooses an input for each sequence of states.A strategy is memoryless if the choice depends only on the last state in the sequence.A memoryless strategy can be written as a function g : Q → Dist(Σ I ).A strategy is pure if the choice is deterministic.A pure strategy is a function h : Q * → Σ I , and a memoryless and pure strategy is a function h : Q → Σ I .
A strategy f along with a probabilistic transducer M , with set of states Q, induces a probability distribution on Q ω , denoted µ f .By standard measure theoretic arguments, it suffices to define µ f for the cylinders of Q ω , which are sets of the form β • Q ω , where β ∈ Q * .First we extend δ to exit states as follows: for a ∈ Σ I , q ∈ F , q ′ ∈ Q, δ(q, a)(q) = 1 and δ(q, a)(q ′ ) = 0 when q ′ = q.Then we define µ f (q 0 • Q ω ) = 1, and for . These conditions say that there is a unique start state, and the probability of visiting a state q ′ , after visiting βq, is the same as the probability of the strategy picking a particular letter multiplied by the probability that the transducer transitions from q to q ′ on that input letter, summed over all input letters.2.1.4.Graph Induced by a Strategy.Given a directed graph G = (V, E), a strongly connected component of G is a subset U of V , such that for all u, v ∈ U , u is reachable from v. We can define a natural partial order on the set of maximal strongly connected components of G as follows: Let M be a probabilistic transducer, Q be its set of states, and f be a memoryless strategy for M .We define the graph induced by f on Q, denoted by G M,f , as the directed graph (Q, E), where (q 1 , q 2 ) ∈ E if a∈Σ I f (q 1 )(a) δ(q 1 , a)(q 2 ) > 0. That is, there is an edge from q 1 to q 2 if the transducer can transition from the state q 1 to the state q 2 on an input letter that the strategy chooses with positive probability.Given q 1 , q 2 ∈ Q, we say that q 2 is reachable from q 1 if there is a path from q 1 to q 2 in G M,f .We say a state is ergodic if it belongs to some ergodic set of G M,f .An ergodic set is reachable if there is a path from the start state to some state in the ergodic set.A state q of M is reachable under f , if there is a path in G M,f from q 0 to q.
2.1.5.Library of Components.A library is a set of probabilistic transducers that share the same input and output alphabets.Each transducer in the library is called a component.Given a finite set of directions D, we say a library L has width D, if each component in the library has exactly |D| exit states.Since we can always add dummy unreachable exit states to any component, we assume, w.l.o.g., that all libraries have an associated width, usually denoted D. In the context of a particular component, we often refer to elements of D as exits, and subsets of D as sets of exits.Given a component M from library L, and a strategy f for M , we say that the exit i ∈ D is selected by f , if the ith exit state of M is reachable under f .
An index function for a transducer is a function that assigns a natural number, called a priority index, to each state of the transducer.An index function for a library is a function that assigns a priority to every state of every component in the library.Given an index function α for a library L, we define max(α) to be the highest priority assigned by α.We can assume, w.l.o.g., that max(α) is not larger than twice the maximal number of states in the components of the library.Given a transducer M , index function α, and a strategy f for M , we say f visits priority p if there exists a state q of M such that α(q) = p and q is reachable under f .2.2.Reactive Synthesis.Reactive synthesis involves the automated construction of reactive programs from specifications.Given sets I and O of input and output signals, respectively, we can view a program as a function P : (2 I ) * → 2 O that maps a finite sequence of sets of input signals into a set of output signals.A reactive system can be viewed as a non-terminating program that interacts with an adversarial environment.The environment generates an infinite sequence of input signals, which are modeled as infinite words over the alphabet 2 I .The execution of the program for a particular input word results in an infinite computation, which is represented as an infinite word over 2 (I∪O) .
Given an LTL formula ψ over I ∪ O, realizability of ψ is the problem of determining whether there exists a program P all of whose computations satisfy the specification ψ.The correct synthesis of ψ then amounts to constructing such P [17].
The complete behavior of the system can be described by the set of all possible executions (i.e. the traces of the system), which is represented as a 2 O -labeled 2 I -tree, called an execution tree.The automata-theoretic approach involves constructing a tree automaton that accepts all computation trees all of whose paths satisfy ψ.The solution to the LTL synthesis problem then consists of a reduction to the nonemptiness problem of tree automata [17] (an earlier and more complicated solution can be found in [3]).The LTL synthesis problem is closely related to Church's problem [4,18].
The automata-theoretic approach to synthesis has been quite fruitful since the original work of Pnueli and Rosner [17].Automata-theoretic methods have been applied successfully to the synthesis of branching specifications [11] and to synthesis in the presence of incomplete or hidden information [13].The work reported in this paper extends the reactive-synthesis framework to synthesis from probabilistic components.

Control-flow Composition from Libraries
We first informally describe our notion of control-flow composition of components from a library.The components in the composition take turns interacting with the environment, and at each point in time, exactly one component is active.When the active component reaches an exit state, control is transferred to some other component.Thus, to define a control flow composition, it suffices to name the components used and describe how control should be transferred between them.We use a deterministic transducer to define the transfer of control.Each library component can be used multiple times in a composition, and we treat these occurrences as distinct component instances.We emphasize that the composition can contain potentially arbitrarily many repetitions of each component inside it.Thus, the size of the composition, a priori, is not bounded.Note that our notion of composition is static, where the components called are determined before run time, rather than dynamic, where the components called are determined during run time.
Let L be a library with width D. A composer over L is a deterministic tranducer C = (D, L, M, M 0 , ∆, λ).Here M is an arbitrary finite set of states.There is no bound on the size of M. Each M i ∈ M is the name of an instance of a component from L and λ(M i ) ∈ L is the type of M i .We use the following notational convention for component instances and names: the upright letter M always denotes component names (i.e.states of a composer) and the italicized letter M always denotes the corresponding component instances (i.e.elements of L).Further, for notational convenience we often write M i directly instead of λ(M i ).Note that while each M i is distinct, the corresponding components M i need not be distinct.Each composer defines a unique composition over components from L. The current state of the composer corresponds to the component that is in control.The transition function ∆ describes how to transfer control between components: ∆(M, i) = M ′ denotes that when the composition is in the ith final state of component M it moves to the start state of component M ′ .A composer can be viewed as an implicit representation of a composition.We give an explicit definition of composition below.
, and the transition function δ is defined as follows: For σ ∈ Σ I , q, i ∈ Q and q ′ , j ∈ Q, Note that the composition is a probabilistic transducer without exits.When the composition is in a state q, i corresponding to a non-exit state q of component M i , it behaves like M i .When the composition is in a state q f , i corresponding to an exit state q f of component M i , the control is transferred to the start state of another component as determined by the transition function of the composer.Thus, at each point in time, only one component is active and interacting with the environment.

Synthesis for Embedded Parity
In this section we consider a simplified version of the general synthesis problem, where each state of a component in the library has a priority associated with it and the specification to be satisfied is that the highest priority visited i.o. must be even with probability 1.
Let M be a probabilistic tranducer and α be an index function.A strategy f for M is winning for the environment if with positive probability the highest priority visited infinitely often (i.o.) is odd.We say that M satisfies α if there exists no winning strategy for the environment.Given a composer C over library L, we say that C satisfies α if T C satisfies α.
Given a library L with width D, Thus, each element of R can be viewed as a constraint on how the composer is allowed to connect components.The following theorem allows us to restrict attention to memoryless strategies.It states that if a winning strategy exists, then a memoryless winning strategy must also exist.Here we give a direct combinatorial proof, but we note that the result can also be obtained by adapting the methods in [6], where a similar result was proved for 2-1/2 player stochastic parity games by Chatterjee et al.
Theorem 4.2.Given a probabilistic transducer M , and index function α, if there exists a winning strategy for the environment then there exists a pure and memoryless winning strategy.
Proof.We break up the proof of this theorem in two parts in Lemma 4.3 and Lemma 4.4.
In the first part we show that given a winning strategy f we can find a memoryless winning strategy f ′ from f .In the second part we show that given a memoryless winning strategy f ′ , we can obtain a pure and memoryless strategy f ′′ from f ′ .Together the two lemmas suffice to complete the proof.Lemma 4.3.Let M be a transducer and f be a winning strategy for the environment.Then there exists a memoryless strategy g such that g is winning.
Proof.Let f be a strategy that is winning for the environment.Let Q be the set of states of M , and let Let V ∞ ⊆ Q be the set of states which have positive probability of being visited i.o.under f , that is, for each state q in V ∞ , the set of paths in Q ω that visit q i.o. has positive measure under µ f .Similarly, let E ∞ ⊆ V ∞ × V ∞ be the set of edges that have positive probability of being followed infinitely often, i.e., We first show that each maximal strongly connected component (MSCC) of G ∞ is also an ergodic set.
If e = (q 1 , q 2 ) is an edge in E ∞ , then in order for an infinite path to to follow this edge i.o., it must also travel from q 2 to q 1 i.o.Every finite path from q 2 to q 1 can be partitioned into a simple path from q 2 to q 1 and a finite number of cycles.Thus for each w ∈ IO({e}), there exists β ∈ simple(q 2 , q 1 ), such that w ∈ IO(edges(β)).Therefore IO({e}) ⊆ β∈simple(q 2 ,q 1 ) IO(edges(β)).Since µ f (IO({e})) > 0, there exists at least one β ∈ simple(q 2 , q 1 ) such that µ f (IO(edges(β)) > 0 and edges(β) ∈ E ∞ .Thus each edge in G ∞ can in effect be traversed in the opposite direction by following some path in G ∞ .So G ∞ does not have an MSCC with an outgoing edge, and thus, is a collection of ergodic sets.
Next we show that there exists some ergodic set X in G ∞ such that the highest parity in X is odd.Given q ∈ Q, let A q ⊆ Q ω denote the event that q is the highest parity state visited i.o.Since f is winning, there must be some q ∈ Q such that q has odd parity and the event A q has positive probability.Then q ∈ V ∞ , and let X ⊆ V ∞ be the ergodic set in G ∞ that contains q.Let B q ⊆ Q ω be the set of paths that visit q i.o. and leave X at most finitely many times.Since, by the definition of G ∞ , it is not possible for a path to leave X i.o. with positive probability, we get µ f (A q − B q ) = 0, and therefore µ f (A q ) = µ f (A q ∩ B q ).Now the probability that a suffix of a path remains in X, but does not visit some q ′ ∈ X is zero.This is because, X is strongly connected, and so avoiding q ′ loses a positive amount of probability infinitely many times.In the limit, the probability of remaining in X and never visiting q ′ goes to zero.If there is some p ∈ X such that the parity of p is greater than the parity of q, then all paths in A q ∩B q must have suffixes that avoid p, and so µ f (A q ∩B q ) = 0, which contradicts that A q has positive probability.Therefore q has the highest parity in X.
Finally, since each state in X is visited i.o. with positive probability, then the probability of visiting some state in X starting from the start state q 0 must be positive.Let π ∈ Q * be the shortest finite path starting from q 0 and ending in X, such that µ f (π We now define a memoryless strategy g : Q → Dist(Σ I ) that is winning for the environment.We first consider the case when q ∈ V ∞ .Let succ(q) = {q ′ : ∃(q, q ′ ) ∈ E ∞ } be the successors of q in G ∞ .Given a ∈ Σ I , we define N q (a) = {q ′ ∈ Q : δ(q, a)(q ′ ) > 0}, and is empty, then this implies that, for all β ∈ Q * , whenever some q ′ ∈ succ(q) is activated by f at β • q, some q ′′ ∈ V ∞ must also be activated by f at β • q.Then any time a path visits q, there is a positive probability of visiting a state in Q − V ∞ next.So a path that visits q and remains in V ∞ loses some finite amount of probability.In the limit, a path visiting q i.o. must have probability zero because any such path has a suffix in V ω ∞ .This contradicts q ∈ V ∞ .Thus D q is non-empty for all q ∈ V ∞ .We define g : V ∞ → Dist(Σ I ) as follows: for q ∈ V ∞ , g(q) is distributed uniformly over D q and is 0 elsewhere.We extend g to all of Q as follows: for states in π, we chose the value of g such that edges in π have positive probability under µ g , and for all other states we let g take an arbitrary value.Then g is a memoryless strategy since it is a function Q → Dist(Σ I ).Consider the graph G g induced by g on Q.Every edge in E ∞ is also an edge in G g , and no edges that leave V ∞ have been added.Also, all edges in π are also in G g .So the set X ⊆ V ∞ is a reachable ergodic set of g.Since the highest parity in X is odd, g is a winning strategy.Lemma 4.4.Let M be a transducer and f be a winning memoryless strategy for the environment.Then there exists a memoryless and pure strategy g such that g is winning.
Proof.Let M = (Σ I , Σ O , Q, q 0 , δ, F, L).Given two memoryless strategies f and g, we say that g refines f , iff ∀q ∈ Q, ∀a ∈ Σ I , g(q)(a) > 0 implies f (q)(a) > 0. The set of inputs chosen with positive probability at state q by memoryless strategy f is simply the support of the distribution f (q), denoted support(f (q)).Then g refines f iff ∀q ∈ Q, support(g(q)) ⊆ support(f (q)).Note that, if g refines f , then G g is a subgraph of G f , and each connected component of G g is contained in a connected component of G f .Now assume that f is a winning memoryless strategy for the environment.Since f is winning, by Lemma 4.5, there must be at least one reachable ergodic set P ⊆ Q of G f such that the highest parity in P is odd.Let q ∈ P be a state with the highest parity.Then if a memoryless strategy g refines f , such that q lies in a reachable ergodic set of G g , then g is also winning.This is because every ergodic set of G g that contains q must be contained within some connected component of G f containing q, and P contains all such components.So the highest parity in such an ergodic set of G g must also be odd.Thus it suffices to give a procedure of stepwise refinement of f , keeping q in a reachable ergodic set at each step, that terminates in a pure strategy.This is because, at each step of the procedure, the refined strategy is winning, and so it is also winning at the end.We detail a two stage procedure below.

Stage 1:
In the first stage we only modify f for states within the ergodic set P and each state is only modified once.At each step we maintain a set S ⊆ P of previously selected states.The modified strategy at step k is denoted f k .The set of already selected states at step k is denoted S k .The procedure is then defined inductively as follows: (1) S 1 = {q}, and f 1 agrees with f on Q−{q} and chooses some input a ∈ support(f (q)) deterministically at q. (2) At each step, the size of P − S decreases by one.The prodecure terminates when P − S is empty.This happens in |P | steps.In order to ensure that the inductive procedure is sound, we need to show that a suitable choice for p k and a k exists at each step.We first prove that, for all k < |P |, for all q ′ ∈ Q − S k , all edges leaving q ′ in G f are also present in G f k .This is true at the first step.If this is true at step k, then it is also true at step k + 1, since Q − S k+1 ⊆ Q − S k and f k+1 and f k have the same value on states in Q − S k+1 , so no edges that leave states in Q − S k+1 are removed at step k + 1.So the statement holds by induction.Since P is an ergodic set of G f , for all k < |P |, there is some edge e k in G f that starts in P − S k and ends S k .Now, by the claim proven above, e k is also an edge in G f k .Then the source vertex of e k can be chosen as Then we can choose b as a k .Therefore the inductive construction is well defined.
Next we show that, for all k ≤ |P |, f k refines f , and q is reachable in G f K from every state in S k .Let f k refine f .Since f k+1 and f k agree on states in Q − {p k }, and support(f k+1 (p k )) ⊆ support(f k (p k )), we have f k+1 refines f .Let q be reachable in G f k from every state in S k .Since S k+1 = S k ∪ {p k }, it suffices to show that q is reachable in G f k+1 from every vertex in S k , and there is an edge in G f k+1 from p k to some vertex in S k .The first part is true because f k+1 and f k take the same value on states in Q k , and the second part follows directly from the definition of f k+1 (p k ).
Let f ′ = f |P | .Then f ′ refines f , all edges leaving Q − P in G f are also edges in G f ′ , and q is reachable in G f ′ from all states in P .
Stage 2: Since P is a reachable ergodic set of G f , there exists a minimal path π in G f that starts from q 0 and ends in some state in P .Since the path is minimal, none of its edges lie in P .Then π is also a path in G f ′ .Let π = q 0 , q 1 , . .., q n where q n ∈ P .Then there exists b k ∈ Σ I such that f ′ (b k ) > 0 and δ(q k , b k )(q k+1 ) > 0. We define a pure memoryless strategy g as follows: for states in P , q agrees with f ′ ; for a state q k in π, g chooses input b k deterministically; and for a state q ′ that is not in P or π, g chooses some input b ∈ support(f ′ (q ′ )) deterministically.
Then g refines f ′ by construction, and thus g refines f .In order to prove that g is also a winning strategy, it suffices to show that q belongs to a reachable ergodic set of G g .Now, by construction, π is also a path in G g , and so some state in P is reachable from the start state in G g .Also, q is reachable in G g from all states in P .Therefore q is reachable from the start state in G g .Since P is an ergodic set of G f , and G g is a subgraph of G f , therefore there is no path in G g from q to a state in Q − P .Therefore, if p ∈ Q is reachable from q in G g , then q is also reachable from p in G g .Thus q lies in a reachable ergodic set of G g .
Memoryless strategies are important because they induce an ergodic structure on the set of states.Ergodic sets are useful because they enable us to replace probabilistic reasoning with combinatorial reasoning.In particular, they have the following crucial properties: (a) the suffix of a path is contained in some ergodic set with probability 1, and (b) the suffix of a path is contained in a proper subset of an ergodic set with probability zero [12].This allows us to define the winning strategy condition in terms of graph reachability.Lemma 4.5.Let M be a probabilistic transducer and f be a memoryless strategy for M .Then f is winning for the environment iff G M,f has a reachable ergodic set whose highest priority is odd.
Proof.Let Q be the set of states of M , E ⊆ 2 Q be the set of ergodic sets of G M,f and X = Y ∈E Y be the set of all ergodic states.We use the following useful property of ergodic sets [12]: (a) the suffix of a path is contained in some ergodic set with probability 1, and (b) the suffix of a path is contained in a proper subset of an ergodic set with probability zero.Formally, we have, for all Let odd(Q ω ) be the set of paths in Q ω whose highest parity visited i.o. is odd.If the highest parity in each ergodic set is even, then every path in odd(Q ω ) must have a suffix that is either contained in (Q − X) ω or is contained in Z ω , where Z is a proper subset of some ergodic set.Thus odd( The probability of both these sets of paths is zero under µ f .Thus µ f (odd(Q ω )) = 0, and f is not winning for the environment.
Next, assume that there is a reachable ergodic set Y ′ such that the highest parity in Y ′ is odd.Let q ′ ∈ Y ′ be a state with this parity.Since Y ′ is reachable from the start state, there exists a path π ∈ Q * , such that π starts from q 0 and ends in Y ′ and µ f (π Since Y ′ is an ergodic set, the probability of a path leaving Y ′ after reaching it is 0 [12].So we also have Then each path in S visits q ′ i.o., and therefore, Thus, f is winning for the environment. When the underlying probabilistic transducer is a composition, ergodic sets acquire additional structure.Given a composer C and a memoryless strategy f for T C , if a reachable ergodic set X of G T C ,f contains some state from a component M of T C , then either X is contained in M or all the reachable states of M are contained in X. Formally: Lemma 4.6.Let C = (D, L, M, M 0 , ∆, λ) be a composer over L and f be a memoryless strategy for T C .Let M i ∈ M and Q i be the state space of M i .Let X be a reachable ergodic set of where Y is the set of states of T C that are reachable under f .Proof.Assume that X ∩ (Q i × {i}) = ∅ and X is not contained in Q i × {i}.Let (q, i) ∈ X ∩(Q i ×{i}) and (q ′ , j) ∈ X −(Q i ×{i}), for some j = i.Since X is ergodic, there is a path π in G T C ,f from (q ′ , j) to (q, i).Let s be the first state along π such that s = (q ′′ , i) ∈ Q i × {i}.We claim that q ′′ = q i 0 , where q i 0 is the start state of M i .Let s ′ = (q ′′′ , k), where k = i, be the predecessor of s in π.By the definition of G T C ,f , there is an edge from s ′ to s only if T C can transition from s ′ to s on some input with positive probability.By Definition 3.1, T C can transition from (q ′′′ , k) to (q ′′ , i) only if q ′′′ is a final state of M k and q ′′ is the initial state of M i .Thus (q i 0 , i) is in X.
Since X is an ergodic set, if it contains a state s of T C , then it also contains all states reachable under f from s.By definition, every state in (Q i × {i}) ∩ Y is reachable under f from (q i 0 , i).Since X contains (q i 0 , i), it also contains all states in (Q i × {i}) ∩ Y .Given a graph G, each of whose vertices is assigned a priority, we say that G has the odd ergodic property if it has a reachable ergodic set whose highest priority is odd.Consider a composer C and a memoryless strategy f for T C .Then, by Lemma 4.5, f is winning for the environment iff G T C ,f has the odd ergodic property.So the probabilistic notion of winning strategy is reduced to a combinatorial one.However, the graph G T C ,f is very large as it contains all the internal states of each component explicitly.Further, to show that C satisfies α, we have to consider every possible memoryless strategy for C. We tackle this complexity by simplifying the description of a strategy f and graph G T C ,f so as to abstract away the inner states of components and the choices that f makes on those inner states.Let M be the state space of C. We aim to replace G T C ,f by a simpler graph G ′ , whose set of vertices is M, such that the odd ergodic property is preserved.We first discuss this transformation informally, and then give formal definitions and proofs.
Let M be a component of T C .If some reachable ergodic set of G T C ,f lies entirely within M , we say M is a sink.When the highest priority in the ergodic set is odd (resp.even) we say M is an odd (resp.even) sink for f .Note that a component can be both an odd and an even sink for a given strategy.Intuitively, we aim to replace the subgraph of G T C ,f that corresponds to states of M by a single new vertex x M to obtain a new graph G ′ and assign a suitable priority to x M such that the odd ergodic property is preserved by the transformation.Now if M is not a sink, then, by Lemma 4.6, x M lies in a reachable ergodic set of G ′ iff all reachable states of M lie in a reachable ergodic set of G T C ,f .In this case, we can simply assign the highest reachable priority in M to x M and the odd ergodic property is preserved.If, however, M is a sink, then the collapse of M to a single vertex might introduce new ergodic sets in the graph.That is, x M might lie in an ergodic set of G ′ which has no analogue in G T C ,f .We then have to choose the priority of x M such that the odd ergodic property is still preserved.There are two cases to consider: • M is an odd sink for f .Then, by Lemma 4.5, f is winning for the environment.Let f M denote f restricted to the states in M .Then f M is a memoryless strategy for M that is winning for the environment, and in every composition involving M , the environment can simply play f M on the states in M to win.So a component that is an odd sink is not useful for synthesizing compositions.We note that it is easy to check for and remove any odd sinks from L in a preprocessing step before attempting synthesis.Checking whether a particular component is a sink is equivalent to model checking Markov decision processes and can be done in polynomial time [22].In the rest of the paper, we assume that the given library L does not contain components that are odd sinks.
• M is an even sink for f but not an odd sink for f .Then, by Lemma 4.6, every reachable state in M either lies in an even sink or does not lie in an ergodic set.So no reachable state in M is part of an ergodic set with odd highest priority.Thus collapsing M to x M does not remove any ergodic sets with odd highest priority.It only remains to consider the possibility that the transformation can introduce a new ergodic set whose highest priority is odd.We can avoid this by assigning a priority of 2 max(α) to x M , where max(α) is the highest parity assigned by the index function α.Then if x M is part of a reachable ergodic set X ′ in G ′ , then X ′ has highest priority 2 max(α), which is even.Thus the odd ergodic property is preserved.
In formalizing the approach given above, instead of explicitly transforming G T C ,f into a more abstract graph, it is simpler to directly define a suitable graph on the state space M of the composer C such that the odd ergodic property is preserved.Just as a memoryless strategy f applied to the composition T C gives rise to the graph G T C ,f , we define a combinatorial object, called a choice function, such that choice function g together with composer C gives rise to a graph G C,g .
Definition 4.7 (Choice Function).Given a library L with width D and index function α, we define the set LABELS(L) ⊆ 2 D × {1, . .., 2 max (α)} × L as follows: (X, j, M ) ∈ LABELS(L) iff there exists a memoryless strategy f for M such that • X ⊆ D is the set of exits of selected by f in M .
• If M is an even sink for f , then j = 2 max(α).
• Otherwise j is the highest priority visited by f in M .
Given a composer C = (D, L, M, M 0 , ∆, λ) over L, a choice function for C, is a function g : for some i ∈ D such that i ∈ X where g(M 1 ) = (X, j).The priority of a vertex M ∈ M of G C,g is j where g(M) = (X, j).We say that g has rank r, if G C,g has a reachable ergodic set whose highest priority is r.
The size of the set LABELS(L) is at most max(α)|L|2 |D| .For an arbitrary triple (X, j, M ), we can check whether (X, j, M ) ∈ LABELS(L) in time polynomial in |M | using standard techniques for solving Markov decision processes [22].Thus LABELS(L) can be computed in time exponential in the size of L. Theorem 4.8.Let C be a composer over L. Then there exists a strategy for T C that is winning for the environment iff there exists a choice function for C that has an odd rank.
Proof.Let C = (D, L, M, M 0 , ∆, λ).Let Q i be the state space of M i = λ(M i ), for M i ∈ M, and let Q = (Q i × {i}) be the state space of T C .
Only If : Assume there exists a strategy for T C that is winning for the environment.Then, by Theorem 4.2, there exists a memoryless winning strategy f .We construct a choice function g for C as follows: for all M i ∈ M, g(M i ) = (X, p), where X is the set of exits of M i selected by f , and p = 2 max(α) if M i is an even sink for f and otherwise p is the highest priority in M i visited by f .Since f is winning, G T C ,f has a reachable ergodic set H with odd highest priority r.Consider the set H ⊆ M defined as follows: for all Thus, H contains a state of the composer C if the corresponding component of T C overlaps with the ergodic set H. Since L contains no components that are odd sinks, and even sinks can not be a part of an ergodic set whose highest priority is odd, H must contain all the reachable states in each component named in H.
We claim that H is an ergodic set of G C,g .We first show that H is strongly connected.Let M i and M k be in H. Since all the reachable states of M i and M k are contained in H, in particular their start states are also contained in H. Let these be q i and q k respectively.Then there is a path in G T C ,f from (q i , i) to (q k , k) because H is an ergodic set of G T C ,f .Consider the path π from (q i , i) to (q k , k) that contains the least number of exit states.Let the length of π be n and let (q ′ i , i) be the first exit state along π.Suppose ∆(M i , x) = M j , where q ′ i is the exit state of M i in direction x, and let q j be the start state of M j .Then, if g(M i ) = (X, p), we have x ∈ X, so there is an edge from M i to M j in G C,g , and the immediate next state after (q ′ i , i) in π is (q j , j).The suffix of π starting from (q j , j) is a path π ′ from (q j , j) to (q k , k) of length less than n.Further, by construction, among all such paths it has the least number of exit states.Assume, by the induction hypothesis, there is a path from M j to M k in G C,g .Since (M i , M j ) is also an edge in G C,g , therefore, by induction, there is a path from M i to M k in G C,g .M i and M k were chosen arbitrarily in H.So H is strongly connected.
Next, we show that there are no edges that leave H. Assume there is some edge in G C,g from a vertex M i ∈ H to a vertex M j ∈ M − H. Let g(M i ) = (X, p ′ ).Then there exists x ∈ X such that ∆(M i , x) = M j .Let (q ′ , i) be the exit state of M i in direction x.Then (q ′ , i) is reachable under f and so is (q j , j), where q j is the start state of M j .Therefore, there is an edge in G T C ,f from (q ′ , i) ∈ H to (q j , j) ∈ H, which contradicts that H is an ergodic set.Thus no edges leave H in G C,g and H is ergodic.
Finally, we show that the highest priority in H is r.By construction of g, since H does not contain any even sinks, the priority of a vertex M i in H is the highest priority visited in M i by f .Thus, the highest priority in H is at most the highest priority in H, which is r.Let (q, j) ∈ H be such that q has priority r.Then the highest priority visited by f in M j is r, so g(M j ) = (X, r) for some X ⊆ D. Since M j ∈ H, the highest priority in H is r, and g has rank r.
If : Now assume that g is a choice function for C with rank p, for some odd p ≤ max(α).
Then, by the definition of choice function, for all M i ∈ M, there exists a memoryless strategy f i for M i , such that g(M i ) = (X i , p i ) where X i is the set of exit directions of M i under f i , and p i = 2 max(α) if M i is an even sink for f i and otherwise p i is the highest priority visited by f i .We define a memoryless strategy f for T C as follows: for all q ∈ Q i , f (q, i) = f i (q).Since g has rank p, there exists a reachable ergodic set H ⊆ M of G C,g with highest priority p.Consider the set H = {(q, i) : q ∈ Q i , M i ∈ H}, which consists of all states in all components corresponding to the set H. Let H f be the subset of H that is reachable under f from the start state of T C .We first show that H f is strongly connected.Let (q i , i) and (q k , k) be two arbitrary states in H f .Then q i is a state of M i and q k is a state of M k .Further, M i and M k are both in H.We have the following two cases: (1) q i is the start state of M i .Consider the shortest path in G C,g from M i to M k .Such a path exists because H is an ergodic set of G C,g .Let the length of the path be n and let M j be the successor of M i in this path.So there is path of length n − 1 in G C,g from M j to M k .Now, by the definition of G C,g , there exists x ∈ D such that ∆(M i , x) = M j and the exit state in direction x is reachable from the start state of M i under f i .Thus there is a path in G T C ,f from (q i , i) to (q j , j) where q j is the start state of M j .By induction, there is a path in G T C ,f from (q i , i) to (q k , k). (2) q i is not the start state of M i .Let g(M i ) = (X, p ′ ), where X ⊆ D. Since p is the highest priority in H and M i ∈ H, we have p ′ ≤ p ≤ max(α).Thus p ′ = 2 max(α) and so M i is not an even sink for f .Also, the library L is assumed to have no components that are odd sinks.Thus, some exit of M i must be reachable from q i under f i .Let this exit be in direction x ∈ D, and let ∆(M i , x) = M j .Then there is a path in G T C ,f from (q i , i) to (q j , j) where q j is the start state of M j .Now, since q j is a start state, by the previous case, there is a path from (q j , j) to (q k , k) in G T C ,f .So there is a path from (q i , i) to (q k , k) and therefore H f is strongly connected.
Assume that some edge in G T C ,f leaves H f .Let there be an edge between (q, i) ∈ H f and (q ′ , j) ∈ Q − H f .Now M j can not belong to H because otherwise (q ′ , j) would be in H f .So we have i = j and (q, i) must be an exit state of M i .Therefore there is an edge in G C,g from M i ∈ H to M j ∈ M − H, which contradicts that H is ergodic.Thus H f is also an ergodic set.By Lemma 4.5, it suffices to show that the highest priority in H f is odd.Now p is the highest priority in H, and p is odd, which means p = 2 max(α).So there must exist M i ∈ H such that some state q in M i has priority p and is reachable under f i .Then (q, i) is in H f and so H f has highest priority at least p. Assume some state (q ′ , j) in H f has priority p ′ > p.Since q ′ is reachable under f j , therefore, we have g(M j ) = (X, p ′′ ), for some X ⊆ D and p ′′ ≥ p ′ > p.This contradicts the fact that M j ∈ H. Thus the highest priority in the ergodic set H f is p, which is odd.
Let Γ = LABELS(L).A composer and choice function pair has a natural representation as a regular Γ-labeled D-tree.Given a composer C = (D, L, M, M 0 , ∆, λ) over L, and a choice function g for C, we denote by tree(C, g), the regular Γ-labeled full D-tree D * , τ , where for all x ∈ D * , we have that τ (x) = (g(∆ * (x)), λ(∆ * (x))).Thus tree(C, g) is the tree obtained as a result of adding labels to tree(C) such that a node x corresponding to M i ∈ M that is labeled with M i in tree(C) is labeled with (X, j, M i ) where (X, j) = g(M i ).As we show in the next lemma, the mapping is reversible, in the sense that given a regular Γ-labeled D-tree, we can obtain a composer and choice function in a natural way.Lemma 4.9.Let T be a regular Γ-labeled full D-tree.Then there exist a composer C over L and a choice function g for C such that tree(C, g) = T .
Since the question of whether a given composition satisfies α boils down to whether its composer has a choice function that has an odd rank, we find it useful to characterize regular trees that correspond to choice functions having a particular rank (see [19] for related results).First, we inductively define the set of marked nodes of a Γ-labeled D-tree as follows: the root is always marked, and a node y • i, where i ∈ D and y ∈ D * , is marked if y is marked and i ∈ X, where (X, j, M ) is the label on y • i. Lemma 4.10.Let C = (D, L, M, M 0 , ∆, λ) be a composer over library L with width D, α be an index function for L, g be a choice function for C, and p ≤ max (α).Then g has rank p iff tree(C, g) has a full subtree T such that: (1) The root of T is marked.
(2) Every node in T that is marked has priority label at most p.
(3) From each marked node in T there is a path in T to a marked node with priority label p.
Proof.Only If: Assume g has rank p.Then, by definition, there exists a reachable ergodic set of G C,g whose highest priority is p.Let M i ∈ M be a vertex of G C,g that lies in this ergodic set such that there is a path in G C,g from M 0 to M i and M i has priority p.Since M i is reachable from M 0 in G C,g , there exists some x ∈ D * such that ∆ * (x) = M i and x is marked.Then the node x ∈ tree(C, g) is labeled with (X, p, M i ) for some X ⊆ D. Let T x be the full subtree of tree(C, g) rooted at x.We show that T x has the desired property.
Let y be a node in T x that is marked and let ∆ * (y) = M j .Then M j must lie in the ergodic set of G C,g containing M i and g(M j ) = (Y, p ′ ) for some Y ⊆ D and p ′ ≤ p.So y is labeled (Y, p ′ , M j ) and has a priority label less than or equal to p.All that remains is to show that some marked node in T x with a priority label p is reachable from y. Since M i is reachable from M j in G C,g , there must exist x ′ ∈ D * such that ∆ * (y • x ′ ) = M i and yx ′ is marked.Then z = yx ′ is also labeled (X, p, M i ).Since T x is a full subtree, and y ∈ T x , therefore z also lies in T x and there is a path from y to z.
If: Let T be a full subtree of tree(C, g) that satisfies the given property.Consider the set H ⊆ M of vertices in G C,g defined as follows: M i ∈ H if there exists some marked node x ∈ T such that ∆ * (x) = M i .Note that every vertex in H is reachable from M 0 in G C,g and has priority at most p.Consider the subgraph G H of G C,g induced by H. Let H ′ be an ergodic set of G H and let M be an arbitrary vertex in H ′ .Then there exists a marked node y ∈ T such that ∆ * (y) = M. Let z = a 1 a 2 . ..a n ∈ D * be such that yz is marked and has priority label p. Then every node along the path from y to yz is also marked.Let M ′ 1 = ∆ * (y) and M ′ i+1 = ∆ * (ya 1 . ..a i ), for 1 ≤ i < n.Then the priority of M ′ n is p and Finally, it suffices to show that no edges leave H in G C,g , as this implies that H ′ is also an ergodic set of G C,g .Consider an edge in G C,g from a vertex M ∈ H to a vertex M ′ ∈ M. Then there exist X ⊆ D and c ∈ X such that ∆(M, c) = M ′ and g(M) = (X, j) for some priority j.Since M lies in H, there exists a marked node x ∈ T such that ∆ * (x) = M. Then x • c is also marked and ∆ * (x • c) = M ′ .By the construction of H, M ′ lies in H. Thus there are no edges that leave H.
The conditions given by Lemma 4.10 can be checked by a suitable tree automaton as follows: Lemma 4.11.Let L be a library with width D and let p ≤ k.Then there exists an nondeterministic Büchi tree automaton (NBT) A p such that A p accepts a Γ-labeled regular D-tree T iff T = tree(C, g) for some composer C over L and choice function g with rank p.
Proof.By Lemma 4.9 and 4.10, it suffices to construct an NBT A p such that A p accepts a tree T ′ iff T ′ has a full subtree T that satisfies the three conditions in Lemma 4.10.For simplicity, the automaton is defined over binary trees, where D = {0, 1}, but the definition can be easily extended to n-ary trees.components and the E player chooses paths through the components chosen by C. C cannot see the moves E makes inside a component.At the start C chooses a component M from the library L. The turn passes to E, who chooses a sequence of inputs, inducing a path in M from its start state to some exit x in D. The turn then passes to C, which must choose some component M ′ in L and pass the turn to E and so on.As C cannot see the moves made by E inside M , C cannot base its choice on the run of E in M , but only on the exit induced by the inputs selected by E and previous moves made by C. So C must choose the same next component M ′ for different runs that reach exit x of M .In general, different runs will visit different priorities inside M .This is a two-player stochastic parity game where one of the players does not have full information.If C has a winning strategy that requires a finite amount of memory, then we can use such a strategy to obtain a suitable finite composer that satisfies the index function α, thus solving the embedded parity synthesis problem.If C has no winning strategy or if every winning strategy requires infinite memory, then α is not realizable from the library L.
We also note that, when viewed in the framework of games, our result is a rare positive result for partial-information stochastic games.In general, 2-player partial information stochastic games are known to be undecidable even for co-Buchi objectives (and thus for parity objectives) [5].

Synthesis for DPW Specifications
Let A be a deterministic parity automaton (DPW), M be a probabilistic transducer and L be a library of components.We say A is a monitor for M (resp.L) if the input alphabet of A is the same as the output alphabet of M (resp.L).Let A be a monitor for M and let L A be the language accepted by A. We say a strategy f for M is winning for the environment iff µ f (L A ) < 1, i.e., the output of M is rejected by A with positive probability.We say that M satisfies A if there exists no winning strategy for the environment.
Definition 5.1.The DPW probabilistic realizability problem is: Given a library L and a DPW A that is a monitor for L, decide whether there exists a composer C over L, such that T C satisfies A. If such a composer exists, we say that L realizes A. The DPW probabilistic synthesis problem is to find such a composer C if it exists.

We transform this problem into a version of the embedded parity problem solved in Section 4. Let
q)) and 0 otherwise.Given a library L with width D, we define the augmented library Our first step is to treat this augmented library as a new library and solve the embedded parity synthesis problem for L A with α A as the index function and R A as the exit control relation.This gives us a tree automaton that accepts L A -labeled (D × Q A )-trees and that is empty iff L A does not realize α A under R A .Later, we show how to transform this automaton into another that accepts L-labeled D-trees and is empty iff L does not realize A. Since, by definition, L A bijectively maps to L × Q A , we find it convenient to use labels from L×Q A in place of L A .We now define a composer for the augmented library.The states of the composer are pairs of the form (M, s), where s is a monitor state and M represents an instance of a component from L. A composer for L A , is a deterministic transducer The following lemma follows directly from Theorem 4.121 .Lemma 5.2.Let L be a library and A be a DPW that is a monitor for L.There exists an NPT B that accepts a regular tree T iff T = tree(C) for some composer C over L A such that T C satisfies α A and C is compatible with R A .
Given a composer C over a library L and a monitor A for L, we can extend C to a composer over the augmented library L A .Definition 5.3 (Augmented Composer).Let L be a library and A be a monitor for L. Let C = (D, L, M, M 0 , ∆, λ) be a composer over L. The augmentation of C by A, denoted C A , is a composer over We say C A is an augmented composer.While a composer only keeps track of the transfer of control between components, the augmented composer also keeps track of the state of the monitor before and after the control is transferred.To go from augmented composers to composers, we use techniques from synthesis with incomplete information [13].We start by describing a relation between tree(C) and tree(C A ). First we need to introduce some convenient notation.
Let X, Y and Z be finite sets.For a Z-labeled (X × Y )-tree T, V , we denote by xray(Y, T, V ), the (Z × Y )-labeled (X × Y )-tree T, V ′ in which each node is labeled by both its direction in Y and its labeling in T, V .We define operators hide Y and wide Y .The operator hide Y : (X × Y ) * → X * replaces each letter x • y, where x ∈ X and y ∈ Y , by the letter x.The operator wide Y maps Z-labeled X-trees to Z-labeled (X × Y )-trees as follows: wide Y ( X * , V ) = (X × Y ) * , V ′ , where for each node w ∈ (X × Y ) * , we have V ′ (w) = V (hide Y (w)).Lemma 5.4.Let L be a library and A be a monitor for L. Let C be a composer over L and C A be the augmentation of C by A. Then tree(C A ) = xray(Q A , wide Q A (tree(C))).
Proof.Let T be the unlabeled full D-tree and T ′ be the unlabeled full Theorem 5.5.Let L be a library and A be a monitor for L. Let C be a composer over L and C A be the augmentation of C by A. Then C satisfies A iff C A satisfies α A .
Proof.Let A = (Σ O , Q A , s 0 , δ A , α A ) and C = (D, L, M, M 0 , ∆, λ).Let Q and Q ′ be the state spaces of T C and T C A , respectively.Then Q ′ = Q × Q A .Let q 0 be the start state of T C .Then (q 0 , s 0 ) is the start state of T C A .Let L A be the language of A. Given w ∈ Q ω , we denote by out(w), the output sequence produced by T C corresponding to state sequence w.We define L = {w ∈ Q ω : out(w) ∈ L A }. Then a strategy f for T C is winning for the environment iff µ f (L) < 1.
We define a notion of consistency for words in Q ′ * as follows: (q 0 , s 0 ) is consistent, and if β ∈ Q ′ * is consistent then, for all q ∈ Q, β • (q, δ A (s, q ′ )) is consistent, where (q ′ , s) is the last letter of β.An infinite path in Q ′ω is consistent if all of its finite prefixes are consistent.We let H denote the set of all consistent paths in Q ′ω , and T H denote the subtree of Q ′ * that contains all consistent words in Q ′ * .Then T H contains all paths in H.We define R to be the set of paths in Q ′ω where the highest parity visited i.o. is even.
Let g be a strategy for T C A and µ g be the probability measure it induces on Q ′ω .Then, by the definition of L A , for every β ∈ Q ′ * that is not consistent, we have µ g (β • Q ′ω ) = 0. Therefore, the probability that an infinite path over Q ′ is not consistent is zero.So consistent paths are the only ones that matter probabilistically.In particular, given two strategies g and g ′ for T C A , such that g(w) = g ′ (w) for all w ∈ T H , we have µ g = µ ′ g .Thus, in order to define a strategy for all of Q ′ * it suffices to define it for T H . Also, g is winning for the environment iff µ g (H ∩ R) < 1, i.e., the probability that the highest parity visted i.o. in a consistent path is positive.
Similarly, given a strategy f over T C , we have µ f (q 0 • Q ω ) = 1, i.e., the probability of a path not beginning from the start state is zero.This means that two strategies that agree on nodes in q 0 • Q * induce the same distribution on Q ω .Thus, in order to define a strategy for all of Q * , it suffices to define it for q 0 • Q * .
Finally, we note that T H is isomorphic to q 0 •Q ω , with the isomorphism h : T H → q 0 •Q * given by h(w) = hide Q A (w).Let G be the set of all strategies g : T H → Dist(Σ I ), and F be the set of all strategies f : q 0 • Q * → Dist(Σ I ).Then h can be lifted to a bijection from F to G as follows: for f ∈ F , g ∈ G, h(f ) = f • h and h −1 (g) = g • h −1 .Then µ f (L) = µ h(f ) (H ∩ R) and µ g (H ∩ R) = µ h −1 (g) (L).Thus f ∈ F (resp.g ∈ G) is winning for the environment iff h(f ) (resp.h −1 (g)) is winning for the environment.
Given a library L and monitor A, we can solve the embedded realizability problem for the augmented library L A to obtain a regular tree T , where T = tree(C) for some composer C over L A such that C satisfies α A .Then the tree T ′ = xray(Q A , wide Q A (tree(C))) is also regular, so T ′ = tree(C ′ ) for some composer C ′ over L. Now we would like to use C ′ to solve the DPW realizability problem, but C ′ is only guaranteed to satisfy A if C is the augmentation of C ′ by A. Therefore, to solve the DPW realizability problem, we have to obtain an automaton that accepts a tree T ′ = tree(C ′ ) if the augmentation of C ′ by A satisfies α A .
Theorem 5.6.Let X, Y and Z be finite sets.Given an alternating automaton B over (Z × Y )-labeled (X × Y )-trees, we can construct an alternating automaton B ′ over Z-labeled X-trees such that B ′ accepts a labeled tree X * , V iff B accepts xray(Y, wide Y ( X * , V )).Further, B and B ′ have the same acceptance condition and |B ′ | = O(|B|).

Discussion and Future Work
Component-based synthesis seeks to build systems that satisfy a given specification using pre-existing components.This contrasts with classical synthesis, where the aim is to build a system from scratch.The component-based approach is closer in spirit to how systems are built in the real world.In this paper, we generalize the component-based synthesis problem to a probabilistic setting.Our components are modeled as probabilistic transducers and the specification is given as a deterministic parity automaton.The composition itself is described by a deterministic transducer, called a composer, which governs the transitions between components.
We break the problem down in two stages.First we solve a simpler version, which we call the embedded parity synthesis problem, where the specification is embedded as parities in the components themselves.Our solution combines techniques from Markov chain analysis and automata theoretic verification.Then we show how to solve the more general case of a separate specification, which we call the DPW probabilistic synthesis problem, by reducing it to the simpler case using techniques from synthesis with incomplete information.
We show that the embedded parity synthesis problem is in EXPTIME and the DPW probabilistic synthesis problem is in 2EXPTIME.The question of tighter lower and upper bounds we leave for future work.In particular, it is an open question whether the DPW probabilistic synthesis problem is in EXPTIME.Another line of work is suggested by the possibility of probabilistic composers.In recent work, we show that allowing the composer to be a probabilistic transducer makes the synthesis problem sensitive to the specification formalism [16].It turns out that probabilistic composers are more expressive than their deterministic counterparts for DPW specifications, but they have the same expressive power for embedded parity specifications.

Definition 4 . 1 .
The embedded parity realizability problem is: Given a library L with width D, an exit control relation R for L, and an index function α for L, decide whether there exists a composer C over L, such that C satisfies α and C is compatible with R. If such a composer exists, we say that L realizes α under R.The embedded parity synthesis problem is to find such a composer C if it exists.