CSC 509 Lecture Notes Week 9 The Dream of Formal Verification or is - - PowerPoint PPT Presentation

csc 509 lecture notes week 9 the dream of formal
SMART_READER_LITE
LIVE PREVIEW

CSC 509 Lecture Notes Week 9 The Dream of Formal Verification or is - - PowerPoint PPT Presentation

CSC509-S14-L9 Slide 1 CSC 509 Lecture Notes Week 9 The Dream of Formal Verification or is it Delusion? CSC509-S14-L9 Slide 2 I. Administrative Matters A. Recap of Remaining work: 1. Assignment 6 -- last set of readings. 2. Assignment 7 --


slide-1
SLIDE 1

CSC509-S14-L9 Slide 1

CSC 509 Lecture Notes Week 9 The Dream of Formal Verification

  • r is it Delusion?
slide-2
SLIDE 2

CSC509-S14-L9 Slide 2

  • I. Administrative Matters
  • A. Recap of Remaining work:
  • 1. Assignment 6 -- last set of readings.
  • 2. Assignment 7 -- in-class presentations.
  • 3. Assignment 8 -- final project/paper.
slide-3
SLIDE 3

CSC509-S14-L9 Slide 3

Administrative Matters, cont’d

  • B. Presentation scheduling:
  • 1. See wiki.
  • 2. Note no diff between one and two-person teams.
slide-4
SLIDE 4

CSC509-S14-L9 Slide 4

Administrative Matters, cont’d

  • C. Final Project Deliverables:
  • 1. See wiki.
  • 2. Tune up brief summary if necessary.
slide-5
SLIDE 5

CSC509-S14-L9 Slide 5

  • - Now onto the Dream --
slide-6
SLIDE 6

CSC509-S14-L9 Slide 6

  • II. Mathematical Foundations of Computing
  • A. Computer hardware and software are both based
  • n mathematical logic.
  • B. Founders of computer science were logicians.
  • C. So were inventors of programming language con-

cepts still in use today.

slide-7
SLIDE 7

CSC509-S14-L9 Slide 7

  • III. How does program verification fit into

the scheme of things?

  • A. Began with modern programming languages.
  • B. John McCarthy’s 1962 paper

"Towards a mathematical theory of computation"

  • C. Robert Floyd’s 1967

"Assigning Meaning to Programs"

slide-8
SLIDE 8

CSC509-S14-L9 Slide 8

How verification fits in, cont’d

  • D. Hoare’s 1969

"An Axiomatic Basis for Computer Programming"

  • E. Hoare and Wirth’s 1973

"An Axiomatic Definition of the Programming Language PASCAL"

slide-9
SLIDE 9

CSC509-S14-L9 Slide 9

  • IV. How Does Verification Relate to Testing?
  • A. Testing: show that a program is correct forn

some finite set of inputs.

  • B. Verification: prove that a program is correct for

all possible inputs.

slide-10
SLIDE 10

CSC509-S14-L9 Slide 10

Now onto the "Reliable Without Proof" and "Verified Software Initiative" papers First the 1996 "Without Proof"

slide-11
SLIDE 11

CSC509-S14-L9 Slide 11

  • V. Noteworthy citations from the "Reliable" paper:
  • A. Hmm, he didn’t giv

e any.

  • B. Can he get away with that?
slide-12
SLIDE 12

CSC509-S14-L9 Slide 12

  • VI. Who is Hoare guy, anyway?
  • A. "Sir Tony" to his friends.
  • B. Among other things:
  • 1. Inventor of Quicksort.
  • 2. Co-Inventor of program verification.
  • 3. Inventor of CSP (mentioned in Week 4 notes).
  • 4. 1980 ACM Turing award winner.
slide-13
SLIDE 13

CSC509-S14-L9 Slide 13

  • VII. Some Starter Questions
  • A. Does Hoare like testing OK, or does he still pine

for formal verification?

  • B. Back in 1996, how prescient was Hoare about the

TDD thing?

slide-14
SLIDE 14

CSC509-S14-L9 Slide 14

Some Starter Questions, cont’d

  • C. Overall, how do Hoare’s analyses say square with

