Indice

Principles for Software Composition

PSC 2023/24 (375AA, 9 CFU)

Lecturer: Roberto Bruni
web - email - Microsoft Teams channel

Office hours: By appointment (preferably on Tuesday 14:00-16:00)


Objectives

The objective of the course is to present:

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.


Prerequisites

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.


Textbook(s)

Main text:

Other readings:

External resources:


Exam

The evaluation will be solely based on oral exams, which can involve the assignment of written exercises.

Registration to exams (mandatory): Exams registration system

During the oral exam the student must demonstrate


Oral Exams: schedule

See the channel Exams in the Microsoft Teams platform


Announcements


Lectures (1st part)

N Date Time Room Lecture notes Links
1 Tue 20/02 16:00-18:00 C1 01 - Introduction to the course

02 - Preliminaries:
from syntax to semantics, the role of formal semantics, SOS approach, small-step operational semantics, big-step operational semantics
Lecture 01
Lecture 02
2 Thu 22/02 16:00-18:00 M1 02 - Preliminaries (ctd):
denotational semantics, compositionality principle, normalisation, determinacy, consistency, equivalence, congruence

03 - Unification:
inference process, signatures, substitutions, most general than relation, unification problem
Lecture 02
Lecture 03
3 Fri 23/02 14:00-16:00 C1 03 - Unification (ctd):
unification problem, most general unifiers, unification algorithm

04 - Logical systems:
logical systems, derivations, theorems, logic programs, goal-oriented derivations
Lecture 03
Lecture 04
4 Tue 27/02 16:00-18:00 C1 Exercises:
unification, goal-oriented derivations

05 - Induction:
precedence relation, infinite descending chains, well-founded relations, well-founded induction, mathematical induction, proof of induction principle, structural induction, termination of arithmetic expressions, determinacy of arithmetic expressions
Exercises 01
Lecture 05a
Lecture 05b
5 Thu 29/02 16:00-18:00 X3 Exercises:
induction

05 - Induction (ctd.):
many-sorted signatures, arithmetic and boolean expressions, structural induction over many-sorted signatures, termination of boolean expressions, memories, update operation, operational semantics of commands
Lecture 05b
6 Fri 01/03 14:00-16:00 C1 05 - Induction (ctd.):
divergence, rule for divergence, limits of structural induction, induction on derivations, rule induction, determinacy of commands
Lecture 05c
7 Tue 05/03 16:00-18:00 C1 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, fixpoint equations
Lecture 06
Lecture 07
8 Thu 07/03 16:00-18:00 X3 07 - Induction and recursion (ctd):
consistency of operational and denotational semantics for arithmetic expressions

08 - Partial orders and fixpoints (ctd.):
partial orders, Hasse diagrams, chains, least element, minimal element, bottom element, upper bounds, least upper bound, limits, complete partial orders, powerset completeness, prefix independence, CPO of partial functions, monotonicity
Lecture 07
Lecture 08a
Lecture 08b
9 Fri 08/03 14:00-16:00 C1 Exercises:
induction, termination, determinacy, divergence

