Click on a class day to go to that particular lecture or recitation. Due
dates for homeworks are set in bold. The due date
of the next homework blinks.
This course is about logics that express algorithms or computation. These
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 briefly 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 last few lectures of the course to sampling some advanced logics, which support special purpose forms of computation.
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 may have completed CS 15-210
(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.
We will use several languages and software tools in the various parts of the course.
Logic programming languages and applications
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
- 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.
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
- then, type
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
See the GNU Prolog manual for further information.
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.
Some homework assignments will have you write a intepreter for a logic
programming language. While you are free to use whatever language you
want for this, we will be providing starter code in Standard ML.
Refer to the 15-150 software page
to remind yourself
about how to install and run SML.
We strongly encourage you to typeset the written part of your homeworks in LaTeX
(we will take this into account as part of your participation grade
). It takes some getting used to it, especially if MS Word is all you've been exposed to, but it enormously simplifies producing pleasant mathematics. Here are some useful references:
You may find this Latex template for homeworks
This is a 9 unit
Tasks and Percentages
- Labs (mandatory): 10%
- 1 point for reaching the lab threshold
- 0 points if you don't reach the threshold or if you don't show up
- Daily exercises and participation: 5%
- At the end of the every lecture, you will be given daily
exercises, a couple of simple exercises or questions collected
during the next class or lab. Each will be graded, with negative points for missing or sloppy
- Participation has the following components:
- Class participation: volunteer to answer questions asked to the
- Class preparedness: you must have done the readings before coming
- Get extra points by using Latex
- 10 + 1 homework assignments: 45%
- 1 to 2 weeks each
- Due at 11:59pm Doha time — strict!
- Written and programming parts
- Graded ASAP based on rubric for programming components
- To encourage good work and integrity, the instructor may invite
students to his office to explain their solutions. Should this happen,
the students' explanations will become part of their grades for that
- No joint homework unless explicitly instructed
- Last homework assignment is bonus
- Midterm 1: 10%, in class, closed books
- Midterm 2: 10%, in class, closed books
- Final exam: 20%, 3 hours, closed books
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 environment
- Specification: say what you want to do before doing it. In the case of programs, use structured comments describing types, meaning of the returned value, 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. See these notes about ML programming style.
- Bonus points:
- 2% of the earned grade for each 12-hour period a homework is submitted ahead of the deadline
- up to 10% for particularly elegant solutions
points: at least -100% if caught
There are no late days. Assignments submitted past the deadline will get a grade of 0.
You are expected to comply with the University Policy on Academic Integrity and Plagiarism
(see also The Word
and Understanding Academic Integrity
). Note that the policy now requires that students acknowledge any help received from the Academic Resource Center (ARC).
Collaboration is regulated by the whiteboard policy
: you can bounce ideas about a homework with other students, but when it comes to typing it down for submission, you are on your own — no notes, files, snapshots, etc. Morever, you must wait at least 4 hours before writing down the solution.
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 contact me
. 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