Session-Based Compositional Verification on Actor-based Concurrent - - PowerPoint PPT Presentation

session based compositional verification on actor based
SMART_READER_LITE
LIVE PREVIEW

Session-Based Compositional Verification on Actor-based Concurrent - - PowerPoint PPT Presentation

Session-Based Compositional Verification on Actor-based Concurrent Systems Session Types for ABS Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 1


slide-1
SLIDE 1

Session-Based Compositional Verification on Actor-based Concurrent Systems

Session Types for ABS Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 1
slide-2
SLIDE 2

Motivation

◮ ABS language can be verified w.r.t. methods preserving class invariants ◮ Specification is written class-local directly in the verification logic

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 2
slide-3
SLIDE 3

Motivation

◮ ABS language can be verified w.r.t. methods preserving class invariants ◮ Specification is written class-local directly in the verification logic

Aim

Use session types as specification language for global communication of ABS systems.

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 2
slide-4
SLIDE 4

Motivation

◮ ABS language can be verified w.r.t. methods preserving class invariants ◮ Specification is written class-local directly in the verification logic

Aim

Use session types as specification language for global communication of ABS systems.

◮ But session types are not defined for such a restrictive concurrency model

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 2
slide-5
SLIDE 5

The ABS Concurrency Model

◮ ABS stands for Abstract Behavioural Specification ◮ Communication between objects are always asynchronous method calls ◮ No direct access to the fields of other objects ◮ Asynchronous method calls are realized through futures ◮ Futures can be passed around through method calls ◮ Object fields with future types ◮ At most one process is active on an object at a time ◮ Cooperative scheduling

◮ scheduling points are made syntactically explicit in the code ◮ await statement (on future or boolean expression)

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 3
slide-6
SLIDE 6

The ABS Concurrency Model

◮ ABS stands for Abstract Behavioural Specification ◮ Communication between objects are always asynchronous method calls ◮ No direct access to the fields of other objects ◮ Asynchronous method calls are realized through futures ◮ Futures can be passed around through method calls ◮ Object fields with future types ◮ At most one process is active on an object at a time ◮ Cooperative scheduling

◮ scheduling points are made syntactically explicit in the code ◮ await statement (on future or boolean expression)

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 3
slide-7
SLIDE 7

An ABS Example (asynchronous call + future)

int n(int i ){ Fut<int> f = o!m(i); await f ?; int r = f .get; return r; }

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 4
slide-8
SLIDE 8

ABS-based Session Types

◮ Adapt session types to futures

Instead of using arbitary channels

◮ Projections (global types to local types):

global behavior → object-local behavior → method-local behavior

◮ Specify history-based class invariants based on the session types ◮ Verify the history-based class invariants using KeY-ABS theorem prover

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 5
slide-9
SLIDE 9

Basic Projection from Global Types to Local Types

Global Types ::= p

f

− →q : m(S).G

Local Types ::= q!fm(S).L | p?fm(S).L

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 6
slide-10
SLIDE 10

Basic Projection from Global Types to Local Types

Global Types ::= p

f

− →q : m(S).G | q ↓ f : (S).G

Local Types ::= q!fm(S).L | p?fm(S).L | Put f : (S).L

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 6
slide-11
SLIDE 11

Basic Projection from Global Types to Local Types

Global Types ::= p

f

− →q : m(S).G | q ↓ f : (S).G | f ↑ p : (S).G

Local Types ::= q!fm(S).L | p?fm(S).L | Put f : (S).L

| Get f : (S).L

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 6
slide-12
SLIDE 12

Basic Projection from Global Types to Local Types

Global Types ::= p

f

− →q : m(S).G | q ↓ f : (S).G | f ↑ p : (S).G | Rel(p, f).G | end

Local Types ::= q!fm(S).L | p?fm(S).L | Put f : (S).L

| Get f : (S).L | Aw(f, f ′).L | React f.L | end

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 6
slide-13
SLIDE 13

Basic Projection from Global Types to Local Types

