Library UseTactics
UseTactics: Tactic Library for Coq: A Gentle
Introduction
Coq comes with a set of builtin tactics, such as reflexivity, intros, inversion and so on. While it is possible
to conduct proofs using only those tactics, you can significantly
Library UseAuto
UseAuto: Theory and Practice of Automation in
Coq Proofs
In a machine-checked proof, every single detail has to be justified. This can result in huge proof scripts.
Fortunately, Coq comes with a proof-search mechanism and with several deci
Library Types
Types: Type Systems
Require Export Smallstep.
Our next topic, a large one, is type systems - static program analyses that classify expressions according
to the "shapes" of their results. We'll begin with a typed version of a very simple lang
Library Typechecking
MoreStlc: A Typechecker for STLC
Require Export Stlc.
The has_type relation of the STLC defines what it means for a term to belong to a type (in some context).
But it doesn't, by itself, tell us how to check whether or not a term is w
Library Sub
Sub: Subtyping
Require Export MoreStlc.
Concepts
We now turn to the study of subtyping, perhaps the most characteristic feature of the static type systems
of recently designed programming languages and a key feature needed to support the objec
Library Stlc
Stlc: The Simply Typed Lambda-Calculus
Require Export Types.
The Simply Typed Lambda-Calculus
The simply typed lambda-calculus (STLC) is a tiny core calculus embodying the key concept of
functional abstraction, which shows up in pretty much e
Library Smallstep
Smallstep: Small-step Operational Semantics
Require Export Imp.
The evaluators we have seen so far (e.g., the ones for aexps, bexps, and commands) have been formulated
in a "big-step" style - they specify how a given expression can be ev
Library SfLib
SfLib: Software Foundations Library
Here we collect together several useful definitions and theorems from Basics.v, List.v, Poly.v, Ind.v, and
Logic.v that are not already in the Coq standard library. From now on we can Import or Export this
Library Rel
Rel: Properties of Relations
Require Export SfLib.
A (binary) relation is just a parameterized proposition. As you know from your undergraduate discrete
math course, there are a lot of ways of discussing and describing relations in general - w
Library References
References: Typing Mutable References
Require Export Smallstep.
So far, we have considered a variety of pure language features, including functional abstraction, basic
types such as numbers and booleans, and structured types such as rec
Library RecordSub
RecordSub: Subtyping with Records
Require Export MoreStlc.
Core Definitions
Syntax
Inductive ty : Type :=
| TTop : ty | TBase : id ty | TArrow : ty ty ty
| TRNil : ty |
TRCons : id ty ty ty. Tactic Notation "T_cases" tactic(first) ident(
Library Records
Records: Adding Records to STLC
Require Export Stlc.
Adding Records
We saw in chapter MoreStlc how records can be treated as syntactic sugar for nested uses of products.
This is fine for simple examples, but the encoding is informal (in re
Library Prop
Prop: Propositions and Evidence
Require Export Poly.
In previous chapters, we have seen many examples of factual claims (propositions) and ways of
presenting evidence of their truth (proofs). In particular, we have worked extensively with equ
Library Preface
Preface
This electronic book is a one-semester course on Software Foundations - the mathematical theory of
programming and programming languages - suitable for graduate or upper-level undergraduate students.
It develops basic concepts of f
Library Poly
Poly: Polymorphism and Higher-Order
Functions
Require Export Lists.
Polymorphism
Polymorphic Lists
Up to this point, we've been working with lists of numbers. Of course, interesting programs also need to
be able to manipulate lists whose elem
Library PE
PE: Partial Evaluation
Equiv.v introduced constant folding as an example of a program transformation and proved that it
preserves the meaning of the program. Constant folding operates on manifest constants such as ANum
expressions. For example,
Library Norm
Norm: Normalization of STLC
Require Import Stlc.
(This chapter is optional.) In this chapter, we consider another fundamental theoretical property of the
simply typed lambda-calculus: the fact that the evaluation of a well-typed program is gu
Library MoreStlc
MoreStlc: More on the Simply Typed LambdaCalculus
Require Export Stlc.
Simple Extensions to STLC
The simply typed lambda-calculus has enough structure to make its theoretical properties interesting, but
it is not yet much of a programming
Library Logic
Logic: Logic in Coq
Require Export "Prop".
Coq's built-in logic is extremely small: only Inductive definitions, universal quantification ( ), and
implication () are primitive, while all the other familiar logical connectives - conjunction, d
Library Lists
Lists: Working with Structured Data
The next line imports all of our definitions from the previous chapter.
Require Export Basics.
For it to work, you need to use coqc to compile Basics.v into Basics.vo. (This is like making a .class file
fr
Library LibTactics
LibTactics: A Collection of Handy GeneralPurpose Tactics
This file contains a set of tactics that extends the set of builtin tactics provided with the standard
distribution of Coq. It intends to overcome a number of limitations of the s
Software Foundations
Benjamin C. Pierce Chris Casinghino Michael Greenberg Ctlin Hricu Vilhelm Sjberg Brent
Yorgey
with Loris d'Antoni, Andrew W. Appel, Arthur Chargueraud, Anthony Cowley, Jeffrey Foster,
Michael Hicks, Ranjit Jhala, Greg Morrisett, Mukun
Library ImpParser
ImpParser: Lexing and Parsing in Coq
The development of the Imp language in Imp.v completely ignores issues of concrete syntax - how an
ascii string that a programmer might write gets translated into the abstract syntax trees defined by
Library ImpCEvalFun
ImpCEvalFun: Evaluation Function for Imp
Evaluation Function
Require Import Imp.
Here's a first try at an evaluation function for commands, omitting WHILE.
Fixpoint ceval_step1 (st : state) (c : com) : state := match c with | SKIP =>
s
Library Imp
Imp: Simple Imperative Programs
In this chapter, we begin a new direction that will continue for the rest of the course. Up to now we've
been mostly studying Coq itself, but from now on we'll mostly be using Coq to formalize other things.
Our
Library HoareList
HoareList: Hoare Logic with Lists
Require Export SfLib.
Imp Programs with Lists
There are only so many numeric functions with interesting properties that have simple proofs. (Of course,
there are lots of interesting functions on numbers
Library HoareAsLogic
HoareAsLogic: Hoare Logic as a Logic
Require Export Hoare.
The presentation of Hoare logic in chapter Hoare could be described as "model-theoretic": the proof rules
for each of the constructors were presented as theorems about the eva