{'fraction_non_alphanumeric': 0.042953878345781626, 'fraction_numerical': 0.011508616931616727, 'mean_word_length': 3.8206780610815354, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 38, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Learning Based Approach to Control Synthesis of Markov Decision Processes for Linear Temporal Logic Specifications

We propose to synthesize a control policy for a Markov decision process (MDP) such that the resulting traces of the MDP satisfy a linear temporal logic (LTL) property. We construct a product MDP that incorporates a deterministic Rabin automaton generated from the desired LTL property. The reward function of the product MDP is defined from the acceptance condition of the Rabin automaton. This construction allows us to apply techniques from learning theory to the problem of synthesis for LTL specifications even when the transition probabilities are not known a priori. We prove that our method is guaranteed to find a controller that satisfies the LTL property with probability one if such a policy exists, and we suggest empirically with a case study in traffic control that our method produces reasonable control strategies even when the LTL property cannot be satisfied with probability one.


I. INTRODUCTION
Control of Markov Decision Processes (MDPs) is a problem that is well studied for applications such as robotics surgery, unmanned aircraft control and control of autonomous vehicles [1], [2], [3]. In recent years, there has been an increased interest in exploiting the expressiveness of temporal logic specifications in controlling MDPs [4], [5], [6]. Linear Temporal Logic (LTL) provides a natural framework for expressing rich properties such as stability, surveillance, response, safety and liveness. Traditionally, control synthesis for LTL specifications is solved by finding a winning policy for a game between system requirements and environment assumptions [7], [8].
More recently, there has been an effort in exploiting these techniques in designing controllers to satisfy high level specifications for probabilistic systems. Ding et al. [6] address this problem by proposing an approach for finding a policy that maximizes satisfaction of LTL specifications of the form φ = GFπ ∧ ψ subject to minimization of the expected cost in between visiting states satisfying π. In order to maximize the satisfaction probability of φ, the authors appeal to results from probabilistic model checking [9], [10]. The methods used for maximizing this probability take advantage of computing maximal end components, which are not well suited for partial MDPs with unknown probabilities. We present a different technique that does not require preprocessing of the model. Our algorithm learns the transition probabilities of a partial model online. Our method can therefore be applied in This  practical contexts where we start from a partial model with unspecified probabilities.
Our approach is based on finding a policy that maximizes the expected utility of an auxiliary MDP constructed from the original MDP and a desired LTL specification. As in the above mentioned existing work, we convert the LTL specification to a deterministic Rabin automaton (DRA) [11], [12], and construct a product MDP such that the states of the product MDP are pairs representing states of the original MDP in addition to states of the DRA that encodes the desired LTL specification. The novelty of our approach is that we then define a state based reward function on this product MDP based on the Rabin acceptance condition of the DRA. We extend our results to allow unknown transition probabilities and learn them online. Furthermore, we select the reward function on the product MDP so it corresponds to the Rabin acceptance condition of the LTL specification. Therefore, any learning algorithm that optimizes the expected utility can be applied to find a policy that satisfies the specification.
We implement our method using a reinforcement learning algorithm that finds the policy optimizing the expected utility of every state in the Rabin-weighted product MDP. Moreover, we prove that if there exists a strategy that satisfies the LTL specification with probability one, our method is guaranteed to find such a strategy. For situations where a policy satisfying the LTL specification with probability one does not exist, our method finds reasonable strategies. We show this performance for two case studies: 1) Control of an agent in a grid world, and 2) Control of a traffic network with intersections. This paper is organized as follows: In Section II, we review necessary preliminaries. In Section III-A, we define the synthesis problem and provide theoretical guarantees in finding a policy satisfying the specification for a special case. Section III-B discusses a learning approach towards finding an optimal controller. We provide two case studies in Section IV. Finally, we conclude in Section V.

II. PRELIMINARIES
We introduce preliminaries on the specification language and the probabilistic model of the system. We use Linear Temporal Logic (LTL) to define desired specifications. A LTL formula is built of atomic propositions ω ∈ Π that are over states of the system that evaluate to True or False, propositional formulas φ that are composed of atomic propositions and Boolean operators such as ∧ (and), ¬ (negation), and temporal operations on φ. Some of the arXiv:1409.5486v1 [cs.SY] 18 Sep 2014 common temporal operators are defined as:

