timed regular expressions derivatives and matching
play

Timed Regular Expressions Derivatives and Matching Dogan Ulus 1 , - PowerPoint PPT Presentation

Timed Regular Expressions Derivatives and Matching Dogan Ulus 1 , Thomas Ferr` ere 1 , Eugene Asarin 2 , and Oded Maler 1 1 verimag , Universit e Grenoble-Alpes & CNRS, France 2 irif , Universit e Paris Diderot, France May 10, 2016


  1. Timed Regular Expressions Derivatives and Matching Dogan Ulus 1 , Thomas Ferr` ere 1 , Eugene Asarin 2 , and Oded Maler 1 1 verimag , Universit´ e Grenoble-Alpes & CNRS, France 2 irif , Universit´ e Paris Diderot, France May 10, 2016 EQINOCS Workshop TRE Derivatives and Matching Thomas Ferr` ere 1 / 27

  2. Regular Expressions Formal Languages ◮ Alphabet: set of actions Σ = { a, b, c, . . . , z } ◮ Word: sequence w = a 1 a 2 a 3 . . . a n where a i ∈ Σ Regular Expressions ◮ Syntax: ϕ := ∅ | ǫ | a | ϕ · ϕ | ϕ ∨ ϕ | ϕ ∗ ◮ Semantics: � ∅ � w = ∅ � ǫ � w = { ( i, i ) : 0 ≤ i ≤ n } � a � w = { ( i − 1 , i ) : w [ i − 1 , i ] = a } � ϕ · ψ � w = { ( i, j ) : ∃ k, ( i, k ) ∈ � ϕ � w ∧ ( k, j ) ∈ � ψ � w } � ϕ i � � � ϕ ∗ � w = � ϕ ∨ ψ � w = � ϕ � w ∪ � ψ � w w i ≥ 0 TRE Derivatives and Matching Pattern Matching Thomas Ferr` ere 2 / 27

  3. Pattern Matching Problem (Matching) Given w = a 1 a 2 a 3 . . . a n and expression ϕ , compute � ϕ � w . Example � ϕ � w : j • • • • 5 • 4 ϕ = a ∗ ( bc ) ∗ • • • 3 • 2 • • 1 w : a c c b b • 0 0 1 2 3 4 5 0 1 2 3 4 5 i TRE Derivatives and Matching Pattern Matching Thomas Ferr` ere 3 / 27

  4. Timed Languages Timed words w = ( t 1 , a 1 )( t 2 , a 2 ) . . . ( t n , a n ) with 0 ≤ t 1 ≤ t 2 ≤ . . . ≤ t n . Two alternative interpretations: ◮ Event sequences ◮ interpret ( t, a ) as “ a occurs at time t ” ◮ notation: w = r 1 a 1 r 2 a 2 . . . r n a n (with r i = t i − t i − 1 , t 0 = 0 ) ◮ Continuous Signals ◮ interpret ( t, a ) as “ a holds up to time t ” ◮ notation: w = a r 1 1 a r 2 2 . . . a r n n (with r i = t i − t i − 1 , t 0 = 0 ) ◮ closure under stuttering : a r · a s = a r + s and a 0 = ǫ TRE Derivatives and Matching Pattern Matching Thomas Ferr` ere 4 / 27

  5. Timed Regular Expressions ◮ New operator � � I requiring duration in interval I ◮ Atomic expressions a now denote r · a (resp. a r ) for abritrary r ◮ Syntax: ϕ := ∅ | ǫ | a | ϕ · ϕ | ϕ ∨ ϕ | ϕ ∗ | � ϕ � I ◮ Semantics: � ∅ � w = ∅ � ǫ � w = { ( t, t ) : 0 ≤ t ≤ | w |} � a � w = { ( t, t ′ ) : w [ t, t ′ ] = a } � ϕ · ψ � w = { ( t, t ′ ) : ∃ t ′′ , ( t, t ′′ ) ∈ � ϕ � w ∧ ( t ′′ , t ′ ) ∈ � ψ � w } � ϕ i � � � ϕ ∗ � w = � ϕ ∨ ψ � w = � ϕ � w ∪ � ψ � w w i ≥ 0 � � ϕ � I � w = { ( t, t ′ ) ∈ � ϕ � w : t ′ − t ∈ I } TRE Derivatives and Matching Pattern Matching Thomas Ferr` ere 5 / 27

  6. Timed Regular Expressions ◮ New operator � � I requiring duration in interval I ◮ Atomic expressions a now denote r · a (resp. a r ) for abritrary r ◮ Syntax: ϕ := ∅ | ǫ | a | ϕ · ϕ | ϕ ∨ ϕ | ϕ ∗ | � ϕ � I ◮ Semantics: � ∅ � w = ∅ � ǫ � w = { ( t, t ) : 0 ≤ t ≤ | w |} � a � w = { ( t, t ′ ) : w [ t, t ′ ] = a } � ϕ · ψ � w = � ϕ � w ◦ � ψ � w � ϕ i � � � ϕ ∗ � w = � ϕ ∨ ψ � w = � ϕ � w ∪ � ψ � w w i ≥ 0 � � ϕ � I � w = { ( t, t ′ ) ∈ � ϕ � w : t ′ − t ∈ I } TRE Derivatives and Matching Pattern Matching Thomas Ferr` ere 5 / 27

  7. Atomic Events and Atomic Signals Let w = ( t 1 , a 1 )( t 2 , a 2 ) . . . ( t n , a n ) . Definition (sub-sequence) w [ t, t ′ ] = a if and only if ∃ i , t = t i − 1 ≤ t ′ = t i , and a i = a Definition (sub-signal) w [ t, t ′ ] = a if and only if ∃ i , t i − 1 ≤ t < t ′ ≤ t i , and a i = a assuming w stutter-free. ◮ In event sequences w [ t, t ′ ] only defined if some events occur at times t and t ′ ◮ In continuous signals w [ t, t ′ ] defined everywhere TRE Derivatives and Matching Pattern Matching Thomas Ferr` ere 6 / 27

  8. Timed Pattern Matching (Event Sequences) Example � ϕ � w : t ′ • • • • 5 . 7 • 4 . 3 • • • 3 . 6 ϕ = a ∗ ( bc ) ∗ • 2 . 2 • • 1 . 5 a b c b c w : • 0 1 . 5 2 . 2 3 . 6 4 . 3 5 . 7 0 0 1 . 52 . 2 3 . 64 . 3 5 . 7 t TRE Derivatives and Matching Pattern Matching Thomas Ferr` ere 7 / 27

  9. Timed Pattern Matching (Event Sequences) Example � ϕ � w : t ′ • • 5 . 7 4 . 3 • • 3 . 6 ϕ = � a ∗ ( bc ) ∗ � [2 , 5] 2 . 2 1 . 5 a b c b c w : 0 1 . 5 2 . 2 3 . 6 4 . 3 5 . 7 0 0 1 . 52 . 2 3 . 64 . 3 5 . 7 t TRE Derivatives and Matching Pattern Matching Thomas Ferr` ere 7 / 27

  10. Timed Pattern Matching (Continuous Signals) Example � ϕ � w : t ′ 5 . 7 4 . 3 3 . 6 ϕ = a ∗ ( bc ) ∗ 2 . 2 1 . 5 w : a c c b b 0 1 . 5 2 . 2 3 . 6 4 . 3 5 . 7 0 0 1 . 52 . 2 3 . 64 . 3 5 . 7 t TRE Derivatives and Matching Pattern Matching Thomas Ferr` ere 8 / 27

  11. Timed Pattern Matching (Continuous Signals) Example � ϕ � w : t ′ 5 . 7 4 . 3 3 . 6 ϕ = � a ∗ ( bc ) ∗ � [2 , 5] 2 . 2 1 . 5 w : a c c b b 0 1 . 5 2 . 2 3 . 6 4 . 3 5 . 7 0 0 1 . 52 . 2 3 . 64 . 3 5 . 7 t TRE Derivatives and Matching Pattern Matching Thomas Ferr` ere 8 / 27

  12. Offline Matching Continuous Signals Theorem (FORMATS’14) The set of matches � ϕ � w is computable as a finite union of 2d zones. Proof. Structural induction over ϕ : ◮ a : triangular zones for every segment ◮ ϕ ∨ ψ : simple union ◮ ϕ · ψ : composition of binary relations ◮ ϕ ∗ : closure is obtained in 2( | w | + � w � ) + 1 iterations ◮ � ϕ � I : intersection of zones with diagonal band of { ( t, t ′ ) : t ′ − t ∈ I } TRE Derivatives and Matching Pattern Matching Thomas Ferr` ere 9 / 27

  13. Offline Matching Continuous Signals (Concatenation) Example Concatenation of ϕ = � p � [1 , ∞ ] with ψ = � q � [0 , 2] 8 7 t ′ 6 5 t ′′ 4 3 2 ϕ ψ 1 ϕ · ψ 0 p p q q t ′′ t ′ 0 1 2 3 4 5 6 7 8 t TRE Derivatives and Matching Pattern Matching Thomas Ferr` ere 10 / 27 a match ( t, t ′ ) of ϕ · ψ zones for ϕ , ψ and ϕ · ψ

  14. Derivatives of Regular Expressions Nullable check ν ( ϕ 1 · ϕ 2 ) = ν ( ϕ 1 ) · ν ( ϕ 2 ) ν ( ∅ ) = ∅ ν ( ǫ ) = ǫ ν ( ϕ 1 ∨ ϕ 2 ) = ν ( ϕ 1 ) ∨ ν ( ϕ 2 ) ν ( ϕ ∗ ) = ǫ ν ( a ) = ∅ Derivatives d a ( ∅ ) = ∅ d a ( ϕ 1 · ϕ 2 ) = d a ( ϕ 1 ) · ϕ 2 ∨ ν ( ϕ 1 ) · d a ( ϕ 2 ) d a ( ǫ ) = ∅ d a ( ϕ 1 ∨ ϕ 2 ) = d a ( ϕ 1 ) ∨ d a ( ϕ 2 ) d a ( ϕ ∗ ) = d a ( ϕ ) · ϕ ∗ d a ( a ) = ǫ d a ( b ) = ∅ TRE Derivatives and Matching Derivatives Thomas Ferr` ere 11 / 27

  15. Matching using Derivatives Example: ϕ = a ∗ ( bc ) ∗ and w = abcbc . Symbols a b c b c Positions 1 2 3 4 5 1 ϕ TRE Derivatives and Matching Derivatives Thomas Ferr` ere 12 / 27

  16. Matching using Derivatives Example: ϕ = a ∗ ( bc ) ∗ and w = abcbc . Symbols a b c b c Positions 1 2 3 4 5 a ∗ ( bc ) ∗ 1 ϕ − → d a TRE Derivatives and Matching Derivatives Thomas Ferr` ere 12 / 27

  17. Matching using Derivatives Example: ϕ = a ∗ ( bc ) ∗ and w = abcbc . Symbols a b c b c Positions 1 2 3 4 5 a ∗ ( bc ) ∗ c ( bc ) ∗ 1 ϕ − → − → d a d b TRE Derivatives and Matching Derivatives Thomas Ferr` ere 12 / 27

  18. Matching using Derivatives Example: ϕ = a ∗ ( bc ) ∗ and w = abcbc . Symbols a b c b c Positions 1 2 3 4 5 a ∗ ( bc ) ∗ c ( bc ) ∗ ( bc ) ∗ 1 ϕ − → − → − → d a d b d c TRE Derivatives and Matching Derivatives Thomas Ferr` ere 12 / 27

  19. Matching using Derivatives Example: ϕ = a ∗ ( bc ) ∗ and w = abcbc . Symbols a b c b c Positions 1 2 3 4 5 a ∗ ( bc ) ∗ c ( bc ) ∗ ( bc ) ∗ c ( bc ) ∗ 1 ϕ − → − → − → − → d a d b d c d b TRE Derivatives and Matching Derivatives Thomas Ferr` ere 12 / 27

  20. Matching using Derivatives Example: ϕ = a ∗ ( bc ) ∗ and w = abcbc . Symbols a b c b c Positions 1 2 3 4 5 a ∗ ( bc ) ∗ c ( bc ) ∗ ( bc ) ∗ c ( bc ) ∗ ( bc ) ∗ 1 ϕ − → − → − → − → − → d a d b d c d b d c TRE Derivatives and Matching Derivatives Thomas Ferr` ere 12 / 27

  21. Matching using Derivatives Example: ϕ = a ∗ ( bc ) ∗ and w = abcbc . Symbols a b c b c Positions 1 2 3 4 5 a ∗ ( bc ) ∗ c ( bc ) ∗ ( bc ) ∗ c ( bc ) ∗ ( bc ) ∗ 1 ϕ − → − → − → − → − → d a d b d c d b d c c ( bc ) ∗ ( bc ) ∗ c ( bc ) ∗ ( bc ) ∗ 2 ϕ − → − → − → − → d b d c d b d c 3 ϕ − → − → − → ∅ ∅ ∅ d c d b d c c ( bc ) ∗ ( bc ) ∗ 4 ϕ − → − → d b d c 5 ϕ − → ∅ d c TRE Derivatives and Matching Derivatives Thomas Ferr` ere 12 / 27

  22. Derivatives of Timed Regular Expressions (Event Sequences) � ǫ if 0 ∈ I and ν ( ϕ ) ◮ Nullable check: ν ( � ϕ � I ) = ∅ otherwise ◮ Derivative relative to events: d a ( � ϕ � I ) = � d a ( ϕ ) � I ◮ Derivative relative to time: d r ( a ) = a and d r ( � ϕ � I ) = � d r ( ϕ ) � I ⊖ r ◮ The set of derivatives over some event sequence is finite TRE Derivatives and Matching Timed Derivatives Thomas Ferr` ere 13 / 27

Recommend


More recommend