We are going to learn more about design by contract, deductive verification, and program logics that allow us to reason about programs.
K. Rustan M. Leino, Senior Principal Applied Scientist at Amazon Web Services
First week of December
(2nd of December, 16h00)
K. Rustan M. Leino is a Senior Principal Applied Scientist in the Automated Reasoning Group at Amazon Web Services.
Leino is a world leader in building automated program verification tools. These include the languages and tools Dafny, Chalice, Jennisys, Spec#, Boogie, Houdini, ESC/Java, and ESC/Modula-3.
Wolfgang Ahrendt, Professor of Computer Science at Chalmers University of Technology
Third week of December
(15th of December, 11h00)
Wolfgang Ahrendt is a Professor of Computer Science at Chalmers University of Technology, Sweden. He is one of the Staff Group Leaders in the KeY project.
He is an expert in automated theorem proving, as well as software verification and specification. He is currently developing methods to verify blockchain smart contracts.
Bart Jacobs, Associate Professor at the Department of Computer Science of KU Leuven
Third week of December
(17th of December, 09h30)
Bart Jacobs is an associate professor at the Department of Computer Science of KU Leuven - University of Leuven, Belgium. He is a member of the Security: Programming Languages task force of the imec-DistriNet research group.
After contributing to Spec# as an intern with Wolfram Schulte and Rustan Leino at Microsoft Research Redmond, he has been developing VeriFast since 2008.
Goal: reduce the number of bugs in a given program
“We could, for instance, begin with cleaning up our language by no longer calling a bug a bug but by calling it an error. It is much more honest because it squarely puts the blame where it belongs, viz. with the programmer who made the error.” (EWD 1036)
Edsger W. Dijkstra (1930 - 2002)
Recorded in the logbook alongside the offending moth, taped to the logbook page.
Answer: Software testing.
“Program testing may convincingly demonstrate the presence of bugs, but can never demonstrate their absence.” (EWD 1036)
Edsger W. Dijkstra (1930 - 2002)
“It may be true, that whenever C actually reaches a certain point in the flow diagram, one or more bound variables will necessarily possess certain specified values, or possess certain properties, or satisfy certain relations with each other. Furthermore, we may, at such a point, indicate the validity of these limitations. For this reason we will denote each area in which the validity of such limitations is being asserted, by a special box, which we call an assertion box.” (1947)
Herman Goldstine (1913 - 2004)
John von Neumann (1903 - 1957)
“How can one check a routine in the sense of making sure that it is right?
In order that the man who checks may not have too difficult a task the programmer should make a number of definite assertions which can be checked individually, and from which the correctness of the whole programme easily follows. ” (24 June 1949)
Alan Turing (1912 - 1954)
“ The basis of our approach is the notion of an interpretation of a program: that is, an association of a proposition with each connection in the flow of control through a program, where the proposition is asserted to hold whenever that connection is taken. ” (1967)
Robert Floyd (1936 - 2001)
“The intended function of a program, or part of a program, can be specified by making general assertions about the values which the relevant variables will take after execution of the program. These assertions will usually not ascribe particular values to each variable, but will rather specify certain general properties of the values and the relationships holding between them.” (October 1969)
Sir Tony Hoare (1934 - )
Customers and engineers define the software that is to be produced and the constraints on its operation.
Example: suppose the goal is to build a swing
Process of understanding and defining what services are required from the system and identifying the constraints on the system's operation and development.
Goal: produce agreed requirements document that specifies a system satisfying stakeholder requirements
Usually, performed at two levels: end-users and clients and developers
(Sommerville, Ian. Software engineering. Addison-Wesley/Pearson, 2011.)
Because we want to build dependable systems.
(Sommerville, Ian. Software engineering. Addison-Wesley/Pearson, 2011.)
... are not necessarily safe systems.
ALARP: As low as reasonably practical
(Sommerville, Ian. Software engineering. Addison-Wesley/Pearson, 2011.)
Widely-used approach to hazard analysis: fault trees.
Source: medtruth.
(Sommerville, Ian. Software engineering. Addison-Wesley/Pearson, 2011.)
(Sommerville, Ian. Software engineering. Addison-Wesley/Pearson, 2011.)
(Sommerville, Ian. Software engineering. Addison-Wesley/Pearson, 2011.)
-- The insulin dose to be delivered is a function of blood sugar level,
-- the previous dose delivered and the time of delivery of the previous dose
currentDose = computeInsulin();
// Safety check—adjust currentDose if necessary.
// if statement 1
if (previousDose == 0) {
if (currentDose > maxDose/2) { currentDose = maxDose/2; }
} else if (currentDose > (previousDose*2)) { currentDose = previousDose*2; }
// if statement 2
if ( currentDose < minimumDose ) { currentDose = 0; }
else if ( currentDose > maxDose ) { currentDose = maxDose; }
administerInsulin(currentDose);
(Sommerville, Ian. Software engineering. Addison-Wesley/Pearson, 2011.)
Moreover, in general, too many cases to analyse.
You have used Alloy to build mathematical models.
Let's look at the Insulin Pump again...
Here's an example of contracts in Eiffel:
deposit (sum: INTEGER) is
-- Deposit sum into the account.
require
sum >= 0
do
add (sum)
ensure
balance = old balance + sum
end
Here's an example of contracts in Java (OpenJML):
public class Subtract {
//@ requires a > 0;
//@ requires b > 0;
//@ ensures \result == a-b;
public static int subtract(int a, int b){
return a-b;
}
public static void main(String args[]){
System.out.println(subtract(2,3));
}
}