Lectures

This page gives highlights of past lectures and provides lecture notes, reading assignments, and exercises.


Dates Topics and Readings Exercises
Aug 24
Aug 26

Course introduction and administration. Introduction to Formal Methods. What are formal methods and how they help in software development.


Required Readings:
  • Syllabus
  • Course overview [pdf] and introduction [pdf]
  • [Haxt10] An introduction to formal methods, with examples of industrial usage
Recommended Readings:
  • [vLam00] An introduction to formal specifications, and a survey of formal specification approaches.
  • Chap. 1-2 of [Gara13] A fairly comprehensive recent survey on the use and practice of FM.
  • [Barr13] Notes on expert reports and testimony of the Toyota Unintended Acceleration Litigation.
Aug 31
Sep 2

Introduction to sets and relations. Recap of basic notions in set theory. Relations and relational operators.

Modeling general software systems. Introduction to the Alloy modeling language. Alloy's foundations. Signatures, fields and multiplicity constraints.

Modeling simple domains in Alloy. Generating and analyzing model instances with the Alloy Analyzer.


Required Readings:
  • Lecture notes on sets and relations [pdf] (revised)
  • Lecture notes: An introduction to Alloy 5 - Part 1 [pdf]
Recommended Readings:

All exercises in set and relations notes

Sep 7
Sep 9

Relations and operations on them. Formulas, Boolean operators and quantifiers. Expressing constraints on relations using Alloy formulas. Examples of constraints. Exercises.


Required Readings:
  • Lecture notes: an introduction to Alloy 5 - Part 1 [pdf] and 2 (revised) [pdf]
  • Family examples from the notes
Recommended Readings:
Exercises in lecture notes
Sep 14
Sep 16

More Alloy operators. Operator precedence and parsing. Facts and assertions. Checking models and assertions with the Alloy Analyzer. Signature scopes. Functions and predicates. Examples and exercises.

Practice with modeling in Alloy: the Academia domain.


Required Readings:
  • Lecture notes: an introduction to Alloy 5 - Part 2 (revised) [pdf] and 3 (revised) [pdf]
  • Lecture notes: the Academia model [pdf]
  • Academia examples from the notes
Recommended Readings:
All exercises in the Part 2 and 3 lecture notes
Sep 21
Sep 23

More practice with modeling in Alloy: the Academia domain. Examples and exercises.

Alloy's module system. Motivations and uses. Parametric modules. An example: the predefined Ordering module.

Modeling dynamic systems in Alloy. Example: making the family model dynamic.


Required Readings:
  • Lecture notes: the Academia model (revised) [pdf]
  • Academia examples from the notes
  • Lecture notes: Dynamic Models in Alloy (revised) [pdf]
Recommended Readings:
  • Lecture notes: Alloy Modules [pdf]
  • util/ordering.als sample model in the Alloy Analyzer
- All exercises in the Academia Model notes
- First exercise in Dynamic Models notes
Sep 28
Sep 30

More on dynamic models. Explicit time modeling and implicit time modelling in Alloy 5 (Electrum Alloy). General approach: dynamic systems as state transition systems. Operators. Preconditions, postconditions and frame conditions. Examples of operators for the family model.

Introduction to Electrum Alloy (Alloy 5). Modeling dynamic systems in Alloy 5. Examples. Group exercises.
A complete Alloy modeling case study: the hotel room lock system.

Required Readings:
  • Lecture notes: Dynamic Models in Alloy (revised) [pdf] (revised)
  • Lecture notes: Hotel Lock System [pdf]
  • Electrum tutorial
Recommended Readings:
  • Examples of equivalences in Alloy
  • Electrum Alloy reference
  • Lecture notes on Electrum Alloy by Alcino Cunha and Nuno Macedo on
    • Electrum overview [pdf]
    • First Order Logic [pdf]
    • Relational Logic [pdf]
    • Alloy's type system [pdf]
    • Relational model finding [pdf]
    • First-order Linear Temporal Logic [pdf]
    • Safety, liveness, and fairness [pdf]
All exercises in Dynamic Models notes
Oct 5
Oct 7

Introduction to reactive systems. Introduction to the Lustre specification language.
Examples of Lustre programs. Specifying simple reactive systems in Lustre. Simulating Lustre programs with the Kind 2 tool (online examples).


