Formal methods are a collection of techniques and notations based on formal logic and formal semantics, applied to the modelling and analysis of software and hardware systems. Their main purpose is to provide unambiguous specifications of system requirements. Formal verification of the requirements allows to discover errors and bugs, and in particular design flaws that cannot be easily discovered using testing or simulation alone. The course gives a broad introduction to the subject, covering the principles and algorithmic methods behind the tools for software analysis and verification. In particular, deductive verification based on Hoare logic, and model checking based on Temporal logic will be considered.
Choose semester and course offering
Choose semester and course offering to see information from the correct course syllabus and course offering.
Content and learning outcomes
Part I. Hoare Logic and Deductive Verification
1. Code Annotation: The Java Modelling Language
2. Automated Static Assertion Checking: Weakest Preconditions
3. The Correctness-by-Construction Approach to Programming
4. Ghost State and Control-flow Abstraction
5. Model State and Data Abstraction
6. The Back-end: Automated Theorem Proving
Part II. Temporal Logic and Model Checking
7. Kripke Structures and System Modelling
8. Temporal Logic and Model Checking: LTL and CTL
9. Software Model Checking
Intended learning outcomes
The overall aim of the course is to provide a working familiarity with the main methods and tools in the formal methods area, in theory as well as in practice.
After passing the course, the students should be able to:
1. Independently select a suitable modeling approach for some given simple problem;
2. Argue informally and formally for the soundness and limitations of the chosen approach;
3. Identify, specify and verify important system properties using suitable automated or semi-automated tools;
4. Correctly interpret and evaluate the results of the analysis.
For passing the course, a student has to demonstrate the ability to apply the methods discussed in the course; for the highest grade he/she has also to be proficient in the theoretical foundations of these methods.
- 7 two-hour lectures
- 7 two-hour tutorial sessions
- 6 homework assignments, peer reviewed at the tutorial sessions
- 2 laboratory assignments
- 1 final five-hour written exam
Literature and preparations
A course in Discrete Mathematics, e.g. SF1630.
Good background in logic for computer science and discrete mathematics is required, e.g. corresponding to the courses DD1350 and SF1630.
Examination and completion
If the course is discontinued, students may request to be examined during the following two academic years.
- HEMA - Exercises, 2.5 credits, grading scale: P, F
- LABA - Laboratory work, 2.5 credits, grading scale: A, B, C, D, E, FX, F
- TENA - Examination, 2.5 credits, grading scale: A, B, C, D, E, FX, F
Based on recommendation from KTH’s coordinator for disabilities, the examiner will decide how to adapt an examination for students with documented disability.
The examiner may apply another examination format when re-examining individual students.
Other requirements for final grade
One needs to pass the homework assignments, the laboratory assignments, and the final exam.
Opportunity to complete the requirements via supplementary examination
Opportunity to raise an approved grade via renewed examination
- All members of a group are responsible for the group's work.
- In any assessment, every student shall honestly disclose any help received and sources used.
- In an oral assessment, every student shall be able to present and answer questions about the entire assignment and solution.
Further information about the course can be found on the Course web at the link below. Information on the Course web will later be moved to this site.Course web DD2452
Main field of study
In this course, the EECS code of honor applies, see: