Program Verification (Lecture)
Course Type | Lecture |
---|---|
Instructors | Prof. Dr. Andreas Podelski, Dr. Jochen Hoenicke, Dominik Klumpp, Tanja Schindler, Frank Schüssele |
Lecture | Tuesday 16:15 - 18:00 Friday 14:15 - 16:00 Online (in a BigBlueButton virtual classrom) |
Exercise | Closely integrated to the lecture |
Language | English |
Exam | tba |
Course Catalog | Program Verification (Lecture) Program Verification (Exercise) |
News
- 2022-04-12: Course Website online
Motivation
Did you ever write a computer program that did not work correctly? Perhaps surprisingly for outsiders the response of every programmer will be "yes" because especially during the development of software, faulty programs are rather the rule than the exception.
How do we deal with the problem that we often have errors in our code? There are two typical approaches:
- We can write tests. We check for a given input if the program produces the expected output
- We can analyze our code very carefully.
Did you ever have a bug in you code even if you analyzed it very carefully and did some tests? Even to this question, the answer "yes" is no surprise, since tests cannot capture all behaviors of the program and an analysis of code is tedious and error-prone. From our everyday experience with electronic devices, we know that not only computer science students but also professional programmers regularly fail to write correct code. The fact that there is a long list of faulty software systems that were expensive or safety-critical hints that the problem is not just the sloppiness of programmers but that there is a need for new approaches that improve the reliability of software.
In this lecture we will learn an approach that is called software verification. First, we will formally state properties like e.g., if the program reaches line 42 then the variable x is positive, or if the input is different from 23 then there will be no overflow. We will then learn how to write mathematical proofs that show that a given program satisfies a given property.
Unfortunately, it can be tedious and difficult to find such a mathematical proof and humans also tend to make mistakes while giving mathematical proofs. Hence, we would like to let computers do this task.
In this lecture we will see algorithms that enable computers to find bugs in computer programs, or to find proofs that show the absence of bugs.
Contents
Although we will use tools this is a rather theoretical lecture in which we will learn the basic concepts of program verification.
We will often reduce problems to the satisfiability problem of logical formulas. (So if you do not like mathematical logic, you probably do not want to take this lecture.) E.g, a satisfying assignment for the following formula will show us how the assert statement in the depicted program can be violated.
x_0 >= 0 /\ y_0 >=0 /\ x_0<=4294967296 /\ y_0<=4294967296 /\ x_0 + y_0 <= 42 /\ y_0 >= 100 /\ x_1 = (2*x_0-y_0)%4294967296 /\ x+y < 100
void foo(unsigned int x, unsigned int y) { while (x+y <=42) { if (y >= 100) { x = 2 * x - y; //@ assert (x+y >= 100); } y++ } } |
In order to get familiar with logical reasoning, the course will start with an introduction to propositional logic and first-order logic. We will then formally introduce the Hoare calculus which will allow us to state the correctness of a program and to give a mathematical proof that the program is correct.
Throughout this lecture, we will use tool like the Z3 SMT solver or the Ultimate Automizer software verifier in order to see the effect of our algorithms on practical examples. E.g., if we want to find out if the following C program is correct, we can ask Ultimate Automizer.
int main() { unsigned char pos = getInitialPosition(); int arr[256]; while(1) { arr[pos] = getNextValue(); arr[pos + 1] = getNextValue(); pos += 2; } return 0; } |
E-Learning
The course will be organized online in the Ilias system (link will follow).The main course material are slides and exercises. Additionally we will have interactive sessions via BigBlueButton, which is integrated in Ilias. The interactive sessions are NOT recorded.
The slide set consists of three kinds of slides. First, there are slides that I would show in a presentation. Some of these slides are accompanied by additional slides (the slides with violet text) that contain the information that I would say while giving the presentation. Furthermore there are slides that look like titlepages, have blue background and tell you the range of slides that is discussed in the next virtual classroom.
The slides are very similar to a lecture script and the idea is that you read the slides before the next interactive sessions. Your efforts to understand the slides will be supported by exercises that you hand in before the next interactive sessions. In the interactive sessions we will go very quickly through the slides and discuss only your questions. Furthermore, we will discuss your solutions for the exercises.
We are very happy to improve the course material. If you have questions and you think something should be explained in more detail then please let us know.
Slides
The lecture slides are the main course material. Starting from Section 2 the slides are annotated with additional information and can be seen as a kind of lecture script.
The slides will be updated frequently. We will not only append new content but depending on the questions in interactive sessions we will also insert slides with additional information.
Exercises
- Every Monday, we will upload a short exercise sheet and a second, longer exercise sheet.
- The short exercise sheet is meant to help prepare the lecture on Friday, and should be submitted by Friday morning.
- The longer exercise sheet should be submitted by the following Monday.
Exam
There will be an exam during the examination period. Prerequisite for admission to the exam is an active participation in the exercises. A sufficient criterion for an active participation in the exercises is that you achieved 50% of the points that can be obtained for exercise sheets and presented an exercise in an interactive session.
Literature
- Almeida, J.B., Frade, M.J., Pinto, J.S., Melo de Sousa, S., Rigorous Software Development - An Introduction to Program Verification, Springer 2011, ISBN 978-0-85729-017-5
- Matthias Heizmann, Jochen Hoenicke, Andreas Podelski: Software Model Checking for People Who Love Automata. CAV 2013
-
Traces, interpolants, and automata : Ultimate Automizer’s approach to software verification
Talk given at the EPIT Spring School 2018