Exhibition of a Structural Bug with Wings

Jun 27, 2014 - Definition. A vector addition system with states (VASS) is a directed graph. G = (Q,A,µ) with : Q a finite set of nodes,. A ⊆ Q × Zd × Q a finite set ...
860KB taille 1 téléchargements 323 vues
Exhibition of a Structural Bug with Wings Florent Avellaneda joint work with Rémi Morin Laboratoire d’Informatique Fondamentale de Marseille, AMU & CNRS, UMR 7279

27 June 2014

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

1 / 22

Outline

1

Background

2

Representation of pathological cycles

3

Searching for minimal counter-examples

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

2 / 22

Outline

1

Background

2

Representation of pathological cycles

3

Searching for minimal counter-examples

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

3 / 22

Well-known model : VASS Definition A vector addition system with states (VASS) is a directed graph G = (Q, A, µ) with : Q a finite set of nodes, A ⊆ Q × Zd × Q a finite set of arcs labeled by integral vectors, An initial configuration µ ∈ Q × Nd .

(-1, 1)

l1 q2

(1, -1)

q1 l4 (-1, 0)

Florent Avellaneda

l2

(0, -1) l3

(5, 5)

Exhibition of a Structural Bug with Wings

27 June 2014

4 / 22

Well-known model : VASS Definition A vector addition system with states (VASS) is a directed graph G = (Q, A, µ) with : Q a finite set of nodes, A ⊆ Q × Zd × Q a finite set of arcs labeled by integral vectors, An initial configuration µ ∈ Q × Nd .

(-1, 1)

l1 q2

(1, -1)

q1 l4 (-1, 0)

Florent Avellaneda

l2

(0, -1) l3

(5, 5)

Exhibition of a Structural Bug with Wings

27 June 2014

4 / 22

Well-known model : VASS Definition A vector addition system with states (VASS) is a directed graph G = (Q, A, µ) with : Q a finite set of nodes, A ⊆ Q × Zd × Q a finite set of arcs labeled by integral vectors, An initial configuration µ ∈ Q × Nd .

(-1, 1)

l1 q2

(1, -1)

q1 l4 (-1, 0)

Florent Avellaneda

l2

(0, -1) l3

(5, 5)

Exhibition of a Structural Bug with Wings

27 June 2014

4 / 22

Well-known model : VASS Definition A vector addition system with states (VASS) is a directed graph G = (Q, A, µ) with : Q a finite set of nodes, A ⊆ Q × Zd × Q a finite set of arcs labeled by integral vectors, An initial configuration µ ∈ Q × Nd .

(-1, 1)

l1 q2

(1, -1)

q1 l4 (-1, 0)

Florent Avellaneda

l2

(0, -1) l3

(5, 5)

Exhibition of a Structural Bug with Wings

27 June 2014

4 / 22

Well-known model : VASS Definition A vector addition system with states (VASS) is a directed graph G = (Q, A, µ) with : Q a finite set of nodes, A ⊆ Q × Zd × Q a finite set of arcs labeled by integral vectors, An initial configuration µ ∈ Q × Nd .

(-1, 1)

l1 q2

(1, -1)

q1 l4 (-1, 0)

Florent Avellaneda

l2

(0, -1) l3

(5, 5)

Exhibition of a Structural Bug with Wings

27 June 2014

4 / 22

Well-known model : VASS Definition A vector addition system with states (VASS) is a directed graph G = (Q, A, µ) with : Q a finite set of nodes, A ⊆ Q × Zd × Q a finite set of arcs labeled by integral vectors, An initial configuration µ ∈ Q × Nd .

(-1, 1)

l1 q2

(1, -1)

q1 l4 (-1, 0)

Florent Avellaneda

l2

(0, -1) l3

(5, 5)

Exhibition of a Structural Bug with Wings

27 June 2014

4 / 22

