How On Earth Do Machines Understand Us?

Shreejan Singh Silwal
The Zerone
Published in
7 min readJan 8, 2023

How do machines understand us? My computer seems to understand English well enough. Yours might understand Mandarin. However, anyone with a little technical knowledge will tell you that you can only communicate with machines using programming languages like Python or C or JavaScript but not HTML.
But here’s the catch. This is what a python code snippet looks like:

Can you guess what it does? Yes, you guessed it right. It instructs the computer to print (display) the text “Hello world”.

The point here is that even these so-called programming languages seem to be very similar to English. Let’s look at a slightly more complex code snippet.

Can you guess the output? Of course you can. It’s 3.
Again, the point here is that these languages are designed to be readable to us humans. But can machines understand this?

Short answer; they can’t. Life would be so much easier if we could just pile up some plastic, some copper and perhaps some silicon, connect it to a power supply and voila, the blob understands python. Unfortunately, things don’t work that way.

You might have heard somewhere that machines understand the binary language that is ones and zeros. Except they don’t. They are just inanimate objects that understand nothing at all. However, we can create an illusion, as if they do understand the binary language.
Here’s a simple example:

Figure 1
Figure 2

When the switch is turned on as shown in figure 1, the bulb glows and when it is turned off as is the case in figure 2, the bulb doesn’t glow. I.e.

If we consider randomly that ON means ‘1’ and OFF means ‘0’, it’s almost as if this circuit understands binary. Whenever the input (switch) is ‘1’, the output (Bulb) is ‘1’ and the output is ‘0’ whenever the input is ‘0’.

Such a table is known as a truth table.

Let’s get a little more adventurous and use two switches, shall we?

Figure 3

In the above configuration, the bulb glows only when both switches S1 and S2 are turned on and the bulb doesn’t glow in all other cases. Let’s create a truth table.

This particular configuration is known as an AND gate. It is denoted by a dot “.” which means that “A.B” is read as “A AND B”.
In a circuit, the symbol of AND gate is:

Figure 4: Symbol of AND gate

Similarly, there are different other logic gates which are nothing but different configurations of switches. There are two other basic gates namely OR gate and NOT gate and four other combinational gates namely NAND gate, NOR gate, XOR gate and XNOR gate made by combining the basic gates. Please look these up and understand their workings before proceeding.

Now the question may arise, “Are all computers just combinations of switches?”. Well most digital computers are. We just don’t hear the switches clicking due to the fact that the switching is done using electronic switches called transistors. There are billions of transistors on this very device you are currently using to read this article. In fact, there are about three billion transistors in a single Intel i7 processor chip.

Now, assuming that we are somewhat familiar with the idea of logic gates, let’s find out how we can perform simple addition and subtraction using these logic gates. We’ll start by building a simple 1-bit adder. You must be familiar with basic binary addition for this. First step in building any combinational circuit is constructing its truth table.

Here, A and B are 1-bit inputs. S is the sum of A and B and C is the resulting carry. Now, let’s break this table down into two parts.

Looks familiar? It is the truth table for XOR gate. So we can simply say,
S = A XOR B.

Similarly,

You might have already figured out that,
C = A AND B.

Let’s create a combinational circuit from this information.

Figure 5: 1-bit Adder Circuit

In a similar fashion, we can create a 1-bit subtractor circuit.

Figure 6: 1-bit Subtractor Circuit

You can try to verify the circuit by creating a truth table.

These simple arithmetic circuits can be further combined to build circuits that can perform more complex arithmetic operations as multiplication is just repeated addition and division is just repeated subtraction. You can further study how it’s done if you’re interested. However, the goal of this piece of article is to see how machine language works. So, instead of going into details of combinational arithmetic circuits, we’ll build a simple 1-bit calculator and try to program it using machine language.

Figure 7: Simple 1-bit Calculator

This simple calculator is made up of an adder and a subtractor. A and B are inputs. S is the sum of A and B as C is the resulting carry. D gives the difference of A and B while required borrow is BR. Then what exactly is I? Most electronic chips come with a control input called chip select. The purpose of it is to make a chip active only when necessary. It is denoted by CS’ in the adder and CS in the subtractor. That means the adder is active low and the subtractor is active high which, in turn, means that adder is selected when I is ‘0’ and subtractor is selected when I is ‘1’.

For example, if we provide the instruction I=0, A=1 and B=0, the output is S=1 and C=0. Since addition is selected the value of D and BR is not of our concern.
Now, let’s create a truth table for this calculator.

Thus, a proper code for subtracting ‘0’ from ‘1’ would be ‘110’ written in sequence IAB. This is how we can program this calculator to add or subtract bits. Could you have guessed what ‘110’ meant, if you didn’t have any knowledge about the internal structure of the machine? Of course, not. So we can say that machine language is not easily readable to humans.

Also, we can conclude that this code would be much more complex if our machine was more complex. Imagine programming an Intel I7 processor having billions of components in this way. Also, the code written for this machine can be used on this machine only. ‘011’ here means add ‘1’ and ‘1’. The meaning of ‘011’ could be completely different on a different machine. Hence the machine language is said to be machine dependent.

Here’s where high level languages like Python, C, Java and others come in. These languages are easier to understand regardless of the complexity of machines and are not machine dependent, meaning a code written in one machine can be used in another machine. The game you play on your phone can easily be installed on your friend’s phone as it is written in a high level language. But computers don’t understand high level languages. Therefore a translator is required to convert source code written in high level language into machine code. Compilers and Interpreters for different high level programming languages are available for this purpose. Compilers and interpreters are basically translators that translate the source code you write in high level languages to machine language.

As artificial intelligence advances rapidly, particularly in the field of natural language processing, computers are becoming more proficient at understanding human language. You can order Siri to play your favorite playlist simply by speaking English. You can even order ChatGPT to build your programming project for you. So it’s easy to assume that computers have got brains of their own. But now we know, fundamentally, it’s all about turning switches on and off.

Hence, this is how machines understand us.

--

--