Logic for Programmers: Using Boolean Math to Fix Software
Logic for Programmers by Hillel Wayne

I wrote this book to help intermediate programmers design and verify software better using logic. You do not need a math background, just basic knowledge of Booleans and programming concepts. The content covers practical applications like simplifying conditionals, writing better tests, and finding race conditions. Chapters are independent, allowing you to skip topics that do not fit your needs while learning techniques from formal verification to database theory.
If all of an empty list is False, then the result would be False no matter what list you provide, which makes no sense.
- rmunn
Back when I was in college, I took some philosophy classes just for fun. I discovered when I took Symbolic Logic that while everyone else was struggling with the class, I was finding it pretty easy, because chaining together a proof in symbolic logic felt just like programming. It was the same mental steps: you have the starting conditions, there's an endpoint you want to reach, and you need to chain together these fundamental operations in order to get there. (And sometimes you needed to see how to break them apart: if you need to prove P AND Q, then proving P separately and proving Q separately were usually easier steps, and then once you've proved P and you've proved Q then you've proved P AND Q. Which felt a lot like refactoring a large function that did two things into two separate, smaller functions that do one thing each).
Looking through the sample chapter, I'm reminded of my experience with symbolic logic class. It looks like it'll be much the same thing, but flipped on its head: instead of knowing programming and using that knowledge to make symbolic logic easier, this looks like it'll be about knowing symbolic logic and using that knowledge to make programming easier. Seems pretty useful; I'll give the sample chapters a more in-depth read soon.
- js8
Looks like a nice book, but.. I feel like no serious work with this ambition today should omit (maybe it is present, not sure from the ToC) the Curry-Howard isomorphism, propositions-as-types, and from it following the analogy between logics and lambda calculi.
I really like this: https://disi.unitn.it/~bernardi/RSISE11/Papers/curry-howard....
I think every programmer should understand the consequences of CHI to the discipline, which are profound. It means that there is no need for classical logic as a separate metalanguage, the properties of programs could also be expressed in the programming language of your choice. Furthermore, it shows that "running the program" and "reasoning about the program" are ultimately the same processes, which raises some good philosophical questions about testing for example. But also about how can we approach the program design, maybe we can just "calculate it" from the constraints. It also opens us to things such as supercompilation.
I think the discipline needs to move towards formal understanding how different programming languages and logics express similar ideas, because it's a really powerful tool of mutual understanding.
(Also, I personally find the typed LC notation, especially with type checking and inference, easier than the classical logic notation. It might be the reason why logic is considered too complicated.)
- Merkur
I read the free part. Looks interesting, but the math heritage is dominant as promised.
It seems to favor the compact and efficient kind of code that is brittle in the hand of a mildly competent junior dev, or a heavy multitasking senior.
I like smart code, in fun projects, but on the job I prefer fast to read and to reason code. Don’t try to be fancy.
So I guess that’s a book to challenge my assumptions. I like that. Thx.
- foobarbecue
Trying to buy this on Amazon seems to trigger a bug.
If I do "buy now," I get a strange text-only "out of stock" page.
If I add to cart and try to check out, I'm redirected to the "switch account" page, where only my currently logged-in account is listed.
I buy things on amazon ask the time and have never seen this before.
EDIT: whatever that was, it's fixed now. I was able to purchase the print book.
- mjaniczek
Congratulations to Hillel for finishing the book!