Well-known model : VASS Definition A vector addition system with states (VASS) is a directed graph G = (Q, A, µ) with : Q a finite set of nodes, A ⊆ Q × Zd × Q a finite set of arcs labeled by integral vectors, An initial configuration µ ∈ Q × Nd .

(-1, 1)

l1 q2

(1, -1)

q1 l4 (-1, 0)

Florent Avellaneda

l2

(0, -1) l3

(5, 5)

Exhibition of a Structural Bug with Wings

27 June 2014

4 / 22

Well-known model : VASS Definition A vector addition system with states (VASS) is a directed graph G = (Q, A, µ) with : Q a finite set of nodes, A ⊆ Q × Zd × Q a finite set of arcs labeled by integral vectors, An initial configuration µ ∈ Q × Nd .

(-1, 1)

l1 q2

(1, -1)

q1 l4 (-1, 0)

Florent Avellaneda

l2

(0, -1) l3

(5, 5)

Exhibition of a Structural Bug with Wings

27 June 2014

4 / 22

Well-known model : VASS Definition A vector addition system with states (VASS) is a directed graph G = (Q, A, µ) with : Q a finite set of nodes, A ⊆ Q × Zd × Q a finite set of arcs labeled by integral vectors, An initial configuration µ ∈ Q × Nd .

(-1, 1)

l1 q2

(1, -1)

q1 l4 (-1, 0)

Florent Avellaneda

l2

(0, -1) l3

(5, 5)

Exhibition of a Structural Bug with Wings

27 June 2014

4 / 22

Well-known model : VASS Definition A vector addition system with states (VASS) is a directed graph G = (Q, A, µ) with : Q a finite set of nodes, A ⊆ Q × Zd × Q a finite set of arcs labeled by integral vectors, An initial configuration µ ∈ Q × Nd .

(-1, 1)

l1 q2

(1, -1)

q1 l4 (-1, 0)

Florent Avellaneda

l2

(0, -1) l3

(5, 5)

Exhibition of a Structural Bug with Wings

27 June 2014

4 / 22

Properties

We study two structural properties : Structural boundedness : for each initial configuration, the VASS is bounded. Structural termination : for each initial configuration, the VASS terminates. Motivation : Boundedness and termination are EXPSPACE-complete problems while structural boundedness and structural termination are polynomial.

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

5 / 22

Warning The usual simulation of a VASS by a Petri net does not preserve these properties.

„ « −1 0 „

« +1 −1

U SA

EU



« −1 +1



« 0 −1

(a) A VASS

Florent Avellaneda

(b) The "equivalent" Petri net

Exhibition of a Structural Bug with Wings

27 June 2014

6 / 22

Characterizations Remark A VASS is structurally bounded if and only if there exists no cycle whose cost is ~0.

Remark A VASS is structurally terminating if and only if there exists no cycle whose cost is ≥ ~0. These problems are solvable in polynomial time by linear programs and computing connected components [Kosaraju and Sullivan, STOC’88]. The resulting algorithm returns in polynomial time a multiset of arcs H that represents a pathological cycle if such a cycle exists. Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

7 / 22

Difficulty The user of a formal verification tool usually expects to get a simple counter example when the property is not satisfied. Difficulty : the minimum length of a "pathological" cycle is potentially exponential.

l1 . . . l2 l2 l2 l2 . . . ⇒ l1 + n · l2 |

{z

n times

}

Aim : Concise representation of pathological cycles for VASS.

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

8 / 22

Outline

1

Background

2

Representation of pathological cycles

3

Searching for minimal counter-examples

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

9 / 22

Looking for a pattern

How can we decompose a pathological cycle ?

(c) Multiset of simple cycles.

Florent Avellaneda

(d) Flower.

Exhibition of a Structural Bug with Wings

(e) Multiset of wings.

27 June 2014

10 / 22

What is a wing ? Definition A wing with valuation k starting from a node q corresponds to a cycle made of three components : A path from the node q to a node q 0 . A cycle over q 0 iterated k times. A path from q 0 to q.

'

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

11 / 22

