Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

39
Runtime Monitoring of Stream Logic Formulæ Sylvain Hallé and Raphaël Khoury Fonds de recherche sur la nature et les technologies CRSNG NSERC Université du Québec à Chicoutimi, Canada

Transcript of Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

Page 1: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

Runtime Monitoring ofStream Logic Formulæ

Sylvain Hallé and Raphaël Khoury

Fonds de recherchesur la natureet les technologies

CRSNGNSERC

Université du Québec à Chicoutimi, Canada

Page 2: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)
Page 3: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

System

Page 4: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

System

Page 5: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

System

Instrumentation

Page 6: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

System

Instrumentation

Page 7: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

System

Instrumentation

Trace

Page 8: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

System

Instrumentation

Trace

Events

Page 9: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

System

Instrumentation

Trace

Events

Page 10: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

System

Instrumentation

Trace

Events

Tracevalidation

Page 11: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

Iterator<T>

Page 12: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

Iterator<T>

hasNext

next

Page 13: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

Iterator<T>

hasNext

next

A call to next must be precededby a call to hasNext

Page 14: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

B

A

Page 15: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

B

A

No CartCreate request can occurbefore a LoginResponse message

Page 16: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

Login

Page 17: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

Login

Three successive login attemptsshould trigger an alarm

Page 18: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)
Page 19: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

Receive order

Page 20: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

Receive orderReady?

Page 21: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

Receive orderReady? Yes

Page 22: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

Receive orderReady? Yes

File order

No Ship

Page 23: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

Receive orderReady? Yes

File order

No Ship

A received order must eventuallybe shipped

Page 24: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

A

0 1 2 3 4 . . .

a a b c b

A trace m is a mapping from ℕ tothe set of events :

ALet be a set of event symbols.

Page 25: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

A monitor takes as input an event trace and outputsa trace of truth values

a c d T

T T . . .

T

T

c

T T T . . .

T T T . . .

. . .T T

T

Page 26: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

Notation:

m : φ

Input trace Expression

Page 27: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

The output of monitors can be combined usingthe usual logical connectives

φ ∧ ψ

TT. . .φ

∧ψ T

T. . .

Page 28: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

Inputs and outputs may be delayed: the notationinduces an implicit buffering

T T . . .φ∧

ψ T . . .

Processing advances in discrete steps: an event iseither produced or not at step n

=> delays != processing time

T

1 2T

T

31 2 3

T

Page 29: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

A filter takes as input an event trace and a monitor.It outputs event n if and only if the n-th output of itsmonitor is true.

. . .

φ

∞φa c d a d

Page 30: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

Notation:

∞φ

Output all events(satisfying φ)

Output only the k-thevent satisfying φ

Page 31: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

∞c ∨ d

Output all events that satisfy c or d

c1 : T

Output the first event that satisfies c

c2 :T

1

))b ∧: T

Monitor "some b isimmediately followedby a c"

Page 32: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

Linear Temporal Logic can be recursivelymapped into filters and monitors

μ(φ)1 : Tμ(F φ) =

μ(X φ) = μ(φ)2 :T

μ(φ U ψ) =μ(¬φ)

1 : T

μ(ψ)1 : T∧1

G φ F ψwhichevercomes first

Page 33: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

A call to next must be followed by a callto hasNext

No CartCreate request can occurbefore a LoginResponse message

A received order must eventuallybe shipped

Three successive login attempts shouldtrigger an alarm

G (next → X hasNext)

¬ CartCreate U hasNext

G (receive → F ship)

G ¬(fail ∧ (X (fail ∧ X fail)))

Page 34: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

A few identities can be applied...

1 : T

1 : T

p

1 : TT

ϵ : T

ϵ

Page 35: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

A few identities can be applied...

1 : T

1 : T

p

1 : TT

ϵ : T

ϵ

Page 36: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

A few identities can be applied...

1 : T

1 : T

p

1 : TT

ϵ : T

ϵ

Page 37: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

A few identities can be applied...

1 : T

1 : T

p

1 : TT

ϵ : T

ϵ

Page 38: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

A few identities can be applied...

1 : T

1 : T

p

1 : TT

ϵ : T

ϵ

μ(G F p) =

= the empty trace

Page 39: Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)

* 10

100

0

>

0

>

0

10

peeB peeB 3http://lif-labs.github.io/beepbeep-3

Principle further generalized andimplemented in...