Lecture 04: Duration Calculus II 2014-05-15 Dr. Bernd Westphal 04 - - PowerPoint PPT Presentation

lecture 04 duration calculus ii
SMART_READER_LITE
LIVE PREVIEW

Lecture 04: Duration Calculus II 2014-05-15 Dr. Bernd Westphal 04 - - PowerPoint PPT Presentation

Real-Time Systems Lecture 04: Duration Calculus II 2014-05-15 Dr. Bernd Westphal 04 2014-05-15 main Albert-Ludwigs-Universit at Freiburg, Germany Contents & Goals Last Lecture: Started DC Syntax and Semantics:


slide-1
SLIDE 1

– 04 – 2014-05-15 – main –

Real-Time Systems

Lecture 04: Duration Calculus II

2014-05-15

  • Dr. Bernd Westphal

Albert-Ludwigs-Universit¨ at Freiburg, Germany

slide-2
SLIDE 2

Contents & Goals

– 04 – 2014-05-15 – Sprelim –

2/36

Last Lecture:

  • Started DC Syntax and Semantics: Symbols, State Assertions

This Lecture:

  • Educational Objectives: Capabilities for following tasks/questions.
  • Read (and at best also write) Duration Calculus terms and formulae.
  • Content:
  • Duration Calculus Formulae
  • Duration Calculus Abbreviations
  • Satisfiability, Realisability, Validity
slide-3
SLIDE 3

Duration Calculus Cont’d

– 04 – 2014-05-15 – main –

3/36

slide-4
SLIDE 4

Duration Calculus: Overview

– 04 – 2014-05-15 – Sdcterm –

4/36

We will introduce three (or five) syntactical “levels”: (i) Symbols: f, g, true, false, =, <, >, ≤, ≥, x, y, z, X, Y, Z, d (ii) State Assertions: P ::= 0 | 1 | X = d | ¬P1 | P1 ∧ P2 (iii) Terms: θ ::= x | ℓ | ∫ P | f(θ1, . . . , θn) (iv) Formulae: F ::= p(θ1, . . . , θn) | ¬F1 | F1 ∧ F2 | ∀ x • F1 | F1 ; F2 (v) Abbreviations: ⌈ ⌉, ⌈P⌉, ⌈P⌉t, ⌈P⌉≤t, ♦F, F

slide-5
SLIDE 5

Terms: Remarks

– 04 – 2014-05-15 – Sdcterm –

5/36

Remark 2.5. The semantics Iθ of a term is insensitive against changes of the interpretation I at individual time points. Remark 2.6. The semantics Iθ(V, [b, e]) of a rigid term does not depend on the interval [b, e].

slide-6
SLIDE 6

Duration Calculus: Overview

– 04 – 2014-05-15 – Sdcform –

6/36

We will introduce three (or five) syntactical “levels”: (i) Symbols: f, g, true, false, =, <, >, ≤, ≥, x, y, z, X, Y, Z, d (ii) State Assertions: P ::= 0 | 1 | X = d | ¬P1 | P1 ∧ P2 (iii) Terms: θ ::= x | ℓ | ∫ P | f(θ1, . . . , θn) (iv) Formulae: F ::= p(θ1, . . . , θn) | ¬F1 | F1 ∧ F2 | ∀ x • F1 | F1 ; F2 (v) Abbreviations: ⌈ ⌉, ⌈P⌉, ⌈P⌉t, ⌈P⌉≤t, ♦F, F

slide-7
SLIDE 7

Formulae: Syntax

– 04 – 2014-05-15 – Sdcform –

7/36

  • The set of DC formulae is defined by the following grammar:

F ::= p(θ1, . . . , θn) | ¬F1 | F1 ∧ F2 | ∀ x • F1 | F1 ; F2 where p is a predicate symbol, θi a term, x a global variable.

  • chop operator: ‘;’
  • atomic formula: p(θ1, . . . , θn)
  • rigid formula: all terms are rigid
  • chop free: ‘;’ doesn’t occur
  • usual notion of free and bound (global) variables
  • Note: quantification only over (first-order) global variables,

not over (second-order) state variables.

slide-8
SLIDE 8

Formulae: Priority Groups