Gφ
φ is true all future moments. Fφ φ is true some future moments. Xφ φ is true the next moment. φ 1 Uφ 2 φ 1 is true until φ 2 becomes true.
Using LTL, we can define interesting liveness and safety properties such as surveillance properties GFφ, or stability properties FGφ. Definition 1. A deterministic Rabin automaton is a tuple R = Q, Σ, δ, q 0 , F where Q is the set of states; Σ is the input alphabet; δ : Q × Σ → Q is the transition function; q 0 is the initial state and F represents the acceptance condition: A run of a Rabin automaton is an infinite sequence r = q 0 q 1 . . . where q 0 ∈ Q 0 and for all i > 0, q i+1 ∈ δ(q i , σ), for some input σ ∈ Σ. For every run r of the Rabin automaton, inf(r) ∈ Q is the set of states that are visited infinitely often in the sequence r = q 0 q 1 . . . . A run r = q 0 q 1 . . . is accepting if there exists i ∈ {1, . . . , n F } such that: For any LTL formula φ over Π, a deterministic Rabin automaton (DRA) can be constructed with input alphabet Σ = 2 Π that accepts all and only words over Π that satisfy φ [12]. We let R φ denote this DRA.

Definition 2.
A labeled Markov Decision Process (MDP) is a tuple M = S, A, P, s 0 , Π, L where S is a finite set of states of the MDP; A is a finite set of possible actions (controls) and A : S → 2 A is defined as the mapping from states to actions; P is a transition probability function defined as P : S × A × S → [0, 1]; s 0 ∈ S is the initial state; Π is a set of atomic propositions, and L : S → 2 Π is a labeling function that labels a set of states with atomic propositions.

Consider a labeled MDP
and a linear temporal logic specification φ.

Definition 3.
A policy for M is a function π : S + → A such that π(s 0 s 1 . . . s n ) ∈ A(s n ) for all s 0 s 1 . . . s n ∈ S + where S + denotes the set of all finite sequences of states in S.
Observe that a policy π for an MDP M induces a Markov chain which we denote by M π . A run of a Markov chain is an infinite sequence of states s 0 , s 1 , . . . , where s 0 is the initial state of the Markov chain, and for all i, P (s i , a, s i+1 ) is nonzero for some action a ∈ A.
Our objective is to compute a policy π * for M such that the runs of M π * satisfy the LTL formula φ with probability one as defined below. Our approach composes M and the DRA R φ = Q, Σ, δ, q 0 , F whose acceptance condition corresponds to satisfaction of φ. We then obtain a policy π * for this composition. Our approach is particularly amenable to learning-based algorithms as we discuss in Section III-B. In particular, the policy π * can be constructed even when the transition probabilities P for M are not known. Thus, we present an approach that allows the policy π * to be found online while learning the transition probabilities of M.
We create a Rabin weighted product MDP P ,defined below, using the DRA R φ and labeled MDP M. The set of states S P in P are a set of augmented states with components that correspond to states in M and components that correspond to states in R φ . The set of actions A P is identical to the set of actions in M.
To this end, we define a Rabin weighted product MDP given a MDP M and a DRA R as follows: Definition 4. A Rabin weighted product MDP or simply product MDP between a labeled MDP M = S, A, P, s 0 , Π, L and a DRA R = Q, Σ, δ, q 0 , F is defined as a tuple P = S P , A P , P P , s P0 , F P , W P [6], where: • S P = S × Q is the set of states.
• A P provides the set of control actions from the MDP: A P ((s, q)) = A(s). • P P is the set of transition probabilities defined as: s P = (s, q) ∈ S P and s P = (s , q ). • s P0 = (s 0 , q 0 ) ∈ S P is the initial state, • F P is the acceptance condition given by where w G > 0 is a positive reward, w B < 0 is a negative reward. We let N i = S\ G i ∪ B i for every pair of (G i , B i ).
We use the notation P i to denote P with the specific reward function W i P . In seeking a policy π for M such that M π satisfies φ, it suffices to consider stationary policies of the corresponding Rabin weighted product MDP [9].
Definition 5. A stationary policy π for a product MDP P is a mapping π : S P → A P that maps every state to actions selected by policy π.
A stationary policy for P corresponds to a finite memory policy for M. We let P π denote the Markov chain induced by applying the stationary policy π to the product MDP P.
Let r = s P0 s P1 s P2 . . . be a run of P π with initial product state s P0 . Definition 6. Consider a MDP M and a LTL formula φ with corresponding DRA R φ , let P be the corresponding Rabin weighted MDP, and let π be a stationary policy on P. We say that M π satisfies φ with probability 1 if where r is a run of P π initialized at s P0 .
Intuitively, M π satisfies φ with probability one if the probability measure of the runs of P π that violate the acceptance condition of φ is 0. We let i be index of Rabin acceptance condition for property φ. A reward function W i P (s P ) on every state is specified in Definition 4 and can be identified by W i ∈ R |S P | for some enumeration of S P . We assign a negative reward w B to states s P ∈ B i = S ×B i since we would like to visit them only finitely often. Similarly we assign positive rewards w g to s P ∈ G i , and reward of 0 on neutral states s P ∈ N i to bias the policy towards satisfaction of the Rabin automaton's acceptance condition.
. . , N } and N = |S P |, such that: where W i is the vector of the rewards W i P (s P ) and P π is a matrix containing the probabilities P P (s P , π(s P ), s P ). For simpler notation, we omit the superscript i the index of Rabin acceptance condition of the LTL specification. In the rest of this paper, it is assumed that W and U π are the reward and utility vectors of the product MDP with their corresponding set of Rabin acceptance condition pair (G i , B i ).

