Index
An index of all Computational Redstone Guides by IAmLesbian, this one included.
Prerequisites
Logic Gates
Covers the basics of Logic with Redstone
Boolean Algebra
Boolean Algebra is an area of mathematics which deals with operations on logic values. It is one of the key tools required when attempting to design your own logic for a circuit. We have a few different symbols we generally make use of. The exact characters used for each operation vary, but the ones I’m using here are as follows.
!A = NOT A
A | B = A OR B
A & B = A AND B
A ^ B = A XOR B
Beyond that, Boolean Algebra is what you might expect. You can use parenthesis, comparisons, etc. in your expressions. As for the order of operations, I’ll be using the following order.
& ^ | !
Now, as an example, here’s an expression with OR and XOR.
Note that I’ll be using True and False
but it’s the same as On and Off
or 1 and 0
.
A = True | False ^ True
A = True | True
A = True
A quick variation on that example leads us to a different result.
A = (True | False) ^ True
A = True ^ True
A = False
Now for some lessons on the Laws of Boolean Algebra.
Laws of Boolean Algebra
The name of each law isn’t vital to remember but they are included. First, we start with The Annulment Law. Anything OR False will be itself, same with anything AND True.
A | False = A
A & True = A
The Identity Law is similar, anything OR True will always be True, while anything AND False will be False.
A | True = True
A & False = False
The Idempotent Law shows us that including the same value for both inputs of an OR or AND operation simply gives is that same input.
A | A = A
A & A = A
The Complement Law is about operations where the inputs are something and its inverse. For an OR operation, this is True. For an AND operation, this is False.
A | !A = True
A & !A = False
The Commutative Law simply shows us that OR and AND treat inputs the same, regardless of ordering.
A | B = B | A
A & B = B & A
The Double Negation Law shows us that a double negative is the same as no negative.
!!A = A
de Morgan’s Theorem shows us the relationship between OR and AND. Inverting both inputs, OR, and inverting the output, is the same as an AND operation.
!A | !B = !(A & B)
!(!A | !B) = A & B
The Distributive Law shows us how inputs can be distributed to other inputs within parenthesis.
A & (B | C) = (A & B) | (A & C)
A | (B & C) = (A | B) & (A | C)
The Absorptive Law may seem more confusing, but all it really says is that in those two situations, the output is the same as the input which appears twice.
A | (A & B) = (A & True) | (A & B) = A & (True | B) = A & True = A
A & (A | B) = (A | False) & (A | B) = A | (False & B) = A | False = A
The Associative Law means the way we group elements together is equivalent if they’re on the same level.
A | (B | C) = (A | B) | C
A & (B & C) = (A & B) & C
That was a lot of different laws, all of them are important for Boolean Algebra. To give us a bit more practice, let’s review some additional problems.
Problems
1) Prove the following equation.
A | (!A & B) = A | B
Solution
Using the Distributive Law, we can apply A to both parts of the second term.
(A | !A) & (A | B) = A | B
Then from there, the first term can be modified according to The Complement Law.
True & (A | B) = A | B
A | B = A | B
And just like that, we have our solution.
2) Simplify the expression.
(A & B) | (A & (B | C)) | (B & (B | C))
Solution
The 2nd and 3rd terms follow the Distributive Law, so we’ll break them apart to help us cancel out some terms.
(A & B) | (A & B) | (A & C) | (B & B) | (B & C)
The 1st and 2nd term match the Idempotent Law. It also applies to the 4th term.
(A & B) | (A & C) | B | (B & C)
For the last 2 terms, we have a case of the Absorptive Law.
(A & B) | (A & C) | B
Fortunately for us, the Absorptive Law applies again with the 1st and 3rd terms.
(A & C) | B
We have successfully simplified our expression from involving 8 instances of inputs down to just 3. This is the power of Boolean Algebra and its laws.
3) Simplify the expression.
(A | C) & ((A & D) | (A & !D)) | (A & C) | C
The last 2 terms work well with the Absorptive Law.
(A | C) & ((A & D) | (A & !D)) | C
We can use the Distributive Law on the 2nd term.
(A | C) & (A & (D | !D)) | C
Then, we can use the Complement Law to help clean up the 2nd term again.
(A | C) & (A & True) | C
Finally, the middle term can become A using the Annulment Law.
(A | C) & A | C
The Absorptive Law can be applied to the 1st and 2nd terms to leave us with our end result.
A | C
Continue
Currently, there is no guide to follow this one. Once there is, this will be updated to include a link to it.