Theorem Let H ∈ NA be a multiset of arcs corresponding to a cycle and qin ∈ QH . We can compute in polynomial time a finite multiset of wings F such that : each wing starts from qin , cost(F ) = m · cost(H) for some m ∈ N∗ . Moreover, Each component of each wing is simple, F contains at most d distinct wings.

x1 (-1, -1) (3, -1) l2 x3

q2

Florent Avellaneda

q0 a3

a1

(-1, -1) x1

a2 (-1, -1) x1

q1

l1 (-1, 2) x5

H = a1 + 5l1 + a2 + 3l2 + a3 W1 = a1 + 10l1 + a2 + a3 W2 = a1 + a2 + 6l2 + a3 F = W1 + W2 cost(F ) = 2 · cost(H)

Exhibition of a Structural Bug with Wings

27 June 2014

12 / 22

Theorem Let H ∈ NA be a multiset of arcs corresponding to a cycle and qin ∈ QH . We can compute in polynomial time a finite multiset of wings F such that : each wing starts from qin , cost(F ) = m · cost(H) for some m ∈ N∗ . Moreover, Each component of each wing is simple, F contains at most d distinct wings.

x1 (-1, -1) (3, -1) l2

q2

Florent Avellaneda

q0 a3

a1

(-1, -1) x1

a2 (-1, -1) x1

q1

l1 (-1, 2) x10

H = a1 + 5l1 + a2 + 3l2 + a3 W1 = a1 + 10l1 + a2 + a3 W2 = a1 + a2 + 6l2 + a3 F = W1 + W2 cost(F ) = 2 · cost(H)

Exhibition of a Structural Bug with Wings

27 June 2014

12 / 22

Theorem Let H ∈ NA be a multiset of arcs corresponding to a cycle and qin ∈ QH . We can compute in polynomial time a finite multiset of wings F such that : each wing starts from qin , cost(F ) = m · cost(H) for some m ∈ N∗ . Moreover, Each component of each wing is simple, F contains at most d distinct wings.

x1 (-1, -1) (3, -1) l2 x6

q2

Florent Avellaneda

q0 a3

a1

(-1, -1) x1

a2 (-1, -1) x1

q1

l1 (-1, 2)

H = a1 + 5l1 + a2 + 3l2 + a3 W1 = a1 + 10l1 + a2 + a3 W2 = a1 + a2 + 6l2 + a3 F = W1 + W2 cost(F ) = 2 · cost(H)

Exhibition of a Structural Bug with Wings

27 June 2014

12 / 22

Theorem Let H ∈ NA be a multiset of arcs corresponding to a cycle and qin ∈ QH . We can compute in polynomial time a finite multiset of wings F such that : each wing starts from qin , cost(F ) = m · cost(H) for some m ∈ N∗ . Moreover, Each component of each wing is simple, F contains at most d distinct wings.

x1 (-1, -1) (3, -1) l2 x3

q2

Florent Avellaneda

q0 a3

a1

(-1, -1) x1

a2 (-1, -1) x1

q1

l1 (-1, 2) x5

H = a1 + 5l1 + a2 + 3l2 + a3 W1 = a1 + 10l1 + a2 + a3 W2 = a1 + a2 + 6l2 + a3 F = W1 + W2 cost(F ) = 2 · cost(H)

Exhibition of a Structural Bug with Wings

27 June 2014

12 / 22

Idea of the proof

Definition Let H ∈ NA be a non-empty multiset of arcs and qin ∈ QH . Let C be a simple cycle within H and k = maxa∈C H(a). Then C is adequate for H and qin if it satisfies the two next conditions : the multiset of arcs H − k · C is connected ; if H − k · C is not empty then QH−k·C contains qin .

Key lemma For each H, we can compute in polynomial time an adequate cycle in H.

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

13 / 22

Illustration of the proof

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

14 / 22

Illustration of the proof

L

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

14 / 22

Illustration of the proof

L

Florent Avellaneda

k fois

Exhibition of a Structural Bug with Wings

27 June 2014

