Timed Pattern Matching Doan Ulus joint with T. Ferrere, E. Asarin, - - PowerPoint PPT Presentation

timed pattern matching
SMART_READER_LITE
LIVE PREVIEW

Timed Pattern Matching Doan Ulus joint with T. Ferrere, E. Asarin, - - PowerPoint PPT Presentation

Timed Pattern Matching Doan Ulus joint with T. Ferrere, E. Asarin, O. Maler and D. Nickovic Verimag, University of Grenoble-Alpes May 6, 2015 Real-time systems 2 Control Systems with Real-time Communication timing systems Biological


slide-1
SLIDE 1

Timed Pattern Matching

Doğan Ulus joint with T. Ferrere, E. Asarin, O. Maler and D. Nickovic Verimag, University of Grenoble-Alpes May 6, 2015

slide-2
SLIDE 2

2

Real-time systems

Real-time systems Systems with timing constraints Control Communication Biological . . . They are complex

+ Extremely large (or infinite) state-spaces + Functional equivalence between abstractions is an exception.

Verification of real-time systems

+ Simulation-based techniques to reason about

correctness/performance

+ Only some segments of simulation behaviors are interesting.

slide-3
SLIDE 3

3

Pattern Matching

Example Find for "was" or "were" in the text Regex Pattern w(as + ere) It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way - in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.

slide-4
SLIDE 4

4

Our intention

Consider a simulation behavior including some pulses. Assume long pulses are interesting.

y(t) t

slide-5
SLIDE 5

4

Our intention

Consider a simulation behavior including some pulses. Assume long pulses are interesting.

y(t) t

We would like to

+ Locate all interesting segments in a formal way.

slide-6
SLIDE 6

4

Our intention

Consider a simulation behavior including some pulses. Assume long pulses are interesting.

y(t) t

We would like to

+ Locate all interesting segments in a formal way.

How?

+ Abstract behaviors in timed level + Specify patterns using timed regular expressions + Perform timed pattern matching

slide-7
SLIDE 7

5

Outline

+ A Long Introduction

+ Timed level of abstraction + Why not real-time logics? + Path to timed regular

expressions + Theory and Practice

+ Definitions + Algorithms + Implementation

slide-8
SLIDE 8

6

Timed Level of Abstraction

+ Discrete values + Metric

Time

+ States as primitive timed

entities

t w0 : w1 :

Visual representation for timed state sequences (signals)

slide-9
SLIDE 9

6

Timed Level of Abstraction

+ Discrete values + Metric

Time

+ States as primitive timed

entities

t w0 : w1 :

Visual representation for timed state sequences (signals)

+ Timed patterns are

meaningful compositions of timed states.

+ Certain patterns are caused

by design or by nature.

t

duration

A timed pattern

slide-10
SLIDE 10

7

Flow

Deeper reality Timed level

Real-time System Behaviors Signals S i m u l a t i

  • n

Abstraction

slide-11
SLIDE 11

7

Flow

Deeper reality Timed level

Real-time System Behaviors Signals S i m u l a t i

  • n

Abstraction Signals Timed Regular Expressions Timed Pattern Matching Matches (Locations in time)

Our extent

slide-12
SLIDE 12

7

Flow

Deeper reality Timed level

Real-time System Behaviors Signals S i m u l a t i

  • n

Abstraction Signals Timed Regular Expressions Timed Pattern Matching Matches (Locations in time)

Our extent

Interesting Behaviors

More analysis More analysis

slide-13
SLIDE 13

7

Flow

Deeper reality Timed level

Real-time System Behaviors Signals S i m u l a t i

  • n

Abstraction Signals Timed Regular Expressions Timed Pattern Matching Matches (Locations in time)

Our extent

Interesting Behaviors

More analysis More analysis

+ We use TRE as a timed specification language. Why not

real-time logics?

slide-14
SLIDE 14

8

Real-time logics

+ Real-time logics (e.g. MTL) used to specify timed properties + Until operator (of LTL) enhanced as UI for time-bounded

sequential reasoning. (w, t) ψ1U[a,b]ψ2 ↔ ∃t′ ∈ [t + a, t + b]. (w, t′) ψ2 and ∀t′′ ∈ [t, t′]. (w, t′′) ψ1

B t p q p U[3,5] q

1 2 3 4 5 6 7 8 9 10 11 12 13

slide-15
SLIDE 15

