format: text

text:
# Model Checking for a Class of Weighted Automata

## 1 Introduction

Model checking of finite state systems is an established approach for the automatic or semi-automatic analysis of dynamic systems from different application areas. The basic model checking approaches have been proposed for untimed models and allow one to check the functional correctness of systems. The general idea of this kind of model checking is to determine the set of states of a finite state automaton which satisfies a formula of a temporal logic. Common examples of modal logics to express formulas are Linear Time Logic (LTL) or Computational Tree Logic (CTL). For both logics, efficient analysis algorithms exist that allow the handling of extremely large automata. Nowadays, several software tools are available that include model checking algorithms, allow the automatic analysis of dynamic systems and have been applied to practical examples from different application areas like hardware verification or software engineering. An enormous number of papers on model checking and related topics exists, for relatively recent surveys we refer to  and  as a textbook.

For several application areas, the proof of functional correctness is not sufficient to assure the correct behavior of a system. For instance, in real-time systems, it has to be assured that a function of a reactive system performs correctly and takes place in a given time interval. For other systems, we may tolerate some erroneous behavior if it occurs only with a sufficiently small probability. In this and similar situations, a basic proof of correctness is not sufficient. Consequently, model checking approaches have been extended to handle also timed, probabilistic and stochastic systems. In , an extended version of the temporal logic CTL is presented that is denoted as Probabilistic Real Time Computational Tree Logic (PCTL). This logic allows the definition of properties which state that something will happen with a given probability in a fixed time interval. The logic is interpreted over finite Discrete Time Markov Chains (DTMCs). The timing is defined by the number of transitions that occur and probabilities are defined by the transition probabilities of the DTMC. PCTL is a useful logic to express requirements for real time systems with constant delays. Other model checking approaches analyze different forms of timed automata  that are possibly augmented by different timing models .

The mentioned approaches for model checking are all similar but differ in various details. In particular, the different logics are all interpreted over an appropriate automata model. The automata models used in the mentioned approaches are untimed automata for standard model checking, probabilistic automata for timed and probabilistic model checking, stochastic automata for stochastic model checking and different forms of timed automata. By considering the wide area of finite state automata, one can notice that apart from these automata types other models have been proposed and applied successfully in different application areas. Examples are min/plus, max/plus, or min/max automata that have been used for the analysis of real time systems , communication system , and discrete event systems . Furthermore, similar models have been applied for natural language processing  or image compression . It is quite natural and for most of the mentioned applications also very useful to extend model checking approaches to all these types of automata. Since the class of weighted automata provides in some sense a superset of different automata types, which includes different forms of probabilistic automata and also untimed automata, one may strive for a general framework of model checking which can be applied to a wide variety of different types of weighted automata without defining a new approach for each type. Such a framework is of theoretical interest to get a better understanding of modelchecking and to get a common ground for model checking in various application areas. From a methodological point of view, it gives direct access to model checking techniques for various types of automata that do not profit from these techniques yet. Finally, it supports tool development: in an object oriented setting, implementation of a specific model checker can inherit basic techniques from a more general class that implements techniques valid for the whole framework.

Weighted automata  are a well known class of automata where transitions are labeled with labels from a finite alphabet and, additionally, receive weights or costs that are elements of some semiring. A key observation is that the algebraic structure of a semiring is sufficient to define modelchecking for weighted automata. The advantage is that by selecting appropriate semirings, one obtains different types of automata that include most of the above mentioned types. This general type of automata is suitable to define a bisimulation as we did in . In , the process algebra GPA has been introduced for the specification of models in a compositional way such that the underlying semantic model is a weighted automaton in the case of a finite set of states.

In this paper, we develop a model checking approach for weighted automata. The approach allows us to check formulas of the newly defined logic Valued Computational Tree Logic (CTL$) over a weighted automaton. Algorithms for model checking are developed and it will be shown that by an appropriate definition of the semiring used for the definition of transitions weights, we naturally define model checking approaches for different model types without developing new approaches in each case. The special cases include untimed, probabilistic, min/plus, max/plus, and min/max automata such that known model checking approaches are covered and new approaches are introduced in the case of min/plus, max/plus, and min/max automata. By the use of other semirings for transition weights, the proposed approach applies to a wide class of automata models. In so far, we develop some form of a generic approach for model checking that is applicable to other model classes and that includes algorithms to perform model checking.

The structure of the paper is as follows. In the next section, we present the automata model that is considered in this paper. Afterwards, we define CTL$, a logic for automata with transition weights that is an extension of the well known branching time logic CTL for untimed automata. The following section introduces algorithms to check a CTL$ formula according to an automaton with transition weights. We consider algorithms with explicit state representations for clarity at this point. A treatment by symbolic representations like multi terminal binary decision diagrams (MTBDDs) is feasible but not in the focus of this paper. In Section 5, bisimulation is briefly defined for automata with transition weights and it is proved that bisimilar automata are indistinguishable under CTL$ formulas. Afterwards, in Section 6, we present several examples of concrete realizations of weighted automata. The paper ends with the conclusions.

## 2 Weighted Automata

To present our general automata model, we first introduce semirings that are needed to define labels for transitions. Afterwards the automata model is defined.

###### Definition 2.1

A semiring $`(\mathrm{IK},\widehat{+},\widehat{},\mathrm{I0},\mathrm{I1})`$ is a set $`\mathrm{IK}`$ with binary operations $`\widehat{+}`$ and $`\widehat{}`$ defined on $`\mathrm{IK}`$ such that the following axioms are satisfied:

1. $`\widehat{+}`$, $`\widehat{}`$ are associative,
2. $`\widehat{+}`$ is commutative,
3. right and left distributive laws hold for $`\widehat{+}`$ and $`\widehat{}`$,
4. $`\mathrm{I0}`$ and $`\mathrm{I1}`$ are the additive and multiplicative identities with $`\mathrm{I0}\mathrm{I1}`$,
5. $`k\widehat{}\mathrm{I0}=\mathrm{I0}\widehat{}k=\mathrm{I0}`$ holds for all $`k\mathrm{IK}`$.

Semirings can show specific properties like idempotency, commutativity, or being ordered; properties that we formally define as follows.

###### Definition 2.2

A semiring is ordered with some transitive ordering $``$, if $`ab`$ or $`ba`$ for all $`a,b\mathrm{IK}`$.

An ordered semiring preserves the order if for all $`a,b,c\mathrm{IK}`$:

$$aba\widehat{+}cb\widehat{+}c,a\widehat{}cb\widehat{}c\text{ and }c\widehat{}ac\widehat{}b.$$

A semiring is commutative if multiplication is commutative.

It is idempotent if addition is idempotent.

It is closed if infinite addition is defined and behaves like finite addition.

Furthermore, we define $`a<b`$ if $`ab`$ and $`ab`$. The supremum $`sup(a,b)`$ of $`a,b\mathrm{IK}`$ is $`a`$ if $`a>b`$ and $`b`$ otherwise, the infimum $`inf(a,b)`$ is $`a`$ if $`a<b`$ and $`b`$ otherwise. To make the notation simpler, we use sometimes $`\mathrm{IK}`$ for the whole semiring and $`ab`$ is used for $`a\widehat{}b`$.

The well known Boolean semiring $`(\mathrm{IB},,,0,1)`$ is order preserving, commutative, idempotent, and closed whereas $`(\mathrm{IR}_0,+,,0,1)`$ is order preserving and commutative, but not idempotent and not closed. The semirings $`(\mathrm{IR}_0\{\mathrm{}\},\mathrm{max},+,\mathrm{},0)`$ and $`(\mathrm{IR}_0\{\mathrm{}\},\mathrm{min},+,\mathrm{},0)`$ are order preserving, idempotent, and commutative, but not closed. However, they are closed if $`\mathrm{}`$ or respectively $`\mathrm{}`$ are added.

###### Definition 2.3

A finite weighted automaton over semiring $`\mathrm{IK}`$ and over a finite alphabet $``$ is a $`4`$ tuple $`𝒜=(𝒮,\alpha ,T,\beta )`$, where

1. $`𝒮=\{0,\mathrm{},n1\}`$ is the finite state space,
2. $`\alpha :𝒮\mathrm{IK}`$ is the initial weight function,
3. $`T:𝒮\times \times 𝒮\mathrm{IK}`$ is the transition function,
4. $`\beta :𝒮\mathrm{IK}`$ is the final weight function.

The transition function $`T`$ computes a transition weight for each label and each pair of states. Independently of the used semiring, $`T(x,a,y)=\mathrm{I0}`$ implies that no $`a`$-labeled transition between state $`x`$ and state $`y`$ exists. However, $`\mathrm{I0}`$ is defined differently in different semirings. Observe that the definition assures that between two states at most one transition exists that is labeled with a fixed label $`a`$. For some automata models, initial and final weight functions are not needed and hence usually not defined. If this is the case, the functions may be substituted by constant $`\mathrm{I1}`$, which is the neutral element according to multiplication; this allows a uniform formal treatment.

###### Example 2.1

We consider a simple model of a driving test to illustrate the concept, Fig. 1 gives an automaton with $`𝒮\{A,B,\mathrm{},H,L\}`$ and $`=\{l,d,f,e\}`$. Let $`L`$ be the initial state, so we define the initialization function $`\alpha (s)=\mathrm{I1}`$ if $`s=L`$ and $`\mathrm{I0}`$ otherwise. When a student starts, he/she takes a couple of lessons, which are transitions with label $`l`$ (lesson). After at least one lesson, the student may be confident to start the test (state $`A`$) and drive around with the examinator (actions with labels $`d`$ for drive). While driving the examinator may decide to finish (actions with label $`f`$) and to assign the desired driver’s license in state $`H`$ (Hooray). Alternatively, the student may make some errors (actions with label $`e`$ for error) that lead him/her to less hopeful situations $`D`$, $`E`$, or $`F`$ where after some further driving the examinator will finally decide to finish (actions with label $`f`$) and to refuse the license. This yields state $`G`$. Hence, the poor student can only return to $`L`$ and take some more lessons. State $`H`$ is the desired result, so we define $`\beta (s)=\mathrm{I1}`$ if $`s=H`$ and $`\mathrm{I0}`$ otherwise. We will consider this example with different semirings and different transition functions (assignment of weights), e.g., the Boolean semiring $`(\mathrm{IB},,,0,1)`$ is useful to ask for existence of paths that lead to a driver’s license (state $`H`$), or whether all paths lead to this state, i.e., if success is guaranteed. For the Boolean semiring, function $`T`$ is defined by assigning $`\mathrm{I1}=1`$ to all arcs present in Fig. 1. $`([0,1],+,,0,1)`$ is useful to achieve a probabilistic model, where actions are randomly selected and one may ask for the probability to succeed. If one asks for trouble, one can use $`(\mathrm{IR}_0\{\mathrm{}\},max,+,\mathrm{},0)`$ to look for the hardest path to success, and $`(\mathrm{IR}_0\{\mathrm{}\},min,+,\mathrm{},0)`$ for the one with minimal stress, given that weights indicate how much energy is necessary to perform that action.

