Formal Verification. Background Information Formal verification methods based on theorem proving...

30
Formal Verification

description

Major Verification Topics Specification verification Architecture verification General practical issues

Transcript of Formal Verification. Background Information Formal verification methods based on theorem proving...

Page 1: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Formal Verification

Page 2: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Background Information• Formal verification methods based on theorem proving techniques and

model checking– To prove the absence of errors (in the formal model)– To reason about the behaviors of programs

• No known generic software verification – Involves complicated proving– Generally cannot be easily and cost-effectively integrated to software and hardware

development cycles

Page 3: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Major Verification Topics

• Specification verification• Architecture verification• General practical issues

Page 4: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Architecture Verification

• Correctness of architecture refinement– A methodology for the correct stepwise refinement of software

architectures– Using the approach of architecture refinement patterns that are

correctness preserving and compositional

Page 5: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Common Architecture Issues

• From abstract level to concrete level• Simple architecture: Box - arrows, representing data

component and connections• Large architecture: Hierarchical approach

Page 6: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Common Architecture Problem

• Limited utility of architecture hierarchy results from the current level of informality

• Ambiguity in architecture allows unintended interpretations. May cause erroneous interpretation

Page 7: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Architecture Refinement

• From a abstract architecture to a concrete (lower-level) architecture– Lead to:

• Fewer architectural design errors• Extensive and systematic reuse of design knowledge and proofs

Page 8: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Refinement Pattern Approach• A pair architecture schemas (homogenous or heterogeneous)• Proven to be relatively correct with respect to the given mapping

schema

Page 9: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Refinement Pattern

• Requires a special correctness criterion– A special mapping between architectures– Extensive translation:

• The representation of components, interfaces, and connections• Aggregated, decomposed, or eliminated

Page 10: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Completeness Assumption

• Prove that a concrete architecture has all required properties– No new properties can be inferred from the concrete architecture

• All components, interfaces, and connections intended to be true of the architecture at its level of detail– If a fact is not explicit in the architecture, assume that it is not

intended to be true

Page 11: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Completeness Assumption

• Standard way to proof relative correctness – Show that the concrete specification logically implies the abstract

specification under a given mapping– Allow additional and specified behaviors, as long as the specified

behavior is implemented– No guarantee that negative properties are preserved under

refinement

• Alternative:– Faithful interpretation– Hard and no general proof technique

• Use preproved refinement patterns

Page 12: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Example

• Use only logical theories for simplicity• To show how to systematically and

incrementally transform a abstract architecture to its lower-level form

• Approach: Combining small and local refinement to form the larger composite

Page 13: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Example

chars codeLexical Analyzer

Lexical Parser

Analyzer Optimizer

Code Generator

toks ast ast

bindings

Page 14: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Architecture as Theories

• Architecture styles– Operations and axioms

• Translation to logic– Patterns logic (theory generation rules)

• Mapping– Name mapping– Style mapping– Interpretation mapping

Page 15: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Architecture StylesDataflow style:

Axioms example -- Every function must at least have one port:

Page 16: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Translation to Logic

• An instance of function declaration schema:– f: Functional_Style!Function [ op: t]

• The underlying theory contains the same instance of first order sentences:

Page 17: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Mapping• Name mapping:

– c | m– op | w

• Style mapping:– Accepts (_, _) | Gets (_, _)– Connects (_, _, _) | Writes (_,_) ^ Reads(_,_)

• Interpretation mapping = name + style mapping

Page 18: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Proving

• Criterion– All intended to do– Not intended to do

Page 19: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Composition

• Horizontal– Compose instances of refinement patterns to form one large composite refinement

• Vertical– Most concrete architecture in a hierarchy is correct with respect to the most abstract– Justified since faithful interpretation is transitive

Page 20: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Problem Example

• Concrete architecture 1– A B (dataflow connection)

• Concrete architecture 2– B C (dataflow connection)

• The composition of 1 and 2 is not faithful!– Need new abstract dataflow from A to C

Page 21: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Specification

• Correctness issue• Complete specification of program is in terms of

hierarchical structure of module specifications• Module external specifications are abstract, about module

behavior • Module internal specifications are descriptions of internal

implementations

Page 22: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Concurrent System Verification

• Program is a set of events• Interpreted and verified with a formal proof system• Internal specification classified as composite or simple• Composite: Composed of linked sub-modules, each with

external and internal specification

Page 23: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

External Specification

External specification consist of three parts:• Behavior: Module delivers to the environment • Provide: How modules synchronizes with the environment?• Require: Synchronization cooperation the module expects

from environment

Page 24: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Composite Internal Specification

Internal specification of a composite module associates events described in the external specification of the module with events described in the external specifications of the sub-modules

• Ports: A set of single direction communication channels between the module and its environment• Network link: Sub module ports are connected together to form communication channels

Page 25: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Composite Module VerificationVerification of composite module:1. External behaviors of the sub-modules plus the network and interface links must imply the external behavior of

composite module2. Provides and requires of the sub modules and composite

module must be mutually supportive and complete Mutual support: Sub module provides imply the sub-

module requires Complete: Composite require and provide represent the

sub-module requires and provides accurately and completely

Page 26: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Simple Module Specification Verification

Internal specification of a simple system consists of three parts:• Program: Internal specification as example• Performance: Whether the program is cyclic or terminates and contains an assert statement that describe the history • Interpret: Identify ports with subsequences on the history

Page 27: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Simple Module Specification Verification

Verification of specifications of a simple module:1. Performance and interpret statements must imply the external behavior2. Performance and external provide must be established

using following axioms:– History sequence axiom– Statement block axiom– Process history axiom

Page 28: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Discussion

• Task of analyzing programs is easier if the program is composed of modules• Key importance is to establish specifications• Automated verification system can be based on verification rules

Page 29: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

Related Works

• Automatic program verifications - verification condition generator• EBS, Chen, Yeh, Reed et al• Concurrent programs, Hailpern,Owicki, Lamport and Schneider

Page 30: Formal Verification. Background Information Formal verification methods based on theorem proving techniques and modelchecking –To prove the absence of.

General Discussion

• Abstract logic component decomposition verification and efficiency analysis• Practical tools, such as UML