9

Pulse Example

+ Consider a pulse. + Pulse spec in English:

When low, increase until high and flat more than 0.5 time units then decrease until low

+ In MTL:

ψ = (Low ∧ Inc) U (Inc U (High ∧ Flat) U≥0.5 (Dec U (Dec ∧ Low))))

w0(t) =

  • High

if y(t) > ch Low if y(t) < cl w1(t) =      Inc if ˙ y(t) > d Dec if ˙ y(t) < -d Flat if otherwise

y(t) t w0 : w1 : Low High Low Flat Inc Flat Dec Flat

+ In TRE:

ϕ := (Low ∧ Inc) · Inc · High ∧ Flat≥0.5 · Dec · (Dec ∧ Low)

slide-16
SLIDE 16

10

Comparison 1 - Intuitiveness

Adding additional constraint over total duration will result:

+ In MTL:

ψ′ = (Low ∧ Inc) U (Inc U (High ∧ Flat) U≥0.5 (Dec U (Dec ∧ Low)))) ∧ ((Low ∧ Inc) ∨ Inc ∨ (High ∧ Flat) ∨ Dec) U[2,5] (Dec ∧ Low)

+ In TRE:

ϕ′ := (Low∧Inc)·Inc·High∧Flat≥0.5·Dec·(Dec∧Low) [2,5]

slide-17
SLIDE 17

11

Comparison 2 - Expressiveness

Everyday patterns We can express in

y(t) t

Sequential composition (Pulse) MTL and TRE

y(t) t

OR

y(t) t

Alternation (2nd order response) MTL and TRE

y(t) t

AND

y(t) t

Parallel composition (Switching capacitors) MTL and TRE

y(t) t

Repetition (Modulated pulse)

  • nly TRE
slide-18
SLIDE 18

12

Comparison 3 - Semantics

+ MTL semantics is over time-points,

monitoring gives only beginnings.

+ TRE semantics is over time-segments,

monitoring gives all beginnings, endings and durations.

t w0 : w1 : Low High Low Flat Inc Flat Dec Flat Begin χ(ψ, w) End Begin M(ϕ, w)

slide-19
SLIDE 19

13

Timed regular expressions

ϕ := ǫ | p | p | ϕ · ϕ | ϕ ∨ ϕ | ϕ ∧ ϕ | ϕ∗ | ϕI p is a propositional variable, I is an interval

(w, t, t′) ǫ ↔ t = t′ (w, t, t′) p ↔ t < t′ and ∀t′′ ∈ (t, t′), p[t′′] = 1 (w, t, t′) p ↔ . . . (w, t, t′) ϕ · ψ ↔ ∃t′′ ∈ (t, t′), (w, t, t′′) ϕ and (w, t′′, t′) ψ (w, t, t′) ϕ ∨ ψ ↔ (w, t, t′) ϕ or (w, t, t′) ψ (w, t, t′) ϕ ∧ ψ ↔ . . . (w, t, t′) ϕ∗ ↔ ∃k ≥ 0, (w, t, t′) ϕk (w, t, t′) ϕI ↔ t′ − t ∈ I and (w, t, t′) ϕ

slide-20
SLIDE 20

14

Formal problem statement

Definition (Match-set)

For a signal w and an expression ϕ the match-set is M(ϕ, w) := {(t, t′) | (w, t, t′) ϕ}

Problem (Timed pattern matching)

Given a signal and an expression compute the match-set.

slide-21
SLIDE 21

15

Data structure

Mark (t, t′) if (w, t, t′) ϕ.

End Begin t t′

Better mark as zones.

End Begin b b′ e e′ d ′ d

A match beginning at t ending at t′.

b ≤ t ≤ b′ e ≤ t′ ≤ e′ d ≤ t′ − t ≤ d′

slide-22
SLIDE 22

16

Main result

Theorem

The match-set M(ϕ, w) is computable as a finite union of 2D zones.

slide-23
SLIDE 23

17

Base cases - Literals

t p p p

A signal w

t′ t Going 2D

M(p, w)

+ When a segment of p

satisfies, all sub-segments satisfy p.

+ Triangle zones

slide-24
SLIDE 24

18

Base cases - Duration constraints

t p p

A signal w

t′ t

M(p[1,2], w)

+ Restricting duration

M(ϕI, w) = M(ϕ, w) ∩ {(t, t′) | t′ − t ∈ I}

