Automata for Real-time Systems B. Srivathsan Chennai Mathematical - - PowerPoint PPT Presentation

automata for real time systems
SMART_READER_LITE
LIVE PREVIEW

Automata for Real-time Systems B. Srivathsan Chennai Mathematical - - PowerPoint PPT Presentation

Automata for Real-time Systems B. Srivathsan Chennai Mathematical Institute 1/35 Overview 2/35 Automata ( Finite State Machines ) are good abstractions of many real systems hardware circuits, communication protocols, biological processes, . .


slide-1
SLIDE 1

Automata for Real-time Systems

  • B. Srivathsan

Chennai Mathematical Institute

1/35

slide-2
SLIDE 2

Overview

2/35

slide-3
SLIDE 3

Automata (Finite State Machines) are good abstractions of many real systems

hardware circuits, communication protocols, biological processes, . . .

3/35

slide-4
SLIDE 4

Automata can model many properties of systems

request response every request is followed by a response

4/35

slide-5
SLIDE 5

System Property Automaton A Automaton B

5/35

slide-6
SLIDE 6

System Property Automaton A Automaton B Does system satisfy property?

5/35

slide-7
SLIDE 7

System Property Automaton A Automaton B

L(A) ⊆ L(B)?

Does system satisfy property?

5/35

slide-8
SLIDE 8

Model-checking

System Property Automaton A Automaton B

L(A) ⊆ L(B)?

Does system satisfy property?

5/35

slide-9
SLIDE 9

In practice...

Huge system Property

6/35

slide-10
SLIDE 10

In practice...

Huge system Property Higher-level description Higher-level description

6/35

slide-11
SLIDE 11

In practice...

Huge system Property Higher-level description Higher-level description Automaton A Automaton B translation translation

Model-Checker

L(A) ⊆ L(B)?

6/35

slide-12
SLIDE 12

In practice...

Huge system Property Higher-level description Higher-level description Automaton A Automaton B translation translation

Model-Checker

L(A) ⊆ L(B)?

Some model-checkers: SMV, NuSMV, SPIN, . . .

6/35

slide-13
SLIDE 13

In practice...

Huge system Property Higher-level description Higher-level description Automaton A Automaton B translation translation

Model-Checker

L(A) ⊆ L(B)?

Some model-checkers: SMV, NuSMV, SPIN, . . . Turing Awards: Clarke, Emerson, Sifakis and Pnueli

6/35

slide-14
SLIDE 14

Automata are good abstractions of many real systems

7/35

slide-15
SLIDE 15

Automata are good abstractions of many real systems

Our course: Automata for real-time systems

Picture credits: F. Herbreteau

pacemaker, vehicle control systems, air traffic controllers, . . .

7/35

slide-16
SLIDE 16

Timed Automata

  • R. Alur and D. Dill in early 90s

8/35

slide-17
SLIDE 17

Timed Automata

  • R. Alur and D. Dill in early 90s

Some model-checkers: UPPAAL, KRONOS, RED, . . .

8/35

slide-18
SLIDE 18

Goals of our course

Study language theoretic and algorithmic properties of timed automata

9/35

slide-19
SLIDE 19

Lecture 7: Timed languages and timed automata

10/35

slide-20
SLIDE 20

Σ Σ∗ L ⊆ Σ∗

alphabet words language {a, b} {ε, a, b, aa, ab, ba, bb, aab, . . . } : : : L1 := {set of words starting with an “ a ”} {a, aa, ab, aaa, aab, . . . } L2 := {set of words with a non-zero even length } {aa, bb, ab, ba, abab, aaaa, . . . } property over words

11/35

slide-21
SLIDE 21

Σ Σ∗ L ⊆ Σ∗

alphabet words language {a, b} {ε, a, b, aa, ab, ba, bb, aab, . . . } : : : L1 := {set of words starting with an “ a ”} {a, aa, ab, aaa, aab, . . . } L2 := {set of words with a non-zero even length } {aa, bb, ab, ba, abab, aaaa, . . . } property over words Finite automata, pushdown automata, Turing machines, . . .

11/35

slide-22
SLIDE 22

Σ TΣ∗

alphabet timed words : : {a, b}

0.8

a

2.5

a

π

a

203

b

312.3