The class of weighted automata is known for a long time in automata theory . The concrete realization defined here has been proposed in . In , a process algebra is presented that is based on the above concepts in the sense that its dynamic behavior yields an automaton with transition weights; however a term in a process algebra may impose an automaton with an infinite number of states. Different semirings yield completely different automata. Before we present some concrete realizations by fixing the semiring, we consider general methods to analyze the behavior of automata with transition weights. The behavior of a weighted automaton considers the weights of paths between states where a path is described by a finite or infinite sequence of transition labels.

To analyze the behavior of an automaton over all paths, we present an approach that is based on vector-matrix computations because this is a convenient approach to compute these results. Since we consider automata over finite state spaces and finite sets of transition labels, each automaton can be described by sets of $`\mathrm{IK}^{n\times n}`$ matrices and $`\mathrm{IK}^n`$ vectors. Thus, we define for each $`a`$ a matrix $`𝐌_a`$ with $`𝐌_a(x,y)=T(x,a,y)`$ and $`𝐌=\widehat{}_a𝐌_a`$ as a matrix that collects all weights independently of the labels. Furthermore, we define a row vector $`𝐚`$ with $`𝐚(x)=\alpha (x)`$ and a column vector $`𝐛`$ with $`𝐛(x)=\beta (x)`$. To complete the notation let, $`𝐈`$ be the $`n\times n`$ identity matrix over semiring $`\mathrm{IK}`$, let $`𝐞_i\mathrm{IK}^n`$ be a row vector with $`\mathrm{I1}`$ in position $`i`$ ($`0i<n`$) and $`\mathrm{I0}`$ elsewhere and let $`𝐞^T`$ be a column vector where all elements equal to $`\mathrm{I1}`$. It is straightforward to define matrix sum and product using the operations of the semiring instead of the usual multiplication and addition.

We start with the analysis of paths and introduce some notations first. We use $`x`$, $`y`$, $`z`$ for states and $`i`$, $`j`$, $`k`$ for running indices in sums or products. A path of automaton $`𝒜`$ is defined as a sequence of states and transitions starting in a state $`x𝒮`$ with $`\alpha (x)\mathrm{I0}`$. In automata theory paths may be defined by sequences of states or transitions or both. We use here a definition that observes transitions via their labels and states. However, the approach can be easily restricted to observe only states or only transitions. Let $`\pi `$ be a path, $`\pi ^s`$ the sequence of states in the path and $`\pi ^t`$ the transition labels. We denote by $`\pi _i^s𝒮`$ ($`i=0,1,2,\mathrm{}`$) the $`i`$-th state in the path and by $`\pi _j^tAct`$ ($`j=1,2,\mathrm{}`$) the $`j`$-th transition label. Thus, $`\pi =(\pi _0^s\pi _1^t\pi _1^s\mathrm{})`$ is a path of automaton $`𝒜`$ if $`T(\pi _i^s,\pi _{i+1}^t,\pi _{i+1}^s)\mathrm{I0}`$. A path might be of infinite or finite length. In the finite case, index $`i`$ runs from $`0`$ to $`|\pi |`$ where $`|\pi |`$ is the length of the path, i.e., the largest index $`i`$ in the path. Let $`\sigma `$ be the set of paths of automaton $`𝒜`$, $`\sigma ^n`$ ($`\sigma ^n`$) the set of paths of length $`n`$ ($`n`$) and $`\sigma _x^n`$ ($`\sigma _x^n`$) the set of paths of length $`n`$ ($`n`$) that start in state $`x`$. For each finite path, we can compute the weights as (ce = costs each)

$$ce(\pi )=\alpha (\pi _0^s)\widehat{}\widehat{}_{i=0}^{|\pi |}T(\pi _i^s,\pi _{i+1}^t,\pi _{i+1}^s)\widehat{}\beta (\pi _{|\pi |}^s)$$
(1)
where $`\widehat{}_{i=1}^Na_i=a_1\widehat{}\mathrm{}\widehat{}a_N`$ and the case of finite $`N`$ might be extended to $`N=\mathrm{}`$, if the semiring is appropriately chosen such that the infinite product can be computed.

If we focus on observing the behavior of an automaton by considering a sequence of labels $`seq=a_1,\mathrm{},a_m`$ with $`a_i`$ for a path $`\pi `$, then one does not want to distinguish among paths $`\pi `$ and $`\pi ^{}`$ that produce the same sequence $`seq`$. The weights summed over all paths with labeling $`seq`$ starting in state $`x`$ are given by (ca = costs all)

$$ca_x(seq)=𝐚(x)\widehat{}(\widehat{}_{i=1}^m𝐌_{a_i})\widehat{}𝐛,$$
(2)
and the weights of all paths of length $`m`$ with an arbitrary labeling is computed as

$$ca_x(^m)=𝐚(x)\widehat{}𝐌^m\widehat{}𝐛^T.$$
(3)
The above computation of weights assumes that a specific initial state is known. Alternatively, one can consider the case that vector $`𝐚`$ defines the weights of initial states. The weights of paths are defined then as

$$ca(seq)=𝐚\widehat{}(\widehat{}_{i=1}^m𝐌_{a_i})\widehat{}𝐛\text{ and }ca(^m)=𝐚\widehat{}𝐌^m\widehat{}𝐛.$$
(4)
Apart from the weights of paths, we consider possible terminating states and the weights of reaching those states. These values are described by a row vector

$$𝐝_{seq}=𝐚\widehat{}(\widehat{}_{i=1}^m𝐌_{a_i}),$$
(5)
such that $`ca(seq)=𝐝_{seq}\widehat{}𝐛`$.

## 3 Valued Computational Tree Logic

The usual way of describing dynamic properties of a system are temporal logics which exist in various forms. Very popular is the branching time logic CTL . CTL formulas are interpreted over labeled transition systems and efficient algorithms for model checking finite systems exist  and have been implemented in software tools . CTL allows us to check properties of paths of an automaton where an all- or existence-quantifier has to precede any path quantifier. Since CTL is defined for transition systems where transitions are not quantified, it cannot be used to derive properties that hold with a certain probability or hold for a specified time. To express such probabilities, the logic has to be extended as done by several authors. The logic RTCTL is described in  as an extension of CTL. RTCTL, in contrast to CTL, allows reasoning about times. Thus, it can be expressed that a property will become true within 50 time units or that a property holds for 20 time units. Time is discrete in this model and one transition takes exactly one time step. In , the logic PCTL is introduced that can be used to describe properties that hold for some time (or after some time) and hold with at least a given probability. Thus, this logic extends RTCTL with respect to probabilities. Formulas of PCTL are interpreted over discrete time Markov chains (DTMCs) and the model checking problem for PCTL is polytime decidable . In this model, time is also discrete and one transition lasts one time step.

In this paper, we extend CTL by defining a logic for weighted automata. This approach is more general than the previous extensions of CTL because it can be applied to a large number of models by defining an appropriate semiring structure for quantifying transition labels. Since our automata model contains transition labels we extend our logic by propositions that allow us to reason over labeled transitions as it is done in Hennesy-Milner logic . In this respect, Valued Computational Tree Logic (CTL$) might not be the natural name for the logic. However, since CTL is included in the logic CTL$ as a special case of automata over the Boolean semiring, we choose this name. We will show later that the approach includes probabilistic systems, although the presented logic is in these cases not completely equivalent to the different logics proposed for the models mentioned above. We will come back to this point in Section 6 where we present concrete realizations of our model. Here, we first define basic CTL$ formulas, introduce informally the semantics of a formula, and define some derived expressions afterwards.

###### Definition 3.1

For a given set of atomic propositions, the syntax of a CTL$ formula for a semiring $`\mathrm{IK}`$ is defined inductively as follows:

* An atomic state proposition $`\mathrm{\Phi }`$ is a CTL$ formula,
* if $`\mathrm{\Phi }_1`$ and $`\mathrm{\Phi }_2`$ are CTL$ formulas, then $`\neg \mathrm{\Phi }_1`$ and $`\mathrm{\Phi }_1\mathrm{\Phi }_2`$ are CTL$ formulas,
* if $`\mathrm{\Phi }`$ is a CTL$ formula and $`p\mathrm{IK}`$, then $`[a]_p.\mathrm{\Phi }`$ is a CTL$ formula, and
* if $`\mathrm{\Phi }_1`$ and $`\mathrm{\Phi }_2`$ are CTL$ formulas, $`t`$ is a nonnegative integer or $`\mathrm{}`$ and $`p\mathrm{IK}`$, then $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ and $`\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$ are CTL$ formulas

where $`\{<,,=,,>\}`$.

Formulas of CTL$ are interpreted over weighted automata. A necessary condition to interpret a formula for an automaton is that both use the same semiring $`\mathrm{IK}`$, which will be assumed in the sequel. Atomic propositions of the kind $`\mathrm{\Phi }:𝒮\mathrm{IB}`$ describe elementary properties that hold or do not hold in a state $`s𝒮`$ of an automaton. The goal of model checking is to compute the set of states for which a CTL$ formula $`\mathrm{\Phi }`$ holds. Before we define formally for which states a formula holds, we present the intuitive meaning of the formulas, i.e., we describe under which conditions formula $`\mathrm{\Phi }`$ holds for state $`x`$.

* An atomic proposition $`\mathrm{\Phi }`$ is true in $`x𝒮`$, if the proposition holds in $`x`$.
* $`\neg \mathrm{\Phi }`$ is true in $`x`$ if $`\mathrm{\Phi }`$ is false in $`x`$; $`\mathrm{\Phi }_1\mathrm{\Phi }_2`$ is true in $`x`$ if $`\mathrm{\Phi }_1`$ or $`\mathrm{\Phi }_2`$ are true in $`x`$.
* $`[a]_p.\mathrm{\Phi }`$ is true in $`x`$ if $`wp`$ holds where $`w`$ denotes the sum of weights of $`a`$-labeled transitions that leave $`x`$ and end in some state where $`\mathrm{\Phi }`$ holds.
* $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ is true in $`x`$, if $`wp`$ holds where $`w`$ denotes the total amount of weights for all paths that 1) start in $`x`$ and 2) fulfill $`\mathrm{\Phi }_1`$ until they reach a state where $`\mathrm{\Phi }_2`$ holds, and 3) perform at most $`t`$ steps for condition 2). This operator ignores those paths that fail on any of the conditions 1) - 3).
* $`\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$ is true in $`x`$, if all paths that 1) start in $`x`$, 2) fulfill $`\mathrm{\Phi }_1`$ until they reach a state where $`\mathrm{\Phi }_2`$ holds, 3) require for this at most $`t`$ steps and for the sum of the weights $`w`$ of all these paths $`wp`$ holds. This operator is more strict than the previous one, it requires all paths to observe conditions 1) - 3).

