timed pattern matching
play

Timed Pattern Matching FORMATS14 gan Ulus 1 ere 1 Eugene Asarin 2 - PowerPoint PPT Presentation

Timed Pattern Matching FORMATS14 gan Ulus 1 ere 1 Eugene Asarin 2 Oded Maler 1 Do Thomas Ferr` 1 VERIMAG, CNRS and the University of Grenoble-Alpes 2 LIAFA, University of Paris Diderot / CNRS September 10, 2014 Timed Pattern Matching


  1. Timed Pattern Matching FORMATS’14 gan Ulus 1 ere 1 Eugene Asarin 2 Oded Maler 1 Do˘ Thomas Ferr` 1 VERIMAG, CNRS and the University of Grenoble-Alpes 2 LIAFA, University of Paris Diderot / CNRS September 10, 2014 Timed Pattern Matching Thomas Ferr` ere 1 / 26

  2. Pattern matching Problem (Pattern matching for regular expressions) Given a word w ∈ Σ ∗ and a regular expression ϕ find subwords v of w that match ϕ . Classical solutions ◮ algorithms: often based on automata ◮ tools: grep , sed , programming languages: perl , python etc. Timed Pattern Matching Thomas Ferr` ere 2 / 26

  3. Timed pattern matching Why do it? ◮ Monitoring of embedded systems ◮ Hardware specification languages ◮ Timed texts (music, speech) ◮ Quantitative pattern matching (texts, DNA sequences) Why is it not straightforward? ◮ Classical algorithms based on (implicit) determinization ⇒ heavy subset construction ◮ Timed automaton does not explicitely provide all matches Timed Pattern Matching Thomas Ferr` ere 3 / 26

  4. Example ◮ Expression: ϕ = � ( p ∧ q ) · ¯ q · q � [4 , 5] · ¯ p ◮ Signals: p q 0 2 4 6 8 10 12 ◮ Matches: p ∧ q ¯ q q p ¯ 1 . 3 2 . 0 6 . 06 . 3 6 . 8 p ∧ q ¯ q q ¯ p 1 . 5 2 . 0 6 . 0 6 . 4 7 . 0 Timed Pattern Matching Thomas Ferr` ere 4 / 26

  5. Outline Problem statement 1 The solution 2 Practical algorithmics 3 Experiments 4 Timed Pattern Matching Problem statement Thomas Ferr` ere 5 / 26

  6. Outline Problem statement 1 The solution 2 Practical algorithmics 3 Experiments 4 Timed Pattern Matching Problem statement Thomas Ferr` ere 6 / 26

  7. Timed Boolean signals Example p q 0 2 4 6 8 10 12 Definition (Boolean Signals) Let T = [0 , d ] (time domain). ◮ a Boolean signal is a function w : T → B m . ◮ can be represented using m Boolean variables p ( t ) . ◮ assumption: the number of discontinuities is finite. Timed Pattern Matching Problem statement Thomas Ferr` ere 7 / 26

  8. Timed regular expressions – to specify sets of signals Definition (Syntax of TRE) ϕ := ǫ | p | p | ϕ · ϕ | ϕ ∨ ϕ | ϕ ∧ ϕ | ϕ ∗ | � ϕ � I p propositional variable, I integer bounded interval Definition (Semantics of TRE) ( w, t, t ′ ) t = t ′ ↔ � ǫ t < t ′ and ∀ t ′′ ∈ ( t, t ′ ) , p [ t ′′ ] = 1 ( w, t, t ′ ) � p ↔ ( w, t, t ′ ) ↔ � p . . . ∃ t ′′ ∈ ( t, t ′ ) , ( w, t, t ′′ ) � ϕ and ( w, t ′′ , t ′ ) � ψ ( 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 ↔ t ′ − t ∈ I and ( w, t, t ′ ) � ϕ ( w, t, t ′ ) � � ϕ � I ↔ Timed Pattern Matching Problem statement Thomas Ferr` ere 8 / 26

  9. Timed regular expressions – to specify sets of signals Definition (Syntax of TRE) ϕ := ǫ | p | p | ϕ · ϕ | ϕ ∨ ϕ | ϕ ∧ ϕ | ϕ ∗ | � ϕ � I p propositional variable, I integer bounded interval Definition (Semantics of TRE) ( w, t, t ′ ) t = t ′ ↔ � ǫ t < t ′ and ∀ t ′′ ∈ ( t, t ′ ) , p [ t ′′ ] = 1 ( w, t, t ′ ) � p ↔ ( w, t, t ′ ) ↔ � p . . . ∃ t ′′ ∈ ( t, t ′ ) , ( w, t, t ′′ ) � ϕ and ( w, t ′′ , t ′ ) � ψ ( 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 ↔ t ′ − t ∈ I and ( w, t, t ′ ) � ϕ ( w, t, t ′ ) � � ϕ � I ↔ Timed Pattern Matching Problem statement Thomas Ferr` ere 8 / 26

  10. Problem statement Definition (Match-set) For a signal w and an expression ϕ the match-set is M ( ϕ, w ) := { ( t, t ′ ) ∈ T × T : ( w, t, t ′ ) � ϕ } Problem (Timed pattern matching) Given a signal and an expression compute the match-set. Timed Pattern Matching Problem statement Thomas Ferr` ere 9 / 26

  11. Problem statement Definition (Match-set) For a signal w and an expression ϕ the match-set is M ( ϕ, w ) := { ( t, t ′ ) ∈ T × T : ( w, t, t ′ ) � ϕ } Problem (Timed pattern matching) Given a signal and an expression compute the match-set. Timed Pattern Matching Problem statement Thomas Ferr` ere 9 / 26

  12. Outline Problem statement 1 The solution 2 Practical algorithmics 3 Experiments 4 Timed Pattern Matching The solution Thomas Ferr` ere 10 / 26

  13. Data structure Definition (2d zone) A 2d zone is a subset of R 2 described by inequalities e < x − y < f a < x < b c < y < d with a, b, c, d, e, f real constants. About 2d zones ◮ convex polygons (with up to 6 edges) ◮ only vertical, horizontal and diagonal edges Timed Pattern Matching The solution Thomas Ferr` ere 11 / 26

  14. Data structure Definition (2d zone) A 2d zone is a subset of R 2 described by inequalities e < x − y < f a < x < b c < y < d with a, b, c, d, e, f real constants. About 2d zones ◮ convex polygons (with up to 6 edges) ◮ only vertical, horizontal and diagonal edges Timed Pattern Matching The solution Thomas Ferr` ere 11 / 26

  15. Main result Theorem The match-set M ( ϕ, w ) is computable as a finite union of 2d zones. Proof principle Structural induction over ϕ ⇒ recursive algorithm over the expression syntactic tree Timed Pattern Matching The solution Thomas Ferr` ere 12 / 26

  16. Main result Theorem The match-set M ( ϕ, w ) is computable as a finite union of 2d zones. Proof principle Structural induction over ϕ ⇒ recursive algorithm over the expression syntactic tree Timed Pattern Matching The solution Thomas Ferr` ere 12 / 26

  17. Structural induction: base cases Empty word M ( ǫ, w ) = { ( t, t ′ ) : t = t ′ } and the diagonal is a zone A literal Example M ( p, w ) is a union of triangles over the diagonal Timed Pattern Matching The solution Thomas Ferr` ere 13 / 26

  18. Structural induction: base cases Empty word M ( ǫ, w ) = { ( t, t ′ ) : t = t ′ } and the diagonal is a zone A literal Example M ( p, w ) is a union of triangles 12 over the diagonal 11 10 9 8 7 6 5 4 3 2 1 p 0 p 0 1 2 3 4 5 6 7 8 9 10 11 12 Timed Pattern Matching The solution Thomas Ferr` ere 13 / 26

  19. Structural induction: Boolean closure Intersection Zones are closed under intersection Union Unions of zones are closed under union Time restriction Example M ( � ϕ � I , w ) = M ( ϕ, w ) ∩{ ( t, t ′ ) : t ′ − t ∈ I } is an intersection of zones Timed Pattern Matching The solution Thomas Ferr` ere 14 / 26

  20. Structural induction: Boolean closure Intersection Zones are closed under intersection Union Unions of zones are closed under union Time restriction Example M ( � ϕ � I , w ) = M ( ϕ, w ) ∩{ ( t, t ′ ) : t ′ − t ∈ I } is an intersection of zones Timed Pattern Matching The solution Thomas Ferr` ere 14 / 26

  21. Structural induction: Boolean closure Intersection Zones are closed under intersection Union Unions of zones are closed under union Time restriction Example M ( � ϕ � I , w ) = M ( ϕ, w ) ∩{ ( t, t ′ ) : t ′ − t ∈ I } 12 is an intersection of zones 11 10 9 8 7 6 5 4 3 2 1 � p � [1 , 2] 0 p 0 1 2 3 4 5 6 7 8 9 10 11 12 Timed Pattern Matching The solution Thomas Ferr` ere 14 / 26

  22. Structural induction: concatenation Lemma (Concatenation = composition of binary relations) M ( ϕ · ψ, w ) = M ( ϕ, w ) ◦ M ( ψ, w ) Composition preserves zones ( t, t ′ ) ∈ z 1 ◦ z 2 ↔ ∃ t ′′ : ( t, t ′′ ) ∈ z 1 ∧ ( t ′′ , t ′ ) ∈ z 2 . Can be obtained using standard zones operations. Timed Pattern Matching The solution Thomas Ferr` ere 15 / 26

  23. Structural induction: concatenation Lemma (Concatenation = composition of binary relations) M ( ϕ · ψ, w ) = M ( ϕ, w ) ◦ M ( ψ, w ) Composition preserves zones ( t, t ′ ) ∈ z 1 ◦ z 2 ↔ ∃ t ′′ : ( t, t ′′ ) ∈ z 1 ∧ ( t ′′ , t ′ ) ∈ z 2 . Can be obtained using standard zones operations. Timed Pattern Matching The solution Thomas Ferr` ere 15 / 26

  24. Example Concatenation of ϕ = � p � [1 , ∞ ] with ψ = � q � [0 , 2] 8 7 6 t ′ 5 t ′′ 4 3 2 ϕ ψ 1 ϕ · ψ 0 p p q q 0 1 2 3 4 5 6 7 8 t t ′′ t ′ a match ( t, t ′ ) of ϕ · ψ zones for ϕ , ψ and ϕ · ψ Timed Pattern Matching The solution Thomas Ferr` ere 16 / 26

  25. Structural induction: Kleene star Definition (size of a signal) σ ( w ) – minimal number of intervals that: ◮ cover the time domain of w ◮ are of length < 1 ◮ w is constant in each interval Lemma (Star is bounded) If σ ( w ) = k then M ( ϕ ∗ , w ) = M ( ϕ ≤ 2 k +1 , w ) . Timed Pattern Matching The solution Thomas Ferr` ere 17 / 26

  26. Structural induction: Kleene star Definition (size of a signal) σ ( w ) – minimal number of intervals that: ◮ cover the time domain of w ◮ are of length < 1 ◮ w is constant in each interval Lemma (Star is bounded) If σ ( w ) = k then M ( ϕ ∗ , w ) = M ( ϕ ≤ 2 k +1 , w ) . Timed Pattern Matching The solution Thomas Ferr` ere 17 / 26

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend