Mathematics and experience are the true basis for real, actual and true knowledge
All exact science is dominated by the idea of approximation.
1. In lieu of Introduction
Before presenting the main idea, we think it is necessary to set forth two statements
regarding science in general and legal science in particular. We are not going to prove those two
statements as proving will distract us from the main point.
We suggest you believe that those two statements are true and encourage the readers
to agree that those statements are axiomatic.
First. We believe that the law tends to complete formalization. In
other words, ideally the system of law consists of typographic expressions connected by the rules of
Let us name this system the Law (with capital “L”) to make it simple. We will further
use capital letters to define terms and concepts that are included in the Law to distinguish their
use from customary or ordinary use of language.
Second. We claim that this formal system of expressions alone and
nothing else constitutes the subject of legal science. Economy, society, political order, man’s
psychics do not constitute the subject of legal science. We refer those subjects to other
disciplines (economic science, sociology, political science, psychology).
Those two statements shall make an axiomatic basis for further considerations.
Boundaries and goals of the research.
This article does not claim to be universal. We base the research on a specific case – a sale and
purchase agreement. More than that, we studied a particular court case.
Our goal is to create an algorithm for the sale and purchase agreement by using a
language of formal system. Under the algorithm, we mean the sale and purchase agreement as it is,
not the mechanisms of its performance. Even though we have not set a special task to create a
self-performing agreement, it will inevitably appear if we succeed in fulfilling the main task which
is “to program” at least the sale and purchase agreement.
When fulfilling this task we have come to the idea of creation of a more
comprehensive formal system – the “Law”. Mechanisms that lay a basis for a studied case confirm that
such system is acceptable. In our view, the only one question that remains open is completeness of
interpretation of the Law into a reality or, saying it differently, completeness of interpretation
of the Law into a law. According to our preliminary estimates, most of the private law institutions
can be described in the Law. The reason to this is substantial positivism of both lawmakers and law
enforcement practice (as in provided case № А67-1561/2016). We believe that interpretation of the
Law into legal institutions that are mainly based on the element of judgement is possible by using
the methods of declarative programming. However, we intentionally leave this question out of the
scope to concentrate on the main task.
We will try to prove the theorem on completion (or non-completion) of the Law in
2. Interpretation of law into the Law.
Idea of the Law
Let us start presentation of the topic from a very easy text that may be not customary for the
We believe that this text illustrates the basics of a legal science language in a strict sense and
demonstrates the main elements required for algorithmic description of a sale and purchase
agreement. Its content briefly describes the substance of the Law.
First, the Law as any typographic formal system is a machine-read program.
Second, the Law has an algorithmic system – commands, operands, and functions.
In this article, for the sake of simplicity, we will describe operations of first two elements:
There are only three elementary commands (described in lines 1-15).
Other commands are compound.
2. Operands (lines 26-50).
They are divided in two classes:
- The operands determined by external factors (examples described in lines 113-119).
- The operands created inside the program (examples described in lines 113-167).
The simplest commands.
There are three simple commands of Law:
The command shall be described as follows:
- “Plus” can be translated into ordinary language as «someone got that much of value».
The command shall be described as follows:
- “Minus” can be translated into ordinary language as «someone lost that much of value».
- Plus and minus manage all quantitative objects in the system. Units of measure are not important
– time, money, objects, and persons can be equally used for those commands.
Command shall be described as follows:
Isfact can be translated into ordinary language as «particular external fact launches (or stops)
the following operation». External facts processed by this command turns into Law facts.
However, there is one peculiarity. Any occurrence: event, action and even expression
of will may constitute and external fact for a command. That is why it is a mistake to interpret
this command as a function substantively similar to the term of “legal fact”. In reality this
function is more comprehensive and is responsible for introduction of any external information into
the system, thus, being responsible for operation of such functions as, for instance, “right”,
“legal fact”, and «waiver of a right».
The above three commands are necessary and appropriate for both the Law and its
interpretation into real law institutions.
The commands are interpreted into definition of an obligation (the formal character of the system
presumes that the procedure follows obligatory, mechanical model) and of a right (isfact command
supports operation of various non-mandatory elements of the system in the most efficient way), and
also manage numbers, facts, «conditions» and sequences.
In other words, any operation of the Law (and its interpretation into law) may be
performed by using those three commands or commands that are more complicated and procedures that
are composed from those three. That presumes sufficiency of the list.
We have got the listed commands by multiple division of the more complicated commands of the Law. We
stopped a process of division when further simplification became impossible. This happened, for
instance, to an initially proposed command the «subjectright», which we interpreted at
into definition of «right». Analysis of operations of this command fastened in mind an
idea that its
functions are fully duplicated by the isfact command. As such, it was excluded from the system of
Thus, the above listed commands make the elementary particles of the Law. So,
necessity of the list of commands is presumed.
By this article the authors, among other things, hope to promote among the readers
additional theoretical prove that the mentioned or any other list is necessary and sufficient. That
will enable us to develop the system of the Law. We will appreciate if you send your comments and
proposals to the address below.
Compound commands and operations.
Since the number of combinations of simple commands and operands are almost endless, we will limit
ourselves by mere examples.
That is how a compound command «transfer» can be described:
That is how a compound command «Buyer transfers commodity to seller»:
As you can see the programming mechanism in the Law is customary and primitive. As any formal
system, the Law is formed of simple operations into more complicated ones, thus bringing to life
exact description of any formal procedure. Work with such system requires diligence, especially in
part of recursion functions that will inevitably come up. Other than that, the Law rather simply
describes institutions and «procedures» of law due to formality of the latter.
We think that tendency of law to formalization or, in other words, aspiration of law
to Law is so strong that it is difficult to make an example of legal essence that is impossible to
describe by the Law.
A few words about a term «operand». It includes any data processed by command.
Definition is so obvious that we choose not to concentrate on it. The only reason for us to pay
attention to that definition is to stress the formal character of the Law.
Being a formal system the Law correlates with law as the Lorentz transformation math
formulas correlate with processes of a real living world. Formula is an abstraction. It shall be
interpreted into reality in order to be used in practice, i.e. one shall understand that a set of
letters and symbols characterize a certain real life occurrence. Interpretation error is as a
terrible mistake as an error in the formula itself.
That is why we warn you not to rush when interpreting the definition of «operand».
Operand is not identical to the term of «legal fact» as one who got just familiarized
with the Law can think
Operands mean any data by which commands operate. Persons, property, actual facts,
and time may work as the operands in Law.
We divide operands in two classes – external and internal. Division of operands by
classes is provisional and is caused by the following: external Operands have the endless set of
variables, while internal Operands are determined inside the Law. We proceed from this assumption,
having expected that operands features influence the method of its management.
As you can see, the operands’ classification may fail to coincide even with classical
sections of the private law, not to mention the classification of legal facts.
The class of External operands in the Law.
External operands represent data that is impossible to receive solely within the system.
When interpreting this term into common language one may say that the term of «external operand»
substantially crosses with such definitions as «subject of law», «object of law», «force major», the
areas where the system requires information from outside environment at most.
Let us demonstate a description of simple external operands in our case of a simple sale and purchase
In the Law, the commands of this agreement will require the following external operands:
- Signature of Seller (or Buyer).
That is how they are defined.
«Seller» and «Buyer» for the Russian jurisdiction will be defined by three commands, setting:
- Legal capacity:
Interpretation of command into common language: «If a person is legally capable».
- Age of legal capacity:
This part defines the age of operand and in case the age is above 18 assigns status of coming into
age of legal capacity.
This part defines «health» of operand and in case of negative answer, one more fact is checked –
availability of court:
- Transaction authority
Here we simplified this examination up to the fact of availability of a power of attorney and
correspondence of passport information. Authority under the charter of a legal entity and the
property belonging to an individual can be checked through the similar procedure.
- Thus, the place of a person in the transaction shall be defined in accordance with the following
This part examines, if the operand transfers commodity or money and accordingly refer a person to one
of two categories – a buyer or a seller.
The operand Commodity describes easier:
The command answers the question: «Is it an object or not?».
The signature operand is also simple:
The command answers the question: «Was the agreement signed personally or not?».
The operand Money shall be defined through examination of authenticity:
For our simplified case and the Russian jurisdiction, the command shall confirm their issuance by the
Bank of Russia.
The class of Internal Operands in the Law.
The internal operands are defined mostly by the program itself and usually do not require any
Those operands in our case are:
- Acceptance act.
- Bank account.
The operand Agreement. Agreement in the Law shall be operand formed under the following
It is getting clear how easily legal procedures can be described using the formal system of the Law.
In particular, the procedures of offer and acceptance are described by almost literal citation of
the law, which proves a high degree of formalization of the law.
The Acceptance act is also described easily and do not require a lot of external data. Similar to the
Agreement, the Acceptance act is a result of a legal algorithm, which means that it can be
determined by the programming methods in the Law. The following is an example of the algorithm of
the monthly acceptance:
The Bank account operand is much simpler than the other two internal operands, as it is defined
through the operand Agreement resulting in assignment of individual number to the operand «Person»
for accounting of the operand «Money».
Example of operation of Law.
Let us design a Law fragment using a share and purchase agreement as a sample.
Based on the above, the part 1 of Article 454 of the Civil code of the Russian
Federation shall be set out as follows:
Where all terms are defined above in this article.
As you can see, the algorithm set forth in the sale and purchase agreement of law can
be word-by-word transfromed into the sale and purchase agreement of the Law using the tools of
object-oriented programming. We intentionally simplified certain aspects of law (for instance, in
the process of determination of legal capacity or authority) and the Law (by excluding at this point
elements of functional programming). We did this for clarity and preservation of logic, to which
lawyers get accustomed to. However, even this simplified program of the Law will operate.
3. Practical Use.
We assume that benefits of use of mathematical methods in law does not require separate reasoning. We
will just briefly list the most obvious advantages of that approach.
Internationality of Law.
Being a formal system, the Law does not have national boundaries. Three simple
commands are necessary and sufficient for the Law irrespective of jurisdiction.
Regarding operands, we emanate from the assumption that their multitude is also the
same for any jurisdiction. The reason is as follows: external operands are formed by actual facts of
reality, which does not depend on jurisdiction, while internal operands are formed by the system,
which means that the list will also be the same due to independence of the system.
This means that the Law may exist as a program for any jurisdiction. The only
difference will be the interpretation of operands and scenarios of decision making depending on
conditions of operands and external events.
Terminology of typographic formal system presumes impossibility of dual
Ideally, the Law is performed by programming means independently. Participation of a
human being is required only at the stage of programming, for data (operands) input, defining their
conditions or for determination of external events (unless they happen automatically, for example –
source of event external reliable system). In case of waiting for occurrence of external event
algorithm will continue performance, provided that the conditions that have been set forth in
activation function are fulfilled. We will describe activation functions and specifics of its
operations in next articles.
The result of operation of the Law may materialize in both self-performance and
printing human-readable text.
In other words programming of so-called smart-contracts using the Law is not the most
important achievement, though the Law shall seriously simplify their formation. The Law as a program
shall not necessarily perform any legally binding actions, the Law may only print out text in a form
of, for example, agreement by converting (interpreting) commands, operations and functions of the
system into a human-readable text.
All you need for that is introduction of interpretation rules into the system.
As an example, we may refer to the above operation set forth in Article 454
of the Civil code of the Russian Federation:
The interpretation rules are described as follows:
- [producer] transfer (product) = «shall transfer Commodity [to the ownership of
- [consumer] transfer (product) = «shall accept Commodity»,
- transfer (money) = «pay»,
The result of operation the following text is printed out:
«Seller shall transfer Commodity to the ownership of Buyer, Buyer shall accept
Commodity and pay».
Therefore, the Law presupposes univocal understanding of the text created by command.
A judge will have to apply to program and define the mechanism of its operations in order to
determine if the agreement has been concluded. Only one conclusion can be inferred due to formal
character of the system.
Analysis of legal acts, transactions.
The Law also allows studying characteristics of the substance created in the systemof
, for example, the supply contract described above. In addition to examination of stability and
flexibility of a system of the Agreement, the Law enables to construct a model of performance of
Thus, we are not just studying the available text or breach of the contract that has
already occurred, but we may predict future performance of the agreement by calculating it with
mathematical accuracy. A model of such development can be drawn as a graph.
The lawyer`s contractual work in reality is very close to the programming. Lawyer
creates algorithm of a transaction. Drafting of a sale and purchase agreement is a good example in
support of this statement, in spite of the choice of common human language, which is far from being
formal, for creation of algorithm. There is only one difference from the machine program – lawyers
does not use machines to create an algorithm, instead they use common language with the elements of
formalization. That is why algorithm of transaction may often fail and that is why even a higher
degree of formalization constitutes the basis for development of legal system. Sometimes, the text
is so detailed and well-thought that there is only one step left to real programming, which is
application of a language of formal mathematical system.
At the same time the programming is developing. Creation of self-performing
agreements (so-called smart-contracts) is the programming. Lawyer plays a secondary role in this
process. His task is to explain by common language to a programmer the terms and conditions of the
contract, which the programmer shall translate into the formal programming language.
The irony is that lawyer shall take a formalized legal text from the shelf, translate
this text into common language, and then a programmer shall translate this text back again into a
formal language, but this time a different one – the machine language. The process reminds the game
where one poem is translated from one language into another and then back to the first language. The
resulting content of the poem sometimes is difficult to recognize..
The Law system eliminates this oddity. The Law operations can be processed in any
programming language, which level is high enough (parsing). This makes possible for a lawyer to
draft a program of smart-contract from the very beginning irrespective of the technology he is going
to use for drafting.
We are planning to upload first simple libraries to make parsing possible in the
Internet at the following address: speranskylabs.com
We hope to get a feedback from our readers to upgrade the uploaded materials.
4. Theoretical benefit.
Inexact science does not exist. Legal science is not an exemption from this.
Human knowledge is called science because it is systematized and sealed by the rules
of logic. That means that any science consists of knowledge about facts and mathematical
Further development of knowledge may follow the path of intuition, experiment,
fantasy, however the stages of facts classification and introduction of mathematical apparatus
cannot be missed. If these stages are missed that means we deal with collecting and guessing.
The science of law is at the initial stage of its development in this regard. The
main studies concentrate around discussions on definitions – what are legal relations, what is
responsibility, what are the subjects and objects of the law. Sometimes this discussion addresses
narrower concepts, such as property law or the concept of transaction; however, it remains within
the limits of search for definitions. Thus, the science of law is concentrated mainly on collecting
facts and attempts of their classification.
Once again, the law has a tendency to formalization. In other words, law looks toward
the Law. It is impossible for law to reach a complete formalization, but it is not required, as
complete formalization would mean the end of research.
As demonstrated in the presented case, law is formalized enough to make the use of
mathematical methods of its study possible.
This statement becomes even clearer in comparison with physics. Physics as a science
with its extensive mathematical tools describes the phenomena much more complicated than legal
institutions. The physical reality is richer and less formalized than law. However, physicists are
successful in studying the reality using mathematical methods. Why lawyers, who study one of the
most formalized phenomena of the reality – system of rules of behavior, can’t do the same?
We see the purpose of this article in formation of a new approach that would allow
concentrating on study of this subject using those methods which other sciences successfully apply
with exclusion of dilution of research boundaries. Lawyers study economic theory, sociology,
political science, philosophy and sometimes anything else, but not the characteristics of formal
system which are available to them.
The model of the research that we propose includes the following two parts:
- Study of law as a formal system that provides undeniable advantage by allowing use of
mathematical tools in the process of research.
- Use of external data without imposing burden of their proof on legal science; such proof shall
be a subject of other scientific disciplines.
In lieu of conclusion.
We believe that legal science, being at the first stage of its development,
thoroughly defined the terms that made its subject. However, study of the system of law currently
has not been received sufficient attention
The situation reminds of a city where there are many traffic lights and the city
administration, instead of focusing on the proper work of the whole light system, argues what
traffic light is, classifying it by types and groups
Our articles pursue the only goal – to raise interest to the proposed method of law study. We
consider it as the first step in this direction.
We are sure that proposed approach will not just bring the law research to a new
level, but also allows researchers to sincerely enjoy it.
The authors experienced an incomparable enjoyment and even surprise having discovered
that the Law (and law as well) can be managed by only three commands and its variety is obtained
through the extensive network of operands.
Probably that fact explains why legal students always have good memory, but not
always are required to study logic often merely disgusted with mathematics. This disadvantageously
distinguish them from technical students and probably impede use of mathematical methods in law.
We understand that the proposed system is incomplete and may contain errors and
inaccuracy being a mere example of possible development. That is why we hope to develop our idea in
further articles and ask for a feedback from the readers.
In addition to classical response to our article in traditional printed sources, we
hope to receive your responses in regard to correction of the inaccuracies, addition of new elements
or direct questions.
We appreciate your feedback sent to the following Internet websites:
speranskylabs.com , speranskylabs.ru.
 Case № А67-1561/2016 // Consultant plus.
 For clarity, we intentionally simplified function of «legal
capacity», without addressing complicated cases of limited legal capacity or emancipation. It is
obvious that a reader understands how simple this task is.
 Content will be subject to GPL to allow everyone to use the results
of our joint efforts.
We carefully monitor the attempts of using math methods in law. However, the most serious attempt so
far was attempt to construct axiomatic system of law principles. The author of a thesis attempted to
take principles of the
Constitution of the Russian Federation
as axioms and tried to construe rules
of Civil Code of the Russian Federation, for example, as theorems deriving from them. We think
this attempt was not successful. The reason is lack of direct logical connection between the firsts
and the seconds. We think that only treatment of law, as algorithm will enable to construct such
system simply because it would be possible to work with obvious contradictions of the system.