You are on page 1of 9

Featured Weighted Automata

Uli Fahrenberg∗ Axel Legay


Ecole polytechnique, Palaiseau, France Inria Rennes, France
uli@lix.polytechnique.fr axel.legay@inria.fr

ABSTRACT For quantitative properties of transition systems, the model of


A featured transition system is a transition system in which the (semiring-) weighted automata has proven useful [10]. This pro-
transitions are annotated with feature expressions: Boolean ex- vides a uniform framework to treat problems such as minimum
pressions on a finite number of given features. Depending on its reachability, maximum flow, energy problems [13], and others. Here
arXiv:1702.07484v2 [cs.FL] 27 Feb 2017

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

certain types of semimodules over ∗ -continuous Kleene algebras; R R


Let GP[ ≥0 ] = { f : P → ≥0 | P ∈ GP, ∀γ 1 ,γ 2 ∈ P : γ 1 ,
hence we need to extend our results to such semimodules. γ 2 ⇒ f (γ 1 ) , f (γ 2 )} denote the set of injective functions from
The paper is followed by a separate appendix which contains R
guard partitions to ≥0 .
some of the proofs of our results. R
We use injective functions P → ≥0 as symbolic representa-
R
tions of functions px → ≥0 , because they provide the most con-
2 MINIMUM REACHABILITY IN cise such representation. Indeed, if a function f : P → ≥0 is R
REAL-WEIGHTED FEATURED AUTOMATA not injective, then there are feature guards γ 1 , γ 2 ∈ P for which
f (γ 1 ) = f (γ 2 ), so we can obtain a more concise representation of
A real-weighted automaton S = (S, I , F ,T ) consists of a finite set S
of states, subsets I , F ⊆ S of initial and accepting states, and a finite R
f by letting P ′ = P \ {γ 1 ,γ 2 } ∪ {γ 1 ∨ γ 2 } and f ′ : P ′ → ≥0 be
R
set T ⊆ S × ≥0 × S of weighted transitions. Here ≥0 denotes R defined by f ′ (δ ) = f (δ ) for δ , γ 1 ∨ γ 2 and f ′ (γ 1 ∨ γ 2 ) = f (γ 1 ).
We show in Fig. 1 an algorithm to compute a symbolic represen-
the set of non-negative real numbers.
A finite path in such a real-weighted automaton S is a finite tation of |F |. The algorithm performs, in lines 13 to 16, a symbolic
Floyd-Warshall relaxation to compute a matrix D which as entries
alternating sequence π = (s 0 , x 0 , s 1 , x 1 , . . . , xk , sk+1 ) of transitions
(s 0 , x 0 , s 1 ), . . . , (sk , xk , sk+1 ) ∈ T . The weight of π is the sum w(π ) = R
D(i, j) has functions in GP[ ≥0 ] that for each product return the
R
x 0 + · · · + xk ∈ ≥0 . A finite path π as above is said to be accept- shortest path from state si to state s j .
The relaxation procedure Relax(i, j, k) is performed by compar-
ing if s 0 ∈ I and sk+1 ∈ F . The minimum reachability problem for
real-weighted automata asks, given a real-weighted automaton S ing D(i, j) to the sum D(i, k)+D(k, j) and updating D(i, j) if the sum
as above, to compute the value is smaller. The result of the comparison depends on the products
for which the different paths are enabled, hence the comparison
|S| = inf {w(π ) | π accepting finite path in S} . and update are done for each feature expression γ 1 in the partition
That is, |S| is the minimum weight of all finite paths from an initial for D(i, j) and all feature expressions γ 2 , γ 3 in the partitions for
to an accepting state in S. This being a multi-source-multi-target D(i, k) and D(k, j), respectively. The comparison has to be done
shortest path problem, it can for example be solved using the Floyd- only if these partitions overlap (line 30), and in case the sum is
Warshall relaxation algorithm. smaller, D(i, j) is updated in a call to a split-and-combine proce-
Let N be a set of features and px ⊆ 2 N a set of products over N . dure.
A feature guard is a Boolean expression over N , and we denote the Using the procedure Split, in lines 32 to 41, D(i, j) is updated
B
set of these by (N ). We write p |= γ if p ∈ px satisfies γ ∈ (N ) B at the γ 1 ∧ (γ 2 ∧ γ 3 ) part of its partition. If Jγ 1 ∧ (γ 2 ∧ γ 3 )K is not
and Jγ K = {p ∈ px | p |= γ }. Note that Jγ K is a set of sets of smaller than Jγ 1 K (line 33), then D(i, j)(γ 1 ) is set to its new value.
features. Afterwards, we need to call a Combine procedure to see whether
D(i, j) has the same value at any other part δ of its partition (line 44)
Definition 2.1. A real-weighted featured automaton (S, I , F ,T ,γ )
and, in the affirmative case, to update the partition of D(i, j) by
consists of a finite set S of states, subsets I , F ⊆ S of initial and
R
accepting states, a finite setT ⊆ S × ≥0 ×S of weighted transitions,
joining the two parts (line 46f).
and a feature guard mapping γ : T → (N ). B If the feature expression γ 1 ∧ (γ 2 ∧γ 3 ) on which to update D(i, j)
is a strict subset of γ 1 (line 36), then the γ 1 part of the partition of
The projection of a real-weighted featured automaton F = D(i, j) needs to be split into two parts: γ 1 ∧(γ 2 ∧γ 3 ), on which D(i, j)
(S, I , F ,T , γ ) to a product p ∈ px is the real-weighted automaton is to be updated, and γ 1 ∧ ¬(γ 2 ∧ γ 3 ), on which its value stays the
projp (F ) = (S, I , F ,T ′ ) with T ′ = {t ∈ T | p |= γ (t)}. same. Again, we need to call the Combine procedure afterwards to
For each product p ∈ px, we could solve the shortest path prob- potentially combine feature expressions in the partition of D(i, j).
lem in projp (F ) by computing |projp (F )|. Instead, we develop an Once relaxation has finished in line 17, we need to find f :=
algorithm which computes all these values at the same time. Its min{D(i, j) | si ∈ I , s j ∈ F }. As this again depends on which
R
output will, thus, be a function |F | : px → ≥0 , with the prop- features are present, we need to compute this minimum in a way
erty that for every p ∈ px, |F |(p) = |projp (F )|. similar to what we did in the Relax procedure: for each feature
As a symbolic representation of functions px → ≥0 , we use in-R expression in the partition P of f and each overlapping feature
R
jective functions from guard partitions to ≥0 . Intuitively, a guard expression in the partition of D(i, j), we compare the two values
partition is a set of feature guards which partitions px into classes and use the Split procedure to update f if D(i, j) is smaller.
such that within each class, f has the same value for all products, A variant of the algorithm in Fig. 1 has been implemented in [21],
and between different classes, f has different values. as part of an effort to compute minimum limit-average cost in real-
Definition 2.2. A guard partition of px is a set P ⊆ (N ) such
Ô
B weighted featured automata. Several experiments in [21] show
that our algorithm is significantly faster than an approach which
that J PK = px, Jγ K , ∅ for all γ ∈ P, and Jγ 1 K ∩ Jγ 2 K = ∅ for
separately solves the minimum reachability problem for each prod-
all γ 1 , γ 2 ∈ P with γ 1 , γ 2 . The set of all guard partitions of px is
denoted GP ⊆ 2B(N ) .
uct.

