Strumenti Utente

Strumenti Sito


Principles for Software Composition

PSC 2021/22 (375AA, 9 CFU)

Lecturer: Roberto Bruni
web - email - Microsoft Teams channel

Office hours: Tuesday 16:00-18:00 or by appointment


The objective of the course is to present:

  • different models of computation,
  • their programming paradigms,
  • their mathematical descriptions, both concrete and abstract,
  • some intellectual tools/techniques for reasoning on models.

The course will cover the basic techniques for assigning meaning to programs with higher-order, concurrent and probabilistic features (e.g., domain theory, logical systems, well-founded induction, structural recursion, labelled transition systems, Markov chains, probabilistic reactive systems, stochastic process algebras) and for proving their fundamental properties, such as termination, normalisation, determinacy, behavioural equivalence and logical equivalence. Temporal and modal logics will also be studied for the specification and analysis of programs. In particular, some emphasis will be posed on modularity and compositionality, in the sense of guaranteeing some property of the whole by proving simpler properties of its parts.


There are no prerequisites, but the students are expected to have some familiarity with discrete mathematics, first-order logic, context-free grammars, and code fragments in imperative and functional style.


Main text:

Other readings:

External resources:


Normally, the evaluation would have been based on written and oral exams.

Due to the covid-19 countermeasures, for the current period, the evaluation will be solely based on oral exams. As an alternative to the assignment of exercises during the oral exam, students can develop a small project before the exam (contact the teacher if interested).

Registration to exams (mandatory): Exams registration system

During the oral exam the student must demonstrate

  • knowledge: his/her knowledge of the course material, and
  • problem solving: the ability to solve some simple exercises, and
  • understanding: the ability to discuss the reading matter thoughtfully and with propriety of expression.

Oral Exams: schedule

See the channel Exams in the Microsoft Teams platform


  • The lecture of tuesday march 8 is canceled and will be rescheduled in the upcoming weeks
  • Due to the covid-19 emergency situation, there will be no mid-term exams
  • as the course starts:
    Each student must subscribe the Microsoft Teams channel of the course and then send an email to the professor from his/her favourite email account with subject PSC21-22 and the following data
    (by doing so, the account will be included in the class mailing-list, where important announcements can be sent):
    1. first name and last name (please clarify which is which, to avoid ambiguities)
    2. enrolment number (numero di matricola)
    3. bachelor degree (course of study and university)
    4. your favourite topics in computer science (optional)

Lectures (1st part)

Virtual classroom: To join a lecture enter the course team on Microsoft Teams, go to the Lectures channel and click on the scheduled lecture.

N Date Time Room Lecture notes Links
1 Mon 14/02 11:00-13:00 M1 01 - Introduction to the course

02 - Preliminaries:
from syntax to semantics, the role of formal semantics
Lecture 01
Lecture 02
2 Tue 15/02 14:00-16:00 M1 02 - Preliminaries (ctd):
SOS approach, small-step operational semantics, big-step operational semantics, denotational semantics, compositionality principle, normalisation, determinacy, consistency, equivalence, congruence
Lecture 02
3 Thu 17/02 14:00-16:00 M1 03 - Unification:
inference process, signatures, substitutions, unification problem, most general unifiers, unification algorithm

04 - Logical systems:
logical systems, derivations, theorems
Lecture 03
Lecture 04
4 Mon 21/02 11:00-13:00 M1 04 - Logical systems (ctd.):
logic programs, goal-oriented derivations

05 - Induction:
precedence relation, infinite descending chains, well-founded relations, well-founded induction, mathematical induction, proof of induction principle
Lecture 04
Lecture 05a
5 Tue 22/02 14:00-16:00 M1 05 - Induction (ctd.):
structural induction, termination of arithmetic expressions, determinacy of arithmetic expressions
Lecture 05a
Lecture 05b
6 Thu 24/02 14:00-16:00 M1 Exercises:
unification, goal-oriented derivations

05 - Induction (ctd.):
many-sorted signatures, arithmetic and boolean expressions
Exercises 01
Lecture 05b
7 Mon 28/02 11:00-13:00 M1 05 - Induction (ctd.):
structural induction over many-sorted signatures, termination of boolean expressions, memories, update operation, operational semantics of commands, divergence, rule for divergence, limits of structural induction, induction on derivations, rule induction, determinacy of commands

Lecture 05b
Lecture 05c
8 Tue 01/03 14:00-16:00 M1 06 - Equivalence:
operational equivalence, concrete equivalences, parametric equivalences, equivalence and divergence

07 - Induction and recursion:
well-founded recursion, lexicographic precedence relation, Ackermann function, denotational semantics of arithmetic expressions
Lecture 06
Lecture 07
9 Thu 03/03 14:00-16:00 M1 Exercises:
induction, termination, determinacy, divergence

