There are three main areas in modern programming: algorithmic, statistical, and logical. The most important role is played by algorithmic programming. This is approximately 99% of all existing programs, including websites, operating systems, text editors and computer games. The statistical direction allows us to solve some specific problems that could not be solved algorithmically. It is rapidly progressing now: neural networks, big data, machine learning are all different names for about the same thing. The logical direction is also successfully used for a certain range of tasks, but due to the lack of striking successes in recent years, the interest of the general public (including the legal) in it has clearly decreased. Nevertheless, in our opinion, if law can be connected with programming, then, first of all, through logic (coincidence?).

One of the first applications of the logical approach to artificial intelligence was chess (as well as checkers, etc.) programs. Let’s take a look at the example of chess simply because it is a good example in fact and everyone knows about chess.

For those who are unfamiliar with this ancient game, we will analyze the same with the example of school algebra, and in conclusion we will talk about the prospects of applying this approach to legal problems.

Any logical program should consist of at least the following components:

1. formal language with which you can describe any situation from the field in question;

2. a list or rules for constructing legal expressions given in terms of this formal language;

3. rules for the transition from one legal expression to another, formulated in terms of a formal language;

4. a description of the initial expression and one or more possible final expressions given in a formal language;

5. an analytical machine that moves from one legal expression to another, trying to build a path from the initial state to the final one. If this succeeds, then the problem is solved, if not, then it does not have a solution or is incorrectly formulated.

It seems too complicated, but in fact everyone has come across this in one form or another. For example, in chess:

1. Formal language. The usual chess notation is suitable, where the pieces are indicated by the first letter, and their position on the board by alphanumeric coordinates. For example, “Kb3” means that the king is on the vertical b and horizontal

2.The rules for constructing legal expressions directly follow from the chess rules: two kings cannot stand side by side, there cannot be a check for both kings, a pawn cannot be on the extreme horizontal, etc. All this can be formulated in terms of chess notation if desired. For example, it is clear that the position “White: Kf1 Black: Kf3” is legal, and “White: Kf1 Black: Kf2” is not.

3. In fact, the rules of chess are devoted to the rules of transition from one legal position to another: the elephant moves along the diagonal, and the horse - with the letter "ge". To rewrite them in terms of chess notation, you have to try pretty hard, especially taking into account such troubles as castling and taking in the aisle ... But believe me, any programmer (and just anyone who wants it) will cope with such a task sooner or later.

4. Everything is clear with the initial situation, but the final situation is a mate. For it, there are clear criteria that can also be formalized.

5. Analytical machine. There is nothing fundamentally complicated here. If you have successfully dealt with points 2 and 3, you can safely call any programmer who does not even play chess at all, who implements a search of all (transitions to) legal positions (but in fact already texts!), And your first chess program is ready. Congratulations! Do not expect miracles from it, but it will click the task “checkmate in 3 moves” like nuts.

If you don’t have a programmer at hand, you will have to sort out the options yourself, which is what chess players do at the board. Since in most positions it is impossible to count to a mat even on modern supercomputers, real chess programs are arranged somewhat more complicated. But the principle is the same.

Now let's see how this approach works in the example of algebra.

1. We do not need to invent a formal language. Unlike chess, we were all taught it against our will back in school.

2. The rules for writing legal expressions are also understandable: the number of brackets to open should be equal to the number of closing brackets, etc.

3. The rules of the transition from one legal expression to another are also painfully familiar to everyone: “the sum does not change from the rearrangement of terms”, etc. Or you can immediately write in terms of a formal language: a + b = b + a, aa = a2, a ( b + c) = ab + ac, a + a = 2a, etc.

4. As an initial expression we take, for example, (x + 1) 2, and the description of the final expression depends on what problem we want to solve. If “open the brackets”, then in the final expression there should not be brackets.

5. Again, we call the programmer to slightly correct the analytical machine from the previous example, and our simple algebraic calculator is ready. In a split second, he will demonstrate what students learn for months: (x + 1) 2 = (x + 1) (x + 1) = (x + 1) x + (x + 1) = xx + x + x + 1 = x2 + 2x + 1

Please note that neither in the first nor in the second case did the programmer require knowledge of the subject area. We formulated all our chess and mathematical knowledge in a formal language, after which the programmer needed to work exclusively with textual data. And that’s exactly what all programmers can do!

**Can the same approach be applied in legal tasks? Let's sort through the points.**

1. Formal language. He is not yet. And it is not clear who and how will be able to compose it. Throughout their history, lawyers have been trying to get away from natural language with all its contradictions and ambiguities. As a result, the language turned out to be boring enough to be incomprehensible to a simple layman, and not formal enough to be understood by the machine.

2. Rules for writing legal expressions. There will be something like “a judge cannot be a victim at the same time”, it is impossible to appeal a court decision before its announcement, etc. We can formulate this in any language: human, at least formal.

3. Rules for the transition from one legal expression to another. These are the ordinary laws of logic. Directly according to Aristotle: "If all people are mortal and Socrates is a man, then Socrates is mortal."

4. The initial expression is, for example, case materials recorded in a formal language. The final expression then is a judgment.

5. Analytical machine. It will differ little from the analytical machine for chess, computer algebra, and other similar tasks.

As you can see, from the significant progress in the computerization of legal activity, we are separated “only” by the absence of a formal legal language. As soon as someone succeeds in creating it, the entire legal sphere will face the same transformation that happened in mathematics after the invention of computers.

It should be noted that mathematical notation was of great benefit long before the advent of computers: bulky verbose entries were simplified significantly, the language and concepts were unified, logical transitions became easily verifiable, and the calculation technique was simplified to the point that they could now explain it in elementary school. There is no doubt that the development and formalization of the legal language should lead to approximately the same consequences as in mathematics: logical transitions will become more understandable and schematic, and therefore accessible for verification, the number of gross errors will decrease sharply, and somewhere in half a century the future second-graders between the lessons of arithmetic and English grammar will begin to comprehend the basics of legal technology along with life safety or other lessons that affect social norms. And then computer programs will catch up with them.

In conclusion, before the emergence of a formal legal language and artificial intelligence on its basis, it is impossible to seriously talk about the practical application of blockchain technology and smart contracts. Because no other way is visible to program at least the simplest legal concepts. Or does someone really believe that artificial intelligence should help a lawyer sniff out the notorious “spirit of law”?