formal verification of uml statecharts with real-timeextensions · 2003. 11. 13. · formal...

25
Formal Verification of UML Statecharts with Real-Time Extensions Alexandre David M. Oliver M¨ oller Wang Yi Uppsala University BRICS ª Arhus Outline: 1 UML, Statechar ts , and Time 2 Semantics f or F or mal V er ification 3 V er ifying a P acemak er with U P P A A L NWPT’01 10 OCTOBER 2001 OLIVER OLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 1

Upload: others

Post on 04-Feb-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

  • Formal Verification of UML Statec har tswith Real-Time Extensions

    �Alexandre David

    �M. Oliver Möller

    �Wang Yi

    �Uppsala Univer sity

    �BRICS ªArhus

    �����������

    �� ��������������������� ��������������������������������

    Outline:1 UML, Statecharts, and Time

    2 Semantics for Formal Verification

    3 Verifying a Pacemaker with UPPAAL

    NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 1

  • Unified Modeling Langua ge (UML)

    Born from unification of other methods (Booch, OMT, OOSE)Different views of a system:

    A) user view - use case diagrams

    B) structural view - class diagrams

    C) behavioral view - statecharts

    D) environmental view - deployment diagrams

    E) implementation view - component diagrams

    An evolving standard: 1.3 finished 2000

    1.4 finished 2001

    2.0 work in progress (4 RFP issued May/Sept)

    NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 2

  • The Statec har t Formalism

    !

    "$#&%('*)+"-,.'/"-0

    Features

    hierarchical state machines

    parallelism (on any level)

    history

    event communication

    powerful synchronization mechanisms

    inter-level transitions

    actions that are dependent on states

    actions on entry/exit

    ...

    NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 3

  • Restricted Statec har t Formalism

    132547638+1-9.6/1-:

    ;<

    Current restricted features

    hierarchical state machines ✔

    parallelism (on any level) ✔

    history ✔

    no event communication

    no sync states

    no inter-level transitions

    no actions that are dependent on states

    no actions on entry/exit

    instead:

    hand-shake style synchronization

    shared variables

    NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 4

  • Real-Time Extensions

    Clocks

    (timed) Guards

    Invariants

    NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 5

  • NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS6

  • A Word on Semantics

    UML-statec har ts:

    informal (textual) semantic statements

    ambiguity of text

    variations over 1.3 / 1.4 / 2.0

    implementations make user-driven choices

    our formalism:

    rule-based, formal semantic

    unambiguous

    not identical, makes clear choices

    any given formal statechart semantic should be “easy” totranslate into it

    NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 7

  • Semantic Rules (example)

    configuration: with control locations

    valuation of integer variables

    valuation of clocks

    history

    operation: .=?>A@+>CBD>CE

    a transition

    JoinEnabled Inv F F EXITactionG G

    NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 8

  • Model Checking

    H

    : description of the system

    : desired property

    easier than proving a general theorem

    completely automatic (’yes’ or counterexample)

    efficient algorithms tailored for classes of problems

    NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 9

  • Real-Time Model Checking with UPPAAL

    A B

    x

  • From (timed) Statec har ts to UPPAAL

    Rhapsody timed Statechart HTA model Y TA model flatten( Y )hierarchical model TA-close hierarchy MODEL-CHECK

    informal description formal semantics formal semantics

    NORMALIZATIONsimplification of data(safe) omission of c-code

    FLATTENINGauxiliary locationsauxiliary variables

    Guiding Principle: Make it easy to adjust to small changes

    NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 11

  • From (timed) Statec har ts to UPPAAL

    Rhapsody timed Statechart HTA model Y TA model flatten( Y )hierarchical model TA-close hierarchy MODEL-CHECK

    informal description formal semantics formal semantics

    NORMALIZATIONsimplification of data(safe) omission of c-code

    FLATTENINGauxiliary locationsauxiliary variables

    Guiding Principle: Make it easy to adjust to small changes

    NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 12

  • Soundness &Correctness

    Translations introduce slack. Thus

    Z flatten Z flatten

    but

    Z flatten Z []\_^a`cbedgfah3i j flatten

    timed transition system timed flatten( ) traces

    give rise to project to k Ytimed Z traces match timed Z traces

    NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 13

  • NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS14

  • Outline of the Flattening

    3 phases to flatten a hierarchical structure:

    1. Collect instantiationsevery superstate becomes one (flat) timed automaton

    2. Compute global joinsmimic synchronization-on-exit in the the flat automataprinciple: use counters & and add threshold-guard

    3. Post-pr ocess channel comm unicationa transitions may not synchronize with its own superstateprinciple: duplicate channels & restrict scope

    NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 15

  • Example: Flattening the Model of a Human Heart

    l(monqpsr(tu monqpsr(t

    vxwzyS{

    vxwzyS{

    | }

    vS~( l7 l7 ( u

    v~�( l7 l7 ( lvy(y r7n n7 v rs lv~ p v (psn r(n vvo l( (

    vxwzyS{vy(y r7n n7 v rs uvwzy{vxwzy{

    vy(y p v (psn r(ns vvor v 7 lr v 7 u

    uo  r ¡ re¢ v r £]y(y?¤v~¥{

    vS~¦{

    §©¨Cª¬«®¬¯°¨±¯©²X³C³X´VContraction

    HEART_TIME

  • Comm unication Conflict

    AB

    c!

    c?

    AB

    c_1!

    c_2?

    cannot keep c

    cannot remove c

    rename c inside

    rename c outside

    modify other transitions:

    either choose one of c 1, c 2

    or duplicate transition (allow both)

    NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 17

  • Model-Chec king a Pacemaker

    µ·¶°¸®¹»º·¼½®¶°¸®¹»º·¼

    ¾À¿ÂÁÄÃ

    ¾À¿ÂÁÄÃ

    Å Æ

    ¾&Ç+È®É·Ê µ»Ë µ·Ì·Í ɻΠ½

    ¾5Ç+È®É·Ê µ»Ë µ·Ì·Í ɻΠµ¾aÁ·ÁÐÏ º·Ñ·¸©Ò ¸»Ó ¾ º©Ô µ¾5Ç+Õ×ÖCÕ ¹CÔ×Ø ¾ Ø·¹»¸·Ñ Ù׺·¸©Ô ¾°Ú©¾°ÖCÛ Ì Ê µ·Í ÊÝÜzÞ·É

    ¾�¿ÂÁÐþÐÁ·ÁÐÏ º·Ñ·¸©Ò ¸»Ó ¾ º©Ô ½¾À¿ÂÁÄþ�¿ÂÁÐÃ

    ¾ÐÁ·ÁaÕ×ÖCÕ ¹CÔ×Ø ¾ Ø·¹»¸·Ñ Ù׺·¸©Ô ¾°Ú©¾°ÖCÛº Õ®¾ Ô·Ò µº Õ®¾ Ô·Ò ½

    ½°ß®º ÕÝÚ º7àÑ®Ø Ú©¾ º Õ Ø Õ®áâÁ·Ácã¾5Ç.Ã

    ¾&ÇDÃ

    äæåèç éëê ì±å ìæíîèîqïWaiting

    Pacing

    Refractory

    Ventricular

    Waiting

    Pacing

    Refractory

    Ventricular

    A_Pacing

    Refractory

    Waiting

    A_Pacing

    Refractory

    Waiting

    Sensed

    Off ToOff?ToOn?

    inAVI

    RefractDone!

    ToTriggered?

    TriggeredInhibited

    t:=0

    ToAVI?

    Ventricular

    ToInhibited?

    APace!

    VPace?

    APace?

    inIdle

    ToIdle?

    AVI

    t==Pulse_WidthVPace!

    t:=0

    t==senseTime

    V_Sense!

    t==RefTime

    t:=0

    V_Sense?

    Atrial

    RefractDone?

    sense?x:=0

    x

  • Flattening of the Pacemaker Model

    HTA model UPPAAL model

    # XML tags 564 1191

    # proper control locations 35 45

    # pseudo-states / committed locations 33 63

    # transitions 47 177

    # variables and constants 33 72

    # formal clocks 6 6

    NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 19

  • Model-Chec king the Pacemaker

    DEADLOCK:possible (if heart stops)

    SAFETY:ÿ���� � ������N �N���� �only true for ’good’ medic

    LIVENESS:ÿ���� � ����M�N������IN � ÿ�� ÿ ����M�N������IN

    Parameter s:

    E.g. for , is violated

    NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 20

  • Model-Chec king the Pacemaker

    DEADLOCK:possible (if heart stops)

    SAFETY:ÿ���� � ������N �N���� �only true for ’good’ medic

    LIVENESS:ÿ���� � ����M�N������IN � ÿ�� ÿ ����M�N������IN

    Parameter s:�������������������������� � ��� ��! ��������������"�� � #$�

    %���&������������������' � ���%���&������������������� � �

    (������������&�&��$)���%�� ���$*���������� � #�+��

    ����%���� )������$(���%���&���� � ,�,

    E.g. for -�.�/1032146587:93;6 � ?1@ , ÿ���� � ������N �N��6�� is violated

    NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 21

  • Related Work

    Variations of the statechart formalisme.g., in 1994, von der Beeck lists 21 different statechartsand distinguishes them in 26 criteria

    Timed extension of statechartse.g., work of Kesten/Pnueli, Petersohn, and others

    UML profile for Schedulability, Performance and Timegeneral time model, both discrete and continuousno progress notion with invariants

    realizations of UML, that extend the standarde.g., the Rhapsody tool has timers

    NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 22

  • Our Formalism in the European WOODDES Project

    Workshop for Object-Oriented Design and Development of Embedded Systems

    Partner s:

    PSA

    Mecel

    CEA

    I-Logix

    Intracom

    Offis

    Uppsala

    Aalborg

    Objectives:

    UML Real-Time profile

    WOODDES methodology & tool platform

    I n tools owned by project partners

    RHAPSODY

    OBJECTEERI NG

    TAU / OBJECTGEODETAU / UML Suite

    RE

    PO

    SIT

    OR

    Y

    AIT−WOODDESModel exchange

    via XMI

    Public API sI nternal

    exchangeForm at

    Analysis Design Sim ulat ion (V&V) Code Gen. Test Gen.

    TEST COMPOSER

    AGATHA

    RATIONAL ROSE

    ACCORD

    UPPAAL

    MODEL CHECKER

    NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 23

  • Conc lusions & Future Work

    Status

    ✔ XML grammar

    ✔ semantics

    ✔ flattening

    Future Work

    formal proof for semantic correspondence

    implementation of an hierarchical editor

    integrate HTAs in the UPPAAL tool

    NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 24

  • References

    [AD94] R. Alur and D.L. dill. A Theory of Timed Automata. In Theoretical ComputerScience, number 125, 1994

    [vdB94] Michael von der Beeck. A Comparison of Statechart Variants. In de RoeverLangmaack and Vytopil, editors, Formal Techniques in RealTime and Fault-Tolerant Systems, volume 863 of Lecture Notes in Computer Science, pages128–148. Springer-Verlag, 1994.

    [D99] Bruce Powel Douglass. Real-Time UML, Second Edition - Developing EfficientObjects for Embedded Systems. Addison-Wesley, 1999

    [DM01] Alexandre David and M. Oliver Möller. From Hierarichcal TimedAutomata to UPPAAL. Research Series RS-01-11, BRICS, Depart-ment of Computer Science, University of Aarhus, March 2001. seeACBCBEDGFIHEHKJCJEJGLNMCOQPSRCTULWVKXYHSZY[CHE\Y]KH^]C]KH^P`_^VCaKbcLdACBEeYf

    .

    [OMG] Unified Modeling Language, version 1.4. Download from http://www.omg.org

    [WOODDES] WOODDES web page: http://wooddes.intranet.gr

    NWPT’01 10 OCTOBER 2001 OLIVER MÖLLER: FORMAL VERIFICATION OF UML STATECHARTS WITH REAL-TIME EXTENSIONS 25

    http://www.brics.dk/RS/01/11/index.html