For any function, it has a set of inputs and one output.

2021-04-24

First, let's take the AND gate as an example: The four inputs of the AND gate are: 00, 01, 10, 11, and the four corresponding outputs are: 0, 0, 0, 1. Therefore, I can use a string of encoding to represent the complete logic of the AND gate: 1000. Here, 11 corresponds to the fourth bit, 10 corresponds to the third bit, 01 corresponds to the second bit, and 00 corresponds to the first bit. Subsequently, we can express 0010 && 1010 = 0010 as (0010, 1010)(1000) = 0010, where 1000 represents the rule. This raises the question: if we arbitrarily change the rule encoding, will there always exist a corresponding rule? The answer is definitely yes. For example, if we define a rule encoding called 1010, what does it mean? It means: if the input is 11, then the output is 1; if the input is 10, then the output is 0; if the input is 01, then the output is 1; if the input is 00, then the output is 0. What does it mean when we change the length of this rule encoding? It essentially means that the number of input elements has been changed. For instance, with two inputs, the possible cases are 2² = 4, requiring 4-bit length. If there is only one input, the possible cases become 2¹ = 2, requiring 2-bit length. For example, rule 01 means: if the input is 1, then the output is 0 (because the second bit in 01 corresponds to 0); if the input is 0, then the output is 1 (because the first bit in 01 corresponds to 1). Similarly, if the encoding is 01011010, this corresponds to three inputs (from 111 to 000) and their resulting outputs.