A guard partition is a logical analogue to a partition of the set of


products px: any guard partition induces a partition of px, and any 3 FEATURED WEIGHTED AUTOMATA
partition of px can be obtained by a guard partition. In particular, We proceed to introduce a generalization of the setting in the pre-
for any guard partition P and any product px, there is precisely one R
vious section. Here ≥0 is replaced by an abstract ∗ -continuous
γ ∈ P for which px |= γ . Kleene algebra. This allows us to develop an abstract setting for
Featured Weighted Automata FormaliSE, May 2017, Buenos Aires, Argentina

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.

3.4 ∗ -Continuous Kleene Algebras 4 ANALYSIS OF FEATURED WEIGHTED


We finish this section by introducing extra structure and properties AUTOMATA
into our semiring K which will ensure that the infinite sums |S| Let K be a ∗ -continuous Kleene algebra. In this section we take a
always exist. This is for convenience only, and all our work can be closer look at the functions in GP[K] and define semiring opera-
extended to a more general (for example non-idempotent) setting. tions on them. We show that with these operations, GP[K] itself
Recall that a semiring K = (K, , , 0, 1) is idempotent [10] if x  is a ∗ -continuous Kleene algebra. This means that we can treat
x = x for every x ∈ K. featured K-weighted automata as GP[K]-weighted automata.
A ∗ -continuous Kleene algebra [20] is an idempotentÉ semiring We first need to define an operation on partitions which turns
K = (K, , , 0, 1) in which all infinite sums of the form n ≥0 x n , functions f : P → K from a partition P ∈ GP into injective func-
x ∈ K, exist, and such that tions, providing the most concise representation, by changing their
Ê  Ê
x yn z = xy n z (1) domain. Intuitively, this canonicalization of f changes the parti-
n ≥0 n ≥0 tion P into a coarser one by forming disjunctions of feature guards
on which f has the same value:
for all x, y, z ∈ K. Intuitively, automata weighted over a ∗ -continuous
Kleene algebra allow for loop abstraction, in that the global effects Definition 4.1. Let P ∈ GP and f : P → K. Introduce an equiv-
of a loop (right-hand side of (1)) can be computed locally (left-hand alence relation ∼ ⊆ P × P by γ 1 ∼ γ 2 iff f (γ 1 ) = f (γ 2 ) and let
side of (1)). In any ∗ -continuous Kleene algebra P ′ = P/∼ be the quotient. Let P̃ = { Γ | Γ ∈ P ′ }, then P̃ ∈ GP. For
Ô
É K none can define
a unary star operation ∗ : K → K by x ∗ = every γ̃ ∈ P̃ there is an equivalence class Γ ∈ P ′ for which γ̃ = Γ,
Ô
n ≥0 x .
Featured Weighted Automata FormaliSE, May 2017, Buenos Aires, Argentina