Global Types ::= p

f

− →q : m(S).G | q ↓ f : (S).G | f ↑ p : (S).G | Rel(p, f).G | end

Local Types ::= q!fm(S).L | p?fm(S).L | Put f : (S).L

| Get f : (S).L | Aw(f, f ′).L | React f.L | end

◮ Global Rel only needed if multiple Aw could be possible ◮ React never needed in global type

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 6
slide-14
SLIDE 14

Example

f0

− →a:m.

a

f

− →b:m1.

b

f ′

− →a:m2.

a↓f ′. f ′ ↑b. b↓f. a↓f0. end

a b

m1 m m2

f' f f0

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 7
slide-15
SLIDE 15

Example

f0

− →a:m.

a

f

− →b:m1.

b

f ′

− →a:m2.

a↓f ′. f ′ ↑b. b↓f. a↓f0. end b ?f m1. !f ′m2. Get f ′. Put f. end a ?f0m. !f m1. Aw(f0, f).?f ′m2. Put f ′. React f0. Put f0. end

a b

m1 m m2

f' f f0

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 7
slide-16
SLIDE 16

Example

f0

− →a:m.

a

f

− →b:m1.

b

f ′

− →a:m2.

a↓f ′. f ′ ↑b. b↓f. a↓f0. end b ?f m1. !f ′m2. Get f ′. Put f. end a ?f0m. !f m1. Aw(f0, f).?f ′m2. Put f ′. React f0. Put f0. end m ?f0m. !f m1. Aw(f0, f). Put f0 m2 ?f ′m2. Put f ′ m1 ?f m1. !f ′m2. Get f ′. Put f

a b

m1 m m2

f' f f0

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 7
slide-17
SLIDE 17

Wellformed Global Types

◮ Consistency constraints on valid types, e.g. no reuse of futures ◮ For projecting on methods, keep track of

◮ busy objects ◮ currently computed futures ◮ waiting futures

◮ Current status: relying on unambiguous and scheduler-independent control flow

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 8
slide-18
SLIDE 18

Wellformed Global Types

◮ Consistency constraints on valid types, e.g. no reuse of futures ◮ For projecting on methods, keep track of

◮ busy objects ◮ currently computed futures ◮ waiting futures

◮ Current status: relying on unambiguous and scheduler-independent control flow f0

− →a:m0 . a

f1

− →b:m1 . a

f2

− →c :m2 . b

f3

− →c :m2 . ...

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 8
slide-19
SLIDE 19

Wellformed Global Types

◮ Consistency constraints on valid types, e.g. no reuse of futures ◮ For projecting on methods, keep track of

◮ busy objects ◮ currently computed futures ◮ waiting futures

◮ Current status: relying on unambiguous and scheduler-independent control flow f0

− →a:m0 . a

f1

− →b:m1 . a

f2

− →c :m2 . b

f3

− →c :m2 . ...

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 8
slide-20
SLIDE 20

Wellformed Global Types

◮ Consistency constraints on valid types, e.g. no reuse of futures ◮ For projecting on methods, keep track of

◮ busy objects ◮ currently computed futures ◮ waiting futures

◮ Current status: relying on unambiguous and scheduler-independent control flow f0

− →a:m0 . a

f1

− →b:m1 . a

f2

− →c :m2 . b

f3

− →c :m2 . ...

f0

− →a:m0 . a

f1

− →b:m1 . c

f2

− →e:m2 . d

f3

− →f :m2 . ...

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 8
slide-21
SLIDE 21

Wellformed Global Types

◮ Consistency constraints on valid types, e.g. no reuse of futures ◮ For projecting on methods, keep track of

◮ busy objects ◮ currently computed futures ◮ waiting futures

◮ Current status: relying on unambiguous and scheduler-independent control flow f0

− →a:m0 . a

f1

− →b:m1 . a

f2

− →c :m2 . b

f3

− →c :m2 . ...

f0

− →a:m0 . a

f1

