An incredibly short and informal introduction to formal logic
Tags: logic introduction post
Intro
I’m not a professional logician, but I am fascinated by formal logic. Hopefully after this introduction, you will be too! In order to dive deep, we need to start with the basics. Let’s say I have a dog named Sherlock. All dogs, including Sherlock, occasionally need to go to the vet. It’s just a fact of life. When I go to the vet, I’ll end up paying some sort of fee (hopefully not too much!) for whatever services the vet gives me. From these simple facts, we can predict or deduce that if I have a dog then I’ll need to pay the vet money. That simple problem was solved by logic. We used certain facts that we know are true in order to prove a conclusion. We do this all the time. What’s cool about formal logic, and what makes it formal, is that it gives us the tools to prove these conclusions in a systematic and clear way. Instead of writing out huge, long, complicated sentences, by using formal logic we could simplify the example I gave above and transcribe it to what I have below. Notice the word transcribe instead of translate! That distinction is very important and I’ll discuss it more later. Without further ado, here is our first look at formal logic!
- 1. (A→B)∧(B→C) ,Premise
- 2. A Assumption
- 3. A→B 1,∧Elimination
- 4. B→C 1,∧Elimination
- 5. B 2,3→Elimination
- 6. C 3,4→Elimination
- 7. A→C 2−6,→Introduction
So I just threw a whole lot of symbols at your face, and I don’t expect you to understand it just yet, but what I do want to showcase to you is how much cleaner the formal logic version of the above sentence is. What’s great about formal logic, is that it doesn’t care about the underlying sentences. In fact, the above proof will work for any sentence in the form of “if A then B and if B then C” so “if A then C” must be true. Again, we can demonstrate this same principle in English with a sentence like “if I like chocolate then I will buy chocolate and if I buy chocolate then I will go to a chocolate store” so “if I like chocolate then I will go to a chocolate store” makes sense intuitively. I want to show to you today that logic is this beautiful human endeavor that’s fun to play around with and the basics are relatively intuitive as long as you’re willing to put in a little work in understanding. Let’s dive in!
Sentences and Logical Connectives
First things first, I don’t want to have to be writing incredibly long sentences all the time to explain the basics of logic, although I will be using them to demonstrate that you have a basic grasp on these concepts already. We will be using uppercase letters like A, B, or C to represent sentences1. These sentences could mean anything from “I have a dog” to “I like riding my bike”. What they mean exactly doesn’t matter. What we’re looking at isn’t the meaning of sentences (that’s semantics!), we’re looking at the structure behind how they interconnect to prove a point. All we care about a sentence is if it’s true or false. So we now know that uppercase letters will represent any sentence 2, but that doesn’t really help us to do anything interesting. The power to express things in formal logic comes from “logical connectives”. We can think of these connectives as little machines which take sentence(s) and spit out whether or not that combination is true.
Negation
The simplest truth connective is the “negation symbol”. What this little machine does is it takes a sentence and makes it’s value the opposite of what it is. For example, if our sentence is “I like cats” then putting it through our negation machine will transform that sentence into “I do not like cats.” (sorry cat lovers, I’m more of a dog person myself!). Lot’s of different people use different notations, but for now, we’ll use the “¬” symbol to represent negation. In order to use this symbol on a sentence we simply stick in front of one3 like so:
Up above, we just negated A so if A was true, it is now false and if A was false it is now true. A common way to showcase the different values a connective can create is through something known as a truth table. The output of a negation connective will depend on what it’s given. There are only two different possibilities which are outlined in the table below.
A (Input) | ¬A (Output) |
---|---|
True | False |
False | True |
Something important to wrap our heads around as we continue to learn and use different logical connectives is the difference between a “case” and a “sentence”. Sentences, like “A”, are either true or false. When we use the negation connective to change the truth value of the sentence, we call the different possible scenarios “cases”. For example, in the case where the sentence “A” is true, then it’s negation will be false. For example, if our sentence is “A” which represents the English sentence “I like chocolate”, in the case where I like chocolate is true, ¬A will be false, while in the case that “I like chocolate” is false then ¬A will be true. This distinction between case and sentence is important as it allows us to explore different scenarios where the sentence may be true or false.
Conjunction
With that connective out of the way, let’s talk about the next symbol, ∧ , conjunction (or more casually known as “and” 4)! This connective takes two sentences and only gives back true if both are true, in every other scenario it gives back false. The truth table for the ∧ connective looks as follows:
A (First Input) | B (Second Input) | A and B (Output) |
---|---|---|
True | True | True |
True | False | False |
False | True | False |
False | False | False |
A sentence using this connective would look like this:
Let’s say A means “I like summer” and B means “I like cool weather” then the above sentence could be transcribed5 into English as “I like summer and I like cool weather”.
Disjunction
The next connective we’ll look at is disjunction. You can think of this connective as representing the idea of “or” in English. Our symbol for this connective looks like this “∨”. Disjunction takes two sentences, and returns true if either one of the sentences is true. The truth table looks like this:
A (First Input) | B (Second Input) | A∨B (Output) |
---|---|---|
True | True | True |
True | False | True |
False | True | True |
False | False | False |
If we keep using A to mean “I like summer” and B to mean “I like cool weather then A∨B would mean “I like summer OR I like cool weather”. Logic is all about precision. In English, we can use “or” to mean that one option is true or we can include both options. An example of the first one, where only one option from the “or” statement is true would be something like: “My birthday is in the months January-June or my birthday is in the months July-December”. It can be used when both options are true such as in the sentence “You need this test to be looked at by your father or mother”. In this sample sentence, both options could be true. This type of “or” is known as inclusive “or”(denoted by ∨) because it includes the option where both possibilities are true. There is another form of “or” known as exclusive “or” where only one of the two possibilities are true, but we won’t be diving into that today.
Conditional
The final connective that we will review is the conditional, which looks like this “→”. This symbol holds a lot of expressive power and allows us to do lots of interesting things in formal logic. If we saw a sentence that looked like “A→B” that means if A then B. If we made A represent the sentence “I like summer” and B represent the sentence “I like warm weather” then that above premise would represent the idea of “If I like summer, then I like warm weather”. Just like with the other connectives, we can create a truth table for this connective that looks like this:
A (First Input) | B (Second Input) | A→B (Output) |
---|---|---|
True | True | True |
True | False | False |
False | True | True |
False | False | True |
The conditional truth table can be a bit confusing at a glance, so let’s go through it line by line so we can better understand it. In a premise like “A→B”, A is called the antecedent and B is called the consequent. This terminology isn’t meant to confuse you further, but to help making pointing things out about the conditional a bit easier. Now if the antecedent and consequent are both true, it would make sense that the whole statement would be true. If the antecedent is true and the consequent is false then the whole statement would be false as we can see from the example, “If it rains tomorrow, then I will eat candy”. If I don’t eat candy, then that means the conditional didn’t hold. That’s why, in that case, the sentence would be false. The last two lines are what confused me the most when I first saw the truth table for the conditional. If the antecedent is false, then the output/conclusion will always be true. Why is that? This property of the conditional seems a bit counterintuitive, but it isn’t an accident. The last line is easiest to explain. Let’s say my sentence is “If I like chocolate then I will buy chocolate”. In the case where both parts of the sentence are false, the sentence is still true because it would make sense that if I didn’t like chocolate then I wouldn’t buy chocolate. What if we look at the case where the antecedent is false, but the consequent is true. That would mean I didn’t like chocolate, but I still bought chocolate. This case would be true overall because even if I don’t like chocolate, that doesn’t mean I’ll never buy chocolate. I may buy chocolate as a gift for a friend. Since I still might buy chocolate so the statement is true.
Combining Logical Connectives
With a clear grasp on each of the basic logical connectives, we’re now ready to begin to do something a bit more interesting. The fact is, most logical premises contain multiple connectives combined in different ways. Let’s take a look at how that works! How could we understand a sentence like this: ¬(A∨B)∧(A∧B) It seems really complicated, but the important part is to break it down into the main connectives. The sentence above is connected by an &, so it can be broken down into the parts:
Now we can deal with each part separately. Notice how I group the negation connective with the A∨B part not the A∧B part. This is because connectives apply to the closest fully formed sentence. A fully formed sentence is simply a sentence that makes sense. A∨ is not a fully formed sentence, so the negation can’t apply just to that. It must apply to the A∨B part as that is a valid sentence in logic. If we have something like ¬A∨B then the negation would apply to only to the A part, not to the whole. This is because A on it’s own is a fully formed sentence. Just like in math, I make my intentions clear using parentheses showcase that I want the negation to apply to everything between the brackets.
Let’s go back to the two parts of our original sentence and deal with the first part: ¬(A∨B). We can look at all the possibilities for whether this sentence is true or false with a truth table, like so!
A | B | A∨B | ¬(A∨B) |
---|---|---|---|
T | T | T | F |
T | F | T | F |
F | T | T | F |
F | F | F | T |
Since there’s so much going on in the above truth table, I shortened true to T and false to F. As we can see from the above, ¬(A∨B) will only be true if both A and B are false! This isn’t enough though. We want to know all the possibilities for ¬(A∨B)∧(A∧B). I want to know what I need to do in order to make that whole sentence true. In order to see that, we simply add more columns to the table, being sure that each column only deals with one part of the sentence at a time.
A | B | A∨B | ¬(A∨B) | A∧B | ¬(A∨B)∧(A∧B) |
---|---|---|---|---|---|
T | T | T | F | T | F |
T | F | T | F | F | T |
F | T | T | F | F | T |
F | F | F | T | F | F |
From the truth table above, we can clearly see that the only scenario that allows the whole sentence to be true is if A and B do not have the same value (i.e. they cannot both be true or both be false)! It may seem like a lot of work, but once you get the hang of it, it can be fun!
Below I’ve got a couple of different exercises for you to try, from transcribing English into formal logic to figuring out the scenarios where a sentence is true. You don’t know something until you practice, so please give it a try before moving on. The answers are also there.
Exercises
Transcribing Practice
For the following exercises, you will use the sentences A. B, and C to transcribe the English into the correct form in logic. All the answers can be found at the end of the post.
- I like apples and bananas or I do not buy fruits in the supermarket.
- I like apples and I like bananas but I do not buy them in the supermarket.
- I do not like apples and bananas.
Truth Table Practice
Given the following sentences, please use the truth table method to see what truth values of A, B and C are needed in order for the whole sentence to be true. The answers for this exercise can be found at the bottom of the post.
-
(A∧B)→C
-
(A∨C)→(A∧C)
Understanding Natural Deduction
Whew! We did it folks, we’re past the very basics of formal logic. You now know and understand the basics of the logical connectives that form the foundation for the rest of your formal logic studies, yet there’s something else foundational that we haven’t covered yet. How do I make arguments? At the very start of this post, I showed a basic example of how you use deductive reasoning in your everyday life to derive new information from previous facts. With the basics down pat, we can now explore and fully understand our example above!
Conjunction Elimination
To do so, we’re going to need to learn a couple of different rules that we can use to get information from previous facts. From now on, we’ll call our facts by the name premises. In formal logic, our premises must be true, or else our conclusion won’t make sense6! We use these premises to prove something, that thing we’re proving is our conclusion. In order to grasp the example I showed at the start, we need to understand three things: Conjunction Elimination, Conditional Introduction and Conditional Elimination. Each logical connective has a way to eliminate it or introduce it when you’re trying to prove an argument, but we’re just going to focus on those two symbols for the remainder of this post. Let’s take a look at an example argument. If our premise, which we’ll take as true is (A∧B)∧((A∧¬C)∧B) then is C true or false? Now, what we could do at this point is stop and create a huge truth table, look through every possibility from start to finish and try to find the value of C when the whole sentence is true. That would be a ton of work though, and be very error-prone. Just one small mistake would ripple through an entire row! Instead, we’ll be using the rule of & Elimination to untangle our premise and get C out of it. Let’s think back to the truth table for the basic ∧ connective which dealt with the sentence A∧B. In order for the whole sentence to be true, A and B each need to be true. That means in order for our premise to be true, both parts of the sentence must be true too!7 English can help make this concept a bit more clear. If the sentence “I have a dog and I have a cat” is true, then we know that “I have a dog” is true as well. This rule allows us to essentially “split up” premises connected by “∧” into parts. If we look at our sentence which is (A∧B)∧((A∧¬C)∧B), we’ll see that the main connective is an &, which means (A∧B) must be true and (A∧¬C)∧B must be true in order for our sentence to be true. We’d write that down that split like this:
- 1. (A∧B)∧((A∧¬C)∧B), Premise
- 2. A∧B 1,∧Elimination
- 3. (A∧¬C)∧B 1,∧Elimination
When creating a formal argument, we must showcase which argument we are using to derive further facts about our premise and which line that premise can be found on (remember, arguments can have lots of premises!). Since we know that lines 2 and 3 are true since they’re derived from our premise that means we can derive new information from lines 2 and 3 as if they were just an extension of our premise. This power allows us to keep splitting apart the sentence until we get to C. If we keep following those rules, then here’s how we’d get to C:
- 1. (A∧B)∧((A∧¬C)∧B), Premise
- 2. A∧B 1,∧Elimination
- 3. (A∧¬C)∧B 1,∧Elimination
- 4. A∧¬C 3,∧Elimination
- 5. B 3,∧Elimination
- 6. A 4,∧Elimination
- 7. ¬C 4,∧Elimination
Yes! We’ve finally gotten down to C all by itself, except, we’ve got this annoying little negation sign in front of it. How do we interpret that? Well, since we’ve broken down each part individually, we know that every line in that argument must be true. So in order to make ¬C true what value does C need to be? False! That means that the value of C in that argument must be false! Notice how few lines of work we have compared to a truth table. It’s really important to also note that every line is numbered. Please don’t forget to number your lines! Once you get better at this, deriving new facts from a premise using the & Elimination rule will get easier, I promise.
Before I move onto the next rule, here are some exercises so you can further practice your skills at applying the & Elimination rule:
Conjunction Elimination Practice
Using the rules of ∧ elimination find out the true value of the stated letter from each premise below. You can find the answers at the bottom of the post.
- What is the value of D if the sentence (A∧B)∧(¬C∧(A∧D)) is true?
- What is the value of F if the sentence (A∧B∧(¬C∧D∧(E∧¬F))) is true?
Conditional Elimination
We’re finally ready to move onto one of the last rules we’re going to be learning here today, conditional introduction! Let’s say we have two premises, A→B and A. This means that A, whatever it represents, is true, and that the complete sentence A→B is also true. Using our terminology that we learned before, that means that we know that if the antecedent is true, and that the whole sentence is also true. If we refer back to the truth table for the conditional, you’ll see that the only scenario where the sentence is true and the antecedent is true is when the consequent is also true8. That means that B, our consequent, must be true as well. We can show this formally below:
- 1. A, Premise
- 2. A→B, Premise
- 3. B 1−2,→Elimination
This act of removing the conditional and getting the consequent out is known as “conditional elimination”. English can demonstrate this easily too! Let’s say my premises are “I have a dog” and “If I have a dog, then I will own dog food”. We can use this rule to deduce that since I have a dog, I must also own dog food! See, you’ve been using deductive reasoning all your life! There is a common mistake that happens though when we come across this rule. If we make our premises: “If I have a dog, then I will own dog food” and “I have dog food”, can we infer that I have a dog? No! Maybe I’m storing the dog food for a friend or I own a shop that sells dog food. Just because I own dog food, doesn’t mean I have a dog. Conditional elimination goes only one way!9 This rule makes logic a lot more interesting and enables us to understand “conditional introduction” which will help us prove all sorts of interesting arguments!
Conditional Elimination Practice
Use natural deduction and the rules learned above to prove the following. Explanations for how to prove them can be found at the bottom of the post.
- Premises: A∧B, A→C. Prove that C is true
- Premises: A∧B, B→C, C→(D∧E). Prove that E is true
Conditional Introduction
Let’s say we want to get A→C, but our only premises are A→B and B→C. Normally, we’d be stuck. You can’t get A→C out of the above premises with our previous rules no matter what you do. What you need is the premise A to get you started. Natural deduction gives you a very special power that will help us get out of this predicament, but you need to use it very carefully. If we use it, then our argument would look like this:
- 1. A→B ,Premise
- 2. B→C ,Premise
- 3. A Assumption
- 4. A→B 1,Reiteration
- 5. B 2,3,→Elimination
- 6. B→C 2,Reiteration
- 7. C 5,6,→Elimination
- 8. A→C 3−7,→Introduction
Let’s break down this argument line by line. First, we have our two premises, clearly stated at the top. Then we “assume” A to be true. When we do this, we need to add a line called a “scope line” that should continue as long as we have that assumption in place. This makes it clear where our assumption holds. You are allowed to assume absolutely anything that you want as by making it an assumption it becomes true. However, if you assume something that would be inconsistent with the premises, you will run into issues10. For example, if your premises were “A” and “B” it wouldn’t make sentence to assume “¬A” since A can’t be both true and false. If you pay close attention to the example above, you’ll notice that the scope line eventually ends. When it does so, we say that the assumption we’ve made has been “discharged”. This means that if you wanted to work with the assumption of “A” as true, then you’d need to assume it again.
Something important to understand when making assumptions is that not everything you do within the scope line will still hold to be true outside of it. For example, if I have an assumption like A∧B I could use conjunction elimination to get B. The thing to keep in mind is that B will only be true if the assumption holds. That’s why you could use something like (A∧B)→B outside of that scope line, but not just the individual sentence. There are various rules which allow you to, in a sense, “take things out” from what’s contained in the scope line. This is why it’s so important to make those lines clear.
For the last part of the example above, from lines 4-7, we use our basic conditional elimination rule like we did before. Finally, in the last line we “discharge” our assumption, but we have clearly shown that when you assume A you can retrieve C. That proves that A implies C so A→C must be true, even if A isn’t one of our premises. There’s lots more complications and rules to how you can use assumptions, and you can even have scope lines within scope lines, but that’s all outside of the scope of this post.
Conclusion
With that, we’re done! You can now take the argument that we did at the start and try to prove it on your own! The premise was (A→B)∧(B→C) and the conclusion was A→C. Try to do it without consulting how I did it at the top, although feel free to look back at it if you need extra clarification! I hope this short(ish) explanation has piqued your interest and makes you want to learn more about formal logic. In the interest of time and length, I skimmed over lots of details that are really important when studying this subject, so if you have the time, I highly recommend that you find an introductory resource that you enjoy and use it to teach yourself more! I learned a lot of the information from this post thanks to the book “A Modern Formal Logic Primer” by Paul Teller which I’ve loved learning from and I totally recommend it. This isn’t the end of my logic learning journey and hopefully, it won’t be this won’t be the end for you too! There’s so much depth and complexity to be found, so many questions to be asked, problems to be solved, and different forms of logic. Each form of logic has different rules and bends your brain in new ways. It’s a big world of logic out there, go explore it! Until next time!
Answer Key for exercises
Transcribing Practice
- The simplest form of this sentence is (A∧B)∨¬C.
- This sentence can look like this A∧B∧¬C. Here, ‘but’ is transcribed into & which makes sense! The sentence “I like apples and I like bananas and I do not buy them in the supermarket” has the same meaning as sentence one. If you’re ever unsure about if you’ve transcribed a sentence into logic correctly, you should try to change it back into English and see if the meaning still holds.
- This sentence has two possibilities ¬(A∧B) or ¬A∨¬B. Each one can be transcribed back into English as follows: “I do not like apples and bananas”, for the first possibility, and “I do not like apples or I do not like bananas” for the second. Both of these sentences have the same meaning, and are good examples of De Morgan’s laws which explain this type of logical equivalence. If you want to understand more about why these are equivalent, I highly recommend you check out that link.
Truth Table Practice
-
A B C A∧B (A∧B)→C T T T T T T F F F T F T T F F F F F F T -
A B C A∨C A∧C (A∨C)→(A∧C) T T T T T T T F F T F F F T T T F F F F F F F T
Conjunction Elimination Practice
- True
- False
Conditional Elimination Practice
- In this problem, you needed to use conjunction elimination to get the sentence “A” and then you could apply conditional elimination to prove that C is true.
- In this scenario, you needed to use conjunction elimination to get the sentence “B”, and then use conditional elimination with the second premise to get the sentence “C”. Finally, you used “C” to eliminate the conditional of the last premise. In order to prove that “E” was true you then needed to use conjunction elimination to get “E” all by itself.
Footnotes:
-
The language that we use to describe the language of logic is called the “metalanguage”. In our case, our metalanguage will be English with a couple of extra features added (like capital letters representing sentences), which allows us to describe how logic works. ↩
-
So there’s a bit of a problem when I say ANY sentence. See, I can only work with sentences that are truth functional. What that means is that whatever sentence I’m using has to have a true or false value. Sentences that ARE truth functional including things like: it is raining, I like chocolate, I ate an apple. These sentences are either true or not, those are the only two options. Sentences like “Do you like the rain?” or “Do your laundry” are not truth functional. They do not have true or false values. There are other forms of logic that deal with these things, but I will be focusing on the basics today, so only truth functional sentences here! ↩
-
While that will work for simple examples, in actuality, logical symbols apply to the shortest complete sentence. I’ll get into this more later. ↩
-
I mean yes, conjunction is most easily translated as the English word “and”, but like with everything in logic there’s a lot more nuance to it. Like I said in footnote number 1, the sentence needs to be truth functional. You can use “and” in English to embed more meaning into sentences then the logical “and” has. In a sentence like “I opened the car door and started driving” you’re really saying “I opened the car door then started driving”. The other way around wouldn’t make sense in English, but formal logic wouldn’t have a problem with it. ↩
-
So I used the word ‘transcribed’ here instead of ‘translated’ into logic which is a distinction I picked up from Teller’s Logic Primer. When you say you’re translating something what you’re stating is that both sentences have the same meaning. This isn’t really true when going from logic to English or vice versa. As we saw in footnote 3, meaning can sometimes be lost or gained through going from one form to another. That’s why I use the word transcribing. ↩
-
So formal logic deals with the structure behind arguments and will give you logical conclusions…assuming that your premises are true. This is where the difference between validity and soundness come in. You can have a valid argument where you’re following all the rules of formal logic, but if your premises are based off of false information then your argument will not be “sound”. ↩
-
This act of inferring new information based on previous premises is known as a rule of inference! ↩
-
I called this conditional elimination, but if we used mathematical terminology, you’d call this “modus ponens”. ↩
-
Of course, if you want a sentence to go both ways then you’d have to write something like “If I have a dog, then I will own dog food AND if I own dog food, then I have a dog” which we can translate to logic as “(A→B)∧(B→A)”. Formal logic also has a nifty little symbol that does this all in one go, the bidirectionality logical connective. ↩
-
Well, really you’ll only run into issues if you’re unsure of what you’re doing. In fact, assuming something that you know will go against the premises in order to get a contradiction is actually a valid strategy you can use to solve a natural deduction problem. You can read more about that here. ↩