INSE web pages u Please explore them! – –http://lesterk.myweb.port.ac.uk/inse/http://lesterk.myweb.port.ac.uk/inse/ u EVERYONE: please follow the “ minilecture.

Slides:



Advertisements
Similar presentations
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Advertisements

C Language.
Control Structures Ranga Rodrigo. Control Structures in Brief C++ or JavaEiffel if-elseif-elseif-else-end caseinspect for, while, do-whilefrom-until-loop-end.
MATH 224 – Discrete Mathematics
Addressing the Challenges of Current Software. Questions to Address Why? What? Where? How?
CSE 3101: Introduction to the Design and Analysis of Algorithms
Program Proving Notes Ellen L. Walker.
1 Semantic Description of Programming languages. 2 Static versus Dynamic Semantics n Static Semantics represents legal forms of programs that cannot be.
Announcements We are done with homeworks Second coding exam this week, in recitation –Times will be posted later today –If in doubt, show up for your regular.
Compiler Construction
Hypertext Markup Language. Platform: - Independent  This means it can be interpreted on any computer regardless of the hardware or operating system.
PVK-HT051 Contents Introduction Requirements Engineering Project Management Software Design Detailed Design and Coding Quality Assurance Software Maintenance.
Lower bound for sorting, radix sort COMP171 Fall 2006.
Contents Introduction Requirements Engineering Project Management Software Design Detailed Design and Coding Quality Assurance.
Guide To UNIX Using Linux Third Edition
Describing Syntax and Semantics
CS 106 Introduction to Computer Science I 10 / 15 / 2007 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 10 / 16 / 2006 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 03 / 17 / 2008 Instructor: Michael Eckmann.
Proving Program Correctness The Axiomatic Approach.
Mathematics throughout the CS Curriculum Support by NSF #
Programming Paradigms Imperative programming Functional programming Logic programming Event-driven programming Object-oriented programming A programming.
How to Register for ESRI’s GIS Online Course Yong Choi School of Business CSU, Bakersfield.
CS2110 Recitation Week 8. Hashing Hashing: An implementation of a set. It provides O(1) expected time for set operations Set operations Make the set empty.
Welcome to CS 3260 Dennis A. Fairclough. Overview Course Canvas Web Site Course Materials Lab Assignments Homework Grading Exams Withdrawing from Class.
9/15/ Lecture 11 STATS 330: Lecture 1. 9/15/ Lecture 12 Today’s agenda: Introductory Comments: –Housekeeping –Computer details –Plan of.
Lecture 16 March 22, 2011 Formal Methods CS 315 Spring Adapted from slides provided by Jason Hallstrom and Murali Sitaraman (Clemson)
Chapter Nine: Subprograms Lesson 09. What are they  Modularized code  Might return a value  Functions  Or not  Procedures  Subroutines  In object.
Reading and Writing Mathematical Proofs
1 Abstraction  Identify important aspects and ignore the details  Permeates software development programming languages are abstractions built on hardware.
1 Agenda Administration Background Our first C program Working environment Exercise Memory and Variables.
1 G4MICE Design Iteration Malcolm Ellis MICE Video Conference 21 st April 2004.
CS Fall 2007 Dr. Barbara Boucher Owens. CS 2 Text –Main, Michael. Data Structures & Other Objects in Java Third Edition Objectives –Master building.
CSE 311 Foundations of Computing I Lecture 8 Proofs and Set Theory Spring
Searching. Linear (Sequential) Search Search an array or list by checking items one at a time. Linear search is usually very simple to implement, and.
SWE 619 © Paul Ammann Procedural Abstraction and Design by Contract Paul Ammann Information & Software Engineering SWE 619 Software Construction cs.gmu.edu/~pammann/
CS261 – Recitation 5 Fall Outline Assignment 3: Memory and Timing Tests Binary Search Algorithm Binary Search Tree Add/Remove examples 1.
Targil 6 Notes This week: –Linear time Sort – continue: Radix Sort Some Cormen Questions –Sparse Matrix representation & usage. Bucket sort Counting sort.
Introduction to Data Structures and Algorithms CS 110: Data Structures and Algorithms First Semester,
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
Reasoning about programs March CSE 403, Winter 2011, Brun.
© Paul Ammann, 2008 Design by Contract Paul Ammann CS/SWE 332.
Pre- and postconditions, Using assertions and exceptions 1 Pre- and postconditions Using assertions and exceptions.
INSE - Lecture 8 Design Tactics (2) - Modular structure u Notations for design documents u Verification of design.
ANU COMP2110 Software Design in 2003 Lecture 10Slide 1 COMP2110 Software Design in 2004 Lecture 12 Documenting Detailed Design How to write down detailed.
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
Beginning Fortran Introduction 13 October 2009 *Black text on white background provided for easy printing.
Dr. Naveed Riaz Design and Analysis of Algorithms 1 1 Formal Methods in Software Engineering Lecture # 26.
1 Introduction 1. Why Data Structures? 2. What AreData Structure? 3. Phases of Software Development 4. Precondition and Postcondition 5. Examples.
Loop Invariants and Binary Search Chapter 4.4, 5.1.
©John Samuel 2008 Introduction to PHP Note: These slides are not included in coverage for the BIF703 final exam...
Searching CSE 103 Lecture 20 Wednesday, October 16, 2002 prepared by Doug Hogan.
Collections and Iteration Week 13.  Collections  ArrayList objects  Using loops with collections Collections and Iteration CONCEPTS COVERED THIS WEEK.
Copyright © 2014 Curt Hill Algorithms From the Mathematical Perspective.
Lecture 2 What is a computational problem? What is an instance of a problem? What is an algorithm? How to guarantee that an algorithm is correct? What.
1 Computer Algorithms Tutorial 2 Mathematical Induction Some of these slides are courtesy of D. Plaisted et al, UNC and M. Nicolescu, UNR.
CPSC 252 ADTs and C++ Classes Page 1 Abstract data types (ADTs) An abstract data type is a user-defined data type that has: private data hidden inside.
CORRECTNESS ISSUES AND LOOP INVARIANTS Lecture 8 CS2110 – Fall 2014.
© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.
WEB 434 Week 2 Summary Check this A+ tutorial guideline at Week-2-Summary For more classes visit
WEB 434 Week 4 Summary Check this A+ tutorial guideline at Week-4-Summary For more classes visit
SWEN421 – Lecture 3 Building High Integrity Software with SPARK Ada
SWEN421 – Lecture 4 Contracts and Correctness
Data Structures and Algorithms
GC211Data Structure Lecture2 Sara Alhajjam.
Introducing the World Wide Web
Introduction to Components and Specifications Using RESOLVE
Assignment 7. Functional implementation of linked listed
Design a TM that decides the language
Formal Methods Lecture 16 March 22, 2011 CS 315 Spring 2011
Presentation transcript:

