c2e2 a verification tool for
play

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


  1. C2E2: A Verification Tool For Stateflow Models Parasara Sridhar Duggirala , Sayan Mitra, Mahesh Viswanathan, Matthew Potok

  2. Pacemaker – Cardiac Cell System + 2

  3. Pacemaker – Cardiac Cell System stimulating pulse π‘Ÿ 0 π‘Ÿ 1 Pacemaker … π‘Ÿ 3 π‘Ÿ 2 HA = Finite State Machine + Differential Equation 𝑣(𝑒) 𝑦 1 (𝑒) time time Stimulus from pacemaker Behavior of a cardiac cell 3

  4. Features of the Model Safety Verification Unsafe Set 𝑦 1 (𝑒) time Stateflow Model of Pacemaker – Cardiac Cell system Features: Invariants , Guards , and Resets  Inputs: 1. Model of the system 𝐡 , Solution 2. Initial States Θ , and Reachable Set Computation 3. Unsafe States 𝑉  Output: If the system is safe or unsafe βˆ€π‘¦ ∈ Θ, 𝜊 𝑦, 𝑒 βˆ‰ 𝑉 4

  5. Contributions  Simulation based verification algorithm for Fully Hybrid Systems  Theoretical guarantees – Soundness and Relative Completeness  Tool Features β€’ Stateflow Models, hyxml intermediate format β€’ Graphical User Interface β€’ Visualizing the reachable set 5

  6. Overview οƒΌ Motivation and Problem Statement  Challenges in Verification  Building Blocks and Algorithm  Soundness and Relative Completeness Guarantees  Tool Features  Annotations  Future Work 6

  7. Safety Verification Unsafe Set 𝑣(𝑒) time Stateflow Model of Pacemaker – Cardiac Cell system Features: Invariants , Guards , and Resets  Inputs: 1. Model of the system 𝐡 , Solution 2. Initial States Θ , and Reachable Set Computation 3. Unsafe States 𝑉  Output: If the system is safe or unsafe βˆ€π‘¦ ∈ Θ, 𝜊 𝑦, 𝑒 βˆ‰ 𝑉 7

  8. Challenges In Reachable Set Computation Unsafe Set 𝑣(𝑒) time Stateflow Model of Pacemaker – Cardiac Cell system Features: Invariants , Guards , and Resets  Nonlinear ODEs – do not even have a closed form solution  Switching conditions – predicates on variables (nondeterminism) Our Technique: Use simulations for computing Reachable Set 8

  9. ሢ A Simple (Often The Only) Strategy  Given start and unsafe 𝑉 Θ 𝐢 πœ— (𝜊(𝑦 0 , 𝑒))  Compute finite cover of initial set  Simulate from the center 𝑦 0 of each cover  Bloat simulation so that bloated tube contains all trajectories from the cover  Union = over-approximation of reach set 𝑦 0 𝑦 = 𝑔(𝑦) 9

  10. ሢ A Simple (Often The Only) Strategy  Given start and unsafe 𝑉 Θ 𝐢 πœ— (𝜊(𝑦 0 , 𝑒))  Compute finite cover of initial set  Simulate from the center 𝑦 0 of each cover  Bloat simulation so that bloated tube contains all trajectories from the cover  Union = over-approximation of reach set 𝑦 0  Check intersection/containment with 𝑉  Refine 𝑦 = 𝑔(𝑦) 10

  11. ሢ A Simple (Often The Only) Strategy  Given start and unsafe 𝑉 Θ 𝐢 πœ— (𝜊(𝑦 0 , 𝑒))  Compute finite cover of initial set  Simulate from the center 𝑦 0 of each cover  Bloat simulation so that bloated tube contains all trajectories from the cover  Union = over-approximation of reach set 𝑦 0  Check intersection/containment with 𝑉  Refine 𝑦 = 𝑔(𝑦) 11

  12. ሢ A Simple (Often The Only) Strategy  Given start and unsafe 𝑉 Θ 𝐢 πœ— (𝜊(𝑦 0 , 𝑒))  Compute finite cover of initial set  Simulate from the center 𝑦 0 of each cover  Bloat simulation so that bloated tube contains all trajectories from the cover  Union = over-approximation of reach set 𝑦 0  Check intersection/containment with 𝑉  Refine 𝑦 = 𝑔(𝑦) 1. How do we get the simulations? 2. How much to bloat? 3. How to handle mode switches? 12

  13. Building Blocks : Simulations Simulation from 𝑦 0 given as 𝜊(𝑦 0 , 𝑒) – no closed form! π’•π’‹π’π’—π’Žπ’ƒπ’–π’‹π’‘π’(π’š 𝟏 , π’Š, 𝝑, 𝑼) gives a sequence S 0 , … , 𝑇 𝑙 : 1. at any time 𝑒 ∈ [π‘—β„Ž, 𝑗 + 1 β„Ž] , 𝜊 𝑦 0 , 𝑒 ∈ 𝑇 𝑗 2. 𝑒𝑗𝑏 𝑇 𝑗 ≀ πœ— π’˜π’ƒπ’Žπ‘»π’‹π’(π’š 𝟏 , 𝑼, π’ˆ) generates such simulations (CAPD) 13

  14. Building Blocks : Discrepancy Function 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 𝑓 𝛿𝑒 𝜊 𝑦 2 , 𝑒 𝑦 2 ≀ 𝐿 𝑦 1 βˆ’ 𝑦 2 𝑓 𝛿𝑒 1 |𝑦 1 βˆ’ 𝑦 2 | 𝑦 1 𝜊 𝑦 1 , 𝑒 = 𝐿 𝑦 1 βˆ’ 𝑦 2 𝑓 𝛿𝑒 1 Discrepancy functions are given as model annotations, i.e. 〈𝐿, 𝛿βŒͺ is given by the user 14

  15. Simulations + Discrepancy Functions = ReachTubes 𝝎 = π’”π’‡π’ƒπ’…π’Šπ’–π’—π’„π’‡ 𝑻, 𝝑, 𝑼 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

  16. Simulations + Discrepancy Functions = ReachTubes 𝝎 = π’”π’‡π’ƒπ’…π’Šπ’–π’—π’„π’‡ 𝑻, 𝝑, 𝑼 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( π‘ͺ 𝜺 π’š 𝟏 , 𝝑 𝟐 + 𝝑 πŸ‘ , 𝑼) οƒΌ How do we get the simulations? Invariants οƒΌ How much to bloat? β€’ How to handle mode switches? Guards 16

  17. Handling Invariants Tagging: track a region based on a predicate 𝑄 𝑛𝑣𝑑𝑒 𝑆 βŠ† 𝑄 𝑆 ∩ 𝑄 β‰  βˆ…, ΰ΄€ 𝒖𝒃𝒉𝑺𝒇𝒉𝒋𝒑𝒐 𝑺, 𝑸 = ቐ 𝑛𝑏𝑧 𝑆 ∩ 𝑄 β‰  βˆ… π‘œπ‘π‘’ 𝑆 ∩ 𝑄 = βˆ… Goal: Reachtube that respects the invariant of the mode 𝝔 = π’‹π’π’˜π’ƒπ’”π’‹π’ƒπ’π’–π‘Έπ’”π’‡π’ˆπ’‹π’š(𝝎, π‘±π’π’˜π’ƒπ’”π’‹π’ƒπ’π’–) is βŒ©π‘† 0 , 𝑒𝑏𝑕 0 , … , 𝑆 𝑛 , 𝑒𝑏𝑕 𝑛 βŒͺ , such that either β€² 𝑑 before it are must 𝑒𝑏𝑕 𝑗 = 𝑛𝑣𝑑𝑒 if all the 𝑆 π‘˜ β€² 𝑑 before it are tagged may or must and at least one of 𝑒𝑏𝑕 𝑗 = 𝑛𝑏𝑧 if all the 𝑆 π‘˜ them is not must 17

  18. Handling Guards & Resets Goal: Compute set of states in Reachtube that change mode based on Guard π’π’‡π’šπ’–π‘Ίπ’‡π’‰π’‹π’‘π’π’•(𝝔) returns a set of tagged regions N. ∈ 𝑂 iff βˆƒ 𝑏 ∈ 𝐡, βŒ©π‘† 𝑗 , 𝑒𝑏𝑕 𝑗 βŒͺ ∈ 𝜚 such that 𝑆 β€² = 𝑆𝑓𝑑𝑓𝑒 𝑏 𝑆 𝑗 and: 𝑆′, 𝑒𝑏𝑕′ 𝑆 𝑗 βŠ† 𝐻𝑣𝑏𝑠𝑒 𝑏 , 𝑒𝑏𝑕 𝑗 = 𝑒𝑏𝑕 β€² = 𝑛𝑣𝑑𝑒 𝑆 𝑗 ∩ 𝐻𝑣𝑏𝑠𝑒 𝑏 β‰  βˆ…, 𝑆 𝑗 βˆ‰ 𝐻𝑣𝑏𝑠𝑒 𝑏 , 𝑒𝑏𝑕 𝑗 = 𝑛𝑣𝑑𝑒, 𝑒𝑏𝑕 β€² = 𝑛𝑏𝑧 𝑆 𝑗 ∩ 𝐻𝑣𝑏𝑠𝑒 𝑏 β‰  βˆ…, 𝑒𝑏𝑕 𝑗 = 𝑒𝑏𝑕′ = 𝑛𝑏𝑧 Tagging is essentially bookkeeping 1. π‘—π‘œπ‘€π‘π‘ π‘—π‘π‘œπ‘’π‘„π‘ π‘“π‘”π‘—π‘¦ discards the invalid trajectories (violating invariant) 2. π‘œπ‘“π‘¦π‘’π‘†π‘“π‘•π‘—π‘π‘œπ‘‘ tags the regions based on the feasibility of discrete transition Utility of tagging 1. Reachable set is contained in union of may and must regions – inferring safety 2. There exists at least one reachable state in every must region – inferring violation of safety 18

  19. Algorithm for Hybrid Systems Input: Initial Set Θ , Unsafe set 𝑉 , Time π‘ˆ , Number of Switches 𝑂 π‘žπ‘π‘ π‘’π‘—π‘’π‘—π‘π‘œ ← 𝑒𝑏𝑕𝑕𝑓𝑒𝐷𝑝𝑀𝑓𝑠(Θ) βˆ€ βŒ©π‘‡, 𝑒𝑏𝑕βŒͺ ∈ π‘žπ‘π‘ π‘’π‘—π‘’π‘—π‘π‘œ πœ” ← π‘ π‘“π‘π‘‘β„Žπ‘ˆπ‘£π‘π‘“(𝑇, π‘ˆ) 𝑦 0 end; 19

  20. Algorithm for Hybrid Systems Input: Initial Set Θ , Unsafe set 𝑉 , Time π‘ˆ , Number of Switches 𝑂 π‘žπ‘π‘ π‘’π‘—π‘’π‘—π‘π‘œ ← 𝑒𝑏𝑕𝑕𝑓𝑒𝐷𝑝𝑀𝑓𝑠(Θ) βˆ€ βŒ©π‘‡, 𝑒𝑏𝑕βŒͺ ∈ π‘žπ‘π‘ π‘’π‘—π‘’π‘—π‘π‘œ πœ” ← π‘ π‘“π‘π‘‘β„Žπ‘ˆπ‘£π‘π‘“(𝑇, π‘ˆ) 𝜚 ← π‘—π‘œπ‘€π‘π‘ π‘—π‘π‘œπ‘’π‘„π‘ π‘“π‘”π‘—π‘¦(πœ”) invariant end; 20

  21. Algorithm for Hybrid Systems Input: Initial Set Θ , Unsafe set 𝑉 , Time π‘ˆ , Number of Switches 𝑂 π‘žπ‘π‘ π‘’π‘—π‘’π‘—π‘π‘œ ← 𝑒𝑏𝑕𝑕𝑓𝑒𝐷𝑝𝑀𝑓𝑠(Θ) βˆ€ βŒ©π‘‡, 𝑒𝑏𝑕βŒͺ ∈ π‘žπ‘π‘ π‘’π‘—π‘’π‘—π‘π‘œ πœ” ← π‘ π‘“π‘π‘‘β„Žπ‘ˆπ‘£π‘π‘“(𝑇, π‘ˆ) 𝜚 ← π‘—π‘œπ‘€π‘π‘ π‘—π‘π‘œπ‘’π‘„π‘ π‘“π‘”π‘—π‘¦(πœ”) invariant if ( 𝜚 is safe ) then continue; if ( 𝜚 is unsafe and 𝑒𝑏𝑕 is 𝑛𝑣𝑑𝑒 ) return unsafe ; else refine tagged cover; end; return safe ; 21

Recommend


More recommend