56
Towards a Case Study on Runtime Verification of Lightweight Avionic Controllers using RMTL- R 3 André de Matos Pedro CISTER ISEP/IPP & HASLab INESC TEC November 25, 2015

TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Towards a Case Study on Runtime Verification ofLightweight Avionic Controllers using RMTL-

∫3

André de Matos Pedro

CISTER ISEP/IPP & HASLab INESC TEC

November 25, 2015

Page 2: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Talk Outline

Motivation

BackgroundSpecification Language RMTL-

∫3

Synthesis of three-valued restricted metric temporal logic withdurations (RMTL-

∫3)

Simplification of Quantified FormulasTemporal operators and duration terms as higher order functions

Stable and non-stable Conditions for Monitoring

Ongoing Case Study based on PixHawk autopilotPlatformRunTime Embedded Monitoring Library – RTEMLLanguages and Synthesizer

Page 3: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Talk Outline

Motivation

BackgroundSpecification Language RMTL-

∫3

Synthesis of RMTL-∫3

Simplification of Quantified FormulasTemporal operators and duration terms as higher order functions

Stable and non-stable Conditions for Monitoring

Ongoing Case Study based on PixHawk autopilotPlatformRunTime Embedded Monitoring Library – RTEMLLanguages and Synthesizer

Page 4: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Motivation I

Why is dynamic property verification and enforcement required forreal-time systems?

I Real-time systems have a high dependence of temporal andtimed constraints.

I Techniques for runtime verification have been growingprogressively along the past years as a complement of staticapproaches such as deductive verification and model checking.

I The demand of reliable and safe development ofprograms for embedded applications where time iscrucial.

* AND THEY ARE MISSING *

A lack of timed approaches for hard real-time properties ofembedded system controllers. Not just a matter of functionalproperties.

Page 5: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Motivation I

Why is dynamic property verification and enforcement required forreal-time systems?

I Real-time systems have a high dependence of temporal andtimed constraints.

I Techniques for runtime verification have been growingprogressively along the past years as a complement of staticapproaches such as deductive verification and model checking.

I The demand of reliable and safe development ofprograms for embedded applications where time iscrucial.

* AND THEY ARE MISSING *

A lack of timed approaches for hard real-time properties ofembedded system controllers. Not just a matter of functionalproperties.

Page 6: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Motivation II

What is dynamic property verification and enforcement of real-timesystems?

I an approach for schedulability analysis of hard real-timesystems and detection of anomalies;

I an approach to ensure durations of the past executions;I a complementary approach of the common static analysis

relaxing coverage but increasing the type of properties to bechecked;

* AND IT IS *

Page 7: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Motivation II

What is dynamic property verification and enforcement of real-timesystems?

I an approach for schedulability analysis of hard real-timesystems and detection of anomalies;

I an approach to ensure durations of the past executions;I a complementary approach of the common static analysis

relaxing coverage but increasing the type of properties to bechecked;

* AND IT IS *

Page 8: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Motivation III

A lightweight method that can reduce the burden for softwareprogrammers as well as intensive test cases. Maintainability andintegration is also cover. Monitors run indeterminately awaitingthe best stamp.

Page 9: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Talk Outline

Motivation

BackgroundSpecification Language RMTL-

∫3

Synthesis of RMTL-∫3

Simplification of Quantified FormulasTemporal operators and duration terms as higher order functions

Stable and non-stable Conditions for Monitoring

Ongoing Case Study based on PixHawk autopilotPlatformRunTime Embedded Monitoring Library – RTEMLLanguages and Synthesizer

Page 10: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Warm up

I Language for specification of timed and resource constraintsfor real-time systems.

I Sound and reliable automatic monitor generation algorithm(synthesis).

I Reliable Runtime Embedded Monitoring Library (RTEML) forARM architecture.

Page 11: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Warm up

I Language for specification of timed and resource constraintsfor real-time systems.

I Sound and reliable automatic monitor generation algorithm(synthesis).

I Reliable Runtime Embedded Monitoring Library (RTEML) forARM architecture.

Page 12: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Warm up

I Language for specification of timed and resource constraintsfor real-time systems.