We use the notations $`x\mathrm{\Phi }`$ if $`x`$ satisfies formula $`\mathrm{\Phi }`$ and $`\neg x\mathrm{\Phi }`$ if this is not the case. The meaning of the first two cases above is obvious. For a formal definition of the last three cases, we make use of a description by vectors and matrices and introduce some additional notations first. Let for some matrix $`𝐑\mathrm{IK}^{n\times n}`$ and two $`CTL\$`$ formulas $`\mathrm{\Phi }_1`$ and $`\mathrm{\Phi }_2`$, $`𝐑[\mathrm{\Phi }_1,\mathrm{\Phi }_2]\mathrm{IK}^{n\times n}`$ be defined as

$$𝐑[\mathrm{\Phi }_1,\mathrm{\Phi }_2](x,y)=\{\begin{array}{cc}𝐑(x,y)\hfill & \text{if }x\mathrm{\Phi }_1\text{ and }y\mathrm{\Phi }_2\hfill \\ \mathrm{I0}\hfill & \text{otherwise}\hfill \end{array}$$

Consequently, matrix $`𝐌[\mathrm{\Phi }_1,\mathrm{\Phi }_2]`$ ($`𝐌_a[\mathrm{\Phi }_1,\mathrm{\Phi }_2]`$) contains all transitions (labeled with $`a`$) that start in a state where $`\mathrm{\Phi }_1`$ holds and end in a state where $`\mathrm{\Phi }_2`$ holds and $`𝐈[\mathrm{\Phi },\mathrm{\Phi }]`$ is a matrix that contains $`\mathrm{I1}`$ in the main diagonal whenever $`\mathrm{\Phi }`$ holds for the corresponding state and all other elements are $`\mathrm{I0}`$. Furthermore, let for some vector $`𝐱`$, $`𝐱[\mathrm{\Phi }]=\mathrm{𝐱𝐈}[\mathrm{\Phi },\mathrm{\Phi }]`$. With these notations, we can formally define the meaning of the presented CTL$-formulas using vectors and matrices rather than considering specific paths.

* $`x[a]_p.\mathrm{\Phi }`$ if and only if $`wp`$ with $`w=𝐞_x𝐌_a𝐞^T[\mathrm{\Phi }]`$.
* $`x\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ if and only if $`wp`$ with

$$w=\{\begin{array}{cc}𝐚(x)𝐞_x\left(\widehat{}_{k=0}^{t1}(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^k\right)\widehat{}𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_2]\widehat{}𝐛[\mathrm{\Phi }_2]\hfill & \text{ if }t>0\hfill \\ 𝐚[\mathrm{\Phi }_2](x)\widehat{}𝐛[\mathrm{\Phi }_2](x)\hfill & \text{ if }t=0\hfill \end{array}$$
* $`x\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$ if and only if $`x\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ and for all $`\pi \sigma _x`$ exists some $`mt`$ such that $`\pi _m^s\mathrm{\Phi }_2\pi _i^s\mathrm{\Phi }_1\neg \pi _i^s\mathrm{\Phi }_2`$ for $`0i<m`$.

If a semiring is ordered, preserves the order by its operations and $`\mathrm{I0}`$ is the infimum of $`\mathrm{IK}`$, then $`a\widehat{+}b=\mathrm{I0}`$ implies $`a=b=\mathrm{I0}`$. In that case, we can equivalently rewrite the condition on paths $`\pi `$ for $`x\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$ by requiring that the sum of weights of paths that contradict the property is $`\mathrm{I0}`$. More formally,

$$\begin{array}{cc}𝐚(x)\widehat{}𝐞_x\widehat{}((\widehat{}_{k=0}^{t1}(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^k)\widehat{}𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\neg \mathrm{\Phi }_1\neg \mathrm{\Phi }_2]\hfill & \\ & \\ \widehat{+}(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^t)\widehat{}𝐞^T\hfill & =\mathrm{I0}\hfill \end{array}$$
(6)
for $`t>0`$. For $`t=0`$, we have $`x\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2x\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$.

CTL$ contains an all but no existence quantifier. The reason for this decision is that the existence quantifier can often be described by the general path quantifier $`U`$ using $`U_{>\mathrm{I0}}^t`$, which indicates for many, but not for all semirings that a path of length $`t`$ exists that observes the required properties. For instance, the boolean semiring is a case where $`U_{>\mathrm{I0}}^t`$ is suitable to decide existence of a path.

Another reason for not introducing an existence quantifier for paths is that in general semirings this quantifier is not indistinguishable under bisimulation. Thus, bisimilar automata (see Sect. 5) still might be distinguished via CTL$ formulas including path quantifiers considering single paths and this is in some sense against the idea of bisimulation and its connection to logics. Note that the quantifier $`AU`$ does not introduce problems for order preserving semirings where $`\mathrm{I0}`$ is the infimum and these semirings will be considered in the algorithms presented below. $`AU`$ is necessary to make CTL$ equivalent to CTL if weighted automata are defined over the Boolean semiring. Since CTL$ shall not be less expressive than CTL, $`AU`$ must be included.

Several other operators can be derived from the basic operators of CTL$ . The basic operators $``$ and $``$ are derived in the obvious way. By help of negation, one can show that for path formulas with $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$, not all operators for comparisons $``$ are essential. We present the relation for $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ and omit index $`p`$, for readability.

$$\begin{array}{cc}\mathrm{\Phi }_1U_<^t\mathrm{\Phi }_2=\neg \left((\mathrm{\Phi }_1U_=^t\mathrm{\Phi }_2)(\mathrm{\Phi }_1U_>^t\mathrm{\Phi }_2)\right)\hfill & \text{ }\mathrm{\Phi }_1U_{}^t\mathrm{\Phi }_2=\neg (\mathrm{\Phi }_1U_>^t\mathrm{\Phi }_2)\hfill \\ & \\ \mathrm{\Phi }_1U_{}^t\mathrm{\Phi }_2=(\mathrm{\Phi }_1U_=^t\mathrm{\Phi }_2)(\mathrm{\Phi }_1U_>^t\mathrm{\Phi }_2)\hfill & \text{ }\mathrm{\Phi }_1U_=^t\mathrm{\Phi }_2=(\mathrm{\Phi }_1U_{}^t\mathrm{\Phi }_2)\neg (\mathrm{\Phi }_1U_>^t\mathrm{\Phi }_2)\hfill \end{array}$$

The last equality shows that we may as well use $`\{>,\}`$ to derive all other relations for $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$. This will be done in the following section because $`>`$ and $``$ can be easily checked in the algorithms.

Similarly, we have the following relation for $`[a]_p`$ where $`p`$ is again omitted for readability.

$$[a]_<=\neg \left([a]_=[a]_>\right),[a]_{}=\neg [a]_>,[a]_{}=[a]_=[a]_>\text{ and }[a]_==[a]_{}\neg [a]_>$$

Again, it is sufficient to consider $`\{>,\}`$.

The following abbreviations are defined by extending the corresponding CTL$ formulas.

* $`AX_p\mathrm{\Phi }=trueAU_p^1\mathrm{\Phi }`$ and $`UX_p\mathrm{\Phi }=trueU_p^1\mathrm{\Phi }`$
* $`AF_p^t\mathrm{\Phi }=trueAU_p^t\mathrm{\Phi }`$ and $`UF_p^t\mathrm{\Phi }=trueU_p^t\mathrm{\Phi }`$.

$`X`$ corresponds to a next operator. $`F`$ denotes a finally operator. Such operators are common syntactical sugar of modal logics.

## 4 Model Checking CTL$ Formulas

To perform model checking in an efficient way, we restrict the semiring used for transition valuation. We assume that the semiring is ordered, that the order is preserved by the operations, and that $`\mathrm{I0}`$ is the infimum of $`\mathrm{IK}`$. Observe that these conditions are satisfied in most practically relevant semirings, e.g., in the examples presented below. To illustrate the point, $`(\mathrm{IR},+,,0,1)`$ is not ordered due to the fact that $`ab`$ does not imply $`acbc`$ if $`c<0`$, but $`(\mathrm{IR}_0,+,,0,1)`$ is ordered. This means that we prohibit negative weights, which is a common and familiar restriction in consideration of automata with transition weights. At the end of the section, we briefly outline when and how model checking can be performed for more general semirings.

We follow other model checking approaches like  and define inductively over the length of a formula how a formula is checked.

* $`leng(\mathrm{\Phi })=1`$ if $`\mathrm{\Phi }`$ is an atomic proposition,
* $`leng(\neg \mathrm{\Phi })=leng(\mathrm{\Phi })+1`$,
* $`leng(\mathrm{\Phi }_1\mathrm{\Phi }_2)=\mathrm{max}(leng(\mathrm{\Phi }_1),leng(\mathrm{\Phi }_2))+1`$,
* $`leng([a]_p.\mathrm{\Phi })=leng(\mathrm{\Phi })+1`$ and
* $`leng(\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2)=leng(\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2)=\mathrm{max}(leng(\mathrm{\Phi }_1),leng(\mathrm{\Phi }_2))+1`$.

As in CTL model checking the set of states satisfying a formula of length $`l`$ is computed after all sets of states that satisfy sub-formulas of length $`<l`$ are known. Computation of the sets of states that observe atomic propositions, $`\neg \mathrm{\Phi }`$, or $`\mathrm{\Phi }_1\mathrm{\Phi }_2`$ is identical to the corresponding computations in CTL. Thus, the new cases are $`[a]_p.\mathrm{\Phi }`$, $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$, and $`\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$. We describe a procedure for each of the three formulas that computes for each state whether it observes the formula or not. We present only cases of $`\{>,\}`$, since the other cases can be derived from these cases as shown above. Let marked($`x`$) be a variable that is true if $`x\mathrm{\Phi }`$ and false otherwise. For the presentation of the algorithms, we use the vector matrix representation of the automaton which is also well suited for an implementation of the algorithms.

#### An algorithm to compute $`[a]_p.\mathrm{\Phi }`$.

for (all $`x𝒮`$) do

marked($`x`$) := false ;

sum := $`\mathrm{I0}`$ ;

for (all $`y`$ with $`𝐌_a(x,y)\mathrm{I0}`$) do

if ($`y\mathrm{\Phi }`$) then

sum := sum $`\widehat{+}𝐌_a(x,y)`$ ;

if (sum $`p`$)

marked($`x`$) := true ;

break ;

The inner for-loop can be left if sum $`p`$ because due to our assumptions the value of sum cannot be reduced according to $``$ or $`<`$.

#### An algorithm to compute $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ for $`t<\mathrm{}`$.

1. for (all $`x𝒮`$) do
2. if ($`x\mathrm{\Phi }_2`$) then
3. $`𝐰(x):=𝐛(x)`$ ;
4. if ($`𝐚(x)\widehat{}𝐛(x)p`$) then
5. marked($`x`$) := true ;
6. else
7. marked($`x`$) := false ;
8. else
9. $`𝐰(x):=\mathrm{I0};`$
10. if ($`\neg x\mathrm{\Phi }_1`$) then
11. marked($`x`$) := false ;
12. else
13. marked($`x`$) := undefined ;
14. $`𝐯:=𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_2]\widehat{}𝐰`$ ;
15. $`𝐮:=𝐯`$ ;
16. for (all $`x𝒮`$ with marked($`x`$) = undefined) do
17. if ($`𝐚(x)\widehat{}𝐮(x)p`$) then
18. marked($`x`$) := true ;
19. $`l:=2;`$
20. while ($`lt`$ and $`x𝒮`$ with marked($`x`$)=undefined) do
21. $`𝐰:=𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]\widehat{}𝐯`$ ;
22. $`𝐮:=𝐮\widehat{+}𝐰`$ ;
23. for (all $`x𝒮`$ with marked($`x`$) = undefined) do
24. if ($`𝐚(x)\widehat{}𝐮(x)p`$) then
25. marked($`x`$) = true ;
26. $`l:=l+1`$ ;
27. $`𝐯:=𝐰`$ ;
28. for (all $`x𝒮`$ with marked($`x`$) = undefined) do
29. marked($`x`$) := false ;

Steps 1 through 13 of the algorithm describe the initialization phase, several special cases are decided directly. A state $`x`$ that satisfies $`\mathrm{\Phi }_2`$ also satisfies $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ if $`𝐚(x)\widehat{}𝐛(x)p`$. If “$``$$`=`$$``$” and $`\neg (𝐚(x)\widehat{}𝐛(x)p)`$ then $`x`$ does not satisfy the formula, because on all paths starting in $`x`$ $`\mathrm{\Phi }_2`$ immediately holds for the first time and the weights of these paths are too small such that the whole formula is false. For states where $`\mathrm{\Phi }_1`$ and $`\mathrm{\Phi }_2`$ both do not hold, the formula is false too. In the remaining cases, it is not clear yet whether the formula holds or not and those states are marked as undefined with respect to this formula. Steps 14 through 18 describe the first transition going from a state where $`\mathrm{\Phi }_1`$, but not $`\mathrm{\Phi }_2`$ holds into a state where $`\mathrm{\Phi }_2`$ holds and check whether the formula becomes true by paths of length one. In the steps 19 through 27, transitions of the automaton between states where $`\mathrm{\Phi }_1`$ but not $`\mathrm{\Phi }_2`$ holds are mimicked step by step. In each step $`l`$, we compute per state $`x`$, where only $`\mathrm{\Phi }_1`$ holds, the sum of weights of paths of length $`l`$ that end in a state where $`\mathrm{\Phi }_2`$ holds and that pass through states where only $`\mathrm{\Phi }_1`$ holds. These weights are collected in vector $`𝐰`$. The weights of all those paths of length of at most $`l`$ are accumulated in vector $`𝐮`$. The iteration stops if $`t`$ steps have been computed, which means that all paths of length $`t`$ have been considered, or if all states are classified, i.e., no state is marked as undefined. After leaving the iteration over all paths of length $`t`$, all states that are still marked undefined do not satisfy the formula because no appropriate path can be found for them. The procedure eventually stops for finite $`t`$.

For $`t=\mathrm{}`$, the situation is different. In principle, we can use the above procedure, but it cannot be assured whether it stops or yields to an infinite computation. The crucial point is the computation of the infinite sum of matrices

$$𝐍[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]=\widehat{}_{k=0}^{\mathrm{}}(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^k.$$

The following relation holds if $`𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]`$ can be reordered to an upper triangular matrix.

$$\widehat{}_{k=0}^{\mathrm{}}(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^k=\widehat{}_{k=0}^n(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^k$$

The relation is true since $`𝐑^k=\mathrm{𝟎}`$ for $`k>n`$ if $`𝐑\mathrm{IK}^{n,n}`$ is an upper triangular matrix. In this case and for $`tn`$

$$x\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2x\mathrm{\Phi }_1U_p^n\mathrm{\Phi }_2$$

such that the above algorithm for finite $`t`$ can be applied for the infinite case as well.

For the general case where $`𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]`$ cannot be reordered to an upper triangular form, computation of $`𝐍[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]`$ requires that the semiring $`\mathrm{IK}`$ is closed and the concrete computation depends on the used semiring. We will give some examples for different semirings below. If $`𝐍[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]`$ is available, then $`\mathrm{\Phi }_1U_p^{\mathrm{}}\mathrm{\Phi }_2`$ can be checked using an extension of the algorithm for the finite case, where the steps 19 through 29 are substituted by the following steps.

$`𝐮:=𝐍[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]\widehat{}𝐯`$ ;

for (all $`x𝒮`$ with marked($`x`$) = undefined) do

if ($`𝐚(x)\widehat{}𝐮(x)p`$) then

marked($`x`$) := true ;

else

marked($`x`$) := false ;

#### An algorithm to compute $`\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$.

To analyze $`x\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$, first $`x\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ has to be proved with the presented algorithm and then (6) has to be checked. Since we restrict ourselves to an order preserving semiring $`\mathrm{IK}`$ with $`\mathrm{I0}`$ as its infimum, the following result holds for $`𝐑\mathrm{IK}^{n,n}`$, $`𝐚,𝐛\mathrm{IK}^n`$.

$$𝐚\widehat{}_{k=0}^{\mathrm{}}𝐑^k𝐛>0𝐚\widehat{}_{k=0}^n𝐑^k𝐛>0$$

The result holds since the existence of a path between two states implies the existence of a path of length $`n`$ between these states (remember that $`|𝒮|=n`$). Thus (6) becomes

$$\begin{array}{cc}𝐚(x)\widehat{}𝐞_x\widehat{}((\widehat{}_{k=0}^{\mathrm{min}(t1,n1)}(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^k)\widehat{}𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\neg \mathrm{\Phi }_1\neg \mathrm{\Phi }_2]\hfill & \\ & \\ \widehat{+}(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^{\mathrm{min}(t,n)})\widehat{}𝐞^T\hfill & =\mathrm{I0}.\hfill \end{array}$$

This relation is checked for $`t>0`$ in the following algorithm where we assume that marked($`x`$) is true if $`x\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ and false otherwise.

1. $`𝐰:=𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\neg \mathrm{\Phi }_1\neg \mathrm{\Phi }_2]\widehat{}𝐞^T`$ ;
2. for (all $`x𝒮`$ with marked($`x`$) = true and $`𝐰(x)>\mathrm{I0}`$) do
3. marked($`x`$) = false ;
4. $`k:=1`$ ;
5. while ($`k<\mathrm{min}(t,n)`$ and $`x`$ with marked($`x`$) = true) do
6. $`𝐰:=𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]\widehat{}𝐰`$ ;
7. for (all $`x𝒮`$ with marked($`x`$) = true and $`𝐰(x)>\mathrm{I0}`$) do
8. marked($`x`$) = false ;
9. $`k:=k+1`$ ;
10. $`𝐰:=𝐞^T[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]`$ ;
11. for ($`k=1`$ to $`\mathrm{min}(t,n)`$) do
12. $`𝐰:=𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]\widehat{}𝐰`$ ;
13. for (all $`x𝒮`$ with marked($`x`$) = true and $`𝐰(x)>0`$) do
14. marked($`x`$) = false ;

The procedure checks both conditions on which $`\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$ may fail separately and requires a finite effort due to the finite summations.

Evaluation of $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ and $`\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$ involves computation of $`𝐑^t`$ and $`\widehat{}_{k=0}^t𝐑^k`$ as subproblems. In the algorithms given so far, those subproblems are solved by successive matrix-vector multiplications, which avoids an explicit computation of $`𝐏=𝐑^t`$ and $`𝐐=\widehat{}_{k=0}^t𝐑^k`$. If the space used to represent $`𝐏`$ or $`𝐐`$ is tolerable for an application, those matrices can be computed with less steps by using iterated squaring if the semiring is idempotent. Iterated squaring is known for long, e.g., to compute a transitive closure of graph which corresponds to the boolean semiring. To compute $`𝐏`$, we can use a binary representation of $`t=_{j=0}^l\delta _j2^j`$ with $`l=log(t)`$ and $`\delta _j\{0,1\}`$ such that $`𝐏=\widehat{}_{j=0,\delta _j=1}^l𝐑^{2^j}`$ and $`𝐑^{2^j}`$ is obtained by computing a sequence $`𝐑,𝐑^{2^1},𝐑^{2^2},\mathrm{},𝐑^{2^l}`$ with $`l`$ matrix-matrix multiplications. Iterated squaring to compute $`𝐏`$ works for semirings in general. In case of an idempotent semiring, we can use that approach for $`𝐐`$ as well. It is straightforward to verify that $`(𝐑+𝐈)^t=\widehat{}_{k=0}^t𝐑^k`$ in case of an idempotent semiring. We briefly recall the argument for this known result. Obviously, the result is true for $`t=0`$. For $`t>0`$, we first use the induction hypothesis and the idempotency of the semiring, in this way we have $`(𝐑+𝐈)^t=(𝐑+𝐈)^{t1}\widehat{}(𝐑+𝐈)=\widehat{}_{k=0}^{t1}𝐑^k\widehat{}(𝐑+𝐈)=\widehat{}_{k=1}^t𝐑^k\widehat{+}\widehat{}_{k=0}^{t1}𝐑^k=\widehat{}_{k=0}^t𝐑^k`$. Hence, for idempotent semirings, we can for instance compute $`\widehat{}_{k=0}^{t1}(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^k`$ and $`(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^t`$ with at most $`log(t)`$ matrix-matrix multiplications and additions.

With the presented algorithms, all formulas of CTL$ can be proved for the class of semirings that has been defined at the beginning of this section. The only missing step is the computation of the matrix $`𝐍[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]`$ which has to be realized specificly for each semiring. In the examples below, we show that computation of this matrix can be done in most interesting semirings with an effort of $`O(n^3)`$ or below. If this is the case, then the effort for checking $`\mathrm{\Phi }_1U_p^{\mathrm{}}\mathrm{\Phi }_2`$ is in $`O(n^3)`$ whereas the effort for checking $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ for finite $`t`$ is in $`O(tn^2)`$. In general, the effort grows linear in $`t`$ and in the length of the formula and it grows at most cubic in the size of the automaton.

Checking CTL$ formulas for more general semirings that are not order preserving requires some restrictions since otherwise an infinite summation may not be computable (for instance in case of divergent sums, non-existence of a fixpoint). Usually, matrix $`𝐍[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]`$ cannot be computed for these semirings such that $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ can only be checked for finite $`t`$. Furthermore, the checking of $`\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$ often cannot be done with the presented algorithm. If we restrict the formulas to those that do not contain $`\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$ and contain $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ only for finite $`t`$, then the proposed algorithms can still be applied for modelchecking given that those parts are removed that terminate a loop due to $`wp`$. All decisions that rely on comparisons $`wp`$ must be delayed to the end of the procedures since values can change in a non-monotonous manner.

## 5 Bisimulation for Weighted Automata

Bisimulation for weighted automata has been introduced in . In , it has been shown that bisimulation is a congruence according to the operations of the process algebra GPA. Here, we briefly rephrase the definition for bisimulation given in  and prove afterwards that bisimilar states of an automaton are indistinguishable under CTL$ formulas.

We consider only equivalence relations as bisimulations. Let $``$ be an equivalence relation on $`𝒮\times 𝒮`$. $`𝒮/`$ is the set of equivalence classes of $``$, $`C𝒮/`$ is an equivalence class of $``$ and $`C[x]`$ is the equivalence class to which state $`x𝒮`$ belongs. If we consider equivalence classes of different equivalence relations $`_i`$, we use $`C__i`$ for an equivalence class from $`𝒮/_i`$. We define for $`C𝒮`$: $`𝐌(x,C)=\widehat{}_{yC}𝐌(x,y)`$.

###### Definition 5.1

An equivalence relation $``$ for an automaton $`𝒜`$ is a bisimulation if and only if $`(x,y)`$, $`C𝒮/`$ and $`a`$:

1. $`\widehat{}_{zC}T(x,a,z)=\widehat{}_{zC}T(y,a,z)`$, equivalently $`𝐌_a(x,C)=𝐌_a(y,C)`$,
2. $`\alpha (x)=\alpha (y)`$, equivalently $`𝐚(x)=𝐚(y)`$,
3. $`\beta (x)=\beta (y)`$, equivalently $`𝐛(x)=𝐛(y)`$, and
4. $`AP(x)=AP(y)`$ where $`AP(x)`$ is the set of atomic propositions satisfied by $`x`$.

We define the union of two bisimulations $`_1`$ and $`_2`$ via the union of their equivalence classes. Thus $`_0=_1_2`$ is characterized by the equivalence classes $`𝒞__0[x]=𝒞__1[x]𝒞__2[x]`$ for all $`x𝒮`$. With this definition the union of bisimulation relations yields a bisimulation relation.

###### Theorem 5.1

Let $`_1`$ and $`_2`$ be two bisimulations for automaton $`𝒜`$, then $`=_1_2`$ is also a bisimulation.

Proof. The proof is a simple extension of the proof in , one needs to consider the additional condition $`AP(x)=AP(y)`$ of Def. 5.1, which is however straightforward. Additionally, $``$ is an equivalence relation since it results from the union of equivalence classes.

Thus, the largest bisimulation for an automaton can be defined as the union of all bisimulations. We use the notation $`xy`$ for $`x,y𝒮`$, if a bisimulation $``$ with $`(x,y)`$ exists. The bisimulation can be extended to compare automata instead of states. This is commonly done for untimed automata as in  but requires slight extensions if applied to the general automata model presented here. Functions $`\alpha `$ and $`\beta `$ require an additional condition. We define the union of automata in the usual sense and bisimulation of automata by means of a bisimulation relation on the union.

###### Definition 5.2

Let $`𝒜_1=(𝒮_1,\alpha _1,T_1,\beta _1)`$ and $`𝒜_2=(𝒮_2,\alpha _2,T_2,\beta _2)`$ be two weighted automata defined over the same semiring $`\mathrm{IK}`$, identical alphabets $``$, and $`𝒮_1𝒮_2=\mathrm{}`$. The union $`𝒜_1𝒜_2`$ is defined as an automaton $`A_0=(𝒮_0,\alpha _0,T_0,\beta _0)`$ with

* $`𝒮_0=𝒮_1𝒮_2`$,
* $`T_0(x,a,y)=\{\begin{array}{cc}T_1(x,a,y)\hfill & \text{if }x,y𝒮_1,\hfill \\ T_2(x,a,y)\hfill & \text{if }x,y𝒮_2,\hfill \\ \mathrm{I0}\hfill & \text{otherwise.}\hfill \end{array}`$
* $`\alpha _0(x)=\alpha _1(x)`$ if $`x𝒮_1`$ and $`\alpha _2(x)`$ for $`x𝒮_2`$, and
* $`\beta _0(x)=\beta _1(x)`$ if $`x𝒮_1`$ and $`\beta _2(x)`$ for $`x𝒮_2`$.

Automata $`𝒜_1`$ and $`𝒜_2`$ are bisimulation equivalent, if a bisimulation relation $``$ exists for $`𝒜_0`$ and for all $`C𝒮/`$:

$$\widehat{}_{xC𝒮_1}\alpha (x)=\widehat{}_{xC𝒮_2}\alpha (x)\text{ and }\widehat{}_{xC𝒮_1}\beta (x)=\widehat{}_{xC𝒮_2}\beta (x)$$

In terms of matrices, $`A_0=𝒜_1𝒜_2`$ yields

$$𝐌_{a}^{}{}_{0}{}^{}=\left(\begin{array}{cc}𝐌_{a}^{}{}_{1}{}^{}\hfill & \mathrm{I0}\hfill \\ \mathrm{I0}\hfill & 𝐌_{a}^{}{}_{2}{}^{}\hfill \end{array}\right)\text{ , }𝐚_0=(𝐚_1,𝐚_2)\text{ , }𝐛_0=\left(\begin{array}{cc}𝐛_1\hfill & \\ 𝐛_2\hfill & \end{array}\right).$$

###### Example 5.2

Driving test, continued. Fig. 2 shows a model which is bisimilar to the one in Fig. 1 provided a semiring is given and functions $`T`$, $`\alpha `$ and $`\beta `$ and sets $`AP`$ are appropriately defined. Let $`AP=\{ok,learn\}`$ and $`AP(x)=\{learn\}x\{A,B,C,D,E,F,G,G^{},L,L^{},ABC,DEF\}`$ and $`AP(x)=\{ok\}`$ for all $`x\{H,H^{}\}`$. So by definition of $`\alpha `$, $`\beta `$, and $`AP`$, we have 3 candidates for equivalence classes $`\{H,H^{}\}`$, $`\{G,G^{},L,L^{}\}`$ and $`𝒮\backslash \{G,G^{},L,L^{},H,H^{}\}`$ to fulfill conditions 2-4 of the definition. By assuming $`T(x,a,y)\mathrm{I0}`$ for all arcs in Figs. 1 and 2 and $`\mathrm{I0}`$ otherwise, we need to partition $`𝒮\backslash \{L,L^{},H,H^{}\}`$ into sets $`\{A,B,C,ABC\}`$ and $`\{D,E,F,DEF\}`$ and to partition $`\{L,L^{},G,G^{}\}`$ into $`\{L,L^{}\}`$ and $`\{G,G^{}\}`$. For the Boolean semiring, addition is $``$ in Def. 5.1, condition 1, so it is straightforward to verify that this partition gives a bisimulation, i.e., $`LL^{},GG^{},HH^{},AABC,BABC,CABC,DDEF,EDEF,`$ and $`FDEF`$. If we choose the semiring $`(\mathrm{IR}_0,+,,0,1)`$, we achieve the same bisimulation if we define $`𝐌_0`$ for example as follows:

|  | L | A | B | C | D | E | F | G | H | L’ | ABC | DEF | G’ | H’ |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| L | $`\frac{1}{2}_l`$ | $`\frac{1}{2}_l`$ |  |  |  |  |  |  |  |  |  |  |  |  |
| A |  |  | $`\frac{1}{3}_d`$ |  | $`\frac{1}{6}_e`$ | $`\frac{1}{6}_e`$ |  |  | $`\frac{1}{3}_d`$ |  |  |  |  |  |
| B |  | $`\frac{1}{6}_d`$ |  | $`\frac{1}{6}_d`$ |  |  | $`\frac{1}{3}_f`$ |  | $`\frac{1}{3}_f`$ |  |  |  |  |  |
| C |  | $`\frac{1}{3}_d`$ |  |  | $`\frac{1}{9}_e`$ | $`\frac{1}{9}_e`$ | $`\frac{1}{9}_e`$ |  | $`\frac{1}{3}_f`$ |  |  |  |  |  |
| D |  |  |  |  |  | $`\frac{1}{2}_d`$ |  | $`\frac{1}{2}_f`$ |  |  |  |  |  |  |
| E |  |  |  |  |  |  | $`\frac{1}{2}_d`$ | $`\frac{1}{2}_f`$ |  |  |  |  |  |  |
| F |  |  |  |  |  |  | $`\frac{1}{2}_d`$ | $`\frac{1}{2}_f`$ |  |  |  |  |  |  |
| G | $`1_l`$ |  |  |  |  |  |  |  |  |  |  |  |  |  |
| H |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
| L’ |  |  |  |  |  |  |  |  |  | $`\frac{1}{2}_l`$ | $`\frac{1}{2}_l`$ |  |  |  |
| ABC |  |  |  |  |  |  |  |  |  |  | $`\frac{1}{3}_d`$ | $`\frac{1}{3}_e`$ |  | $`\frac{1}{3}_f`$ |
| DEF |  |  |  |  |  |  |  |  |  |  |  | $`\frac{1}{2}_d`$ | $`\frac{1}{2}_f`$ |  |
| G’ |  |  |  |  |  |  |  |  |  | $`1_l`$ |  |  |  |  |
| H’ |  |  |  |  |  |  |  |  |  |  |  |  |  |  |

The fractions give the arc weights, while the index indicates the associated label, e.g., $`𝐌_0(L,A)=\frac{1}{2}_l`$ indicates $`T_0(L,l,A)=1/2`$, which corresponds to a transition in the first automaton. Matrix entries that are $`\mathrm{I0}`$ are omitted for clarity.

The following theorem introduces the relation between bisimulation equivalence for weighted automata and CTL$ formulas, which is similar to the relation between bisimulation and CTL in untimed automata.

###### Theorem 5.3

If $`xy`$, then

1. $`x\mathrm{\Phi }y\mathrm{\Phi }`$ for all $`\mathrm{\Phi }`$ which are logical combinations of atomic propositions,
2. $`x[a]_p.\mathrm{\Phi }y[a]_p.\mathrm{\Phi }`$,
3. $`x\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2y\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ and
4. $`x\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2y\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$.

where $`\mathrm{\Phi }_1`$ and $`\mathrm{\Phi }_2`$ are CTL$ formulas.

Proof. 1. holds since $`AP(x)=AP(y)`$ for $`xy`$ such that also all logical combinations of atomic propositions yield identical results.

2. is proved inductively by assuming that for $`xy`$: $`x\mathrm{\Phi }y\mathrm{\Phi }`$. Then $`x[a]_p.\mathrm{\Phi }y[a]_p.\mathrm{\Phi }`$ since $`𝐌_a(x,C)=𝐌_a(y,C)`$. Initially we know that $`AP(z)`$ is the same for all $`zC`$ such that the relation holds for all $`\mathrm{\Phi }`$ which are logical combinations of atomic propositions. By induction the relation also holds for $`\mathrm{\Phi }`$ containing an arbitrary number of constructs of the form $`[a]_p\mathrm{\Phi }`$. For more general formulas we combine the induction used in this step with the induction presented for 3. and 4. below.

3. and 4. have to be proved inductively over the number of occurrences of $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ and $`\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$ in the formula and over the length $`t`$ of the required paths. First assume for $`xy`$:

$$x\mathrm{\Phi }_1y\mathrm{\Phi }_1\text{ and }x\mathrm{\Phi }_2y\mathrm{\Phi }_2$$

which is proved for formulas $`\mathrm{\Phi }_1`$ and $`\mathrm{\Phi }_2`$ that do not contain $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ or $`\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$. Now we prove $`x\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2y\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ inductively over $`t`$. For $`t=0`$ we have:

$$𝐚(x)𝐛(x)=𝐚(y)𝐛(y)$$

such that the formula holds for $`xy`$. Define for $`C𝒮/`$: $`\xi (C)=𝐛(z)`$ for some (all) $`zC`$ and let $`\delta (C,\mathrm{\Phi })=\mathrm{I1}`$ if some (all) $`zC`$: $`z\mathrm{\Phi }`$ and $`\mathrm{I0}`$ otherwise. For $`t=1`$, the following relation holds for $`xy`$ and all $`C𝒮/`$:

$$\begin{array}{cc}𝐚(x)\widehat{}_{zC}𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_2](x,z)𝐛[\mathrm{\Phi }_2](z)\hfill & \\ & \\ 𝐚(x)𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_2](x,C)\xi (C)\delta (C,\mathrm{\Phi }_2)\hfill & =\hfill \\ & \\ 𝐚(y)𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_2](y,C)\xi (C)\delta (C,\mathrm{\Phi }_2)\hfill & =\hfill \\ & \\ 𝐚(y)\widehat{}_{zC}𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_2](y,z)𝐛[\mathrm{\Phi }_2](z)\hfill & \end{array}$$

such that the required property is given for $`t=1`$. Let $`𝐛_C^{}(i)=\widehat{}_{zC}𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_2](i,z)𝐛[\mathrm{\Phi }_2](z)`$ for $`i𝒮`$. So, the aforegoing argumentation ensures that $`𝐛_C^{}(x)=𝐛_C^{}(y)`$ if $`xy`$.

For the induction step, we assume that the relation has been proved for $`t1`$ and we show that it holds for $`t+1`$. To simplify the notation, let $`𝐏=𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]`$, $`𝐐=𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_2]`$, and $`𝐑_t=\left(\widehat{}_{k=0}^t(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^k\right)𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_2]`$. We have to prove that

$$𝐚(x)\widehat{}_{zC}𝐑_t(x,z)𝐛[\mathrm{\Phi }_2](z)=𝐚(y)\widehat{}_{zC}𝐑_t(y,z)𝐛[\mathrm{\Phi }_2](z).$$

Since $`𝐚(x)=𝐚(y)`$ for $`xy`$, we only need to show that

$$\widehat{}_{zC}𝐑_t(x,z)𝐛[\mathrm{\Phi }_2](z)=\widehat{}_{zC}𝐑_t(y,z)𝐛[\mathrm{\Phi }_2](z).$$

Starting from the left side, we obtain by the induction assumption,

$$\begin{array}{cc}\widehat{}_{zC}𝐑_t(x,z)𝐛[\mathrm{\Phi }_2](z)\hfill & =\hfill \\ \widehat{}_{zC}𝐑_{t1}(x,z)𝐛[\mathrm{\Phi }_2](z)\widehat{+}\widehat{}_{zC}\left(𝐏^t𝐐\right)(x,z)𝐛[\mathrm{\Phi }_2](z)\hfill & =\hfill \\ \widehat{}_{zC}𝐑_{t1}(y,z)𝐛[\mathrm{\Phi }_2](z)\widehat{+}\widehat{}_{zC}\left(𝐏^t𝐐\right)(x,z)𝐛[\mathrm{\Phi }_2](z)\hfill & =\hfill \\ \widehat{}_{zC}𝐑_{t1}(y,z)𝐛[\mathrm{\Phi }_2](z)\widehat{+}𝐞_x𝐏^t𝐛_C^{}\hfill & \end{array}$$

At this point, we are done if $`𝐞_x𝐏^t=𝐞_y𝐏^t`$. Obviously, $`xy`$ implies only $`𝐏(x,C^{})=𝐏(y,C^{})`$ for all $`x,yC`$ and all $`C,C^{}𝒮/`$. However, we can show by induction that $`𝐏(x,C^{})=𝐏(y,C^{})=\psi _1(C,C^{})`$ for all $`x,yC`$ and all $`C,C^{}𝒮/`$ implies $`𝐏^k(x,C)𝐏^k(y,C)=\psi _k(C,C^{})`$ for $`k>0`$. By definition, the statement is true for $`k=1`$. So for an inductive argument, we can assume that the result holds for $`k1`$, then we have for an arbitrary $`C𝒮/`$ and all $`x,yC`$:

$$\begin{array}{cccc}𝐏^k(x,C^{})\hfill & =\hfill & \widehat{}_{z𝒮}𝐏(x,z)𝐏^{k1}(z,C^{})\hfill & =\hfill \\ & & & \\ \widehat{}_{C^{\prime \prime }𝒮/}\widehat{}_{zC^{\prime \prime }}𝐏(x,z)𝐏^{k1}(z,C^{})\hfill & =\hfill & \widehat{}_{C^{\prime \prime }𝒮/}\widehat{}_{zC^{\prime \prime }}𝐏(x,z)\psi _{k1}(C^{\prime \prime },C^{})\hfill & =\hfill \\ & & & \\ \widehat{}_{C^{\prime \prime }𝒮/}\psi _1(C,C^{\prime \prime })\psi _{k1}(C^{\prime \prime },C^{})\hfill & =\hfill & \widehat{}_{C^{\prime \prime }𝒮/}\widehat{}_{zC^{\prime \prime }}𝐏(y,z)\psi _{k1}(C^{\prime \prime },C^{})\hfill & =\hfill \\ & & & \\ \widehat{}_{C^{\prime \prime }𝒮/}\widehat{}_{zC^{\prime \prime }}𝐏(y,z)𝐏^{k1}(z,C^{})\hfill & =\hfill & \widehat{}_{z𝒮}𝐏(y,z)𝐏^{k1}(z,C^{})\hfill & =\hfill \\ & & & \\ 𝐏^k(y,C^{})\hfill & & & \end{array}$$

So in summary, we obtain

$$\begin{array}{cc}\widehat{}_{zC}𝐑_t(x,z)𝐛[\mathrm{\Phi }_2](z)\hfill & =\hfill \\ \widehat{}_{zC}𝐑_{t1}(y,z)𝐛[\mathrm{\Phi }_2](z)\widehat{+}𝐞_x𝐏^t𝐛_C^{}\hfill & =\hfill \\ \widehat{}_{zC}𝐑_{t1}(y,z)𝐛[\mathrm{\Phi }_2](z)\widehat{+}𝐞_y𝐏^t𝐛_C^{}\hfill & =\hfill \\ \widehat{}_{zC}𝐑_t(y,z)𝐛[\mathrm{\Phi }_2](z)\hfill & \end{array}$$

and the induction step is complete. This finishes considerations of $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$.

For $`\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$, the above line of argumentation can be used completely analogously to prove

$$\begin{array}{c}𝐚(x)𝐞_x(\widehat{}_{k=0}^{t1}(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^k)𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\neg \mathrm{\Phi }_1\neg \mathrm{\Phi }_2]𝐞^T=\mathrm{I0}\\ \\ 𝐚(y)𝐞_y(\widehat{}_{k=0}^{t1}(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^k)𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\neg \mathrm{\Phi }_1\neg \mathrm{\Phi }_2]𝐞^T=\mathrm{I0}\end{array}$$

and

$$𝐚(x)𝐞_x(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^t𝐞^T=\mathrm{I0}𝐚(y)𝐞_y(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^t𝐞^T=\mathrm{I0}$$

which proves $`x\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2y\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$. We omit the details, since they provide no further insight.

Finally, to prove $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ and $`\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$ for general $`\mathrm{\Phi }_1`$ and $`\mathrm{\Phi }_2`$, we again use induction, namely over the number of occurrences of $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ or $`\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$ in a formula. Note that in the aforegoing argumentation, we did not use any other assumption for $`\mathrm{\Phi }_1`$ and $`\mathrm{\Phi }_2`$ than that $`x\mathrm{\Phi }_1y\mathrm{\Phi }_1\text{ and }x\mathrm{\Phi }_2y\mathrm{\Phi }_2`$. Since this assumption holds here again by the induction assumption we can simply repeat the argumentation for $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ and $`\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$ above for the induction step.

The above theorem shows that one cannot distinguish between bisimilar states or automata by model checking CTL$ formulas. Thus, an automaton can be first reduced according to bisimulation equivalence to gain efficiency in subsequent model checking algorithms. For this purpose, first relation $``$ is computed, which can be done by a partition refinement algorithm, and then each equivalence class of $``$ is substituted by a single state, which yields an aggregated automaton . Afterwards, formulas are checked with the aggregated instead of the original automaton. In , it is shown that bisimulation is a congruence according to the composition operators of the process algebra GPA, which allows compositional analysis by interleaving reduction of components due to bisimulation equivalence and composition of components. In this way, a reduced automaton is generated to which model checking is applied.

## 6 Examples of automata with specific semirings

We present six examples in the following subsections. Two of the examples describe known types of automata which are presented in the proposed framework. In these cases we show that CTL$ model checking is related to logics presented specifically for these automata types. Afterwards we present new approaches for model checking.

### 6.1 Untimed automata

Untimed automata are defined over the semiring $`(\mathrm{IB},,,0,1)`$. For these automata $`\alpha (x)=1`$ for initial states and $`\alpha (x)=0`$ for the remaining states. Similarly, $`\beta (x)=1`$ for terminating states and $`0`$ for the remaining states. $`T(x,a,y)=1`$ describes the existence of an $`a`$-labeled transition between $`x`$ and $`y`$. The Boolean semiring is ordered ($`0<1`$), the order is preserved by the operations and $`0`$ is the infimum. Therefore the conditions we proposed for model checking are observed. In the Boolean case all paths have the same weights, namely $`1`$.

For untimed automata CTL is a logic which is often used for model checking. We now show how the path formulas of CTL can be expressed by CTL$. State formulas defined via atomic propositions are obviously identical in both cases.

| CTL | CTL$ |
| --- | --- |
| $`EX\mathrm{\Phi }`$ | $`trueU_{>0}^1\mathrm{\Phi }`$ |
| $`AX\mathrm{\Phi }`$ | $`trueU_{>0}^1\mathrm{\Phi }`$ |
| $`A[\mathrm{\Phi }_1U\mathrm{\Phi }_2]`$ | $`\mathrm{\Phi }_1AU_{>0}^{\mathrm{}}\mathrm{\Phi }_2`$ |
| $`E[\mathrm{\Phi }_1U\mathrm{\Phi }_2]`$ | $`\mathrm{\Phi }_1U_{>0}^{\mathrm{}}\mathrm{\Phi }_2`$ |
| $`AF\mathrm{\Phi }`$ | $`trueAU_{>0}^{\mathrm{}}\mathrm{\Phi }`$ |
| $`EF\mathrm{\Phi }`$ | $`trueU_{>0}^{\mathrm{}}\mathrm{\Phi }`$ |
| $`AG\mathrm{\Phi }`$ | $`\neg (trueU_{>0}^{\mathrm{}}\neg \mathrm{\Phi }_1)`$ |
| $`EG\mathrm{\Phi }`$ | $`\neg (trueAU_{>0}^{\mathrm{}}\neg \mathrm{\Phi }_1)`$ |

For the detailed description of the CTL-formulas see . It is easy to show that for the Boolean case the model checking algorithms proposed above all have a finite runtime because for $`\mathrm{\Phi }_1EU_p^t\mathrm{\Phi }_2`$, $`\mathrm{\Phi }_1AU_p^t\mathrm{\Phi }_2`$ and $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ are identical for all $`tn`$. The reason for this behavior is that for an automaton with $`n`$ states between two states a path of length $`n`$ or no path exists and since additionally all paths have the same weights and addition is idempotent, it is sufficient to consider paths up to length $`n`$ if no longer paths have been defined explicitly via concatenation of $`[a]`$ in the formulas. Consequently, the following relation holds for the Boolean semiring.

$$𝐍[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]=\widehat{}_{k=0}^{\mathrm{}}(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^k=\widehat{}_{k=0}^n(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^k$$

For the representation of CTL formulas using CTL$, paths of arbitrary length are considered. However, by considering paths of finite length and assuming that each transition of the automaton has a duration of one time unit, real time properties can be proved by CTL$ model checking. In this case CTL$ can be used to mimic formulas of the real time logic RTCTL .

###### Example 6.1

We consider the driving test example shown in Fig. 1 over the Boolean semiring. In this case, each arc in the graph describes a transition with weight $`1`$. Since for the Boolean case bisimilar automata cannot be distinguished by CTL$, model checking can be performed using the aggregated automaton shown in Fig. 2.

Since $`L^{}`$ is the only initial state of the automaton, we have to prove whether a formula holds for $`L^{}`$. Formula $`(trueU_{>0}^{\mathrm{}}ok)`$ states that it is possible to pass the driving examination in an arbitrary number of steps. This formula is obviously satisfied by $`L^{}`$. The shortest path satisfying the formula start in $`L^{}`$ passes $`ABC`$ and then enters $`H^{}`$. Thus, also the formula $`(trueU_{>0}^tok)`$ is satisfied by $`L^{}`$ for all $`t>1`$ which means that the driving examination can be passed in 2 steps. The formula $`(trueAU_{>0}^{\mathrm{}}ok)`$ states that the examination is always passed. This formula is not satisfied by $`L^{}`$ because paths of infinite length exist which do not reach $`H^{}`$. Consequently, also formula $`(trueAU_{>0}^tok)`$ does not hold for $`L^{}`$.

In the Boolean semiring it is not possible to determine more detailed results about reaching state $`H^{}`$. We can only state that a path exists which reaches $`H^{}`$ and that not all paths reach $`H^{}`$. CTL$ allows us to derive results about the length of the path reaching $`H^{}`$ but not about the quantification of paths because the $`U`$ operator equals $`EU`$ in the Boolean semiring. This is different in the other semirings, we consider in the subsequent paragraphs.

### 6.2 Probabilistic automata

Probabilistic automata are defined over the semiring $`(\mathrm{IR}_0,+,,0,1)`$ with the additional restrictions

$$\begin{array}{c}_{x𝒮}\alpha (x)=1,\\ \\ _a_{y𝒮}T(x,a,y)=1\text{ for all }x𝒮.\end{array}$$

A probability distribution is defined as the initial distribution and the sum of transition probabilities leaving a state is $`1`$. These restrictions define a generative probabilistic model in the sense of  because the automaton decides probabilistically which transition occurs next. Additionally, the automata model is similar to the model presented in  with additional possibility of labeling transitions. Probabilistic automata are ordered, the order is preserved by the operations and $`0`$ is the infimum which implies that model checking can be applied for this automata type.

For probabilistic automata the logic PCTL has been proposed in . This logic contains, apart from state propositions and logical combinations of state propositions, the path quantifier $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ with a similar semantics as in CTL$. For finite $`t`$, the following relation between the path formulas $`U`$ and $`AU`$ holds in probabilistic systems.

$$\begin{array}{c}x\mathrm{\Phi }_1U_1^t\mathrm{\Phi }_2x\mathrm{\Phi }_1AU_1^t\mathrm{\Phi }_2\end{array}$$

The above relation does not necessarily hold for $`t=\mathrm{}`$ as shown in the example below.

Now we consider CTL$ model checking for probabilistic automata. Interesting are the formulas $`\mathrm{\Phi }_1U_p^{\mathrm{}}\mathrm{\Phi }_2`$. For the remaining cases the algorithms presented in section 4 can be used because they require in these cases a finite number of steps. For the formulas with $`t=\mathrm{}`$, matrix $`𝐍[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]`$ has to be computed first which can be done as shown in the following theorem.

###### Theorem 6.2

State $`x𝒮`$ satisfies formula $`\mathrm{\Phi }_1U_p^{\mathrm{}}\mathrm{\Phi }_2`$ if $`𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_2]`$ is a substochastic matrix without a stochastic submatrix and

$$\begin{array}{cc}𝐚(x)(\stackrel{~}{}_{k=0}^{\mathrm{}}(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^k)𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_2]𝐛[\mathrm{\Phi }_2]\hfill & =\hfill \\ & \\ 𝐚(x)\left(𝐈𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]\right)^1𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_2]𝐛[\mathrm{\Phi }_2]\hfill & p\hfill \end{array}$$

Proof. The matrix representation of the formula has already been introduced. The relation

$$\underset{k=0}{\overset{\mathrm{}}{}}\left(𝐈𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]\right)^k=\left(𝐈𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]\right)^1$$

is well known for absorbing Markov chains  under the conditions stated in the theorem.

The theorem contains a method to decide for which states $`\mathrm{\Phi }_1U_p^{\mathrm{}}\mathrm{\Phi }_2`$ holds. If $`𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]`$ contains a stochastic submatrix, then there exists a subset of states where $`\mathrm{\Phi }_1`$ but not $`\mathrm{\Phi }_2`$ holds and this subset of states forms a trap according to the formula, i.e., the automaton can never leave the subset after entering it. Obviously $`\mathrm{\Phi }_1U_p^{\mathrm{}}\mathrm{\Phi }_2`$ cannot be satisfied in these states and each path entering the subset does not count when path weights are summed. Thus, for subsets of states forming a stochastic submatrix, the rows in $`𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]`$ might be set to $`\mathrm{𝟎}`$ to compute the result. After this modification the inverse matrix exists and the set of states satisfying $`\mathrm{\Phi }_1U_p^{\mathrm{}}\mathrm{\Phi }_2`$ can be computed in finitely many steps.

###### Example 6.3

For the probabilistic case, we consider the driving test example with probabilities given in Examp. 5.2 where also a bisimilar automaton with less states is presented. We can check the smaller aggregated automaton and consider the formula ($`trueU_p^{\mathrm{}}ok`$) which is true if the test is passed with probability of at least $`p`$ in an arbitrary number of steps. State $`L`$ satisfies the formula if

$$𝐚(L^{})\underset{k=0}{\overset{\mathrm{}}{}}\left(𝐓[true,ok]\right)^k\left(𝐛[ok]\right)p$$

holds. Using the ordering of states $`(L^{},ABC,DEF,G^{},H^{})`$ as given in 5.2 we obtain the following matrices and vectors.

$$𝐚=(1,0,0,0,0),𝐛[ok]=(0,0,0,0,1)^T$$

$$𝐓[true,ok]=\left(\begin{array}{ccccc}1/2& 1/2& 0& 0& 0\\ 0& 1/3& 1/3& 0& 1/3\\ 0& 0& 1/2& 1/2& 0\\ 1& 0& 0& 0& 0\\ 0& 0& 0& 0& 0\end{array}\right)$$

$$\left(𝐈𝐓[true,ok]\right)^1=\left(\begin{array}{ccccc}4& 3& 2& 1& 1\\ 2& 3& 2& 1& 1\\ 4& 3& 4& 2& 1\\ 4& 3& 2& 2& 1\\ 0& 0& 0& 0& 1\end{array}\right)$$

and

$$𝐚\left(𝐈𝐓[true,ok]\right)^1\left(𝐛[ok]\right)^T(1,1,1,1,1)1$$

which implies that the formula is observed for all $`p1`$. This means that after an arbitrary number of steps the driving test will be passed with probability $`1`$. However, $`\neg L^{}trueAU_p^{\mathrm{}}ok`$ for all $`p`$. The example nicely shows that probability $`1`$ does not mean that the result holds for all paths. This result is, of course, well known from probability theory.

### 6.3 Max/plus automata

Max/plus automata are defined over the completed semiring $`(\mathrm{IR}_0\{\mathrm{},\mathrm{}\},\mathrm{max},+,\mathrm{},0)`$ with the computation $`a\widehat{+}\mathrm{}=\mathrm{max}(a,\mathrm{})=a`$ and $`a\widehat{}0=a+0=a`$. The weights of a path in max/plus correspond to the sum of weights of each transition on the path because multiplication is represented by the usual addition. If we consider several paths, then the maximum operator computes the weights of the path with the highest weights. Max/plus automata can be applied for various analysis purposes including the analysis of real time systems or communications networks and became very popular in the recent years. The max/plus semiring is ordered according to the usual ordering $`ab\mathrm{max}(a,b)=b`$. Furthermore, the order is preserved by the operations and $`\mathrm{I0}`$, in this case $`\mathrm{}`$ is the infimum of the semiring. In the definition of the transition function $`T`$, $`\mathrm{}`$ is used to denote that an arc does not exist, which is the common usage of element $`\mathrm{I0}`$. We can directly apply our model checking approach.

Computation of the matrix $`𝐍[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]`$ requires the analysis of cycles in the matrix $`𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]`$. $`x_1,\mathrm{},x_K`$ is a cycle if $`𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2](x_k,x_{k+1})\mathrm{I0}`$ ($`1k<K`$) and $`x_1=x_K`$. The cycle has a positive weight if $`\widehat{}_{k=1}^{K1}𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2](x_k,x_{k+1})>0`$. It is well known that all cycles can be generated by composing minimal cycles and minimal cycles can be computed using some standard algorithms from graph theory. Element $`𝐍[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2](x,y)=\mathrm{}`$, if a minimal cycle with a positive weight that contains arc $`(x,y)`$ exists. The remaining elements in matrix $`𝐍[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]`$, which are not $`\mathrm{}`$ can be computed from $`\widehat{}_{k=0}^n(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^k`$.

###### Example 6.4

For this semiring, we need a different selection of $`T(x,a,y)`$ to achieve bisimilar automata in Figs. 1 and 2, since the maximal values of outgoing arcs of bisimilar states leading to the same class of states need to be equal. We select the following values which may be interpreted as distances the student has to drive or a quantification of the amount of stress he/she has to suffer. Matrix elements that are $`\mathrm{I0}`$ and transition labels are omitted for clarity.

|  | L | A | B | C | D | E | F | G | H | L’ | ABC | DEF | G’ | H’ |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| L | 1 | 2 |  |  |  |  |  |  |  |  |  |  |  |  |
| A |  |  | 3 |  | 6 | 9 |  |  | 3 |  |  |  |  |  |
| B |  | 1 |  | 3 |  |  | 9 |  | 3 |  |  |  |  |  |
| C |  | 3 |  |  | 9 | 4 | 7 |  | 3 |  |  |  |  |  |
| D |  |  |  |  |  | 2 |  | 1 |  |  |  |  |  |  |
| E |  |  |  |  |  |  | 2 | 1 |  |  |  |  |  |  |
| F |  |  |  |  |  |  | 2 | 1 |  |  |  |  |  |  |
| G | 1 |  |  |  |  |  |  |  |  |  |  |  |  |  |
| H |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
| L’ |  |  |  |  |  |  |  |  |  | 1 | 2 |  |  |  |
| ABC |  |  |  |  |  |  |  |  |  |  | 3 | 9 |  | 3 |
| DEF |  |  |  |  |  |  |  |  |  |  |  | 2 | 1 |  |
| G’ |  |  |  |  |  |  |  |  |  | 1 |  |  |  |  |
| H’ |  |  |  |  |  |  |  |  |  |  |  |  |  |  |

For instance, $`AABC`$ since $`T(A,d,B)=3=T(ABC,d,ABC)`$, $`max(T(A,e,D),T(A,e,E))=9=T(ABC,e,DEF)`$, and $`T(A,f,H)=3=T(ABC,f,H^{})`$ and further conditions of Def. 5.1 with respect to $`\alpha `$, $`\beta `$ and $`AP`$ hold as well.

In this semiring, CTL$ considers the most costly (or stressful) ways to a driver’s license exist. E.g. one can compute by the algorithm given in Sec. 4 that $`LtrueU_{21}^9ok`$ holds due to path $`\pi `$ through states $`L,A,E,G,L,A,B,H`$ with $`ce(\pi )=21`$. For model checking we can use the bisimilar automaton given above, which contains less states and less arcs. So we check $`L^{}trueU_{21}^9ok`$ which holds due to path $`\pi ^{}`$ through states $`L^{},ABC,EFG,G^{},L^{},ABC,ABC,H`$. Both paths are of same length and have the same weights.

### 6.4 Min/plus automata

The min/plus approach is very similar to the max/plus approach. It is applied if one is interested in minimal weights instead of maximal weights. It is defined on the semiring $`(\mathrm{IR}_0\{\mathrm{}\},min,+,\mathrm{},0)`$ with an inverse order, i.e. addition becomes minimum $`x\widehat{+}y=min(x,y)`$, multiplication becomes addition $`x\widehat{}y=x+y`$, and $`x`$, $`y`$ are ordered $`xy`$ iff $`x=min(x,y)`$. The semiring preserves the order and $`\mathrm{I0}=\mathrm{}`$ is the infimum. Working with an inverse order is formally correct but rather contrary to intuition. Note that the inverse order of min/plus is the reason to use the notion of infimum and supremum rather than minimum and maximum in this paper. This avoids reformulation of the algorithms. Model checking algorithms can be applied analogously as for max/plus automata.

Computation of the matrix $`𝐍[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]`$ is easier for min/plus than for max/plus. The reason is that minimal weights count. Since a cycle cannot reduce the weight of a path we have, as in the Boolean semiring

$$𝐍[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]=\widehat{}_{k=0}^{\mathrm{}}(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^k=\widehat{}_{k=0}^n(𝐌[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2])^k$$

### 6.5 Max/min automata

The semiring $`(\mathrm{IR}_0\{\mathrm{}\},max,min,0,\mathrm{})`$ is useful to identify paths with respect to bottlenecks, since the weight of a path gives the minimum value observed through all of its arcs. We consider a communication network as an example. A weighted automaton models the network by using nodes for hubs and arcs for links between hubs. Each hub shows a certain utilization and each link has a bandwidth as a non-negative real number assigned to it. If there is no link between two nodes, we assume an arc with weight $`0`$. In order to establish a point to point communication, we are interested in the existence of a connection between two nodes $`x_{start}`$ and $`x_{end}`$ that has a minimum bandwidth $`\mu `$, uses less than $`\lambda `$ intermediate nodes and the employed nodes should have a utilization less than $`\gamma `$ to avoid saturated or overloaded nodes.

To express this in CTL$, we first define atomic propositions $`\mathrm{\Phi }_1`$ and $`\mathrm{\Phi }_2`$ as follows. A node $`x\mathrm{\Phi }_1`$ if and only if its utilization is less than $`\gamma `$. A node $`x\mathrm{\Phi }_2`$ if and only if it is node $`x_{end}`$. The following formula describes the property we are interested in $`\mathrm{\Phi }=\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ with $`p=\mu `$, $`t=\lambda `$. Model checking the automata by the algorithm for $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ given in Section 4 provides us with information whether $`x_{starts}\mathrm{\Phi }`$ or not. Note that the semiring is ordered, the operations preserve the order and $`\mathrm{I0}=0`$ is the infimum.

Computation of the matrix $`𝐍[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]`$ is easy in the max/min semiring because the weight of a path is determined by minimum weight of an arc on this path such that cycles cannot increase the weight of a path and $`𝐍[\mathrm{\Phi }_1\neg \mathrm{\Phi }_2,\mathrm{\Phi }_1\neg \mathrm{\Phi }_2]`$ can be computed by finite summation like for the Boolean semiring or the min/plus semiring.

### 6.6 The expectation semiring

In this subsection, we consider a semiring which is more complex than the previous and outline how our modelchecking approach can be extended to analyze also this system. However, the extension requires some additional steps. The proposed semiring is motivated by a semiring given in  and allows the simultaneous computation of path probabilities and expected values of a set of paths. A value in the expectation semiring consists of two components $`(p,v)`$ with $`p,v\mathrm{IR}_0`$. The operations are defined as

$$(p_1,v_1)\widehat{}(p_2,v_2)=(p_1p_2,v_1+v_2)\text{ and }(p_1,v_1)\widehat{+}(p_2,v_2)=(p_1+p_2,(p_1v_1+p_2v_2)/(p_1+p_2))$$

where $`0/0=0`$. We have $`\mathrm{I0}=(0,0)`$ and $`\mathrm{I1}=(1,0)`$. Furthermore, we define the ordering $``$ with $`(p_1,v_1)(p_2,v_2)`$ if $`p_1p_2`$ and $`v_1v_2`$. Observe that this defines only a partial order since elements exist where neither $`(p_1,v_1)(p_2,v_2)`$ nor $`(p_1,v_1)(p_2,v_2)`$ holds. The semiring is commutative because multiplication is commutative, it is not idempotent, and it is also not order preserving.

Assume that we have an automaton over the expectation semiring where all transitions are labeled with a single label which will be suppressed in the sequel. As in probabilistic automata, let the sum of the first components $`p_i`$ of the weights $`(p_i,v_i)`$ of transitions $`i=1,2,\mathrm{}`$ that leave a state be smaller or equal to $`1`$. Thus, the first values form a probability distribution of choosing a successor state, the second components might be interpreted as the costs of a transition. Assume that $`\alpha (s)=\mathrm{I1}=(1,0)`$ for one state, the initial state. Assume further that a predicate $`\mathrm{\Phi }_2`$ for one state $`s^{}`$ with $`\beta (s^{})=\mathrm{I1}`$. Formula $`trueU_{(p,v)}^t\mathrm{\Phi }_2`$ holds if the probability of reaching the final state from the initial state in at most $`t`$ steps is at least $`p`$ and the expected costs are smaller or equal $`v`$. Similarly $`\mathrm{\Phi }_1U_p^t\mathrm{\Phi }_2`$ holds if only nodes are touched where $`\mathrm{\Phi }_1`$ holds on the way from the initial state to the final state, the remaining conditions are as in the previous case. For finite $`t`$ the formulas can be checked with the proposed algorithms after some modifications that change all parts which are based on the order preserving property of the semiring.

For this specific semiring, even results for $`t=\mathrm{}`$ may be checked but this requires some tools from the analysis of Markov processes which are beyond the scope of this paper.

The introduction of this rather unconventional semiring shows that the proposed method modelchecking approach can be extended to a very large class of models by using sophisticated semirings. However, if these semirings do not fall into the basic class defined at the beginning of section 4, model checking algorithms have to be adjusted specifically to their properties.

## 7 Conclusions

We present a general approach for model checking weighted automata which covers classical types of automata like untimed or probabilistic automata as well as new types like max/plus and min/plus automata. The key idea is that transitions weights can be taken of an arbitrary ordered semiring which is an algebraic structure of very modest requirements. We present a modal logic CTL$ for this class of models that is build on top of CTL and allows to specify paths with respect to their length and weights. This yields a generic approach where new, different semirings automatically profit from algorithms and results derived for the general case, e.g. we present a bisimulation for CTL$ that is subsequently used to modelcheck an example under various weight assignments of different semirings. So far we presented analysis algorithms based on graphs assuming an explicit representation of states. This was for clarity and to limit the scope of the paper. Clearly, large state spaces are better treated by a symbolic representation. In the special case of the boolean semiring, binary decision diagrams (BDDs) and corresponding algorithms  are sufficient. However the general case requires the treatment of numerical values, such that corresponding extensions of BDDs like multi-terminal BDDs as in  for instance are more appropriate. Furthermore, compositional representations as in  and compositional model checking are interesting candidates for modelchecking CTL$.

Advantages of the approach presented here are foreseen for building analysis tools and to allow for model checking in different application areas like realtime scheduling and logistic networks. The latter is in the focus of a large DFG-funded collaborative research centre (SFB 559), with significant interest in modelchecking. The development of tools profits from our approach since it nicely matches an object oriented design, where model checkers of specific semirings can inherit functionality from an implementation of the general case. We currently work to integrate this approach into an existing CTL modelchecker within the APNN toolbox .