#boolean marhematics
Explore tagged Tumblr posts
Text
youtube
everything i'm about to say is based on this video up to and including the section on boolean arithmetic, so you should watch this before continuing
i believe i know how to write not only OR (^) as the video challenges, but also NAND (!&), NOR (!^), and XOR.
I'll recap AND (&) first, because in order to reach ^, i had to understand &. & is written as follows:
\xy.(x(y FALSE))
but reasoning this was necessary to understand how to write OR. 2swap mentions using x as a selector, but on first watch, i didn't know what they meant. It took me two or three viewings to understand that x is being used as a stand-in for the first boolean, and this is used to encode the answer. If x is FALSE(F), the output is FALSE, because FALSE is simply a function that picks the second of two values. If x is TRUE(T), x is whatever y is. This is explained in the video.
Now we arrive at OR. The way OR works is that ^ is TRUE if any of its arguments are TRUE. we can encode this as follows:
\xy(x(T_))
If x is FALSE, x will select whatever the second input is, since the statement can still be TRUE is the first statement is FALSE. This is written as:
\xy(x(T y))
This is the OR function.
I also promised NAND, NOR, and XOR, so i will cover !& and !^ next.
I reached !& and !^ with the same reasoning as OR. where x is a function that determines trueness or falseness.
Let's start with NAND. NAND TAKES 2 inputs, and is false if both arguments are true.
\xy(x(__))
Alternatively, we can think of NAND as a function where if ANY input is false, the argument is TRUE. we can write this by encoding TRUE in the second slot, because the argument would automatically pass if the first argument were FALSE.
\xy(x(_T))
if the first argument of NAND is TRUE, !& is whatever the second argument isn't. If x is TRUE, but y is FALSE, !& is TRUE. If x is TRUE and y is TRUE, !& is FALSE. This can be written as:
\xy(x(!y T))
This means if x is TRUE, x is not y, and y will be passed through the NOT function \w(w(F T)).
NOR is simpler. !^ is FALSE if any argument is TRUE.
\xy(x(F !y))
which brings us to XOR. i believe XOR is \xy(x(!y y)). I will explain my though process.
XOR is a function of two inputs that can only be true if ONE of the arguments is TRUE.
\xy(x(__))
If x is FALSE, x is whatever y is. if x is TRUE however, x is whatever y ISN'T.
\xy(x(!y y))
\xy(x((\w.w(f t))y y))
\xy(x((\w.w(\ab.b)(\ab.a) y) y)
2 notes
·
View notes