– 04 – 2014-05-15 – Sdcform –

8/36

  • To avoid parentheses, we define the following five priority groups from

highest to lowest priority:

  • ¬

(negation)

  • ;

(chop)

  • ∧, ∨

(and/or)

  • =

⇒ , ⇐ ⇒ (implication/equivalence)

  • ∃ , ∀

(quantifiers) Examples:

  • ¬F ; F ∨ H
  • ∀ x • F ∧ G
slide-9
SLIDE 9

Syntactic Substitution...

– 04 – 2014-05-15 – Sdcform –

9/36

...of a term θ for a variable x in a formula F.

  • We use

F[x := θ] to denote the formula that results from performing the following steps: (i) transform F into ˜ F by (consistently) renaming bound variables such that no free occurrence of x in ˜ F appears within a quantified subformula ∃ z • G or ∀ z • G for some z occurring in θ, (ii) textually replace all free occurrences of x in ˜ F by θ.

slide-10
SLIDE 10

Syntactic Substitution...

– 04 – 2014-05-15 – Sdcform –

9/36

...of a term θ for a variable x in a formula F.

  • We use

F[x := θ] to denote the formula that results from performing the following steps: (i) transform F into ˜ F by (consistently) renaming bound variables such that no free occurrence of x in ˜ F appears within a quantified subformula ∃ z • G or ∀ z • G for some z occurring in θ, (ii) textually replace all free occurrences of x in ˜ F by θ. Examples: F := (x ≥ y = ⇒ ∃ z • z ≥ 0 ∧ x = y + z), θ1 := ℓ, θ2 := ℓ + z,

  • F[x := θ1] = (x ≥ y =

⇒ ∃ z • z ≥ 0 ∧ x = y + z)

  • F[x := θ2] = (x

≥ y = ⇒ ∃ z • z ≥ 0 ∧ x = y + z)

slide-11
SLIDE 11

Formulae: Semantics

– 04 – 2014-05-15 – Sdcform –

10/36

  • The semantics of a formula is a function

IF : Val × Intv → {tt, ff} i.e. IF(V, [b, e]) is the truth value of F under interpretation I and valuation V in the interval [b, e].

  • This value is defined inductively on the structure of F:

Ip(θ1, . . . , θn)(V, [b, e]) = ˆ p(Iθ1(V, [b, e]), . . . , Iθn(V, [b, e])), I¬F1(V, [b, e]) = tt iff IF1(V, [b, e]) = ff, IF1 ∧ F2(V, [b, e]) = tt iff IF1(V, [b, e]) = IF2(V, [b, e]) = tt, I∀ x • F1(V, [b, e]) = tt iff for all a ∈ R, IF1[x := a](V, [b, e]) = tt IF1 ; F2(V, [b, e]) = iff there is an m ∈ [b, e] such that IF1(V, [b, m]) = IF2(V, [m, e]) = tt.

slide-12
SLIDE 12

Formulae: Example

– 04 – 2014-05-15 – Sdcform –

11/36

F := ∫ L = 0 ; ∫ L = 1

Time 1 LI 1 2 3 4

  • IF(V, [0, 2]) =
slide-13
SLIDE 13

Formulae: Remarks

– 04 – 2014-05-15 – Sdcform –

12/36

Remark 2.10. [Rigid and chop-free] Let F be a duration formula, I an interpretation, V a valuation, and [b, e] ∈ Intv.

  • If F is rigid, then

∀ [b′, e′] ∈ Intv : IF(V, [b, e]) = IF(V, [b′, e′]).

  • If F is chop-free or θ is rigid,

then in the calculation of the semantics of F, every occurrence of θ denotes the same value.

slide-14
SLIDE 14

Substitution Lemma

– 04 – 2014-05-15 – Sdcform –

13/36

Lemma 2.11. [Substitution] Consider a formula F, a global variable x, and a term θ such that F is chop-free or θ is rigid. Then for all interpretations I, valuations V, and intervals [b, e], IF[x := θ](V, [b, e]) = IF(V[x := a], [b, e]) where a = Iθ(V, [b, e]).

  • F := ℓ = x ; ℓ = x =

⇒ ℓ = 2 · x, θ := ℓ

slide-15
SLIDE 15

