36
Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS MPI-SWS

Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Embed Size (px)

Citation preview

Page 1: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Expand, Enlarge, and Check for Branching

Vector Addition Systems

Rupak Majumdar Zilong Wang

MPI-SWS MPI-SWS

Page 2: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Branching Vector Addition Systems(BVAS)

• A generalization of vector addition systems (VAS)

• A very expressive concurrency model – spawn and wait– asynchronous programming

• Program safety coverability problem for BVAS

Page 3: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Coverability ResultsCoverability VAS BVAS

Theory

Practice

EXPSPACE-complete [Lipton 76, Rackoff 78]Nondeterministically guess a doubly exponential covering path

2EXPTIME-complete[Demri et al. 09]Nondeterministically guess a doubly exponential covering tree

• Backward reachability [Abdulla et al. 96]

[2EXPTIME: Bozzelli & Ganty 11]

• Expand, Enlarge, and Check (EEC) [Geeraerts et al. 04] [complexity unknown]

Page 4: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Coverability ResultsCoverability VAS BVAS

Theory

Practice

EXPSPACE-complete [Lipton 76, Rackoff 78]Nondeterministically guess a doubly exponential covering path

2EXPTIME-complete[Demri et al. 09]Nondeterministically guess a doubly exponential covering tree

• Backward reachability [Abdulla et al. 96]

[2EXPTIME: Bozzelli & Ganty 11]

• EEC

EEC [2EXPTIME]

[EXPSPACE]

Page 5: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Outline

• Recap of EEC for VAS

• Complexity analysis of EEC for VAS • Generalized to EEC for BVAS

• Experimental results of EEC for BVAS

Page 6: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Vector Addition System (VAS)

VAS

• is the dimension of vectors

• is the initial vector

• is a finite set of unary rules

Page 7: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Derivationinitialvectordim unary rules

(1, 2)(2, -1)

(3, 1)(-1, -1)

(2, 0)

(1, 2) + (2, -1) = (3, 1)

(3, 1) + (-1, -1) = (2, 0)

(-1, -1)

(1, -1) derives

Page 8: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Coverability Problem

Given a VAS and a target , is there a covering derivation of in ?

is a covering (derivation) of if derives a vector such that

Page 9: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

EEC for VAS

Page 10: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Truncated and Extended Derivations w.r.t a bound

Normal Truncated ( = 2) Extended ( = 2)

If a number > ,truncate it to

If a number > ,extend it to

Page 11: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

EEC for VAS

No

No

Cover

Uncover

Yes

Yes

Page 12: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Soundness and Completeness [Geeraerts et al. 04]

Page 13: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Complexity Analysis

Page 14: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

EEC for VASHow many iterations are required for termination?

Finite graph reachability. Size of the graph is

Finite graph reachability. Size of the graph is

No

No

Cover

Uncover

Yes

Yes

Page 15: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Definitions

Given a VAS and a vector , define

• input size : number of bits required to encode and in binary

• : the absolute value of the smallest negative integer in (i.e. the maximal decrease in one step of a derivation)

• : the greatest integer in

Page 16: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Lemmas

Lemma 1 [Rackoff 78, Demri et al. 09]: If there is a covering derivation of , there is one whose length is at most

Lemma 2: For all , if there is a covering extended derivation of , there is one whose length is at most

Page 17: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Pf: Let

We show:

Theorem 1: EEC for VAS terminates in iterations

Theorem

1.If is coverable, there is a covering truncated derivation

2.If is uncoverable, there is no covering extended derivation

Page 18: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Proof of Claim 1

By Lemma 1:

If is coverable, there is a covering truncated derivation

No truncation in

Page 19: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Proof of Claim 1

By Lemma 1:

There is a truncation in

If is coverable, there is a covering truncated derivation

Page 20: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Pf: Let

We show:

Theorem 1: EEC for VAS terminates in iterations

Theorem

1.If is coverable, there is a covering truncated derivation

