## CS252r: Advanced Topics in Programming Languages## Fall 2011: Maxwell Dworkin 323, Mon-Wed-Fri 3-4pm## Greg Morrisett |

## Overview

This semester's version of CS252r will introduce students to techniques for modeling and reasoning about dynamic systems from the point of view of programming languages. By dynamic system, we simply mean any system that is equipped with a notion of states and transitions. Those states and transitions could correspond to a high-level programming language, but they could also be used to model and reason about other kinds of systems, including protocols, distributed systems, etc. We will investigate compositional and scalable methods for modeling systems (i.e., structured operational semantics, denotational semantics, and axiomatic semantics), and techniques for reasoning about the dynamic behavior of such systems.

We will be using the Coq Proof Assistant to construct and reason about our models formally.

The class is intended for graduate students and upper-level undergraduates. There are no formal prerequisites for the class, but if you are not comfortable with functional programming (e.g., CS51) and formal proofs, then the course may not be for you.

## Lecture Notes and Code

- Course Overview: PPTX, PDF
- Big-Step and Small-Step Semantics for IMP: Coqdoc, Source
- Hoare Logic for IMP: Coqdoc, Source
- Simply Typed Lambda Calculus, Coqdoc, Source
- Mixing operational and denotational ideas Coqdoc, Source.
UPDATED! Midterm exercises (Due Oct 21). Coqdoc, Source.- Type Inference: Coqdoc, Source.
- Regular expressions Coqdoc, Source.
- State: Coqdoc, Source.
- Continuations Coqdoc, Source.
- CPS Conversion Coqdoc, Source.
- Exceptions Coqdoc, Source.
- Hoare Type Theory Coqdoc, Source.
- Separation Logic Coqdoc, Source.

## Resources

Students may find the following texts particularly useful for this course:

- Software Foundations by Pierce et al.
- The Formal Semantics of Programming Languages: An Introduction by Glynn Winskel
- Types and Programming Languages by Benjamin C. Pierce.
- Certified Programming with Dependent Types by Adam Chlipala.

## Homework and Grading

The course will include weekly homeworks, mostly done using Coq. It is terribly important that you keep up with these exercises---if you fall behind, I can guarantee that you won't be able to catch up.

Your grade will be based on these homeworks as well as class participation.

## Syllabus

- Introduction to the Coq Proof Assistant Part I
- Programming in Coq's Gallina

- Structured Operational Semantics
- Semantics of Inference Rules
- Small-Step SOS
- Large-Step SOS
- Coinductive Definitions

- Introduction to the Coq Proof Assistant Part II
- Proof terms in Coq
- Tactics and Tacticals

- Basic Denotational Semantics
- Set-theoretic interpretations
- CPOs and fixed-points
- Adequacy of denotational semantics
- Encoding denotational semantics in Coq
- Abstract interpretation

- Axiomatic Semantics
- Hoare logic, partial and total correctness
- Encoding Hoare logic in Coq
- Soundness of Hoare logic
- Weakest pre-conditions, strongest post-conditions
- Relative completeness
- Verification tools

- Simply Typed Lambda Calculus
- Terms, binding, substitution, and alpha-equivalance
- Types and type safety
- Logical relations

- Beyond Simple Types
- Products and sums
- Monads and exceptions
- Lists and other inductive types
- Continuations and other control operators
- Recursive functions
- Recursive types
- State and references
- Threads and synchronization
- Polymorphism
- Subtyping
- Dependent types

- Advanced Reasoning About State
- Separation logic
- Hoare type theory
- Indexed logical relations