====== Principles for Software Composition ====== {{:magistraleinformatica:psc:psc.png?250 | }} **PSC 2017/18 (375AA, 9 CFU)** Lecturer: **Roberto Bruni**\\ [[http://www.di.unipi.it/~bruni|web]] - [[mailto:bruni@di.unipi.it|email]] - phone 050 2212785 - fax 050 2212726 Office hours: **Wednesday 15:00-17:00 or by appointment** ---- ==== 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: * Jane Hillston, [[http://www.dcs.ed.ac.uk/pepa/book.pdf|A Compositional Approach to Performance Modelling]], Cambridge University Press (1996). Chapters 1-3. * Caleb Doxsey, [[http://shop.oreilly.com/product/0636920046516.do|Introducing Go]], O'Reilly Media (2016). Chapters: 1-4, 6-7, 10. * Joe Armstrong, [[https://pragprog.com/book/jaerlang2/programming-erlang|Programming Erlang]], 2nd edition. The Pragmatic Bookshelf (2013). Chapters: 1-5, 8, 10-12. * 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. * 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. External resources: * [[https://www.haskell.org/|Haskell]] * [[http://www.erlang.org/|Erlang]] * [[http://golang.org/|Google Go]] * [[http://www.dcs.ed.ac.uk/pepa/|PEPA]] * [[http://caal.cs.aau.dk/|CAAL]] * [[http://pseuco.com/|PseuCo]] * [[http://rap.dsi.unifi.it/tapas/en/index.htm|TAPAS]] ---- ==== Exams ==== The evaluation will be based on written and oral exams. The written exam is not necessary if the two (written) mid-terms exams are evaluated positively. * First (written) mid-term exam: **5/4/2018** * Second (written) mid-term exam: **31/5/2018** Registration to written exams (mandatory): [[https://esami.unipi.it/esami/|Exams registration system]] In the written exam the student must demonstrate * knowledge: his/her knowledge of the course material * problem solving: the ability to solve some exercises, and * organisation: the ability to organise an effective and correctly written reply. During the oral exam the student must demonstrate * knowledge: his/her knowledge of the course material, and * understanding: the ability to discuss the reading matter thoughtfully and with propriety of expression. ---- ==== Oral Exams: schedule ==== ^ Date ^^ Time ^ Name ^ | **Day** | **DD/MM** | hh:mm | student | | | | ... | ... | ---- ==== Announcements ==== * **Lectures rescheduled**:\\ Two additional lectures have been scheduled on **wednesday 16/05** and **wednesday 23/05**. Both are **from 9:00 to 11:00 in room L1**. * **Lecture canceled**:\\ The lecture of **thursday 10/05** is canceled for allowing participation to the course on [[ https://www.di.unipi.it/en/phd/phd-teaching/phd-courses?id=1176|Formal Methods for Program Verification]]. * Lecture canceled:\\ The lecture of **friday 27/04** is canceled. It will be rescheduled later on. * Lectures rescheduled:\\ Two additional lectures have been scheduled on **wednesday 21/03** and **wednesday 28/03**. Both are **from 9:00 to 11:00 in room L1**. * Lecture canceled:\\ The lecture of **thursday 01/03** is canceled. It will be rescheduled later on. * Lecture canceled:\\ The lecture of **friday 23/02** is canceled. It will be rescheduled in March. * as the course starts:\\ Each student should send an email to the professor from his/her favourite email account with subject **PSC17-18** and the following data\\ (by doing so, the account will be included in the class mailing-list, where important announcements can be sent): - **first name** and **last name** (please clarify which is which, to avoid ambiguities) - **enrolment number** (numero di matricola) - bachelor degree (**course of study** and **university**) - your favourite topics in computer science (optional) ---- ==== Lectures (1st part) ==== ^ N ^ Date ^^ Time ^ Room ^ Lecture notes ^ Links ^ | 1 | Tue | 20/02 | 14:00-16:00 | L1 | Introduction to the course | | | 2 | Thu | 22/02 | 11:00-13:00 | L1 | Preliminaries:\\ //formal semantics, logical systems, derivations// | | | - | Fri | 23/02 | 14:00-16:00 | C | **Canceled** | | | 3 | Tue | 27/02 | 14:00-16:00 | L1 | Preliminaries:\\ //signatures, unification problem, logic programs\\ goal-oriented derivations// | | | - | Thu | 01/03 | 11:00-13:00 | L1 | **Canceled** (weather condition alert) | | | 4 | Fri | 02/03 | 14:00-16:00 | C | Exercises:\\ //unification, goal-oriented derivations//\\ \\ Induction and recursion:\\ //well-founded relations, well-founded induction, mathematical induction// | | | 5 | Tue | 06/03 | 14:00-16:00 | L1 | Induction and recursion:\\ //proof of induction principle, structural induction,\\ termination of arithmetic expressions, determinacy of arithmetic expressions// | | | 6 | Thu | 08/03 | 11:00-13:00 | L1 | Induction and recursion:\\ //structural induction over many-sorted signatures, termination of boolean expressions,\\ operational semantics of commands, divergence// | | | 7 | Fri | 09/03 | 14:00-16:00 | C | Induction and recursion:\\ //induction on derivations, rule induction, determinacy of commands,\\ well-founded recursion, lexicographic precedence relation, Ackermann function,\\ denotational semantics of arithmetic expressions, fixpoint equations// | | | 8 | Tue | 13/03 | 14:00-16:00 | L1 | Exercises:\\ //induction and recursion, consistency of arithmetic expressions//\\ \\ Partial orders and fixpoints:\\ //partial orders, Hasse diagrams, least upper bound, chains, limits,\\ complete partial orders, bottom element, powerset completeness// | | | 9 | Thu | 15/03 | 11:00-13:00 | L1 | Partial orders and fixpoints:\\ //CPO of partial functions, monotonicity, continuity, Kleene's fixpoint theorem// | | | 10 | Fri | 16/03 | 14:00-16:00 | C | Exercises:\\ //induction, recursion, posets//\\ \\ Partial orders and fixpoints:\\ //immediate consequences operator, denotational semantics of commands// | | | 11 | Tue | 20/03 | 14:00-16:00 | L1 | Partial orders and fixpoints:\\ //fixpoint computation, consistency of commands, semantic equivalence// | | | 12 | Wed | 21/03 | 09:00-11:00 | L1 | Haskell:\\ //an overview//\\ {{ :magistraleinformatica:psc:ghci-session1.txt.zip |ghci session 1}} | [[https://www.haskell.org/|Haskell]] | | 13 | Thu | 22/03 | 11:00-13:00 | L1 | Haskell:\\ //recursion, folds, application, function composition//\\ {{ :magistraleinformatica:psc:ghci-session2.txt.zip |ghci session 2}} | | | 14 | Fri | 23/03 | 14:00-16:00 | C | Haskell:\\ //data types, type classes, recursive data structures, derived instances,\\ IO actions, errors//\\ {{ :magistraleinformatica:psc:ghci-session3.txt.zip |ghci session 3}} | | | 15 | Tue | 27/03 | 14:00-16:00 | L1 | Exercises:\\ //well-founded recursion, posets, denotational semantics, Haskell// | | | 16 | Wed | 28/03 | 09:00-11:00 | L1 | HOFL:\\ //syntax, type system, type checking, type inference, principal type,\\ canonical forms, operational semantics// | | | 17 | Thu | 05/04 | 11:00-13:00 | L1 | {{ :magistraleinformatica:psc:testo-2018-04-05.pdf |First mid-term written exam}}\\ {{ :magistraleinformatica:psc:2018-04-05-appello-straordinario.pdf |Extra-ordinary exam (MOD)}} | | ==== Lectures (2nd part) ==== ^ N ^ Date ^^ Time ^ Room ^ Lecture notes ^ Links ^ | 18 | Thu | 12/04 | 11:00-13:00 | L1 | HOFL:\\ //lazy vs eager evaluation//\\ \\ Domain theory:\\ //Integers with bottom, cartesian product, projections, switching lemma// | | | 19 | Fri | 13/04 | 14:00-16:00 | C | Domain theory:\\ //functional domains, lifting, continuity theorems, apply, fix, let notation//\\ \\ Consistency of HOFL:\\ //Counterexample to completeness// | | | 20 | Tue | 17/04 | 14:00-16:00 | L1 | Denotational semantics of HOFL:\\ //Type consistency, substitution lemma, compositionality and other properties// | | | 21 | Thu | 19/04 | 11:00-13:00 | L1 | Consistency of HOFL:\\ //Correctness of the operational semantics,\\ operational convergence, denotational convergence,\\ operational convergence implies denotational convergence,\\ denotational convergence implies operational convergence (optional),\\ operational and denotational equivalence, correspondence for type int,\\ unlifted semantics// | | | 22 | Fri | 20/04 | 14:00-16:00 | C | Exercises:\\ //HOFL, domains// | | | 23 | Tue | 24/04 | 14:00-16:00 | L1 | Erlang:\\ //an overview//\\ {{ :magistraleinformatica:psc:erl-session.zip |erl session}} | [[http://www.erlang.org/|Erlang]] | | 24 | Thu | 26/04 | 11:00-13:00 | L1 | CCS:\\ //Syntax, operational semantics, abstract semantics, graph isomorphism,\\ trace equivalence, bisimulation game// | | | - | Fri | 27/04 | 14:00-16:00 | C | **Canceled** | | | 25 | Thu | 03/05 | 11:00-13:00 | L1 | CCS:\\ //strong bisimulation, strong bisimilarity, strong bisimilarity is an equivalence// | | | 26 | Fri | 04/05 | 14:00-16:00 | C | CCS:\\ //strong bisimilarity as a fixpoint, finitely branching processes, guarded processes,\\ Knaster-Tarski's fixpoint theorem, Hennessy-Milner logic// | | | 27 | Tue | 08/05 | 14:30-16:00 | L1 | CCS:\\ //strong bisimilarity is a congruence, some equational laws for strong bisimilarity,\\ weak bisimilarity, weak observational congruence, Milner's tau-laws, value passing,\\ modelling with CCS// | | | - | Thu | 10/05 | 11:00-13:00 | L1 | **Canceled**\\ for allowing participation to the course on [[ https://www.di.unipi.it/en/phd/phd-teaching/phd-courses?id=1176|Formal Methods for Program Verification]] | | | 28 | Fri | 11/05 | 14:00-16:00 | C | Exercises:\\ //Erlang, CCS// | | | 29 | Tue | 15/05 | 14:00-16:00 | L1 | CCS:\\ //modelling and playing with CCS (using CAAL)//\\ {{ :magistraleinformatica:psc:examples_caal.zip |CAAL examples}} (copy the text and paste it in the Edit panel) | [[http://caal.cs.aau.dk/|CAAL]]\\ [[http://pseuco.com|PseuCo]]\\ [[http://rap.dsi.unifi.it/tapas/en/index.htm|TAPAS]] | | 30 | Wed | 16/05 | 09:00-11:00 | L1 | Temporal and modal logics:\\ //linear temporal logic (LTL), computational tree logic (CTL* and CTL), mu-calculus// | | | 31 | Thu | 17/05 | 11:00-13:00 | L1 | Temporal and modal logics:\\ //mu-calculus examples//\\ \\ GoogleGo:\\ //an overview//\\ {{ :magistraleinformatica:psc:go-session1.zip |go-session1}} | [[http://golang.org/|Google Go]] | | 32 | Fri | 18/05 | 14:00-16:00 | C | GoogleGo:\\ //an overview//\\ {{ :magistraleinformatica:psc:go-session2.zip |go-session2}}\\ \\ Pi-calculus:\\ //syntax and operational semantics, examples// | | | 33 | Tue | 22/05 | 14:00-16:00 | L1 | Pi-calculus:\\ //abstract semantics, early and late bisimilarities, weak bisimilarities//\\ \\ Exercises:\\ //logics, GoogleGo// | | | 34 | Wed | 23/05 | 09:00-11:00 | L1 | Exercises:\\ //pi-calculus//\\ \\ 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// | | | 35 | Thu | 24/05 | 11:00-13:00 | L1 | Measure theory and Markov chains:\\ // ergodic DTMC and steady state distribution, exponential distribution, CTMC,\\ infinitesimal generator matrix, embedded DTMC,\\ bisimilarity revisited, reachability predicate, CTMC bisimilarity, DTMC bisimilarity// | | | 36 | Fri | 25/05 | 14:00-16:00 | C | Markov chains with actions:\\ //reactive systems, bisimilarity for reactive systems, Larsen-Skou logic//\\ \\ PEPA:\\ //PEPA syntax, apparent rate, PEPA operational semantics,\\ performance analysis// | [[http://www.dcs.ed.ac.uk/pepa/|PEPA]] | | 37 | Tue | 29/05 | 14:00-16:00 | L1 | Exercises:\\ //probabilistic systems// | | | 38 | Thu | 31/05 | 11:00-13:00 | L1 | {{ :magistraleinformatica:psc:testo-2018-05-31.pdf |Second mid-term written exam}} | | | 39 | Wed | 13/06 | 14:00-16:00 | L1 | {{ :magistraleinformatica:psc:testo-2018-06-13.pdf |Exam}} | | | 40 | Wed | 04/07 | 14:00-16:00 | L1 | **Exam** | | | 41 | Wed | 25/07 | 14:00-16:00 | C1 | {{ :magistraleinformatica:psc:testo-2018-07-25.pdf |Exam}} | | | 42 | Tue | 11/09 | 14:00-16:00 | N1 | {{ :magistraleinformatica:psc:testo-2018-09-11.pdf |Exam}} | | | 43 | Wed | 16/01 | 14:00-16:00 | L1 | **Exam** | | | 44 | Wed | 13/02 | 14:00-16:00 | L1 | **Exam** | | ---- ==== Past courses ==== * [[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)]] ----