I Sound and reliable automatic monitor generation algorithm(synthesis).

I Reliable Runtime Embedded Monitoring Library (RTEML) forARM architecture.

Page 13: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Talk Outline

Motivation

BackgroundSpecification Language RMTL-

∫3

Synthesis of RMTL-∫3

Simplification of Quantified FormulasTemporal operators and duration terms as higher order functions

Stable and non-stable Conditions for Monitoring

Ongoing Case Study based on PixHawk autopilotPlatformRunTime Embedded Monitoring Library – RTEMLLanguages and Synthesizer

Page 14: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Duration aware specification

RMTL-∫3 is formed by

I Terms:

η ::= α | x | minx∈I

ϕ | maxx∈I

ϕ | η1 ◦ η2 |∫ η

ϕ

I Formulas:

ϕ ::= p | η1 < η2 | ϕ1∨ϕ2 | ¬ϕ | ϕ1 U∼γ ϕ2 | ϕ1 S∼γ ϕ2 | ∃x ϕ,

with α ∈ R, x ∈ V, ◦ a function {+,×},∫ ηϕ the duration of the

formula ϕ in an interval, p ∈ P, ∼∈ {<,=}, γ ∈ R≥0, and < arelation.

Common AbbreviationsEventually : �∼γφ ≡ true U∼γ φ

Always : �∼γφ ≡ ¬( �∼γ¬φ)

Page 15: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Intuition for duration terms

ρεα εβ εα εidle εβ εα εidle εα εβ εα εβ εα εβ

∫ xφ

Undef .x

εα∨εβ

εidle

εα

εβ

I ρ is a path; εβ , εα, and εidle are events;I φ = εβ ( ), φ = εα ( ), and φ = εβ ∨ εα ( )

Page 16: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Talk Outline

Motivation

BackgroundSpecification Language RMTL-

∫3

Synthesis of RMTL-∫3

Simplification of Quantified FormulasTemporal operators and duration terms as higher order functions

Stable and non-stable Conditions for Monitoring

Ongoing Case Study based on PixHawk autopilotPlatformRunTime Embedded Monitoring Library – RTEMLLanguages and Synthesizer

Page 17: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Monitoring Synthesis of RMTL-∫

3

Intuition behind monitor generation

1. Quantifiers are discarded prior the execution. Any monitoringformula is quantifier free.

∃x A→ (B ∧ (x < 10)),

which is trivially simplified to A→ B .

2. Temporal operators such as until (U) and since (S) areencoded using higher order functions.

A U<20 B is true for t = 0

A U<21 B is false for t = 0

εM is released at each 20time units, and the trace ρbegins at t = 0.

B

A

εM εM εMρ

Page 18: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Monitoring Synthesis of RMTL-∫

3

Intuition behind monitor generation

1. Quantifiers are discarded prior the execution. Any monitoringformula is quantifier free.

∃x A→ (B ∧ (x < 10)),

which is trivially simplified to A→ B .2. Temporal operators such as until (U) and since (S) are

encoded using higher order functions.

A U<20 B is true for t = 0

A U<21 B is false for t = 0

εM is released at each 20time units, and the trace ρbegins at t = 0.

B

A

εM εM εMρ

Page 19: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Simplification of RMTL-∫

3 formulas I

Definition (Inequality Abstraction Constraint)Let φ3 be a formula in RMTL-

∫3. φ3 is a formula in first order logic

of real numbers (FOLR) if it is free of duration terms,minimum/maximum terms, temporal operators, and propositions.

Step by step example of the proposed simplification algorithm

1. x <∫ x+1

(P ∧ x < 10){replace duration term by y}

2. x < y ∧ 0 ≤ y ≤ x + 1{apply weaker inequality for P ∧ x < 10 }

3. x < y ∧ 0 ≤ y ≤ x + 1∧((x < 10)→

(0 ≤

∫ x+1P ≤ x + 1

))∧

¬(x < 10)→ ff{replace new duration term by z}

Page 20: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Simplification of RMTL-∫

3 formulas I

Definition (Inequality Abstraction Constraint)Let φ3 be a formula in RMTL-

∫3. φ3 is a formula in first order logic

