COSC 4P42 Formal Methods in Software Engineering - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

COSC 4P42 Formal Methods in Software Engineering

Description:

Specification and correctness of software. ... 'Correctness cannot be established through testing. ... used to prove partial correctness. assertion of the form: ... – PowerPoint PPT presentation

Number of Views:75
Avg rating:3.0/5.0
Slides: 15
Provided by: michael742
Category:

less

Transcript and Presenter's Notes

Title: COSC 4P42 Formal Methods in Software Engineering


1
COSC 4P42Formal Methods in Software Engineering
  • Instructor Michael Winter
  • Office J323
  • Office Hours Tue Thu 1000am noon
  • email mwinter_at_brocku.ca
  • Webpage www.cosc.brocku.ca/Offerings/4P42

2
  • Course Description (Brock Calendar)
  • Specification and correctness of software.
    Topics include algebraic specifications,
    semantics of programming languages, Hoare/dynamic
    logic, specification languages, program
    transformation.
  • Prerequisites COSC 3F00(minimum 60 percent) and
    3P03 (minimum 60 percent).
  • course procedures
  • plagiarism

3
Textbooks
  • Main Text
  • None (course material is on the web page).
  • Supplemental Texts
  • The Formal Semantics of Programming Languages An
    Introduction, G. Winskel, The MIT Press (1993),
    ISBN 0-262-23169-7 (hc), 0-262-73103-7 (pb)
  • The Design of Well-Structured and Correct
    Programs, S. Alagic M.A. Arbib, Springer-Verlag
    (1978), ISBN 0-387-90299-6
  • Fundamentals of Algebraic Specifications 1
    Equations and Initial Semantics, H. Ehrig B.
    Mahr, Springer-Verlag (1985), ISBN 0-387-13718-1

4
Course Work
  • Marking Scheme
  • Assignments (3x10) 30
  • Project 30
  • Final Exam (oral, 30min each) 40
  • Important Dates
  • Assignment Due Late Class presentation
  • 1 Jan 26 _at_ 100 pm Jan 28 _at_ 100 pm Jan
    29 _at_ 200 pm
  • 2 Feb 09 _at_ 100 pm Feb 11 _at_ 100 pm Feb
    12 _at_ 200 pm
  • 3 Mar 02 _at_ 100 pm Mar 04 _at_ 100 pm Mar
    05 _at_ 200 pm
  • Project Mar 30 _at_ 100 pm no late date Mar
    31/Apr 02 _at_ 200 pm

5
Course Outline
6
  • Assignments will be available on-line.
    Assignments will be returned via room J333 at the
    times posted.
  • Assignments are due at the times specified above
    and will be accepted late until the indicated
    time, subject to a penalty of 25. After the late
    period, assignments will not be accepted.
  • A mark of at least 40 on the final exam is
    required to achieve a passing grade in this
    course. No electronic devices and especially no
    calculators will be allowed in the examination
    room.
  • Assignments will be carefully examined regarding
    plagiarism. Cases of suspected plagiarism will be
    dealt with according to the University
    regulations and Departmental procedures.
  • Consideration regarding illness for assignment
    submission or test dates will only be considered
    if accompanied with the completed Departmental
    Medical Excuse form.

7
Motivation
  • Assume you are a project coordinator in a
    software company. The latest
  • project your team is working on has the following
    constraints
  • avoid integer multiplication (there are issues
    with the hardware)
  • the operation square(n)n2 will frequently be
    used in the program.
  • You present this problem to a member of your
    team. He comes up with the
  • following piece of code

8
A program
  • r 0
  • s 1
  • i 0
  • while i lt n do
  • r rs
  • s s2
  • i i1
  • od

The program above computes n2 in the variable r.
9
Testing
10
Problems with Testing
  • Testing may unveil errors in the code, but
  • You may only test finitely many examples.
  • Testing cannot verify that the code is bug-free.
  • Correctness cannot be established through
    testing. Testing can only delete errors, but
    never exclude errors.
  • Are you satisfied with the testing procedure?
  • Yes?!?, but what if this program
  • controls a machine producing toys worth 10,000
    an hour?
  • controls a rocket sending a new television
    satellite into orbit?
  • An error in the code might cause a big financial
    loss for our company!!!

11
A proof
  • The programmer says
  • My program obviously computes
  • Here is the proof that this is equal to n2.
  • (Compare this approach to Math 1P66/67.)

12
Further Problems?
  • Are you satisfied with this proof?
  • Yes?!?, but what if this program
  • controls the reentry of a space shuttle?
  • controls the rollercoaster you are sitting in?
  • controls the cooling system of the nuclear plant
    next door?
  • The previous argument still contains the informal
    step
  • My program obviously computes
  • This could be wrong!!!!!

13
Hoare logic
  • Hoare logic is a calculus that can be used to
    prove partial correctness
  • assertion of the form
  • ? c ?
  • where ?, ? are formulas and c is a command (or
    program).
  • The intended meaning of such a statement is as
    follows
  • If the precondition ? is satisfied and the
    program c terminates, then the
  • postcondition ? will be satisfied (after the
    execution of c).
  • Example n0 p rn2
  • where p is our program.

14
Hoare logic proof rules
  • (Skip) ? skip ?
  • (Assignment) ?a/x xa ?
  • (Sequencing) ? c0 ? ? c1 ?
  • ? c0c1 ?
  • (Conditional) ??b c0 ? ???b c1 ?
  • ? if b then c0 else c1 fi ?
  • (Loop) ??b c ?
  • ? while b do c od ???b
  • (Consequence) ??? ? c ? ? ? ?
  • ? c ?
Write a Comment
User Comments (0)
About PowerShow.com