Preface
(* $Date: 2012-07-23 16:26:25 -0400 (Mon, 23 Jul 2012) $ *)
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 functional
    programming, logic, operational semantics, lambda-calculus, and
    static type systems, using the Coq proof assistant.  
 
    The main novelty of the course is that the development is
    formalized and machine-checked: the text is literally a script for
    the Coq proof assistant.  It is intended to be read hand-in-hand
    with the accompanying Coq source file in an interactive session
    with Coq.  All the details of the lectures are fully developed in
    Coq, and the exercises are designed to be worked using Coq.
 
    The files are organized into a sequence of core chapters, covering
    about one semester's worth of material and organized into a
    coherent linear narrative, plus several "appendices" covering
    additional topics. 
Overview
-  Logic as the mathematical basis for software engineering:
logic calculus -------------------- = ---------------------------- software engineering mechanical/civil engineeringIn particular, inductively defined sets and relations and inductive proofs about them are ubiquitous in all of computer science. The course examines them from many angles.
-  Functional programming, an increasingly important part of
    the software developer's bag of tricks:
-  Advanced programming idioms in mainstream software
         development methodologies are increasingly incorporating
         ideas from functional programming.
-  In particular, using persistent data structures and avoiding
         mutable state enormously simplifies many concurrent
         programming tasks.
 
-  Advanced programming idioms in mainstream software
         development methodologies are increasingly incorporating
         ideas from functional programming.
-  Foundations of programming languages (the second part of the
    course):
-  Notations and techniques for rigorously describing and
          stress-testing new programming languages and language
          features.  (Designing new programming languages is a
          surprisingly common activity!  Most
          large software systems include subsystems that are basically
          programming languages — think of regular expressions,
          command-line formats, preference and configuration files,
          SQL, Flash, PDF, etc., etc.)
-  A more sophisticated understanding of the everyday tools
          used to build software... what's going on under the hood of
          your favorite programming language.
 
-  Notations and techniques for rigorously describing and
          stress-testing new programming languages and language
          features.  (Designing new programming languages is a
          surprisingly common activity!  Most
          large software systems include subsystems that are basically
          programming languages — think of regular expressions,
          command-line formats, preference and configuration files,
          SQL, Flash, PDF, etc., etc.)
-  Coq, an industrial-strength proof assistant:
- Proof assistants are becoming more and more popular in both software and hardware industries. Coq is not the only one out there, but learning one thoroughly will give you a big advantage in coming to grips with another.
 
Chapter Dependencies
Required Background
Coq
- a simple and slightly idiosyncratic (but, in its way, extremely expressive) programming language, together with
- a set of tools for stating logical assertions (including assertions about the behavior of programs) and marshalling evidence of their truth.
System Requirements
- A current installation of Coq, available from the Coq home page. (Everything is known to compile with 8.3.)
-  An IDE for interacting with Coq.  Currently, there are two choices:
- Proof General is an Emacs-based IDE. It tends to be preferred by users who are already comfortable with Emacs. It requires a separate installation (google "Proof General").
- CoqIDE is a simpler stand-alone IDE. It is distributed with Coq, but on some platforms compiling it involves installing additional packages for GUI libraries and such.
 
Access to the Coq files
        http://www.cis.upenn.edu/~bcpierce/sf   
    If you are using the notes as part of a class, you may be given
    access to a locally extended version of the files, which you
    should use instead of the release version.
Exercises
-  One star: easy exercises that for most readers should take
         only a minute or two.  None of these are explicitly marked
         "Recommended"; rather, all of them should be considered as
         recommended: readers should be in the habit of working them
         as they reach them.
-  Two stars: straightforward exercises (five or ten minutes).
-  Three stars: exercises requiring a bit of thought (fifteen 
         minutes to half an hour).
- Four stars: more difficult exercises (an hour or two).
Translations
- http://proofcafe.org/sf