Definition 8.
A policy that maximizes this expected discounted utility for every state is an optimal policy π * = [π * (s 0 ) . . . π * (s N )], defined as: Note that for any policy π, for all s ∈ S P U π (s) ≤ U π * (s). From a product MDP P, we seek a policy that satisfies the LTL specification by optimizing the expected future utility. Note that an optimal policy exists for each acceptance condition (G i , B i ) ∈ F P and thus our reward maximization algorithm must be run on each acceptance condition. The outcome is a collection of strategies where π * i is the optimal policy under rewards W i P . We use Definition 6 to determine whether a policy π * i satisfies φ with probability one by analyzing properties of the recurrent classes in P [9].
The following theorem shows that optimizing the expected discounted utility produces a policy π such that M π satisfies φ with probability one if such a policy exists. Theorem 1. Given MDP M and LTL formula φ with corresponding Rabin weighted product MDP P. If there exists a policyπ such that Mπ satisfies φ with probability 1, then there exists i * ∈ {1, . . . , n F }, γ * ∈ [0, 1), and w * B < 0 such that any algorithm that optimizes the expected future utility of P i * with γ ≥ γ * and w B ≤ w * B will find such a policy.
Proof. Proof of theorem 1 can be found in Appendix A. Intuitively, choosing γ i.e. the discount factor close to 1 enforces visiting G i infinitely often, and a large enough negative reward w B enforces visiting B i only finitely often. This will result in satisfaction of φ by our algorithm.
Theorem 1 provides a practical approach to synthesizing a control policy π * for the MDP M. After constructing the corresponding product MDP P, a collection of policies is computed that optimize the expected future utility of each P i . Provided that γ and |w B | are sufficiently large, if there exists a policy π such that M π satisfies φ with probability 1, then for at least one of the computed policies π * i , M π * i satisfies φ with probability 1. Determining which of the policies satisfy φ with probability 1 is easily achieved by computing strongly connected components of the resulting Markov chains, for which there exists efficient graph theoretic algorithms [9].
In this section, we have not provided an explicit method for optimizing the expected utility of the product MDP P. If the transition probabilities of M are not known a priori, then the optimization algorithm must simultaneously learn the transition probabilities while optimizing the expected utility, and tools from learning theory are well-suited for this task. In the following section, we discuss how these tools apply to the policy synthesis problem above.

