Logic
Logic is a topic of interest in both math and philosophy. In math it forms much of the bedrock on which the entire discipline stands. An intuitive introduction to the most widely used basics is contained below.
Statements, Truth Tables, and Boolean Variables
Logic deals with the truth value of Statements. The statements allowed must be either true or false (never both at the same time). For instance the statement which follows.
"It is raining outside."
This statement is either true or false. It is either raining or it is not raining.
Often it is convenient to label our statements with letters much like variables in algebra. These variables can only take values of true or false and are called Boolean Variables. Lets define the statements and as follows.
Statement
"The person is wearing a red shirt."
Statement
"The person is wearing blue pants."
A Truth Table is a catalogue used to represent all the possible combinations of truth values of the statements being studied. Note all statements are either true (T) or false (F). The images and wordy explanations presented here are for learning purposes and are not part of the truth table structure.
Of course when a statement is false the result might be more subtle than the example illustrated to the right. For instance if is false perhaps the shirt is Yellow rather than missing entirely.
Basic Operations
It is useful to define operations on these Boolean Variables, so that we can do Boolean Arithmetic. Boolean Arithmetic is much like arithmetic on numbers except there are only two values, true and false (rather than an infinite set of numbers).
Negation (NOT)
The Negation of is written as and serves to invert the truth value of . The word "NOT" is used to serve this purpose in English.
We can also write compound statements. In a Compound Statement we combine two or more statements we already know the truth values of with an operator. This is much like creating a compound sentence in English.
Conjunction (AND)
The Conjunction of two statements is written as . It gives true only when both and are true statements. The word "AND" is used to achieve this in English.
Disjunction (OR)
The Disjunction of two statements is written as . It gives false only when both and are false statements. The word "OR" is used to achieve this in English. "OR" is ment in the inclusive sense, meaning that can be true, can be true, or both can be true at the same time.
Disjunction (XOR)
The other form of the disjunction (exclusive or, "XOR") is another useful operation. It is written . It is not popular in Math or Philosophy, but is very popular in computer programming. It is true only when one or the other of and are true, but not both at once.
Implication Operations
There are two more logic operations which are very useful in Math and Philosophy.
Conditional Statement (IF)
The Conditional Statement (also called Implication, or Material Implication) is the most difficult operation to understand. It is written . It is always true unless A is true and B is false. In English we would call this an "IF statement" or an "IF THEN statement". It works like a promise. If you do then I will do . If you do not do I can choose to do or not to do B without breaking my promise. However if you do I must do otherwise my promise is a lie. Consider the following statements.
In Words | |||
T | T | T | You earn 100% on your exam, is a TRUE statement. You get 100% in the class, is a TRUE statement. IF you earn 100% on your exam, THEN you get 100% in the class, is a TRUE statement. |
T | F | F | You earn 100% on your exam, is a TRUE statement. You get 100% in the class, is a FALSE statement. IF you earn 100% on your exam, THEN you get 100% in the class, is a FALSE statement. |
F | T | T | You earn 100% on your exam, is a FALSE statement. You get 100% in the class, is a TRUE statement. IF you earn 100% on your exam, THEN you get 100% in the class, is a TRUE statement. |
F | F | T | You earn 100% on your exam, is a FALSE statement. You get 100% in the class, is a FALSE statement. IF you earn 100% on your exam, THEN you get 100% in the class, is a TRUE statement. |
Statement
"You earn 100% on your exam."
Statement
"You get 100% in the class."
The Conditional statement is the following. "If you earn 100% on your exam, then you get 100% in the class." If you earn 100% on your exam and you don't get 100% in the class then my conditional statement is a lie. If you earn 100% on your exam and get 100% in the class then I have told the truth. If you earn any other grade than 100% on your exam then I can give 100% in the class or not and the conditional statement is true, because I made no promise for any other grade than 100% on the exam. In the real world, other factors would be considered too (graded assignments, class participation, etc.), but that information is not part of the conditional statement given.
If the condition is true it implies the statement must be true for the compound statement to be true. If the condition is false then the compound statement implies nothing about B, so it can be true or false. The truth table follows.
The conditional statement can also be written as " IF ", and in a variety of other forms too. is often called the Premise or Hypothesis and the Conclusion.
Biconditional Statement (IFF)
In Words | |||
T | T | T | You earn 100% on your exam, is a TRUE statement. You get 100% in the class, is a TRUE statement. IF AND ONLY IF you earn 100% on your exam, THEN you get 100% in the class, is a TRUE statement. |
T | F | F | You earn 100% on your exam, is a TRUE statement. You get 100% in the class, is a FALSE statement. IF AND ONLY IF you earn 100% on your exam, THEN you get 100% in the class, is a FALSE statement. |
F | T | F | You earn 100% on your exam, is a FALSE statement. You get 100% in the class, is a TRUE statement. IF AND ONLY IF you earn 100% on your exam, THEN you get 100% in the class, is a FALSE statement. |
F | F | T | You earn 100% on your exam, is a FALSE statement. You get 100% in the class, is a FALSE statement. IF AND ONLY IF you earn 100% on your exam, THEN you get 100% in the class, is a TRUE statement. |
Finally the Biconditional Statement. It is written . In English we say "If and only If", sometimes abbreviated "IFF". This is what people usually mean when they use the word if in English. This statement is true if both and are true or if both and are false. It is false if and do not have the same truth value. It is like a promise which is only fulfilled if the condition is met.
BONUS EXAMPLE
A more mathematical example would be the following statements.
Statement
"x in an even number."
Statement
"x is divisible by 2."
It is clearly the case that these two statements are true or false at the same time, as the second statement is the definition of the first. Applying the biconditional with these will give exactly the truth table expected.
It is interesting to note that the biconditional and "XOR" are one negation away from having the same truth table. In fact in digital computers the XOR gate and a NOT gate are what is used to implement the biconditional, which is in turn used to check equality. This implementation is preferred so as to minimize the number of transistors required to make a gate that can check equality of binary digits.
Order of Operations, Logical Equivalence, Tautology and Contradiction
T | T | F | F |
T | F | T | T |
F | T | F | F |
F | F | F | F |
T | T | F | F |
T | F | T | T |
F | T | F | F |
F | F | T | F |
T | T | T | F |
T | F | F | T |
F | T | T | F |
F | F | T | F |
When more than one operation is used in a compound statement we follow an order of operations, much like with algebra. The order is brackets, negation, conjuntion, disjunction (OR), conditional, and finally biconditional. XOR is used mostly in computers and the practical implications of this are messy (bitwise operators vs boolean/logical operators). Check out this Wikipedia link if you are curious, otherwise forget about XOR for now. I'll remind you when it comes up in future lessons.
Here's an example of how to approach creating a truth table for the compound statement . First we write down all possible combinations or truth values for the simple statements , and . Then we work our way through the order of operations writing the truth values of each increasingly complex statement as we build our way out to the whole statement. It's just like BEDMAS. Note we don't know the content of the statements and , but that's okay. We just want to look at how the logic computes. We want to consider every combination of truth values, so we can quickly look up the answers in our table for specific examples at a later date.
We repeat similar procedures for . Note you can just continue the first table (instead of separating them) to avoid repeating yourself. That will bring the twelve columns represented here (in three separate tables) down to six (in a single table).
The final truth table values are the same for both of our expressions.
T | T | F | F | T |
T | F | T | T | T |
F | T | F | F | T |
F | F | F | F | T |
This means the two expressions are Logically Equivalent. We write this . Some people use instead of . We will avoid this notation for clarity. Out of curiosity, lets consider what the truth table would look like for the statement .
This statement is always true, regardless of the choice of truth value for and . Such a statement is called a Tautology. If instead we negate the statement to get the new statement is now always false. This kind of statement is called a Contradiction. Template:Vpad
Quantifiers
There are 3 quantifiers generally used in mathematical logic. They are (For All/For Every, ie. all), (There Exists, ie. some), and (The Does Not Exist, ie. none).
In example here are three statements. All humans are people. Some humans are named Alice. No humans are fish.
Generally it is preferred to find statements that apply to every case. Often the cases, where only some values work, can be subdivided to create new statements for which statements are true universally. The symbols will be explored further in Set Theory, where they are used extensively.
Applications
Logic is foundational in mathematics. It forms the framework in which proofs are done.
Beyond math, logic is also used extensively in Digital Circuits and computer programming.
It also makes up the foundation of how to make an argument and thus is an integral component in most academic pursuits.
Examples
T | T | T | T | T | T | T |
T | F | F | F | T | F | T |
F | T | F | T | F | F | T |
F | F | T | T | T | T | T |
T | T | T | F | F | F |
T | F | F | T | T | F |
F | T | T | F | T | T |
F | F | T | T | T | T |
Finding A Truth Table
Find the truth table for the statement . Note the result is logically equivalent to .
Showing Logical Equivalence
Show that the statements and are logically equivalent and thus that the statement is a tautology.
Exercises
Rules of Boolean Algebra
Below are the Rules of Boolean Algebra (often referred to as Rules of Replacement, Laws, or Identities). These rules are all the operations we need to do algebra on Boolean variables. For practise, please use truth tables to prove the logical equivalence of these statements. Please use the systematic (step by step) approach to building truth tables which is shown in the examples section.
Tautologies (Another Notation)
All of the above rules are tautologies as the left and right sides are logically equivalent. Which ones have a left or right side which is already a tautology or contradiction on its own? Hint no truth tables needed, its right in the rules.
Extra Practise
If you want more practise, try looking up rules of inference online and prove these rules using truth tables. Depending on the resource you find, you may have to learn other notations (like those common in philosophy) before you can practise.
Suggested Resources
Truth tables can be checked using Wolfram Alpha online. Logic Calculator with Example Check it out. We'll be using this tool to check our work often.