Docsity

Software Development Process: Cleanroom Verification - Lecture Slides | CS 6300, Study notes of Computer Science

Toggle sidebar
bg1
Cleanroom Verification
• In Cleanroom, constructed programs can be
checked by a parser for syntax errors, but may
not be executed by the developer
– No debugging ⇒ cheap and predictable process
• Verification is performed by a team review
driven by a set of verification conditions
– Questions to ask about the program code
– Specific questions are asked about each occurrence
of different kinds of program statements
• Productivity
– 3x–5x improvement in verification over debugging
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c

Partial preview of the text

Download Software Development Process: Cleanroom Verification - Lecture Slides | CS 6300 and more Study notes Computer Science in PDF only on Docsity!

Cleanroom Verification

  • In Cleanroom, constructed programs can be checked by a parser for syntax errors, but may not be executed by the developer - No debugging ⇒ cheap and predictable process
  • Verification is performed by a team review driven by a set of verification conditions - Questions to ask about the program code - Specific questions are asked about each occurrence of different kinds of program statements
  • Productivity
    • 3x–5x improvement in verification over debugging

Formal Inspections

  • Although program proving is always an option, it involves intensive work requiring mathematical sophistication
  • An alternative, used by Cleanroom software engineering, is to structure a team code inspection in terms of program functions and verification conditions and then undertake an semi-formal review confirming that all verification conditions are satisfied
  • Conditions under which the prime program can legally execute (preconditions)
  • Expression of the effect of program execution on the state of the system (postconditions)
  • Expressed in terms of the program's input arguments, return value, instance variables, global variables, and side effects on the environment (disk writes, printing, etc.) but not referring to local program variables

Program Function

Sort Program Function

context IntVector::sort() -- assumes that IntVector is -- represented with an OCL sequence post: this@pre->asBag() = this->asBag() and forAll(i : Integer | 1 <= i and i < this->size() and this->at(i) <= this->at(i + 1))

Typical

SESEs

Composition of SESEs

  • Each SESE can be thought of as being

itself a small program with its own program

function

  • The overall program function is the logical

composition of the program functions of its

constituent SESEs

  • The lowest level SESE is the single

assignment statement

Verification Conditions - 2

  • Imagine a program p with a program function f
  • p is composed of smaller programs (SESEs) q, r, s ... each with their own program functions f q , f r , f s ...
  • In general, we have to devise verification conditions vc q , vc r , vc s ... such that demonstrating that the verification conditions all hold demonstrates that f also holds
  • This will depend on how the statements are composed
  • There are three ways of composing SESEs
    • Sequentially, conditionally and iteratively

Sequence

  • The simplest control structure is a sequence of two other statements or control structures
  • There is one verification condition per sequence:
    • Do the constituent statements together accomplish the sequence’s goal?
    • That is, if you come across the following situation [f] do g; h enddo
    • Then generate the following verification condition Does g followed by h do f?
  • This idea can readily be extended to three or more constituent statements

Conditional

  • An if-then-else has two arms
    • Does each arm acting by itself accomplish the control structure’s post condition, assuming the control structure's precondition and that the tested condition is true (or false)?
    • That is, if you come across the following situation [f] if p then g else h endif
    • Then generate the following verification conditions
    • When p is true does g do f?
    • When p is false does h do f?
  • If-then is treated as if-then-else with a null arm. Case is like a multi-armed if

Conditional

2.Does taking the true branch imply the

post assertion?

  • The predicate of the conditional can be assumed to be true

3. Does taking the false branch imply the

post assertion?

  • The predicate can be assumed to be false

Iteration

4. Does the loop terminate?

5. If the predicate is false, does the post

assertion follow from the pre assertion?

6. If the predicate is true, is the post

assertion of the loop equivalent to the post

assertion of the body followed by the post

assertion of the loop?

  • Recursive!

Implications

  • As teams become more experienced

in Cleanroom, they begin to write their

programs more directly

  • This typically results in very small program segments with few control structures each
  • Example: 3300 lines ⇒ 600 control

structures, 1000 correctness

conditions

  • Consider the following program segment
  • What are its pre and post conditions?

Example

SUM(b[0 .. n] : int ) returns t : int int b[0 : n]; i := 1; t := b[0]; while i <= n do t := t + b[i]; i := i + 1 end ; end ;

  • Signature:

SUM(b[0 .. n] : int )

returns t : int

  • Precondition: n ≥ 0
    • "n is non-negative"
  • Postcondition: t = Σ b[k]
    • "t is the sum of the elements of b"

Program Function

k = 0 n