07 - Induction and recursion (ctd.):
consistency of operational and denotational semantics for arithmetic expressions, fixpoint equations

08 - Partial orders and fixpoints:
partial orders, Hasse diagrams
Exercises 02
Lecture 07
Lecture 08a
10 Mon 07/03 11:00-13:00 M1 Exercises:
x++, arithmetic expressions with side-effects

08 - Partial orders and fixpoints (ctd):
chains, least element, minimal element, bottom element, upper bounds, least upper bound, chains, limits, complete partial orders, powerset completeness
Lecture 08a
Lecture 08b
- Tue 08/03 14:00-16:00 Canceled
11 Thu 10/03 14:00-16:00 M1 08 - Partial orders and fixpoints (ctd.):
prefix independence, CPO of partial functions, monotonicity, continuity, Kleene's fixpoint theorem, McCarthy's 91 function, recursive definitions of partial functions as logical systems, immediate consequences operator
Lecture 08b
Lecture 08c
12 Mon 14/03 11:00-13:00 M1 08 - Partial orders and fixpoints (ctd.):
set of theorems as fixpoint

09 - Denotational semantics:
lambda-notation, free variables, capture-avoiding substitutions, alpha-conversion, beta rule, conditionals, denotational semantics of commands, fixpoint computation

posets, semantics
Lecture 08c
Lecture 09
Exercises 03
13 Tue 15/03 14:00-16:00 M1 10 - Consistency:
denotational equivalence, congruence, compositionality principle, consistency of commands, correctness, completeness

well-founded recursion, posets, semantics
Lecture 10
Exercises 03
14 Thu 17/03 14:00-16:00 M1 11 - Haskell:
an overview

Haskell ghci:
basics, tuples, lists, list comprehension, guards, pattern matching, lambda, partial application, zip, exercises
Lecture 11
ghci session 01
15 Mon 21/03 11:00-13:00 M1 Haskell ghci (ctd):
recursive definitions, tail recursion, let-in, where, map, filter, exercises
ghci session 02
16 Tue 22/03 14:00-16:00 M1 Haskell ghci (ctd.):
fixpoint operator, folds, application, function composition, data types, type classes, recursive data structures, derived instances, exercises
ghci session 03
17 Thu 24/03 14:00-16:00 M1 Exercises:

12 - HOFL:
syntax, pre-terms, types, types judgements
Exercises 04
Lecture 12a
18 Mon 28/03 11:00-13:00 M1 12 - HOFL (ctd.):
type system, type checking, type inference, principal type, canonical forms, operational semantics, lazy vs eager evaluation
Lecture 12a
Lecture 12b
19 Tue 29/03 14:00-16:00 M1 13 - Domain theory:
Integers with bottom, cartesian product, projections, switching lemma, functional domains
Lecture 13a
Lecture 13b

Lectures (2nd part)

Virtual classroom: To join a lecture enter the course team on Microsoft Teams, go to the Lectures channel and click on the scheduled lecture.

N Date Time Room Lecture notes Links
20 Thu 31/03 14:00-16:00 M1 13 - Domain theory (ctd.):
functional domains, lifting, let notation, continuity theorems

14 - Denotational semantics of HOFL:
definition and examples, type consistency
Lecture 13c
Lecture 14
21 Mon 04/04 11:00-13:00 M1 13 - Domain theory (ctd.):
apply, fix, curry, uncurry

14 - Denotational semantics of HOFL (ctd.):
substitution lemma, compositionality and other properties

15 - Consistency of HOFL:
Counterexample to completeness, correctness of the operational semantics, operational convergence, denotational convergence, operational convergence implies denotational convergence (and vice versa), operational and denotational equivalence, correspondence for type int, unlifted semantics
Lecture 13c
Lecture 14
Lecture 15
22 Tue 05/04 14:00-16:00 M1 15 - Consistency of HOFL (ctd.):
lifted vs unlifted semantics

16 - Erlang:
an overview

Erlang erl:
numbers, atoms, tuples, lists, terms, variables, term comparison, pattern matching, list comprehension, modules, functions, guards, higher order, recursion, pids, spawn, self, send, receive, examples
Lecture 15
Lecture 16
erl session
23 Thu 07/04 14:00-16:00 M1 Exercises:
HOFL, domains

17 - CCS:
Syntax, operational semantics
Exercises 05
Lecture 17a
24 Mon 11/04 11:00-13:00 M1 17 - CCS (ctd.):
value passing, finitely branching processes, guarded processes