b (aa; 0.8, 2.5) (abb; π, 203, 312.3)

12/35

slide-23
SLIDE 23

Σ TΣ∗

alphabet timed words : : {a, b}

0.8

a

2.5

a

π

a

203

b

312.3

b (aa; 0.8, 2.5) (abb; π, 203, 312.3)

(w, τ)

Word Time sequence w = a1 . . . an

ai ∈ Σ

τ = τ1 . . . τn

τ1 ≤ · · · ≤ τn τi ∈ R≥0

12/35

slide-24
SLIDE 24

L ⊆ TΣ∗ Timed language

: property over timed words L1 := {( ab(a + b)∗, τ ) | τ2 − τ1 = 1}

1 2

a b ab b

10 11

a b

10 11

a b b

L2 := { (w, τ) | τi+1 − τi ≥ 2 for all i < |w|}

1.2 3.5 6

a b a

10 12

a b

100

a

13/35

slide-25
SLIDE 25

L ⊆ TΣ∗ Timed language

: property over timed words L1 := {( ab(a + b)∗, τ ) | τ2 − τ1 = 1}

1 2

a b ab b

10 11

a b

10 11

a b b

L2 := { (w, τ) | τi+1 − τi ≥ 2 for all i < |w|}

1.2 3.5 6

a b a

10 12

a b

100

a

Timed automata

13/35

slide-26
SLIDE 26

Timed automaton: Finite automaton + Finite no. of Clocks

Clock time

14/35

slide-27
SLIDE 27

Timed automaton: Finite automaton + Finite no. of Clocks

Clock time

{( ab(a + b)∗, τ) | τ2 ≤ 2}

q0 q1 q2 b a a, b

14/35

slide-28
SLIDE 28

Timed automaton: Finite automaton + Finite no. of Clocks

Clock time

{( ab(a + b)∗, τ) | τ2 ≤ 2}

q0 q1 q2 x ≤ 2, b a a, b

14/35

slide-29
SLIDE 29

Timed automaton: Finite automaton + Finite no. of Clocks

Clock time

{( ab(a + b)∗, τ) | τ2 ≤ 2}

q0 q1 q2 x ≤ 2, b a a, b

1 2

a b b

q0 q1 q2 1 2

a b b

q0 q1

×

accept reject

14/35

slide-30
SLIDE 30

Timed automaton: Finite automaton + Finite no. of Clocks Guards

φ := x ≤ c | x ≥ c | ¬φ | φ ∧ φ x ∈ Clocks , c ∈ Q≥0 Clock time

{( ab(a + b)∗, τ) | τ2 ≤ 2}

q0 q1 q2 x ≤ 2, b a a, b

1 2

a b b

q0 q1 q2 1 2

a b b

q0 q1

×

accept reject

14/35

slide-31
SLIDE 31

Timed automaton: Finite automaton + Finite no. of Clocks Guards

φ := x ≤ c | x ≥ c | ¬φ | φ ∧ φ x ∈ Clocks , c ∈ Q≥0 Clock time

{( ab(a + b)∗, τ) | τ2 − τ1 ≤ 2}

q0 q1 q2 x ≤ 2, b a a, b

14/35

slide-32
SLIDE 32

Timed automaton: Finite automaton + Finite no. of Clocks Guards

φ := x ≤ c | x ≥ c | ¬φ | φ ∧ φ x ∈ Clocks , c ∈ Q≥0

Resets

Clock time

{( ab(a + b)∗, τ) | τ2 − τ1 ≤ 2}

q0 q1 q2 x ≤ 2, b a {x} a, b

14/35

slide-33
SLIDE 33

Timed automaton: Finite automaton + Finite no. of Clocks Guards

φ := x ≤ c | x ≥ c | ¬φ | φ ∧ φ x ∈ Clocks , c ∈ Q≥0

Resets

Clock time

{( ab(a + b)∗, τ) | τ2 − τ1 ≤ 2}

q0 q1 q2 x ≤ 2, b a {x} a, b

1 2

a b b

q0 q1 x : 0 q2 x ≤ 2 1 2 .5 2.5

a bb

q0 q1 x : 0

×

x > 2

accept reject

14/35

slide-34
SLIDE 34

L3 := { ( ak, τ ) | k > 0, τi = i for all i ≤ k}

