Formal Methods for Java (Lecture)
Recently, formal methods have been successfully used to specify and verify large software system. A current example is the Verisoft project, whose goal is to create a fully verified processor, operating system and compiler. In this lecture we will investigate the existing methods for the language Java. The language Java was chosen because it is a mature language, with a semi-formal definition of its semantics (The Java Language Specification). However, to use mathematical reasoning, we need a precise definition of the semantics. Therefore, we will sketch the definition of an operational semantics for Java. Furthermore, we will investigate different formal methods for Java. The starting point will be the language extension JML that allows Design by Contract. This allows to add pre- and postconditions to methods and invariants to classes and loops. These assertions can be checked during runtime and this is the purpose of the JML runtime assertion checker (jmlrac). On the other hand, there are static methods, e.g., ESC/Java and Jahob, that automatically provide mathematical proofs that the Java code ensures the post-condition for each possible pre-condition. If these proofs cannot be found automatically, one can also use theorem provers that assist in finding a proof manually. In this lecture, we will present the different approaches for verification of Java code. In the exercise you will investigate different tools on small practical examples.
Course type | Lecture |
---|---|
Instructors | Jochen Hoenicke |
Lecture |
Tuesday, 16:00–18:00 c.t., in building 106 room 00 007 (MMR) Friday, 10:00-11:00 c.t., in building 106 room 00 007 (MMR) |
Exercise | Friday, 11:00–12:00, in building 106 room 00 007 (MMR) |
First session | Lecture 23.10.12 |
Language of instruction | English |
Credits | 6 |
Exams | Oral, 06.03.2013, building 052, room 00-017 |
Course Catalog | Formale Methoden für Java |
News
- A new version of the file PriorityQueue.java with full annotations has been uploaded. This includes a workaround for a bug in the JMLTools.
- On Friday, 11.01.2013, we will have two hours of tutorial to discuss the Christmas sheet. This tutorial will be held by Jochen Hoenicke. Please send your solutions to the Christmas sheet to him (see delivery note on the sheet).
- The faculty switched from pen-and-paper evaluations to a new online evaluation system. Please use this system in the period from January 28 until February 8 to give us some feedback on the lecture. You need the RAS login to access the system. The pages are available in German and English. Note that even though you have to log into the system your answers to the questions will be completely anonymous.
Formalia
Admission criteria
You have to do all exercises.
Exercise Submission Scheme
Every Tuesday before the lecture.
Exam
There will be oral exams. The dates of the exams will be published later.
Please register via examination office as usual.Resources
Literature & Web resources
- J. Gosling et al.: The Java Language Specification (third edition)
- T. Lindholm, F. Yellin: The Java Virtual Machine Specification (second edition)
- Home page of the JML Project.G. Leavens et al.. JML Reference Manual (DRAFT), February 2007.
- B. Beckert, R. Hähnle, P. Schmitt (Eds.): Verification of Object-Oriented Software: The KeY Approach, Springer-Verlag, LNCS 4334
- M. Barnet, D. Naumann: Friends Need A Bit More: Maintaining Invariants Over Shared State, February 2004
- Home page of Jahob
- V. Kuncak: Modular Data Structure Verification
- Home page of JPF
- Home page of Key-Project, Release Candidate Key-1.65
Slides and Additional Material
- Lecture 1 (23.10.2012)
- Lecture 2 (26.10.2012)
- Lecture 3 (30.10.2012)
- Lecture 4 (02.11.2012)
- Lecture 5 (06.11.2012)
- Heap.java : size, ghost, datagroup, complete
- PriorityQueue.java: size, ghost, datagroup, complete
- Test.java
- Lecture 6 (09.11.2012)
- Lecture 7 (13.11.2012)
- Lecture 8 (16.11.2012)
- Lecture 9 (20.11.2012)
- Lecture 10 (23.11.2012)
- jpf-aprop: Heap.java, PriorityQueue.java, TestPF.jpf
- jml: TestPF.jpf
- TestPF.java
- Lecture 11 (27.11.2012)
- Lecture 12 (30.11.2012)
- Lecture 13 (04.12.2012)
- Lecture 14 (07.12.2012)
- Lecture 15 (11.12.2012)
- Lecture 16 (14.12.2012)
- Lecture 17 (18.12.2012)
- Lecture 18 (21.12.2012)
- Lecture 19 (08.01.2013)
- Lecture 20 (15.01.2013)
- Lecture 21 (18.01.2013)
- Lecture 22 (22.01.2013)
- Lecture 23 (25.01.2013)
- Lecture 24 (29.01.2013)
- Lecture 25 (01.02.2013)
- Example: GCD.java
- Lecture 26 (05.02.2013)
- Examples: Mul.java, Search.java, BubbleSort.java
- Lecture 27 (08.02.2013)
- Examples: Minimum.java, SearchWithBreak.java
- Lecture 28 (12.02.2013)
- Example: Triangle.java
- Lecture 29 (15.02.2013)
Exercises
- Exercise Sheet 0 (will be discussed in first tutorial)
- Exercise Sheet 1 (submission: 30.10.2012)
- Exercise Sheet 2 (submission: 06.11.2012)
- Exercise Sheet 3 (submission: 13.11.2012)
- Additional Material: Map.java, Key.java, IntKey.java
- Exercise Sheet 4 (submission: 20.11.2012)
- Exercise Sheet 5 (submisstion: 27.11.2012)
- Additional Material: UsageChecker.java
- Exercise Sheet 6 (submission: 04.12.2012)
- Exercise Sheet 7 (submission: 11.12.2012)
- Additional Material: Heap.java, HeapElem.java, IntHeapElem.java
- Exercise Sheet 8 (submission: 18.12.2012)
- Christmas Sheet (submission: 08.01.2013)
- Additional Material: PostCondition.java
- Solution: ChristmasListener.java, Christmas.jpf
- Exercise Sheet 9 (submission: 15.01.2013)
- Patch to run z3 with Jahob: jahob/src/smtlib/smtCvcl.ml
- Exercise Sheet 10 (submission: 22.01.2013)
- Exercise Sheet 11 (submission: 29.01.2013)
- Exercise Sheet 12 (submission: 05.02.2013)
- Exercise Sheet 13 (submission: 12.02.2013)
- Additional Material: InsertionSort.java