B. Synthesis through Reinforcement Learning
By translating the LTL synthesis problem into an expected reward maximization framework in section III-A, it is now possible to use standard techniques in the reinforcement learning literature to find satisfying control policies.
In the previous section, we did not provide an explicit method for optimizing the expected utility of the product MDP P. If the transition probabilities of M are not known a priori, then the optimization algorithm must 1) Learn the transition probabilities and 2) Optimize the expected utility. Tools from learning theory are well-suited for this task.
Algorithm 1 below is a modified active temporal difference learning algorithm [13] that accomplishes these goals. It is called after each observed transition and updates a set of persistent variables, which include a table of transition frequencies, state utilities, and the optimal policy that can each be initialized by the user with a priori estimates. The magnitude of the update is determined by a learning rate, α. Algorithm 1 is customized to take advantage of the structure Algorithm 1 Temporal Difference Learning for M P Input: s P Current state of P.
Output: a P Current action Persistent Values: · Utilities U P (s P ) for all states of P initialized at 0. · N sa ( s P , a P ) a table of frequency of state, action pairs initialized by the user. · N s |sa ( s P , a P , s P ) a table of frequency of the outcome of the equivalence class s P for state, action pairs in the equivalence class ( s P , a P ) initialized by the user.
· Optimal Policy π * for every state. Initialized at 0. · s P , a P previous state and action, initialized as null if s P is new then Choose current action a P = f exp s P = s P a P = a P in P to converge more quickly to the actual transition probabilities. Observe that product states corresponding to the same labeled MDP state have the same transition probability structure i.e. P P (s P , a, s P ) = P P (ŝ P , a,ŝ P ) if s P = (s, q), s P = (s,q),ŝ P = (s , q ), andŝ P = (s ,q ), where q, q ,q,q ∈ Q, and s, s ∈ S. Therefore, every iteration in the product MDP can in fact be used to update the transition probability estimates for all product MDP states that share the same labeled MDP state. Thus, the algorithm uses equivalence classes ( s P , a P ), where s P = s × Q = {s P = (s, q)|q ∈ Q} to more quickly converge to the optimal policy.
Traditionally, temporal difference learning occurs over multiple trials where the initial state is reset after each trial [14]. Similarly, in an online application, where we cannot reset the labeled MDP state, we periodically reset the Rabin component of the product state to Q 0 . For instance, if the LTL formula contains any safety specifications, then a safety violation will make it impossible to reach a state with positive reward in P. To ensure we obtain a correct control action for every state we introduce a function "ResetCon- Fig. 1. A grid world example with a superimposed sample trajectory under the policy π * generated by the reinforcement learning algorithm. The trajectory has a length of 1000 time steps and an initial location (0,3) denoted by a solid square. The arrows denote movement from the box containing the arrow to a corresponding adjacent state. Locations (3,0) and (4,0) do not have any arrows because they are not reachable from the initial state under our policy. Note that π * is deterministic, but may cause a single location on the grid (e.g. location (4,2)) to have different actions under different Rabin states. ditionMet()" in Algorithm 1 that forces a Rabin state reset whenever a safety violation is detected, or heuristically after a set time interval if liveness properties are not being met. In both case studies, we observed that this reset technique results in Algorithm 1 converging to a satisfying policy.
We note that online learning algorithms on general MDPs do not have hard convergence guarantees to the optimal policy because of the exploitation versus exploration dilemma [13]. A learning agent decides whether to explore or exploit via the exploration function f exp . One possible exploration function for probably approximately correct learning observes transitions and builds an internal model of the transition probabilities. The agent defaults to an exploration mode and only explores if it can learn more about the system dynamics [15].

A. Control of an agent in a grid world
For illustrative purposes, we consider an agent in a 5 × 5 grid world that is required to visit regions labeled A and B infinitely often, while avoiding region C. The LTL specification is given as the following formula: The agent is allowed four actions, where each one expresses a preference for a diagonal direction. An "upper right" action will cause the agent to move right with probability 0.4, up with probability 0.4, and remain stationary with probability 0.2. If a wall is located to the agent's right then it will move up with probability 0.8, if one is located above then it will move to the right with probability 0.8, and if the agent is in the upper right corner, then it is guaranteed to remain in the same location. The dynamics for the other actions are identical after an appropriate rotation.  Figure 1 shows the results of the learning algorithm with an exploration function f exp (·) that simply outputs random actions while learning. The product MDP contained 150 states and one acceptance pair, G i = 500, B i = −500 and γ = 0.98. There were 600 trials, which are separated by a Rabin reset every 200 time steps.
Observe that no policy exists such that φ is satisfied for all runs of the MDP. For example, it is possible that every action results in no movement of the robot. However, it is clear that there exists a policy that satisfies φ with probability 1, thus this example satisfies the conditions for Theorem 1.