Required Readings:
  • Lecture notes: Reactive Systems and the Lustre language, Part 1 [pdf]
  • Chap. 1 of [Halb02], a Lustre tutorial
  • (Superset of) Lustre examples seen in class
Recommended Readings:
Exercises in Lustre notes
Oct 12
Oct 14

Practice with writing Lustre models and expressing their properties. Simulating and checking Lustre models with Kind 2 (online examples).
Checking properties via synchronous observers. Useful temporal operators. Examples. In-class exercise.


Required Readings:
  • Lecture notes: Reactive Systems and the Lustre language, Part 1 [pdf] and 2 [pdf]
  • Lustre examples seen in class
  • Chap. 1 of [Halb02], a Lustre tutorial
Recommended Readings:
  • [Halb91], the main reference paper for Lustre
  • [Halb99], an introduction to verification and testing with Lustre
Exercises in Lustre notes
Oct 19

Midterm exam

Oct 21

More practice with writing Lustre models and expressing their properties. Using counterexamples to debug the model. Traffic light examples.

Required Readings:
Simulate and verify in Kind 2 all Lustre examples in the readings
Oct 26
Oct 28

Contract-based specification and compositional verification. Motivation and uses. Extending Lustre with contracts. Contract basics: assumptions, guarantees and execution modes. Examples of contracts.


Required Readings:
  • Lecture notes: A Mode-aware Contract Language for Reactive System [pdf] (revised)
  • StopwatchSpec and ElevatorSpec examples on the Kind 2 online page
Recommended Readings:
  • [Cham16], a paper introducing Kind 2's contract language
  • Kind 2 User Documentation on contract syntax and semantics
Simulate and verify in Kind 2 the Lustre examples in the readings
Nov 2

More on contract-based specification. Specifying system modes in Kind 2's contract language. Modular and compositional analysis in Kind 2. Motivation and examples.


Required Readings: Recommended Readings:
Nov 4

Specifying and verifying programs in high-level programming languages. Introduction to Dafny. Method contracts in Dafny. Specifying pre and post-conditions. Compositional verification of methods through the use of contracts.


Required Readings:
  • Lecture notes: Reasoning About Programs with Dafny [pdf]
  • Chap. 1, 2.1 of Program Proofs (textbook)
Recommended Readings:
  • [Wing95], which provides several hints to specifiers
Exercises in lecture notes
Nov 9
Nov 11

Introduction to Floyd-Hoare logic. Formalizing program behavior with Hoare triples. Strongest postconditions and weakest preconditions. The WP and SP operators. Computing WPs and SPs for assignments, sequential compositions, conditional statements, and methods calls. Assert and assume statements. Method vs function calls in Dafny. Partial expressions.
Dafny in action. Some initial examples.


Required Readings:
  • Lecture notes: Floyd-Hoare logic [pdf] (revised)
  • Chap. 2 of Program Proofs except for 2.9
Recommended Readings:
  • Chap. 2.9 of Program Proofs
Exercises in lecture notes
Nov 16
Nov 18

Dafny in action. Various examples.
Loops in Dafny. The loop rule in Floyd-Hoare logic. Loop specifications and implementations. Deriving correct by construction implementations from specs. Loop termination. Examples.
Recursive specifications of iterative programs. Examples.
Arrays. Checking iterative programs with arrays.


Required Readings:
  • Lecture notes: Loops in Dafny [pdf] (revised)
  • Lecture notes: Iterative programs in Dafny [pdf] (revised)
  • Lecture notes: Arrays in Dafny [pdf] (revised)
  • Chap. 11, 12 of Program Proofs except 12.3
  • Chap. 13.0-13.3 of Program Proofs
Recommended Readings:
  • Chap. 3 of Program Proofs
Exercises in lecture notes
Nov 23
Nov 25

No class (Thanksgiving recess)

 
Nov 30
Dec 2

More on arrays. Binary search. Reading and writing frames for reference variables. Methods that modify arrays. Examples.

Classes and Objects in Dafny. Specifying classes as abstract data types to separate observable behavior from internal implementation. Examples: counters and alternative implementations of FIFO queues.


Required Readings:
Dec 7
Dec 9

The use of dynamic frames in Dafny to specify and verify programs using objects. Motivation and uses. Queue, counter, bank account and linked list examples.

Required Readings: Recommended Readings:
  • Lecture notes: Objects in Dafny [pdf]
Dec 13  

Final Exam

 
 

Copyright: Cesare Tinelli, The University of Iowa, 2021