An “a” occurs in every integer from 1, . . . , k a a a a a

1 2 3 4 5

15/35

slide-35
SLIDE 35

L3 := { ( ak, τ ) | k > 0, τi = i for all i ≤ k}

An “a” occurs in every integer from 1, . . . , k a a a a a

1 2 3 4 5

q0 q1 x = 1, a {x} x = 1, a {x}

15/35

slide-36
SLIDE 36

L4 := { ( ak, τ ) | exist i, j s.t. τj − τi = 1}

There are 2 “a”s which are at distance 1 apart

t t + 1

a a a a a a a

16/35

slide-37
SLIDE 37

L4 := { ( ak, τ ) | exist i, j s.t. τj − τi = 1}

There are 2 “a”s which are at distance 1 apart

t t + 1

a a a a a a a q0 q1 q2 a {x} x = 1, a a a a

16/35

slide-38
SLIDE 38

Three mechanisms to exploit:

◮ Reset: to start measuring time ◮ Guard: to impose time constraint on action ◮ Non-determinism: for existential time constraints

17/35

slide-39
SLIDE 39

A = (Q, Σ, X, T, Q0, F)

T ⊆ Q × Σ × guard × reset × Q

s0 s1 s3 s2

a, {y} c, (x < 1) a, (y < 1), {y} c, (x < 1) d, (x > 1) b, (y = 1)

18/35

slide-40
SLIDE 40

A = (Q, Σ, X, T, Q0, F)

T ⊆ Q × Σ × guard × reset × Q

s0 s1 s3 s2

a, {y} c, (x < 1) a, (y < 1), {y} c, (x < 1) d, (x > 1) b, (y = 1)

(ac; 0.4, 0.9) s0 s0 0.4 0.4 s1 0.4 s1 0.9 0.5 s3 0.9 0.5

0.4 a 0.5 c

x y

18/35

slide-41
SLIDE 41

A = (Q, Σ, X, T, Q0, F)

T ⊆ Q × Σ × guard × reset × Q

s0 s1 s3 s2

a, {y} c, (x < 1) a, (y < 1), {y} c, (x < 1) d, (x > 1) b, (y = 1)

(ac; 0.4, 0.9) s0 s0 0.4 0.4 s1 0.4 s1 0.9 0.5 s3 0.9 0.5

0.4 a 0.5 c

x y Run of A over (a1a2 . . . ak; τ1τ2 . . . τk)

δi := τi − τi−1; τ0 := 0

(q0, v0)

δ1

− − → (q0, v0 + δ1)

a1

− − → (q1, v1)

δ2

− − → (q1, v1 + δ2) · · ·

ak

− − → (qk, vk) (w, τ) ∈ L(A) if A has an accepting run over (w, τ)

18/35

slide-42
SLIDE 42

L5 := { ( abcd.Σ∗, τ ) | τ3 − τ1 ≤ 2 and τ4 − τ2 ≥ 5}

Interleaving distances

1 2 3 4 5 6 7

a b c d

19/35

slide-43
SLIDE 43

L5 := { ( abcd.Σ∗, τ ) | τ3 − τ1 ≤ 2 and τ4 − τ2 ≥ 5}

Interleaving distances

1 2 3 4 5 6 7

a b c d

q0 q1 q2 q3 q4 a {x} b {y} x ≤ 2, c y ≥ 5, d Σ

19/35

slide-44
SLIDE 44

n interleavings ⇒ need n clocks

n + 1 clocks more expressive than n clocks

20/35

slide-45
SLIDE 45

Timed automata

Runs 1 clock < 2 clocks < . . .

21/35

slide-46
SLIDE 46

L6 := { ( ak, τ ) | τi is some integer for each i}

1 2 3 4 5 6 7

a a a

22/35

slide-47
SLIDE 47

L6 := { ( ak, τ ) | τi is some integer for each i}

1 2 3 4 5 6 7

a a a

Claim: No timed automaton can accept L6

22/35

slide-48
SLIDE 48

Step 1: Suppose L6 = L(A) Let cmax be the maximum constant appearing in a guard of A

23/35

slide-49
SLIDE 49

Step 1: Suppose L6 = L(A) Let cmax be the maximum constant appearing in a guard of A Step 2: For a clock x, x = ⌈cmax⌉ + 1 and x = ⌈cmax⌉ + 1.1 satisfy the same guards