14 / 22

Illustration of the proof

F = k1 · W1

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

14 / 22

Illustration of the proof

F = k1 · W1

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

14 / 22

Illustration of the proof

F = 3 · k1 · W1 + k2 · W2

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

14 / 22

Illustration of the proof

F = 9 · k1 · W1 + 3 · k2 · W2 + k3 · W3

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

14 / 22

Illustration of the proof

F = 27 · k1 · W1 + 9 · k2 · W2 + 3 · k3 · W3 + k4 · W4

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

14 / 22

Illustration of the proof

F = 81 · k1 · W1 + 27 · k2 · W2 + 9 · k3 · W3 + 3 · k4 · W4 + k5 · W5

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

14 / 22

Illustration of the proof

F = 243 · k1 · W1 + 81 · k2 · W2 + 27 · k3 · W3 + 9 · k4 · W4 + 3 · k5 · W5 + k6 · W6

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

14 / 22

Illustration of the proof

F = 243 · k1 · W1 + 81 · k2 · W2 + 27 · k3 · W3 + 9 · k4 · W4 + 3 · k5 · W5 + k6 · W6 By Carathéodory’s theorem, we can reduce F to d wings.

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

14 / 22

Outline

1

Background

2

Representation of pathological cycles

3

Searching for minimal counter-examples

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

15 / 22

Context

The following problems are NP-hard : Minimizing the length of pathological cycles. Minimizing the number of distinct arcs in pathological cycles. Minimizing the number of dimensions in pathological cycles. Minimizing the maximum number of times each arc is used. However,

Second result Minimizing the length of wings can be done in polynomial time.

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

16 / 22

An Upper Bound for the Valuation of Wings

Lemma Let F be a multiset of wings starting from q with length at most l such that cost(F ) ≥ ~0. Let φ = 96 × p 4 × size(S). Then there exists a non-empty finite multiset F 0 of wings starting from q with length at most l and valuation at most 2φ such that cost(F 0 ) ≥ ~0. Hint : Write an integer linear program whose variables correspond to the valuation of wings.

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

17 / 22

Remarks : We can restrict the search to wings with length at most l and valuation at most 2φ . The number of these wings is finite. Let W1 , ..., WN be an enumeration of these wings. We consider the linear program for a vector x ∈ QN with N unknown : N ~ ΣN i=1 x[i] · cost(Wi ) ≥ 0 with x ∈ Q x ~0

Remark : The number of unknown is exponential. => We consider the dual problem.

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

18 / 22

Let W1 , ..., WN be an enumeration of wings starting from q with length at most l and valuation at most 2φ . We consider the linear program for a vector y ∈ Qp with p unknown : y [i] > 0, for i ∈ [1..p] −cost(Wi )> y > 0, for i ∈ [1..N] By Gordan Theorem, the linear program has no solution if and only if there exists some non-negative non-zero linear combination of its row vectors that sums to a non-negative vector. Remarks : The number of unknown is linear. The number of inequalities is exponential. We use the ellipsoid method [Grötschel, Lovász, Schrijver’81]. Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

19 / 22

Theorem [Grötschel, Lovász, Schrijver’81] We can solve a linear program with arbitrary number of constraints in polynomial time if we have a polynomial separation algorithm. Idea of the separation algorithm : If y 6> ~0, return some i ∈ [1..p] such that y [i] ≤ 0. For all q, q 0 ∈ Q, we calculate the maximal weight of the paths from q to q 0 with length at most l . ⇒ We calculate the wing with the maximum weight. y [i] > 0, for i ∈ [1..p] −cost(Wi )> y > 0, for i ∈ [1..N]

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

20 / 22

Conclusion

We are interested in structural properties of VASS because they are useful in practice. We can detect and represent a structural bug by a multiset of d wings in polynomial time. We can minimizing the length of these wings in polynomial time.

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

21 / 22

Thanks.

Florent Avellaneda

Exhibition of a Structural Bug with Wings

27 June 2014

22 / 22