Professional Documents
Culture Documents
feature expression, each individual transition can be enabled when we extend techniques from weighted automata to featured weighted
some features are present, and disabled for other sets of features. automata, i.e., weighted automata in which the transitions are an-
The behavior of a featured transition system hence depends on a notated with feature expressions. This extension makes it possible
given set of features. There are algorithms for featured transition to check quantitative properties for all sets of features at once.
systems which can check their properties for all sets of features at To be precise, a featured transition system induces a (projec-
once, for example for LTL or CTL properties. tion) function from sets of features to transition systems, mapping
Here we introduce a model of featured weighted automata which each set of features to the behavior under these features. Similarly,
combines featured transition systems and (semiring-) weighted au- we will define projections of featured weighted automata, map-
tomata. We show that methods and techniques from weighted ping sets of features to weighted automata. Values of weighted
automata extend to featured weighted automata and devise algo- automata are an abstract encoding of their behavior; we will see
rithms to compute quantitative properties of featured weighted au- how to compute values of featured weighted automata as functions
tomata for all sets of features at once. We show applications to from feature expressions to behaviors.
minimum reachability and to energy properties. We also develop an application of our techniques to featured en-
ergy problems. Energy problems are important in areas such as em-
ACM Reference format: bedded systems or autonomous systems. They are concerned with
Uli Fahrenberg and Axel Legay. 2017. Featured Weighted Automata. In
the question whether a given system admits infinite schedules dur-
Proceedings of FormaliSE, Buenos Aires, Argentina, May 2017, 9 pages.
DOI: 10.1145/nnnnnnn.nnnnnnn
ing which (1) certain tasks can be repeatedly accomplished and (2)
the system never runs out of energy (or other specified resources).
Starting with [3], formal modeling and analysis of such problems
1 INTRODUCTION has attracted some attention [2, 4, 5, 9, 14, 18, 22].
A featured transition system [6] is a transition system in which the Featured transition systems have applications in software prod-
transitions are annotated with feature expressions: Boolean expres- uct lines, where they are used as abstract representations of the
sions involving a finite number of given features. Depending on behaviors of variability models [23]. This representation allows
its feature expression, each individual transition can be enabled one to analyze all behaviors of a software product line at once, as
when some features are present, and disabled for other sets of fea- opposed to analyzing each product on its own. Similarly, featured
tures. For any set of features, a given featured transition system weighted automata can be used as abstract representations of quan-
projects to a transition system which contains precisely the transi- titative behaviors of software product lines, and the present work
tions which are enabled for that set of features. enables analysis of quantitative behaviors of all products in a soft-
Standard problems such as reachability or safety can be posed ware product line at once.
for featured transition systems, where the interest now is to check Contributions and structure of the paper. We start in Sect. 2 by re-
these properties for all sets of features at once. Hence, for example visiting minimum reachability in featured transition systems with
for reachability, given a featured transition system and a set of ac- transitions weighted by real numbers. This has to some extent al-
cepting states, one wants to construct a feature expression ϕ such ready been done in [8], but we reformulate it in order to prepare
that an accepting state is reachable iff the set of features satisfies for the generalization in the following sections.
ϕ. In Sect. 3, we introduce featured weighted automata and show
some first examples. Instead of semirings, we will work with (fea-
∗ Mostof this work was carried out while this author was still employed at Inria tured) automata weighted in ∗ -continuous Kleene algebras; this is
Rennes.
for convenience of presentation only, and all our work (except
Permission to make digital or hard copies of all or part of this work for personal or for Sect. 5) can be extended to a more general (for example non-
classroom use is granted without fee provided that copies are not made or distributed idempotent) setting. In Sect. 4, we then show how methods and
for profit or commercial advantage and that copies bear this notice and the full cita- techniques from weighted automata can be transferred to featured
tion on the first page. Copyrights for components of this work owned by others than
ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or re- weighted automata.
publish, to post on servers or to redistribute to lists, requires prior specific permission In the last Sect. 5, we extend our results to develop an applica-
and/or a fee. Request permissions from permissions@acm.org.
tion to featured energy problems. This is based on the recent result
FormaliSE, Buenos Aires, Argentina
c 2017 ACM. 978-x-xxxx-xxxx-x/YY/MM. . . $15.00 in [13] that energy problems can be stated as Büchi problems in
DOI: 10.1145/nnnnnnn.nnnnnnn automata weighted in ∗ -continuous Kleene ω-algebras, which are
FormaliSE, May 2017, Buenos Aires, Argentina Uli Fahrenberg and Axel Legay
1: Input: real-weighted featured automaton F = (S, I , F ,T ,γ ) analysis of featured weighted automata, and to re-use our tech-
with S = {s 1 , . . . , sn } niques developed in the previous section to solve quantitative prob-
2: Output: function |F | ∈ GP[ ≥0 ] R lems in other concrete settings.
3: R
var D : {1, . . . , n} × {1, . . . , n} → GP[ ≥0 ]
3.1 Weighted Automata
4: var P, f
5: for i ← 1 to n do Recall that a semiring [10] K = (K, , , 0, 1) consists of a com-
6: for j ← 1 to n do mutative monoid (K, , 0) and a monoid (K, , 1) such that the
7: dom(D(i, j)) ← {tt} distributive and zero laws
8: D(i, j)(tt) ← ∞
9: for all (si , x, s j ) ∈ T do x(y z) = xy xz (y z)x = yx zx 0x = 0 = x 0
10: for all γ ∈ dom(D(i, j)) do
11: if Jγ ∧ γ (si , x, s j )K , ∅ and D(i, j)(γ ) > x then hold for all x, y, z ∈ K (here we have omitted the multiplication
12: Split(D(i, j),γ , γ (si , x, s j ), x) sign in some expressions, and we shall also do so in the future).
It follows that the product distributes over all finite sums.
13: for i ← 1 to n do A (finite) weighted automaton [10] over a semiring K (or a K-
14: for j ← 1 to n do weighted automaton for short) is a tuple S = (S, I , F ,T ) consisting
15: for k ← 1 to n do of a finite set S of states, a subset I ⊆ S of initial states, a subset
16: Relax(i, j, k) F ⊆ S of accepting states, and a finite setT ⊆ S ×K ×S of transitions.
17: P ← {tt}; f (tt) ← ∞ A finite path in such a K-weighted automaton S = (S, I , F ,T ) is
18: for all si ∈ I do a finite alternating sequence π = (s 0 , x 0 , s 1 , . . . , xk , sk+1 ) of tran-
19: for all s j ∈ F do sitions (s 0 , x 0 , s 1 ), . . . , (sk , xk , sk+1 ) ∈ T . The weight of π is the
20: for all γ 1 ∈ P do product w(π ) = x 0 · · · xk ∈ K. A finite path π as above is said to
21: for all γ 2 ∈ dom(D(i, j)) do be accepting if s 0 ∈ I and sk+1 ∈ F . The reachability value |S| of
22: if Jγ 1 ∧ γ 2 K , ∅ and f (γ 1 ) > D(i, j)(γ 2 ) then S is defined to be the sum of the weights of all its accepting finite
23: Split(f ,γ 1 ,γ 2 , D(i, j)(γ 2 )) paths:
24: return f Ê
|S| = {w(π ) | π accepting finite path in S}
25: procedure Relax(i, j, k)
26: for all γ 1 ∈ dom(D(i, j)) do As the set of accepting finite paths generally will be infinite, one
27: for all γ 2 ∈ dom(D(i, k)) do has to assume that such sums exist in K for this definition to make
28: for all γ 3 ∈ dom(D(k, j)) do sense. This is the subject of Sect. 3.4 below.
29: if Jγ 1 ∧ γ 2 ∧ γ 3 K , ∅ then
30: if D(i, j)(γ 1 ) > D(i, k)(γ 2 ) + D(k, j)(γ 3 ) then 3.2 Examples
31: Split(D(i, j),γ 1 ,γ 2 ∧γ 3 , D(i, k)(γ 2 ) + D(k, j)(γ 3 ))
B
The Boolean semiring is = ({ff, tt}, ∨, ∧, ff, tt), with disjunction
32: R
procedure Split(f : P → ≥0 , γ 1 , γ 2 ∈ B(N ), x ∈ R ≥0 ) B
as and conjunction as . A -weighted automaton S hence
has its transitions annotated with ff or tt. For a finite path π =
33: if Jγ 1 K = Jγ 1 ∧ γ 2 K then
(s 0 , x 0 , s 1 , . . . , xk , sk+1 ), we have w(π ) = tt iff all x 0 = · · · = xk =
34: f (γ 1 ) ← x
tt. Hence |S| = tt iff there exists an accepting finite path in S
35:
36:
Combine(f , γ 1 )
else
which involves only tt-labeled transitions. That is, -weighted B
automata are equivalent to ordinary (unlabeled) automata, where
37: y ← f (γ 1 )
the equivalence consists in removing all ff-labeled transitions.
38: P ← P \ {γ 1 } ∪ {γ 1 ∧ γ 2 , γ 1 ∧ ¬γ 2 }
The tropical semiring is T R= ( ≥0 ∪ {∞}, ∧, +, ∞, 0), where
39:
40:
f (γ 1 ∧ ¬γ 2 ) ← y
f (γ 1 ∧ γ 2 ) ← x
R ≥0 ∪ {∞} denotes the set of extended real numbers, with mini-
mum as and addition as . The weight of a finite path is now
41: Combine(f , γ 1 ∧ γ 2 )
the sum of its transition weights, and the reachability value of a
T -weighted automaton is the minimum of all its accepting finite
42: procedure Combine(f : P → ≥0 ,γ ∈ R B(N )) T
paths’ weights. Hence -weighted automata are precisely the real-
43: x ← f (γ ) weighted automata of Sect. 2, and to compute their reachability
44: for all δ ∈ P \ {γ } do values is to solve the minimum reachability problem.
45: if f (δ ) = f (γ ) then F R
The fuzzy semiring is = ( ≥0 ∪ {∞}, ∨, ∧, 0, ∞), with maxi-
46: P ← P \ {δ,γ } ∪ {δ ∨ γ } mum as and minimum as . Here, the weight of a finite path is
47: f (δ ∨ γ ) ← x the minimum of its transition weights, and the reachability value
48: break F
of an -weighted automaton is the maximum of all its accepting
finite paths’ weights. This value is hence the maximum flow in a
Figure 1: Algorithm to compute |F | for a real-weighted fea- weighted automaton: the maximum available capacity along any
tured automaton F . finite path from an initial to a accepting state.
FormaliSE, May 2017, Buenos Aires, Argentina Uli Fahrenberg and Axel Legay
3.3 Featured Weighted Automata For any semiring K and n ≥ 1, we can form the matrix semiring
We now extend weighted automata with features, for modeling K n×n whose elements are n-by-n matrices of elements of K and
quantitative behavior of software product lines. Let K be a semir- whose sum and product are given as the usual matrix sum and
ing and denote by GP[K] = { f : P → K | P ∈ GP, ∀γ 1 ,γ 2 ∈ P : product. It is known [19] that when K is a ∗ -continuous Kleene
γ 1 , γ 2 ⇒ f (γ 1 ) , f (γ 2 )} the set of injective functions from guard algebra, then K n×n is also a ∗ -continuous ÉKleene algebra, with the
∗ -operation defined by M ∗ =
É
partitions to K. i, j m ≥0 {Mk1,k2 · · · Mkm−1,km |
1 ≤ k 1 , . . . , km ≤ n, k 1 = i, km = j} for all M ∈ K n×n and 1 ≤
Definition 3.1. A featured weighted automaton over K and px is a i, j ≤ n. Also, if n ≥ 2 and M = ac db , where a and d are square
tuple (S, I , F ,T ) consisting of a finite set S of states, subsets I , F ⊆ S matrices of dimension less than n, then
of initial and accepting states, and a finite set T ⊆ S × GP[K] × S of
(a bd ∗c)∗ (a bd ∗c)∗bd ∗
transitions. M∗ = ∗ ∗ ∗ ∗ ∗ . (2)
(d ca b) ca (d ca b)
Similarly to what we did in Sect. 2, the transition labels in GP[K] The matrix representation [10] of a K-weighted automaton S =
are to be seen as syntactic representations of functions from prod- (S, I , F ,T ), with n = #S the number of states, is given by the triple
ucts to K; we will say more about this below. (α, M, k), where α ∈ {0, 1}n is the initial vector, M ∈ K n×n is the
Example 3.2. For K = B
the Boolean semiring, featured - B transition matrix, and 0 ≤ k ≤ n. These are given as follows: order
weighted automata are standard (unlabeled) featured automata: for S = {1, . . . , n} such that i ∈ F iff i ≤ k, i.e., such that the first k
B
any feature guard γ ∈ (N ), {γ , ¬γ } is a guard partition of px, states are Éaccepting, and define α and M by αi = 1 iff i ∈ I and
B
moreover, for K = , any mapping in GP[K] is equivalent to one Mi, j = {x | (i, x, j) ∈ T }.
from such a guard partition. Hence transitions labeled with feature It can be shown [17] that if S is a weighted automaton over a
∗ -continuous Kleene algebra, then the reachability value of S is
guards (as in standard featured automata) are the same as transi-
tions labeled with functions from guard partitions to {ff, tt}. defined and |S| = αM ∗ κ, where κ ∈ {0, 1}n is the vector given by
κi = 1 for i ≤ k and κi = 0 for i > k.
Definition 3.3. For f : P → K ∈ GP[K] and p ∈ px, let γ ∈ P
be the unique feature guard for which p |= γ and define Jf K(p) =
BT F
Example 3.5. Our example semirings , and share the prop-
f (γ ). This defines the semantic representation of f as the function erty of being bounded. In general terms, a semiring K is said to be
bounded [10] if x 1 = 1 for all x ∈ K. Note that this implies
Jf K : px → K.
idempotency: for all x ∈ K, x x = x(1 1) = x 1 = x. If
Definition 3.4. Let F = (S, I , F ,T ) be a featured K-weighted au- K is bounded, then x ∗ = 1 · · · = 1 for all x ∈ K, and K is a
tomaton and p ∈ px. The projection of F to p is the K-weighted ∗ -continuous Kleene algebra [15].
automaton projp (F ) = (S, I , F ,T ′ ), where T ′ = {(s, Jf K(p), s ′) | B T
In , x 1 = x ∨ tt = tt; in , x 1 = x ∧ 0 = 0; and in , F
(s, f , s ′ ) ∈ T }. x 1 = x ∨ ∞ = ∞; so these three semirings are indeed bounded.
Operationally, the fact that É x ∗ = 1 means that loops can be disre-
The behavior of a featured K-weighted automaton is hence given garded: for all x, y, z ∈ K, n ∗
n ≥0 xy z = xy z = xz. In lieu of
relative to products: given a featured K-weighted automaton F the examples in Sect. 3.2, it is clear that this property holds for -,B
and a product p, |projp (F )|, provided that it exists, will be the be- T F
- and -weighted automata: for reachability, loops are unimpor-
havior of F when restricted to the particular product p. The pur- tant; for minimum reachability, likewise; and for maximum flow,
pose of this paper is to show how the values |projp (F )| can be taking a loop can only decrease the flow, hence would be disadvan-
computed for all p ∈ px at once. tageous.
Î
and the neutral elements are the functions ⊥, id given by ⊥(x) = ⊥ in K to an element n xn of V . The infinite product is subject to
R
and id(x) = x for all x ∈ ≥0 ∪ {⊥, ∞}. the following conditions:
Î Î
Definition 5.1. An energy automaton is a tuple (S, I , F ,T ) consist- • For all x 0 , x 1 , . . . ∈ K, n xn = x 0 n xn+1 .
ing of a finite set S of states, subsets I , F ⊆ S of initial and accepting • Let x 0 , x 1 , . . . ∈ K and 0 = n 0 ≤ n 1 ≤ · · · a sequence
states, and a finite set T ⊆ S × E × S of transitions. which increases without a bound. Let yk = xnk · · · xnk +1 −1
Î Î
for all k ≥ 0. Then n xn = k yk .
Hence the transition labels in energy automata are functions
Î
• ÉFor all x 0 , x 1 , . . . , y, z ∈ K, we have n (xn (y z)) =
which proscribe how a real-valued variable evolves along a transi-
Î ′
x 0′ , x 1′ , ... ∈{y,z } n xn xn .
tion. An energy problem asks, then, whether some state is reach- Î ∗ É Î kn
• For all x, y0 , y1 , . . . ∈ K, n x yn = k0,k1, ... ≥0 n x yn .
able when given a certain initial energy, or whether the automaton
admits infinite accepting runs from some initial energy: For any idempotent semiring-semimodule pair (K,V ) and n ≥
A global state of an energy automaton is a pair q = (s, x) with 1, we can form the matrix semiring-semimodule pair (K n×n ,V n )
R
s ∈ S and x ∈ ≥0 . A transition between global states is of the whose elements are n×n-matrices of elements of K and n-dimensional
form ((s, x), f , (s ′, x ′ )) such that (s, f , s ′) ∈ T and x ′ = f (x). A (column) vectors of elements of V , with the action of K n×n on V n
(finite or infinite) run of the automaton is a (finite or infinite) path given by the usual matrix-vector product.
in the graph of global states and transitions. When (K,V ) is a ∗ -continuous Kleene ω-algebra, then (K n×n ,V n )
As the input to a decision problem must be in some way finitely is a generalized ∗ -continuous Kleene algebra [12]. By [12, Lemma 17],
representable, we will state them for subclasses E ′ ⊆ E of com- there is an ω-operation on K n×n defined by
putable energy functions (but note that we give no technical mean-
Ê
Miω = Mi,k1 Mk1,k2 · · ·
ing to the term “computable” other that “finitely representable”); 1≤k1,k2, ... ≤n
an E ′ -automaton is an energy automaton (S, I , F ,T ) with T ⊆ S ×
K n×n
and 1 ≤ i ≤ n. Also, if n ≥ 2 and M = ac db ,
E ′ × S. for all M ∈
where a and d are square matrices of dimension less than n, then
Problem 1 (Reachability). Given a subset E ′ ⊆ E of computable
(a bd ∗c)ω (a bd ∗c)∗bd ω
functions, an E ′ -automaton S = (S, I , F ,T ) and a computable ini- Mω =
R ∗ ω ∗ ∗ ω .
tial energy x 0 ∈ ≥0 : do there exist s 0 ∈ I and a finite run of S (d ca b) (d ca b) ca
from (s 0 , x 0 ) which ends in a state in F ? We also need another matrix-ω-power below. Let n ≥ 2, k < n
and M ∈ K n×n , and write M = ac db as above, with a ∈ K k×k top
Problem 2 (Büchi acceptance). Given a subset E′
⊆ E of com-
left k-by-k part of M. We define
putable functions, an E ′ -automaton S = (S, I , F ,T ) and a com-
R (a bd ∗c)ω
putable initial energy x 0 ∈ ≥0 : do there exist s 0 ∈ I and an
M ωk = ∗ ∗ ω .
infinite run of S from (s 0 , x 0 ) which visits F infinitely often? d c(a bd c)
As customary, a run such as in the statements above is said to Let (K,V ) be a ∗ -continuous Kleene ω-algebra and S = (S, I , F ,T )
be accepting. a K-weighted automaton. An infinite path in S is an infinite alter-
nating sequence π = (s 0 , x 0 , s 1 , x 1 , s 2 , . . . ) of transitions (s 0 , x 0 , s 1 ),
5.2 ∗ -Continuous Kleene ω-Algebras (s 1 , x 1 , s 2 ), . . . ∈ T . The weight of π is the infinite product w(π ) =
Î
We need a few algebraic notions connected to infinite runs in weighted n xn ∈ V .
An infinite path π = (s 0 , x 0 , s 1 , x 1 , . . . ) in S is said to be Büchi
automata before we can continue. An idempotent semiring-semimodule
pair [1,16] (K,V ) consists of an idempotent semiring K = (K, , , 0, 1) accepting if s 0 ∈ I and the set {n ∈ N
| sn ∈ F } is infinite. The
and a commutative idempotent monoid V = (V , , 0) which is Büchi value kSk of S is defined to be the sum of the weights of all
equipped with a left K-action K × V → V , (x, v) 7→ xv, satisfy- its Büchi accepting infinite paths:
Ê
ing the following axioms for all x, y ∈ K and u,v ∈ V : kSk = {w(π ) | π Büchi accepting infinite path in S}
(x y)v = xv yv x(u v) = xu xv Let (α, M, k) be the matrix representation of S. It can be shown [12]
(xy)v = x(yv) 0x = 0 that
x 0 =0 1 v = v kSk = αM ωk .
Also non-idempotent versions of these are in use, but we will only 5.3 Featured Energy Problems
need the idempotent one here.
A generalized ∗ -continuous Kleene algebra [12] is an idempotent Recall that E denotes the set of energy functions: functions f :
semiring-semimodule pair (K,V ) where K is a ∗ -continuous Kleene R ≥0 ∪ {⊥, ∞} → R ≥0 ∪ {⊥, ∞} with the property (3) that when-
algebra such that for all x, y ∈ K and for all v ∈ V , ever x ≤ y, then f (y) − f (x) ≥ y − x; and that E = (E, ∨, ◦, ⊥, ⊤)
Ê is the semiring of energy functions.
xy ∗v = xy n v .
n ≥0 Lemma 5.2 ( [13]). E is a ∗ -continuous Kleene algebra.
A ∗ -continuous Kleene ω-algebra [12] consists of a generalized ∗ - B
Let = {ff, tt} be the Boolean lattice. We say that a function
continuous Kleene algebra (K,V ) together with an infinite product R B
f : ≥0 ∪ {⊥, ∞} → is ∞-continuous if f = ⊥ or for all X ⊆
operation K ω → V which maps every infinite sequence x 0 , x 1 , . . . R ≥0 ∪ {⊥, ∞} with
Ô Ô
X = ∞, f (X ) = tt.
Featured Weighted Automata FormaliSE, May 2017, Buenos Aires, Argentina
[17] Z. Ésik and W. Kuich. Finite automata. In Handbook of Weighted Automata [10]. APPENDIX: PROOFS
[18] U. Fahrenberg, L. Juhl, K. G. Larsen, and J. Srba. Energy games in multiweighted
automata. In ICTAC, vol. 6916 of LNCS. Springer, 2011. Proof of Lemma 4.2. To see that f˜ is injective, let γ̃ 1 , γ̃ 2 ∈ P̃
and assume f˜ (γ̃ 1 ) = f˜(γ̃ 2 ). Let Γ1 , Γ2 ∈ P ′ such that γ̃ 1 = Γ1 and
Ô
[19] D. Kozen. On Kleene algebras and closed semirings. In MFCS, vol. 452 of LNCS.
Springer, 1990. Ô
[20] D. Kozen. A completeness theorem for Kleene algebras and the algebra of regular
γ̃ 2 = Γ2 , then f (Γ1 ) = f (Γ2 ) and hence Γ1 = Γ2 , i.e., γ̃ 1 = γ̃ 2 .
events. Inf. Comput., 110(2):366–390, 1994. For the second claim, let γ ∈ P, then γ ∈ Γ for some Γ ∈ P ′ ,
[21] R. Olaechea, U. Fahrenberg, J. M. Atlee, and A. Legay. Long-term average cost
Ô
hence Jγ K ⊆ J ΓK. To see uniqueness, let γ̃ 1 , γ̃ 2 ∈ P̃ and assume
in featured transition systems. In SPLC. ACM, 2016.
[22] K. Quaas. On the interval-bound problem for weighted timed automata. In LATA, Jγ K ⊆ Jγ̃ 1 K and Jγ K ⊆ Jγ̃ 2 K. As Jγ K , ∅, this implies that Jγ̃ 1 K ∩
vol. 6638 of LNCS. Springer, 2011. Jγ̃ 2 K , ∅, hence γ̃ 1 = γ̃ 2 .
[23] T. Thüm, S. Apel, C. Kästner, I. Schaefer, and G. Saake. A classification and survey
of analysis strategies for software product lines. ACM Comput. Surv., 47(1):6:1–
6:45, 2014. Proof of Lemma 4.4. Existence of γ 1 and γ 2 is obvious by defi-
nition of P1 ∧P2 . For uniqueness, assume that there is γ 1′ ∈ P1 with
γ 1′ , γ 1 and γ = γ 1′ ∧γ 2 . Then γ = γ 1 ∧γ 1′ ∧γ , but as P1 is a partition,
Jγ 1 ∧ γ 1′ K = Jγ 1 K ∩ Jγ 1′ K = ∅, hence Jγ K = ∅, a contradiction.