B. Control of a Traffic Network with Two Intersections
To demonstrate the utility of our approach, we apply our control synthesis algorithm to a traffic network with two signalized intersections as depicted in Figure 2 where, for a ∈ A, l ∈ a implies that link l is actuated. The gray links in Fig. 2 are not explicitly considered in the model as they carry traffic out of the network. The model considers a queue of vehicles waiting on each link, and at each time step, the queue is forwarded to downstream links if the queue's link is actuated and if there is available road space downstream. If the queue is longer than some saturating limit, then only this limit is forwarded and the remainder remains enqueue for the next time step. The vehicles that are forwarded divide among downstream links via turn ratios given with the model.
Let C l > 0 be the capacity of link l. Here, the queue length is assumed to take on continuous values. To obtain a discrete model, the interval [0, C l ] ⊂ R is divided into a finite, disjoint set of subintervals. For example, if link l can accomodate up to C l = 40 vehicles, we may divide [0, 40] into the set {[0, 10], (10,20], (20, 30], (30, 40]}. The current discrete state of link l is then the subinterval that contains the current queue length of link l, and the total state of the network is the collection of current subintervals containing the current queue lengths of each link. Here, we consider probabilistic transitions among the discrete states and obtain an MDP model with control actions A as defined in (8). For the example in Fig. 2, we have (C 1 , C 2 , C 3 , C 4 ) = (40, 50, 30, 30) (9) and link 1 is divided into four subintervals, link 2 is divided into five subintervals, and links 3 and 4 are divided into two subintervals each. In addition, we augment the state space with the last applied control action so that the control objective, expressed as a LTL formula, may include conditions on the traffic lights as is the case below, thus there are 320 total discrete states. The transition probabilities for the MDP model are determined by the specific subintervals, saturating limits, and turn ratios. Future research will investigate the details of abstracting the traffic dynamics to an MDP. Let x i for i = 1, . . . , 4 denote the number of vehicles enqueue on link i. We consider the following control objective: In words, (10) where "adequate supply" means the number of vehicles on links 1 and 2 does not exceed 30 vehicles and thus can always accept incoming traffic, and a queue is "short" if the queue length is less than 10. Condition (12) is a minimum green time for actuation of link 4 at signal 2 and may be necessary if, e.g., there is a pedestrian crosswalk across link 2 which requires at least 45 seconds (three time steps) for safe crossing (recall that s v2 = 1 when link 2 is actuated). The above condition is encoded in a Rabin automaton with one acceptance pair and 37 states. The Rabin-weighted product MDP contains 11,840 states and rewards corresponding to the one acceptance pair. In Fig. 3, we explore how our approach can be used to synthesize a control policy. Restating (10)- (12), the control objective requires the two solid traces to eventually remain below the threshold at 30 vehicles and for the two dashed traces to infinitely often move below the threshold at 10 vehicles. Additionally, signal 2 should be red for at least three consecutive time steps whenever it switches from green to red. Fig. 3(a) shows a naïve control policy that synchronously actuates each link for 3 time steps but does not satisfy φ since x 2 remains above 30 vehicles. If estimates of turn ratios and saturation limits are available from, e.g., historical data, then we can obtain a MDP that approximates the true traffic dynamics and determine the optimal control policy for the corresponding Rabin-weighted product MDP. When applied to the true traffic model, the controller greatly outperforms the naive policy but still does not satisfy φ, as shown in Fig.   3(b). However, by modifying this policy via reinforcement learning on the true traffic dynamics, we obtain a controller that empirically often satisfies φ as seen in Fig. 3(c) (Note that we should not expect φ to be satisfied for all traces of the MDP or all disturbance inputs as such a controller may not exist).
This example suggests how our approach can be utilized in practice: a "reasonable" controller can be obtained by using a Rabin-weighted MDP generated from approximated traffic parameters. This policy can then be modified online to obtain a control policy that better accommodates existing conditions. Additionally, using a suboptimal controller prior to learning is rarely of serious concern for traffic control as the cost is only increased delay and congestion.

