C2E2: A Verification Tool For Stateflow Models
Parasara Sridhar Duggirala, Sayan Mitra, Mahesh Viswanathan, Matthew Potok
C2E2: A Verification Tool For Stateflow Models Parasara Sridhar - - PowerPoint PPT Presentation
C2E2: A Verification Tool For Stateflow Models Parasara Sridhar Duggirala , Sayan Mitra, Mahesh Viswanathan, Matthew Potok Pacemaker Cardiac Cell System + 2 Pacemaker Cardiac Cell System stimulating pulse 0 1 Pacemaker
Parasara Sridhar Duggirala, Sayan Mitra, Mahesh Viswanathan, Matthew Potok
2
3
π0 π2 π3
stimulating pulse
Pacemaker
π1
time
π£(π’) π¦1(π’)
time Stimulus from pacemaker Behavior of a cardiac cell
1. Model of the system π΅, 2. Initial States Ξ, and 3. Unsafe States π
βπ¦ β Ξ, π π¦, π’ β π
4
π¦1(π’)
time Unsafe Set Stateflow Model of Pacemaker β Cardiac Cell system Features: Invariants, Guards, and Resets
Solution Reachable Set Computation
5
οΌMotivation and Problem Statement
6
1. Model of the system π΅, 2. Initial States Ξ, and 3. Unsafe States π
βπ¦ β Ξ, π π¦, π’ β π
7
π£(π’)
time Unsafe Set Stateflow Model of Pacemaker β Cardiac Cell system Features: Invariants, Guards, and Resets
Solution Reachable Set Computation
8
Our Technique: Use simulations for computing Reachable Set
π£(π’)
time Unsafe Set Stateflow Model of Pacemaker β Cardiac Cell system Features: Invariants, Guards, and Resets
9
all trajectories from the cover
Ξ
π¦0
π
αΆ π¦ = π(π¦) πΆπ(π(π¦0, π’))
10
all trajectories from the cover
Ξ
π¦0
π
αΆ π¦ = π(π¦) πΆπ(π(π¦0, π’))
11
all trajectories from the cover
Ξ
π¦0
π
αΆ π¦ = π(π¦) πΆπ(π(π¦0, π’))
12
all trajectories from the cover
Ξ
π¦0
π
αΆ π¦ = π(π¦) πΆπ(π(π¦0, π’))
Simulation from π¦0 given as π(π¦0, π’) β no closed form!
13
ππππππππππ(ππ, π, π, πΌ) gives a sequence S0, β¦ , ππ: 1. at any time π’ β [πβ, π + 1 β], π π¦0, π’ β ππ 2. πππ ππ β€ π
ππππ»ππ(ππ, πΌ, π) generates such simulations (CAPD)
Discrepancy Function: capturing the continuity of ODE solutions executions that start close, stay close
β©πΏ, πΏβͺ is called an exponential discrepancy function of the system if for any two states π¦1 and π¦2 β π, for any t |π(π¦1, π’) β π(π¦2, π’)| β€ πΏ π¦1 β π¦2 ππΏπ’
14
|π¦1 β π¦2| π¦1 π¦2 π π¦2, π’ π π¦1, π’ β€ πΏ π¦1 β π¦2 ππΏπ’1 = πΏ π¦1 β π¦2 ππΏπ’1
Discrepancy functions are given as model annotations, i.e. β©πΏ, πΏβͺ is given by the user
π = ππππ πππππ π», π, πΌ of αΆ π¦ = π π¦ is a sequence π0, β¦ , ππ such that πππ(ππ) β€ π and from any π¦0 β π, for each time π’ β [πβ, (π + 1)β], π π¦0, π’ β ππ.
How to compute a ReachTube from validated simulation and annotation? π0, β¦ , ππ, π1 β ππππ»ππ(π¦0, π, π)
15
π = ππππ πππππ π», π, πΌ of αΆ π¦ = π π¦ is a sequence π0, β¦ , ππ such that πππ(ππ) β€ π and from any π¦0 β π, for each time π’ β [πβ, (π + 1)β], π π¦0, π’ β ππ.
How to compute a ReachTube from validated simulation and annotation? π0, β¦ , ππ, π1 β ππππ»ππ(π¦0, π, π) For each π β π π2 β max
π’βππ πΏππΏπ’π;
ππ β πΆπ2 ππ π0, β¦ , ππ is a reachtube(πͺπΊ ππ , ππ + ππ, πΌ)
16
οΌ How do we get the simulations? οΌ How much to bloat?
Invariants Guards
Tagging: track a region based on a predicate π
ππππΊπππππ πΊ, πΈ = α ππ£π‘π’ π β π πππ§ π β© π β β , ΰ΄€ π β© π β β πππ’ π β© π = β π = ππππππππππΈπππππ(π, π±ππππππππ) is β©π0, π’ππ0, β¦ , ππ, π’πππβͺ , such that either π’πππ = ππ£π‘π’ if all the π
π β²π‘ before it are must
π’πππ = πππ§ if all the π
π β²π‘ before it are tagged may or must and at least one of
them is not must
17
Goal: Reachtube that respects the invariant of the mode
πππππΊππππππ(π) returns a set of tagged regions N. πβ², π’ππβ² β π iff β π β π΅, β©ππ, π’πππβͺ β π such that πβ² = πππ‘ππ’π ππ and: ππ β π»π£ππ ππ , π’πππ = π’ππβ² = ππ£π‘π’ ππ β© π»π£ππ ππ β β , ππ β π»π£ππ ππ , π’πππ = ππ£π‘π’, π’ππβ² = πππ§ ππ β© π»π£ππ ππ β β , π’πππ = π’ππβ² = πππ§ Tagging is essentially bookkeeping
Utility of tagging
safety
18
Goal: Compute set of states in Reachtube that change mode based on Guard
Input: Initial Set Ξ, Unsafe set π, Time π, Number of Switches π πππ π’ππ’πππ β π’ππππππ·ππ€ππ (Ξ) β β©π, π’ππβͺ β πππ π’ππ’πππ π β π πππβππ£ππ(π, π) end;
19
π¦0
Input: Initial Set Ξ, Unsafe set π, Time π, Number of Switches π πππ π’ππ’πππ β π’ππππππ·ππ€ππ (Ξ) β β©π, π’ππβͺ β πππ π’ππ’πππ π β π πππβππ£ππ(π, π) π β πππ€ππ ππππ’ππ ππππ¦(π) end;
20
invariant
Input: Initial Set Ξ, Unsafe set π, Time π, Number of Switches π πππ π’ππ’πππ β π’ππππππ·ππ€ππ (Ξ) β β©π, π’ππβͺ β πππ π’ππ’πππ π β π πππβππ£ππ(π, π) π β πππ€ππ ππππ’ππ ππππ¦(π) if (π is safe) then continue; if (π is unsafe and π’ππ is ππ£π‘π’) return unsafe; else refine tagged cover; end; return safe;
21
invariant
Input: Initial Set Ξ, Unsafe set π, Time π, Number of Switches π πππ π’ππ’πππ β π’ππππππ·ππ€ππ (Ξ) β β©π, π’ππβͺ β πππ π’ππ’πππ π β π πππβππ£ππ(π, π) π β πππ€ππ ππππ’ππ ππππ¦(π) if (π is safe) then continue; if (π is unsafe and π’ππ is ππ£π‘π’) return unsafe; else refine tagged cover; end; return safe;
22
guard
Input: Initial Set Ξ, Unsafe set π, Time π, Number of Switches π πππ π’ππ’πππ β π’ππππππ·ππ€ππ (Ξ) β β©π, π’ππβͺ β πππ π’ππ’πππ π β π πππβππ£ππ(π, π) π β πππ€ππ ππππ’ππ ππππ¦(π) πππ¦π’ β πππ¦π’πππππππ‘(π) if (π is safe) then check πππ¦π’; if (π is unsafe and π’ππ is ππ£π‘π’) return unsafe; else refine tagged cover; end; return safe;
23
guard
Input: Initial Set Ξ, Unsafe set π, Time π, Number of Switches π πππ π’ππ’πππ β π’ππππππ·ππ€ππ (Ξ) β β©π, π’ππβͺ β πππ π’ππ’πππ ππ£ππ£ππππππππ‘ β {β©π, π’ππβͺ} β π, π’ππ β ππ£ππ£ππππππππ‘ until π steps and π time π β π πππβππ£ππ(π, π) π β πππ€ππ ππππ’ππ ππππ¦(π) πππ¦π’ β πππ¦π’πππππππ‘(π) if (π is safe) enque πππ¦π’ to ππ£ππ£ππππππππ‘; if (π is unsafe and π’ππ is ππ£π‘π’) return unsafe; else refine tagged cover; end; end; return safe;
24
guard
[Soundness]: If the algorithm returns safe(or unsafe), then the system is indeed safe(or unsafe). Proof sketch:
are safe
in the unsafe set
25
[Relative Completeness]: If the system is robustly safe or robustly unsafe, then the algorithm will terminate with correct answer. Definition
Robustly safe: If there is π separation between reachable set and π Robustly unsafe: If π shrinkage of invariants, guards, and initial set Ξ, is unsafe with respect to π shrinkage of π Proof sketch: 1. Refining the cover enough will ensure that overapproximation is less than π, so if the system is robustly safe, the algorithm returns safe 2. If the π shrinkage of invariants, guards, Ξ, and π is unsafe, then β ππ tagged ππ£π‘π’ in the reachable that is unsafe
26
οΌMotivation and Problem Statement οΌChallenges in Verification οΌBuilding Blocks and Algorithm οΌSoundness and Relative Completeness Guarantees
27
Features:
28
Architecture of C2E2
π’ β₯ 5; π’ = 0
Stateflow models: No formal semantics from MATHWORKS, Hybrid automata semantics by Tiwari [β02], Manamcheri et.al.[β10] Urgent semantics: Bloating the guard set: for providing robust counterexamples π’ β₯ 5 β π’ β₯ 5 β π, π’ β€ 5 + π
29
30
More in the Tool Demo Market
31 Benchmark Variables Sims. C2E2 (time) Flow* (time) Ariadne (time) Moore-G. Jet Engine 2 36 1.56 10.54 56.57 Brussellator System 2 115 5.26 16.77 72.75 VanDerPol Oscillator 2 17 0.75 8.93 98.36 Coupled VanDerPol 4 62 1.43 90.96 270.61 Sinusoidal Tracking 6 84 3.68 48.63 763.32 Linear Adaptive 3 16 0.47 NA NA Nonlinear Adaptive 2 32 1.23 NA NA Nonlinear Disturbance 3 48 1.52 NA NA
C2E2 Flow*
π¦ = π(π¦) has Lipschitz constant π, then π¦1(π’) β π¦2(π’) β€ |π¦1 β π¦2|πππ’
2 β€ π π¦1 β π¦2 2πβππ’
β€ π π¦1 β π¦2 ; π = πΊ(π)
π€ = π΅π€ that are exponentially stable, compute Lyapunov function
32
Exponential discrepancy function β©πΏ = 3.8, πΏ = β0.2βͺ
Future Work
given system
33