A Framework for Translating Models and Specifications Shmuel Katz Computer Science Department The Technion.

Slides:



Advertisements
Similar presentations
1 Verification by Model Checking. 2 Part 1 : Motivation.
Advertisements

Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Translation-Based Compositional Reasoning for Software Systems Fei Xie and James C. Browne Robert P. Kurshan Cadence Design Systems.
Automatic Verification Book: Chapter 6. What is verification? Traditionally, verification means proof of correctness automatic: model checking deductive:
Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
1 Translation Validation: From Simulink to C Michael RyabtsevOfer Strichman Technion, Haifa, Israel Acknowledgement: sponsored by a grant from General.
Timed Automata.
1 Mechanical Verification of Timed Automata Myla Archer and Constance Heitmeyer Presented by Rasa Bonyadlou 24 October 2002.
Background information Formal verification methods based on theorem proving techniques and model­checking –to prove the absence of errors (in the formal.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Axiomatic Semantics.
ISBN Chapter 3 Describing Syntax and Semantics.
1 Formal Methods in SE Qaisar Javaid Assistant Professor Lecture 05.
SAT and Model Checking. Bounded Model Checking (BMC) A.I. Planning problems: can we reach a desired state in k steps? Verification of safety properties:
1 Temporal Logic u Classical logic:  Good for describing static conditions u Temporal logic:  Adds temporal operators  Describe how static conditions.
Formal Methods in Software Engineering Credit Hours: 3+0 By: Qaisar Javaid Assistant Professor Formal Methods in Software Engineering1.
© Katz, 2007CS Formal SpecificationsLecture - Temporal logic 1 Temporal Logic Formal Specifications CS Shmuel Katz The Technion.
1 Model Checking, Abstraction- Refinement, and Their Implementation Based on slides by: Orna Grumberg Presented by: Yael Meller June 2008.
© Katz, 2003 Formal Specifications of Complex Systems-- Real-time 1 Adding Real-time to Formal Specifications Formal Specifications of Complex Systems.
Course Summary. © Katz, 2003 Formal Specifications of Complex Systems-- Real-time 2 Topics (1) Families of specification methods, evaluation criteria.
Model Checking. Used in studying behaviors of reactive systems Typically involves three steps: Create a finite state model (FSM) of the system design.
Katz Formal Specifications Larch 1 Algebraic Specification and Larch Formal Specifications of Complex Systems Shmuel Katz The Technion.
1 Carnegie Mellon UniversitySPINFlavio Lerda SPIN An explicit state model checker.
Categories of Aspects Shmuel Katz Computer Science Department The Technion Haifa, Israel.
Validating High-Level Synthesis Sudipta Kundu, Sorin Lerner, Rajesh Gupta Department of Computer Science and Engineering, University of California, San.
© Katz, 2007 Formal Specifications of Complex Systems-- Real-time 1 Adding Real-time to Formal Specifications Formal Specifications of Complex Systems.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 18 Program Correctness To treat programming.
Course Summary. © Katz, 2007 Formal Specifications of Complex Systems-- Real-time 2 Topics (1) Families of specification methods, evaluation criteria.
Rigorous Fault Tolerance Using Aspects and Formal Methods Shmuel Katz Computer Science Department The Technion Haifa, Israel
Embedded Systems Laboratory Department of Computer and Information Science Linköping University Sweden Formal Verification and Model Checking Traian Pop.
ESE601: Hybrid Systems Introduction to verification Spring 2006.
Witness and Counterexample Li Tan Oct. 15, 2002.
Describing Syntax and Semantics
1 Formal Engineering of Reliable Software LASER 2004 school Tutorial, Lecture1 Natasha Sharygina Carnegie Mellon University.
© Katz, 2003 Formal Specifications of Complex Systems-- Real-time 1 Adding Real-time to Formal Specifications Formal Specifications of Complex Systems.
1.3 Executing Programs. How is Computer Code Transformed into an Executable? Interpreters Compilers Hybrid systems.
Formal Methods 1. Software Engineering and Formal Methods  Every software engineering methodology is based on a recommended development process  proceeding.
Cheng/Dillon-Software Engineering: Formal Methods Model Checking.
Knowledge representation
Mathematical Modeling and Formal Specification Languages CIS 376 Bruce R. Maxim UM-Dearborn.
Benjamin Gamble. What is Time?  Can mean many different things to a computer Dynamic Equation Variable System State 2.
Introduction to Formal Methods Based on Jeannette M. Wing. A Specifier's Introduction to Formal Methods. IEEE Computer, 23(9):8-24, September,
Introduction Algorithms and Conventions The design and analysis of algorithms is the core subject matter of Computer Science. Given a problem, we want.
Institute e-Austria in Timisoara 1 Author: prep. eng. Calin Jebelean Verification of Communication Protocols using SDL ( )
CS6133 Software Specification and Verification
On Reducing the Global State Graph for Verification of Distributed Computations Vijay K. Garg, Arindam Chakraborty Parallel and Distributed Systems Laboratory.
Paper by: A. Pnueli O. Shtrichman M. Siegel Course: Served to: Professor Orna Grumberg Served By: Yehonatan Rubin.
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
Semantics In Text: Chapter 3.
1 CSEP590 – Model Checking and Automated Verification Lecture outline for August 6, 2003.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
ECSE Software Engineering 1I HO 4 © HY 2012 Lecture 4 Formal Methods A Library System Specification (Continued) From Specification to Design.
Formal Methods.
Lecture 5 1 CSP tools for verification of Sec Prot Overview of the lecture The Casper interface Refinement checking and FDR Model checking Theorem proving.
Verification & Validation By: Amir Masoud Gharehbaghi
Predicate Abstraction. Abstract state space exploration Method: (1) start in the abstract initial state (2) use to compute reachable states (invariants)
Static Techniques for V&V. Hierarchy of V&V techniques Static Analysis V&V Dynamic Techniques Model Checking Simulation Symbolic Execution Testing Informal.
Formal Verification. Background Information Formal verification methods based on theorem proving techniques and model­checking –To prove the absence of.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
From Natural Language to LTL: Difficulties Capturing Natural Language Specification in Formal Languages for Automatic Analysis Elsa L Gunter NJIT.
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
Agenda  Quick Review  Finish Introduction  Java Threads.
Credible Compilation With Pointers Martin Rinard and Darko Marinov Laboratory for Computer Science Massachusetts Institute of Technology.
Software Design Methodology
Logical architecture refinement
Aspect Validation: Connecting Aspects and Formal Methods
Model Checking for an Executable Subset of UML
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
Presentation transcript:

A Framework for Translating Models and Specifications Shmuel Katz Computer Science Department The Technion

Some Questions What is done today? Why translate? Is there a better way? Are required properties affected? Can we/do we need to prove something about the translation? Can we integrate different formal methods into one proof?

Some Existing Translations Murphi to PVS SMV to Spin Verilog to Cospan Java abstractions to SMV, Spin SMV to VHDL Statecharts to SMV, VIS, and Spin State machine to Petri net

Some More Translations Stochastic process algebras to Eden Class+object+Statechart to graph diagram with graph transformations RSDS to B, SMV, and Java Statecharts to B and B to Statecharts Object-Z + ASM to SMV SDL to bREAL SPW to HOL (hand coded?)

Reasons for Translating Different tools handle different properties –SMV: branching t.l. (possible interrupt) –STeP: infinite domain, real-time extension –Spin: linear, finite state properties Sometimes tools fail –Model checking has state explosion –Theorem proving needs clever invariants –Petri net analysis can explode –Process algebra bisimulations are too strong

Reasons for Translating (cont.) A notation without tools as a source –Statecharts have simulation, easy to look at –Verilog designs need to be analyzed –Translations provide verification –Need `Back implication’ A notation without tools as a target –Part of usual production stream or for visualization –Translate verified design into VHDL –`Import’ verified designs for synthesis

Decomposed Proofs Abstraction: Reduce an infinite state system to a (small) finite one –Justify the reduction in theorem prover –Check the small version in model checker Proof by cases (the PVS paradigm) –Some theorem proving –More decision procedures for fragments –Most model checking for finite cases

Invariant generation How to find relevant invariants for PVS, HOL, or STeP induction proofs? Pick up invariants from Petri net versions Check candidates for feasibility on a Murphi explicit state version Generate simple invariants using SMV model checking

Also: Convenient Computations Two stage verification: –Verify properties for convenient computations –Prove every computation can be reduced to a convenient one Scenario-based specification and verification Common: swap order of independent actions –Model check for convenient – Justify back implication of reduction with theorem proving

Difficulties Different atomic actions Different synchronization models Different modularity constructs Different fairness /liveness assumptions Different control statements

Implications Translations cannot be exact Need metrics and proofs about translations Different uses influence requirements of a translation Need to be more systematic: –Framework for implementing translations –Framework for understanding translations

The VeriTech Project (joint work with Orna Grumberg) Integrates existing tools Permits translating from one tool to the other, going through a core notation adds functionality only once develops heuristics for choosing suitable tool for a task

Veritech Murphi Spin Petri PVS LotosSMV Statecharts CORE STeP

Veritech N N2N2

Stages in the Project Import and install existing tools Design a core representation Implement translations to/from core (10 done with more to come) Develop benchmark case studies Add internal modules for extra analysis Gather additional information for tracing changes

The Core: Design Criteria Maximal expressiveness as a target Maximal simplicity as a source Ease of analysis for adding reductions Not needed for programming by humans Note: the core has more than just intermediate code (kitchen sink approach….)

Core Description Language (CDL) Structured textual transition system Transition: –name –enabling condition –relation between current and next variables Parameterized Module: collection of transitions Parallel composition: –asynchronous –synchronous –partially synchronous

A Sample Program: 3 modules with partial synchrony MODULE SENDER (a: INT){ VAR readys: BOOL INIT false TRANS produce: enable: !readys assign: readys’=true a’=5 TRANS send: enable: readys assign: readys’=false} MODULE BUFFER (c,d: INT){ VAR cok: BOOL INIT true, dok: BOOL INIT false TRANS get: enable: cok assign: cok’=false TRANS move: enable: !cok /\ !dok assign: d’=c; cok’=true; dok’=true TRANS put: enable: dok assign: dok’=false} MODULE RECEIVER (b: INT){ VAR readyr: BOOL INIT true vr: INT TRANS consume: enable: !readyr assign: readyr’=true vr’=b TRANS receive: enable: !readyr assign: readyr’=false} MODULE COMB(){ VAR s,t: INT SENDER(s) |(send,get)| BUFFER(s,t) |(put,receive)| RECEIVER(t)}

Sample Difficulties Grain of Atomicity –An atomic action in one notation is translated to a sequence of actions in another –Requires visible/hidden, affects invariants Synchrony and Asynchrony - Require simulations -Differ in assumptions on maintaining previous values

Present Work Creating a translation environment to make new translations easier (XML –based) Analyzing how real translations are related: what is maintained and what is disturbed? Conducting case studies to better understand which problems are best solved using which tools. Develop an expert system for selecting the best tool for a problem

Additional Information Source to target connections usually lost after translation Needed for –Tracing an error in the target back to the source –Improving sequences of translations (esp. translating back after slight changes) Related to incremental compilation and error messages of usual compilation Needed when many source codes yield one target, or one source is split to many places in target

Example: CDL  STeP initialization CDL has nondet. init. of x from any set A STeP has nondet. init. only from 0..n Solution: array with A values, nondet. init. of index i, new transition N to set x to A[i], disable all other transitions until after N Additional information: all parts added to treat the initialization… an XML version using links is under development

Translations and Properties Differences in models imply not all properties can be maintained Classic approach: identify classes of properties that ARE maintained More general: transform the properties along with the model Two possibilities: –Importing: Property of the source has a transformed version true of the target –Back-implying: Property of the target has a version true of the source

Faithful Translations A theory for translations and properties Transform classes of temporal logic properties uniformly (syntactically) –tr(f1, f2) –Tr(m1, m2) Can have import/ back-implication/ both

Faithful Translations (cont.) Then TR and tr are –import faithful –back-implication faithful –strongly faithful w.r.t. M1, M2, L1, and L2, if whenever TR(m1,m2) and tr(f1,f2) then – m1 satisfies f1  m2 satisfies f2 –m2 satisfies f2  m1 satisfies f1 – m1 satisfies f1  m2 satisfies f2

Example: Grain of Atomicity In TR(m1,m2) – only m2 has visible –visible states of m2 are all of m1’s – transition of m1 goes to sequence with intermediate  visible In tr L1 is CTL, L2 is result of : –Xp…...X(  visible U (tr(p)  visible)) –pUq…..(visible  tr(p)) U (visible  tr(q)) –Fp ………F(visible  tr(p)) –Gp ………..G (visible  tr(p))

Semantic description of source Original tree of m1

Semantic changes define TR One transition becomes many (pure refinement) v v v

Claim: TR and tr are strongly faithful Xp in source  X(  visible U (tr(p)  visible)) in target Gp in source  G (visible  tr(p)) in target

Effective Transformations The property transformation is strongly faithful BUT… Transforms CTL to CTL* For a target with LTL, translating LTL is OK When target is CTL, better to maintain nesting, replace AGp by AG(visible  p) and AFp by AF(visible  p) when p is atomic

Additional semantic changes Complex initialization  special code Nondeterminism  choose and test, plus fail Final states  repeating plus term flag Built-in fairness  asserting `fair implies…’ Note: all are from real compilers (CDL-Murphi, Spin-CDL, CDL-SMV,…..)

Are such proofs enough? Problem: what if the compiler doesn’t actually do the semantic changes assumed? Possible solution: use translation validation idea due to Amir Pnueli –Validate that each model and its translated version satisfy the needed semantic relation –Generate verification conditions for a source and target, automatically verify.

Observations The additional information can determine the appropriate property transformations –Data mappings –Visible/hidden transitions The property transformations can determine what is essential in the translation—permitting optimizations Small effective transformation classes indicate bad model translations

For a Translation A  B Compiler from A to B (including optimizations from additional information about the source) Generic property transformations Schema of additional information on A  B Description of intended semantic changes Abstract proofs: If the compiler makes the intended semantic changes, the transformations are …faithful for effective source sublanguage …

For Each Specific Translation (Activation) Source code Target code (result of applying the compiler) Specific added information gathered Specific properties proven about source/target Automatically generated annotations for specific properties BDD-based proofs that for this activation the intended semantic changes occurred (and thus the abstract proof applies this time)

The kitchen sink approach All of the above, plus: Variants for finite or infinite state Partial order reductions Symmetry and cone-of-influence reductions Combinations of different aspects of a system described in different notations (glue) A database for every system under development

Conclusions A Framework for translations is good software engineering and allows analysis We need a theory of model translations It gives us valuable insight into the quality of translations and can improve compilers Translations can and should be part of the formal verification process—otherwise there are holes in our reasoning