V. CONCLUSION
We have proposed a method for synthesizing a control policy for a MDP such that traces of the MDP satisfy a control objective expressed as a LTL formula. We proved that our synthesis method is guaranteed to return a controller that satisfies the LTL formula with probability one if such a controller exists. We provided two case studies: In the first case study, we utilize the proposed method to synthesize a control policy for a virtual agent in a gridded environment, and in the second case study, we synthesize a traffic signal controller for a small traffic network with two signalized intersections.
The most immediate direction for future research is to investigate theoretical guarantees in the case when the LTL specification cannot be satisfied with probability one. For example, it is desirable to prove or disprove the conjecture that for appropriate weightings in the reward function, our proposed method finds the control policy that maximizes the probability of satisfying the LTL specification. In the event that the conjecture is not true, we wish to identify fragments of LTL for which the conjecture holds. Future research will also explore other application areas such as human-in-theloop semiautonomous driving. APPENDIX A. Proof of Theorem 1 Proof. Supposeπ satisfies φ with probability 1, then the set of states of M P,π written as M Cπ can be represented as a disjoint union of Tπ transient states and R j π closed irreducible sets of recurrent classes [16]: Proposition 1. Policyπ satisfies φ with probability 1 if and only if there exits (G i , B i ) ∈ F P such that B i ∈ Tπ and R j π ∩ G i = ∅ for all recurrent classes R j π . We omit the proof of Proposition 1; however, it readily follows Definition 6.
Let Π * be the finite set of optimal policies that optimize the expected future utility. We constructively show that for large enough values of γ, the discount factor and w B , the negative reward on non accepting states, all policies π * ∈ Π * satisfy φ with probability 1. An optimal controller for an MDP obtained from an approximate model of the traffic dynamics (e.g., a model with turn ratios and saturation limits different than reality). This controller outperforms the previous naïve controller, but does not fully satisfy φ. (c) The controller from (b) is modified via reinforcement learning on the true traffic model. In the lower plot for all cases, signal i for i = 1, 2 is green if link i is actuated and is red otherwise. This example suggests how a reasonable control policy can be obtained from an approximate MDP estimated via, e.g., historical data and modified "online" using reinforcement learning on observed traffic dynamics.
Suppose π * ∈ Π * does not satisfy φ. Then one of the following two cases must be true: • Case 1: There exists a recurrent class R j π * such that R j π * ∩ G i = ∅. This means with policy π * it is possible to visit G i only finitely often. • Case 2: There exists b ∈ B i such that b is recurrent.
That is for some recurrent class of the M P,π * , b ∈ R j π * . This translates to the possibility of visiting a state in B i infinitely often. We let Π * = Π 1 ∪ Π 2 , where Π 1 (Π 2 ) is the set of optimal policies that do not satisfy φ by violating Case 1 (Case 2).
Notice that this is not a disjoint union.
In addition, we know that the vector of utilities for any policy π * ∈ Π * is U π * ∈ R N , where N = |M C π * | is the number of states of M P,π * : In this equation U π * = [U π * (s 0 ) . . . U π * (s N )] and W = [W (s 0 ) . . . W (s N )] and P π * is the transition probability matrix with entries p π * (s i , s j ) which are the probability of transitioning from s i to s j using policy π * .
We partition the vectors in equation (14) into its transient and recurrent classes: (15) In equation (15), U tr π * is a vector representing the utility of every transient state. Assuming we have q transient states, P π * (T, T ) is a q × q probability transition matrix containing the probability of transitioning from one transient state to another. Assuming there are m different recurrent classes, 0 ( m i=1 Ni×q) is a zero matrix representing the probability of transitioning from any of the m recurrent classes, each with size N i to any of the transient states. This probability is equal to 0 for all of these entries.
On the other hand, P π * = [P tr1 π * . . . P trm π * ] is a q × m i=1 N i matrix, where each P tr k π * is a q × N k matrix whose elements denote the probability of transitioning from any transient state t j , j ∈ {1, . . . , q} to every state of the kth recurrent class R k π * . Finally, P π * (R, R) is a block diagonal matrix with m blocks of size m i=1 N i × m i=1 N i for every recurrent class that states the probabilities of transitioning from one recurrent state to another. It is clear that P π * (R, R) is a stochastic matrix since each block of N i × N i is a stochastic matrix [16]. From equation (15), we can conclude: Also with some approximations, a lower bound on U tr π * can be found: ∞ n=0 γ n P n π * (T, T ) P π * P n π * (R, R) W tr W rec < U tr π * (18) ∞ n=0 γ n P n π * (T, T )W tr + ∞ n=0 γ n P π * P n π * (R, R)W rec < U tr π * (19) Case 1: We first consider all policies π * ∈ Π 1 . These are policies that violate case 1, thus for π * there exists some j such that R j π * ∩ G i = ∅. We choose any state s ∈ R j π * . Then we use equation (16) to show that any policy π * over state s has a non-positive utility U π * (s) ≤ 0.
In equation (20), is the vector that corresponds to transition probabilities from s ∈ R j π * to any other state in the same recurrent class using policy π * . W j = [W (s j 1 ) . . . W (s j N j )] is the vector for the reward values of the recurrent class R j π * . Since none of these states are in G i , we conclude that for all elements w ∈ W j , w ≤ 0.
We first consider the case that s is in a recurrent class of M Cπ.
• If s is in some recurrent class s ∈ R j π , by proposition 1, R j π ∩ G i = ∅. Therefore, there is at least one s g ∈ G i such that s g ∈ R j π and s ∈ R j π . In addition, we know that all states in B i are in the transient class. Therefore the vector of rewards in this recurrent class W j as defined previously contains non-negative elements. That is for all elements w ∈ W j , 0 ≤ w and there exists at least one w g ∈ W j , 0 < w g .
We have shown that for some s, and any policy π * ∈ Π 1 , U π * (s) < Uπ(s) which contradicts the optimality assumption of π * for the case where s ∈ R j π . Thus, we must have that s is in a transient class of M Cπ. • If s is in a transient class s ∈ Tπ, we first find a lower bound on U tr π (s), and show this lower bound can be greater than any positive number for large enough choice of γ. Note that at minimum all the states in the transient set ofπ will have utility of w B < 0, that is , and there will be only one state s g ∈ G i that lives in the recurrent class. That is w G ∈ W rec has a positive reward.
that is, the infinite sum is bounded [16].
We assume q := |T π | is the number of transient states.
In addition, P n π (R, R) is a stochastic matrix with row sum of 1 [16]. ∞ n=0 γ n P n π (T, T )W tr + γ n PπP n π (R, R)W rec < U tr π (24) γ n PπP n π (R, R)W rec < U tr π (25) Proposition 3. If p n (s, s) is the probability of returning from a state s to itself in n time steps, there exists a lower bound on ∞ n=0 γ n p n (s, s). First, there existsn such that pn(s, s) is nonzero and bounded. That is s visits itself aftern time steps with a nonzero probability. Also we know (pn(s, s)) n < p nn (s, s). Therefore: Going back to equation (24), we find a stricter lower bound on the utility of every state U tr π (s) using proposition 3: If 0 < N 1 w B + 1 1 − γnm (30) =⇒ U π * (s) < Uπ(s) Herem = max(M ) andM < PπP W rec , whereP is a block matrix whose nonzero elements arep bounds derived from proposition 3. For a fixed w B , we can select a large enough γ so equation (30) holds for all π * ∈ Π 1 . This condition implies equation (31) which contradicts with optimality of any π * ∈ Π 1 . Therefore, π * cannot be optimal unless it visits G i infinitely often. Case 2: Now we consider case 2, where π * ∈ Π 2 . Here for some b ∈ B i , b ∈ R j π * . In addition, this state is in the transient class ofπ, b ∈ Tπ. Using the same procedure as the previous case, we find the following upper bound.
U tr π > ∞ n=0 γ n P n π (T, T )W tr (32) > ∞ n=0 P n π (T, T )W tr (33) (Proposition 2) > N 2 I q×q W B (34) =⇒ Uπ(b) > N 2 w B (35) We know that b is in the recurrent class while using policy π * . So we can use equation (16) to find a bound on the utility. An upper bound assumes that all the other states in the recurrent class have positive reward of w G . U rec π * = ∞ n=0 γ n P n π * (R, R)W rec =⇒ (36) If the following condition in equation (39) holds, we conclude that for a state b, U π * (b) < Uπ(b) which violates the optimality of π * .
(39) We only need to enforce: Since there are only a finite number of policies in Π 2 , from all policies π * ∈ Π 2 , we can findp such that: Therefore equation (40) can be simplified: We assumed without loss of generality w G = 1. For a fixed value of γ, we choose w B small enough so all π * ∈ Π 2 satisfy equation (45) and violate the optimality condition.
As a result, any optimal policy must satisfy case 2, which is visiting a state in B i only finitely often.
For optimal policies π * ∈ Π 1 ∩ Π 2 , we need to find γ and w B such that both conditions for case 1 and case 2 are satisfied. That is: We select a pair of γ and w B so the system of equations in (46) is satisfied. This solution can be found as follows: First, for a small real number 0 < <M , we select w * B so: Then, γ * is selected so the following holds: The pair of (w * B , γ * ) satisfy equation (46), and as a result none of the policies π * ∈ Π * are optimal.