Checking Timed Regular Expressions on Boolean Signals Eugene Asarin, Thomas Ferrere, Oded Maler, Dogan Ulus Verimag & LIAFA July 9, 2014
Here we begin Introduction Patterns exist on signals. (Intentionally or unintentionally) Checking patterns is an important verification task. Regular Expressions (Usual solution) Uses: PSL, SVA This work A complete solution for Timed Pattern Matching problem 2 / 23
Timed Pattern Matching Problem (Timed Pattern Matching) Let T = [0 , d ] . Given a dense-time signal w : T → B m and a timed regular expression ϕ , find all intervals ( t , t ′ ) ∈ T × T that matches ϕ . We need to define ... 1 Timed Regular Expressions 2 Match-Set 3 / 23
Timed Pattern Matching Problem (Timed Pattern Matching) Let T = [0 , d ] . Given a dense-time signal w : T → B m and a timed regular expression ϕ , find all intervals ( t , t ′ ) ∈ T × T that matches ϕ . We need to define ... 1 Timed Regular Expressions 2 Match-Set 4 / 23
Timed Regular Expressions Definition (Syntax of TRE) ϕ := ǫ | p | p | ϕ · ϕ | ϕ ∨ ϕ | ϕ ∧ ϕ | ϕ ∗ | � ϕ � I ( p propositional variable; I duration constraint) 5 / 23
Timed Regular Expressions Definition (Syntax of TRE) ϕ := ǫ | p | p | ϕ · ϕ | ϕ ∨ ϕ | ϕ ∧ ϕ | ϕ ∗ | � ϕ � I ( p propositional variable; I duration constraint) It will match ... ϕ := p — any interval s.t. p uniformly holds ϕ := p · q — any interval s.t. p followed by q ϕ := � p · q � [3 , 4] — any interval with a duration between [3,4] s.t. p followed by q 6 / 23
Timed Regular Expressions Definition (Syntax of TRE) ϕ := ǫ | p | p | ϕ · ϕ | ϕ ∨ ϕ | ϕ ∧ ϕ | ϕ ∗ | � ϕ � I ( p propositional variable; I duration constraint) Definition (Semantics of TRE) ( w , t , t ′ ) � ǫ ↔ t = t ′ t < t ′ and ∀ s ∈ ( t , t ′ ) : p [ s ] = 1 ( w , t , t ′ ) ↔ � p ( w , t , t ′ ) similar � p ( w , t , t ′ ) � ϕ · ψ ↔ ∃ t ′′ . ( w , t , t ′′ ) � ϕ and ( w , t ′′ , t ′ ) � ψ ( w , t , t ′ ) � ϕ ∨ ψ ↔ ( w , t , t ′ ) � ϕ or ( w , t , t ′ ) � ψ ( w , t , t ′ ) � ϕ ∧ ψ similar ∃ k ≥ 0 . ( w , t , t ′ ) � ϕ k ( w , t , t ′ ) � ϕ ∗ ↔ t ′ − t ∈ I and ( w , t , t ′ ) � ϕ ( w , t , t ′ ) � � ϕ � I ↔ 7 / 23
An Example Expression ϕ := � ( p ∧ q ) · ¯ q · q � [4 , 5] · ¯ p Signals p q 0 2 4 6 8 10 12 8 / 23
An Example Expression ϕ := � ( p ∧ q ) · ¯ q · q � [4 , 5] · ¯ p Signals p q 0 2 4 6 8 10 12 A few 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 9 / 23
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. 10 / 23
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. 11 / 23
Data Structure Definition (2D Zone) A 2D zone is a subset of R 2 described by inequalities d < t ′ − t < d e < t ′ < e b < t < b with b , b , e , e , d , d are constants. About 2D zones Representing a set of intervals (t, t’) [ b , b ] , [ e , e ] , [ d , d ] correspond begin, end and duration constraints. Zones (in general) used for timed automata verification; efficient algorithms and libraries exist. Many examples below. 12 / 23
Main Result Theorem The match-set M ( ϕ, w ) is a finite union of 2D zones. It is computable knowing expression ϕ and signal w. Method for algorithms Structural induction over ϕ . 13 / 23
Main Result Theorem The match-set M ( ϕ, w ) is a finite union of 2D zones. It is computable knowing expression ϕ and signal w. Method for algorithms Structural induction over ϕ . 14 / 23
Computation: Literals 12 A Literal 11 10 M ( p ) — a union of triangle zones 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 1 Dropping w when w is clear 15 / 23
Computation: Time Restriction 12 Time Restriction 11 10 M ( � ϕ � I ) = M ( ϕ ) ∩{ ( t , t ′ ) | t ′ − t ∈ I } 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 16 / 23
Computation: Concatenation Concatenation M ( ϕ · ψ ) = M ( ϕ ) ◦ M ( ψ ) Composition preserves zones ( t , t ′ ) ∈ M ( ϕ ) ◦ M ( ψ ) ↔ ∃ t ′′ : ( t , t ′′ ) ∈ M ( ϕ ) ∧ ( t ′′ , t ′ ) ∈ M ( ψ ) Can be obtained using standard zone operations. 17 / 23
Concatenation with pictures 8 7 t ′ 6 5 t ′′ 4 3 2 ϕ ψ 1 ϕ · ψ 0 p p q q t t ′′ t ′ 0 1 2 3 4 5 6 7 8 Explanation ϕ := � p � [1 , ∞ ] , ψ := � q � [0 , 2] and ϕ · ψ 18 / 23
Back to the First Example Expression ϕ := � ( p ∧ q ) · ¯ q · q � [4 , 5] · ¯ p Signals p q 0 2 4 6 8 10 12 Correct Result M ( ϕ, w ) := { ( t , t ′ ) ∈ [1 , 2] × [6 , 7] } 19 / 23
Back to the First Example Match-Set Computation 12 11 10 9 8 7 6 5 4 3 p ∧ q p q 2 ¯ p q ¯ ( p ∧ q ) · ¯ q 1 0 12 11 10 9 8 7 6 5 4 3 2 � ( p ∧ q ) · ¯ q · q � [4 , 5] � ( p ∧ q ) · ¯ q · q � [4 , 5] · ¯ p ( p ∧ q ) · ¯ q · q 1 0 20 / 23 0 1 2 3 4 5 6 7 8 9 10 11 12 0 1 2 3 4 5 6 7 8 9 10 11 12 0 1 2 3 4 5 6 7 8 9 10 11 12
Performance Experimental Setup p � [0 , 10] ) ∗ ∧ ( � q · ¯ q � [0 , 10] ) ∗ � [80 , ∞ ] ϕ := � ( � p · ¯ V L | Z ϕ | Time (s) A complex expression ϕ . 0.025 40000 0 0.08 Random signals p and q 0.025 80000 0 0.17 with variability V and 0.025 160000 0 0.37 length L 0.05 40000 0 0.27 0.05 80000 0 0.60 0.05 160000 0 1.27 Notes 0.075 40000 1 0.64 0.075 80000 4 1.40 Python calling IF zone 0.075 160000 5 2.88 library (in C) 0.1 40000 10 1.35 0.1 80000 23 2.73 0.1 160000 47 5.83 21 / 23
Conclusion Summary Timed Pattern Matching Zones to represent match-sets Experiments witness scalability. Discussion Trivial to extend for any discrete value domain. Natural companion for specification logics. 22 / 23
More patterns using zones Thanks 23 / 23
Recommend
More recommend