Agile-style testing?

  • D. Does Hoare say that we can do without formal

methods altogether, or just the proof stuff?

  • E. We’ll consider these and other questions further ...
slide-15
SLIDE 15

CSC509-S14-L9 Slide 15

  • VIII. Section 1 -- Introduction
  • A. "... in spite of appearances, modern software

engineering practice owes a great deal to the the-

  • retical concepts"
slide-16
SLIDE 16

CSC509-S14-L9 Slide 16

Section 1 -- Introduction, cont’d

  • B. The plain fact -- "the current state of industrial

practice lags behind the research we did in the

  • past. Twenty years perhaps?"
  • C. Twenty years at least!
slide-17
SLIDE 17

CSC509-S14-L9 Slide 17

  • IX. Section 2 -- Management
  • A. "Above all, the strictest management is needed to

prevent premature commitment to start program- ming as soon as possible."

  • B. "This can only lead to a volume of code of

unknown and untestable utility,"

  • C. Do these statement contradict agile testing??
slide-18
SLIDE 18

CSC509-S14-L9 Slide 18

Management, cont’d

  • D. "... inspections, walk throughs, reviews and gates

are required to define important transitions between all subsequent phases in the project ..."

  • E. This is precisely SCRUM, though Hoare may

have envisioned it happening monthly rather than daily.

slide-19
SLIDE 19

CSC509-S14-L9 Slide 19

Management, cont’d

  • F. And there’s this -- "... there is now increasing

experience of the benefits of introducing abstract mathematical concepts and reasoning methods into the process, right from the beginning."

  • G. See, e.g., 2009 IEEE Computer article:

"Formal Versus Agile: Survival of the Fittest?"

slide-20
SLIDE 20

CSC509-S14-L9 Slide 20

Management, cont’d

  • H. The gist of the paper:

"Success in the use of mathematics for specifica- tion, design and code reviews does not require strict formalization of all the proofs."

slide-21
SLIDE 21

CSC509-S14-L9 Slide 21

Management, cont’d

  • I. Some appropriate humility:

"It [formal reasoning] is not immune from fail- ure; for example simple misprints can be surpris- ingly hard to detect by eye. Fortunately, these are exactly the kind of error that can be removed by early tests."

slide-22
SLIDE 22

CSC509-S14-L9 Slide 22

Management, cont’d

  • J. Still a bit of a dream

"Informal reasoning among those who are fluent in the idioms of mathematics is extremely effi- cient, and remarkably reliable."

slide-23
SLIDE 23

CSC509-S14-L9 Slide 23

Management, cont’d

  • K. And finally

"More formal calculation can be reserved for the most crucial issues, ..., where bugs would be most dangerous, expensive, and most difficult to diag- nose by tests."

slide-24
SLIDE 24

CSC509-S14-L9 Slide 24

  • X. Section 3 -- Testing
  • A. "Thorough testing is touchstone of reliability"
  • B. "Tests are applied as early as possible"
  • C. "They are designed rigorously"
  • D. "If a test fails, it is not enough to mend the faulty

product."

slide-25
SLIDE 25

CSC509-S14-L9 Slide 25

  • XI. So, how do does testing work so well?
  • A. Skeptics may still say it doesn’t
  • B. Per E.W. Dijkstra "program testing can reveal
  • nly the presence of bugs, never their absence"
  • C. And QA folks say "you cannot test quality into a

product". How then can testing contribute to reli- ability of programs, theories and products?

  • D. Is the confidence it gives illusory?
slide-26
SLIDE 26

CSC509-S14-L9 Slide 26

  • XII. But it evidently does work.
  • A. "The resolution of the paradox is well known in

the theory of quality control."

  • B. "It is to ensure that a test made on a product is

not a test of the product itself, but rather of the methods that have been used to produce it"

slide-27
SLIDE 27

CSC509-S14-L9 Slide 27

But it does work., cont’d

  • C. "The first lesson is that the test strategy must be

laid out in advance."

  • D. "The real value of tests is not that they detect

