Mathematical logic through Python, by Gonczarowski and Nisan, provides a Python implementation of logical concepts and mathematical proofs. It aims at covering major topics for a typical undergraduate course in mathematical logic.
The introduction briefly explains the purpose of mathematical logic with simple examples. It emphasizes the fact that logical deduction is purely syntactic (form) rather than semantic (meaning). This part of the book details the motivations of different communities using logic. These communities include philosophers, mathematicians, and computer scientists. It also discusses the pedagogical approach followed throughout the chapters, that is, to prove every mathematical concept via computer programming. In addition to the introduction, the book is divided into two parts addressing propositional logic and predicate logic, respectively.
Propositional logic is a branch of mathematical logic. It deals with propositions or statements and is widely used in decision making. Part 1 (chapters 1 through 6) covers propositional logic syntax and semantics, logical operators, proof by deduction, working with proofs, the tautology theorem, and the completeness of propositional logic.
Part 2 includes chapters 7 through 12. Predicate logic or first-order logic is an extension of propositional logic:
[It is] a collection of formal systems used in mathematics, philosophy, linguistics, and computer science. First-order logic uses quantified variables over non-logical objects, and allows the use of sentences that contain variables, so that rather than propositions such as “Socrates is a man,” one can have expressions in the form “there exists x such that x is Socrates and x is a man,” where “there exists” is a quantifier, while x is a variable.
This part of the book covers predicate logic syntax and semantics, deductive proofs, the deduction theorem, and the completeness theorem. The last chapter (13) is a first glimpse into Gödel’s incompleteness theorem.
The book is not to be confused with a tutorial on mathematical logic. Rather, it is a reference for mathematicians who want to use Python programming to study logic. It comes with Python code skeletons to be completed by the reader. The authors converted the mathematical concepts into a set of programming tasks to be implemented using the Python language. Each task is explained and supported with examples and hints.
The book is well written and the chapters are short but comprehensive. The practical approach to grasping mathematical concepts is quite innovative and useful. Overall, I highly recommend it to students of mathematical logic who wish to strengthen their comprehension through Python implementations of the covered concepts.