Back to Blog

Logic: The Hidden Thread Connecting Philosophy, Mathematics, and Computer Science

Philosophy isn't just abstract thinking. It's the foundation of logic systems used in computer science and mathematics. Explore how Aristotelian syllogisms connect to the if-then statements in your code and the proofs in discrete math.

5 min read
logic philosophy computer-science mathematics formal-logic stem programming

When one hears the term philosophy, what kind of image or feeling does it invoke? Some think of a bllsht field full of pretentious people while others think of an elevated field of enlightened individuals contemplating and thinking of grand questions of life.

As for me, I think of logic.

Logic in Philosophy

Now why do I think of logic of all things? For those who don’t know, it seems unusual, however for people who are informed about what the building blocks of philosophy are, they will likely understand what I mean. I am talking about the logic that helps philosophers to develop their thoughts and ideas, which, many do not know, is the same logic used by computer scientists and mathematicians when working on algorithms and proofs.

That might seem baffling and surprising at first, but let us look into some of the history of philosophy and mathematics. We can look back to ancient Greece to the philosopher Aristotle. He was known for many great accomplishments such as pioneering Zoology, teaching Alexander the Great, and so much more, but today we’ll look towards something he developed that is used by philosophers around the world today: Formal Logic.

Aristotle created a system of formal logic that we know today as Aristotelian Logic which can be used to develop syllogisms, a system where we can come to a conclusion from two assumed predicates.

For example:

Premise 1: All men are mortal
Premise 2: Socrates is a man
Conclusion: Therefore, Socrates is mortal

Now this seems fairly obvious and simple, but we can expand upon this using other logic systems, some that we may be familiar with through computer science or mathematics surprisingly enough.

Propositional Logic

We can now enter the world of propositional logic which uses statements like “not”, “and”, “or”, and “if-then”, or symbols like ~, ^, v, and ->. For those of you who have gone into studying computer architecture, binary logic, and/or discrete mathematics may be familiar with these symbols and words. They function just like the logic gates we find in CPUs and other microchips, however, in philosophy, we can use them with statements to create conclusions, equivalencies and so much more.

Premise 1: If Austin is sick, then Austin will take medication
Premise 2: Austin is sick
Conclusion: Therefore, Austin will take medication

We can rewrite the above syllogism as shown below:

Let S = Austin is sick
Let M = Austin will take medication

((S => M) ^ S) => M

Or in plain English:

If it’s true that (if Austin is sick then Austin will take medication) AND Austin is actually sick, THEN Austin will take medication.

This logical structure is called Modus Ponens. More of a fun fact than something too substantial for this blog post, but if you’re interested in learning formal logic, look more into it.

Philosophy and Logic in Computer Science and Mathematics

We can make even more complex logic using these symbols to create more complex systems similar to how we can make complex circuits by combining various logic gates together. The same can be said for algorithms in computer science as well. Think of a program you’ve written using if-then statements; you’re applying propositional logic there even if you may not have known it.

Now for those of you who have taken a discrete math class in the past, you may have had a war flashback to working on proofs from looking at the symbols and logic shown above. The system I showed earlier, the propositional logic system, is used heavily in math, also known as propositional calculus, to develop proofs. Now I know some of you had a shiver go down your spine from that word. Proofs are heavily dependent on the logic systems used in philosophy to come up with algorithms and equations that can be proved to be used to answer complex mathematics questions, or even simpler ones like below.

If a number is divisible by 2, then the number squared is also divisible by 2.

Now this statement is better defined as:

A number is divisible by 2 if and only if the number squared is divisible by 2

But we won’t get too far into semantics, maybe for another post.

Logic like this has been used to answer many great questions mathematicians have had throughout history. You can use logic to describe complex definitions in a simple way.

Now we are missing some symbols and words we can use to further expand mathematics which we can find in predicate logic, but as said before, we can get into that another day.

Why Philosophy Matters in STEM

Based on what we have seen above, philosophy is far more than just asking why to everything; it is the foundation of computer science and mathematics as well as the entryway to a complex world of logic that one can delve into if one so wishes. I can’t say for you who read this far, for which I thank you, but I know that this is a complex and fascinating world even outside of my interest in computer science and math. If you’re interested in learning more, look into how you can develop more complex syllogisms, learning other formal systems such as predicate logic, modal logic, etc. You can learn if some truth values apply to some or all members of a set, see if something is necessary or possible, and maybe find out the meaning of life.