Duration Calculus: Overview

– 04 – 2014-05-15 – Sdcform –

14/36

We will introduce three (or five) syntactical “levels”: (i) Symbols: f, g, true, false, =, <, >, ≤, ≥, x, y, z, X, Y, Z, d (ii) State Assertions: P ::= 0 | 1 | X = d | ¬P1 | P1 ∧ P2 (iii) Terms: θ ::= x | ℓ | ∫ P | f(θ1, . . . , θn) (iv) Formulae: F ::= p(θ1, . . . , θn) | ¬F1 | F1 ∧ F2 | ∀ x • F1 | F1 ; F2 (v) Abbreviations: ⌈ ⌉, ⌈P⌉, ⌈P⌉t, ⌈P⌉≤t, ♦F, F

slide-16
SLIDE 16

Duration Calculus Abbreviations

– 04 – 2014-05-15 – main –

15/36

slide-17
SLIDE 17

Abbreviations

– 04 – 2014-05-15 – Sdcabbrev –

16/36

  • ⌈⌉ := ℓ = 0

(point interval)

  • ⌈P⌉ := ∫ P = ℓ ∧ ℓ > 0

(almost everywhere)

  • ⌈P⌉t := ⌈P⌉ ∧ ℓ = t

(for time t)

  • ⌈P⌉≤t := ⌈P⌉ ∧ ℓ ≤ t

(up to time t)

  • ♦F := true ; F ; true

(for some subinterval)

  • F := ¬♦¬F

(for all subintervals)

slide-18
SLIDE 18

Abbreviations: Examples

– 04 – 2014-05-15 – Sdcabbrev –

17/36

Time 1 LI 2 4 6 8

I ∫ L = 0 (V, [0, 2] ) = I ∫ L = 1 (V, [2, 6] ) = I ∫ L = 0 ; ∫ L = 1 (V, [0, 6] ) = I ⌈¬L⌉ (V, [0, 2] ) = I ⌈L⌉ (V, [2, 3] ) = I ⌈¬L⌉ ; ⌈L⌉ (V, [0, 3] ) = I ⌈¬L⌉ ; ⌈L⌉ ; ⌈¬L⌉ (V, [0, 6] ) = I ♦⌈L⌉ (V, [0, 6] ) = I ♦⌈¬L⌉ (V, [0, 6] ) = I ♦⌈¬L⌉2 (V, [0, 6] ) = I ♦⌈¬L⌉2 ; ⌈¬L⌉1 ; ⌈¬L⌉3 (V, [0, 6] ) =

slide-19
SLIDE 19

Duration Calculus: Preview

– 04 – 2014-05-15 – Sdcpreview –

18/36

  • Duration Calculus is an interval logic.
  • Formulae are evaluated in an

(implicitly given) interval.

gas valve flame sensor ignition

  • G, F, I, H : {0, 1}
  • Define L : {0, 1} as G∧¬F.

Strangest operators:

  • almost everywhere — Example: ⌈G⌉

(Holds in a given interval [b, e] iff the gas valve is open almost everywhere.)

  • chop — Example: (⌈¬I⌉ ; ⌈I⌉ ; ⌈¬I⌉) =

⇒ ℓ ≥ 1

(Ignition phases last at least one time unit.)

  • integral — Example: ℓ ≥ 60 =

⇒ ∫ L ≤

ℓ 20

(At most 5% leakage time within intervals of at least 60 time units.)

slide-20
SLIDE 20

DC Validity, Satisfiability, Realisability

– 04 – 2014-05-15 – main –

19/36

slide-21
SLIDE 21

Validity, Satisfiability, Realisability

– 04 – 2014-05-15 – Sdcsat –

20/36

Let I be an interpretation, V a valuation, [b, e] an interval, and F a DC formula.

  • I, V, [b, e] |

= F (“F holds in I, V, [b, e]”) iff IF(V, [b, e]) = tt.

slide-22
SLIDE 22

Validity, Satisfiability, Realisability

– 04 – 2014-05-15 – Sdcsat –

20/36

Let I be an interpretation, V a valuation, [b, e] an interval, and F a DC formula.

  • I, V, [b, e] |

