CS 15-317: Constructive Logic
(Spring 2012)
|
|
This course is about logics that express algorithms or computations. These
constructive logics permeate Computer Science, both as a foundation
for the discipline and as concrete languages with eminently practical uses.
Indeed, logical languages, tools and methods play an essential role in the
design, specification and verification of computer hardware and software, a
role that is growing as systems become more complex. The course provides a
general exposure to the ideas underlying constructive logic and examines
some specific logics and their applications. It is organized into four parts:
- We begin by giving a basic vocabulary and tool set to talk about logics
(and to a large extent programming languages). This includes the
judgmental infrastructure of rules and derivations, and the elementary
properties that a logical system should have. We use them to study
propositional and predicate logic in their natural deduction and
sequent calculus presentations.
- We then observe that, in some logics, derivations look just like functional
programs, a correspondence known as the Curry-Howard isomorphism. Under this
proof-as-program interpretation, computation is carried out as a form
of proof reduction.
- Next, we show that, in some logics, formulas can themselves be understood
as programs, while proof search is the vehicle of computation. This
formula-as-programs interpretation underlies logic programming. We
examine languages based on both top-down search, such as Prolog
and λ-Prolog, and bottom-up search, e.g., Datalog.
- We dedicate the final weeks of the course to sampling some advanced logics, which
support special purpose forms of computation. These include linear
logic (stateful transformations), lax logic (effectful algorithms),
and authorization logic (security guarantees).
This course is a gateway to the fascinating and multifaceted world of computational logic. If you find it enjoyable, you may also like 15-312 Foundations of Programming Languages (a systematic, logic-based investigation to programming languages), 15-414 Bug Catching: Automated Program Verification and Testing (the use of a logical technique known as model-checking to verify complex systems), and 80-311 Computability and Incompleteness (a study of the logical foundations of Computer Science).
This course targets primarily (but not exclusively) Computer Science undergraduate students in their junior or senior year. To enroll, students must have completed CS 15-212 (Principles of Programming) or received explicit permission from the instructor.
There is no textbook for this class. However, each lecture is covered by a handout or an article (see schedule). Readings are required unless explicitly flagged as optional.
This course assumes proficiency with informal logic and logical reasoning. If you feel you need a review or are otherwise unsure, you may want to read through Discovering Logic, by Iliano Cervesato.
It is my goal to make this course successful, stimulating and enjoyable. If at any time you feel that the course is not meeting your expectations or you want to provide feedback on how the course is progressing for you, please . If you would like to provide anonymous comments, please use the feedback form on the course home page or slide a note under my door. Comments of general interest will be answered on the course discussion board.
We will use several languages and software tools in the various parts of the course.
- Tutch
-
Tutch (short for Tutorial Proof Checker) is a tool that checks the validity of formal proofs that users provide. We will use version 0.52 beta. To run Tutch,
- either install it on your personal computer from the Tutch home page,
- or log on
unix.qatar.cmu.edu
;
- then, type
tutch filename.tut
where filename.tut
contains your proof or proofs.
See the documentation for further information on running Tutch. The examples from the overview are available here.
- Prolog
-
We will gain experience with top-down logic programming using GNU Prolog, version 1.3.0 or later. To run Prolog,
- either install GNU Prolog on your personal computer from the GNU Prolog web site,
- or log on
unix.qatar.cmu.edu
;
- then, type
gprolog
.
Most installations of vim and Emacs have editing modes for Prolog code, but the default is to treat .pl
files as Perl code. To switch to the Prolog mode in vim, use the command :setf prolog
. To switch to the Prolog mode in Emacs, use the command M-x prolog-mode
.
See the GNU Prolog manual for further information.
- Lollibot
-
To explore bottom-up logic programming we will be using Lollibot, a linear logic programming language which is a custom fragment of Ollibot.
Lollibot is installed on unix.qatar.cmu.edu
. You can run it on a file filename.lob
with the command
$ lollibot filename.lob
See the Lollibot primer by William Lovas for a quick introduction. Several examples from lecture are available here.
This is a 9 unit course. It counts as a logic and languages constrained elective.
Tasks and Percentages
- Daily homework and class participation: 5%
- At the end of every lecture, you will be given daily homework, a couple of simple exercises or questions collected in the next class. Each will be graded, with negative points for missing or sloppy work.
- Do the readings ahead of time and volunteer to answer questions asked in class
- 10 weekly homework assignments: 40% (4% each)
- Handed out on Thursdays
- Due on Thursday 7 days later at 23:59
Doha time. Submit on Blackboard.
- No joint assignments
- Midterm 1: 15%, in class on February 19th,
closed notes
- Midterm 2: 15%, in class on March 25th,
closed notes
- Final exam: 25%, 3 hours, open notes
Evaluation Criteria
Your assignments and exams are evaluated on the basis of:
- Correctness: your arguments should make sense, your proofs should be valid, and your program should work in the reference environments
- Specification: say what you want to do before doing it. In the case of programs, use structured comments describing inputs and outputs, invariants, and side-effects
- Elegance: written material should be of the same quality as what a professional would write. No typos, no bad grammar, clarity is paramount.
- Bonus points: up to 10% for
particularly elegant solutions
- Negative
points: no less than -100% if caught
cheating
Late Policy
Every student has up to 3 late days that may be used for any assignment throughout the semester, but no homework may be more than one day late (no fractional late days: if you submit 1 minute late, you have used up a full late day). Submissions will not be accepted afterward.
Academic Integrity
You are expected to comply with the University Policy on Academic Integrity and Plagiarism.
Collaboration is regulated by the whiteboard policy: you can bounce ideas about an assignment, but when it comes to typing it down for submission, you are on your own — no notes, snapshots, etc., you can at most reconstruct the reasoning from memory.
Course Objectives
This course seeks to develop students who:
- demonstrate a high level of proficiency with logic fundamentals
- are familiar with algorithmic uses of computational logic
- are experienced with a non-declarative programming paradigm
- approach problems logically and create innovative solutions relying on proven techniques
- have foundational knowledge and an attitude of career-long learning to remain current as technologies evolve
- communicate orally and in writing in effective and appropriate ways within the discipline
Learning Outcomes
Upon successful completion of this course, students will:
- know and appreciate advanced concepts in logic. Namely, students will
- have a deep understanding of propositional and predicate logic, be
familiar with the distinction between intuitionistic and classical
logic, and have had exposure to some advanced logics
- correctly use a natural deduction or sequent calculus presentation in
appropriate situations
- be familiar with fundamental properties such as soundness,
completeness and consistency, as well as with cut-elimination
- be able to use structural induction to prove elementary properties of logical systems
- have a clear understanding of the logical mechanisms underlying several forms of computation. Namely, they will
- be acquainted with the proofs-as-programs correspondence, both for
intuitionistic and for classical logic
- be familiar with the formulas-as-programs paradigm and computation as
proof search
- understand the concept of abstract logic programming language and uniform proof
- distinguish backward-chaining and forward-chaining modes of computation
- extract algorithms from constructive proofs, for example a compiler from a proof of soundness
- be able to write programs in a variety of styles within the logic
programming paradigm. Specifically, they will
- be familiar with the fundamental algorithms of top-down logic
programming including resolution and unification
- be able to write medium-sized programs in Prolog and related languages
- understand the principles and applications of bottom-up logic
programming as found in Datalog
- have had exposure to elementary forms of rewriting logic as found in forward-chaining linear logic programming
- are able to think abstractly and to combine methods to solve a problem. Namely, they will be able to
- apply abstractions to solve problems
- develop a systematic analysis method for solving problems
- logically break down a problem into logical components
- have the ability to use learned concepts to remain current in their field. Specifically, they will be able to
- reformat information from one way to another
- recognize how to apply the fundamentals learned to new or emerging technologies
- be able to communicate clearly and effectively ideas, concepts and
intentions within the field of computational logic, namely
- be able to describe technical constructs (concepts) clearly, so as to
be readily understood by their peers
- be able to give an individual presentation on a technical subject to
audience of peers within the discipline of computational logic
- form a cogent, logical argument asserting and reiterating all technical
concepts that lie within the bounds of the taught curriculum or their
research within that curriculum