# Mathematical logic book that uses a proof assistant?

I'm looking for an introductory book on mathematical logic that also discusses an implementation of its logic in a proof assistant. It seems to me this would be a great way to learn mathematical logic, since many concepts would become very clear and concrete when implemented in a computer program. But I have never seen such a book.

Preferably, the book would introduce the language of the proof assistant assuming no prior knowledge, and encourage the reader to use it at various points.

EDIT

I like the answers posted so far, and want to keep this open for a while to collect other recommendations in one place. However, after opening it, I also found the following excellent resources linked in this question, namely this list of resources and this book/compilation of notes by Jeremy Avigad. These resources seem like the type of thing I was looking for, and might be helpful to others who stumble on this post.

EDIT 2

One feature I would really like to see, which I haven't seen in the suggestions so far, is a book that also formalizes its meta-logic within a proof assistant. For example, I would love a book that proves (for example) a soundness theorem, and shows how such a proof could be implemented with a proof assistant.

Then again, I'd be surprised if such a resource exists, since no mathematical logic books (that I've seen) even mention the idea of formalizing meta-logic.

• Would the texts from the Open Logic Project count, where they have a hand-developed web tool for formal verification of proofs in their systems? Or are you asking specifically for something using a general-purpose proof assistant? – Daniel Schepler Jun 24 at 20:43
• @DanielSchepler I'm fine with any particular software—as long as it is being used for instructive purposes alongside a resource for teaching mathematical logic. Seems like OLP is a great resource, although I can't find their web tool for proof verification, which you mentioned. – WillG Jun 25 at 3:06
• To get your feet wet, you might consider my proof checker freeware downloadable from my homepage at dcproof.com with accompanying tutorial. It was designed to introduce students to the basic methods of proof. It is based on a simplified form of natural deduction and set theory that seems to be implicitly used in most math text books (not standard FOL or ZFC). – Dan Christensen Jun 25 at 14:53
• Concerning your second edit: In the draft I have linked, soundness and completeness of classical propositional logic are shown at the end of the chapter on Natural Deduction. Formalizing the full-meta logic a book uses is intricate question; the book then explicitly needs to make a distinction between its meta-logic and the object-logic it wants to study. Usually the proof-assistant (and its logic) are used as the meta-logic in which results are discussed. Then to formalize(!) all the intricacies off the proof assistant logic really is its own challenge altogether. – Lereau Jun 26 at 6:16

I would strongly recommend John Harrison's Handbook of Practical Logic and Automated Reasoning. The programming examples are more to do with how to implement proof assistants and decision procedures rather than how to use a proof assistant, but I think they meet your desire for implementations that clarify the key concepts. The examples are all given in the functional programming language OCaml.

Concerning the second edit: I think it is implicit in most texts on mathematical logic that the subject can be formalised in a suitable foundation system such as ZF. In the mathematical logic literature this becomes important and is made explicit in work on independence, In the world of proof assistants, self-formalisation with a view to increased assurance and understanding has been of intererest for many years. E.g., see this paper on self-verification of HOL and the references therein. I think the overall principles of a formalised meta-logic are probably more instructive than the fine details of the formalisation.

Try fundamental proof methods in computer science.it uses Athena as a proof assistant.It teaches both logic with language.

If you find that complex here a simple one- https://staff.washington.edu/jon/flip/www/userguide-nd.html It works with Python 2.7.

Books having an accompanying proof assistant for their logic is one way to look at it, but it also works the other way around: Most proof assistants implement some particular (usually constructive) logic and therefore books about the proof assistant are already books about this logic.

Here are some resources about Coq:

The Lean Community site has a page on recommended learning resources.

And let's not forget the HoTT stuff: