MPRI Functional Programming project, whose subject can be found [here](https://gitlab.inria.fr/fpottier/mpri-2.4-public/blob/master/project/sujet.pdf)
Find a file
François Pottier 4de6bf8544 README update.
2017-12-13 14:08:29 +01:00
coq Add a demo of equational reasoning in Coq. 2017-10-20 10:36:47 +02:00
ocaml New OCaml exercise. 2017-10-12 15:40:11 +02:00
projet Publish the project. 2017-12-13 14:04:28 +01:00
slides Slides cours YRG-1. 2017-12-13 10:26:29 +01:00
.gitignore .gitignore. 2017-09-11 10:50:45 +02:00
Makefile Anchor for Lecture 3. 2017-10-29 16:48:50 +01:00
README.md README update. 2017-12-13 14:08:29 +01:00

Functional programming and type systems (2017-2018)

This page supplements the official page of MPRI 2-4.

Location and duration

The lectures take place at University Paris 7 - Denis Diderot, Bâtiment Sophie Germain, in room 2035.

They are scheduled on Fridays from 12:45 to 15:30. There is a 15-minute break in the middle of each lecture.

Teachers

Aims

This course presents the principles and formalisms that underlie many of today's typed functional programming languages. (Here are some introductory slides.)

The course is made up of four parts and can be split after the first two parts.

In the first part, we discuss the operational semantics of functional programming languages, and we present several classic program transformations, including closure conversion, defunctionalization, and the transformation into continuation-passing style (CPS). These program transformations are interesting from two points of view. First, they are useful programming techniques, which can help write or understand programs. Second, they are used in the compilation of functional programming languages, so they help understand what happens when the machine executes a program. We use operational semantics to prove that the meaning of programs is preserved by these transformations. Finally, we suggest how these definitions and theorems can be expressed in a form that a machine can check. That is, although Coq is not a prerequisite of the course, we will at least try to read and understand Coq definitions and statements.

In the second part, we focus on the meta-theoretical properties of type systems. We study parametric polymorphism (as in System F and ML), data types and type abstraction. We show syntactic type soundness (via progress and subject reduction) by reasoning by induction on typing derivations. We also show how to obtain semantic properties via logical relations by reasoning by induction on the structure of types. Finally, we introduce subtyping, row polymorphism, and illustrate the problems induced by side effects (references) and the need for the value restriction.

The third part of the course introduces "rich" type systems designed to guarantee extra properties in addition to safety: principality, information hiding, modularity, extensionality, purity, control of effects, algorithmic invariants, complexity, resource usage, or full functional correctness. The expressivity of these systems sometimes endangers the tractability, or even the feasibility, of type checking and type inference: a common thread between these lectures discusses the tradeoffs made on the design of these systems to balance expressivity and tractability.

The last part focuses on the use of dependent types for programming: effectful programming with monads and algebraic effects; tagless interpreters; programming with total functions; generic programming. We also show the limits of dependently-typed functional programming.

Project

The programming project is now available! The deadline is Friday, February 16, 2018.

Approximate syllabus

Functional Programming: Under the Hood

Metatheory of Typed Programming Languages

Rich types, tractable typing

Dependently-typed Functional Programming

  • Effectful functional programming.
  • Dependent functional programming.
  • Total functional programming.
  • Generic functional programming.
  • Open problems in dependent functional programming.

Evaluation of the course

Two written exams (a partial exam on Friday Dec 1 and a final exam) and one programming project or several programming exercises are used to evaluate the students that follow the full course. Only the partial exam will count to grade students who split the course.

Only course notes and hand written notes are allowed for the exams.

Although the course has changed, you may still have a look at previous exams available with solutions:

Please install opam first.

Then, install OCaml 4.0x and Coq 8.5 via the following commands:

opam init --comp=4.05 # for instance
opam repo add coq-released https://coq.inria.fr/opam/released
opam update
opam install -j4 -v coq.8.5.3

(Do not install Coq 8.6. The version of AutoSubst that I am using is not compatible with it. If for some reason you need Coq 8.6, or have already installed Coq 8.6, note that opam switch can be used to let multiple versions of Coq coexist.)

Please also install François Pottier's variant of the AutoSubst library:

git clone git@github.com:fpottier/autosubst.git
make -C autosubst install

In order to use Coq inside emacs, ProofGeneral is highly recommended. Here is a suggested installation script:

rm -rf /tmp/PG
cd /tmp
git clone git@github.com:ProofGeneral/PG.git
cd PG
EMACS=/Applications/Aquamacs.app/Contents/MacOS/Aquamacs
if [ ! -x $EMACS ]; then
  EMACS=emacs
fi
make EMACS=$EMACS compile
TARGET=/usr/local/share/emacs/site-lisp/ProofGeneral
sudo rm -rf $TARGET
sudo mv /tmp/PG $TARGET

Enable ProofGeneral by adding the following line to your .emacs file:

(load-file "/usr/local/share/emacs/site-lisp/ProofGeneral/generic/proof-site.el")

If desired, ProofGeneral can be further customized.

Bibliography

Types and Programming Languages, Benjamin C. Pierce, MIT Press, 2002.

Advanced Topics in Types and Programming Languages, Edited by Benjamin C. Pierce, MIT Press, 2005.