52 minutes ago · 30 min read6014 words · Tech · hide · 0 comments

I started writing Logic for Programmers because there weren’t any good resources on logic for, uh, programmers. Now that the book’s out, the new problem is that there aren’t any good free resources on logic for programmers. So, to solve that problem (and maybe hype the book a little), I converted the second chapter of LfP into a blog post. All footnotes are editorial comments not present in the book.1 Enjoy! Chapter 2: A Crash Course in Logic Formal logic is a very powerful tool, but it’s also very simple. Over this chapter, we’ll motivate and explain the basic concepts and syntax. This includes predicates, the implication operator, sets, and set quantifiers. Much of it may already be familiar to you from programming experience! Predicates To a first approximation, a predicate is a function that returns a Boolean. You’ve probably written dozens of predicates as a programmer. These are all predicates: Positive(x) is true if x is greater than 0. IsSum(x, y, z) is true if x plus y equals…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.