08 - Partial orders and fixpoints (ctd.):
continuity, Kleene's fixpoint theorem, McCarthy's 91 function
Exercises 02
Lecture 08b
- Tue 12/03 - - Canceled (Teacher's travel constraints) -
- Thu 14/03 - - Canceled (Teacher's travel constraints) -
- Fri 15/03 - - Canceled (Teacher's travel constraints) -
10 Tue 19/03 16:00-18:00 C1 Exercises:
well-founded recursion, posets, semantics

08 - Partial orders and fixpoints (ctd.):
recursive definitions of partial functions as logical systems, immediate consequences operator, set of theorems as fixpoint
Exercises 03
Lecture 08c
11 Thu 21/03 16:00-18:00 X3 09 - Denotational semantics:
lambda-notation, free variables, capture-avoiding substitutions, alpha-conversion, beta rule, conditionals, denotational semantics of commands, fixpoint computation

10 - Consistency:
denotational equivalence, congruence, compositionality principle, consistency of commands, correctness, completeness
Lecture 09
Lecture 10
12 Fri 22/03 14:00-16:00 C1 11 - Haskell:
an overview

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

12 - HOFL:
syntax, pre-terms, types, types judgements, type system, type checking, type inference, principal type
Exercises 04
Lecture 12a
16 Fri 05/04 14:00-16:00 C1 12 - HOFL (ctd.):
canonical forms, operational semantics, lazy vs eager evaluation

13 - Domain theory:
Integers with bottom, cartesian product, projections
Lecture 12b
Lecture 13a
- Tue 09/04 - - Canceled (Teacher's travel constraints) -
17 Thu 11/04 16:00-18:00 X3 13 - Domain theory (ctd.):
switching lemma, functional domains, lifting, let notation

14 - Denotational semantics of HOFL:
definition and examples, type consistency
Lecture 13b
Lecture 13c
Lecture 14
18 Fri 12/04 14:00-16:00 C1 13 - Domain theory (ctd.):
continuity theorems, 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
Lecture 13c
Lecture 14
Lecture 15
19 Tue 16/04 16:00-18:00 C1 15 - Consistency of HOFL (ctd.):
operational convergence, denotational convergence, operational convergence implies denotational convergence (and vice versa), operational and denotational equivalence, correspondence for type int, unlifted semantics, lifted vs unlifted semantics

16 - Erlang:
an overview

Exercises:
HOFL, domains
Lecture 15
Lecture 16
Exercises 05

Lectures (2nd part)

N Date Time Room Lecture notes Links
20 Thu 18/04 16:00-18:00 X3 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

17 - CCS:
Syntax, operational semantics
Erlang
erl session
Lecture 17a
21 Fri 19/04 14:00-16:00 C1 17 - CCS (ctd.):
value passing, finitely branching processes, guarded processes

18 - Bisimulation:
abstract semantics, graph isomorphism, trace equivalence, bisimulation game, strong bisimulation
Lecture 17a
Lecture 17b
Lecture 18a
Lecture 18b
22 Tue 23/04 16:00-18:00 C1 18 - Bisimulation (ctd.):
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, strong bisimilarity as a fixpoint
Lecture 18b
Lecture 18c
23 Fri 26/04 14:00-16:00 C1 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

20 - Weak Semantics:
weak transitions, weak bisimulation, weak bisimilarity, weak bisimilarity is not a congruence, weak observational congruence, Milner's tau-laws
Lecture 18c
Lecture 19
Lecture 20
24 Tue 30/04 16:00-18:00 C1 21 - CCS at work:
modelling imperative programs with CCS, playing with CCS (using CAAL), modelling and verification of mutual exclusion algorithms with CCS and CAAL

CAAL session (copy the text and paste it in the Edit panel)
Lecture 21
CAAL
CAAL session
25 Thu 02/05 16:00-18:00 X3 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
- Fri 03/05 - - Canceled (Student body assembly) -
26 Tue 07/05 16:00-18:00 C1 22 - Temporal and modal logics (ctd.):
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
Lecture 22a
Lecture 22b
27 Thu 09/05 16:00-18:00 X3 22 - Temporal and modal logics (ctd.):
invariant properties, possibly properties, mu-calculus with labels

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 22b
Lecture 23
Google Go
go session
28 Fri 10/05 14:00-16:00 C1 24 - Pi-calculus:
name mobility, free names, bound names, syntax and operational semantics, scope extrusion, early and late bisimilarities, weak semantics
Lecture 24
29 Tue 14/05 16:00-18:00 C1 Exercises:
logics, GoogleGo, pi-calculus

25 - Measure theory and Markov chains:
probability space, random variables, stochastic processes, homogeneous Markov chains, DTMC, DTMC as matrices, DTMC as PTS
Exercises 07
Lecture 25a
30 Thu 16/05 16:00-18:00 X3 25 - Measure theory and Markov chains (ctd):
next state probability, ergodic DTMC, steady state distribution, finite path probability, negative exponential distribution, CTMC, embedded DTMC, infinitesimal generator matrix, CTMC stationary distribution

26 - Probabilistic bisimilarities:
bisimilarity revisited, reachability predicate, CTMC bisimilarity, DTMC bisimilarity, Markov chains with actions
Lecture 25a
Lecture 25b
Lecture 26
31 Fri 17/05 14:00-16:00 C1 26 - Probabilistic bisimilarities (ctd.):
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
PEPA
32 Tue 21/05 16:00-18:00 C1 Exercises:
Markov chains, probabilistic systems, PEPA
Exercises 08
33 Thu 23/05 16:00-18:00 X3 Exercises:
Samples from exam exercises
34 Fri 24/05 14:00-18:00 Teacher's office Mini-projects:
discussion
End

Past courses