5 Logic


Authors

Last Updated

11/15/2022

There are (roughly) two ways to make sense of the world: the proof and the experiment.

Proofs are the language of mathematics and are rooted in logic, the subject of this chapter. Logic studies the rules that govern how we can draw conclusions from premises.

Experiments are the language of science and are rooted in probability theory, the subject of the next chapter. Probability theory studies the rules that govern how we can draw conclusions from evidence1.

Logic and probability theory codify what it means to reason. As such, they’ve been the basis of artificial intelligence since day one. Since that time, the field has shifted its attention more towards probability theory and away from logic. Today’s state-of-the-art AI systems are not the symbolic systems of the past.

But even if current ML techniques scale to full generality and explicit logical reasoners prove to be unnecessary, logic remains central to understanding much of the subsequent mathematics we’ll need to study AI (in particular, computational complexity theory). It’s also key to alignment agendas tackling foundational questions of agency, intelligence, self-reference, causality, and reflective stability.

Propositional Logic

Propositional logic begins with propositions, which are statements that can be either true or false, and combines them using logical operators. The most basic operators are the logical connectives (in order of precedence):

These rules are summarized in the following truth table:

PP\quadQQ\quad¬P  \neg P\ \ PQP \wedge QPQP \vee QPQP \rightarrow QPQP \leftrightarrow Q
T\color{blue} TT\color{blue} TF\color{red} FT\color{blue} TT\color{blue} TT\color{blue} TT\color{blue} T
T\color{blue} TF\color{red} FF\color{red} FF\color{red} FT\color{blue} TF\color{red} FF\color{red} F
F\color{red} FT\color{blue} TT\color{blue} TF\color{red} FT\color{blue} TT\color{blue} TF\color{red} F
F\color{red} FF\color{red} FT\color{blue} TF\color{red} FF\color{red} FT\color{blue} TT\color{blue} T

Figure 1.1 Truth table for the five most common logical connectives.

Example 1.1

Consider another possible logical connective, the NAND (not and) gate, which has the following truth table:

PP\quadQQ\quadPQP \wedge Q¬(PQ)\neg (P \wedge Q)
T\color{blue} TT\color{blue} TT\color{blue} TF\color{red} F
T\color{blue} TF\color{red} FF\color{red} FT\color{blue} T
F\color{red} FT\color{blue} TF\color{red} FT\color{blue} T
F\color{red} FF\color{red} FF\color{red} FT\color{blue} T

It turns out that the NAND gate is universal, meaning that it can be used to implement any other logical connective.

Exercise 1.1 Use the NAND gate to derive all the logical connectives in Figure 1.1. Once you’ve derived a connective, you can use it in subsequent

First-Order Logic

Computability

Incompleteness

Footnotes

  1. Throughout this book, we’ll be sticking to a Bayesian framing. See chapter 4. In this light, every interaction with reality can be seen as an experiment.


Previous:

Outline

Next:

Linear Algebra

Updates & Corrections

If you see any mistakes or want to suggest improvements, please create an issue on GitHub

Reuse

Figures and text are available under a Creative Commons license (CC-BY 4.0) unless otherwise mentioned. The source is available on GitHub. Figures taken from other sources (as mentioned in the captions by "Figure from...") are not available under this license.

Citation

@misc{hoogland2022,
    title={Logic},
    author={Jesse Hoogland},
    year={2022},
    url={https://agi-curriculum.vercel.app//1-foundations/0-logic}
}