= F (“F holds in I, V, [b, e]”) iff IF(V, [b, e]) = tt.

  • F is called satisfiable iff it holds in some I, V, [b, e].
slide-23
SLIDE 23

Validity, Satisfiability, Realisability

– 04 – 2014-05-15 – Sdcsat –

20/36

Let I be an interpretation, V a valuation, [b, e] an interval, and F a DC formula.

  • I, V, [b, e] |

= F (“F holds in I, V, [b, e]”) iff IF(V, [b, e]) = tt.

  • F is called satisfiable iff it holds in some I, V, [b, e].
  • I, V |

= F (“I and V realise F”) iff ∀ [b, e] ∈ Intv : I, V, [b, e] | = F.

slide-24
SLIDE 24

Validity, Satisfiability, Realisability

– 04 – 2014-05-15 – Sdcsat –

20/36

Let I be an interpretation, V a valuation, [b, e] an interval, and F a DC formula.

  • I, V, [b, e] |

= F (“F holds in I, V, [b, e]”) iff IF(V, [b, e]) = tt.

  • F is called satisfiable iff it holds in some I, V, [b, e].
  • I, V |

= F (“I and V realise F”) iff ∀ [b, e] ∈ Intv : I, V, [b, e] | = F.

  • F is called realisable iff some I and V realise F.
slide-25
SLIDE 25

Validity, Satisfiability, Realisability

– 04 – 2014-05-15 – Sdcsat –

20/36

Let I be an interpretation, V a valuation, [b, e] an interval, and F a DC formula.

  • I, V, [b, e] |

= F (“F holds in I, V, [b, e]”) iff IF(V, [b, e]) = tt.

  • F is called satisfiable iff it holds in some I, V, [b, e].
  • I, V |

= F (“I and V realise F”) iff ∀ [b, e] ∈ Intv : I, V, [b, e] | = F.

  • F is called realisable iff some I and V realise F.
  • I |

= F (“I realises F”) iff ∀ V ∈ Val : I, V | = F.

slide-26
SLIDE 26

Validity, Satisfiability, Realisability

– 04 – 2014-05-15 – Sdcsat –

20/36

Let I be an interpretation, V a valuation, [b, e] an interval, and F a DC formula.

  • I, V, [b, e] |

= F (“F holds in I, V, [b, e]”) iff IF(V, [b, e]) = tt.

  • F is called satisfiable iff it holds in some I, V, [b, e].
  • I, V |

= F (“I and V realise F”) iff ∀ [b, e] ∈ Intv : I, V, [b, e] | = F.

  • F is called realisable iff some I and V realise F.
  • I |

= F (“I realises F”) iff ∀ V ∈ Val : I, V | = F.

  • |

= F (“F is valid”) iff ∀ interpretation I : I | = F.

slide-27
SLIDE 27

Validity vs. Satisfiability vs. Realisability

– 04 – 2014-05-15 – Sdcsat –

21/36

Remark 2.13. For all DC formulae F,

  • F is satisfiable iff ¬F is not valid,

F is valid iff ¬F is not satisfiable.

  • If F is valid then F is realisable, but not vice versa.
  • If F is realisable then F is satisfiable, but not vice versa.
slide-28
SLIDE 28

Examples: Valid? Realisable? Satisfiable?

– 04 – 2014-05-15 – Sdcsat –

22/36

  • ℓ ≥ 0
  • ℓ = ∫ 1
  • ℓ = 30 ⇐

⇒ ℓ = 10 ; ℓ = 20

  • ((F ; G) ; H) ⇐

⇒ (F ; (G ; H))

  • ∫ L ≤ x
  • ℓ = 2
slide-29
SLIDE 29

Initial Values

– 04 – 2014-05-15 – Sdcsat –

23/36

  • I, V |

=0 F (“I and V realise F from 0”) iff ∀ t ∈ Time : I, V, [0, t] | = F.

  • F is called realisable from 0 iff some I and V realise F from 0.
  • Intervals of the form [0, t] are called initial intervals.
  • I |

=0 F (“I realises F from 0”) iff ∀ V ∈ Val : I, V | =0 F.

  • |

=0 F (“F is valid from 0”) iff ∀ interpretation I : I | =0 F.

slide-30
SLIDE 30