18 - Bisimulation:
abstract semantics, graph isomorphism, trace equivalence
Lecture 17a
Lecture 17b
Lecture 18a
25 Tue 12/04 14:00-16:00 M1 18 - Bisimulation (ctd.):
bisimulation game, strong bisimulation, strong bisimilarity, strong bisimilarity is an equivalence, strong bisimilarity is a bisimulation, strong bisimilarity is the coarsest strong bisimulation, strong bisimilarity is a congruence, some laws for strong bisimilarity
Lecture 18b
26 Thu 14/04 14:00-16:00 M1 18 - Bisimulation (ctd.):
strong bisimilarity as a fixpoint, Phi operator, Phi is monotone, Phi is continuous (on finitely branching processes), Knaster-Tarski's fixpoint theorem

19 - Hennessy-Milner logic:
modalities, HML syntax, formula satisfaction, converse of a formula, HML equivalence
Lecture 18c
Lecture 19
27 Tue 26/04 14:00-16:00 M1 20 - Weak Semantics:
weak transitions, weak bisimulation, weak bisimilarity, weak bisimilarity is not a congruence, weak observational congruence, Milner's tau-laws

21 - CCS at work:
modelling imperative programs with CCS, playing with CCS (using CAAL)
Lecture 20
Lecture 21
28 Thu 28/04 14:00-16:00 M1 21 - CCS at work:
modelling and verification of mutual exclusion algorithms with CCS and CAAL

CAAL session (copy the text and paste it in the Edit panel)
CAAL session
29 Mon 02/05 11:00-13:00 M1 Exercises:
Erlang, CCS

22 - Temporal and modal logics:
linear temporal logic (LTL), linear structures models, shifting, LTL satisfaction, equivalence of formulas, automata-like models
Exercises 06
Lecture 22a
30 Tue 03/05 14:00-16:00 M1 22 - Temporal and modal logics:
computational tree logic (CTL* and CTL), infinite trees, infinite paths, branching structure, CTL* satisfaction, equivalence of formulas, CTL formulas, expressiveness comparison, mu-calculus, positive normal form, least and greatest fixpoints, invariant properties, possibly properties, mu-calculus with labels
Lecture 22b
31 Thu 05/05 14:00-16:00 M1 23 - GoogleGo:
an overview

GoogleGo playground:
Go principles, variable declaration, type conversion, multiple assignments, type inference, imports, packages and public names, named return values, naked return, multiple results, conditionals and loops, pointers, struct, receiver arguments and methods, interfaces, goroutines, bidirectional channels, channel types, send, receive, asynchronous communication with buffering, close, select, communicating communication means, range, handling multiple senders, concurrent prime sieve
Lecture 23
Google Go
go session
32 Mon 09/05 14:00-16:00 M1 24 - Pi-calculus:
name mobility, free names, bound names, syntax and operational semantics, scope extrusion, early and late bisimilarities, weak semantics
Lecture 24
33 Tue 10/05 14:00-16:00 M1 25 - Measure theory and Markov chains:
probability space, random variables, stochastic processes, homogeneous Markov chains, DTMC, DTMC as matrices, DTMC as PTS, next state probability, finite path probability, ergodic DTMC, steady state distribution
Lecture 25a
34 Thu 12/05 14:00-16:00 M1 Exercises:
logics, GoogleGo, pi-calculus

25 - Measure theory and Markov chains:
negative exponential distribution, CTMC, embedded DTMC, infinitesimal generator matrix, CTMC stationary distribution

26 - Probabilistic bisimilarities:
bisimilarity revisited, reachability predicate, CTMC bisimilarity.
Exercises 07
Lecture 25b
Lecture 26
35 Mon 16/05 11:00-13:00 M1 26 - Probabilistic bisimilarities (ctd.):
DTMC bisimilarity, Markov chains with actions, probabilistic reactive systems, bisimilarity for reactive systems, Larsen-Skou logic

27 - PEPA:
motivation, basic ideas, PEPA workflow, PEPA syntax, cooperation combinator, bounded capacity, apparent rate, PEPA operational semantics, performance analysis, reward structures
Lecture 26
Lecture 27
36 Tue 17/05 14:00-16:00 M1 Exercises:
Markov chains, probabilistic systems, PEPA
Exercises 08

Exam sessions

Date Time Room Info
Teams Exam
Exams registration system
The actual date of the oral exam will be agreed with the teacher
Teams Exam
Exams registration system
The actual date of the oral exam will be agreed with the teacher
Teams Exam
Exams registration system
The actual date of the oral exam will be agreed with the teacher
Teams Exam
Exams registration system
The actual date of the oral exam will be agreed with the teacher
Teams Exam
Exams registration system
The actual date of the oral exam will be agreed with the teacher
Teams Exam
Exams registration system
The actual date of the oral exam will be agreed with the teacher

Past courses

magistraleinformatica/psc/2021-22/start.txt · Ultima modifica: 11/02/2023 alle 08:54 (8 mesi fa) da Roberto Bruni