In today's world, we are increasingly using a variety of cars and gadgets. And not only when it is necessary to use literally inhuman force: move the load, raise it to a height, dig a long and deep trench, etc. Cars collect robots today, multicookers cook food, and calculators perform elementary arithmetic calculations. Increasingly, we hear the expression "Boolean algebra." Perhaps the time has come to understand the role of man in creating robots and the ability of machines to solve not only mathematical, but also logical problems.
Logics
Translated from Greek, logic is an ordered system of thinking that creates relationships between given conditions and allows us to make conclusions based on assumptions and assumptions. Quite often we ask each other: “Is it logical?” The received answer confirms our assumptions or criticizes the train of thought. But the process does not stop: we continue to reason.
Sometimes the number of conditions (introductory) is so great, and the interconnections between them are so confusing and complex that the human brain is not able to "digest" everything at once. It may take more than one month (week, year) to understand what is happening. But modern life does not give us such time intervals for decision-making. And we resort to the help of computers. And here the algebra of logic appears, with its own laws and properties. Having downloaded all the initial data, we allow the computer to recognize all the relationships, eliminate contradictions and find a satisfactory solution.
Mathematics and Logic
The most famous Gottfried Wilhelm Leibniz formulated the concept of “mathematical logic”, the tasks of which were accessible for understanding only to a narrow circle of scientists. This area did not cause much interest, and until the middle of the XIX century, few knew about mathematical logic.
Of great interest in the scientific community was a dispute in which the Englishman George Bull announced his intention to create a branch of mathematics that has absolutely no practical application. As we remember from history, industrial production was actively developing at that time, all kinds of auxiliary machines and machine tools were being developed, that is, all scientific discoveries had a practical orientation.
Looking ahead, we say that Boolean algebra is the most used part of mathematics in the modern world. So, Boule lost his argument.
George Bull
The very personality of the author deserves special attention. Even considering the fact that in the past people grew older than us, it is still impossible not to note that at the age of 16, J. Bull taught at a village school, and by the age of 20 opened his own school in Lincoln. The mathematician was fluent in five foreign languages, and in his free time he read out the works of Newton and Lagrange. And all this is about the son of a simple worker!
In 1839, Boole first sent his scientific work to the Cambridge Mathematical Journal. The scientist turned 24 years old. The work of Boole was so interested in the members of the Royal Scientific Society that in 1844 he received a medal for his contribution to the development of mathematical analysis. A few more published works that described the elements of mathematical logic allowed the young mathematician to become a professor at Cork County College. Recall that Buhl himself had no education.
Idea
In principle, Boolean algebra is very simple. There are statements (logical expressions), which, from the point of view of mathematics, can be defined only in two words: “truth” or “false”. For example, in spring, trees bloom - true, in summer it snows - a lie. The whole charm of this mathematics is that there is no strict need to use only numbers. For propositional algebra, any statements with unambiguous meaning are quite suitable.
Thus, the algebra of logic can be used literally everywhere: in scheduling and writing instructions, analyzing conflicting information about events and determining the sequence of actions. The most important thing is to understand that it is completely unimportant how we determined the truth or falsity of the statement. From these “how” and “why” you need to abstract. What matters is only a statement of fact: true-false.
Of course, for programming, the functions of the algebra of logic are important, which are written with the corresponding signs and symbols. And to learn them is to learn a new foreign language. Nothing is impossible.
Basic concepts and definitions
Without going into the depths, we will deal with terminology. So, Boolean algebra implies the presence of:
- utterances;
- logical operations;
- functions and laws.
Statements are any affirmative expressions that cannot be interpreted ambiguously. They are written in the form of numbers (5> 3) or are formulated in the usual words (the elephant is the largest mammal). Moreover, the phrase “the giraffe has no neck” also has a right to exist, only Boolean algebra will define it as “false”.
All statements should be unambiguous, but they can be elementary and composite. The latter use logical connectives. That is, in the algebra of judgments, compound statements are formed by adding elementary ones through logical operations.
Boolean algebra operations
We already remember that operations in the algebra of propositions are logical. Just as the algebra of numbers uses arithmetic operations to add, subtract or compare numbers, the elements of mathematical logic allow you to make complex statements, give a negation or calculate the final result.
Logical operations for formalization and simplicity are written down by formulas familiar to us in arithmetic. The properties of Boolean algebra make it possible to write down equations and calculate unknowns. Logical operations are usually written using a truth table. Its columns define the elements of the calculations and the operation that is performed on them, and the rows show the result of the calculations.
Basic logic actions
The most common operations in Boolean algebra are denial (NOT) and logical AND and OR. So you can describe almost all the actions in the algebra of propositions. We study in more detail each of the three operations.
Negation (not) applies to only one element (operand). Therefore, the negation operation is called unary. To write the concept of “not A”, the following symbols are used: ¬A, A¯¯¯ or! A. In tabular form, it looks like this:
The negation function is characterized by the following statement: if A is true, then B is false. For example, the moon revolves around the earth - the truth; Earth revolves around the moon - a lie.
Logical Multiplication and Addition
Logical AND is called a conjunction operation. What does it mean? First, that it can be applied to two operands, i.e., And is a binary operation. Secondly, that only in the case of the truth of both operands (both A and B) is the expression itself true. The proverb “Patience and labor will rub everything” assumes that only both factors will help a person to cope with difficulties.
Symbols are used for recording: A∧B, A⋅B or A && B.
Conjunction is similar to multiplication in arithmetic. Sometimes they say so - logical multiplication. If we multiply the table elements row by row, we get a result similar to logical thinking.
A disjunction is a logical OR operation. It assumes the value of truth when at least one of the statements is true (either A or B). It is written like this: A∨B, A + B or A || B. The truth tables for these operations are as follows:
Disjunction is like arithmetic addition. The logical addition operation has only one limitation: 1 + 1 = 1. But we remember that in digital format, mathematical logic is limited to 0 and 1 (where 1 is true, 0 is false). For example, the statement “you can see a masterpiece in a museum or meet an interesting conversationalist” means that you can see works of art, or you can meet an interesting person. At the same time, the possibility of simultaneously accomplishing both events is not ruled out.
Functions and Laws
So, we already know what logical operations the Boolean algebra uses. The functions describe all the properties of the elements of mathematical logic and make it possible to simplify complex compound conditions of problems. The most understandable and simplest property is the rejection of derivative operations. Derivatives are understood as exclusive OR, implication and equivalence. Since we familiarized ourselves only with the basic operations, we will also consider properties only of them.
Associativity means that in statements like “A, B, and C,” the sequence of listing the operands does not play a role. The formula is written as follows:
(A∧B) ∧B = A∧ (B∧V) = A∧B∧V,
(A∨B) ∨B = A∨ (B∨V) = A∨B∨V.
As you can see, this is not only characteristic of conjunctions, but also disjunctions.
Commutativity claims that the result of a conjunction or disjunction does not depend on which element was considered at the beginning:
A∧B = B∧A; A∨B = B∨A.
Distribution allows you to open brackets in complex logical expressions. The rules are similar to opening brackets for multiplication and addition in algebra:
A∧ (B∨V) = A∧B∨A∧B; A∨B∧V = (A∨B) ∧ (A∨B).
The properties of unity and zero , which can be one of the operands, are also similar to algebraic multiplication by zero or one and addition to unity:
A∧0 = 0, A∧1 = A; A∨0 = A, A∨1 = 1.
Idempotency tells us that if, with respect to two equal operands, the result of the operation turns out to be similar, then we can throw away the extra operands that complicate the course of reasoning. Both conjunction and disjunction are idempotent operations.
B∧B = B; B∨B = B.
Absorption also allows us to simplify equations. Absorption claims that when another operation with the same element is applied to an expression with one operand, the result is the operand from the absorption operation.
A∧B∨B = B; (A∨B) ∧B = B.
Sequence of operations
The sequence of operations is of no small importance. Actually, as for algebra, there is a priority of functions that Boolean algebra uses. Formulas can be simplified only if the significance of the operations is respected. Ranking from the most significant to minor, we get the following sequence:
1. Denial.
2. The conjunction.
3. Exclusive OR Disjunction.
4. Implication, equivalence.
As we see, only negation and conjunction do not have equal priorities. And the priority of disjunction and exclusive OR are equal, as are the priorities of implication and equivalence.
Implication and equivalence functions
As we have already said, in addition to the basic logical operations, mathematical logic and theory of algorithms uses derivatives. Most often, implication and equivalence are used.
An implication, or logical following, is a statement in which one action is a condition and the other is a consequence of its execution. In other words, this sentence with the pretexts "if ... then." "Do you like to ride, love and carry a sleigh." That is, to ride it is necessary to tighten the sled to the hill. If there is no desire to move down the mountain, then you don’t have to carry a sled either. It is written like this: A → B or A⇒B.
Equivalence assumes that the resulting action occurs only when both operands are true. For example, night is replaced by day if (and only if) when the sun rises from the horizon. In the language of mathematical logic, this statement is written as follows: A≡B, A⇔B, A == B.
Other laws of Boolean algebra
The algebra of propositions is developing, and many interested scientists have formulated new laws. The most famous are the postulates of the Scottish mathematician O. de Morgan. He noticed and defined properties such as close negation, complement, and double negation.
A close negation suggests that there is not a single negation in front of the bracket: not (A or B) = not A or NOT B.
When the operand is denied, regardless of its value, they say about the addition :
∧¬ = 0; ∨¬ = 1.
And finally, double negation compensates itself. Those. before the operand, negation either disappears or only one remains.
How to solve tests
Mathematical logic implies the simplification of given equations. Just as in algebra, you must first lighten the condition as much as possible (get rid of complex inputs and operations with them), and then proceed with the search for the correct answer.
What to do to simplify? Convert all derived operations to simple ones. Then open all the brackets (or vice versa, put them out in brackets to reduce this element). The next step should be the application of the properties of Boolean algebra in practice (absorption, properties of zero and one, etc.).
Ultimately, the equation should consist of a minimum number of unknowns, combined by simple operations. The easiest way to find a solution is if you get a lot of cramped denials. Then the answer will pop up as if by itself.