Class Logs and Required Readings
The cited references can be found in the Readings section.
Date | Topics | Readings |
---|---|---|
08/24/06 |
Introduction and syllabus overview. Main aspects of programming languages: syntax and semantics. Examples of syntax and semantics in natural languages. The case for formal semantics of PLs. Examples of how different semantics affect the equivalence or inequivalence of two program fragments. Perceived disadvantages of formal semantics. Advantages of formal semantics in implementation, verification and design of PLs. Brief overview of three major styles of formal semantics: operational, axiomatic and denotational. |
- Chap. 1 of [Win]
- Chap. 11-16 of [Nis] (optional) |
08/29/06 |
Concrete and abstract syntax. Examples of concrete grammars and parse trees. Examples of abstract grammars and abstract syntax trees. IMP, a simple imperative language. IMP's syntactical categories. IMP's abstract syntax. IMP's intuitive computational model. IMP's formal model: IMP's operational semantics. Main mathematical objects of IMP's operational semantics: states, configurations, the evaluation relation ->. Introduction to derivation rules, derivation systems, and definition of derivability. |
- Chap. 2 of [Win]
- Chap. 1-4,10 of [Aab] - [Leav] (optional) |
08/31/06 |
Formal definition of the evaluation relation -> for expressions. Axioms and derivation rules for arithmetic expressions. Rule instances and derivations. Examples of derivations and derivation trees. Equivalence relation ~ over arithmetic expressions. Proof that ~ is an equivalence relation. Formal definition of the evaluation relation -> for Boolean expressions. Alternative rules for boolean expressions: left-first sequential semantics of the conjunction and disjunction operator. |
- Chap. 2 of [Win] |
09/05/06 |
Axioms and derivation rules for commands. Formal definition of the evaluation relation -> for commands. Rule instances and derivations. Equivalence relation over commands. Examples of equivalent commands. Introduction to OCaml. The OCaml interactive compiler. Basic types and tuple types. Evaluating OCaml expressions. Declaring values and functions. |
- Class examples in Readings - Up to Functions section of [Smi] in OCaml - Chap. 1-3 of [Hic] in OCaml |
09/7/06 |
More on OCaml. Pattern matching. Scoping, the let construct. Function definitions. Defining functions by cases with pattern matching. Recursive functions. Alternative syntax for function declarations. Multi-argument functions. Higher-order functions. Lists. Polymorphic functions over lists. Algebraic data types in OCaml. Recursive functions over algebraic data types. |
- Class examples in Readings - Up to Declared Types section of [Smi] in OCaml - Chap. 4-6 of [Hic] in OCaml |
09/12/06 |
Equivalence of IMP commands.
Example of an equivalence proof. A definition of the IMP language in terms of OCaml algebraic data types. An OCaml implementation of IMP's operational semantics. |
- Chap. 2 of [Win] - Class examples in Readings - Up to Declared Types section of [Smi] in OCaml - Chap. 4-6 of [Hic] in OCaml |
09/14/06 |
Discussion of Homework 1 and its solutions. Induction. The principle of mathematical induction. Course-of-values induction. Structural induction. Examples of proofs by structural induction. Formalization of termination for IMP commands. Examples of claims over commands not provable by structural induction. Well-founded relations. Examples of well-founded relations. |
- Chap. 3 of [Win] |
09/19/06 |
More examples of well-founded relations. The general principle of well-founded induction. Other forms of induction as special cases of well-founded induction. A proof of command termination by well-founded induction. Derivations as syntactic structures. Induction on derivations. Induction on derivations as a special case of structural induction. The general principle of rule induction. Example of a proof by rule induction. |
- Chap. 3, 4 of [Win] |
09/21/06 |
The general and the special principle of rule induction.
A proof by rule induction on commands. R-closed sets. Examples. Properties of R-closed sets. The R^ operator. Examples of R^ operators. |
Chap. 4 of [Win] |
09/26/03 |
Properties of the R^ operator.
Fixpoints and least fixpoints of R^.
Related theorems and proofs. Introduction to Denotational Semantics. Motivation and main idea. The denotational semantics of IMP. Definition of the denotations of Aexp. Arithmetic expressions as total functions from states to numbers. |
Chap. 5 of [Win] |
09/28/06 |
Definition of the denotations of Bexp. Boolean expressions as total functions from states to truth values. Definition of the denotations of Comm. Commands as partial functions from states to states. Main issues in defining the denotation of while commands. The denotation of while commands seen as a solution of a recursive equation of the form &phi = &Gamma(&phi). The operator &Gamma defined in terms of a system of rules. The while command as the least fixpoint of Γ. |
Chap. 5 of [Win] |
10/03/06 |
Detailed example justifying the choice of the denotational semantics of while loops as a least fix point.
Equivalence of the operational and denotational semantics of IMP. Proof of equivalence for boolean expressions. |
Chap. 5 of [Win] |
10/6/06 |
Equivalence of the operational and denotational semantics of IMP.
Proof of equivalence for commands. Introduction to axiomatic semantics. Use of axiomatic semantics to specify future programs (programming by refinement). Use of axiomatic semantics to verify the correctness of existing programs. Partial correctness vs. total correctness. |
Chap. 5, 6 of [Win] |
10/10/06 |
Axiomatic semantics of IMP. The language of assertions and of partial correctness assertions. Integer variables and quantifiers. Free/bound occurrences of variables in assertions. Examples of partial correctness assertions and their informal semantics. Semantics of assertions. The meaning of arithmetic expressions with integer variables. The satisfiability relation |=^I for assertions. Validity of assertions. The satisfiability relation |=^I for partial correctness specifications ({A}c{b}). Validity of partial correctness specifications. Examples of satisfiable/valid/invalid assertions. Examples of satisfiable/valid/invalid partial correctness specifications. |
Chap. 6 of [Win] |
10/12/06 |
The role of integer variables in assertions.
Examples. The dual role of axiomatic semantics as a specification and as a verification framework. The complete set of Hoare rules. Invariants for the while rule. |
Chap. 6 of [Win] |
10/17/06 | Examples of derivations in Hoare logic. | Chap. 6 of [Win] |
10/19/06 | Midterm | See Exams section. |
10/24/06 |
Soundness and completeness of Hoare rules.
Proof of soundness. Discussion of Homework 4. |
Chap. 6 of [Win] |
10/26/06 |
Soundness and completeness of Hoare rules.
A sketch of the completeness proof based on weakest preconditions. Discussion of the midterm. |
[Nec05] |
10/30/06 |
Computing verification conditions that approximate weakest preconditions. Converting Hoare triples into verification conditions. Alternatives: user-provided invariants, finite unrollings of loops. Examples. Introduction to type systems and static typing. |
[Nec05] |
11/02/06 |
The untyped Lambda Calculus. Introduction and motivation. Syntax of λ-terms. Binding, scope, free and bound variables. Substitutions. Reductions rules. Examples of reductions. Defining Booleans and integers as λ-terms. |
- Sect. 1-2 of [Pie95] - Chap. 5 of [Pie] |
11/07/06 | No class. | |
11/14/06 |
More on the untyped Lambda Calculus. Examples of combinators implementing the booleans and the natural numbers: boolean functions, Church numerals and arithmetic functions. Examples of β-reductions of expressions over these combinators. The Y combinator for the definition of recursive functions. Confluence of the β-reduction relation. β-equivalence of λ-terms. Reduction strategies. Normal order vs. applicative order. |
- Sect. 1-2 of [Pie95] - Chap. 5 of [Pie] |
11/16/06 |
Examples of β-reduction using various strategies: normal order, call-by-value, call-by-name, call-by-need.
Discussion of how these strategies relate to parameter passing mechanisms in real programming languages. Introduction to typed languages and formal type systems. Motivation. The importance of type safety. Advantages and disavantages of typing. |
- Chap. 5 of [Pie] - Sec. 1-2 of [Car95] |
11/09/06 |
The Simply Typed Lambda Calculus.
Basic types, function types and product types.
Typing judgments and typing rules for system F_1. Well-typed expressions. Type preservation properties of the calculus. |
- Chap. 8-9 of [Pie] - Sec. 3 of [Car95] |
11/21/06 | Thanksgiving Break. | |
11/23/06 | Thanksgiving Break. | |
11/28/06 |
Brief discussion of Homework 5. Extending the Simply Typed Lambda Calculus. From product types to record types. Sum types. The Unit type. Static and dynamic semantics of the extended language. Motivation and parallels with common programming languages. |
- Chap. 11 of [Pie] - Sec. 3 of [Car95] |
11/20/06 |
Adding imperative features to the simply typed lambda calculus: references and commands. Motivation and comparison with common programming languages. Extension of the static and dynamic semantics. |
- Chap. 13 of [Pie] |
12/05/06 |
Defining recursive functions to the simply typed lambda calculus.
Comparisons with the untyped calculus. Adding exceptions. Static and dynamic semantics extensions. Needed adjustments to the preservation and progress theorems. Subtypes. Motivation and relations with common programming languages. The subtyping relation. Subtyping for records. |
- Chap. 14-15 of [Pie] |
12/07/06 |
More on subtyping. Extending the subtyping relation with respect to function, tuple, record, list and reference types. |
- Chap. 15 of [Pie] |