Using a unique pedagogical approach, this text introduces mathematical logic by guiding students in implementing the underlying logical concepts and mathematical proofs via Python programming. This approach, tailored to the unique intuitions and strengths of the ever-growing population of programming-savvy students, brings mathematical logic into the comfort zone of these students and provides clarity that can only be achieved by a deep hands-on understanding and the satisfaction of having created working code. While the approach is unique, the text follows the same set of topics typically covered in a one-semester undergraduate course, including propositional logic and first-order predicate logic, culminating in a proof of Gödel's completeness theorem. A sneak peek to Gödel's incompleteness theorem is also provided. The textbook is accompanied by an extensive collection of programming tasks, code skeletons, and unit tests. Familiarity with proofs and basic proficiency in Python is assumed.
I love the approach, especially since, as a result of the tasks in the book, I now have a nice logic package to mess with and branch off of for future projects. I found some of the tasks very difficult, but their exposition is definitely enough even for self-guided use. It may not be suitable as a first course in logic for a few reasons, including the difficulty, but it’s great as a way to deepen your understanding of the subject. For an introduction, my personal recommendation is Logic, Sets, and Recursion by Robert Causey.
The authors host a free online version of the textbook, which is virtually identical to the final print copy. Also, since they’re nowhere else to be found, I’ve posted my solutions at:
Hopefully they can be helpful to anyone who feels stuck! Another reason for posting them is to encourage others to share their solutions as well - I’d love to see other creative or more efficient implementations for any of the tasks!
An intuitive way to understand mathematical logic, especially for those of us who are fairly competent at Python. Much easier and readable than most texts on the subject, highly recommend.