Resource - A Turing-Style Brain
Resource - A Turing-Style Brain
Estimated date of completion: Unknown (In mid-active progress)
Attribution: xkcd (xkcd.com)
Topics covered in this section: Defining The Boolean, a brief overview of Data Structures, computer memory
The Boolean --
Everything in 'classical' computing comes back to The Boolean (named after its devisor, George Boole). The Boolean is the data structure defined as such: it's either TRUE, or it's FALSE. Really just, dead simple there. In electronics, we represent TRUE using a wire being applied a 'High' voltage (not 'High' like 'DANGER! HIGH VOLTAGE', or 'High' like questionable decisions, but like 'there is current here'), and we represent FALSE using a wire that does not hold current / is ground, or, 'Low'. In an infinite desert of rocks, TRUE is represented by a rock and FALSE is represented by the absence of a rock (according to xkcd 505 "A Bunch Of Rocks" -- great read by the way). But wait, let's back up a second just for clarification;
Data Structures --
Think of 'data structures' as an ordered arrangement of things that mean other things. The Boolean is essentially the simplest usable data structure in Computer Science, and usually, it's trivially easy to represent in a usable and efficient way (see words, electrical mediums, rocks). Beyond "TRUE" and "FALSE", we usually represent configurations of a Boolean in terms of Numbers, i.e. ONE for TRUE and ZERO for FALSE. Furthermore, we can make use of an organized collection of Booleans to represent a Number in the base of Binary-- precisely where the idea of computers as ONEs and ZEROs comes from.
Memory --
Booleans and Numbers are great, but where do we put them, exactly? Well. I don't know, why not just line them up in a, er- well, line? Yeah, no we did that, that's- that's exactly what we did. Put a bunch of Booleans in a row--however many you want--and just consider the leftmost one as the starting point-- we'll call that the ZEROth, because it ends up being easier to start at ZERO than ONE, specifically because we start all the Booleans as FALSE, which we use to represent ZERO, which then means any Number we represent with those Booleans also starts at ZERO, and [this sentence will go on for far too long...]
But, Why? Let's talk about Logic --
Back to George Boole. Boole essentially formalized Logic itself into mathematical terms, which starts with the Boolean. There are about NINE basic Logic operators, SEVEN of which are really important, and THREE of which are absolutely essential: NOT, OR, and... AND. It works like this: NOT takes a single Boolean as input, and spits out whichever value the input wasn't. You give it TRUE? It gives you back FALSE. You give it FALSE? Gives you TRUE. This is the only 100% valid use case for the term 'Vice versa'. AND takes two inputs, and if you give it two TRUEs it gives you back a TRUE, and otherwise returns FALSE. OR takes two inputs as well, but gives you FALSE if you give it two FALSEs, and otherwise outputs TRUE. XOR (exclusive OR) is a similar operator to OR, except it only gives you TRUE if you give it ONE TRUE and ONE FALSE, otherwise returning a FALSE. Notice that all of these basic operators only return a single (ONE) Boolean, and with NOT excluded, the remaining EIGHT receive TWO Booleans. Oh yeah, what are the rest of them?
Logic 'Gates' --
The basic Logic operators, called gates for their gate-like behavior in practice, can express themselves as follows:
NOT(Bool. A): {If A = TRUE, return FALSE; If A = FALSE, return TRUE}
FALSE(Bool. A, Bool. B): {return FALSE} (discards A, B entirely)
NOR(Bool. A, Bool. B): {If A = FALSE and B = FALSE, return TRUE; else/otherwise, return FALSE} ()
XOR(Bool. A, Bool. B)
NAND (Bool. A, Bool. B)
AND(Bool. A, Bool. B)
XNOR (Bool. A, Bool. B)
OR (Bool. A, Bool. B)
TRUE (Bool. A, Bool. B): {return TRUE} (discards A, B entirely)
But that's a lot to write (except for NOT), so I'd recommend this way instead:
Gate(Bool. cX, Bool. cY, Bool. cZ)(Bool. A, Bool. B): {Let C be the amount of TRUEs counted between A and B. If C = ZERO, return cX; if C = ONE, return cY; if C = TWO, return cZ}
FALSE(Bool. A, Bool. B) = Gate(FALSE, FALSE, FALSE)(Bool. A, Bool. B)
NOR(Bool. A, Bool. B) = Gate(TRUE, FALSE, FALSE)(Bool. A, Bool. B)
XOR(Bool. A, Bool. B) = Gate(FALSE, TRUE, FALSE)(Bool. A, Bool. B)
NAND(Bool. A, Bool. B) = Gate(TRUE, TRUE, FALSE)(Bool. A, Bool. B)
AND(Bool. A, Bool. B) = Gate(FALSE, FALSE, TRUE)(Bool. A, Bool. B)
XNOR(Bool. A, Bool. B) = Gate(TRUE, FALSE, TRUE)(Bool. A, Bool. B)
OR(Bool. A, Bool. B) = Gate(FALSE, TRUE, TRUE)(Bool. A, Bool. B)
TRUE(Bool. A, Bool. B) = Gate(TRUE, TRUE, TRUE)(Bool. A, Bool. B)
Or, in other words: Gate([000, 100, 010, 110, 001, 101, 011, 111])(A, B)
Wait, that's just the first EIGHT counting number in binary but, backwards? Yep. And there's a good reason for that, but I'll leave that as an exercise for the reader.
Takeaway points: Booleans are cool, they're great at waiting their turn, and Logic is confusing. Well, the boring part's over.
The Turing Machine --
Let's line up a ton of Booleans for Memory. In fact, let's make it an infinite line. Now let's go to the center of it. Yes, that makes no sense. No, that makes yes sense! Now,
Let's Make That A Little Easier --
//