− →b:m1 . c

f2

− →e:m2 . d

f3

− →f :m2 . ...

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 8
slide-22
SLIDE 22

Branching

Branching operator p

      

l1 : G1 l2 : G2 ... ln : Gn

◮ With arbitary channels the choice is made by sending the label over a channel ◮ But futures cannot send arbitary data

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 9
slide-23
SLIDE 23

Branching

Branching operator p

        

l1 : p

f1

− →q1 :m1 . G′

1

l2 : p

f2

− →q2 :m2 . G′

2

... ln : p

fn

− →qn :mn . G′

n ◮ With arbitary channels the choice is made by sending the label over a channel ◮ But futures cannot send arbitary data ◮ Each choice must be made by calling a different method: mi = mj, if qi = qj ◮ Methodname takes role of branch-label

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 9
slide-24
SLIDE 24

Repetition

Repetition operator G∗

◮ Actions of futures are method calls and returns (and .get) ◮ If a method call is repeated, its return must also be repeated ◮ If a methods returns repeatedly, its call must also be repeated ◮ Futures used for repeated calls cannot be accessed afterwards

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 10
slide-25
SLIDE 25

Repetition

Repetition operator G∗

◮ Actions of futures are method calls and returns (and .get) ◮ If a method call is repeated, its return must also be repeated ◮ If a methods returns repeatedly, its call must also be repeated ◮ Futures used for repeated calls cannot be accessed afterwards

(p

f

− →q :m)∗ . q ↓ f

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 10
slide-26
SLIDE 26

Repetition

Repetition operator G∗

◮ Actions of futures are method calls and returns (and .get) ◮ If a method call is repeated, its return must also be repeated ◮ If a methods returns repeatedly, its call must also be repeated ◮ Futures used for repeated calls cannot be accessed afterwards

(p

f

− →q :m)∗ . q ↓ f

p

f

− →q :m . (q ↓ f)∗

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 10
slide-27
SLIDE 27

Repetition

Repetition operator G∗

◮ Actions of futures are method calls and returns (and .get) ◮ If a method call is repeated, its return must also be repeated ◮ If a methods returns repeatedly, its call must also be repeated ◮ Futures used for repeated calls cannot be accessed afterwards

(p

f

− →q :m)∗ . q ↓ f

p

f

− →q :m . (q ↓ f)∗

(p

f

− →q :m . q ↓ f)∗ . f ↑ p

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 10
slide-28
SLIDE 28

Composition Conjuncture

If all methods satisfy their types in class A

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 11
slide-29
SLIDE 29

Composition Conjuncture

If all methods satisfy their types in class A and they are called according to the global type

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 11
slide-30
SLIDE 30

Composition Conjuncture

If all methods satisfy their types in class A and they are called according to the global type and no other communication is made

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 11
slide-31
SLIDE 31

Composition Conjuncture

If all methods satisfy their types in class A and they are called according to the global type and no other communication is made, then class A satisfies its local type.

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 11
slide-32
SLIDE 32

Composition Conjuncture

If all methods satisfy their types in class A and they are called according to the global type and no other communication is made, then class A satisfies its local type.

Conjuncture

If all classes satisfy their local types, and no other communication is made, then the whole system satisfies its global type. I.e. every communication is allowed by the session type.

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 11
slide-33
SLIDE 33

Ongoing Work

Project is work in progress, missing parts:

◮ Correctness of composition ◮ Exploration of expressive power ◮ Wellformedness of repetition ◮ Scheduler configurations ◮ Extension to Protocol Types (Chen et Al.) with error handling ◮ Extension of KeY-ABS

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 12
slide-34
SLIDE 34

Summary

◮ Using session types to specify ABS systems ◮ Adaption of session types to futures ◮ Projection to method-local types ◮ Verification with KeY-ABS

Thank you for your attention.

  • 20. Oktober 2015 | TU Darmstadt | Eduard Kamburjan, Crystal Chang Din, Tzu-Chun Chen | 13