CAS CS 400
Type Theory and Mechanized Reasoning
Boston University
Spring 2024
This course is an introduction to basic concepts in type theory and mechanized proof as they relate to programming languages, formal verification, mathematics, and philosophy. We will only be able to cover a (biased) selection of rudiments, but the goal is to provide students (you) with the tools to:
- construct formal proofs and typing derivations for a variety of logics and type theories which undergird systems used for large-scale verification tasks;
- prove meta-theoretic properties of type theories (like normalization and soundness) which are core to their utility;
- implement fundamental algorithms for type theories like type-checking and type-inference;
- formalize non-trivial mathematical theorems and properties of programs using Agda;
- prepare for graduate-level courses in formal methods and programming languages;
- think critically about the fundamental question: what is a proof? Does a proof need to be human readable? Does it need to be human understandable? Does it need to be constructive? (What is constructivity?)
Prerequisites: CS131, CS330, CS320 (CS332 is recommended but not required)
Links
Schedule
Topics
What is this course?
Induction and Recursion
- Summary:
- review induction over natural numbers and extend this to induction over inductively-defined sets
- think about what "kind of thing" induction is, and how that will affect our ability to formalize it
- discuss the connection between induction and recursion, with any eye towards how these will relate in Lean
- Reading:
Agda I: An Introduction
- Summary:
- examine at Agda as a function programming language, especially as compared to OCaml (the language of CAS CS 320)
- start looking at dependent types and what we can do with them
- Reading:
Agda II: Dependent Types
Propositional Logic I: An Introduction
- Summary:
- discuss in more detail the standard workflow of Agda
- introduce the syntax and semantics of propositional logic (as well as what exactly these terms mean)
- see how we can use Agda as a framework for implementing propositional logic
- Reading:
- Required:
- Supplementary:
- Required:
Propositional Logic II: Meta-Theory
- Summary:
- dive deeper into pattern matching in Agda, introducing with-abstraction for pattern matching on intermediate computations
- introduce semantic notions in logic, particularly up to the notion of logical equivalence
- Reading:
- Required:
- Supplementary:
- Required:
SAT-Solvers I: An Introduction
- Summary:
- finish discussing semantics notions in propositional logic
- talk about functional completeness and normal forms
- introduce SAT solvers and the DPLL procedure
- Reading:
- Required:
- TTMR 4: Classical Propositional Logic
- 4.5: Conjunctive Normal Form
- TTMR 5: SAT Solvers
- 5.1: Restriction
- 5.2: DPLL
- TTMR 4: Classical Propositional Logic
- Supplementary:
- Required:
SAT-Solvers II: In Practice
- Summary:
- look at a couple encodings of propositions as CNF formulas
- look at an example application of SAT-solvers
- Reading:
- Required:
- TTMR 5: SAT Solvers
- 5.3 CNF Encodings
- 5.4 Example: Sudoku
- TTMR 5: SAT Solvers
- Supplementary:
- Required:
Propositional Proofs
The Lambda Calculus I: An Introduction
- Summary:
- introduce the syntax and semantics of the lambda calculus.
- Reading:
- TTFP 2: Functional Programming and Lambda-Calculi
- 2.2: The untyped lambda-calculus
- 2.3: Evaluation
- TTFP 2: Functional Programming and Lambda-Calculi
The Lambda Calculus II: Meta-Theory
- Summary:
- introduce semantic notions of the lambda calculus, including normalization and evaluation strategies.
- look at how to encode data.
- talk breifly about De Bruijn indices and alpha equivalence.
- Reading:
- TTFP 2: Functional Programming and Lambda-Calculi
- 2.4: Convertibility
- 2.5: Expressiveness
- TTFP 2: Functional Programming and Lambda-Calculi
Simple Types I: An Introduction
- Summary:
- introduce the simply typed lambda calculus (STLC)
- give an outline of the proof that STLC is strongly normalizing
- Reading:
- TTFP 2: Function Programming and Lambda-Calculi
- 2.6: Typed lambda-calculus
- 2.7: Strong normalization
- Strong Normalization for Simply Typed Lambda Calculus (Notes)
- TTFP 2: Function Programming and Lambda-Calculi
Simple Types II: The Curry-Howard Isomorphism
- Summary:
- finish the discussion of strong normalization
- discuss data types in STLC
- connect data types to the Curry-Howard isomorphism
- Reading:
- TTFP 2: Function Programming and Lambda-Calculi
- 2.8: Further type constructors: the product
- 2.9: Base types: natural numbers
- PPA 3.1: The Curry-Howard correspondence: Propositional logic
- TTFP 2: Function Programming and Lambda-Calculi
Agda III: The Proof Assistant
Agda IV: Equational Reasoning
- Summary:
- discuss how to prove complex equalities in Agda
- see many examples in code
- Reading:
- PPA 4: Equational reasoning in Agda (note: we use different syntax, but the ideas transfer)
Case Study I: STLC in Agda
Case Study II: Verified Sorting
Intuitionistic Logic I: An introduction
- Summary:
- introduce a proof system for intuitionistic propositional logic with propositional variables (IPL) as the simply typed lambda calculus with type variables with type variables (STLC) minus the computational content
- introduce a proof system for classical propositional logic (CPL) as IPL plus a variant of proof by contradiction
- look at classical principles which are not intuitionistically provable
- see what is gained by thinking intuitionistically (e.g., the disjunction property)
- Reading:
- please look through the lecture slides
Intuitionistic Logic II: Kripke Semantics
- Summary:
- recall the notions of soundness and completeness
- note that IPL is not complete with respect to valuations
- present Kripke models as an alternative semantics for which IPL is sound and complete
- use Kripke countermodels to prove that some classical principles cannot be proved in IPL
- Reading:
- please look through the lecture slides