Article/Ali Tao department F(X) Team – Xu Lun

The two most important things about coding are looking up at the stars and keeping your feet on the ground. Before code review, let’s look at a picture of the starry sky, van Gogh’s starry sky:


Seeing this picture of the starry sky, I wonder if those who have read the Three-Body Problem think of the two-direction foil.


Even those who have not seen the Three-Body Problem are not unfamiliar with the term “dimension reduction attack”. A bidirectional foil is a weapon that turns three-dimensional space into two-dimensional space. Here’s a quote:

“The two two-dimensional structures are clearly visible under the starlight: in the two-dimensional space ship, you can see the three-dimensional structure of the two dimensions unrolled, you can distinguish the cockpit and the fusion engine and so on, and the curled body in the cockpit. In another two-dimensional human body, bones and veins can be clearly distinguished, and various parts of the body can be identified. In the process of 2 d, 3 d object on every point according to precise rules of geometric projected onto a two-dimensional plane, so that the two-dimensional body become the original 3 d space craft and the three dimensional human body two most complete the most accurate drawings, all of its internal structure is arranged on the flat surface, without any hidden, but the mapping rules and engineering drawing completely different, Visually, it’s very difficult to visualize the original three-dimensional shape.”


Here comes the key sentence:

“The biggest difference from the engineering drawings is that the 2d unfolding is done at all scale levels. All the structures and details that were once hidden in the 3D configuration are arranged in the 2D plane, thus showing the infinite detail of the 3D world from the 4d space.”

This is the code Review methodology. The ultimate vision of code Review should be to find all the code that might go wrong, or to prove that the code is correct.

This may be different from the thinking of many code review students. Some students believe that the most powerful code review system should be able to accurately find the code that can be found with bugs in the future, and those that are not found are not counted. This is the most energy saving, but also in line with the good wishes of many students for the cattle. This is essentially a method of induction, which prevents future problems by writing rules for each problem that has been identified. Of course we do. However, when you try to extend and generalize the rules, you will find that they are not easy to implement, even with the existing computing power.

If a problem is finite, then divide and conquer can be used to break the problem down to the atomic state. But if a problem is fractal, you get the same problem no matter how you split it.

So faced with such a complex problem, what should we do? My answer is to figure it out in math. Instead of going through the principles, let’s tell two stories.

The story of ten dimensions

The infinite world is often at odds with our intuition, and a lot of what we perceive as infinite is actually finite. For example, a line on the earth, which intuitively could go on forever, all the way to imaginary infinity, is actually the longest line on the globe of the Earth. For example, on the road yesterday, I heard a pupil tell his classmates that he wanted to put an object in the environment of hundreds of thousands of degrees below zero.

It’s often possible to create multidimensional worlds while writing code. For example, version numbers, major version numbers 1.0, 2.0, 3.0 can form a main line. 1.0 can be independently developed into 1.1, 1.2, 1.3, etc., and each small version can be independently developed into incompatible lines. In fact, it is wrong to use positive real numbers to describe the patch1. It should be described by vectors like [1,0,0], [2,1,0], [3,2,0, patch1].

For example, if all released versions have the same patch1, then linear growth is easy to get confused. For example, there are versions 1.0.0, 1.0.1, 1.1.0, such as 1.0.0 to 1.0.2, 1.0.1 to 1.0.3, 1.1.0 to 1.1.1 such solutions are easy to mess. The existing linear solution will leave 1.0.0 and give 1.0.1 litres to 1.0.2.

But when it comes to long-term maintenance, the story is often not so simple. For example, the Linux kernel 3.10.* is no longer officially maintained, and the official linear version is no longer available. Therefore, forks inevitably occur, which means that you go from one dimension to n dimensions.

In machine learning, hundreds or thousands of dimensions of data are commonplace.

But with so many dimensions, is it an illusion like the hundreds of thousands of degrees below zero? In superstring theory, the world is 10 dimensional, and once it reaches 10 dimensions, there is only one all-encompassing point in which all possible wires are contained.

We live in four dimensions, without the blessing of general relativity, but still have plenty of experience. Going from four to five was a tough break, but we have Interstellar as a textbook, which is about the five dimensional world.


In four dimensions, we can only go through the past to the future. And if we look at it in five dimensions, we can go back in time and predict the future. After returning to the past, you remembered the girl you had missed and wanted to change history. At the moment history changed, you were already in six dimensions, because the timeline diverged.

Well, since it’s split, why don’t we try all the possibilities? Two lines can define a plane, and there are an infinite number of lines coming out of a point, which is a ball.


We take any two points in the sphere and we draw a line, and that’s a line in seven dimensions. When these two lines meet, they form a new plane, an eight-dimensional space. Two lines can’t just be on one plane and become a three-dimensional body, a nine-dimensional space. All the points in the nine-dimensional space are arbitrarily connected to form a ten-dimensional space. But the current theory holds that a 10-dimensional space contains all possible points, so it can no longer form an 11-dimensional space.

Please note that THIS is not a scientific theory, this is a story. That is to say, we do not want to speculative approach, directly use the most stupid approach, the problem may not be infinite, but may have a boundary.

The logic of the program code may be a little more complicated, such as an infinite loop. However, the purpose of writing the code is not to kill the Code Review system, but to use its power to save as much mental energy as possible.

The story of the man who beat all markets

After telling the story of infinite possibilities being finite, let’s tell the story of a mathematician. As the saying goes, what is bought is not sold. There are probably no more savvy businessmen than those who run casinos, because gambling is a math game. Throughout history there have been countless mathematicians who have studied gambling, and disciplines such as probability theory began in this way. But until Thorpe struck, all mathematicians had concluded that the player could not beat the dealer.

What made Thorpe great was not only his mathematical theory but also his ability to use the most advanced computing power. In 1959, Thorpe used the then advanced IBM mainframe computer to calculate the probability distribution of all possible scenarios for the most player-friendly game, blackjack. Through calculation, it is found that in favor of the player, can be 5% higher than the odds of the house.


But you can’t push an IBM mainframe into a casino, so Thorpe studied feature engineering and concluded that the more small cards in front, the more beneficial the remaining cards are to the player. Thorpe personally to the casino to practice, the casino even sent out a cheating dealer is still to no avail. Thorpe had to be blocked. Thorpe even published a book to guide players and was nearly killed by the casino bosses.

In order to calculate the trajectory of a ball in a more complex roulette wheel, Thorpe and shannon, the father of information theory, built an IoT computing device in a shoe and proved to be effective. It just didn’t take off because the hardware wasn’t stable enough.

But it was only a matter of time before Thorpe was killed by the casino bosses, so he turned to the stock market. He had no background in securities analysis, no knowledge of economics, no inside information, so he turned investing into a mathematical problem, and his solution was to hedge. The method he pioneered is known as quantitative investing and remains one of the mainstream schools of securities markets today.

Thorpe’s algorithm was not open source this time, so three scholars made an open source implementation, and the two surviving ones won the Nobel Prize in economics. The model they introduced is BSM model, which many of you may have learned.

summary

Having said all this, WHAT I want to say is:

  1. What code Review essentially does is roll out all the possibilities for code to run. This can be considered first principles of Code Review.
  2. The complexity of full state expansion is likely to be equivalent to that of induction, and it may be bounded.
  3. According to Thorpe’s story, even if article 2 fails, as long as we can beat other code review systems currently on the market, we will be in business.



Tao department front end – F-X-Team opened micro blog! (Visible after Posting on Weibo)
More team content awaits you in addition to articles at 🔓