====== Models for Programming Paradigms ====== {{:magistraleinformatica:mpp:logo-van-gogh-like.png?150 | }} **MPP 2025/26 (0077A, 9 CFU)** Lecturer: **Roberto Bruni** [[http://www.di.unipi.it/~bruni|web]], **Filippo Bonchi** Other resources: [[https://teams.microsoft.com/l/team/19%3AC66XUZJECgys8E7GSFEGLCYhBGIBtw3nGAEb5ndsvuI1%40thread.tacv2/conversations?groupId=083da95a-18f3-4d3e-bd49-d3c1c9e0db3d&tenantId=c7456b31-a220-47f5-be52-473828670aa1|Microsoft Teams]] Office hours: **Thursday 15:00-18:00** ---- ==== Objectives ==== 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. ---- ==== 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: * Roberto Bruni, Ugo Montanari, "[[http://www.springer.com/978-3-319-42898-7|Models of Computation]]", Springer Texts in Computer Science, 2017. Other readings: * Graham Hutton, "[[http://www.cs.nott.ac.uk/~pszgmh/pih.html|Programming in Haskell]]", 2nd edition, Cambridge University Press (2016). Chapters: 1-8, 14, 15. * Joe Armstrong, [[https://pragprog.com/titles/jaerlang2/programming-erlang-2nd-edition/|Programming Erlang]], 2nd edition. The Pragmatic Bookshelf (2013). Chapters: 1-5, 8, 10-12. * Caleb Doxsey, [[http://shop.oreilly.com/product/0636920046516.do|Introducing Go]], O'Reilly Media (2016). Chapters: 1-4, 6-7, 10. * Robin Milner, "[[https://books.google.it/books/about/Communication_and_Concurrency.html?id=QPyyQgAACAAJ&redir_esc=y|Communication and Concurrency]]", Prentice Hall (1989). Chapters: 1-7, 10. * Luca Aceto, et al, "[[https://www.cambridge.org/core/books/reactive-systems/9B91FFD3996FC77D7AF0C309F8EE4CF7#|Reactive Systems]]", Cambridge University Press (2011). Chapters: 1-7. * Jane Hillston, [[http://www.dcs.ed.ac.uk/pepa/book.pdf|A Compositional Approach to Performance Modelling]], Cambridge University Press (1996). Chapters 1-3. External resources: * [[https://www.haskell.org/|Haskell]] * [[http://www.erlang.org/|Erlang]] * [[http://golang.org/|Google Go]] * [[http://caal.cs.aau.dk/|CAAL]] * [[http://www.dcs.ed.ac.uk/pepa/|PEPA]] ---- ==== Exam ==== The evaluation will be solely based on oral exams, which can involve the assignment of written exercises. Registration to exams (mandatory): [[https://esami.unipi.it/esami/|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. ---- ==== Announcements ==== * As the course starts:\\ Each student must subscribe the [[https://teams.microsoft.com/l/team/19%3AC66XUZJECgys8E7GSFEGLCYhBGIBtw3nGAEb5ndsvuI1%40thread.tacv2/conversations?groupId=083da95a-18f3-4d3e-bd49-d3c1c9e0db3d&tenantId=c7456b31-a220-47f5-be52-473828670aa1|Microsoft Teams channel]] of the course and then fill the form [[https://forms.office.com/e/t0vmX0yf7B|Students information]] to provide the following contact data and info about her/his background: - **first name** - **last name** - enrolment number (numero di matricola), optional - **email** - **bachelor degree** (course of study and university) - **MSc course** (if Computer Science, specify which curriculum) * then, fill the (optional) form about your familiarity with some of the subjects of the course: [[https://forms.office.com/e/HrcJK4etV0|Familiar subjects]] ---- ==== Lectures (1st part) ==== [[https://teams.microsoft.com/l/team/19%3AC66XUZJECgys8E7GSFEGLCYhBGIBtw3nGAEb5ndsvuI1%40thread.tacv2/conversations?groupId=083da95a-18f3-4d3e-bd49-d3c1c9e0db3d&tenantId=c7456b31-a220-47f5-be52-473828670aa1|Microsoft Teams]]: Additional material is available on Teams. ^ N ^ Date ^^ Time ^ Room ^ Lecture notes ^ Links ^ | 1 | Tue | 16/09 | 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// | | | 2 | Thu | 18/09 | 09:00-11:00 | L1 | 02 - Preliminaries (ctd):\\ //denotational semantics, compositionality principle, normalisation, determinacy, consistency, equivalence, congruence//\\ \\ 03 - Unification:\\ //inference process, signatures, substitutions, most general than relation, unification problem// | | | 3 | Fri | 19/09 | 16:00-18:00 | L1 | 03 - Unification (ctd):\\ //unification problem, most general unifiers, unification algorithm//\\ \\ 04 - Logical systems:\\ //logical systems, derivations, theorems, logic programs, goal-oriented derivations// | | | 4 | | | | | 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// | | | 5 | | | | | Exercises:\\ //induction//\\ \\ 05 - Induction (ctd.):\\ //determinacy of arithmetic expressions, many-sorted signatures, arithmetic and boolean expressions, structural induction over many-sorted signatures, termination of boolean expressions, memories, update operation, operational semantics of commands// | | | 6 | | | | | 05 - Induction (ctd.):\\ //divergence, rule for divergence, limits of structural induction, induction on derivations, rule induction, determinacy of commands// | | | 7 | | | | | 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, consistency of operational and denotational semantics for arithmetic expressions, fixpoint equations// | | | 8 | | | | | 08 - Partial orders and fixpoints:\\ //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// | | | 9 | | | | | Exercises:\\ //induction, termination, determinacy, divergence//\\ \\ 08 - Partial orders and fixpoints (ctd.):\\ //continuity, Kleene's fixpoint theorem, McCarthy's 91 function// | | | 10 | | | | | 08 - Partial orders and fixpoints (ctd.):\\ //recursive definitions of partial functions as logical systems, immediate consequences operator, 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// | | | 11 | | | | | Exercises:\\ //posets//\\ \\ 10 - Consistency:\\ //denotational equivalence, congruence, compositionality principle, consistency of commands, correctness, completeness// | | | 12 | | | | | Exercises:\\ //well-founded recursion, posets, semantics//\\ \\ 11 - Haskell:\\ //an overview//\\ \\ Haskell ghci:\\ //basics, tuples, lists, list comprehension, guards, pattern matching, lambda, partial application, zip, exercises// | | | 13 | | | | | Haskell ghci (ctd):\\ //recursive definitions, tail recursion, let-in, where, map, filter, fixpoint operator// | | | 14 | | | | | Haskell ghci (ctd.):\\ //folds, application, function composition, exercises//\\ \\ 12 - HOFL:\\ //syntax, pre-terms, types, types judgements, type system, type checking, type inference, principal type// | | | 15 | | | | | 12 - HOFL (ctd.):\\ //canonical forms, operational semantics, lazy vs eager evaluation// | | | 16 | | | | | Exercises:\\ //Haskell//\\ \\ 13 - Domain theory:\\ //Integers with bottom, cartesian product, projections// | | | 17 | | | | | 13 - Domain theory (ctd.):\\ //switching lemma, functional domains, lifting, let notation// | | | 18 | | | | | 13 - Domain theory (ctd.):\\ //continuity theorems//\\ \\ 14 - Denotational semantics of HOFL:\\ //definition and examples, type consistency, substitution lemma, compositionality// | | | 19 | | | | | 13 - Domain theory (ctd.):\\ //continuity theorems, apply, fix, curry, uncurry//\\ \\ 14 - Denotational semantics of HOFL (ctd.):\\ //only free variables matters, canonical terms are not bottom//\\ \\ 15 - Consistency of HOFL (ctd.):\\ //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, lifted vs unlifted semantics//\\ \\ Exercises:\\ //HOFL, domains// | | ---- ==== Lectures (2nd part) ==== [[https://teams.microsoft.com/l/team/19%3AC66XUZJECgys8E7GSFEGLCYhBGIBtw3nGAEb5ndsvuI1%40thread.tacv2/conversations?groupId=083da95a-18f3-4d3e-bd49-d3c1c9e0db3d&tenantId=c7456b31-a220-47f5-be52-473828670aa1|Microsoft Teams]]: Additional material is available on Teams. ^ N ^ Date ^^ Time ^ Room ^ Lecture notes ^ Links ^ | 20 | | | | | Exercises:\\ //HOFL, domains//\\ \\ 16 - Erlang:\\ //an overview// | | | 21 | | | | | 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:\\ //Introduction to concurrency// | | | 22 | | | | | 17 - CCS (ctd.)\\ //Syntax, operational semantics, value passing, finitely branching processes, guarded processes// | | | 23 | | | | | 18 - Bisimulation:\\ //abstract semantics, graph isomorphism, trace equivalence, bisimulation game, strong bisimulation// | | | 24 | | | | | 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, strong bisimilarity as a fixpoint, Phi operator, Phi is monotone, Phi is continuous (on finitely branching processes)// | | | 25 | | | | | 18 - Bisimulation (ctd.):\\ //Guarded processes (again, from Lecture 17), 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//\\ \\ 21 - CCS at work:\\ //modelling imperative programs with CCS// | | | 26 | | | | | 21 - CCS at work (ctd.) :\\ //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) | | | 27 | | | | | Exercises:\\ //Erlang, CCS//\\ \\ 22 - Temporal and modal logics:\\ //linear temporal logic (LTL), linear structures models, shifting, LTL satisfaction, equivalence of formulas, automata-like models// | | | 28 | | | | | 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, invariant properties, possibly properties, mu-calculus with labels// | | | 29 | | | | | 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// | | | 30 | | | | | 24 - Pi-calculus:\\ //name mobility, free names, bound names, syntax and operational semantics, scope extrusion, early and late bisimilarities, weak semantics// | | | 31 | | | | | 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, next state probability, ergodic DTMC, steady state distribution, finite path probability// | | | 32 | | | | | 25 - Measure theory and Markov chains (ctd):\\ //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, probabilistic reactive systems, bisimilarity for reactive systems, Larsen-Skou logic// | | | 33 | | | | | 27 - PEPA:\\ //motivation, basic ideas, PEPA workflow, PEPA syntax, cooperation combinator, bounded capacity, apparent rate, PEPA operational semantics, performance analysis, reward structures// | | | 34 | | | | | Exercises:\\ //Markov chains, probabilistic systems, PEPA// | | | 35 | | | | | Exercises:\\ //Samples from exam exercises// | | | 36 | | | | | Mini-projects:\\ //discussion// | | | End | | | | | | | ---- ==== Past courses ==== * [[magistraleinformatica:psc:|PSC (A.A. 2024/25)]] * [[magistraleinformatica:psc:2023-24:|PSC (A.A. 2023/24)]] * [[magistraleinformatica:psc:2022-23:|PSC (A.A. 2022/23)]] * [[magistraleinformatica:psc:2021-22:|PSC (A.A. 2021/22)]] * [[magistraleinformatica:psc:2020-21:|PSC (A.A. 2020/21)]] * [[magistraleinformatica:psc:2019-20:|PSC (A.A. 2019/20)]] * [[magistraleinformatica:psc:2018-19:|PSC (A.A. 2018/19)]] * [[magistraleinformatica:psc:2017-18:|PSC (A.A. 2017/18)]] * [[magistraleinformatica:mod:|MOD (A.A. 2016/17)]] * [[magistraleinformatica:mod:2015-16:|MOD (A.A. 2015/16)]] * [[magistraleinformatica:mod:2014-15:|MOD (A.A. 2014/15)]] * [[magistraleinformatica:mod:2013-14:|MOD (A.A. 2013/14)]] ----