# A Look Into the Logic of Computer Science

## Diving into discrete mathematics

--

Contrary to popular belief, computer science is not all about raw code. In my first year of computer science, I was surprised to see that my university required many “non-CS courses,” including calculus, linear algebra, and most interestingly, a class on logic and discrete mathematics. I had always known that computer science and mathematics were deeply intertwined, which is partly why I decided to do a joint major in both. However, this class gave me the underlying foundation to think deeply about the logic behind certain computer science principles, and I hope to give a brief introduction to some of the more fundamental topics in this article.

# Truth Tables

Let’s begin with going over truth tables and propositions. In discrete mathematics, a proposition is simply a statement that has a truth value, and that truth value is either true or false. For example, the statement “two plus two equals 4” is a proposition because it has a truth value. In this case, its truth value happens to be true. However, note that the statement “two plus two equals five” is still a proposition because it retains the property of having a truth value; only in this case, the truth value is false. Common examples of statements that are not a propositions include questions. For example, “do you want to play tennis?” is not a proposition because there is no inherent truth value: you can not really pin true or false on it.

Now that we understand propositions, let’s dive into truth tables. Truth tables essentially connect truth values from propositions together, and they actually lay down the foundation of not just computer science logic, but everyday logic as well. To allow for maximum understanding as quick as possible, I’ll show an example of a truth table and explain what is going on.

This is what a standard truth table looks like. Usually, there are two propositions p and q, and all combinations of T = true and F = false are listed out.

--

--