1: function KCombine(f : P → K): GP[K] 1: function KSum(f 1 : P1 → K, f 2 : P2 → K): GP[K]


2: var f˜ , P̃ 2: var f ′ , P ′
3: P̃ ← ∅ 3: P′ ← ∅
4: while P , ∅ do 4: for all γ 1 ∈ P1 do
5: Pick and remove γ from P 5: for all γ 2 ∈ P2 do
6: x ← f (γ ) 6: if Jγ 1 ∧ γ 2 K , ∅ then
7: for all δ ∈ P do 7: P ′ ← P ′ ∪ {γ 1 ∧ γ 2 }
8: if f (δ ) = x then 8: f ′ (γ 1 ∧ γ 2 ) ← f 1 (γ 1 )  f 2 (γ 2 )
9: γ ←γ ∨δ 9: return KCombine(f ′ )
10: P ← P \ {δ }
11: P̃ ← P̃ ∪ {γ } 10: function KProd(f 1 : P1 → K, f 2 : P2 → K): GP[K]
12: f˜(γ ) ← x 11: var f ′ , P ′
13: return f˜ : P̃ → K 12: P′ ← ∅
13: for all γ 1 ∈ P1 do
Figure 2: Function which computes canonicalization. 14: for all γ 2 ∈ P2 do
15: if Jγ 1 ∧ γ 2 K , ∅ then
16: P ′ ← P ′ ∪ {γ 1 ∧ γ 2 }
and f passes to these equivalence classes by definition, so we can 17: f ′ (γ 1 ∧ γ 2 ) ← f 1 (γ 1 )  f 2 (γ 2 )
define f˜ : P̃ → K, the canonicalization of f , by f˜ (γ̃ ) = f (Γ). 18: return KCombine(f ′ )
We show an algorithm which implements canonicalization in
Fig. 2. The function KCombine takes as input a function f : P → K 19: function KStar(f : P → K): GP[K]
and builds its canonicalization f˜ : P̃ → K by taking disjunctions of 20: var f ′
feature expressions in the partition P. Note the similarity of its in- 21: for all γ ∈ P do
ner loop to the Combine procedure of Fig. 1: the procedure in Fig. 1 22: f ′(γ ) ← f (γ )∗
only updates the partition of f in one place, whereas KCombine 23: return KCombine(f ′ )
needs to check the whole partition.
Lemma 4.2. Let P ∈ GP, f : P → K, and f˜ : P̃ → K the Figure 3: Functions which compute ,  and ∗ in GP[K].
canonicalization of f . Then f˜ is injective, hence f˜ ∈ GP[K]. Also,
for any γ ∈ P there is a unique element γ̃ ∈ P̃ such that Jγ K ⊆ Jγ̃ K.
Lemma 4.9. For n ≥ 1, M ∈ GP[K]n×n , and p ∈ px, JM ∗ K(p) =
Definition 4.3. Let P1 , P2 ∈ GP. The intersection of P1 and P2 is JMK(p)∗ .
the partition P = P1 ∧ P2 ∈ GP given as P = {γ 1 ∧γ 2 | γ 1 ∈ P1 ,γ 2 ∈
P2 , Jγ 1 ∧ γ 2 K , ∅}. We are ready to give the central result of this paper, stating that
for a given featured weighted automaton F , computing |F | suf-
Lemma 4.4. Let P1 , P2 ∈ GP and γ ∈ P1 ∧ P2 . There are unique fices to obtain all projected values.
elements γ 1 ∈ P1 , γ 2 ∈ P2 such that γ = γ 1 ∧ γ 2 .
Theorem 4.10. Let F be a featured weighted automaton over K
We can hence write the elements of P1 ∧P2 as γ 1 ∧γ 2 without am- and p ∈ px. Then |projp (F )| = J|F |K(p).
biguity. We are ready to define operations ,  and ∗ on functions
in GP[K]. Proof. We have J|F |K(p) = JαM ∗κK(p) = JαK(p)JMK(p)∗ JκK(p)
by Lemmas 4.6 and 4.9. Noting that the matrix representation of
Definition 4.5. Let f 1 : P1 → K, f 2 : P2 → K ∈ GP[K]. Define
projp (F ) is (JαK(p), JMK(p), k), the proof is finished. 
functions s ′, p ′ : P1 ∧ P2 → K and t ′ : P1 → K by s ′(γ 1 ∧ γ 2 ) =
f 1 (γ 1 )f 2 (γ 2 ), p ′(γ 1 ∧γ 2 ) = f 1 (γ 1 )f 2 (γ 2 ), and t ′ (γ 1 ) = f 1 (γ 1 )∗ . Let
s, p, t ∈ GP[K] be the canonicalizations of s ′, p ′ and t ′ , respectively,
5 FEATURED ENERGY PROBLEMS
then we define f 1  f 2 = s, f 1  f 2 = p, and f 1∗ = t. In this final section we apply the theoretical results of this paper
to featured energy problems.
Figure 3 shows algorithms to compute these operations in GP[K].
Note how these are similar to the Split procedure in Fig. 1. 5.1 Energy Problems
Let 0, 1 : {tt} → K be the functions given by 0(tt) = 0 and
1(tt) = 1. Then 0, 1 ∈ GP[K].
E
The energy semiring [14] is the structure = (E, ∨, ◦, ⊥, ⊤). Here
E is the set of energy functions, which are partial functions f :
Lemma 4.6. Let f 1 , f 2 ∈ GP[K] and p ∈ px. Then Jf 1  f 2 K(p) = R R
≥0 ∪ {⊥, ∞} → ≥0 ∪ {⊥, ∞} on extended real numbers (f (x) =
Jf 1 K(p)  Jf 2 K(p), Jf 1  f 2 K(p) = Jf 1 K(p)  Jf 2 K(p), and Jf 1∗ K(p) = ⊥ meaning that f is undefined at x) with the property that
Jf K1 (p)∗ .
for all x ≤ y : f (y) − f (x) ≥ y − x . (3)
Lemma 4.7. Let f 1 , f 2 ∈ GP[K]. Then f 1 = f 2 iff Jf 1 K = Jf 2 K.
These have been introduced in [14] as a general framework to han-
Proposition 4.8. The structure (GP[K], , , 0, 1) forms a dle formal energy problems as below. The operations in the semir-
∗ -continuous Kleene algebra. ing are (pointwise) maximum as  and function composition as ,
FormaliSE, May 2017, Buenos Aires, Argentina Uli Fahrenberg and Axel Legay