of real numbers (FOLR) if it is free of duration terms,minimum/maximum terms, temporal operators, and propositions.

Step by step example of the proposed simplification algorithm

1. x <∫ x+1

(P ∧ x < 10){replace duration term by y}

2. x < y ∧ 0 ≤ y ≤ x + 1{apply weaker inequality for P ∧ x < 10 }

3. x < y ∧ 0 ≤ y ≤ x + 1∧((x < 10)→

(0 ≤

∫ x+1P ≤ x + 1

))∧

¬(x < 10)→ ff{replace new duration term by z}

Page 21: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Simplification of RMTL-∫

3 formulas I

Definition (Inequality Abstraction Constraint)Let φ3 be a formula in RMTL-

∫3. φ3 is a formula in first order logic

of real numbers (FOLR) if it is free of duration terms,minimum/maximum terms, temporal operators, and propositions.

Step by step example of the proposed simplification algorithm

1. x <∫ x+1

(P ∧ x < 10){replace duration term by y}

2. x < y ∧ 0 ≤ y ≤ x + 1{apply weaker inequality for P ∧ x < 10 }

3. x < y ∧ 0 ≤ y ≤ x + 1∧((x < 10)→

(0 ≤

∫ x+1P ≤ x + 1

))∧

¬(x < 10)→ ff{replace new duration term by z}

Page 22: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Simplification of RMTL-∫

3 formulas I

Definition (Inequality Abstraction Constraint)Let φ3 be a formula in RMTL-

∫3. φ3 is a formula in first order logic

of real numbers (FOLR) if it is free of duration terms,minimum/maximum terms, temporal operators, and propositions.

Step by step example of the proposed simplification algorithm

1. x <∫ x+1

(P ∧ x < 10){replace duration term by y}

2. x < y ∧ 0 ≤ y ≤ x + 1{apply weaker inequality for P ∧ x < 10 }

3. x < y ∧ 0 ≤ y ≤ x + 1∧((x < 10)→

(0 ≤

∫ x+1P ≤ x + 1

))∧

¬(x < 10)→ ff{replace new duration term by z}

Page 23: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Simplification of RMTL-∫

3 formulas II

4. x < y ∧ 0 ≤ y ≤ x + 1∧((x < 10)→ (0 ≤ z ≤ x + 1))∧¬(x < 10)→ ff{apply CAD }

