CS 456: Programming Languages

Meeting Time

Monday, Wednesday, Friday: 10:30 - 11:20
LWSN B134

Instructor

Suresh Jagannathan
LWSN 3154J
Ph: x4-0971
email: suresh@cs.purdue.edu
Office Hours: Tuesday, Thursday: 3–4pm

Teaching Assistant

Swarn Priya
email: priyas@purdue.edu
Office Hours: Monday: 12–1pm

Course Overview

The field of programming languages is as old as computing itself, and is central to the way we transform abstract algorithmic notions to concrete executable plans. While some aspects of language design entail issues related to choice of syntax (e.g., Lisp), contain features that are only relevant to the specific domains in which the language is intended to operate (e.g., Cuda), or are centered around particular methdologies the language designer wishes to promote (e.g., Javascript), other aspects of the study of programming languages are more universal, concerned with exploring foundational questions. That is, beyond thinking of programming languages in terms of qualitative judgments (why is language X better to write programs in than language Y ?), we might pursue a more substantive line of inquiry centered around notions of semantics and correctness - how can we best describe what a program does or means, without injecting subjective bias into our characterization; and, how do we ascertain from this description, assurance that any execution of this program will be faithful to the intent of the developer? Surprisingly, answers to these questions can often be pursued without appealing to specific syntactic forms or any particular design features.

More generally, these questions broadly fall under the term formal methods, an important branch of computer science that looks to mathematics (specifically, logic) to help us (at least in this class) precisely reason about programming language features and behaviors. Our focus will be to explore core ideas in programming languages from a rigorous, foundational, and principled perspective enabled by couching programming language concepts and the vocabulary we use to reason about them in terms of well-defined mathematical objects (e.g., sets, functions, relations) and associated reasoning strategies (e.g., induction). To do so, we will undertake our study using small language definitions (program calcuii), sufficiently expressive to serve as a useful object of study, but not burdened with features that while perhaps necessary for real-world implementations, are semantically uninteresting.

The course will be centered around the use of tools (proof assistants, model checkers, type systems) that enable better understanding of how we might design, specify, and implement language features. We will also use these tools to help us think about how to gain stronger assurance and confidence that the programs we write do what we expect them to do.

From the above description, you can conclude that this course will not be a survey of existing languages or a taxonomy of language constructs. Neither will it be a course on programming or software engineering per se>. Instead, the course will be structured to allow us to explore new ways to understand programming languages generally that help us to answer questions such as the following:

  1. What is a program specification and what role do specifications play in program construction and reliability?
  2. What does program verification mean?
  3. What are sensible and tractable notions of program correctness? What are the conditions under which we can assert that a program is “safe”?
  4. How do we prove useful properties about a program; what do we mean by a proof in this context?
  5. How do we qualify the “expressive power” of a language feature? How do we relate different features found in different languages?
  6. What is a type and how can they be used to reason about program correctness?
  7. How foundationally different are various methodologies espoused by different languages (e.g., object-oriented, functional, imperative)?
  8. How do we reason about the equivalence of programs, or programs and their compiled translation?
  9. What tools can we bring to bear to help automate the way we reason about a program’s behavior?

To help answer these questions, the course is designed around several interleaved themes: (1) the role of logic and related mathematical formalisms in programming language specification and design; (2) formal reasoning devices that precisely explain the meaning of programming language features and program executions; (3) the use of types to define and specify safety conditions on program executions, and to enrich language expressivity; (4) characterization of different notions of correctness and development of mechanisms to verify that programs are correct with respect to their specification; (5) the use of automated tools (e.g., proof assistants, program verifiers) to help validate important theorems that describe useful properties based on the structure of (2) and (3), using techniques enabled by (1).

By the end of the class, students should be comfortable with objectively assessing and comparing superficially disparate language features, understanding how these features impact implementations, be able to distinguish concepts that are truly foundational from those that just appear to be, and be able to critically reason about program correctness and safety. Most importantly, the overarching goal of this course is to equip students to ask better questions about language design, even if the answers themselves are not readily apparent.

Prerequistes

It is assumed that students taking this class would have had exposure to an undergraduate software engineering and/or compilers class, and be comfortable with basic mathematical concepts, and software implementation techniques. There will be a number of programming exercises in the class, but no prior background in any specific programming language is necessary.

Academic Honesty

Students are encouraged to work together to clarify issues presented in class. However, students are not allowed to collaborate on programming assignments or examinations.

Grading

Grading for the class is as follows:

  1. Scribe: 20%
  2. Homeworks: 30%
  3. Midterm: 25%
  4. Final: 25%

A pair of scribes will be appointed for every topic, which may span two to three classes. The role of the scribes is to summarize and clarify the lectures, and transcribe this summary into a form suitable for posting on the course web-site. Scribes will be expected to research the topic beyond what is discussed in lecture; an implicit goal of this class is to foster intellectual creativity and curiosity and to improve communication and exposition skills - the scribe process gives students an opportunity to explore a topic in greater depth and to share their understanding with other members of the class.

There will also be a number of homework assignments given throughout the semester; these will typically be due two weeks after posting.

Text

We will use the online textbook Software Foundations, available here for part of the course. Students should download the text, and install the Coq mechanized proof assistant (see here).

In fact, the textbook is essentially one large Coq program, with explanation provided in comments, so students are encouraged to bring their laptops to class to interactively explore the material along with the instructor.

In addition, students might find the following texts also useful:

Topics

Foundations

Specifications, Semantics, and Verification

Types

Lectures

August 20 - 24, 2018
  1. Introduction
  2. Basics.v
August 27 - 31, 2018
  1. Induction.v
  2. Lists.v
  3. Poly.v
  4. Homework 1. Due: Sept. 5, 2018
September 3 - 7, 2018
  1. Poly.v
  2. Scribe Notes: 1.
September 10 - 14, 2018
  1. Tactics.v
  2. Logic.v
  3. Homework 2. Due: Sept. 17, 2018
September 17 - 21, 2018
  1. Logic.v
  2. IndProp.v
  3. Homework 3. Due: Sept. 24, 2018
September 24 - 28, 2018
  1. Maps.v
  2. Imp.v
October 1 - 5, 2018
  1. Imp.v
  2. Scribe Notes: 2.
  3. Homework 4. Due: October 8, 2018
October 8 - 12, 2018
  1. Imp.v
  2. Midterm exam
October 15 - 19, 2018
  1. Equiv.v
October 22 - 26, 2018
  1. Hoare.v
  2. Homework 5. Due: October 29, 2018
October 29 - November 2, 2018
  1. Hoare.v
  2. Hoare2.v
  3. Scribe Notes: 3.
  4. Homework 6. Due: Nov. 5, 2018
November 5 - November 9, 2018
  1. Dafny
  2. Getting Started with Dafny
  3. Homework 7.
November 12 - November 16, 2018
  1. Dafny (cont.)
  2. Smallstep.v.
  3. Types.v.
  4. Scribe Notes: 4.
November 19 - November 23, 2018
  1. Dafny (cont.)
  2. Types.v.
November 19 - November 23, 2018
  1. Simply-Typed Lambda Calculus.v.
  2. More Simply-Typed Lambda Calculus.v.