COL703 – Logic for Computer Science
July 2024 – November 2024
Course timings & Venue:
B slot: Mondays & Thursdays 0930 – 1100, in Block VI, LT II.
What is this course about, and why should I take it?
Logicians will often tell you that the primary raison d'être of logic is to systematically evaluate arguments for deductive validity, or something equally abstruse along those lines. So why should you, a computer scientist, bother with logic at all? Because, as anyone who has ever written a program beyond "Hello, world!" knows, writing code is hard. Writing good code is even harder, and this starts even before we have written any code at all! Are you sure that what you think you want is really what you want? Will your code actually work? How reasonable are the assumptions you have made along the way? These are questions that logic can help you think about in a systematic way.
The objective of this course is to learn fundamental ideas that help us create abstract models of systems in the real world, so we can then ensure that they behave as they should. This course will essentially cover concepts related to how to model complex systems abstractly while making good choices, as well as how to reason about these systems automatically, with a view to formal verification.
Prerequisites
This fundamental material covered in this course is fairly abstract and theoretical, and will therefore require some mathematical acumen -- students should, at the very least, be able to write and understand rigorous formal proofs, especially those involving various kinds of induction. There will also be some programming involved to implement various concepts. You should have taken at least one of the following courses (or equivalents thereof):
Evaluation policy
Assignments: 20%. We will follow a graceful degradation policy: For every day that you use beyond the indicated deadline, you lose 20% of marks for that assignment -- if you submit anything later than 5 days past the deadline, it will not be evaluated.
Minor: 20%. No re-minor will be conducted. If you miss the minor for a medical reason (with appropriate documentation produced within one week of the minor), the major marks will be scaled up accordingly.
Major: 40%. The syllabus for the major exam will include everything covered in the course.
Quizzes: 15–20%. There will be some surprise quizzes conducted in class at various points during the semester. Absence in a quiz is directly marked 0. No make-up quizzes will be conducted.
In-class participation, attendance etc: 0–5%.
Pedagogical experiment surveys: 0–5% Bonus.
"A few of my favourite things": 0–5% Bonus.
Audit pass needs at least a B- overall, including at least 10% out of the 15–20% earmarked for quizzes.
Deviation of any sort from the IIT Delhi honour code (copying, plagiarism, collaborating on gradable items where explicitly disallowed etc. – see here for more examples) will summarily result in an F grade, or in case of audit, an NF, and potentially further disciplinary action.
Reference material
We will follow notes presented in class, for the most part, which will be uploaded here. Some external references for much of the course are listed below (caveat emptor: notation used in these notes/books might significantly differ from the ones used in class).
Introduction to Formal Logic, by Peter Smith
Formal Logic: Its Scope and Limits, by Richard C. Jeffrey (also available in the IIT library)
Hyper-notes for Logic in Computer Science, by Prof. S. Arun-Kumar
Lecture Notes & Reference Material
Date | Slides | References and suggested follow-up reading (if any) |
---|---|---|
22 July, 2024 |
|
|
25 July, 2024 |
|
|
29 July, 2024 |
|
|
1 August, 2024 | ||
5 August, 2024 | ||
8 August, 2024 |
Here is a link where you can play around with equivalences and normal forms for various expressions. Make sure that you use the English language toggle on the top right if it loads in Dutch. Most of the conversion rules should be easy enough to figure out (they are identities we have covered in class). The only exception is the rule for Equivalence, which is: p ⇔ q iff (p ∧ q) ∨ (¬p ∧ ¬q). |
|
12 August, 2024 | ||
13 August, 2024 | ||
22 August, 2024 |
Here is a list of proofs you should try to do using the Deduction Theorem. These are fairly fundamental statements and are often useful. Try to do the proofs in order, since some later ones might need you to invoke the ones that came prior. Here is a link where you can play around with proofs in the Hilbert system. Make sure that you use the English language toggle on the top right if it loads in Dutch. The three axioms are called A, B, and C. A and B are the same as our H1 and H2, but axiom C is taken to be (NOT p IMPLIES not q) IMPLIES (q IMPLIES p). |
|
29 August, 2024 |
This link has an excellent write-up about the Compactness Theorem and the Graph Colouring application. Murdle is an excellent, fun way to sharpen your logical inference skills. Try to code up today's Murdle in propositional logic! (You need to come up with the right propositions and the right connectives. This will often require some human meta-reasoning using the given clues.) |
|
31 August, 2024 |
You can play around with other Z3 exercises here. Z3 is a solver that primarily tries to solve the Satisfiability problem, which is known to be hard. However, the problem is so common across subfields that enterprising computer scientists have come up with inventive ways to solve this problem anyway. Recommended reading related to SAT solving includes the DPLL algorithm (which is related to Resolution) and Conflict-Driven Clause Learning (which tries to "learn" a satisfying valuation for the given expression). Come talk to me if you're interested in learning more or working on extensions of any of these! |
|
2 September, 2024 | ||
5 September, 2024 | ||
9 September, 2024 | Review lecture |
|
19 September, 2024 | Chapters 21 through 24 of Introduction to Formal Logic by Peter Smith contain many examples. | |
23 September, 2024 | ||
26 September, 2024 | ||
30 September, 2024 | ||
3 October, 2024 |
This link is an excellent repository of exercises that you can try out to get better both at modelling "real life" statements in FOL, and at performing resolution (to prove the conclusion from the axioms). FO Resolution is often used in automated theorem proving. Here is a nice little implementation in Python. Caveat: Theorem proving using resolution is not complete (why not?), since the rule does not yield a complete proof system for FOL (unlike the PL resolution rule), so you might not be able to prove everything you might want to. |
|
14 October, 2024 | ||
17 October, 2024 | ||
21 October, 2024 | ||
24 October, 2024 |
Here is a list of proofs you should try to do using the natural deduction proof system. This is a paper that we recently wrote that was accepted at IEEE CSF 2024 showing the (rather nice) NP-completeness for a security system built on top of a positive existential fragment of intuitonistic FOL. |
|
28 October, 2024 | ||
4 November, 2024 | ||
7 November, 2024 |
This book by Peter Smith provides a lovely, concise introduction to Gödel's Incompleteness theorem. The technique is slightly different from the ones in the notes, but it is a thoroughly approachable text. This very interesting piece by Torkel Franzén presents a view of the overall context into which the Incompleteness theorem fits. This cute article by Karl Sigmund describes setting up an exhibition in Vienna in 2006 on the centenary of Gödel's birth, with a very entertaining tapestry of the history of his life and times. These pieces appeared in the Notices of the AMS, volume 53, number 4 (A tribute to Kurt Gödel). |
|
11 November, 2024 |
The original CACM article by Tony Hoare, which introduced Hoare logic can be found here. This is a fairly comprehensive survey about Hoare logic, written in 2019 to mark fifty years of the CACM article by Tony Hoare which originally introduced the logic. It gives some history of what had come before, and how Hoare logic applies to various kinds of systems one might want to develop and verify. There are a couple of pedagogical tools one can use to learn Hoare logic better. One is the HAHA system, developed at the University of Warsaw. Another, which helpfully has an in-browser version, is the KeY-Hoare tool, developed by folks from Karlsruhe Institute of Technology, Chalmers University of Technology, and TU Darmstadt. |
|
14 November, 2024 |