2.If is uncoverable, there is no covering extended derivation

Page 21: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Proof of Claim 2

By Lemma 2:

If is uncoverable, there is no covering extended derivation

No extension in

Page 22: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Proof of Claim 2

By Lemma 2:

There is an extension in

If is uncoverable, there is no covering extended derivation

Page 23: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Pf: Let

We show:

Theorem 1: EEC for VAS terminates in iterations

Theorem

1.If is coverable, there is a covering truncated derivation

2.If is uncoverable, there is no covering extended derivation

✓✓

Page 24: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Theorem 1: EEC for VAS terminates in iterations

Pf:• By Theorem 1, =

• Each iteration solves two finite graph reachability problems

• Each graph has at most or nodes , which is

• Finite graph reachability problem is in NLOGSPACE

Theorem 2: EEC for VAS is in EXPSPACE

Page 25: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Branching Vector Addition System

Page 26: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

BVAS

BVAS

is the dimension of vectors

is a finite set of axioms

is a finite set of unary rules

is a finite set of binary rules

Page 27: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Derivation

(0,3)+(4,2)+(0,-4)=(4, 1)

(0, 1)

(5, -2) derives (5, 1)

dim axioms unary rules binary rule

(0, 1)(0, 2)

(0, 3)

(3, 2)(1, 0)

(4, 2)

(0, -4)

(0, -4)

(1, 0)

(5, 1)

Page 28: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Coverability Problem

Given a BVAS and a target , is there a covering derivation of in ?

is a covering (derivation) of if derives a vector such that

Page 29: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

EEC for BVAS

No

No

Cover

Uncover

Yes

Yes

These are trees

Page 30: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Theorems about EEC for BVAS

Theorem 4: EEC for BVAS terminates in iterations

Theorem 5: EEC for BVAS is in 2EXPTIME

Page 31: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Implementation and Experimental Results

Page 32: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Single-wait Programs [Bouajjani & Emmi 12]

• A function can

1. call unboundedly many asynchronous functions running in parallel

2. wait till the first return value comes back

• State reachability BVAS coverability

Page 33: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

DNS lookupdns_server(Name) { ... // do something else do { post r0 <- lookup Name (fun ret->Result=ret); } while(*) ... // do something else ewait r0; assert(is_valid_ip(Result)); ... // do something else}

lookup(Name) { // lookup() returns ip ... while(true) { allocate(Buf); post r1 <- server1 Name (fun ret->Buf=ret);//server1 returns err or ip post r1 <- server2 Name (fun ret->Buf=ret);//server2 returns err or ip

... // do something else ewait r1; if (Buf == err) {

free(Buf);

} return Buf; }}

Can this assertion fail?

continue;

• Asynchronously make unboundedly many lookups

• wait till the first return value that comes back.

• Ask two remote servers for an ip address

• wait for the first return value

Page 34: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Experimental Results

#server #dimension

#axiom #urule #brule result time

2 19 20 9153 6950 Uncover 31.25s

3 22 23 14832 11664 Uncover 79.16s

4 25 26 22640 18326 Uncover 151.46s

5 28 29 33070 27392 Uncover 279.56s

6 31 32 46638 39366 Uncover 463.71s

6(buggy) 31 32 40077 32805 Cover 63.58s

Page 35: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

SummaryCoverability VAS BVAS

Theory

Practice

EXPSPACE-complete [Lipton 76, Rackoff 78]Nondeterministically guess a doubly exponential covering path

2EXPTIME-complete[Demri et al. 09]Nondeterministically guess a doubly exponential covering tree

• Backward reachability [Abdulla et al. 96]

[2EXPTIME: Bozelli & Ganty 11]

• EEC

EEC [2EXPTIME]

[EXPSPACE]

Page 36: Expand, Enlarge, and Check for Branching Vector Addition Systems Rupak Majumdar Zilong Wang MPI-SWS

Questions?

www.mpi-sws.org/~zilong