INSE web pages u Please explore them! – – u EVERYONE: please follow the “ minilecture schedule ” link & note your date! u Follow the “ schedule ” link if you want to print the lecture slides u Follow the “ brainstorms ” link for a summaries of last week ’ s tutorial –summaries of the next 2 tutorials will be added a few days later

INSE1 - Lecture 5 Program proof? -- we ’ ll look at one example system for achieving this

ANNA - annotated Ada  Designed to be “ programmer friendly ”  therefore looks like programming language  is in the Ada programming language + special “ annotating ” comments.

ANNA...  is used to “ annotate ” specifications;  is also used to annotate code, to enable checks that the code meets the specification - i.e.  program proof  This could be done for other languages - but hasn ’ t, barely (why not?)

Ada background  Ada procedures are usually written in two parts - a “ specification ” for the interface, and a “ body ” for the implementation.  E.g. given type Data is array(Index)of Element; a specification could be procedure Sort(X:in out Data);

An Annotation  an Ada comments starts with -- and continues to the end of the line;  an Anna formal comment starts with one of --| which introduces an annotation; --: which introduces virtual Ada text that obeys the same rules as Ada, but is called only from the annotations.

Annotating a specification  gives an “ outside view ” of the effect of calling the procedure: e.g. for SORT: procedure SORT(X:in out DATA); --| in all X(I)=X(J) => I=J --| out all X(I)=X(J) => I=J --| and all I X(I)<X(J) --| and all I in INDEX --| => X(I) = in X(J)

BUT  the “ no duplicates ” requirement is clearly a nuisance –  so how can we get rid of it?

Defining virtual text  for the version of SORT on the next slide: --: function Count(E:Element) --: return Integer is --: So_Far : Integer := 0; --: begin --: for I in Index loop --: if X(I)=E --: then So_Far := So_Far+1; --: end if; --: end loop; --: return So_Far; --: end Count;

Using virtual text  in annotation of a spec - e.g. for SORT: procedure SORT(X:in out DATA); --| out all I X(I)<X(J) --| and all I in INDEX --| => Count(X(I)) = Count(in X(J))  The postcondition says –the array is in order, with adjacent equal elements allowed; and –each value appears as many times after a call as before.

Program proof?  Suppose we put annotations between steps in the “ body ” of a procedure; and  use the precondition before the first step, postcondition after; then  each individual step in the instructions can then be “ proven ” relative to the annotations immediately before & after -  which proves the correctness of the code relative to the pre-& post-conditions.

Postscript to “ formal specification ”  other methods – notably VDM & Z – are oriented to building the program proving every design & coding step as you go; whereas  ANNA is oriented to proving already-written programs. u [For more on formal methods - take the f.m. units!]

After this lecture  Work through the example in the notes for an intuition of the idea -  but do not bother with the details.  Consider: if you were assigned to manage an S.E. project, in what cases would you want f.m. to be used?