Verification of Control Systems by Abstract
Total Page:16
File Type:pdf, Size:1020Kb
49th IEEE Conference on Decision and Control Atlanta, GA Pre-Conference Workshop on Verification of Control Systems December 14, 2010 Verification of Control Systems by Abstract Interpretation Patrick Cousot CIMS-NYU & ENS [email protected] cs.nyu.edu/~pcousot [email protected] di.ens.fr/~cousot 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 1 © P. Cousot Motivation 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 2 © P. Cousot All computer scientists have experienced bugs Ariane 5.01 failure Patriot failure Mars orbiter loss Russian Proton-M rocket carrying 3 Glonass-M satellites (overflow error) (float rounding error) (unit error) (unknown programming error) • Checking the presence of bugs is great • Proving their absence is even better! 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 3 © P. Cousot Abstract interpretation Patrick Cousot & Radhia Cousot. Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Conference Record of the Fourth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 238—252, Los Angeles, California, 1977. ACM Press, New York, NY, USA Patrick Cousot & Radhia Cousot. Systematic design of program analysis frameworks. In Conference Record of the Sixth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages pages 269—282, San Antonio, Texas, 1979. ACM Press, New York, U.S.A. Patrick Cousot & Radhia Cousot. Abstract interpretation frameworks. Journal of Logic and Computation, 2(4):511—547, August 1992. 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 4 © P. Cousot Abstract interpretation • Started in the 70’s • Statically and automatically inferring properties of the behavior of programs/computer systems for program analysis (proof, verification, optimization, transformation, etc.) • Based on the idea that undecidability and complexity of automated static program analysis can be fought by approximation • Applications of abstract interpretation do scale up! 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 5 © P. Cousot Application to static analysis and verification • Static analysis consists in automatically answering questions about the runtime executions of programs • Static means « at compile time », by examining the program text only, without executions on computers • Automatic means by a computer, without human intervention during the analysis Program Static analyzer Answer Question program Computer 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 6 © P. Cousot Fighting undecidability and complexity in program verification • Any automatic program verification method will definitely fail on infinitely many programs (Gödel) • Solutions: • Ask for human help (theorem-prover based deductive methods) • Consider (small enough) finite systems (model- checking) • Do complete abstractions or else sound approximations (abstract interpretation) Program Static analyzer Answer Question program Don’t know Computer 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 7 © P. Cousot An informal introduction to abstract interpretation P. Cousot & R. Cousot. A gentle introduction to formal verification of computer systems by abstract interpretation. In Logics and Languages for Reliability and Security, J. Esparza, O. Grumberg, & M. Broy (Eds), NATO Science Series III: Computer and Systems Sciences, © IOS Press, 2010, Pages 1—29. 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 8 © P. Cousot 1) Define the programming language semantics Formalize the concrete execution of programs (e.g. transition system) y y (x,y) t=0 x t=2 x t=… t=1 t Trajectory Space/time trajectory in state space 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 9 © P. Cousot II) Define the program properties of interest Formalize what you are interested to know about program behaviors 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 10 © P. Cousot III) Define which specification must be checked Formalize what you are interested to prove about program behaviors Forbiden zone Possible trajectories 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 11 © P. Cousot IV) Choose the appropriate abstraction Abstract away all information on program behaviors irrelevant to the proof Zone interdite Possible trajectories Abstraction of the trajectories 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 12 © P. Cousot V) Mechanically verify in the abstract The proof is fully automatic Forbidden zone Possible trajectories Abstraction of the trajectories 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 13 © P. Cousot Soundness of the abstract verification Never forget any possible case so the abstract proof is correct in the concrete Forbidden zone Possible trajectories Abstraction of the trajectories 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 14 © P. Cousot Unsound validation: testing Try a few cases 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 15 © P. Cousot Unsound validation: bounded model-checking Simulate the beginning of all executions Forbidden zone Possible trajectories Bounded model-checking 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 16 © P. Cousot Unsound validation: static analysis Many static analysis tools are unsound (e.g. Coverity, etc.) so inconclusive 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 17 © P. Cousot Incompleteness When abstract proofs may fail while concrete proofs would succeed Forbidden zone Alarm !!! Possible trajectories Error or false alarm ? By soundness an alarm must be raised for this overapproximation! 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 18 © P. Cousot True error The abstract alarm may correspond to a concrete error Forbidden zone Alarm !!! Possible trajectories Error 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 19 © P. Cousot False alarm The abstract alarm may correspond to no concrete error (false negative) Forbidden zone Alarm !!! Possible trajectories False alarm 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 20 © P. Cousot What to do about false alarms? • Automatic refinement: inefficient and may not terminate (Gödel) • Domain-specific abstraction: • Adapt the abstraction to the programming paradigms typically used in given domain-specific applications • e.g. synchronous control/command: no recursion, no dynamic memory allocation, maximum execution time, etc. 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 21 © P. Cousot Just a bit less informally ... Patrick Cousot & Radhia Cousot. Basic Concepts of Abstract Interpretation. In Building the Information Society , René Jacquard (Ed.), Kluwer Academic Publishers, pp. 359—366, 2004. (IFIP WCC 2004 Toulouse, Topical Day on Abstract Interpretation, Tuesday 24 August 2004). 49th iEEE Conference on Decision and Control, Atlanta GA, Pre-Conference Workshop on Verification of Control Systems, Dec. 14, 2010 22 © P. Cousot Lemma 5 A semantics = Σ, T , is terminating if and only if tdm[T]=Σ. ST Definition 6 (termination proof) A termination proof for a trace semantics is the Lemma 5 A semantics = Σ, T , is terminating if and only if tdm[T ]=Σ. ST proof, using the definitionST of as hypothesis, that it is terminating for all states, that is ST ΣDefinitiontdm[T] 6 (a (termination variant is Init proof)tdm[TA]whereterminationInit proofΣ isfor a given a trace set semantics of initial states).is the ST proof,⊆ using the definition of ⊆ as hypothesis, that⊆ it is terminating for all states, that is ST Σ Σtdm, τ[,TInit] (a variant is Init tdm[T]whereInit Σ is a given set of initial states). ⊆ ⊆ ⊆ post r X s s X : r(s, s) Σ, τ, Init { | ∃ ∈ } Lemma Σ 5 A semantics = Σ, T , is terminating if and only if tdm[T]=Σ. post r X s s X : r(s, s) T { | ∃ ∈ S} 7.4 Functions LemmaΣ 5 A semanticsn = Σ, T , is terminating if and only if tdm[T ]=Σ. lfp F = F ( ) T n0 S ⊥ ⊥ We let (S S ... S) S be set set of n-aryDefinition partial functions 6n (terminationon S which is