The branch of algebra in which the values of the variables are the truth values true and false, usually denoted 1 and 0 respectively. It is a formal description of logical relations. It was introduced by George Boole in his first book The Mathematical Analysis of Logic in 1847.
Alternative names for true and false:
There are three basic operations, all of which have two inputs and one output.
- AND, formally termed conjunction and denoted by . The output is true iff (iff means if and only if) both inputs are true.
- OR, formally termed disjunction and denoted by . The output is true if either of the inputs are true. This is sometimes also referred to as inclusive disjunction. This is because the output is true if either of the inputs are true, including the case where both inputs are true.
- NOT, formally termed negation, and denoted by . The output is simply the opposite of the input.
There are also several "shortcut" notations that we can use for more succinct expressions:
- conjunction may be written as multiplication, i.e. or, more simply,
- disjunction may be written as addition, i.e.
- negation may be written with a bar above the variable, i.e.
All Boolean operations can be expressed through a composition of these basic operations.
- NAND is denoted by and is equivalent to the negation of the result of , i.e. . The output is true in all cases except when both A and B are true.
- NOR is denoted by and is equivalent to the negation of the result of , i.e. . The output is true only if both A and B are false.
- EQUAL, formally termed equivalence and denoted by . The output is true iff both inputs have the same value.
- XOR, formally termed exclusive disjunction and denoted by , , , . The output is true if either of the inputs are true but both are not true. Compare this to inclusive disjunction.
- IMPLY, formally termed material implication and denoted by . This is sometimes read as "if A then B" or "A implies B". The output is true in all cases except the case where A is true and B is false.
- CONVERSE IMPLY, formally termed converse implication and denoted by . This is sometimes read as "if B then A" or "B implies A". The output is true in all cases except the case where B is true and A is false.
- BIDIRECTIONAL IMPLY, formally termed material biconditional and denoted by . This is sometimes read as "A if and only if B" and abbreviated as "A iff B". It is logically equivalent to . The output is true if both A and B are true or if both A and B are false.
- Why is one of the symbols used for exclusive disjunction ?
Order of Operations
Expressions with multiple operators are evaluated from left to right, respecting the operator precedence as follows:
- (NOT) has the highest priority, followed by
- (AND), (NAND)
- (OR), (NOR)
- (IMPLY), (CONVERSE IMPLY)
- , , , (XOR), , (EQUIV)
As always, parentheses may be used to both emphasize and override the order of operations.
For clarification, here are several examples of equivalent expressions:
|Without Parentheses||With Parentheses|
It is important to note that the precedence list above, while generally agreed upon, is not implemented by all computer programming languages. It's important to pay close attention to the rules of each language, or, better yet, use parentheses to avoid ambiguity.
Truth tables provide us with a straightforward means to specify the required output(s) for the specified input(s), in table form. On the left-hand side of the table we enumerate the input(s) and on the right-hand side of the table we specify the output(s). Assuming that we have inputs we may label each input as . The value of the inputs on any given row, may be referred to as an input tuple. Likewise, assuming that we have outputs we may label each output as , and the value of these outputs on any given row may be referred to as an output tuple. The number of rows in any such table is given by the formula . When there is a single output, we can formalize the relationship as
- Why is the formula for determining the number of rows in a truth table related only to the number of inputs, and why is the formula ?
Note that for convenience we sometimes label inputs as A, B, C, etc. rather than etc. and do the same for outputs, often beginning with the letter Q.
When writing truth tables, it is very helpful to always write them in the same order. This helps in reading and memorizing the tables because we can simply memorize the output column(s), because the input columns will always be the same. For example, consider the AND truth table:
Rather than memorizing the entire table, we can just memorize the output column, i.e. 0 0 0 1. And, in most cases, we really only need to memorize the exceptional cases. We call this the standard order, i.e. ascending order of the binary inputs.
There are possible single-output Boolean functions that can be defined over inputs. These are enumerated, with explanations, in the following table.
|Function Name||Boolean Algebraic Formula||Truth Table||Explanation|
|AND||0||0||0||1||x and y are true|
|AND NOT||0||0||1||0||x is true and y is false|
|0||0||1||1||x is true, y is irrelevant|
|NOT AND||0||1||0||0||x is false and y is true|
|0||1||0||1||y is true, x is irrelevant|
|XOR||0||1||1||0||x is true or y is true but both are not true|
x is different than y
|OR||0||1||1||1||Either x or y is true|
|NOR||1||0||0||0||Neither x nor y is true|
|EQUIVALENCE||1||0||0||1||x is the same as y|
|NOT||1||0||1||0||y is false, x is irrelevant|
|IMPLYs||1||0||1||1||x is true or y is false|
|NOT||1||1||0||0||x is false, y is irrelevant|
|IMPLYs||1||1||0||1||y is true or x is false|
|NAND||1||1||1||0||x and y are not both true|
As discussed above, regardless of the function being implemented, each input and output combination can be represented by a single row in a truth table. Therefore, if we correctly represent each row, and then join those representations together, we'll be able to accurately recreate the function. There's a very straightforward means of doing so:
- For each output, we consider only those rows where the output value is true. We then form an expression representing all of the inputs for that same row, either the value of the input itself (if true) or its negation (if false), so that the result is true.
- We join each of the above expressions using disjunction.
Let's consider some examples:
The first step is to scan through each row and note each case where the output is true. In the case of conjunction, there is only one such row, row #4:
The expression representing the inputs for this row is simply , that is, the conjunction of and . Because there are no other rows for which the output is true, we're done. Thus, the canonical representation of is simply . Let's consider a slightly more challenging example:
Again, the first step is to scan through each row and note each case where the output is true. In the case of exclusive disjunction, there are two such rows: row #2 and row #3. The expression representing the inputs for these rows are for row #2 and for row #3. To complete the canonical representation, we combine the expression for each row with disjunction. Thus, the canonical representation of is .
Let's consider one final example, function f:
We note those rows in which the output is true: row #2, row #6, and row #7. The expressions representing the inputs for these rows are:
Combining these expressions with disjunction yields our canonical representation: .
De Morgan's Laws
De Morgan's Laws provide a helpful formula to obtain the same truth table of:
- an AND operation by using negation and an OR operation, or
- an OR operation by using negation and an AND operation
The Laws are:
- J1013 Create a journal and answer all questions in this experience. Be sure to:
- edit your journal using emacs within your ~/Journals directory
- properly name your journal as J1013.txt
- include all sections of the journal, properly formatted
- push your changes to GitHub
- properly tag your journal as J1013.Final
- push your tag to GitHub
- M1013-10 Complete Merlin Mission Manager Mission M1013-10.
- M1013-11 Complete Merlin Mission Manager Mission M1013-11.
- M1013-12 Complete Merlin Mission Manager Mission M1013-12.
- M1013-31 Complete Merlin Mission Manager Mission M1013-31.
- Boolean Algebra (Wikipedia)
- De Morgan's Laws (Wikipedia)
- Logic Gates (Wikipedia)
- Truth Table (Wikipedia)
- Schocken, Simon and Nisan, Noam. The Elements of Computing Systems. MIT Press, 2005.
|Knowledge and skills||§10.321|
|Topic areas||Boolean algebra|
|Classroom time||60 minutes|
|Study time||4 hours240 minutes <br />|
|Acquired knowledge||understand the principles of Boolean algebra|
understand the use of operators in Boolean algebra
understand the order of operations in Boolean algebra
understand how to use truth tables
understand how to represent a Boolean expression canonically
understand the use of DeMorgan's laws
|Acquired skill||demonstrate proficiency in using Boolean algebra|
demonstrate proficiency in constructing and using truth tables
demonstrate the use of canonical representation for arbitrary Boolean expressions
demonstrate the appropriate application of DeMorgan's laws