Formal Methods and Functional Programming
Spring Semester 2024, Bachelor course (252-0058-00)
Overview
Lecturers: Prof. Dr. Peter Müller and Prof. Dr. David Basin
Classes: Tuesdays 10-12 and Thursdays 10-12
Credits: 7 ECTS (4V + 2U)
Language: English (lectures), English and German (exercises)
Exercise classes: Tuesdays 14-16, Wednesdays 8-10 or Wednesdays 16-18
For questions/issues concerned with the first half (Functional Programming), please contact François Hublet; for the second half (Formal Methods), please contact Nicolas Klose.
Announcements
- [2024/05/02] The second midterm will take place on May 14 at 10:00 in the usual lecture halls.
- [2024/05/02] We will provide protected page this cheat sheet for the final. For the midterm we will provide a reduced version which only contains the materials covered so far.
- [2024/04/13] The FM team has magically time-travelled a year into the present!
- [2023/04/12] The FP team is handing the course over to the FM team. Have fun!
- [2023/04/12] The protected page master solution of the first midterm has been released.
- [2023/03/04] Our first midterm will take place on March 14 at 10:00 in the usual lecture halls!
- [2023/02/14] You can now enroll in an exercise group using CodeExpert. Note that enrollment in CodeExpert is obligatory to attend the exercises.
- [2023/01/25] The course webpage for this year's FMFP is up and running!
Course material
Week 14
- [2024/05/21] protected page Slides: Linear Temporal Logic
- [2024/05/21] protected page Slides: Model checking
- [2024/05/27] protected page Exercise sheet 14 - protected page Solution
- [2024/05/27] protected page Exercise session 14 - protected page Solution
- [2024/05/27] protected page Promela models - protected page Solutions
- [2024/05/27] protected page Optional exercises 14
Week 13
- [2024/05/16] protected page Slides: Modeling
- [2024/05/19] protected page Exercise sheet 13 - protected page Solution
- [2024/05/19] protected page Exercise session 13 - protected page Solution
- [2024/05/19] protected page Viper Programs 13 - protected page Solutions
- [2024/05/19] protected page Optional exercises 13
Week 12
- [2024/05/13] protected page Exercise sheet 12 - protected page Solution
- [2024/05/13] protected page Exercise session 12 - protected page Solution
- [2024/05/13] protected page Optional exercises 12
Week 11
- [2024/05/02] protected page Slides: Axiomatic semantics
- [2024/05/06] protected page Exercise sheet 11 - protected page Solution
- [2024/05/06] protected page Exercise session 11 - protected page Solution
- [2024/05/06] protected page Optional exercises 11
Week 10
- [2024/04/29] protected page Exercise sheet 10 - protected page Solution
- [2024/04/29] protected page Exercise session 10 - protected page Solution
- [2024/04/29] protected page Optional exercises 10
Week 9
- [2024/04/21] protected page Slides: Operational Semantics - protected page Handwritten Notes
- [2024/04/21] protected page Exercise sheet 9 - protected page Solution
- [2024/04/21] protected page Exercise session 9 - protected page Solution
Week 8
- [2024/04/11] protected page Slides: Introduction
- [2024/04/11] protected page Slides: IMP
Week 7
- [2023/04/08] protected page Slides: monads and conclusion
- [2023/04/08] protected page Exercise (theory) sheet 7
Week 6
- [2023/04/12] NEW! protected page Midterm with solutions
- [2023/04/08] protected page Exercise session slides
- [2023/03/26] protected page Slides: case studies
- [2023/03/26] protected page Slides: efficiency
- [2023/03/26] protected page Exercise (theory) sheet 6 - protected page Solutions
Week 5
- [2023/03/26] protected page Exercise session slides
- [2023/03/18] protected page Slides: lazy evaluation
- [2023/03/18] protected page Exercise (theory) sheet 5 - protected page Solutions
Week 4
- [2023/03/18] protected page Exercise session slides
- [2023/03/11] protected page Slides: algebraic data types
- [2023/03/11] protected page Slides: modules
- [2023/03/11] protected page Exercise (theory) sheet 4 - protected page Solutions
Week 3
- [2023/03/13] protected page Exercise session slides
- [2023/03/04] protected page Slides: higher-order programming and types
- [2023/03/04] protected page Exercise (theory) sheet 3 - protected page Solutions
Week 2
- [2023/03/05] protected page Exercise session slides
- [2023/02/27] protected page Slides: lists
- [2023/02/26] protected page Slides: correctness
- [2023/02/26] protected page Exercise (theory) sheet 2 - protected page Solutions
Week 1
- [2023/02/22] protected page Exercise session slides
- [2023/02/22] protected page Slides: natural deduction
- [2023/02/19] protected page Slides: introduction
- [2023/02/19] protected page Exercise (theory) sheet 1 - protected page Solutions
General Information
Course material:
All the course material will be uploaded on this website.
For the first part of the course, we will also use CodeExpert for programming exercises.
Lectures:
The lecture will be held in HG E 7. If not all students fit into the room, there will be a live streaming of the lecture in HG E 3. Please come to HG E 7 first.
Attendance is strongly recommended. No recordings will be provided.
Exercise Sessions:
The enrollment link for the Code Expert groups will be posted on this website very soon!
Exam and Quizzes:
There will be a 180 minutes written examination. This examination covers both halves of the course. Note that the examination is only offered in the session after the course unit.
There will also be two graded midterm quizzes. Each quiz will be 30 minutes and each may improve the final grade.
Description
In this course, participants will learn about new ways of specifying, reasoning about, and developing programs and computer systems. Our objective is to help students raise their level of abstraction in modelling and implementing systems.
The first part of the course will focus on designing and reasoning about functional programs. Functional programs are mathematical expressions that are evaluated and reasoned about much like ordinary mathematical functions. As a result, these expressions are simple to analyse and compose to implement large-scale programs. We will cover the mathematical foundations of functional programming, the lambda calculus, as well as higher-order programming, typing, and proofs of correctness.
The second part of the course will focus on deductive and algorithmic validation of programs modelled as transition systems. As an example of deductive verification, students will learn how to formalize the semantics of imperative programming languages and how to use a formal semantics to prove properties of languages and programs. As an example of algorithmic validation, the course will introduce model checking and apply it to programs and program designs.
Resources
Literature for the first part
- Miran Lipovača. external page Learn you a Haskell for great good! no starch press, 2011 (external page full version online)
- Simon Thompson. external page Haskell: the Craft of Functional Programming, Addison Wesley, 2011
- O'Sullivan, Stuart, Goerzen. external page Real World Haskell, O'Reilly, 2008 (external page full version online)
- Graham Hutton. external page Programming in Haskell. Second edition, Cambridge University Press, 2016
- Mordechai Ben-Ari. external page Mathematical Logic for Computer Science. Springer, 2012
Haskell links
The external page Zurich Haskell user group maintains a collection of external page Haskell links useful for both Haskell beginners and experts.
Proof checker
The proof checker CYP for induction proofs is external page available on GitHub.
Literature for the second part
- Hanne Riis Nielson and Flemming Nielson. external page Semantics with Applications: A Formal Introduction, John Wiley & Sons, 1992
- Christel Baier and Joost-Pieter Katoen. external page Principles of Model Checking. The MIT Press, 2008
Additional literature for interested students
- Chris Okasaki. Purely Functional Data Structures. Cambridge University Press, 1998.
- Harold Abelson and Gerald Jay Sussman with Julie Sussman. Structure and Interpretation of Computer Programs. MIT Press, 1996. (external page full version online)