5. y = 0 ∧ (z = 0 ∨ (0 ≤ z ≤ x + 1)))∨(0 < y ≤ x + 1 ∧ 0 ≤ z ≤ x + 1) for x ∈ [−1, 0[, and(x < y ≤ x + 1 ∧ 0 ≤ z ≤ x + 1) for x ∈ [0, 10[{replace y and z by

∫ x+1P }

6.∫ x+1

P = 0 ∨ 0 <∫ x+1

P ≤ x + 1 for x ∈ [−1, 0[,x <

∫ x+1P ≤ x + 1 for x ∈ [0, 10[, and

ff otherwise

Now, we have that ∀x , x <∫ x+1

(P ∧ x < 10) is false, and∃x , x <

∫ x+1(P ∧ x < 10) is true.

Page 24: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Simplification of RMTL-∫

3 formulas II

4. x < y ∧ 0 ≤ y ≤ x + 1∧((x < 10)→ (0 ≤ z ≤ x + 1))∧¬(x < 10)→ ff{apply CAD }

5. y = 0 ∧ (z = 0 ∨ (0 ≤ z ≤ x + 1)))∨(0 < y ≤ x + 1 ∧ 0 ≤ z ≤ x + 1) for x ∈ [−1, 0[, and(x < y ≤ x + 1 ∧ 0 ≤ z ≤ x + 1) for x ∈ [0, 10[{replace y and z by

∫ x+1P }

6.∫ x+1

P = 0 ∨ 0 <∫ x+1

P ≤ x + 1 for x ∈ [−1, 0[,x <

∫ x+1P ≤ x + 1 for x ∈ [0, 10[, and

ff otherwise

Now, we have that ∀x , x <∫ x+1

(P ∧ x < 10) is false, and∃x , x <

∫ x+1(P ∧ x < 10) is true.

Page 25: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Simplification of RMTL-∫

3 formulas II

4. x < y ∧ 0 ≤ y ≤ x + 1∧((x < 10)→ (0 ≤ z ≤ x + 1))∧¬(x < 10)→ ff{apply CAD }

5. y = 0 ∧ (z = 0 ∨ (0 ≤ z ≤ x + 1)))∨(0 < y ≤ x + 1 ∧ 0 ≤ z ≤ x + 1) for x ∈ [−1, 0[, and(x < y ≤ x + 1 ∧ 0 ≤ z ≤ x + 1) for x ∈ [0, 10[{replace y and z by

∫ x+1P }

6.∫ x+1

P = 0 ∨ 0 <∫ x+1

P ≤ x + 1 for x ∈ [−1, 0[,x <

∫ x+1P ≤ x + 1 for x ∈ [0, 10[, and

ff otherwise

Now, we have that ∀x , x <∫ x+1

(P ∧ x < 10) is false, and∃x , x <

∫ x+1(P ∧ x < 10) is true.

Page 26: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Simplification of RMTL-∫

3 formulas II

4. x < y ∧ 0 ≤ y ≤ x + 1∧((x < 10)→ (0 ≤ z ≤ x + 1))∧¬(x < 10)→ ff{apply CAD }

5. y = 0 ∧ (z = 0 ∨ (0 ≤ z ≤ x + 1)))∨(0 < y ≤ x + 1 ∧ 0 ≤ z ≤ x + 1) for x ∈ [−1, 0[, and(x < y ≤ x + 1 ∧ 0 ≤ z ≤ x + 1) for x ∈ [0, 10[{replace y and z by

∫ x+1P }

6.∫ x+1

P = 0 ∨ 0 <∫ x+1

P ≤ x + 1 for x ∈ [−1, 0[,x <

∫ x+1P ≤ x + 1 for x ∈ [0, 10[, and

ff otherwise

Now, we have that ∀x , x <∫ x+1

(P ∧ x < 10) is false, and∃x , x <

∫ x+1(P ∧ x < 10) is true.

Page 27: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Simplification of RMTL-∫

3 formulas III

After simplifying ∀x , (0 ≤ x < 10)→ x <∫ x+1

(P ∧ x < 10), wehave ∀x , (0 ≤ x < 10)→ 0 <

∫ x+1P − x ≤ x + 1.

The proposition P is now isolated and we have two options,

1. replace x with a set of unique values – formula size highlyincreases (unpractical for real numbers search space)

2. increasingly compute duration terms for different intervals(uncovered in this paper) – may have a low monitoringoverhead

Page 28: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Simplification of RMTL-∫

3 formulas III

After simplifying ∀x , (0 ≤ x < 10)→ x <∫ x+1

(P ∧ x < 10), wehave ∀x , (0 ≤ x < 10)→ 0 <

∫ x+1P − x ≤ x + 1.

The proposition P is now isolated and we have two options,1. replace x with a set of unique values – formula size highly

increases (unpractical for real numbers search space)

2. increasingly compute duration terms for different intervals(uncovered in this paper) – may have a low monitoringoverhead

Page 29: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Simplification of RMTL-∫

3 formulas III

After simplifying ∀x , (0 ≤ x < 10)→ x <∫ x+1

(P ∧ x < 10), wehave ∀x , (0 ≤ x < 10)→ 0 <

∫ x+1P − x ≤ x + 1.

The proposition P is now isolated and we have two options,1. replace x with a set of unique values – formula size highly

increases (unpractical for real numbers search space)2. increasingly compute duration terms for different intervals

(uncovered in this paper) – may have a low monitoringoverhead

Page 30: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Synthesis of duration term:∫ a

φ

1ϕ(κ,υ) :: (K×Υ)→ R≥0 → Φ3 → {0, 1}

1ϕ(κ,υ) (κ, υ) t φ ,

{1 if Computeϕ (κ, υ, t) φ = tt0 otherwise

evηal :: (K×Υ)→ Φ3 → K→ R≥0

evηal (κ, υ) φ κ , fold(λs, (p, (i , t′))→ t′ ·

(1ϕ(κ,υ) (κ, υ) t′ φ

)+ s)0 κ

Compute(∫

) (κ, υ) t a φ ,

{evηal (κ, υ) φ (subK (κ, υ, t) a) if a ≥ 0⊥R otherwise

Page 31: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Synthesis of duration term:∫ a

φ

1ϕ(κ,υ) :: (K×Υ)→ R≥0 → Φ3 → {0, 1}

1ϕ(κ,υ) (κ, υ) t φ ,

{1 if Computeϕ (κ, υ, t) φ = tt0 otherwise

evηal :: (K×Υ)→ Φ3 → K→ R≥0

evηal (κ, υ) φ κ , fold(λs, (p, (i , t′))→ t′ ·

(1ϕ(κ,υ) (κ, υ) t′ φ

)+ s)0 κ

Compute(∫

) (κ, υ) t a φ ,

{evηal (κ, υ) φ (subK (κ, υ, t) a) if a ≥ 0⊥R otherwise

Page 32: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Synthesis of duration term:∫ a

φ

1ϕ(κ,υ) :: (K×Υ)→ R≥0 → Φ3 → {0, 1}

1ϕ(κ,υ) (κ, υ) t φ ,

{1 if Computeϕ (κ, υ, t) φ = tt0 otherwise

evηal :: (K×Υ)→ Φ3 → K→ R≥0

evηal (κ, υ) φ κ , fold(λs, (p, (i , t′))→ t′ ·

(1ϕ(κ,υ) (κ, υ) t′ φ

)+ s)0 κ

Compute(∫

) (κ, υ) t a φ ,

{evηal (κ, υ) φ (subK (κ, υ, t) a) if a ≥ 0⊥R otherwise

Page 33: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Synthesis of Until operator: φ1 U<γ φ2

evial :: B3 → B3 → B4

evial b1 b2 ,

mapB4 b2 if b2 6= ffmapB4 b1 if b1 6= tt and b2 = ffr otherwise

evbal ::

(K×Υ×R≥0

)→ Φ3 → Φ3 → B4 → B4

evbal m φ1 φ2 v ,

{evi

al(Computeϕ m φ1

) (Computeϕ m φ2

)if v = r

v otherwise

evfoldal :: (K×Υ×R≥0)→ Φ3 → Φ3 → K→ B4

evfoldal (κ, υ, t) φ1 φ2 κ , fold

(λv (p, (i , t′))→ evb

al (κ, υ, t′ − ε) φ1 φ2 v)r κ

evCal :: (K×Υ×R≥0)→ R≥0 → Φ3 → Φ3 → K→ (B× B4)

evCal (κ, υ, t) γ φ1 φ2 κ ,

(d (κ) ≤ t + γ, evfold

al (κ, υ, t) φ1 φ2 κ)

Compute(U<) m γ φ1 φ2 ,

{mapB3

(evC

al m γ φ1 φ2 (subK m γ))

if γ ≥ 0ff otherwise

Page 34: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Synthesis of Until operator: φ1 U<γ φ2

evial :: B3 → B3 → B4

evial b1 b2 ,

mapB4 b2 if b2 6= ffmapB4 b1 if b1 6= tt and b2 = ffr otherwise

evbal ::

(K×Υ×R≥0

)→ Φ3 → Φ3 → B4 → B4

evbal m φ1 φ2 v ,

{evi

al(Computeϕ m φ1

) (Computeϕ m φ2

)if v = r

v otherwise

evfoldal :: (K×Υ×R≥0)→ Φ3 → Φ3 → K→ B4

evfoldal (κ, υ, t) φ1 φ2 κ , fold

(λv (p, (i , t′))→ evb

al (κ, υ, t′ − ε) φ1 φ2 v)r κ

evCal :: (K×Υ×R≥0)→ R≥0 → Φ3 → Φ3 → K→ (B× B4)

evCal (κ, υ, t) γ φ1 φ2 κ ,

(d (κ) ≤ t + γ, evfold

al (κ, υ, t) φ1 φ2 κ)

Compute(U<) m γ φ1 φ2 ,

{mapB3

(evC

al m γ φ1 φ2 (subK m γ))

if γ ≥ 0ff otherwise

Page 35: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Synthesis of Until operator: φ1 U<γ φ2

evial :: B3 → B3 → B4

evial b1 b2 ,

mapB4 b2 if b2 6= ffmapB4 b1 if b1 6= tt and b2 = ffr otherwise

evbal ::

(K×Υ×R≥0

)→ Φ3 → Φ3 → B4 → B4

evbal m φ1 φ2 v ,

{evi

al(Computeϕ m φ1

) (Computeϕ m φ2

)if v = r

v otherwise

evfoldal :: (K×Υ×R≥0)→ Φ3 → Φ3 → K→ B4

evfoldal (κ, υ, t) φ1 φ2 κ , fold

(λv (p, (i , t′))→ evb

al (κ, υ, t′ − ε) φ1 φ2 v)r κ

evCal :: (K×Υ×R≥0)→ R≥0 → Φ3 → Φ3 → K→ (B× B4)

evCal (κ, υ, t) γ φ1 φ2 κ ,

(d (κ) ≤ t + γ, evfold

al (κ, υ, t) φ1 φ2 κ)

Compute(U<) m γ φ1 φ2 ,

{mapB3

(evC

al m γ φ1 φ2 (subK m γ))

if γ ≥ 0ff otherwise

Page 36: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Synthesis of Until operator: φ1 U<γ φ2

evial :: B3 → B3 → B4

evial b1 b2 ,

mapB4 b2 if b2 6= ffmapB4 b1 if b1 6= tt and b2 = ffr otherwise

evbal ::

(K×Υ×R≥0

)→ Φ3 → Φ3 → B4 → B4

evbal m φ1 φ2 v ,

{evi

al(Computeϕ m φ1

) (Computeϕ m φ2

)if v = r

v otherwise

evfoldal :: (K×Υ×R≥0)→ Φ3 → Φ3 → K→ B4

evfoldal (κ, υ, t) φ1 φ2 κ , fold

(λv (p, (i , t′))→ evb

al (κ, υ, t′ − ε) φ1 φ2 v)r κ

evCal :: (K×Υ×R≥0)→ R≥0 → Φ3 → Φ3 → K→ (B× B4)

evCal (κ, υ, t) γ φ1 φ2 κ ,

(d (κ) ≤ t + γ, evfold

al (κ, υ, t) φ1 φ2 κ)

Compute(U<) m γ φ1 φ2 ,

{mapB3

(evC

al m γ φ1 φ2 (subK m γ))

if γ ≥ 0ff otherwise

Page 37: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Synthesis of Until operator: φ1 U<γ φ2

evial :: B3 → B3 → B4

evial b1 b2 ,

mapB4 b2 if b2 6= ffmapB4 b1 if b1 6= tt and b2 = ffr otherwise

evbal ::

(K×Υ×R≥0

)→ Φ3 → Φ3 → B4 → B4

evbal m φ1 φ2 v ,

{evi

al(Computeϕ m φ1

) (Computeϕ m φ2

)if v = r

v otherwise

evfoldal :: (K×Υ×R≥0)→ Φ3 → Φ3 → K→ B4

evfoldal (κ, υ, t) φ1 φ2 κ , fold

(λv (p, (i , t′))→ evb

al (κ, υ, t′ − ε) φ1 φ2 v)r κ

evCal :: (K×Υ×R≥0)→ R≥0 → Φ3 → Φ3 → K→ (B× B4)

evCal (κ, υ, t) γ φ1 φ2 κ ,

(d (κ) ≤ t + γ, evfold

al (κ, υ, t) φ1 φ2 κ)

Compute(U<) m γ φ1 φ2 ,

{mapB3

(evC

al m γ φ1 φ2 (subK m γ))

if γ ≥ 0ff otherwise

Page 38: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Settling decisions about our synthesis mechanism

Lets introduce other available and common mechanisms.

What we get by using automata ?A lot of theory and fundamental properties. But, could suchapproach help us on runtime verification of durationformulas? Maybe not.

What we gain using automata with stop-watches?We know that the reachability problem is undecidable whenmore than one clock is used.

I Since we are dealing with explicit time, automata basedsynthesization is irrelevant when compared with theexploration of inductive structures. Well, a very strong andunproved sentence.

* AND NOW SIMULATIONS *

Page 39: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Settling decisions about our synthesis mechanism

Lets introduce other available and common mechanisms.

What we get by using automata ?A lot of theory and fundamental properties. But, could suchapproach help us on runtime verification of durationformulas? Maybe not.

What we gain using automata with stop-watches?We know that the reachability problem is undecidable whenmore than one clock is used.

I Since we are dealing with explicit time, automata basedsynthesization is irrelevant when compared with theexploration of inductive structures. Well, a very strong andunproved sentence.

* AND NOW SIMULATIONS *

Page 40: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Simulated results of the RMTL-∫

evaluation algorithm

10−4 10−3 10−2 10−1 100 101 102i1i2i3i4i5i6

Computation Time (s)

fold

cycles

i1 i2 i3 i4 i5 i60246810

fold cycles

Untilop

erators(n)

i1 i2 i3 i4 i5 i60246810

fold cycles

Durationterm

s(n)

(a) computation time vs. executioncycles of fold functions,m(ϕ) = 25 − 1 and nκ = 1000

100 101 102 103 104 10510−4

10−1

102

105

108

nκ = 1000nκ = 100

nκ = 10

10002 ·m(ϕ)

1002 ·m(ϕ)

102 ·m(ϕ)

m(ϕ)

Com

putatio

nTim

e(s)

(b) computation time vs. formulasize constructed with nested Untiloperators

Figure: Experimental validation of the complexity results provided in [6]

Page 41: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Talk Outline

Motivation

BackgroundSpecification Language RMTL-

∫3

Synthesis of RMTL-∫3

Simplification of Quantified FormulasTemporal operators and duration terms as higher order functions

Stable and non-stable Conditions for Monitoring

Ongoing Case Study based on PixHawk autopilotPlatformRunTime Embedded Monitoring Library – RTEMLLanguages and Synthesizer

Page 42: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Unstable conditions for monitorsPre-defined conditions in RML4Ada framework

1. step-bounded condition – the execution of the monitor endswhen n iterations have been processed or when events havenot arrived (dynamic time execution);

2. time-bounded condition – the execution of the monitor isbounded by t time units, exiting if no events occur (dynamictime execution);

3. symbol-based condition – the execution ends when one ormore symbols of the path are consumed, and the monitorsleeps until a new symbol arrival (dynamic time execution);

(3)

(1)

εM εM εM εM εMρ

Page 43: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Stable conditions for monitors

Unstable monitors are not enough to ensure safe monitoring.For that we require an hierarchy of well-behaved monitors andwell-dependent monitors. Correctness by construction.

But, what this means?We need to make the assumption that the monitor is timeconstant. Each branch of a control flow graph of a monitor has torun exactly the same instructions or at least the same number ofinstructions (note that the latter is more weak).Based on that we can trust over the verdicts of such monitor, andemploy unstable monitors to perform more dynamic tasks.We need to assume that monitors are always interfering as aconstant measure of time. Can we could call it stationary ?

Page 44: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Talk Outline

Motivation

BackgroundSpecification Language RMTL-

∫3

Synthesis of RMTL-∫3

Simplification of Quantified FormulasTemporal operators and duration terms as higher order functions

Stable and non-stable Conditions for Monitoring

Ongoing Case Study based on PixHawk autopilotPlatformRunTime Embedded Monitoring Library – RTEMLLanguages and Synthesizer

Page 45: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Talk Outline

Motivation

BackgroundSpecification Language RMTL-

∫3

Synthesis of RMTL-∫3

Simplification of Quantified FormulasTemporal operators and duration terms as higher order functions

Stable and non-stable Conditions for Monitoring

Ongoing Case Study based on PixHawk autopilotPlatformRunTime Embedded Monitoring Library – RTEMLLanguages and Synthesizer

Page 46: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

PixHawk platform

I Applicability of the developed tools for a real application usinga real embedded ARM Cortex-M4 processor.

I Lightweight Drones are currently unsafe in terms of time-spaceisolation. Our purpose is to apply the runtime verification toincrease dependability of such well spread air vehicles.

Page 47: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Talk Outline

Motivation

BackgroundSpecification Language RMTL-

∫3

Synthesis of RMTL-∫3

Simplification of Quantified FormulasTemporal operators and duration terms as higher order functions

Stable and non-stable Conditions for Monitoring

Ongoing Case Study based on PixHawk autopilotPlatformRunTime Embedded Monitoring Library – RTEMLLanguages and Synthesizer

Page 48: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

RTEML is for embedded systems I

RTEML is a modification of the current in house multi-purposeapproach and library [7] that is purely imperative programmingoriented.

Issues that we identify for embedded systems

I assigning a buffer for each type of event is memory consuming.A buffer of 100 elements is not the same as a set of ten buffersof size 10 (related to the approach);

I event overwrite is not safe since can be unrecoverable at somepoint (related to the approach);

I only works if monitors have less priority (related to the librarylevel);

I lock-free mechanism is supported by Boost library (related tothe library level);

I wait-free is not provided (related to the library level);

Page 49: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

RTEML is for embedded systems II

RTEML usage regards

I is lock- and wait-free;I does not overwrite events by default;I due to the synthesis tool it manages the buffers of monitors by

clusters when synthesis of RMTL-∫3 is used;

I only works for ARM architectures but can be further extended;

Page 50: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Modes of execution for RTEML

Modes of operation

I Time-Triggered mode – executes as a periodic task;

PεM εM εM εM

I Event-Based mode – executes as a sporadic task (eachinter-arrival time shall be supplied before the execution andstatically checked);

PεM εM εM

I Hybrid mode – mixture both previous modes;

Page 51: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Talk Outline

Motivation

BackgroundSpecification Language RMTL-

∫3

Synthesis of RMTL-∫3

Simplification of Quantified FormulasTemporal operators and duration terms as higher order functions

Stable and non-stable Conditions for Monitoring

Ongoing Case Study based on PixHawk autopilotPlatformRunTime Embedded Monitoring Library – RTEMLLanguages and Synthesizer

Page 52: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

From RMTL-∫

3 to C++11

Thanks to C++11 lambda functions.Thanks to Ocaml programming language. Lets see thermtld3synthcpp tool in more detail...

DEMO

Page 53: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

The End...

Thank you for watching our presentation.Please send any comment to [email protected].

Page 54: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Publications I

Logic-based Schedulability Analysis for Compositional HardReal-Time Embedded Systems.In Proceedings of the 6th International Workshop onCompositional Theory and Technology for Real-TimeEmbedded Systems, CRTS ’13, 2013.

A Compositional Monitoring Framework for Hard Real-TimeSystems.In Proceedings of the 6th NASA Formal Methods Symposium,pages 16–30, 2014.

Implementing Ada Task Types in AVR-Ada.Ada User Journal, 35(3):194–203, 2014.

Page 55: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Publications II

Towards a Runtime Verification Framework for the AdaProgramming Language.In Proceedings of the 19th Ada-Europe InternationalConference on Reliable Software Technologies, pages 58–73,2014.

Logic-based schedulability analysis for compositional hardreal-time embedded systems.SIGBED Rev., 12(1):56–64, March 2015.

Monitoring for a decidable fragment of MTLD.In Proceedings of the 15th International Conference onRuntime Verification, September 2015.

Page 56: TowardsaCaseStudyonRuntimeVerificationof R ... · K R 0! 3! 3!B4!B4 evb al m ˚1 ˚2 v , (evi al Compute ’m ˚1 Compute ’m ˚2 ifv = r v otherwise evfold al:: (K R 0) ! 3! 3!K

Publications III

Geoffrey Nelissen, David Pereira, and LuísMiguel Pinho.A novel run-time monitoring architecture for safe and efficientinline monitoring.In Juan Antonio de la Puente and Tullio Vardanega, editors,Reliable Software Technologies – Ada-Europe 2015, volume9111 of Lecture Notes in Computer Science, pages 66–82.Springer International Publishing, 2015.