Initial or not Initial...

– 04 – 2014-05-15 – Sdcsat –

24/36

For all interpretations I, valuations V, and DC formulae F, (i) I, V | = F implies I, V | =0 F, (ii) if F is realisable then F is realisable from 0, but not vice versa, (iii) F is valid iff F is valid from 0.

slide-31
SLIDE 31

Specification and Semantics-based Correctness Proofs

  • f Real-Time Systems with DC

– 04 – 2014-05-15 – main –

25/36

slide-32
SLIDE 32

Methodology: Ideal World...

– 04 – 2014-05-15 – Sdcmeth –

26/36

(i) Choose a collection of observables ‘Obs’. (ii) Provide the requirement/specification ‘Spec’ as a conjunction of DC formulae (over ‘Obs’). (iii) Provide a description ‘Ctrl’

  • f the controller in form of a DC formula (over ‘Obs’).

(iv) We say ‘Ctrl’ is correct (wrt. ‘Spec’) iff | =0 Ctrl = ⇒ Spec.

slide-33
SLIDE 33

Gas Burner Revisited

– 04 – 2014-05-15 – Sdcgasburner –

27/36

gas valve flame sensor ignition

(i) Choose observables:

  • two boolean observables G and F

(i.e. Obs = {G, F}, D(G) = D(F) = {0, 1})

  • G = 1: gas valve open

(output)

  • F = 1: have flame

(input)

  • define L := G ∧ ¬F (leakage)

(ii) Provide the requirement: Req : ⇐ ⇒ (ℓ ≥ 60 = ⇒ 20 · ∫ L ≤ ℓ)

slide-34
SLIDE 34

Gas Burner Revisited

– 04 – 2014-05-15 – Sdcgasburner –

28/36

(iii) Provide a description ‘Ctrl’

  • f the controller in form of a DC formula (over ‘Obs’).

Here, firstly consider a design:

  • Des-1 : ⇐

⇒ (⌈L⌉ = ⇒ ℓ ≤ 1)

  • Des-2 : ⇐

⇒ (⌈L⌉ ; ⌈¬L⌉ ; ⌈L⌉ = ⇒ ℓ > 30) (iv) Prove correctness:

  • We want (or do we want |

=0...?): | = (Des-1 ∧ Des-2 = ⇒ Req) (Thm. 2.16)

slide-35
SLIDE 35

Gas Burner Revisited

– 04 – 2014-05-15 – Sdcgasburner –

28/36

(iii) Provide a description ‘Ctrl’

  • f the controller in form of a DC formula (over ‘Obs’).

Here, firstly consider a design:

  • Des-1 : ⇐

⇒ (⌈L⌉ = ⇒ ℓ ≤ 1)

  • Des-2 : ⇐

⇒ (⌈L⌉ ; ⌈¬L⌉ ; ⌈L⌉ = ⇒ ℓ > 30) (iv) Prove correctness:

  • We want (or do we want |

=0...?): | = (Des-1 ∧ Des-2 = ⇒ Req) (Thm. 2.16)

  • We do show

| = Req-1 = ⇒ Req (Lem. 2.17) with the simplified requirement Req-1 := (ℓ ≤ 30 = ⇒ ∫ L ≤ 1),

slide-36
SLIDE 36

Gas Burner Revisited: Lemma 2.17

– 04 – 2014-05-15 – Sdcgasburner –

29/36

Claim: | = (ℓ ≤ 30 = ⇒ ∫ L ≤ 1)

  • Req-1

= ⇒ (ℓ ≥ 60 = ⇒ 20 · ∫ L ≤ ℓ)

  • Req

Proof:

slide-37
SLIDE 37

Gas Burner Revisited: Lemma 2.17

– 04 – 2014-05-15 – Sdcgasburner –

29/36

Claim: | = (ℓ ≤ 30 = ⇒ ∫ L ≤ 1)

  • Req-1

= ⇒ (ℓ ≥ 60 = ⇒ 20 · ∫ L ≤ ℓ)

  • Req

Proof:

  • Assume ‘Req-1’.
slide-38
SLIDE 38

Gas Burner Revisited: Lemma 2.17

– 04 – 2014-05-15 – Sdcgasburner –