slide-25
SLIDE 25

19

Base cases - Concatenation

+ Concatenation is a composition of match sets.

M(ϕ · ψ) = M(ϕ) ◦ M(ψ) (t, t′) ∈ M(ϕ)◦M(ψ) ↔ ∃t′′ : (t, t′′) ∈ M(ϕ)∧(t′′, t′) ∈ M(ψ)

+ Can be obtained using standard zone operations. + Composition preserves zones and match sets

  • i

zi ◦

  • j

z′

j =

  • ij

zi ◦ z′

j

+ Most resulting zones are empty in practice. + Plane-sweep algorithm: sorting zones by start / end time

allows to avoid most empty operations

slide-26
SLIDE 26

20

Overall Computation

ϕ := (Low ∧ Inc) · Inc · High ∧ Flat>0.5 · Dec · (Dec ∧ Low)

Low Dec Dec >0.5 ∧ Flat High Inc ∧ Inc Low

slide-27
SLIDE 27

21

Matching Pulse Example

ϕ := (Low ∧ Inc) · Inc · High ∧ Flat≥0.5 · Dec · ( Dec ∧ Low )

t′ t t Low High Low Flat Inc Flat Dec Flat

slide-28
SLIDE 28

21

Matching Pulse Example

ϕ := (Low ∧ Inc) · Inc · High ∧ Flat≥0.5 · Dec · (Dec ∧ Low)

t′ t t Low High Low Flat Inc Flat Dec Flat

slide-29
SLIDE 29

21

Matching Pulse Example

ϕ := (Low ∧ Inc) · Inc · High ∧ Flat≥0.5 · Dec · (Dec ∧ Low)

t′ t t Low High Low Flat Inc Flat Dec Flat

slide-30
SLIDE 30

21

Matching Pulse Example

ϕ := (Low ∧ Inc) · Inc · High ∧ Flat ≥0.5 · Dec · (Dec ∧ Low)

t′ t t Low High Low Flat Inc Flat Dec Flat

slide-31
SLIDE 31

21

Matching Pulse Example

ϕ := (Low ∧ Inc) · Inc · High ∧ Flat ≥0.5 · Dec · (Dec ∧ Low)

t′ t t Low High Low Flat Inc Flat Dec Flat

slide-32
SLIDE 32

21

Matching Pulse Example

ϕ := (Low ∧ Inc) · Inc · High ∧ Flat≥0.5 · Dec · (Dec ∧ Low)

t′ t t Low High Low Flat Inc Flat Dec Flat

slide-33
SLIDE 33

21

Matching Pulse Example

ϕ := (Low ∧ Inc) · Inc · High ∧ Flat≥0.5 · Dec · (Dec ∧ Low)

t′ t t Low High Low Flat Inc Flat Dec Flat

slide-34
SLIDE 34

21

Matching Pulse Example

ϕ := ( Low ∧ Inc )· Inc · High ∧ Flat≥0.5 · Dec · (Dec ∧ Low)

t′ t t Low High Low Flat Inc Flat Dec Flat

slide-35
SLIDE 35

21

Matching Pulse Example

ϕ := (Low ∧ Inc) · Inc · High ∧ Flat≥0.5 · Dec · (Dec ∧ Low)

t′ t t Low High Low Flat Inc Flat Dec Flat

slide-36
SLIDE 36

21

Matching Pulse Example

M(ϕ, w) = {} = {(t, t′) ∈ [2, 2.2] × [3.8, 4]}

t′ t t Low High Low Flat Inc Flat Dec Flat

Return back to behaviors, segments in contain a pulse.

slide-37
SLIDE 37

22

Prototype Tool

On Implementation

+ in Python and C (using IF library for zones)

On Performance

+ 32K zones + complex expression = few seconds + Negligible overhead compared to simulation times

slide-38
SLIDE 38

23

Conclusion

+ TRE is intuitive, expressive and informative

for timed pattern matching purposes.

+ Problem of timed pattern matching stated

and solved in a 2D world.

+ A prototype tool developed. + Experiments on synthetic data witness scalability.

More details in

+ Timed Pattern Matching, [FORMATS’14]

  • D. Ulus, T. Ferrere, E. Asarin, O. Maler

+ Measuring with Timed Patterns, [CAV’15]

  • T. Ferrere, D. Nickovic, O. Maler, D. Ulus