23/35

slide-50
SLIDE 50

Step 1: Suppose L6 = L(A) Let cmax be the maximum constant appearing in a guard of A Step 2: For a clock x, x = ⌈cmax⌉ + 1 and x = ⌈cmax⌉ + 1.1 satisfy the same guards Step 3: (a; ⌈cmax⌉ + 1) ∈ L6 and so A has an accepting run (q0, v0)

δ = ⌈cmax⌉+1

− − − − − − − − − → (q0, v0 + δ)

a

− → (qF, vF)

23/35

slide-51
SLIDE 51

Step 1: Suppose L6 = L(A) Let cmax be the maximum constant appearing in a guard of A Step 2: For a clock x, x = ⌈cmax⌉ + 1 and x = ⌈cmax⌉ + 1.1 satisfy the same guards Step 3: (a; ⌈cmax⌉ + 1) ∈ L6 and so A has an accepting run (q0, v0)

δ = ⌈cmax⌉+1

− − − − − − − − − → (q0, v0 + δ)

a

− → (qF, vF) Step 4: By Step 2, the following is an accepting run (q0, v0)

δ′ = ⌈cmax⌉+1.1

− − − − − − − − − − → (q0, v0 + δ′)

a

− → (qF, v′

F)

23/35

slide-52
SLIDE 52

Step 1: Suppose L6 = L(A) Let cmax be the maximum constant appearing in a guard of A Step 2: For a clock x, x = ⌈cmax⌉ + 1 and x = ⌈cmax⌉ + 1.1 satisfy the same guards Step 3: (a; ⌈cmax⌉ + 1) ∈ L6 and so A has an accepting run (q0, v0)

δ = ⌈cmax⌉+1

− − − − − − − − − → (q0, v0 + δ)

a

− → (qF, vF) Step 4: By Step 2, the following is an accepting run (q0, v0)

δ′ = ⌈cmax⌉+1.1

− − − − − − − − − − → (q0, v0 + δ′)

a

− → (qF, v′

F)

Hence (a; ⌈cmax⌉ + 1.1) ∈ L(A) = L6 Therefore no timed automaton can accept L6

23/35

slide-53
SLIDE 53

Timed automata

Runs 1 clock < 2 clocks < . . . Role of max constant

24/35

slide-54
SLIDE 54

Timed automata

Runs 1 clock < 2 clocks < . . . Role of max constant

Timed regular lngs.

24/35

slide-55
SLIDE 55

Timed regular languages

Timed languages L′ = L(A) Timed regular languages L = L(A)

L′ L

Definition

A timed language is called timed regular if it can be accepted by a timed automaton

25/35

slide-56
SLIDE 56

L = L(A)

L L′

L′ = L(A′)

L ∪ L′

L ∪ L′ = L(A∪)

A = (Q, Σ, X, T, Q0, F) A′ = (Q′, Σ, X′, T ′, Q′

0, F′)

A∪ = ( Q ∪ Q′ , Σ , X ∪ X′ , T ∪ T ′ , Q0 ∪ Q′

0 , F ∪ F′ )

L(A) ∪ L(A′) = L(A∪) Timed regular languages are closed under union

26/35

slide-57
SLIDE 57

L = L(A)

L L′

L′ = L(A′)

L ∩ L′

L ∩ L′ = L(A∩)

A = (Q, Σ, X, T, Q0, F) A′ = (Q′, Σ, X′, T ′, Q′

0, F′)

A∩ = ( Q × Q′ , Σ , X ∪ X′ , T∩ , Q0 × Q′

0 , F × F′ )

T∩ : (q1, q′

1) a, g ∧ g′

− − − − − − − → (q2, q′

2) if

R ∪ R′

q1

a, g

− − − − → q2 ∈ T and q′

1 a, g′

− − − − → q′

2 ∈ T ′ R R′

Timed regular languages are closed under intersection

27/35

slide-58
SLIDE 58

L : a timed language over Σ Untime(L) ≡ {w ∈ Σ∗ | ∃τ. (w, τ) ∈ L} Untiming construction

For every timed automaton A there is a finite automaton Au s.t. Untime( L(A) ) = L(Au)

more about this later . . .

