290 likes | 499 Views
Bounded Model Checking for Region Automata. Fang Yu, Bow-Yaw Wang, Yaw-Wen Hu ang Institute of Information Science Academia Sinica, Taiwan. Introduction. SAT-based model checking from discrete systems to time systems Challenge How to handle infinite timing behavior? Discrete clocks
E N D
Bounded Model Checking for Region Automata Fang Yu,Bow-Yaw Wang, Yaw-Wen Huang Institute of Information Science Academia Sinica, Taiwan
Introduction • SAT-based model checking from discrete systems to time systems • Challenge • How to handle infinite timing behavior? • Discrete clocks • Zone predicates Region Automata
Real-Time System • Discrete variables plus dense-time clocks • Real domain • A uniform rate increase • Reset X: Y: … 0 1 2
Timed Automata • Timed Automata <D, X, A, E, I>: • D: A set of discrete variables • X: A set of clocks • A: A set of actions • Each action is a series of discrete variable assignments • E: A set of edges, each edge is associated with • : Guarded condition • : An action • : A set of reset clocks • I: An initial condition ,
Timed Automata • State • Discrete interpretation • Clock interpretation • Transition • Time elapse • Edge fire A positive real
Region Automata • Alur et al (1990) • Equivalence class [ν] • integral part • fraction ordering • Region Graph • State • Transition y 0 x
What’s The Problem? • Region Graph [ACD90] • Precision, simplicity, and an intrinsic bound • However… • Prohibitive size • Regions exponential to the number and the max constraint constants of clocks • Standard model checking verification becomes infeasible even for moderately-sized systems Theoretical rather than practical!
Bounded Model Checking • Biere et al.[BCCFZ99] • Boolean formula satisfiability • n steps: • Pros • Powerful SAT solvers developed • Many heuristic approaches • Over thousands of variables and millions of clauses capable A powerful support for region automata!
Region Encoding Each odd pair a fraction relation [0,0] [1,1] [2,2] [3,3] X: (0,1) (1,2) (2,3) (3,∞] 0 1 2 3 Y: x Z: 0 1 2 3 7(Mx) Xd 3 1 5 2 0 6 4 Xd is evena point Xd is odd an open interval Xd is Mx X>Cx 7 3 1 5 2 0 6 4 Fraction relation: Xf>Yf, Xf>Zf, Yf>Zf X: Y: Z: … 0 1 2 3 4 … 7 8 3 1 5 2 0 6 4 Xd=3, Yd=5, Zd=4, Xf<Yf
Region (In a Two-clock System) X: Y: 0 1 2 3 3 1 4 5 7 2 0 6 Xd=5, Yd=3, Xf<Yf y Xd is even, Yd is odd or My Xd is odd or Mx, Yd is even Xd is odd, Yd is odd, Xf<Yf Xd is odd , Yd is odd, Xf=Yf Xd is odd, Yd is odd, Xf>Yf Xd is even, Yd is even Xd is Mx, Yd is odd Xd is odd, Yd is My Xd is Mx, Yd is My • No intersection • Universe 0 x
Successor (In a Two-clock System) Xd’=Xd+1, Yd’=Yd, Xf’<Yf’ Xd’=Xd++, Yd’=Yd++, Xf’=Yf’ Xd’=Xd, Yd’ =Yd++ Xd is odd, Yd is odd, and Xf<Yf Xd is even, Yd is even Xd is even, Yd is odd or My
A General Case: Multi-clock System • Pair Conjunction? X: X Y: Z: Xd’=Xd++ 0 1 2 3 Xd’=Xd 3 1 5 2 0 6 4 Z Y Xd=1, Yd=1, Zd=3, Xf=Yf, Xf>Zf, Yf>Zf A clock can progress, only when all its pairs allow it to progress!
Who is The Murderer? • Observation: when clock values are • Even: always progress • Max: always stay • Odd: progress and stay at the same time • Should consider other pairs before progresses • Should not progress unless all its pairs allow it to progress Contradiction!! How to achieve this?
A General Case: Multi-clock System • An extra case for stuttering • Not all stuttering Xd=1, Yd=1, Zd=4, Xf=Yf Xd=1, Yd=1, Zd=3, Xf=Yf, Xf>Zf, Yf>Zf X: Y: Z: 0 1 2 3 3 1 5 2 0 6 4 X Xd’=Xd++, Yd’=Yd++ Xd’=Xd, Zd’=Zd++ Or Xd’=Xd, Yd’=Yd, R’XY=RXY Or Xd’=Xd, Zd’=Zd R’xz=Rxz Y Z
A General Case: Multi-clock System • An extra case for stuttering • Not all stuttering
Transition • Time elapse • Edge fire • A step condition 0
Reachability Analysis BoundedFwdReach(I, R, T, MaxBound) var i: 0.. MaxBound; begin i := 0; F := I(i);loop foreverif(i=MaxBound) returnunreachable within MaxBound;if(SAT(FR(i))) returnreachable; F := FT(i) R(i); i := i+1; end. Results of each step are added until termination
Theorem Given a TA having n regions, BoundedFwdReach() is sound and complete when MaxBound≥n.
Implementation • Implementation • Standard bit encoding • A circuit representation • xBMC • Make use of zChaff • xBMC 2.0: supports real-time systems • xBMC 1.0: supports discrete systems, and has been used to verify program security(DSN2004)
Fischer’s Mutual Exclusion • Each process • X: a local clock • L: a global discrete variable • Safety property • For all i<j, • Safe, only when A≥B • Experiments • Increase the number of processes • Check whether a violation occurs when A<B L=Nul; {X} idle ready L!=P; L:=Nul X<B; L:=P, {X} critical wait L=PX>A;
Time Performance of Bug Hunting A=1, B=2. P1.7 GHz, 256M, Linux
Compared to BBMC • Wozna, Penczek and Zbrzezny (FI 2003) • BBMC found the witness at the 12th iteration • xBMC 2.0 found the witness at the 15th iteration Fischer’s Mutual Exclusion, A=1, B=2
Discussion and Related Works • Discretization • Discrete time unit • Penczek, Wozna and Zbrzezny (FTRTFT’02) • Divide a time unit into 2n segments • Tool: BBMC • General zones/polyhedra • Quantifier Boolean elimination • Seshia and Bryant (CAV’03) • Tool: TMV • Region Graph • prohibitive size • from infeasible to feasible • Simple transition relation • SAT-Based Model Checking
Conclusion and Future Work • We propose a new transition relation encoding based on region graph • We realize it in xBMC 2.0 • Standard experiments show some promise in bug hunting • How about correctness guarantee? • An intrinsic bound: usually prohibitively high to reach • Unbounded approaches: Induction, interpolation. Apply inductive method(appeared in ATVA2004)
Conclusion and Future Work • How about large constants? • Large constants did incur worse performance • Change B from 2 to 4000: 22->14 • How about clock difference conditions? Apply abstraction techniques Add extra Boolean predicates for clock difference conditions
Thank you for your attention. Any questions are welcome! Contact info. Bow-Yaw Wang bywang@iis.sinica.edu.tw http://iis.sinica.edu.tw/~bywang Fang Yu yuf@iis.sinica.edu.tw http://iis.sinica.edu.tw/~yuf ~END~
Discussion and Related Work • Symbolic Zone Model Checking • Unbounded • State: Zone • Transition: Quantifier elimination • Explore states until fixed point reached • Conventional Tools: RED(CRD), UPPAAL(DBM), KRONOS(DBM) • SAT-based Zone Model Checker • Seshia and Bryant (CAV’03) • Separation Logic and Predicate Encoding • Tool: TMV
Region Discretization • (s, [v])(s, vd, vr) • vd :Integral part • vr :Fraction part • An example