bugs in the code, but that they detect inadequacy in the methods, ... and skills of those who design and produce the code"

slide-28
SLIDE 28

CSC509-S14-L9 Slide 28

But it does work., cont’d

  • E. He goes on to point out the specific benefits of

black box and regression testing (remember this is 1996).

slide-29
SLIDE 29

CSC509-S14-L9 Slide 29

  • XIII. Section 4 -- Debugging
  • A. He presents a cute Mosquito analogy.
  • B. Vicious biting mosquitos are killed quickly.
  • C. Gentle non-biting ones lurk on.
  • D. Cf. the known "gentle" bugs in, e.g., gcc
slide-30
SLIDE 30

CSC509-S14-L9 Slide 30

  • XIV. Coverage
  • A. Hoare preaches the virtue of coverage.
  • B. Did he read an early version of the 1997 Zhu

paper?

slide-31
SLIDE 31

CSC509-S14-L9 Slide 31

Coverage, cont’d

  • C. A bit early to have read a draft of the 2009 MS

research paper, but he boldly states their conclu- sions anyway: "Equally unfortunately, total coverage is found to be necessary: more errors continue to be discov- ered right up to the last line tested."

slide-32
SLIDE 32

CSC509-S14-L9 Slide 32

Coverage, cont’d

  • D. He also gets in his bit about OPs --

"... most general-purpose programs are only used in highly stereotyped ways ..."

slide-33
SLIDE 33

CSC509-S14-L9 Slide 33

Coverage, cont’d

  • E. And some more from 2009 --

"Suppose a hundred new errors of this kind are detected each year. Crude extrapolation suggests that there must be about half a million such errors in the code. [Undetected errors] play the same role as the swarms of the gentle kind of mosquito that hardly ever bites."

slide-34
SLIDE 34

CSC509-S14-L9 Slide 34

Coverage, cont’d

  • F. Ah, but

"The less fortunate corollary is that if all the errors that are detected are immediately cor- rected, it would take a thousand years to reduce the error rate by twenty percent."

slide-35
SLIDE 35

CSC509-S14-L9 Slide 35

Coverage, cont’d

  • G. And how little we seemed to have progressed in

the last 20ish years: "Unfortunately, before that stage is reached, it

  • ften happens that a new version of the system is

delivered, and the error rate shoots up again."

slide-36
SLIDE 36

CSC509-S14-L9 Slide 36

  • XV. Section 5 -- Over-engineering
  • A. He mentions defensive programming
  • B. Also software audits, which are nowadays called

"code reviews".

  • C. In general, he considers over-engineering to be a

sub-optimal tactic for reliability.

slide-37
SLIDE 37

CSC509-S14-L9 Slide 37

  • XVI. Section 6 -- Programming Methodology
  • A. Things are bit dated here.
  • B. He talks about structured programming
  • C. Also the benefits of strong typing (Python folks,

are you listening?)

slide-38
SLIDE 38

CSC509-S14-L9 Slide 38

’Programming, cont’d

  • D. And don’t forget information hiding
  • E. He (tries) to argue that more languages have

ev

  • lved from formally specified progenitor (e.g.,

Algol 60) as opposed to less formal ones (e.g., COBOL). Alas, he’s left C out of the mix."

slide-39
SLIDE 39

CSC509-S14-L9 Slide 39

  • XVII. Section 7 -- Conclusions
  • A. He notes again the 20 year gap (at least) between

theory and industrial practice.

  • B. He laments the fragmentation of researchers into

competing tribes.

  • C. He describes, in so many concluding words what

will be his 2009 manifesto

slide-40
SLIDE 40

CSC509-S14-L9 Slide 40

Now onto "Verified Software Initiative"

slide-41
SLIDE 41

CSC509-S14-L9 Slide 41

  • XVIII. The 1996 paper conclusions are the direct

lead-in to the 2009 manifesto.

  • A. What’s needed to make verification happen?
slide-42
SLIDE 42

CSC509-S14-L9 Slide 42

What’s needed, cont’d

  • 1. Researcher collaboration.
  • 2. Tools.
  • 3. Industrial partners.
  • 4. More edgimicashun.