28/35

slide-59
SLIDE 59

Complementation

Σ : {a, b} L = { (w, τ) | there is an a at some time t and no action occurs at time t + 1 } L = { (w, τ) | every a has an action at a distance 1 from it }

29/35

slide-60
SLIDE 60

Complementation

Σ : {a, b} L = { (w, τ) | there is an a at some time t and no action occurs at time t + 1 } L = { (w, τ) | every a has an action at a distance 1 from it } Claim: No timed automaton can accept L

Decision problems for timed automata: A survey

Alur, Madhusudhan. SFM’04: RT 29/35

slide-61
SLIDE 61

Step 1: L = { (w, τ) | every a has an action at a distance 1 from it } Suppose L is timed regular

30/35

slide-62
SLIDE 62

Step 1: L = { (w, τ) | every a has an action at a distance 1 from it } Suppose L is timed regular Step 2: Let L′ = { (a∗b∗, τ) | all a’s occur before time 1 and no two a’s happen at same time } Clearly L′ is timed regular

30/35

slide-63
SLIDE 63

Step 1: L = { (w, τ) | every a has an action at a distance 1 from it } Suppose L is timed regular Step 2: Let L′ = { (a∗b∗, τ) | all a’s occur before time 1 and no two a’s happen at same time } Clearly L′ is timed regular Step 3: Untime( L ∩ L′ ) should be a regular language

30/35

slide-64
SLIDE 64

Step 1: L = { (w, τ) | every a has an action at a distance 1 from it } Suppose L is timed regular Step 2: Let L′ = { (a∗b∗, τ) | all a’s occur before time 1 and no two a’s happen at same time } Clearly L′ is timed regular Step 3: Untime( L ∩ L′ ) should be a regular language Step 4: But, Untime( L ∩ L′ ) = {anbm | m ≥ n}, not regular!

30/35

slide-65
SLIDE 65

Step 1: L = { (w, τ) | every a has an action at a distance 1 from it } Suppose L is timed regular Step 2: Let L′ = { (a∗b∗, τ) | all a’s occur before time 1 and no two a’s happen at same time } Clearly L′ is timed regular Step 3: Untime( L ∩ L′ ) should be a regular language Step 4: But, Untime( L ∩ L′ ) = {anbm | m ≥ n}, not regular! Therefore L cannot be timed regular

30/35

slide-66
SLIDE 66

L L

Timed regular languages are not closed under complementation

31/35

slide-67
SLIDE 67

Timed automata

Runs 1 clock < 2 clocks < . . . Role of max constant

Timed regular lngs.

Closure under ∪, ∩ Non-closure under complement

32/35

slide-68
SLIDE 68

Timed automata

Runs 1 clock < 2 clocks < . . . Role of max constant

Timed regular lngs.

Closure under ∪, ∩ Non-closure under complement

ε-transitions

32/35

slide-69
SLIDE 69

L6 := { ( ak, τ ) | τi is some integer for each i}

1 2 3 4 5 6 7

a a a

Claim: No timed automaton can accept L6

33/35

slide-70
SLIDE 70

L6 := { ( ak, τ ) | τi is some integer for each i}

ε ε ε ε

1 2 3 4 5 6 7

a a a

33/35

slide-71
SLIDE 71

L6 := { ( ak, τ ) | τi is some integer for each i}

ε ε ε ε

1 2 3 4 5 6 7

a a a

q0 x = 1, ε, {x} x = 1, a, {x}

33/35

slide-72
SLIDE 72

ε-transitions

ε-transitions add expressive power to timed automata.

Characterization of the expressive power of silent transitions in timed automata

Bérard, Diekert, Gastin, Petit. Fundamenta Informaticae’98 34/35

slide-73
SLIDE 73

ε-transitions

ε-transitions add expressive power to timed automata. However, they add power only when a clock is reset in an ε-transition.

Characterization of the expressive power of silent transitions in timed automata

Bérard, Diekert, Gastin, Petit. Fundamenta Informaticae’98 34/35

slide-74
SLIDE 74

Timed automata

Runs 1 clock < 2 clocks < . . . Role of max constant

Timed regular lngs.

Closure under ∪, ∩ Non-closure under complement

ε-transitions

More expressive

ε

− − → without reset ≡ TA

35/35