Î
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

Let V be the set of ∞-continuous functions f : R ≥0 ∪{⊥, ∞} → 6 CONCLUSION


B. With operation ∨ defined by (f ∨д)(x) = f (x)∨д(x) and unit ⊥ We have introduced featured (semiring-) weighted automata and
given by ⊥(x) = ff for all x ∈ R ≥0 ∪ {⊥, ∞}, V = (V, ∨, ⊥) forms shown that, essentially, verification of their properties can be re-
a commutative idempotent monoid. Then (E, V) is an idempotent duced to checking properties of weighted automata. This is be-
semiring-semimodule pair. cause, from a mathematical point of view, a featured weighted au-
Define an infinite product E → V as follows: Let f 0 , f 1 , . . . ∈ E tomaton over a semiring K is the same as a weighted automaton
R
be an infinite sequence and x ∈ ≥0 ∪ {⊥, ∞}. Let x 0 = f 0 (x) and, over the semiring of functions from products (sets of features) to
for each k ≥ 1, xk = fk (xk−1 ). Thus x 0 , x 1 , . . . is the infinite K.
sequence of values obtained by application of finite prefixes of the Representing functions from products to K as injective func-
Î
function sequence f 0 , f 1 , . . . . Then ( n fn )(x) = ff if there is an tions from partitions of the set of products to K, we have exposed
Î
index k for which xk = ⊥ and ( n fn )(x) = tt otherwise. algorithms which will compute featured weighted reachability in
Î
It can be shown [13] that n fn is ∞-continuous for any infi- case K is a ∗ -continuous Kleene algebra. It is easy to see that these
nite sequence f 0 , f 1 , . . . ∈ E, hence this defines indeed a mapping extend to the non-idempotent case of K being a Conway semiring.
E ω → V. The essence in our approach does not lie in these technical details,
Lemma 5.3 ( [13]). ( ,E V) is a ∗ -continuous Kleene ω-algebra. but in the fact that we pass from K to a semiring of functions into
K; this typically preserves properties one is interested in.
Hence the energy problems stated at the end of Sect. 5.1 can We have also seen that energy properties are preserved when
be solved by computing reachability and Büchi values of energy passing from the weighted to the featured weighted setting; gener-
automata: ally, if (K,V ) is a ∗ -continuous Kleene ω-algebra, then the semiring-
semimodule pair of functions from products to K and V , respec-
Proposition 5.4 ( [13]). Let S = (S, I , F ,T ) be an energy au- tively, will also be such.
R
tomaton and x 0 ∈ ≥0 . We are interested in extending the setting of this paper to other
weighted structures beyond semirings, for example the valuation
• There exist s 0 ∈ I and a finite run of S from (s 0 , x 0 ) which
monoids of [11]. This will enable feature-based treatment of prop-
ends in a state in F iff |S|(x 0 ) , ⊥.
erties such as limit-average cost and will be useful for an extension
• There exist s 0 ∈ I and an infinite run of S from (s 0 , x 0 ) which
to the timed setting of [7]. From a practical point of view, we have
visits F infinitely often iff kSk(x 0 ) = tt.
shown in [21] that efficient algorithms are available for the limit-
We now define energy problems for featured automata. Recall average setting.
that N denotes a set of features and px ⊆ 2 N a set of products over
N. REFERENCES
[1] S. L. Bloom and Z. Ésik. Iteration Theories: The Equational Logic of Iterative Pro-
cesses. EATCS monographs on theoretical computer science. Springer, 1993.
Definition 5.5. A featured energy automaton over px is a tuple [2] P. Bouyer, U. Fahrenberg, K. G. Larsen, and N. Markey. Timed automata with
(S, I , F ,T ) consisting of a finite set S of states, subsets I , F ⊆ S of observers under energy constraints. In HSCC. ACM, 2010.
initial and accepting states, and a finite set T ⊆ S × GP[E] × S of [3] P. Bouyer, U. Fahrenberg, K. G. Larsen, N. Markey, and J. Srba. Infinite runs in
weighted timed automata with energy constraints. In FORMATS, vol. 5215 of
transitions. LNCS. Springer, 2008.
[4] P. Bouyer, K. G. Larsen, and N. Markey. Lower-bound constrained runs in
Hence transitions in featured energy automata are labeled with weighted timed automata. In QEST. IEEE Computer Society, 2012.
[5] K. Chatterjee and L. Doyen. Energy parity games. In ICALP (2), vol. 6199 of LNCS.
(injective) functions from guard partitions to energy functions. Springer, 2010.
[6] A. Classen, M. Cordy, P. Schobbens, P. Heymans, A. Legay, and J. Raskin. Fea-
Lemma 5.6. For f ∈ E, f ω ∈ V is given by tured transition systems: Foundations for verifying variability-intensive sys-
tems and their application to LTL model checking. IEEE Trans. Software Eng.,
( 39(8):1069–1089, 2013.
ff if x = ⊥ or f (x) < x , [7] M. Cordy, P. Schobbens, P. Heymans, and A. Legay. Behavioural modelling and
f ω (x) = verification of real-time software product lines. In SPLC. ACM, 2012.
tt otherwise .
[8] M. Cordy, P. Schobbens, P. Heymans, and A. Legay. Beyond boolean product-
line model checking: dealing with feature attributes and multi-features. In ICSE.
Definition 5.7. Let f : P → E ∈ GP[E] and define w ′ : P → V IEEE / ACM, 2013.
by w ′ (γ ) = f (γ )ω . Let w ∈ GP[V] be the canonicalization of w ′ , [9] A. Degorre, L. Doyen, R. Gentilini, J.-F. Raskin, and S. Torunczyk. Energy and
mean-payoff games with imperfect information. In CSL, 2010.
then we define f ω = w. [10] M. Droste, W. Kuich, and H. Vogler. Handbook of Weighted Automata. Springer,
2009.
Lemma 5.8. For n ≥ 1, k < n, M ∈ GP[E]n×n , and p ∈ px, [11] M. Droste and I. Meinecke. Weighted automata and regular expressions over
valuation monoids. Int. J. Found. Comput. Sci., 22(8):1829–1844, 2011.
JM ω K(p) = JMK(p)ω and JM ωk K(p) = JMK(p)ωk .
[12] Z. Ésik, U. Fahrenberg, and A. Legay. ∗ -continuous Kleene ω -algebras. In DLT,
vol. 9168 of LNCS. Springer, 2015.
Theorem 5.9. Let F be a featured energy automaton and p ∈ px. [13] Z. Ésik, U. Fahrenberg, and A. Legay. ∗ -continuous Kleene ω -algebras for energy
Then kprojp (F )k = JkF kK(p). problems. In FICS, vol. 191 of EPTCS, 2015.
[14] Z. Ésik, U. Fahrenberg, A. Legay, and K. Quaas. Kleene algebras and semimodules
for energy problems. In ATVA, vol. 8172 of LNCS. Springer, 2013.
Proof. We have JkF kK(p) = JαM ωk K(p) = JαK(p)JMK(p)ωk [15] Z. Ésik and W. Kuich. Locally closed semirings. Monatsh. Math., 137(1):21–29,
2002.
by Lemmas 4.6 and 5.8. As the matrix representation of projp (F ) [16] Z. Ésik and W. Kuich. On iteration semiring-semimodule pairs. Semigroup Forum,
is (JαK(p), JMK(p), k), the result follows.  75:129–159, 2007.
FormaliSE, May 2017, Buenos Aires, Argentina Uli Fahrenberg and Axel Legay

[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. 

Proof of Lemma 4.6. Let f 1 : P1 → K and f 2 : P2 → K. Let


γ 1 ∈ P1 , γ 2 ∈ P2 be the unique feature guards for which p |= γ 1 and
p |= γ 2 , then Jf 1 K(p) = f 1 (γ 1 ) and Jf 2 K(p) = f 2 (γ 2 ).
We have p ∈ Jγ 1 ∧ γ 2 K, hence Jγ 1 ∧ γ 2 K , ∅, so that γ 1 ∧ γ 2 ∈
P1 ∧ P2 . Using the notation of Def. 4.5, s ′(γ 1 ∧ γ 2 ) = f 1 (γ 1 ) 
f 2 (γ 2 ) = Jf 1 K(p)  Jf 2 K(p). Write s : P → K and let γ̃ ∈ P be
such that Jγ 1 ∧ γ 2 K ⊆ Jγ̃ K, cf. Lemma 4.2. Then p |= γ̃ , hence
Jf 1  f 2 K(p) = (f 1  f 2 )(γ̃ ) = s ′(γ 1 ∧ γ 2 ). The proofs for  and ∗
are similar. 

Proof of Lemma 4.7. It is clear that f 1 = f 2 implies Jf 2 K =


Jf 2 K. For the other direction, write f 1 : P1 → K and f 2 : P2 → K.
Ó Ó
For each p ∈ px, let γp = f ∈p f ∧ f <p ¬f ∈ (N ) denote its B
characteristic feature guard; note that Jγp K = {p}.
Let P ∈ GP be the guard partition P = {γp | p ∈ px}, and
define functions f 1′, f 2′ : P → K by f 1′ (γp ) = Jf 1 K(p) and f 2′ (γp ) =
Jf 2 K(p). By definition, f 1 is the canonicalization of f 1′ and f 2 the
canonicalization of f 2′. By construction, Jf 1 K = Jf 2 K implies f 1′ =
f 2′ , hence f 1 = f 2 . 

Proof of Prop. 4.8. We show that the set K px of functions from


px to K forms a ∗ -continuous Kleene algebra; the theorem is then
clear from Lemmas 4.6 and 4.7. For functions ϕ 1 , ϕ 2 : px → K,
define ϕ 1  ϕ 2 , ϕ 1  ϕ 2 and ϕ 1∗ by (ϕ 1  ϕ 2 )(p) = ϕ 1 (p)  ϕ 2 (p),
(ϕ 1 ϕ 2 )(p) = ϕ 1 (p) ϕ 2 (p), and ϕ 1∗ (p) = ϕ 1 (p)∗ . Let 0, 1 : px → K
be the functions 0(p) = 0, 1(p) = 1. Then (K px, , , 0, 1) forms an
idempotent semiring.
We miss to show ∗ -continuity. Let p ∈ px and ϕ 1 , ϕ 2 , ϕ 3 : px →
K, then

ϕ 1 ϕ 2∗ϕ 3 (p) = ϕ 1 (p)ϕ 2∗ (p)ϕ 3 (p)




= ϕ 1 (p)ϕ 2 (p)∗ϕ 3 (p)


Ê
ϕ 2 (p)n ϕ 3 (p)

= ϕ 1 (p)
n ≥0
Ê
= ϕ 1 (p)ϕ 2 (p)n ϕ 3 (p)
n ≥0
Ê
= ϕ 1 (p)ϕ n2 (p)ϕ 3 (p)
n ≥0
Ê
ϕ 1ϕ n2 ϕ 3 (p)

=
n ≥0

Featured Weighted Automata FormaliSE, May 2017, Buenos Aires, Argentina

Proof of Lemma 4.9. As the formula for computing M ∗ involves


only additions, multiplications and stars, this is clear by Lemma 4.6.

Proof of Lemma 5.6. The claim is clear for x = ⊥, so let x , ⊥.
If f (x) ≥ x, then also f n (x) ≥ x for all n ≥ 0, hence f ω (x) = tt by
definition.
If f (x) < x, then f (x) ≤ x − M, with M = x − f (x) > 0. By (3),
f n (x) ≤ x − nM for all n ≥ 0, hence there must be k ≥ 0 for which
f k (x) = ⊥, whence f ω (x) = ff. 
Proof of Lemma 5.8. The formulas for M ω and M ωk involve
only additions, multiplications, stars, and ωs. Invoking Lemmas 4.6
and 4.9, we see that the proof will be finished once we show that
for f ∈ GP[E], Jf ω K(p) = Jf K(p)ω .
Write f : P → E and let γ ∈ P be the unique feature guard for
which p |= γ . Then Jf K(p) = f (γ ). Using the notation of Def. 5.7,
w ′ (γ ) = Jf K(p)ω . Write w : P ′ → V and let γ̃ ∈ P ′ be such that
Jγ K ⊆ Jγ̃ K, cf. Lemma 4.2. Then p |= γ̃ , hence Jf ω K(p) = f ω (γ̃ ) =
w ′ (γ ). 

You might also like