29/36

Claim: | = (ℓ ≤ 30 = ⇒ ∫ L ≤ 1)

  • Req-1

= ⇒ (ℓ ≥ 60 = ⇒ 20 · ∫ L ≤ ℓ)

  • Req

Proof:

  • Assume ‘Req-1’.
  • Let LI be any interpretation of L, and [b, e] an interval with e − b ≥ 60.
slide-39
SLIDE 39

Gas Burner Revisited: Lemma 2.17

– 04 – 2014-05-15 – Sdcgasburner –

29/36

Claim: | = (ℓ ≤ 30 = ⇒ ∫ L ≤ 1)

  • Req-1

= ⇒ (ℓ ≥ 60 = ⇒ 20 · ∫ L ≤ ℓ)

  • Req

Proof:

  • Assume ‘Req-1’.
  • Let LI be any interpretation of L, and [b, e] an interval with e − b ≥ 60.
  • Show “20 · ∫ L ≤ ℓ”, i.e.

I20 · ∫ L ≤ ℓ(V, [b, e]) = tt i.e. ˆ 20ˆ · e

b

LI(t) dt ˆ ≤ (e − b)

slide-40
SLIDE 40

Gas Burner Revisited: Lemma 2.17

– 04 – 2014-05-15 – Sdcgasburner –

30/36 | = (ℓ ≤ 30 = ⇒ ∫ L ≤ 1)

  • Req-1

= ⇒ (ℓ ≥ 60 = ⇒ 20 · ∫ L ≤ ℓ)

  • Set n := ⌈ e−b

30 ⌉, i.e. n ∈ N with n − 1 < e−b 30 ≤ n, and split the interval b b + 30 b + 60 b + 30(n − 2)b + 30(n − 1) e b + 30n

slide-41
SLIDE 41

Some Laws of the DC Integral Operator

– 04 – 2014-05-15 – Sdcgasburner –

31/36

Theorem 2.18. For all state assertions P and all real numbers r1, r2 ∈ R, (i) | = ∫ P ≤ ℓ, (ii) | = (∫ P = r1) ; (∫ P = r2) = ⇒ ∫ P = r1 + r2, (iii) | = ⌈¬P⌉ = ⇒ ∫ P = 0, (iv) | = ⌈⌉ = ⇒ ∫ P = 0.

slide-42
SLIDE 42

Gas Burner Revisited: Lemma 2.18

– 04 – 2014-05-15 – Sdcgasburner –

32/36

Claim:

| = ((⌈L⌉ = ⇒ ℓ ≤ 1)

  • Des-1

∧ (⌈L⌉ ; ⌈¬L⌉ ; ⌈L⌉ = ⇒ ℓ > 30)

  • Des-2

) = ⇒ (ℓ ≤ 30 = ⇒ ∫ L ≤ 1)

  • Req-1

Proof:

slide-43
SLIDE 43

Gas Burner Revisited: Lemma 2.18

– 04 – 2014-05-15 – Sdcgasburner –

33/36

Claim:

(i) | = ∫ P ≤ ℓ, (iv) | = ⌈⌉ = ⇒ ∫ P = 0 (ii) | = (∫ P = r1) ; (∫ P = r2) = ⇒ ∫ P = r1 + r2, (iii) | = ⌈¬P⌉ = ⇒ ∫ P = 0, | = ((⌈L⌉ = ⇒ ℓ ≤ 1)

  • Des-1

∧ (⌈L⌉ ; ⌈¬L⌉ ; ⌈L⌉ = ⇒ ℓ > 30)

  • Des-2

) = ⇒ (ℓ ≤ 30 = ⇒ ∫ L ≤ 1)

  • Req-1

Proof:

slide-44
SLIDE 44

Gas Burner Revisited: Lemma 2.18

– 04 – 2014-05-15 – Sdcgasburner –

34/36

slide-45
SLIDE 45

References

– 04 – 2014-05-15 – main –

35/36

slide-46
SLIDE 46

– 04 – 2014-05-15 – main –

36/36

[Olderog and Dierks, 2008] Olderog, E.-R. and Dierks, H. (2008). Real-Time Systems - Formal Specification and Automatic Verification. Cambridge University Press.